Skip navigation.

Perception is 99% of reality #

Jeff Atwood writes:

If you've used Windows Vista, you've probably noticed that Vista's file copy performance is noticeably worse than Windows XP. I know it's one of the first things I noticed. Here's the irony-- Vista's file copy is based on an improved algorithm and actually performs better in most cases than XP. So how come it seems so darn slow?

PS: Jeff adds that Vista SP1 has switched back to XP's algorithm. Duhh!

Octalpussy #

In my previous post I asked what would be the output of of the following numbers:

echo 09," => (09) <br>";
echo 9," => (9) <br>";

The answer is:

0 => (09)
9 => (9)

That's because any number preceded by 0 is treated as an octal number, and 9 is an invalid octal number. Octal numbers are base 8, e.g.:

Octal ValueDecimal Value


The silly thing is that hardly anyone uses octal nowadays, but it continues to be part of the C, C++, Java and PHP standards. The mistake is also very common. C-style languages pride themselves in their terse and minimalist syntax, but this is one scenario where a language design error was probably made. Perhaps 0c should have been used to represent octal in analogy to 0x for hexadecimal, but this suggestion is sadly 35 years too late. 0 for octal is too deeply imprinted in modern compiler DNA.

PS: Here's the mistaken ADOdb bug report that started it.

Octopussy numbers in PHP #

Someone reported a bug in ADOdb, the open source db library i maintain. I went crazy for half an hour until i realised the problem. Here's a little gotcha you can try:

echo 09," => (09) <br>";
echo 9," => (9) <br>";

If you expect the above code to produce the same values, you are sadly mistaken. Try it. Also see the followup.