Skip to content


All jobs are equally important

I recently heard someone claiming that all jobs are equally important and that everyone deserves to be compensated fairly for their work. The second half of this is uncontroversial; defining what is fair is the sticky part.

But equally important? For any particular goal, you will find some jobs that are essential to achieving it, some that are useful, some that are irrelevant, and some that impair it. For instance, if you are trying to preserve a pristine environment, the job of Exxon executive would be better left unfilled. If you want to keep people alive and heal their injuries, then paramedics, doctors, nurses, and orderlies are essential, as are people who manufacture items they use in their work, while athletes are counterproductive, since they tend to injure themselves and each other.

If you can assign each goal a weight (perhaps by scoring how much each person values it and summing up across all people) and then score each job on how important it is to fulfilling that goal, you can then sum them and get an indication of how important each job is. And while it’s technically possible that all jobs will have an equal score, it’s only a mathematical possibility. On the other hand, it’s also pretty unlikely that our current compensation schemes fit this.

I think the intention here was to ensure that nobody should be called stupid or worthless based on their career choice. Adding to that, nobody should be forced into a job, and everyone should have a certain standard of living. But it’s hardly true that all possible careers are equally valuable to a society. When the Huns are knocking on the gates, you want archers more than basket weavers.

Posted in Uncategorized.


Inverted qualia: why should you care?

Let’s take a page from popular philosophy. Consider two people, Kevin and Nivek. Kevin looks at a ripe beefsteak tomato, a stop sign, and the Chinese flag and gets a certain mental state in common between those experiences: the color red. We’ll call that experience “flobber”. Nivek looks at some grass and a leprechaun and a US dollar bill and also has the mental experience “flobber”.

This is called “inverted qualia”. It is conceivable that someone has inverted qualia, but conceivable doesn’t mean possible. Nobody has managed to test whether it happens. Is it possible?

With enough knowledge of neurobiology, I would be able to remap your optic nerve so that your L cones are remapped to the nerves that serviced your S cones previously and vice versa. This wouldn’t be precisely inverted qualia, but it would be a radical alteration, which is sufficient for our purposes. That’s one way you could achieve this result.

Of course, that’s pretty similar to another way of achieving the result. Strap a pair of goggles on an infant. These goggles have a high-resolution display on the inside and cameras on the outside. In between, there is a computer that remaps colors. Now, this infant will grow up with the experience of green light where I see red light.

Your instinct might be that the second is cheating. Well, then the first probably is, too. It’s a simple inversion well before any interesting processing can happen.

Recall the remapping I did in the optic nerve? I’m going to keep doing the same thing, but I’m going to distribute that functionality throughout your visual cortex along the paths from the optic nerve. Is this any different than the goggles? It seems the same to me.

Going further, let’s say I restructure your visual cortex in some more fundamental way, rather than inverting the input crudely. At that point, it’s probably going to be difficult to compare what’s going on in each brain on a physical level because I went in and changed everything around. We no longer have the ability to compare analogous qualia using a super-duper fMRI (or epiphenomenal consciousness dowsing rod or what have you); the qualia are no longer comparable.

That’s how it seems to me, anyway.

But even if it’s possible to get inverted qualia that isn’t analogous to wearing color-shift goggles, what do we care? It’s entirely compatible with physicalism. It’s compatible with functionalism; a functionalist would gloss over the difference, and refer to the color qualium experienced by both me and my color-inverted cousin as “the qualia produced by experiencing stop signs, ripe beefsteak tomatoes, blood, and the Chinese flag”, even if they are represented differently. There’s a lot to be said for that approach.

Maybe it’s an argument against behaviorism, but that’s already unpopular; it doesn’t capture the fact that different attitudes and beliefs might account for the same behavior.

What is inverted qualia good for?

Posted in Uncategorized.


Kalam Cosmological Argument

I’ve heard a lot about the Kalam cosmological argument lately. It’s a very simple argument:

  1. Whatever begins to exist has a cause.
  2. The universe began to exist.
  3. Therefore the universe has a cause.

Craig goes on to say this cause must be some agent, but he has no justification for this, so I’ll ignore it here. The portion of the argument I presented is well-formed; if the premises are correct, the conclusion is true. So let’s examine the premises.

