elliot's blog

Need a builder? A Drupal site might help!

My brother-in-law (Jason) is a builder, based in Caterham, Surrey He asked me if I'd put together a site for him to advertise his company (he's self-employed), Alljays Building Services. The main things he wanted were somewhere to host a list of services, address and contact form, and a portfolio of work.

I decided to put him a site together with Drupal 5. The static pages and contact form were easy. But I wanted to add in a portfolio which he could edit himself. So I used the following Drupal modules to add the functionality I wanted:

  • CCK, to create a custom content type to represent portfolio entries. This meant I could create an "Example of work" page type.
  • The Image field for CCK, which gives you a simple image upload field.
  • The Views module, which enables you to produce custom summary and detail views for nodes.

With these in place, I created a taxonomy of types of work Jason does (e.g. Conservatory, Garden), and specified that each Example of work page has to be added to at least one of these categories. I then created some taxonomy-based views, to first show the types of work in the portfolio as links; each link then becomes a link to the nodes in that category, again shown in a custom view (see the site for more details). Most of this can be done through the Drupal GUI; but I wrote some custom templates to do the rendering.

The idea is that Jason should be able to login, create a new portfolio item (using Textile markup if he wants), upload a picture (and have it automatically resized), and categorise it. It will then find its way into the appropriate part of the site with no further work. On my own site (this one) I use these great, flexible Drupal features to build the navigation: create a category and/or node type, add items to it, then link it to the navigation. It makes adding new content to the right section trivial: you just set a category and Drupal does the rest.

