Archive for March, 2007

water: heating prohibited

March 28th, 2007

// review this later
§ 34-A/7. No comfort station in the Kingdom may have hot water available.

What you see is a verbatim extract from the Constitution of the Kingdom of the Netherlands. And this is a very instructive example of what happens when code goes unmaintained. Someone wrote this in a draft, meant to change it later, forgot, and it was left as is.

The result is that there is absolutely no hot water in any restroom anywhere. You spent 15 minutes on your bike in the wind and want to defrost your hands? Tough luck. You had a little bike emergency and had to get your hands dirty? Good luck washing off the gunk with cold water.

No matter where you are, no matter what time of year it is, if you want hot water you have to bring it yourself.

reality tv, the new viewer favorite

March 27th, 2007

A few years ago there was this well respected genre in filmatography called documentary movies. Documentaries set out to, indeed, document something. A historical event, a person's biography, discuss a social issue by presenting a lot of facts, that kind of thing. They were still movies, made in some period of time and screened later. Of course, no matter how important or interesting your documentary was very few people would watch it, because generally people think they're boring.

Actually, documentaries still exist. No, really, they do. It's just that the idea of showing something as it is has rather rudely shifted focus to the reality show. The show is made for television, so they need a lot more material. Which also means the quality is much lower. The reality show is like a documentary with no message or purpose to it. They're not trying to tell you anything, or educate you, they just hope you stick around and watch it anyway. And to do that, they sensationalize it. They build it up a lot, run those ads on tv. "Temptation Island starting next week, don't miss it!!" Then they add some graphical framework so you have the intro sequence a certain way, a music clip to go along "dramatic" scenes and all kinds of effects to distract your from the fact that the show isn't about anything. As a final piece of the puzzle, they know you like stupid games, so they make it a competition between the people in the show. Without this you would actually figure it out and not watch it, but because you have this sick compulsion to partake in games and gambling (how do you explain those slot machines as the supermarket?), you will actually watch this bs.

It's called a reality show, and the major selling point is that it's omg so real! We're actually seeing what they're doing, it's like a live feed. Which it isn't, because they screen this stuff all through the week and then they show you a summary once a week, so it's just like any other show. But if they want to really maximize on the show, they will find a way to get you involved. They'll make you vote on the people, decide who wins, who loses, make you care about whatever nonsense they're up to. And that's why they can sensationalize every little detail as well, because they know it matters oh so much to you!

"The contestants are in the house, I repeat they are inside the house, this is so exciting."
"Now they've positioned themselves around the table and they appear to be talking, are we getting this?"
"We're not recording, you bimbo, we're broadcasting."

Big Brother, that was just a fantastic show. It was a study in just how insulting you could make a show to the user and still make him follow it. And they did, en masse. It set a number of records in tv ratings, can you believe it? A show about a bunch of nitwits who sat in a house for months without doing anything and people actually watched it. Not only that, they managed to sell satellite, cable and internet subscriptions for the live feeds too. If you think that was bad, people even taped it to see what they had missed.

airport security: the stupidity mounts

March 26th, 2007

I was on a flight a few months ago and I needed to bring my tennis racket. It's a bit awkward to take if you only have a backpack, cause there's no way to pack it. And no way to conceal it, unfortunately. As I'm going through security, this woman stops me. "That's a strike weapon, you have to check that in." What now? Oh, my racket? No no, it's just a racket, it's not a weapon. It's for sports. She made me check it in and I was a little panicked cause I wasn't prepared for this. Well it turns out I was still okay on time, so no big deal.

But the stupidity of it is annoying. A tennis racket is now a weapon? "What about that guy over there, he's carrying a laptop! Have you seen those youtube videos, you can maul a guy with a laptop!" (No, neither have I, but youtube has everything so I bet you could find people beaten with laptops as well.) I mean a tennis racket, that thing is made to be really light, it would be a terrible weapon. A baseball bat I could understand.

Somehow when I get into these situations with the security people, there's always someone else who comes out of it unscathed. On the very same flight there was a guy that had a racket on the plane. A badminton racket. Even worse for a weapon, would probably break that thing. But if mine is a strike weapon then his is too. What, you couldn't hit someone with a badminton racket if you wanted to? They won't take our laptops, cause that would really piss off the business travelers, but it's actually a more potent weapon.