Whatever begins to exist has a cause.

A cause, in this case, is some set of circumstances sufficient to allow for the thing to exist, though those circumstances do not necessarily necessitate that such a thing start to exist. For instance, virtual particles pop into and out of existence frequently in a vacuum. They can do this because there’s energy in that vacuum, and the structure of the universe allows this energy to occasionally transform into particles. This is somewhat contrary to our common notion of causation; in this sense, I could say that I caused a banana to be chopped by putting a knife beside it, when someone else chose whether to chop it or not.

The justification for this premise is common intuition. This fails in two ways. First, we stopped talking about the common sense of “cause” and started talking about a specific technical term. Our intuitions don’t speak about this concept nearly as well. And second, our intuitions fail miserably at physics. Our brains are wired for Aristotelian physics, where, for instance, a space ship has a maximum speed rather than a maximum acceleration. We haven’t caught up to Newtonian physics, much less quantum physics. Our intuitions are a poor guide here.

It does, however, seem to be something of a stretch to say that something can begin to exist without any preconditions. In point of fact, for anything to exist, there needs to be an environment with sufficient structure to allow things to exist. So I can give him this one, though I’ll have to note that it’s a very weak sort of cause that he’s positing.

The universe began to exist.

Craig says that if the universe did not begin to exist, we would have an infinitely long past. This is due to a confusion that is likely common, so I will take some time to explain it.

Time is a part of the universe. Our universe contains time. If you flattened out one of our spacial dimensions so we’re living in Flatland, you could then rotate our universe so that time becomes a third spacial dimension. That’s essentially what our universe would look like from the outside — you would look like a spaghetti strand winding your way from birth to death, with each possible cross section being your body at a particular point in time. And that strand would be made up of smaller strands, each one representing an atom, with their origins being inside the cores of stars that died billions of years ago.

The universe itself would be a giant braid of all the individual strands that make up the smallest possible particles. And that braid would have an end where all the tiny strands come to one point. We don’t know what happens on the other end.

Craig is saying that, because this braid (our universe) has one end, there was a time when this braid didn’t exist.

But time is part of the braid. Time is the structure of the braid. In order for our universe to begin to exist, it would need to exist in something time-like existing outside our universe. How does Dr Craig know that there is some sort of time external to our universe? Without knowing that, we can’t say whether our universe began to exist.

Dr Craig, however, is not claiming that there is any sort of time outside our universe. He is instead conflating time inside our universe with time in which our universe exists. It is a simple fallacy of equivocation.

The universe has a cause.

As we discussed earlier, the form of “cause” here is very weak, so let me reformulate that properly: The universe began to exist in circumstances sufficient to allow its existence.

That formulation sounds pretty weak, doesn’t it? But we don’t know that the universe began to exist, so we can’t even accept this weak formulation.

Bonus: Getting to God

Dr Craig attempts to get from “the universe has a cause” to “this cause must be God”. A cause outside the universe, he claims, cannot be material, which means it must be a mind or an abstract concept; and since abstract concepts cannot cause anything, that only leaves a mind.

This ignores the possibility of a multiverse, if you will, containing other types of material objects that might not be supported in the laws of physics native to our universe. There are likely some other possibilities we haven’t thought of yet.

It additionally assumes a type of dualism in which minds exist outside time, which really puts a damper on character development. Fortunately, these minds can act inside the quasi-time in which our universe was created, so there’s some hope for us. But we have no reason to think, assuming there’s a quasi-time outside the universe, that this is connected in any way to our universe’s time, so there’s not a lot of hope.

Conclusion

There’s no reason to subscribe to Kalam. This is fortunate; since Kalam requires some quasi-time in which the universe exists, if it did work, we’d find an infinite regress, and we generally don’t like the idea of infinities existing.

Even if we accepted Kalam, there is no reason to assume that God is the source for our universe.

Posted in Uncategorized.


Thinking in DSLs

In preparation for Ludum Dare, I’m writing a little side-scrolling shooter. I took some time to think of what sort of format I should use for storing a level. I thought of Tiled, which would work…but I found that I wanted to assign a function or path for each enemy ship, which would be cumbersome. Specifically, I’d have to write a parser for infix-notation math, including sine and friends most likely. And this wasn’t going to allow for any code reuse, annoyingly.

