Archive for April, 2008

This

Monday, April 7th, 2008

The Promised Land – this is a wonderful read, a beautiful and perfect cap for a hectic day.

The problem with PHP

Thursday, April 3rd, 2008

array_reverse() doesn’t maintain array keys.
The problem here isn’t this specific behavior, but it neatly encapsulates one of my core complaints with PHP. Which is: there’s an attitude of “do something dumb, unless the developer asks not to.” You see this over and over in the PHP world. Mangling keys unless you ask not to. Magic [...]

Grief, continued

Thursday, April 3rd, 2008

Firefox 3.0b5: Now with 100% more crashes when getting directions with Google Maps. By which I mean it crashes every time I try to do so.

Simple answers to stupid questions

Thursday, April 3rd, 2008

Apple to go into the operating system business?
No.
This has been another edition of simple answers to stupid questions.
Adding, Apple is already in the OS business, just not for non-Apple hardware. So my answer only makes sense if you recognize that the question is badly phrased. I leave you with this gem:
My Apple Fool’s day story [...]

PHP’s shuffle() destroys your array keys

Wednesday, April 2nd, 2008

Note: This function assigns new keys for the elements in array . It will remove any existing keys you may have assigned, rather than just reordering the keys.
My favorite. Here is the painfully artless workaround:

$data = array(1 => ‘a’, 2 => ‘b’, 3 => ‘c’, 4 => ‘d’);
$out = array();
$keys = array_keys($data);
shuffle($keys);
foreach ($keys as $key) [...]