Firefox Wallpapers: more wallpapers than you can shake a desktop at. (0) «
I’m usually not too fond of easy humor, but this blond joke is really pretty funny :) (6) «
In: , On: 2005 / 12 / 22 Short URL: http://ozh.in/an

I needed a recursive function to go through directories and subdirectories, so I headed to PHP.net's readdir() page, knowing that I would find one in user comments. Or did I need a recursive function ? Hell no. I've found the nifty neat following function, which does not recursively calls itself. And what's so cool about it, you may ask ? Speed.

  1. <?php
  2. function list_directory($dir) {
  3.    $file_list = '';
  4.    $stack&#91;] = $dir;
  5.   while ($stack) {
  6.       $current_dir = array_pop($stack);
  7.       if ($dh = opendir($current_dir)) {
  8.          while (($file = readdir($dh)) !== false) {
  9.             if ($file !== '.' AND $file !== '..') {
  10.                $current_file = "{$current_dir}/{$file}";
  11.                if (is_file($current_file)) {
  12.                   $file_list&#91;] = "{$current_dir}/{$file}";
  13.               } elseif (is_dir($current_file)) {
  14.                   $stack&#91;] = $current_file;
  15.               }
  16.             }
  17.          }
  18.       }
  19.    }
  20.    return $file_list;
  21. }
  22. ?>

The function returns an array of files from directory passed as argument and subdirectories. The user who submitted this function added a few benchmarks against an average recursive function, to find out that this one is about 50% quicker.

Just as anybody I guess, I've been using various recursive functions for years now, and I just had never thought about why or how to do it differently. Damn. So many CPU cycles wasted for nothing :)

In: , , , On: 2005 / 12 / 20 Short URL: http://ozh.in/am

At work ? Cannot access some website because your corporate proxy says it's forbidden / unsecure / porn / games related ? No more ! If your proxy is not blocking Google, which is probably the case, then you can virtually access any website with the following address :

http://www.google.com/translate?langpair=en|en&u=www.site.com

It just loads a webpage via Google's translation service, and translate it from english to… english. Of course this works the same with langpair=fr|fr, it|it etc.. Chances are images, .css files and such will be blocked, but you will be able to read the content at least.

I've had a few mails from folks who could not read my blog because their work proxy was denying access with reason "Games related" (which is not that stupid, it's hosted on a game site actually). This could be handy. My corporate proxy does not block anything so I cannot test, but I imagine you could also add any feed to your feed reader (probably with the direct URL of the lower frame of the Google translated page)

(Found via the always entertaining DiggDot.us)

RSS IconIt seems that Microsoft eventually decided (after much hesitation) to officially adopt Firefox' icon for representing XML feeds, and that they will use it in the upcoming MSIE 7 and other products such as Outlook.

It's almost weird to see Microsoft adopt a competitor's "standard", especially given the fact that they had been thinking a lot on their own RSS icons a few months ago. And anyway, it's just funny that they adopt "minor" standards (an icon, whoah, big deal) while they just cannot conform to the other, important, web standards :-Þ (via)

Paris By Night. Gorgeous panoramic picture (360°, 15.000 x 500 pixels, 1.8 MB) of Paris as seen by night, with views of monuments from all the city (the Eiffel Tower, Notre Dame…) I’m wondering what was the hardware that made this possible. Really cool. (3) «

I've heard this morning on the radio that someone named Stanley 'Tookie' Williams was about to be executed in California, after being sentenced to death in 1981. My — naive — question is : why did they wait for 24 years ?

I don't know if death penalty is a good thing or a bad thing, but I'm pretty sure that waiting for as long as what looks like a perpetuity jail sentence before executing someone is really dumb. It's obvious that such a long period is likely to deeply change someone's personality. It's obvious they're not even executing the same person they have judged 24 years ago.

I use Technorati a bit. I've found "geekerati" in an article I've just read. I've also come across "blogerati" a few days ago. I could guess the approximate meaning of the -(e)rati suffix, but I needed something more accurate, which I've found at Wordspy:

-rati (RAT.ty) suffix. Indicates the intelligentsia or the elite of a particular group.

The original is literati: the literary intelligentsia or the educated class (the literate intelligentsia). Variations on the theme include digerati (digital intelligentsia), journarati (journalism intelligentsia), cinerati (cinema intelligentsia), and Liberati (Liberace intelligentsia).

Now I feel much more civilized :) (And while I am at it, let me coin a few words so that I'm the first one to use them : wordpresserati, pluginerati.)

It has to happen sooner or later (and I would have bet sooner), del.icio.us has been bought by a big web company : Yahoo.

The funny thing is that a few months ago, Yahoo released a somehow competitor of del.icio.us, My Web 2.0 : social bookmarking with tags and a few features (read my review of My Web, and how it compares to del.icio.us)

The obvious thing is that, Yahoo now owning del.icio.us and Flickr, they are something like biggest tagging company on the intarweb.

Backstage of a LAN Party. Installing what 2000 gamers need for a week-end can be hot :Þ (0) «