Archive for April, 2006

Mobile Voice over IP ?!?

Tuesday, April 25th, 2006

I seem to be missing something here. I hope I’m not the only one who read WiFi and VoIP in one sentence and thought, this is never going to work…

But the businesses seem to think that combining hot new hype words in one simple mobile device will result in ‘MegaBuXX’! I mean, how often have you opened your laptop in the middle of nowhere and actually got free WiFi ? Perhaps if you can crack WEP keys with your laptop, it might work, but otherwise I’ve only been presented with either “cannot connect” or a welcome screen showing that you can connect if you pay €27 ((You read that correctly, twenty-seven euros. I heard from an American guest staying in Amsterdam. Note that this price for connectivity per day. This was even for a 400Mb limited session, if you wanted unlimited, you had to fork over €32!)).

But it seems that there actually is a product out there.

Remember, Remember, the Fifth of November

Monday, April 10th, 2006

Plan a visit to your local cinema as soon as you read this. ‘V for Vendetta’ is a brilliant movie, the likes of which come out of Hollywood once every 30 years.

This entry is a first in my blog for movie reviews, but this is also one of the best movies I have ever seen (yes, I am rating it as high as ‘The Godfather’). The Wachowsky brothers show again that they are very able to mix history (Guy Fawkes), classics (1984, Brave New World), and modern events into a thrilling movie with a serious message. Although I found Natalie Portmans acting and (detectable fake) British accent a bit disappointing, this was completely compensated by the phenomenal casting and acting of Hugo Weaving, Stephen Rea, Stephen Fry and John Hurt.

The story of ‘V for Vendetta’ is very serious, and on the one hand I really hope that governments will never take such extreme measures. But I really hope that the public will take action like in the movie whenever something like this happens. This may sound a bit cryptic, but you really should see the movie and come back and thank me for kicking you towards it.

If you want to read more, here’s the IMDB entry (currently scored 8.2 with 30k votes).

‘Shebang! ‘

Friday, April 7th, 2006

That is shebang followed by a space. This is a short followup to the previous story. Checking some things, I ran into the remark that “on some versions of Unix” a space is required after the #!. This is because supposedly, otherwise the “magic” byte-order detection is off.

A faithful reader (without blog :() pointed this issue out to me and I responded that I had heard about it, but ignored it for simplicity sake. Another reason was that I never ran into it on the current Unices, so it didn’t really seem important. He did some more searching and below is the result (from http://www.in-ulm.de/~mascheck/various/shebang/)

There is a rumor, that a very few and very special, earlier Unix versions (particularly 4.2BSD derivatives) require you to separate the “#!” from the following path with a blank. You may also read, that (allegedly) such a kernel parses “#! /” as a 32-bit (long) magic. But it turns out that it is virtually impossible to find a Unix which actually required this. … Even intensive search of usenet archives didn’t reveal any more hints to me.

I can’t put it better than the readers conclusion: “Myth Busted?”.

Shebang!

Tuesday, April 4th, 2006

No, I’m not talking about adding sound-effects to my blog. I’d like to talk about that first line of every shell script, the shebang line. If you know all about shebang lines and env, please skip_ahead to the last section. Since the earliest versions of Unix, this first line is used to point to the executable that should be used to execute the script. Classic example:

#!/bin/sh

This signals two things:

  • #! is used as a magic number to determine the endianness.
  • The whole script should be executed using sh located in the /bin/ directory.

This worked without much problems in the past 20 years or so (at least I think so, since it hasn’t changed much since then). This is mostly because there weren’t much different options for script executors, mostly just shell variants (sh, bash, csh, etc.), and these are always installed in default locations.

The past couple of years has seen the rise of several different scripting/programming languages, such as Perl, Python, and Ruby. These also use the shebang line. However, unlike shells, a default location for the scripting language interpreters is not vital for a unix system. It will boot fine without any of them present. And when there is room for options, *nix distribution will make different choices.

What makes it problematic is that most shell script authors will assume that your system is a default, standard Linux install, where all scripting interpreters are installed in `/usr/local/bin/`. This works on their system, so it should work on everybody else’s system! Wrong!

There are lots of systems around that don’t do have the interpreters there, or if they do, they often have a more up to date version in some other directory. This seems to be a hard problem, but luckily there is env. env is located in /usr/bin/ and can act as a pointer for the shell to find the right interpreter, based on the configuration of the user executing the script. And the great thing about env that it is always located in /usr/bin/, because a lot of scripts depend on it.

The sad thing is that not many script authors know or care about the existence of env. Which can be a real pain for OS X users, because the standard interpreters are pretty old and most use either Fink or DarwinPorts and these install the interpreters in /sw/local/bin/ or /opt/local/bin respectively.

So please, spread the word, remember this when you write your next script: always start your script with the line

#!/usr/bin/env <interpreter>

The only valid exception to this rule is when you really need to feed arguments to the interpreter. Perl is notorious for wanting arguments, and while FreeBSD’s env handles arguments just fine, most other versions of env unfortunately do not. So besides spreading the word about env, also put in a good word for FreeBSD’s version of env.