Lars Wirzenius: September, 2005
- September 29: Buggy zero length /bin/true, Demonstratation against Finnish copyright law reform
- September 27: Talked about programming
- September 24: Samsung Yepp YP-T6X
- September 23: Quest for Sun '05
- September 13: Cheesed off, or: a parable of ease of use
- September 08: On getting cats
- September 01: Happy Birthday
Thursday, September 29, 2005
Back when I was young, and Usenet was only about a decade
old, I read somewhere the story of two bugs being filed
against a zero length implementation of
/bin/true. I have since not been able to find
the story again, but let me re-tell it this once in my web
log, perhaps someone will find the original story, or proof
that I hallucinated.
Some technical background:
/bin/true is a
Unix command that does nothing, and then returns an exit
code of zero, which is interpreted by the shell as
"success". It can be implemented in various ways, such as
This is a shell script that does nothing, except exit
with an exit code of zero. Works perfectly. It can, however,
be shortened. The second line is not necessary: if there is
exit command, the shell will exit with
the exit code of the last command it executed, or zero if it
didn't execute any commands. We can thus just remove the
line. The first line instructs the Unix kernel
to start the default shell to execute the file; as it happens,
the default shell is the default interpreter, if the kernel
can't find anything else to run a file with, and so we can
remove the first line as well. We get a file with a filename,
execute permissions, and no content. This is a working
/bin/true. It has, however,
two bad bugs.
The first bug is that it is too slow. Starting up a shell
can take quite a lot of time, relatively speaking, and since
/bin/true happens to be a command that gets
executed quite often in a Unix system, the startup time of
the shell can have a measureable impact on system performance.
The other bug is that the shell takes up too much memory. Especially back when I read the story fifteen years ago, and many slightly older systems still didn't use very sophisticated virtual memory systems, the memory used by the shell could, again, have a significant impact, at least on heavily used systems.
The solution is to rewrite the zero length shell script as a short C program that, ta-daa, does nothing.
Finnish politics, skip if you're not interested.
The Finnish parliament is in the final stages of revising copyright laws based on the EUCD directive. The process has been long and complicated, and both the government and lobby organizations for the entertainment industry have been happy enough to trample on citizen's rights at will. Lately we've learned that some civil servants who prepared the law also worked, or now work, for said lobby organizations, which seems rather improper to me.
There is going to be a demonstration by those opposed to the new laws next Tuesday, October 4, at 13 (with a gathering beforehand), in front of the parliament. Please see Id's web log for new information, for now. There's going to be a better page later, I hear, but it's not done yet, and not even the URL is known, so be patient. (I'm only a messenger here, sorry.)
If you like to watch movies or listen to music on Linux, even in the future, from as yet unreleased formats (like, say, the successor of DVDs), you really do want to come there. Even if you just stand with other people, it will have an effect. Banderolls are optional.
I've no idea how many Finns read my web log, but at the demonstration against software patents, several people told me they'd only heard about it here, so that's why I thought I'd be a messenger again, it's for a good cause.
Tuesday, September 27, 2005
Last week I was invited to a company to give a lecture on programming, and was allowed to pick my own title. So I picked Kaikki, mitä ikinä tarvitsee tietää ohjelmoinnista, lukuunottamatta joitakin lähes yhdentekeviä yksityiskohtia ohjelmointikielten syntaksista ja semantiikasta, tietokoneiden toimintaperiaatteista, ynnä muista sellaisista turhuuksista, which is in Finnish, the English translation would be Everything you ever need to know about programming, except for some almost inconsequential details about programming language syntax and semantics, how computers works, and other such frills. That should teach everyone to not let me formulate my own titles.
The PDF is available; unfortunately, only in Finnish, since the talk was in Finnish, and I'm too lazy to translate it now.
Giving talks can be a lot of fun, but I guess it matters that I don't have to do it very often these days, and that when I do, I get to talk about things I know about or otherwise want to talk about.
Saturday, September 24, 2005
Djelibeybi is my new toy.
In preparation for the Quest for Sun '05, I bought a portable Ogg Vorbis player. I happened to see one that was nice and small and fairly cheap, or at least cheap enough not to bust my economy.
In brief: Samsung Yepp YP-T6X, can play Ogg Vorbis and other formats, has 512 MB of space, acts as a USB mass storage device, operates on a single AAA battery, and weighs about 30 grams plus the battery.
For me, Ogg Vorbis and FLAC are the most attractive music file formats. The former makes small files, that still sound good; the latter is lossless, so no quality degradation whatsoever. Both are free, open specifications and unencumbered by patents.
While I can create MP3 files, if I want to, I don't want to, if I can avoid it. Unfortunately, though Ogg Vorbis is free, many portable players don't support it. Finding one that does, and is cheap, is nice. The box even lists Ogg Vorbis as the first file format it supports.
The box did not list Linux as a supported system. Many players require special software to load sound files into the device, and to remove them, which can be a bother for Linux users. This device just acts as a USB mass storage device, meaning that it looks like an external hard disk and managing sound files on it is easy even from Linux. I plug the device in, udev/hal/gnome-volume-manager/Nautilus magic happens and a folder window pops up on my screen, and then I just drag and drop to change the set of music on the device.
All this was not deducible from the documentation on the box, but the nice salesperson at Stockmann, where I bought the device, let me test things. I happened to be carrying my laptop, so I booted it up, attached the USB cable, and it worked the first try. I copied an Ogg Vorbis file onto the device, unmounted, unplugged, and played it, and the device crashed.
Turns out that the device has problems with some Ogg Vorbis files; see xiph.org's talk page for more information. The device did play something else I put in it, so I bought it, and researched things. I'm now converting all my lowest-quality vorbis files to slightly bigger ones. So far, no problems with any of the new batch. (I do the conversion from the FLAC files I have made of my CDs. No more ripping the same CDs again.)
The device uses an AAA battery for power. I use rechargeables, and one lasts about a day of listening. That's pretty close to the 20 hours the manual promises, certainly good enough. Since the battery is easily switched, and the AAA ones don't weigh much, I should be able to listen to music through me entire quest.
There's only 512 MB of disk space in the model I bought. The one gigabyte version was too expensive, but half a gig should be enough for about a dozen hours of highly compressed songs.
While the thing doesn't weigh much, it is a bit of a bother to carry with you. The cable from the earphones gets easily caught in clothes, door handles, bag straps, and so on. Also, if you don't happen to have a pocket in your clothing, there's no convenient place to keep the player.
My solution is visible in the picture above. I made a little loop out of steel wire through the little attachment ring in the player. Then I taped the wire so that the ends don't stick out, puncturing skin or clothes, and also to keep it from coming undone. Than I hung the player using the loop in a neck keychain, a Debian one I got from Jörg Jaspert at Debconf. The earphone cable is rolled up so it is suitably short. Everything now hangs from my neck, and the cable is short enough that it rarely gets stuck anywhere. (Unless I bow down, but one near accident with an oven and hot food hopefully taught me to be careful.)
The user interface is not great, but for my needs it is quite sufficient. I want it to shuffle all songs and play them forever, and after I've configured this once, I basically only need to adjust volume and play/pause, and those are easy and don't require looking at the tiny screen.
All in all, I am extremely happy about this toy.
Friday, September 23, 2005
Finnish summer contains quite a lot of sunlight, except when there is heavy rain. Finnish winter contains quite little sunlight, even when it doesn't rain. The human body reacts to the lack of sunlight by stopping to do some weird chemical stuff, which for some people results in seasonal affective disorder. While I doubt I really have SAD, I do get awfully moody and ineffective. The cure is to get enough strong light that the body restarts the chemical stuff (gotta love that scientific talk). If real sunlight is not available, special bright lamps can help. I have one and it does help, at least a bit.
This winter I want to have the real thing. On November 22, I will go for the Quest for Sun '05 by going to Spain. More specifically, I'll be staying in Madrid, at a friend's place. I don't have any other concrete plans than enjoying the sunlight. I know it's not going to be particularly warm, but it's the light that matters. I hear Madrid has some nice museums, and I would love to meet local Debian/Linux/free software people. If there is a LUG or something that would enjoy me babbling about something, I might have time to prepare a talk, but just going out for dinner or a drink would be fun, too. Mail me at firstname.lastname@example.org.
Tuesday, September 13, 2005
Cutting down on ice cream, I need an alternate source of calcium, and cheese seems to be recommended. Cheese sandwiches for breakfast it is, then. To introduce myself to the wonderful new world of cheeses, I bought a nice triangular piece that doesn't smell very bad. It even tastes quite nice, but damn, it's hard to use.
The first slice was easy, and the second one as well, but after that things started to go bad. Bits of cheese started to break off, and regardless of how hard I tried, and I tried with quite a lot of force, I was unable to make a third good slice for my sandwich. The harder I tried, the more bits would fly around, until the entire table, my copy of Terry Pratchett's The Fifth Elephant, and myself were covered in cheese crumbs. How's that for difficult food?
I eventually had to resort to gathering a small pile of cheese crumbs and pound on them with my fist to make what I might have described as a cheese kludge, if I hadn't been in an uncharitable mood, so I used stronger words.
The moral here is that it's not enough for something to be easy and comfortable for the first slice or two, it has to be easy and comfortable all the way to the last slice.
Thursday, September 08, 2005
For some years now, I've been thinking that I want to have a cat, or maybe two cats. I've read cat books, and talked with friends who have cats, and generally concluded that it is something I want. This week, my friend Anu finally took me to the Helsinki animal shelter, who take care of abandoned cats (and other animals) in the Helsinki region.
This was my first visit to an animal shelter. I've been to zoos and pet shops, and there's a huge, almost heartbreaking difference between them and a shelter. In a zoo or pet shop, I am a customer; in a shelter, I am a potential benefactor that can save lives. A zoo caters to my need for entertainment, a pet shop to my need to own, but a shelter triggers just about all the protective and care-taking urges I have.
And yet I could not take final step and adopt. I reserved two beautiful, black cats, one lap-jumpingly social, the other a bit shy but friendly. After thinking about it for two days, I am still unable to take the responsibility, to change my lifestyle and habits, and adjust my plans for my future to involve two cats. I guess that means I suck.
At least I can do some things with money. The shelter is a private association and runs completely on donations, so they're understandably always short of cash.
Having pets has been a nice dream for me. It is sad I could not realize it, but some dreams are best left dreams. Maybe in a few years I'll have changed and can reconsider.
Thursday, September 01, 2005
HAPPY BIRTHDAY TO YOU HAPPY BIRTHDAY TO YOU HAPPY BIRTHDAY TO YOU JESUS CLIMENT HAPPY BIRTHDAY TO YOU!