Walk To Work Day

Today was Walk To Work Day in Dunedin, an initiative spearheaded by Living Streets Aotearoa with the support of Sport Otago and the DCC. I decided to make the trip as the amount of excercise I get thanks to the extreme convenience of my scotter is minimal. I left home at 7:20 this morning and arrived in the Octagon at about 8:30 where a few stands were laid out for registration. The registration process was rewarded with a $7 voucher redeemable at Barakah, MASH, The Ra Bar, Alibi or The Craic. I chose MASH and a nice looking breakfast bap which was delicious, but unfortunately my order was forgotten in the rush of breakfast time cafe operations. After a reminder it turned up with an apology.

They say New Zealand is a small place and indeed it is – I ran into community advocates Frank Buddingh and Nina Arron from Lawrence who were on the registration stands. A familiar face was very much a welcome sight. I first ran into Frank and Nina some time ago when Frank was looking for an alternative provider for the Buddingtree Consultancy website.

For me the nicest thing (other than the fantastic weather!) about walking into town was it was a chance for me to “sit down” and listen to some podcasts. Listening to Leo Laporte, Jono Bacon and Randal Schwartz interview Jamie Cameron about Webmin on the FLOSS weekly podcast was a delight, especially as in my dark days I had a fair use for Webmin, so much so that I bought Jamie’s “Using Webmin” book.

Now that I have my walking method sussed all I need to do is load up my iPod and get an early night and a good sleep beforehand – unfortunately the early night and good sleep was thwarted last night by some jQuery and AJAX goodness and also by Zoe night-babbling, then Linus who woke up crying because “Ada ate my pie in a dream!” and then some more Zoe babbling. Things had quietened down by about 4am anyway.

Check out the local Channel Nine TV coverage at http://www.ch9.co.nz/node/14223

LCA2010 – a first timers overview

Well, LCA2010 drew to a close here in Wellington yesterday with the final event being the Penguin Dinner just after Brisbane was announced as the next host city for LCA2011.  The preceding week has been a great chance for geeks to meet, hack, discuss, debate, fix, help, recruit, teach and share with other geeks.  A wide range of geekery was represented, from Linux kernel hackers, to source control experts (notably representatives from the GitHub and Ubuntu Launchpad projects), to documentation lovers (yes, they exist, I saw some!) all the way down (or up?) to hardware hackers soldering together Arduino/Pebble kits and developing technology to win the Lunar X Prize (hello, Lunar Numbat).

For me, the highlights of this week have been:

  • Seeing HTML5 support for the Video tag, and in particular seeing realtime video processing with Javascript (example here)
  • An overview of Drupal 7 by Webchick including writing a sample “Pirate Module”
  • Various presentations by Paul Fenwick, including a piece of social genius, a proposed Facebook application called “AntiSocial” (keep an eye on his blog for more info)
  • The LCA2010 Hackoff organised by the Wellington Perlmongers group – our team did well, answering 3 out of the 6 questions (with the solution to #4 arriving minutes after the contest has closed)
  • The Pengiun dinner, where some* Epic Beer was consumed (Epic were a sponsor of LCA2010) and a whopping $33,000 dollars was raised for the Lifeflight Trust at the charity auction (winning prize was a trip for four on the rescue helicopter with some good old fashioned winching on 8mm steel cable)
  • An overview by  Patrick Brennan from Albany Senior High School (a new school) where he spoke about the massive savings they made by choosing to go completely open-source for their new school.  It was a delight to see the passion that the entire board has for the philosophy of free software.
  • Following and contributing to the vibe of the conference in realtime with Twitter via the lca2010 hashtag

Everything worked very smoothly with the conference venue being more than adequate and with power and internet access never being an issue, although there were a few times where I had to charge my iPod from my laptop battery.  Each session was streamed live and the archived videos will be available at a later stage once they’ve been processed and made available online.

Also, being able to stay with Adam and Amy was a great advantage with their apartment being only about three blocks from the Wellington Convention Centre and right on Courtenay Place.

Finally, a heartfelt thanks to Andrew and Susanne for organising the conference, and to the hordes of crew, support people, volunteers, ghosts and incidentals who made the event such a pleasure to attend.

* Ok, way too much :)

FogBugz “Active Project” notification tool

At Turboweb we’ve recently subscribed to a 5-user on-demand license for an awesome case tracking system called FogBugz.  For us it means that we have controlled workflow of cases (bugs, features, enquiries etc.) along with awesome estimation reporting and time tracking.  FogBugz was built with development teams in mind and it’s a very nice tool.

Anyway, one of the things it has is a nice API which you can use to interrogate the product (read and write) and this got me thinking about how I could use the API to remind me what I should currently be working on.  Thus was created the “FogBugz Notification Tool”.

This script does the following:

  1. Connects to your FogBugz installation
  2. Runs a query to see what things have been worked on today
  3. If there are any items that don’t have an end date, then it’s the case that’s currently being worked on
  4. Get the details of the case
  5. Use notify-send to pop up a notification bubble showing case number, title, estimated time and time remaining.

FogBugz Active Case Notification

I have found this most effective if I put it in my crontab to run every 5 minutes.