Another time I'm going through security at Schiphol, again with just a backpack. I had a pair of scissors in there, not that I even remembered, I had them in my pencil case since junior high. But sure enough the guy pulled me over and stole them. "You can't take these on the plane." Right next to me there's another guy being examined and he's carrying a first aid kit in his backpack. In there, yes you guessed it, a pair of scissors. The security guy takes them out, looks at them, puts them back in. I think his were actually bigger than mine (and probably sharper on account of a first aid kit having to be in good condition). So apparently I'm a terrorists, because I have scissors, but the guy next to me, pretending to be medical personnel, couldn't possibly be faking, right?

coming to terms with vim

March 24th, 2007


In case you didn't already know this.. the choice of editor to a geek means more than the choice of religion to the average person. Flame wars over editors are legendary and go back decades. The Unix community split into two main currents, each following one special editor. As you would have it, these two currents are about as black and white as you can find, exactly as the two editors also are: vi and emacs. They are on either extreme of the spectrum. emacs (1975) was written by Richard Stallman and friends, and aims to be everything. It can integrate with lots of other applications, shells, you can run everything *inside* emacs, never having to leave the editor! vi (1976) aims to be nothing, it is the anti-thesis, written by a sadistic bastard called Bill Joy. :D It is as cut down, crippled and bare bones of an editor as you couldn't imagine. And so the wars have waged, emacs vs vi.

Both editors are super popular to this day. You will find vi on *every* Unix system. If you have to edit a config file on some ancient machine and you find out your editor isn't installed, eventually you'll have to fall back on vi. emacs isn't always included, because of its size. Depending on how heavy the install is, it can easily be 60mb, which for an editor, on a scaled down system, is unacceptable. vi is about 600kb.

That is not the whole story, however. A pragmatic Dutchman called Bram Moolenaar decided to liberate the world from vi and came up with vim (1991): Vi IMproved. Now, ironically perhaps, vim is much more of an emacs than a vi, it has a gazillion features. Still, it's much lighter, and compared to emacs, still lightweight. With all its extensions and plug ins, it's hard to call it a lightweight editor in absolute terms, because there are lots of smaller ones, like nano.

Choosing an editor

Since I started out with Linux around the turn of the millennium, and not in the 80s, I don't have such strong feelings about vi and emacs. I could care less. I'm happy to use kate most of the time. It's a very well designed editor, easy to use, intuitive, pleasant. But since I'm hacking Haskell a lot these days, and Haskell is just esoteric enough to not be supported by anyone, I've come to realize that, indeed, it's a choice between emacs and vim.

I'm told there is a Haskell mode for emacs, and probably quite a good one, because it's advertised by the Haskell people. On the other hand, if you search long enough, you might just find some support for vim stashed away in a corner. Syntax highlighting isn't the problem, everyone can do that. But Haskell's indentation is hell, and the vim plugin makes it a little better. I've seen Haskell mode for emacs in action, and that too is rather imperfect.

I reject emacs on the same grounds as every vim user in the world. The key bindings are just horrible. Ctrl+X Ctrl+S to save the file, Ctrl+X Ctrl+C to quit. That's already painful if you do it once, it's unbearable if you do it while hacking, every two minutes. In addition, I work in X all the time, and emacs' gui is just awful. Whether it's gnu emacs or xemacs, they both stink.

UPDATE: Last night I saw a note about emacs-cvs having a completely new gui, so perhaps that is something worth exploring at some point.

So the choice falls on vim
vim is not the guy who approaches you with a smile and an outstretched hand. It's the guy sitting in his cubicle consumed in his work and mumbling to himself. What originally got me interested in vim was not the strong endorsements from lots of people I had talked to it, it was actually this blog entry from a guy who's selling vim integration plug ins for things like Visual Studio. There were two things about his text that resonated with me. First of all, if anyone is going to be looking for vim plug ins for probably the most popular IDE out there (ie. lots of people are already very happy with this IDE), there must be something pretty special about vim. And secondly, he loves vim because it's ergonomic. Hah, ergonomic, imagine that! Have you ever tried editing away from your desk? It's awful, you don't know what to do with the mouse, the mousepad sucks, you can't use the desktop normally, bleh. But he said vim works just as well on the train as it does on your desk. That got me thinking.

