Nitobi hosted another Hack Day this weekend, giving me another opportunity to eat their food, drink their beer and generally mooch around their office. Nice.

There were lots of neat things being worked on. One, a pared-down jQuery script called XUI written for iPhones was particular interesting, as was a Flash app (or component?) for handling information loading for image sets – showing better clarity for the images when zooming in. Hard to explain, but easy if you could see the demo.

I decided to spend the day making a couple of updates my data generator script (see generatedata.com). I actually had a long list of features I wanted to add, but around 2pm someone brought beer and, mysteriously, my productivity kinda went south.

But what I *did* add was pretty cool (I think!). First, I upgraded the “Date” data type to use the Nitobi Complete UI calendar component, which is about a thousand times better than the one currently being used. Secondly, I modified the code for a simple plugin architecture. So, with the next release of the code (2.2), programmers will be able to write their own plugins to add new data types, letting them generate whatever custom info they want.

As an illustration, I wrote a plugin that pulled random images from a Flickr public RSS feed based on a search string and either displayed the image (for the HTML result type), or stored the URL (for the other types). I originally worked on a “Fractions” plugin that would generate fractions with certain denominators and numerators, but dumped it because images will always be cooler than fractions – especially if the search string you use is “boobs”.

The code design is actually very simple. A /plugins folder stores all plugins, and each plugin folder name acts as the namespace for both PHP and JS functions. At certain spots in the code – like page load and during generation time – the core code checks for the existence of those function names and executes them if they exist. Plugin developers may choose to write functions for particular events, but only if they need to. For example, for my Flickr plugin I wanted a “search string” option to appear when the user selected the data type from the “Data Type” column. So in my code, I just needed to add:

var plugin_flickr = {};
plugin_flickr.select = function(row) { } // executed when the plugin data type is selected by the user

And that’s pretty much it. The core code passes the row number to the function, which the plugin developer can use to identify the various elements in the row, letting them do whatever the heck they want.

Anyway, I’ll document all this when I can find some time to polish it up and release the sucker. Documentation will probably take longer than writing it, so give me some time…
A good day.