The end result is basic but functional, and took me maybe a day to do (most of which time was spent toying with CCK and Views, which I hadn't used before). I think Drupal is a great little CMS for this type of small dynamic site, or for pretty much any kind of site; but I'd add that I think CCK and Views should be more readily available as part of the core; I'd also like to see more comprehensive documentation and examples to make it easier for people to pick up. I know I could write some, but I think it would need a good slab of time I don't have at the moment.

Holiday at Pontin's

We've just got back from a long weekend at Pontin's Camber Sands resort. We got it for about 40 quid for 4 days, through a newspaper offer. It's not really the kind of holiday I'd go for as an adult; but for Madeleine, it is bliss. She particularly loves the character shows, where they have people dressed in fluffy outfits, dancing and singing; the playgrounds and soft play areas; and activities for children, like painting and drawing. We stayed in a chalet which was freezing cold with a terrible bed (I ended up sleeping on a single in Madeleine's room to avoid it last night), but it was enjoyable nonetheless.

We had a great time, and I particularly enjoyed the family entertainment provided by the Blue Coats. We went to their cabaret show, and I have to admit to being very impressed by their performances: these people spend the whole day doing children's activities, running quizzes, performing on stage, working on the rides etc.; then spend the evening doing song and dance routines. The dance routines and singing were frankly very good, given that they were given by all-rounders. Although pretty cheesy, I had a sneaking admiration for the professional approach taken by the staff.

The highlight for me was Amethyst, a magic and illusion act that came on before the "Blues". They were hired in, not Blue Coats, and had a classic intro where a deep booming voice said stuff like:

Please do not attempt any of the magic and illusions you will see on stage. The tricks you will see are being performed by professionals.

And now, ladies and gentlemen, we present: Amethyst.

If you've ever seen Jonathon Creek, or that episode of Knowing Me, Knowing You With Alan Partridge, where they parody the overblown magic act, it was just like that.

However, once they got started, I was sucked in and enjoyed it. They ended with a particularly fine illusion where they made the illusionist bloke made it look like he'd cut off the lady's head. No idea how he did it. Madeleine loved it, too.

I don't think I'd stay in a chalet again (given a choice), but I enjoyed the holiday camp experience.

You've got to love open source

A while ago, I did some work on s33r, a Ruby library for Amazon S3. It was good fun to work on, and I used it to mess around with S3 when I was looking for a backup solution. However, I then started using Dreamhost for my backups, lost my use for S3, and stopped actively developing the project. At the same time, Marcel Molina (the Rails core fella) released his own S3 library, which, of course, outstripped the popularity of mine by a long way and became the de facto standard. All these factors combined meant that I decided to scrap my library and just refer people to Marcel's.

But it turns out some folk were still using s33r for projects, and obviously found bugs as they continued using it with newer Ruby software. I got a few bugs and patches submitted, but had little time or need for the fixes myself. I decided to suggest that the submitters take over the project as the new admins.

Tiago Macedo graciously agreed to take over the project, and has already released a new minor version and been folding submitted patches into the code base. I feel a bit like a proud father watching his child (the s33r code, not Tiago, of course) walk through the school gates on their own for the first time. The s33r code belongs to the world, not just me. I feel proud to let go of it, handing it over to someone who thinks it's worth continuing.

Java - better than you think?

I've been at Talis for a week now, and so far it's been great: the people there are top notch, extremely welcoming and very technically-competent. I'm also finding the culture invigorating and interesting, as I'm dealing with many techniques and technologies first hand which I've only been able to dabble with previously. I've also realised that I love programming. I really do. So: so far, so good.

The first project I've been attached to involves a lot of Java coding. I can't give too much away, but suffice to say we are using Spring and Hibernate (nothing too startling there, then), and approaching the project with test-driven, agile techniques, using Ant to build and Subversion for source control. This is exciting (slightly daunting, too, but mainly exciting).

And I have to admit, I am growing to really like Java, especially when written using Eclipse (the code completion, spell checking, refactoring tools etc. are first rate); and Spring is making me reassess my whole approach to coding (more and better use of design patterns).

It's also made me realise that there are definite advantages to static, manifestly-typed languages (like Java), over dynamic languages (like Ruby and PHP): a lot of errors get caught early on while coding, rather than at runtime, as the compiler is constantly checking types of variables, and making sure the type casts you do will give the results you expect. Eclipse is superb in this respect, pointing out where you're going wrong as the mistakes occur. Non-dynamic languages like Java are painful if you're coding the old-fashioned way (with a text editor); but I'm finding them much less error-prone than dynamic ones if you're coding with modern tools. For example, I refactored a section of someone else's code, and Eclipse pointed out to me where this had an impact on other parts of the code. I could just go through and make my changes wherever they were necessary. All this was made easier because of Java's manifest typing: the IDE can detect exactly where changes in one part of the code will impact elsewhere. I'm sure this is possible with Ruby and PHP (as examples of dynamic languages), but I've yet to find an IDE that does this really well.

One down-side I've found with Java is package management: pulling dependencies together to form a coherent buildable software system. I've been investigating Maven as a possible solution for this issue. My other issue is source code organisation: Rails has spoiled me by telling me where to put everything, while Java is laissez faire. More flexible, but I seem to have spent loads of time just deciding how to divide up my applications. I also find that Java is more verbose and awkward than something like Ruby, but I think there are other benefits which counter that. Let's see how I feel about it in a month or so...

More exciting developments are on the way, so stay tuned.

The nerd test

I've done these before, but even I was surprised at quite how nerdy I turned out to be when I took one today:

I am nerdier than 96% of all people. Are you a nerd? Click here to find out!

Nicola found the summary amusing:

All hail the monstrous nerd. You are by far the SUPREME NERD GOD!!!

I didn't think I was quite as nerdy as that. I suppose putting it on my blog makes me even nerdier.

Then I took version 2.0, and got this result:

See, I am really only a computer nerd.

Cat/bag expulsion scenario: my Rails book

The cat is out of the bag: my forthcoming book on Rails, grandly entitled Ruby on Rails Enterprise Application Development: Plan, Program, Extend, is now being advertised for pre-orders on the Packt website. I was keen on calling the book Rails in Context, as to my mind that is the book's strength: showing Rails in a realistic context, working with other tools. (No one else liked that title, though.) The book is not intended as a replacement for the classic Agile Development with Rails, but more as a complement to the excellent reference material that book and others provide.

The focus of the book is on building a Rails application in the context of a small business: setting up a realistic SME infrastructure for Rails, an overview of how to develop with Rails, installing and configuring a Subversion server, unit testing, using Ruby to write scripts for data import, deployment using Capistrano, and some simple techniques for improving performance using caching and load-balancing (Apache + Mongrel). The result is a simple contact management system with tasks and file uploads, which is dog-ugly but practical. If you want to see it for yourself, you can check it out from my public Subversion repository with:

svn co http://svn.receptacular.org/Intranet/trunk

I didn't write the book all on my own: I was ably partnered by Rob Nichols, a friend I met through OpenAdvantage. It's taken just over a year to write, and has been killing me in the evenings during that time, even though I only had to do 5 chapters. I think it was worth the effort, and I'm pretty pleased with the result (as pleased as a perfectionist can be). (By the way, if you're thinking of writing a book, let me reiterate what everyone says: it's hard, and probably not very lucrative from a cash perspective. I did it because I've always wanted to have a book published and I enjoy writing.)

Go and buy it. If you pre-order it now, you'll even get a discount!

New job at Talis

My time at OpenAdvantage comes to an end this Friday. It's been a great experience for me, and perhaps the best job I've had so far: freedom to follow my instincts, suggest strategy, engage in a broad range of activities (writing, training, presenting, programming, analysis, consultancy, organising events, you name it), and evangelise open source. Plus working with a great bunch of people, in a friendly and relaxed environment.

But the project was due to come to an end, and I felt like I needed a change anyway, and went off looking for jobs. (By the way, it hasn't come to an end, and will be continuing without me; the base for the project is now the Technology Innovation Centre, based at Millenium Point in Birmingham.) In the end, I took a position at Talis as a Software Engineer. They build library systems and are heavily into open data and the semantic web; they also utilise quite a bit of open source internally. I can't say I am without fear: I haven't been a full-time programmer for a few years, and the team I'm joining is disciplined and highly intelligent. But I need the challenge, and feel I need to prove to myself that I can work as a commercial programmer. I've worked full time as a developer before, but never as part of a tight team, using agile techniques. It will be good for me to have that experience.

So, the last couple of weeks, I've been trying hard to prepare by freshening my skills, concentrating on those which are core to Talis. This has meant learning Spring (mainly from the marvellous Spring in Action) and finding out more about design patterns (via the direct, fun Head First Design Patterns and the more heavy but still excellent Patterns of Enterprise Application Architecture). Along the way, I've been perusing/learning/relearning Java Server Faces, Tomcat, JSP, Tiles, Ant, Log4j, Hibernate, JUnit, EasyMock, and probably a few other things. There's a lot to take in, and my brain groans at times (especially when it reaches 1.00am and I'm still nibbling away at something), but it's been enjoyable so far. Though I could do without dreaming about Java Beans.

Producing open source: C2B2 case study

One of the firms I've worked with at OpenAdvantage is C2B2. They specialise in Java software, particularly to do with portals, and have their own open source Java portal product, iPoint. It's an interesting product, and one I think should be more widely known.

OpenAdvantage have assisted C2B2 with some marketing and feedback on their product, and I've written up their experience with open source as a case study on the OpenAdvantage website. I think it's an interesting read, as small businesses producing open source products are very much in the minority (at least in my experience - see Senokian and Clockwork Software for two other West Midlands examples). We know of plenty of companies using open source in the West Midlands, but producers are in the minority. The article goes into both the benefits and pitfalls of producing open source, and highlights issues on both the vendor and customer sides of the business.

VirtualBox: open source virtualisation

I've been a VMware user for a couple of years now, and have found it invaluable for testing different operating systems and network configurations without the need for tons of hardware. (For example, I used VMware to simulate deployments of Rails applications from my laptop to a virtual Linux server, using Capistrano over SSH.) I have the luxury of a Workstation licence, which makes it simple to set up new virtual machines and network them.

However, having heard about Xen and the like, I thought I'd have a look over the open source offerings for virtualisation and see how they measured up. This week, I have been trying out VirtualBox, a nice system which offers much of the functionality of VMware (probably all if you're prepared to read the manual properly), but which you can use for nothing. The licensing model is to charge extra for some "enterprise" features, but for me the wholly-free community version (released under the GPL) is more than adequate. Also bear in mind that I installed it on Ubuntu Linux (Dapper) and used that as the host operating system (the one running the virtual machines), but that it is available for Windows too.