So does it? I don't know. You see, vim is a lot to handle. It's like having a particle accelerator dropped in your lap. (And it's just as heavy too!) Yes, there's a manual, but by the time you read it and grasp the meaning, you'll be an old man. vim's premise is radical to everyone who uses the mouse to edit. You don't need the mouse, don't touch the mouse, you can do everything from the keyboard. I'm still not comfortable with h,j,k,l, I cling to the arrow keys. I try to force myself to use k instead of arrow-up, but it feels so unnatural. vim's gui isn't much to brag about either, it looks better, but it doesn't exactly do much for you gui wise.

And, of course, the number of key combinations to remember is completely overwhelming. You just can't learn vim, you have to take it one day at a time. In fact, that's what Moolenaar says too - today you learn something that helps you today, tomorrow you learn something that helps you tomorrow. So I feel like the journey has just begun, I know almost all the keys on the cheat sheet now, plus a few more.

Configure or die

Unfortunately, the biggest drawback with vim (and probably emacs) is configuration. It can do almost everything, but that doesn't necessarily help me. I need to tell it what I need it to do. My .vimrc is now 67 lines and growing. And if there's one thing I truly dislike about complicated applications it's this - having to configure it down to the smallest detail. And having to carry your config everywhere you go, otherwise all the pain that went into setting up these options is lost once you get on a machine where you don't have your setup. KDE solves this problem now (at least for me) quite well, it's configurable to death, but the defaults are so good that most things I don't have to change (or even know about). Not so with vim, not only aren't the options listed, it's not always that easy to figure out what they mean.

Depending on the machine, the default vim config may even have vi compatibility set, so yes, your vim is reduced to vi, how terrifying! Why Bram decided to include a vi compatibility mode one can only guess, but one suspects it was so that he could argue that vi lovers could still breathe, meanwhile he would rescue the rest of us from that terror. I can imagine this would be the only way he could make a case to every distro out there to include vim by default.

So .vimrc is not exactly a walk in the park, it's quite a mess, and the more you want to configure it, the more muddled it becomes. The first thing I wanted to fix was saving the file. By default in vim, this is accomplished with an emacs like awkward sequence of <Esc> : w i. Yes, four key presses, just like emacs. I managed to map it to one key: <F1>. Out of all the commands I type in vim, it's the one I use the most and I can't stand that :w stuff, often typing :W by mistake, which gives an error. :lazy: If you want to know how that's done, look no further:

map! <F1> <ESC>:w<RETURN>a " insert mode
map <F1> :w<RETURN> " normal mode

Yes, at least the mapping is pretty obvious, you tell it exactly what you would normally type. It's just that there are a dozen different kinds of map command, apparently this map! is a way to get something working with insert mode. :/

But vim is not too bad, certain features make you realize that kate has weaknesses that the mouse can't solve. Like navigating word-for-word (instead of by character), deleting whole words, paragraphs.. generally it's things that have to do with moving in the file that are more sophisticated. To fix a typo in kate, you could either double click to select the word, delete and type it in - or just click at the incorrect character and replace it. In vim you hit w to move word-for-word until you come to it, then hit c w (change word) to erase it and you can type it in. That's quite convenient in code. To duplicate a line: Y p, in kate: Home Shift+End Ctrl+C End Return Ctrl+V. Depending on what you're doing, *a lot* more convenient.

Of course, I'm still trapped somewhere in between, so I'm seeing the flaws in mouse oriented editing, without knowing all about the vim approach, so it's still awkward. If I had to edit a file to save my life, I would pick nano. But hopefully vim does actually work as well as people say and I'll be fluent enough to hack plug ins and make it work well for me.

does "confidential" inspire confidence?

March 23rd, 2007

It's the second time I've seen an envelope addressed to one of my neighbors marked confidential. It's a regular white envelope, but across it they stamped CONFIDENTIAL in upper case, and below that Strictly confidential, must only be opened by addressee or something like that.

So they send this very important (presumably) information in the mail, and making sure noone is to open it but the recipient. I didn't open it, indeed I never open other people's mail cause I just don't feel that is good practice, nor do I care. But if I were nosy, a letter labeled confidential would pique my interest. I'd be much more keen to open that one than any other. So what are they trying to achieve here? Why not send it by registered mail so the recipient has to show a valid id and sign for it? That's a lot more of a confidential method.

Or did they send this one "confidential" to divert attention from some other letter in a plain envelope that actually had the secret information?