My next thought was to create a DSL in Boo. I sketched out what I wanted it to look like. Two minutes gave me something I was vaguely happy with. Only problem, I don’t know how to implement a DSL in Boo. I could learn, but I suspect it would take me more time than Ludum Dare gives me to implement one and integrate it with my project.

But why use Boo? I immediately thought: what prevents me from doing the same things in C#?

Well, nothing.

I rewrote my DSL example in plain C#. It would take maybe fifty lines of code to support that, whereas a DSL would take more like five times that, and a custom math parser on top of tiled would take even longer. Plus, this gives me fast access to all my code, so I can easily break out of the standard stuff if I need to.

But thinking in terms of a DSL gave me an API that is much nicer than anything I would otherwise have come up with.

Posted in Uncategorized.


Surgery!

I recently underwent some minor surgery — exposing some impacted teeth — and here’s a partial account of how my surgery went.

To start with, the orderly / nurse applied nitrous oxide via a nasal mask. The pressure was a tad low, and initially I was troubled by this. However, I very quickly became lethargic, and didn’t bother talking to anyone about it. It wasn’t a big deal, as I could breathe deeply to get enough air.

I had about two waves of mild euphoria. I began laughing over nothing. I noticed this, however, and managed to drive back the feeling and stop laughing very quickly.

I began to feel a tingling sensation spreading out from my face. It affected my right arm well before my left, and eventually spread to my feet. It disappeared in roughly the same order.

The nurse / doctor introduced an IV needle into my left arm. I was awake for this, and noticed the full effects as if I had not received nitrous oxide (assuming the needle was inserted skillfully). However, I cared less about it than I normally would, due, I believe, to the nitrous oxide.

My sense of time was severely distorted once the intravenous drip started, as was my short-term memory. I believe I was unconscious for most of the time, but this was not necessarily the case. I did not remember waking up during the procedure, though I remember several times feeling pain and indicating that I needed more anesthetic. I think this happened between three and five times. When this happened, I recall reacting strongly — it felt like I convulsed due to pain. I do not recall feeling pain significant enough for me to convulse, however.

For most of the procedure, I saw nothing. I had to make an effort to keep my eyes open, and with the lethargy supplied by the nitrous oxide (and probably the intravenous anesthetic as well), I wasn’t about to expend any effort. Except for communication.

During the initial phase, I made an effort to be alert and pay attention to my surroundings and what effects the drugs were having. I didn’t have anything in particular to concentrate on, so I couldn’t test to any reasonable degree how well I was thinking, except during conversation. I found myself at, I think, no more than half speed there. I had my sense of humor, but it took about four times as long to put together a statement as it should have. (Specifically, I was rate-limited by my brain, and that reduced my conversation speed. Normally I am not noticeably rate-limited by my brain.)

I found myself wondering whether anesthetics perhaps do not dull pain but instead cause you to forget about it afterward, and in the meantime prevent you from moving. There are ways to tell, I’m certain — EEG studies and all — and I assume these have been done. I didn’t manage to think nearly that far.

I’m kind of scared that this impaired my thinking to such a degree. No more than going 48 hours without sleep would have done, I’m guessing, but still.

Posted in Uncategorized.


Spring is the devil

Spring is evil.

Older versions of Spring required you to write gobs of XML to do anything.

Newer versions of Spring merely make you wish for those days.

I had a relatively simple setup:

@Component
public class Processor {
    @Autowired
    public Processor(@Qualifier("foo") List<SubProcessor> subprocessors) {}
}

I added a configuration class:

@Configuration
public class Config {
    @Bean("foo")
    public List<SubProcessor> subprocessors() { ... }
}

Somehow, Spring managed to suss out the generic parameters for Processor’s constructor arguments, then went off looking for the implementations directly. If it had managed to find all the implementations, I’d have been impressed and relatively happy. (I wanted the subprocessors in a particular order, but that’s a minor thing.)

But no. Spring died at that point. It couldn’t find any implementations, it said. I had five.

I ended up getting around its stupidity eventually, though: I changed the types everywhere to Object and Spring shut up.

