will

Where there is a Will

Will McGugan's Blog

I am a freelance software engineer living in Edinburgh.

I post mostly about tech (particularly Python) and photography.

Background: A code monkey

Upgrading to Ubuntu 10.04 went remarkably smoothly, with the exception that audio in Flash was erratic. Sometimes it worked, sometimes it didn't. Since I use my PC as an entertainment system, this was pretty much a deal-breaker.

Googling for it got me no where. Apparently “no audio in flash” is the Ubuntu equivalent of “i have a headache” – it's a vague symptom that has multiple possible causes. Long story short, the problem was that I had both Flash 9 and Flash 10 installed. Firefox appeared to pick one at random (as far as I could tell), but audio only worked with 10. The solution was to delete Flash 9 – which I couldn't do from the package manager, because it turned out I had Flash 9 installed locally. continue reading…

Django has support for Generic Foreign Keys, which let you reference one model instance from another, without knowing up-front what that model type is. The classic use for something like this is for a commenting system; you need generic foreign keys – or something like them – because you wouldn't want a commenting system that only worked with a single model. continue reading…

I recently administered a programming test to a number of applicants for a Python developer job at 2degreesnetwork.com. Since we now have a new developer (hi Gustavo!), I figured I would post the test and see what kind of response I get to them.

There are two parts to the test, neither are hugely difficult, but there is enough scope in the solutions to understand how the candidate approaches a problem.

In the first part of the test I asked the candidate to look at the following code and implement the thousands_with_commas function, which should take an integer and return a string representation of that integer with commas separating groups of three digits: continue reading…

I implemented a theme system for locidesktop.com and thought it only fitting that the first theme I made was one for Django.

I present you with the Django themed Loci Desktop!

Here it is, in embedded form – although you really need to click the above link to fully appreciate it.

Since I've been hacking away with Javascript lately, I thought I'd share a few snippets that I have found invaluable.

Some of these snippets use JQuery, but could easily be modified to use plain JS or another toolkit.

Some of these snippets are likely available in other libraries and plugins, but I prefer not to introduce too many dependencies when working with Javascript. Better to keep the code lean – if possible!

Building strings with Javascript can be a pain if it consists of a number of parts, and it isn't too flexible if you want to modify later. Here's a snippet that adds simple template substitution to strings.

It adds a method, f, which takes an object and replaces parts of the string between double braces with values from that object, similar to Django templates. Here's an example: continue reading…

I have been busy working on locidesktop.com lately. One popular feature request from the beta testing was to use website favicons, so that links become more readily identifiable – which I have implemented after several late nights, and abusing my quad core.

A few of the 3D Favicons used in locidesktop.com

I built a pipeline that downloads favicons, extracts PNGs which are then processed in to a 3D scene and rendered for missing resolutions (.ICO files can contain multiple resolutions). I've tweaked the way that the 3D icons are produced, and they are significantly better than my first attempt – although some do come out better than others. continue reading…

The company I work for, 2Degrees, is looking for a front-end developer to join our team.

Are you a CSS monkey?

We need a CSS monkey with a good working knowledge of browser quirks and the ability to get even IE6 looking good (although you don't have to like it). It would help if you don't run away screaming from Javascript and can play well with the code monkeys.

More details are below. Email the address at the bottom of the job description, and mention this blog!

Would you like to do something genuinely useful with your client side development skills - UI, XHTML, CSS (JavaScript, AJAX)

2degrees is an exciting, fast-paced, well-funded Web2.0 environmental networking business based in Oxford. continue reading…

The feedback I recieved from Reddit about locidesktop.com (my hobby project) was encouraging.

If you would like to join the beta program for locidesktop, please leave a comment below…

One of the comments pointed out that although there is a large choice of icons available, there isn't always a clear recognizable image for each site, and it would be nice if locidesktop would use ‘favicons’. I had considered using favicons previously, but rejected the idea because they are just 16x16 pixels in size, and I wanted to use large images for icons. continue reading…

My latests hobby-project has been pushed live, in invite-only beta form. Previously known as Links Desktop, I have now dubbed it Loci Desktop, after the Loci Method.

Auto-complete in Loci Desktop

One feature of Loci Desktop is that it will auto-complete URLs when you add new icons to your ‘desktop’. Auto-complete is one of those features that users expect these days. They want the app to figure out what they want with as few key-presses as possible – and quite rightly so, typing is such a chore!

The auto-complete system for Loci Desktop, in its initial state, was straight-forward to implement. The javascript and front-end was the most time-consuming part of the job, but the back-end Python code was trivial. continue reading…

In past blogs I've hinted on the fact that I'm working on a Javascript application in my spare time. It's not quite done yet, and wont be live for a few more weeks, but I do have something that I can show off.

This project is best explained in the form of a screencast. This is the first screencast I have ever made and I'm not sure if I have done it right, or if my humble server will cope with serving FLV files. If the server doesn't manage to keep up, I'll probably Youtube it.

Update: If for any reason the above player doesn't work, you can view the screencast on Youtube. continue reading…