The first step is to download a package for your operating system. I used the Ubuntu Dapper .deb package provided on the downloads site, which I installed with no problems. The only slight issue is that you need a few dependencies first. I had most already, but I needed a couple more. For those of you who are interested, here's the output of dpkg-query -s virtualbox, which shows the dependencies:

Package: virtualbox
Status: install ok installed
Priority: optional
Section: misc
Installed-Size: 30936
Maintainer: innotek GmbH <info@virtualbox.org>
Architecture: i386
Version: 1.5.0-24069-1_Ubuntu_dapper
Depends: libasound2 (>> 1.0.10), libc6 (>= 2.3.4-1), libgcc1 (>= 1:4.0.2), libgl ib2.0-0 (>= 2.10.0), libice6, libidl0, libpng12-0 (>= 1.2.8rel), libqt3-mt (>= 3 :3.3.6), libsdl1.2debian (>> 1.2.7+1.2.8), libsm6, libssl0.9.8 (>= 0.9.8a-1), li bstdc++6 (>= 4.0.2-4), libx11-6, libxalan110, libxcursor1 (>> 1.1.2), libxerces2 7, libxext6, libxt6, zlib1g (>= 1:1.2.1), debconf (>= 0.5) | debconf-2.0, psmisc
Pre-Depends: debconf (>= 1.1) | debconf-2.0
Recommends: linux-headers, gcc, make, binutils, bridge-utils, uml-utilities, lib hal1 (>= 0.5)
 /etc/init.d/vboxnet dba1d3dd5cf1dfa526df9f8be2cd17b8
 /etc/init.d/vboxdrv b3b219d047c0de1216db6c4b9481a233
 /etc/vbox/vbox.cfg 7fa8136a0f4330b1024b70f9d258c0a5 obsolete
 /etc/init.d/virtualbox 4946cb298821c69ebd17575c75c56fd1 obsolete