Seriously, I didn’t have anywhere near this much trouble with .NET. What’s going wrong with Java? I can’t even use Spring as a service locator. I’d get better utility out of a hash table.

Posted in Uncategorized.


Implementing a JUnit Test Runner

Today, we’re going to look into implementing a custom test runner for junit 4. The features we’re targeting are:

  • Feature parity with the standard runner (expected exceptions, @Before/@After, @BeforeClass/@AfterClass)
  • Per-test parameterization (with appropriate output formatting)
  • Expected exceptions (like in the standard runner)
  • Performance enforcement (stop and fail tests after N milliseconds)

So let’s open up our favorite editor and start hacking.

Basic structure

Our test runner must inherit from the abstract class org.junit.runner.Runner, which provides some restrictions, and requires a constructor that takes one argument of type Class<?>. So let’s add that:

public class BeefyRunner extends Runner {
    private final Class<?> clazz;
    public BeefyRunner(Class<?> clazz) {
        this.clazz = clazz;
    }
   
    @Override
    public Description getDescription() {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    @Override
    public void run(RunNotifier rn) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}

Okay, so now we have two interesting points of contact with the outside world: getDescription() and run().

JUnit’s internals and our model

getDescription() returns an instance of Description, which is a tree-like structure holding test and test suite information. This is used for a few purposes, among them counting the number of tests in this test fixture. If you botch this, you’ll end up with the HTML output at some point saying that your user has 15 failed tests out of 4, or something like that. Not exactly desirable, but if you’re just doing this for internal use, it might be acceptable.

The main problem with getDescription() is that it uses this Description class. Description has exactly one constructor, and that is private. So you can’t modify its behavior, without doing some low-level and ugly JVM contortions à la JMock. But maybe its behavior by default is good enough?

…yes, as long as we play fast and loose with the API. There are a few issues, so it’d be nicer to have our own properties on Description, like maxElapsedMilliseconds and expectedException and so forth. This would, however, constrain our external API — we’d have to make all our annotations method-level, disallow overloading test names, and so forth. So while we can get our results using just the standard Description class, we’ll have a lot fewer headaches if we have our own internal model and only serialize to Description at the last second.

So here’s a quick hack of our internal model, probably good enough to support all the features we’re after:

public class Test {
    public Class<?> classUnderTest;
    public Method method;
    public Class<?> expectedException;
    public long maxElapsedMilliseconds;
    public Object[] parameters;
    private Description description;
   
    public Description getDescription() { ... }
}

We don’t know for certain whether there will be any object identity issues in the rest of junit with instances of Description, but it’s safer to cache our instance just in case. As for the rest, we just record what we need in order to run this one test instance.

Note what we’re saying when we say ‘test instance’. We’ll end up with a separate instance of Test for every combination of parameters. So if you have a test with a few hundred combinations of parameters, we’ll create a few hundred instances of this. What will this do to our output? It’ll be pretty unreadable, I should think. Let’s split this out so that the final output will aggregate by test method, and you can drill down into a test method to get the individual parameters.

public class TestMethod {
    public Class<?> classUnderTest;
    public Method method;
    public Class<?> expectedException;
    public long maxElapsedMilliseconds;
    public List<Test> tests = new ArrayList<Test>();
   
    public Description getDescription() { ... }
}

public class Test {
    public Object[] parameters;
    public TestMethod parent;
    private Description description;
   