Requirements:

  • Ubuntu Linux (or any version of Linux that supports the “notify-send” command)
  • PHP5 CLI (simply because this script is written with PHP)
  • The “libnotify-bin” package (this provides the “notify-send” command, try “sudo apt-get install libnotify-bin”)

The script requires a little configuration for your circumstances, but this is easily done by editing the defined constants in the script:

	// Adjust these defines to suit your installation
	define( 'FBBASEURL', 'https://mywebsite.fogbugz.com/' );
	define( 'FBUSERNAME', 'my@email.address.com' );
	define( 'FBPASSWORD', 'mypassword' );

And to add it to your crontab, simply add this line (note the */5 means every time the current number of minutes in the hour is evenly divisible by 5)

*/5 * * * * DISPLAY=:0.0 /usr/bin/php /home/bob/fogbugz-notify.php

Of course, adjust the path appropriately.

Changing the location of your working copy with Subversion

svnSubversion is a popular version control system that will allow you to keep track of any changes to any files (normally text files or source code). If you’re a developer and you’re not using a version control system it’s kind of like being dragged behind a Jeep instead of driving it, except you don’t realise that’s what’s happening.

Anyway, when using Subversion you “check out” from the repository your own “working copy” of the code. This is where you then make your changes before either reverting them (throwing them out) or committing them (storing them in the repository as the latest version).

There may be situations where the location of the repository (which is usually specified as a URI) may change, and you would prefer to keep your working directory intact rather than having to check out a fresh copy from the new URI.

This is easy enough to do with the “switch” command, like so:

  1. Start a shell and change into the working directory that you’re using, e.g. cd /home/bob/projects/myproject
  2. Issue the svn switch command, with the –relocate option, followed by the old URI and the new new URI, e.g. svn switch –relocate http://hostname.com/svn/myproject http://newhostname.com/svn/myproject

In my particular case I had checked out a working copy from a subversion repository available on my LAN at my workplace, but then when working remotely I could not update or commit files.  The repository is accessible remotely however via HTTPS.  Even though it’s the same physical repository, the URI that I access it by had changed so my command was:

svn switch --relocate http://ace/svn/myproject https://work/svn/myproject

To find the URI of your current working directory, use the “svn info” command and look for the Repository Root:

bob@bob-laptop:/var/www/myproject$ svn info
Path: .
URL: https://work/svn/myproject
Repository Root: https://work/svn/myproject
Repository UUID: a13b7e41-fee6-4c75-a229-83425febcc85
Revision: 498
Node Kind: directory
Schedule: normal
Last Changed Author: bob
Last Changed Rev: 498
Last Changed Date: 2009-11-30 14:01:35 +1300 (Mon, 30 Nov 2009)

CodeIgniter – Form Validation and Optional Fields

I’ve been doing a bit of work lately with CodeIgniter.  It’s been OK but the framework seems quite wrong in most places.  My main gripe is that the “helpers” define themselves as functions in the global namespace (rather than as objects that hook into the CodeIgniter object) which results in some stupidity like a function called “set_value” which just happens to retrieve the value as validated by the form validation “helper”.  Anyway, that’s a lesson learnt.

I’ve been trying to get the form validation to allow me to use set_value for fields that aren’t required, but unless your rules specify the field and a validation rule for it the value won’t be available when set_value is called.  The trick here is to use “echo” as the rule which means that the validation passes and you get back what you put in.  This is not documented in the CodeIgniter manual (it’s implied by the fact that you can use any PHP function as a “rule”).

Example:

$rules = array(
  array(
    'field' => 'name',
    'label' => 'Name',
    'rules' => 'required'
  ),
  array(
    'field' => 'nickname',
    'label' => 'Nickname',
    'rules' => 'echo'
  )
);
 
$this->form_validation->set_rules( $rules );

In this case any calls to set_value(‘nickname’) will return the correct value, rather than an empty string.

Web 2.0 Reflection using HTML and CSS only

You’re most probably familiar with the Web 2.0 reflection technique.  This technique is used to make products appear as if they’re on a shiny surface.  Apple most probably have it in use in their current campaign on the Apple website.

I was thinking about this technique as it can be quite fiddly to put together.  Normally you would use Photoshop or The Gimp or Inkscape to apply a gradient to an existing image, and then save that image as a seperate one, making sure you keep your original should you need it.

I then realised that by using a combination of CSS background images, background-position and opacity you could reproduce this effect purely with HTML and CSS.  I’m yet to wrap up the finer points but here’s the idea.

  1. Include your image on the page with an <img …/> tag as per usual.
  2. Underneath the image, include a number of 1px high empty <div> tags.
  3. On each div tag, set the background-image to be the same as the image referenced in step 1, set the background-position such that the 1px high div is displaying the correct row from the image, and set the opacity such that it fades out a little more on each subsequent div.

This image illustrates the effect up close:

My concerns at this point are:

  1. What effect will this technique have on older browsers?
  2. How will this break across browsers? (I’m assuming it won’t be perfect)
  3. The extra HTML for one image is maybe acceptable, but many images on a page would significant slow down load time for the sake of some shine
  4. What effect – if any – will this have on SEO?

I’m considering writing a jQuery plugin that you could use to apply this technique.  You can see the technique in actual use on this page.  View the source code to see how it’s done.

WordPress Themes