Description: innotek VirtualBox
 VirtualBox is a powerful PC virtualization solution allowing you to run a
 wide range of PC operating systems on your Linux system. This includes
 Windows, Linux, FreeBSD, DOS, OpenBSD and others. VirtualBox comes with a broad
 feature set and excellent performance, making it the premier virtualization
 software solution on the market.

I installed the VirtualBox .deb itself using:

sudo dpkg --install virtualbox_1.5.0-24069-1_Ubuntu_dapper_i386.deb

(Attempting to install highlighted my missing dependencies, which I then installed with apt-get.) Once installed, you can get it up and running from the command line with:

$ VirtualBox

The interface is plain but fairly easy to follow:

Installing Damn Small Linux as a guest operating system

My preferred distribution for testing virtualisation software is Damn Small Linux (DSL), a tiny but still useful Linux distribution. The download is only 50Mb, and it will run from a CD image; but you can also install it to a USB drive or proper hard drive, providing you give it at least 200Mb of space. I use it as the guest operating system on my Linux host, to quickly get a flavour of how the virtualisation software works.

I downloaded an .iso for DSL, created a new virtual machine, and pointed it at the .iso file as the CD image to boot from. This is what the VirtualBox configuration looks like; notice the options to mount multiple hard disks, mount a real CD drive, use USB, audio etc., as in VMware:

Once I clicked on the Start button, DSL booted off the CD image first time, blindingly fast: much faster than a VMware virtual machine booting DSL with the same amount of RAM. This was promising. Once up and running, everything worked as expected, and VirtualBox had set up the virtual machine's network connection so I could get out onto the internet using Firefox (1.0.6):

Installing Damn Small Linux to a virtual disk