    public Description getDescription() { ... }
}

Okay, we’ve got our model; we only have three concerns now: serializing this to Description, creating the model in the first place, and executing our tests. Let’s decide on our external API and then worry about creating our model.

External API: Parameterized Tests

Our primary concern is parameterized tests. We want to be able to specify as much as possible on the method level and on the parameter level, for maximum flexibility, ease of use, and ease of reuse. Also, we want shortcuts for the cases we can handle easily. Lastly, since we’re using Java and providing metadata, we’re using annotations to assign values.

This deserves a rehashing of the limitations of Java’s annotations. You can’t store values of type Object in an annotation. You can’t store arrays of arrays. You’re limited to compile-time constants (integer types, byte, and String) and arrays thereof.

This means we can’t use the same annotation field for strings and doubles. We can use the same annotation with different fields, or different annotations. It would be slightly prettier to use different annotations — then you could use the value() property for each. But this would require using more types and more imports to accomplish the same tasks. Let’s use the same annotation — @Values — and multiple fields. If you put this annotation on a test with one parameter, we’ll pretend that you put it on the parameter. If your test has multiple parameters, we’ll emit an error.

Now that we know what we want end users to see, and we have a good idea of what our internal model will be, let’s call it a day and come back to this in the morning.

Posted in Uncategorized.


Java sucks, that’s all

I keep getting annoyed at these Java libraries. In some cases, I can do better (and I have). In a bunch of other cases, though, Java just sucks.

My most recent complaint? Annotations are great! But they can only have values that are primitives, or String, or one-dimensional arrays of primitives or String.

So you can’t have an annotation with a property that might be a string or a primitive, because you need to store that as Object. And that’s not allowed.

Why is this so important to me? Well, junit has a concept of parameterized tests. So does nunit (a roughly similar library for C#). But junit does it horribly. In junit, you have one set of parameters that apply to your entire test suite. You annotate the data generation method, not your tests:

@RunWith(Parameterized.class)
public class MyTests {
    @Parameters
    public Collection<Object[]> makeData() {
        return Arrays.asList(new Object[][] {
            { "fish", 17 },
            { "sheep", 12 }
        });
    }

    private String animal;
    private int count;

    public MyTests(String animal, int count) {
        this.animal = animal;
        this.count = count;
    }

    @Test
    public void testCase() { ... }
}

Nunit, on the other hand, provides attributes where you put the data in directly:

public class MyTests
{
    [Test]
    [Sequential]
    public void TestCase([Values("fish", "sheep")] string animal,
                 [Values(17, 12)] int count) { ... }
}

See the difference there? One way is so complicated, I’d refactor away from it. The other is just plain readable.

And the junit version is near optimal for Java’s capabilities.

These limitations don’t seem insurmountable under the JVM. Groovy, for instance, allows you to have two-dimensional arrays as annotation members, whereas Java does not. But there seems to be very little pressure for improvement in Java.

Posted in Uncategorized.


Video Film Declaration Forms

It takes significant effort to defend freedom against security and patriotism. In the case of elected officials, you need to track individual actions and make it clear which actions you support and which you do not. This requires being in frequent contact with a senator or two, a governor, and a handful of representatives.

What happens when a bureaucratic institution goes awry?

The Department of Homeland Security has started requiring ‘Video Film Declaration’ forms for any imported film.

Security effects

Who does this move benefit? Is it a valid security measure?

No. For it to be a security measure, there needs to be a threat that it reduces. Organized terrorism isn’t a threat. Oh, sure, there have been a handful of arrests — genuinely innocent people, or victims of agents provocateurs. And a couple of idiots have tried to blow themselves up in ill-thought-out attempts that would barely succeed at suicide, let alone any appreciable level of terrorism.

(As an aside, I wonder whether it would be effective as terrorism to have agents blow themselves up, with little damage to others, making it look like the explosives had been planted in secret. But I doubt such a plot could remain secret for long enough to make that successful.)

What’s the most successful terrorist act since the World Trade Center incident? A lone man in Oslo, deciding, without outside assistance, that certain people needed to die.

What about in the United States, before the Word Trade Center incident? Well, that would be the Oklahoma City bombing, which was also a lone man deciding that others needed to die.

These things are more likely to stop by providing more access to psychiatric care than by censoring material.

Political terrorism has been a lasting threat in certain circumstances. Hamas, Hezbollah, the Tamil Tigers, and the Irish Republican Army have caused a huge amount of strife. The United States is not seeing anything similar domestically. If we were, I’d have to consider whether censorship might help in those circumstances, but I think it’s likely a bad idea to have the ostensible good guys suppressing truth that only criminals and terrorists can provide.

Why censorship?

So, we don’t seem to be getting any security from this loss of freedom. Need we consider any other benefits that censorship might give?

Well, presumably, if there were good arguments in favor of censorship, those who are censoring materials would already be providing them. So I could claim that it is simply unnecessary for me to refute arguments that have not been provided; these are clearly outside the scope of consideration for the Department of Homeland Security. And there’s some merit to that attitude: it’s unlikely that the DHS would optimize censorship for a less spurious goal if they are claiming its purpose is security.

But it’s a better form of argument, if you’re interested in finding truth, to fix your opponent’s arguments for them, and refute what you are left with.

Is there any knowledge that is uncontroversially dangerous, that we would benefit from restricting access to? Some knowledge that harms more than it helps? Or something that merely requires significant caution to handle safely?

Well, yes. Knowledge of how to create an artificial intelligence could be extremely dangerous, if it were exercised in the absence of careful and thorough work on the topic of Friendly AI. Knowledge of how to create an atomic bomb or an airborne ebola could be quite dangerous, especially since the implementation will get easier in time. Any subject about which people are strongly inclined to become severely dogmatic is dangerous, whether it be a political theory or a religion. (And I’ve heard a number of stories about people deconverting from Christianity as a result of having read the Bible. It seems safer, if you’re not stamping out the religion, to allow people to access its holy texts.)

Censorship in science and artificial intelligence would reduce a wide variety of means to attack others, and reducing religiosity would reduce one strong motivation for terrorism. Censorship in these areas is at least controversial, albeit not an obviously good idea. But the DHS is not redacting the Journal of Clinical Microbiology, or banning sales of the Bible.

Dangerous materials?

The DHS is censoring materials that suggest being violent toward anyone in the United States. I can ask whether there is a reason for US citizens to view such materials, but that implies there is by default no right for me to see anything, unless it has been proven safe already.

Are these materials actually dangerous? Well, they’ve been available for years, with very little effect. If we treat the period in which it has been readily practical to distribute videos promoting terrorism and terrorist organizations in the US as a trial period, these videos have incited violence pretty much never.

In the US, you can visit al Jazeera’s English website and see a number of announcements from terrorist groups. Al Jazeera occasionally runs video submitted by terrorist organizations. How many people have resorted to violence due to these? If it had happened, would al Jazeera still be operating?

Obscenity and Immorality

Let’s look at the other provisions in the video declaration form. Inciting treason is already a criminal offense, so there’s not much point worrying about it in this form. Obscene and immoral matter, though, is a different knob of wax.

Obscenity laws are a way of imposing the scruples of the largest or most powerful portion of a society on members of that society who would otherwise be free to do what they want in the privacy of their own home. They typically target sexual material or mannerisms of speech (which is to say, swearing).

What can be covered by immorality and not obscenity, but is not already illegal?

If some activity were universally or near-universally condemned, it would presumably already be illegal. Immorality only has room where the enforcers have a different morality than their society. It is a way to sneak in views that are not sufficiently mainstream to survive a fair vote.

Do you think something is immoral and should be banned? Fine — push a bill through Congress. I’ll happily debate you there. But if you instead put an undefined ‘immoral’ term in a video declaration form, with a strong assumption that anything that ends up being called immoral can’t be imported…well, you’re surrendering the definition of law, and the enforcement of your morality, to unknown, unchecked employees of the Department of Homeland Security.

Regardless of your specific morality, that’s just not a good idea.

Posted in Uncategorized.


Thinking from the future

If I can predict what I’ll feel in the future, I may as well think it now.

I’ve read this story before. I’ve seen the protagonist go down this road and learn a valuable life lesson. I know what that lesson is. I’ll just learn it without slogging through the Forbidden Forest with orcs on my tail.

The other lesson I’ve learned is that things will keep going like they have been going unless someone changes something, usually with deliberate effort.

I’ve been apart from the D community for about a year now. Before that, I had maybe six months on, which was preceded by another non-D spell. This has happened through about four cycles so far. It’s getting old.

I can look for something to change about this. And “just stick with it this time” isn’t an option. It’s a goal. What I would need to do is identify some motivation I have that I can feed and increase, or remove some obstacle that’s been causing me to abandon D periodically, and use that to make it easier to stay.

Of course, that takes work — maybe a lot of it. Maybe I should just say goodbye and never look back. Even though that saddens me at times.

But switching back and forth at this point is useless, unless I have some specific, bounded goal I can achieve, will make me less happy than I could otherwise be. It’s inconsistent, and inconsistencies generally produce guaranteed suboptimality.

I don’t know what I’m going to decide. But I’ll think about it.

Posted in Uncategorized.