The Highland Fling 2011 – Web Standard In Scotland

July 8th 2011 saw the welcome and eagerly anticipated return of “The Highland Fling — Web Standards in Scotland”.  Set up and organised by Alan White in 2007 to increase awareness of web standards and best practice, it’s the only conference of it’s kind in Scotland.  I’ve been fortunate enough to have been able to attend each conference, although there was a hiatus in 2009/2010.  The inaugural event really set the bar high for what could be achieved by a dedicated developer passionate about his work.

Continue reading

Automating Internet Explorer VPC Images On VirtualBox

In order to facilitate testing of websites in different browsers, Microsoft have released what they call their ‘Application Compatibility Virtual PC Images‘.  These time-limited V12n solutions are great for quickly bringing up a VM for a particular version of Internet Explorer but they are built for Microsoft’s Virtual PC (VPC) software.

I work predominantly with Linux and use Virtual Box as my V12n application of choice.  Later versions of Virtual Box support VPC’s VHD disk image format.  This means it’s possible to run these VPC images under VirtualBox, but it involves downloading and extracting files from the win32 executables; downloading drivers for the ethernet adapter and other time consuming steps that I’d rather not repeat every time my IE VM expires.  I’m a programmer, therefore I’m lazy and don’t like doing things more than once; I’d rather script something to do it for me.  In keeping with this virtue, I’ve written msie2vbox to automate this stuff for me.  It’s on Github with a GPLv3 license.  There’s some outstanding todo items but it does the job for me, and I thought it might be of use to others.

Manage Your Home Directory With Subversion

Revision control systems serve their purpose well for managing codebases, but they can also be used to good effect for configuration management.  I’ll discuss how I’ve used Subversion to manage the configuration of my home directory.  The same goal could probably be achieved just as easily with Git.  While I use Git and Github for personal projects, I have employed this solution at work where we use Subversion.

Continue reading

Subversion And The Entropy Pool

I ran into an interesting little subversion problem earlier.  I was trying to commit a change, and the commit just seemed to hang indefinitely.  I couldn’t sent an interrupt, and eventually resorted to killing the process.  I tried all sorts of command line options in case there was an authentication problem – with no luck.  I then thought I had made a mistake when switching my working copy to a different branch.  I checked the logs on the server to find nothing pertinent; it seemed as though svn didn’t get as far as taking to the server.  At a loss, I thought there was nothing for it but to run the command with strace.  Bingo!

Strace showed that subversion reads from /dev/random as part of the commit, and that’s where the problem seemed to be happening.  After doing some research, I discovered that /dev/random generates random numbers using the so-called entropy pool.  This entropy pool is just random bits of noise generated from things such as mouse movements, time between keystrokes and so on.  For whatever reason, on the client server, this entropy pool was empty!  Using /dev/random is cryptographically more random than using /dev/urandom; and /dev/random blocks when the entropy pool is empty, whereas /dev/urandom is non-blocking.  Moving /dev/random to /dev/random.old and linking /dev/urandom to /dev/random solved the problem.  There may be a better solution to this, and depending on your cryptographic requirements it might be better to find an alternative, but this did the trick for me.  One svn commit later and all was well.

Display Query Results Vertically With PostgreSQL

Those who are familiar with MySQL may be used to terminating a query with ‘\G’ to have the client output the query results vertically with each column/value pair a line at a time. There is in a equivalent in PostgreSQL too. The psql client uses ‘\x’ to toggle vertical output, and ‘\g’ to send the current buffer to the server for processing. To get the same effect in psql as ‘\G’ in MySQL, just end your query with ‘\x\g\x’.