CodeZoo

I just discovered O’Reilly CodeZoo today. What a cool idea – ”Find good code, use it quickly”. The net is just littered with bad code samples and finding a place where a high quality standard is set might be a great idea. Only problem is that the (probably) two most used languages on the net - PHP and Perl - aren’t allowed in (so far). Too bad, while good Perl code can be found, it’s hardly impossible to find any quality PHP code samples anywhere.

IP address conversion with Perl

With Perl you can do many interesting transformations of IP-numbers. Below is two small examples allowing conversions from “IP quad” (xxx.xxx.xxx.xxx) format to a single decimal and back. The decimal format may be more convenient and efficient to store in a database.

  sub ip2dec ($) {
    return unpack N => pack CCCC => split /\\./ => shift;
  }

  sub dec2ip ($) {
    return join '.' => map { ($\_\[0\] >> 8\*(3-$\_)) % 256 } 0 .. 3;
  }

In CPAN you can find many modules aimed at using and manipulating IP-addressees.

Gmail filter feature wanted

I’ve been moving a fairly large part of my private mail to my Gmail account.  Gmail do have some amazing features for searching, labeling and handling mail and the virtually unlimited storage is also pretty cool - Much cooler than keeping a huge mail-archive on an IMAP-server or having it on a local fragile hard disk.

One of the more recent things I’ve started using GMail for is backups of this site. With the wp-db-backup plugin for Wordpress a backup of the entired database is mail to my gmail account every 24 hours and using filters I’m applying a ”backup”-label and auto-archiving it (and avoiding noise in inbox).

The case against tags

To every modern web 2.0 site offering tagging seems to be an absolute requirement. While I may agree, that tagging in some cases may offer some improvements in content navigation over many other points, I do think it’s been too abused in way to may cases.

Tags on sites such as Flickr and Del.icio.us are absolutely fantastic. They offer some cross navigation options, which would probably be near impossible, if not for the tags. I often find my self exploring links though del.icio.us, since the content stored there generally seem to be of a muh high quality than a simple Google search on a common term.

Wanted (source)code plugin for Wordpress

The past days I’ve been posting stories with a few code samples – Perl, PHP, Javasscript and/or HTML. While Wordpress is fantastic to a number of things, handling sourcecode examples in the posts, reallly isn’t one of them.

I’ve been playing with a number of plugins, but none of them really works for me. What I’m looking for is this:

  • It must be able to handle HTML, Javasscript, PHP and Perl sourcecode.
  • The code samples should work with the visual editor (preferably entered in this, but ”code mode” is quite alright) – Visual post editing shouldn’t break the code example.
  • The plugin should be alive (maintained and tested with recent wordpress releases).

I would have thought it would have been easy to find a plugin that covered the above requirements, but so far I’ve had very little luck – any suggestions?