However, trying to install to a hard disk was a bit more of a chore than I would have liked. To do this, I worked out this series of steps, with some trial and error. First, you have to attach a virtual disk to the machine, like so:

  1. Close down the virtual machine so it is powered off.
  2. Click on the Hard disks heading in the virtual machine configuration. This takes you to the Hard Disks tab in the configuration window.
  3. Tick the Primary Master radio button, then on the icon next to the drop-down box. This will take you through to the Virtual Disks Manager.
  4. Click on the New button to add a new virtual disk.
  5. Click on the Next button. You're now offered a choice of creating a Fixed-size or Dynamically expanding virtual disk. I chose a fixed size one. Click on Next.
  6. Set the size for the disk image. I went for 200Mb. You can leave the name for the disk at the default, and it will be stored in a .VirtualBox directory in your home directory.
  7. Click through the rest of the wizard until your virtual disk is created.

Next, boot off the operating system off the CD again. Here's where I had a few problems. While the hard disk was recognised (as /dev/hda), it wasn't automatically mounted; in addition, it didn't have a valid partition table on it. Fine for technical users, but nowhere near as friendly as VMware: I seem to remember that when I installed DSL on VMware, I didn't need to create the filesystem myself.

In VirtualBox, when I tried to run the DSL "install to hard disk" option (right click on the desktop, and select Apps > Tools > Install to Hard Drive), it failed miserably. So I got a terminal up and created my own partition on the hard drive using fdisk. My session looked like this:

I then ran the installer, choosing to use an ext3 filesystem and using the Grub bootloader (Lilo didn't work). Here's what the DSL hard disk install script looks like while it's running:

I don't know if you'd need to do this for other Live CD to hard disk installers (e.g. Ubuntu's). In most cases, more sophisticated distributions provide a graphical tool for this, so it shouldn't be such a chore. However, notice that I think I needed to specify a bootable flag for the disk (with the a option in fdisk), which you might need to keep an eye out for when installing another distribution. This might not be necessary, but I did it so that I definitely wouldn't end up with an unbootable disk.

Once I'd done this, DSL happily booted off the virtual disk and I was done.

Pros and cons

So, what do I like about VirtualBox?

  • It's open source :) and doesn't cost a penny for the "workstation" style edition. VMware's player is open source, but the workstation needs a paid-for licence key. It also means that installation is at least as easy (and will probably eventually be easier than) VMware, as it can become part of mainstream distribution repositories.
  • It runs happily on Linux and was easy to install on Dapper (providing you remember the dependencies).
  • It seems faster than VMware.
  • One feature I really like is that you can attach any virtual disk to any machine, and that disks can be managed separately from virtual machines. This means you could mount a single virtual disk onto multiple machines; so if you upgrade or change the operating system, you could still easily access data from another virtual machine by mounting its disk. I'm not sure whether you can do this at all with VMware.
  • Although I am not likely to use it, the API is fairly open; you can also run guest OSes headlessly, as I believe you can with VMware server. You can also programmatically create virtual machines, as they are configured through an XML file (I believe the virtual disk format is also compatible with the Xen virtualisation software; I don't think VMware's is). This open-ness should make it attractive to enterprises that don't want to get locked to a vendor.

What don't I like?

  • Setting up things like bridged networking seems like a real faff, involving doing quite a bit of work on the host operating system. It looked so much of a pain that I decided not to bother. This makes it tricky to do networking between the guest and the host (e.g. so you can copy files from the host onto the guest). Similarly, sharing folders looks slightly trickier than on VMware.
  • Cut and paste requires you to add the VirtualBox Guest Additions to a virtual machine, which requires compilation. This process is similar to VMware's toolbox, and a bit of a pain. I haven't bothered with this yet.
  • It doesn't quite have the interface polish of VMware, though that doesn't bother me too much.
  • It doesn't have quite the backing of tools like Xen. This could mean that it doesn't attract the same quality of engineers, and that it will have trouble innovating so fast.


This is a short, biased and probably inaccurate review of VirtualBox, but hopefully it will give you a flavour of why I think it is a useful tool, and help you get started with it yourself. I'll be using it in favour of VMware, at least in the short term, so that I don't have to pay a licence fee. It definitely suits my needs for the moment, and if you're interested in virtualisation, I'd recommend giving it a go.

Heroes catch up

If you missed the start of Heroes in the UK, you can watch the whole series from the beginning this weekend on BBC2, starting at 9.00pm on Saturday. I urge you to watch it if you are in any way interested in quality drama and/or science fiction.

Syndicate content