The “August” error

Posted on Thursday, September 17th, 2009 under , , ,

I’ve just came back from Wurbe, where I’ve enjoyed a late evening snack (consisting of beer, Pepsi and pizza) and chated with other fellow developers on a large range of subjects, raging from current trends in development to Klingon grammar.

Bodgan Lucaciu told us a funny story about a strange bug. It’s like this: in Javascript, when you parse a number from a string – let’s say a month’s index like 07 – with parseInt you must be very careful, because, for parseInt, the leading 0 is an indicator that the number is written in octal instead of decimal.

alert(parseInt('07')); // for July - will echo 7
alert(parseInt('08')); // for August - will echo 0 as there is no 08 in octal

So if your application mysteriously stops working on the first of August, this might be your problem. Although this “feature” is marked as deprecated, it’s still present in many modern browsers, so one can never be too careful. Also keep in mind that by default, numbers starting with 0x are considered to be hexadecimals.

How to have fun with your Linux server

Posted on Wednesday, June 17th, 2009 under , ,

I’ve found a great way to have fun with your linux server. First of all, install cowsay. If you use Ubuntu server or Debian, you can use apt-get install it:

sudo apt-get install cowsay

Now, you have to wait for another user to connect to the server via ssh. You can use the who command to see who is logged in. With two open terminals on my Ubuntu box, who’s output looks something like this.

tudor@thor:~$ who
tudor    tty7         2009-06-17 20:31 (:0)
tudor    pts/0        2009-06-17 20:36 (:0.0)
tudor    pts/2        2009-06-17 22:21 (:0.0)

Let’s assume that the victim is the one using the first terminal, pts/0. Now, all you have to do is punch the following like in your terminal:

cowsay -f tux "I see you" > /dev/pts/0

…and his terminal will look like this:

tux

Doesn’t this make you feel better about yourself?

Later edit: the party continues here!

Linux symposium statistics

Posted on Friday, May 22nd, 2009 under , ,

This is an older pic from another – now abandoned – blog of mine, about statistics made at a linux symposium.
The sad truth:

Linux symposium statistics

via TechCrunch.

Pizza party UNIX

Posted on Wednesday, February 18th, 2009 under ,

Simple and quick. Unix style ;)