Archive for October, 2008

Taking an interest in politics

Thursday, October 9th, 2008

It bothers me a bit when people say they have no interest in politics. Almost everyone has some things that they are passionate about, and most of those things can be helped by the right government policies or hindered by the wrong ones. Everyone who has the right to vote should exercise it to help shape the world into the place they most want it to be.

But I don't think that everyone should just get out and vote for some random candidate, or vote based on (for example) which candidate you'd most like to have dinner with - that's as bad as (if not worse than) not voting at all. Ideally you should have an informed opinion on every issue. If there is an issue on your ballot that you don't know or genuinely don't care about, don't vote on that issue.

I am guilty of not following my own advice here by not maintaining my right to vote in UK elections (my excuse is that it's an annoying amount of paperwork which has to be done every year, and I'm ill-informed about UK politics these days anyway).

Programs to write programs

Wednesday, October 8th, 2008

When one needs to write a computer program but that computer program would be particularly difficult and (especially) repetitive to write, a useful pattern is to instead write a program to write the program for you. Programming in assembly language is very tedious so we have compilers. Configure scripts are fiddly and tend to be very similar so we have autoconf. Makefiles are hard to get right so we have automake. When building GCC, there are many files written in domain-specific languages (such as machine description files and opt files) which are used to used to generate the final C source code that is compiled to produce the final GCC. Even the C preprocessor is best thought of as a separate language from C itself, to allow for some limited compile-time code generation.

I wonder how far it is sensible to take this. If the program that writes the program is itself difficult to write, can we write a program to write that one too? At some point it seems that you will reach a point of diminishing returns - adding layers of code generation makes things more complicated, not less. Perhaps the kinds of programs we can understand (and therefore write and debug) are limited by the number of layers of code generation which need to be used. Perhaps with better tools for understanding these layers (such as this), we can write programs that are more sophisticated and less buggy.

Another factor is that in many languages (especially compiled languages) it is quite difficult to write code that writes code - you have to make sure that a suitable compiler is installed, invoke it etc. I hope that future compiled languages will include
code generation libraries which make this easier.

Things cyclists should be allowed to do

Tuesday, October 7th, 2008

I used to cycle to work sometimes. Not all the way to work, but to a bus stop 2-3 miles away. It's very good exercise but I stopped doing it after Alexander was born for several reasons:

  • The commute was 40 minutes to an hour that way at best, by car it was 20 minutes at best.
  • I always ended up very sweaty on the bus - not very pleasant for my fellow passengers.
  • Sometimes the bus was standing room only, meaning the time I spent on the bus had to be wasted.
  • The only (not too hilly) route between my house and the bus stop is along a fairly busy but rather narrow road. The speed limit is 25 mph there but cars expect to be able to go at speeds of up to about 45 mph. They get frustrated when they are stuck behind a cyclist who is going at less than 25mph and there isn't room to safely overtake. Sometimes they will overtake when there isn't enough room, putting the cyclist in danger.
  • In Seattle, cyclists are technically supposed to stay as far right in the lane as possible to allow cars to overtake. However, in order to minimize the danger to myself from overtaking cars, I would often ride in the middle of the lane when it wasn't safe to overtake. This was both a clear signal to the cars that they should not attempt to overtake, and to give me a space to dive into on the right in case they tried anyway. One time, a driver got very angry at me for doing this and started shouting at me. I couldn't hear exactly what he said over the sound of his engine but he gave me the impression that he thought roads were for cars and that cyclists need to stay off of them. He eventually overtook me (unsafely) but then I overtook him again while he was waiting at the traffic light (so I hadn't actually delayed him at all). This seemed to make him even madder and he shouted at me even more (but I still couldn't hear him, and was too out of breath to say anything myself). I switched to the sidewalk as the traffic was too close to the curb for me to get past, which made him even madder still. The whole incident put a very bad taste in my mouth and put me off cycling altogether for a while. I never quite felt safe cycling along that road after that - perhaps the same guy would see me late one night and decide to run me off the road. The irony is that because of that I drove more, which caused more traffic and probably made him even later (if he was a regular user of that road).

Cycling has a problem in Seattle (and in many other cities as well, especially in the US) in that it lacks critical mass (hence Critical Mass). Cycling is great - it's good exercise, good for the environment and reduces traffic. But there are so many cars on the road, going so fast and paying so little attention that in many places cycling is very dangerous. With enough cyclists or few enough cars using that road, it would be safe for cyclists but the danger keeps the number of cyclists down and the number of cars up, as my story above illustrates.

In order to promote cycling, we need to make sure the road rules favor cyclists. For example:

  • Cyclists should be able to go to the front of the line at red lights (and stop signs if there is a long queue). In many places this is legal but there is not always room in front of the traffic, and sometimes no room to undertake at the approach to the light. Improved road markings would help here. These exist in some places (not in Seattle, though).
  • Cyclists should not have to come to a complete stop at stop signs. Currently they are supposed to (at least in Seattle) but rarely do. For a cyclist, coming to a complete stop is much more of a problem than it is for a car - not only do you have to build up your momentum again but you can't balance when stopped. Cyclists should just need to slow down enough to ensure that they don't ride out in front of a car or another cyclist coming from a different direction, or a pedestrian trying to cross the street, and only stop if they need to wait for other traffic. Pedestrians do not have to stop at stop signs if there is no traffic - I think cyclists should have that advantage too.
  • Cyclists should be able to ride in the middle of the lane when it is not safe for them to be overtaken, as I used to do.

One of the complaints car drivers seem to have about cyclists is that sometimes they follow pedestrian road rules and sometimes car road rules. This seems to me to be an advantage of the bicycle as a form of transportation - in some ways it is like being in a car and in some ways it is like walking. Cyclists take up much less space than cars and are much less dangerous to pedestrians, so it makes sense that they should be allowed to ride on the sidewalk (pavement) when it is wide enough and when they are going at walking speed (though of course they should give way to pedestrians when doing so). On level ground and downhill they can go fast enough that it makes more sense to use space shared with cars than space shared with pedestrians.

I recently started cycling again on a regular basis - now that I don't have to commute I can do so for exercise, and choose non-dangerous routes. I found it to be a much more pleasant experience without cars honking behind me - there are lots of other cyclists on this route and they often say hello as they whizz past me.

It's not in the last place you'll look

Monday, October 6th, 2008

When I was looking for something my parents would often quip "it'll be in the last place you look". Brilliant. And not at all helpful. In order to prove them wrong, I now make a habit of looking in some more places after I've found something that I was looking for. This isn't as pointless as it sounds - sometimes I find things I wasn't looking for.

Visual cortex fail

Sunday, October 5th, 2008

Ever have the experience of waking up and checking your email, and then wondering for a moment why you don't seem to be able to read English any more until you realize that your only email is spam written in Cyrillic?

The mouth filter

Saturday, October 4th, 2008

Sometimes I'll start to say something and then realize that it wasn't very interesting and shut up. This frequently annoys the people around me who will say things like "What? What were you going to say?" I'll say the thing that I was going to say and they will generally comment on the inanity of it. This seems rather unfair - if I didn't think it was inane I would have said it in the first place. You can have the filtered or unfiltered version of my comments but don't expect the unfiltered comments to be up to the standards of quality of the filtered ones.

The mosquito loop

Friday, October 3rd, 2008

Ever notice how, if you get a mosquito in your bedroom, it will sometimes buzz right by your ear? I suspect this is an evolved survival mechanism to check if you are asleep. If you're awake and they start sucking your blood, you'll probably notice and squish them. If you're not asleep it's almost impossible to avoid reacting when they buzz past your ear. So, as you're trying to fall asleep they will buzz past your ear every once in a while and only start to go for your ankles if you don't react.

Trouble is, some people (like me) are light sleepers and get woken up by these fly-pasts. This causes a loop as I start to drift off to sleep, get buzzed awake, swat the mosquito away and repeat. No meal for the mosquito, but no sleep for me either. Last time I got a mosquito in the bedroom I went through a few cycles of this and then tried to find it for a while and but eventually gave up and had to go to sleep in another room. The next day I found it on a wall and squished it.

Recurring dream

Thursday, October 2nd, 2008

When I was a child I used to have this recurring dream. Actually it wasn't exactly a dream because I sometimes experienced it while awake as well. It was more like a feeling of fear and of "wrongness". Part of this feeling was centered around my fingers - they seemed to be too large to be able to do the things I wanted to do with them, but simultaneously too small to have an effect on the world. I wonder if this was part of my brain's getting used to the new sizes of my fingers as I grew. Another part of it was being chased downhill by a rolling boulder (and being unable to stop it because my fingers were too small, and simultaneously being unable to pick it up because fingers were too large and crude) only the entire scene was in 2D. It was very strange and even more surreal than a normal dream. Unlike most dreams, I can vividly remember how it made me feel even though I haven't had the dream for many years.

Stupid image resizing

Wednesday, October 1st, 2008

It greatly annoys me when web pages don't resize images properly. In particular, one thing that there seems to be an epidemic of at the moment is web pages that embed images at one resolution and then use styles like "max-width: 100%" in a column narrower than the image. This makes the images look horrible because most browsers (at least IE7 and Firefox 2) resize the images by just dropping columns, causing diagonal lines and curves to be all wavy. At least Firefox 3 gets this right and resamples the image but it's still a waste of bandwidth.

Along similar lines, here is an interesting article about the interactions between gamma correction and image scaling. I hadn't thought about that before (my own image resizing routines always just assumed a linear brightness scale) but this has definitely opened my eyes.