elliot's blog

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.

Installation

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)
Conffiles:
 /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.

Summary

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.

Too much technology

There's been too much technology on here recently, and not enough frivolity. Ironically, this has been one of my least busy periods for a while, and I've had about 6 weeks of free evenings. So my main activities have been reading and watching DVDs. So why the heck not enjoy a list of my recent entertainments?

DVDs (and quality drama):

  • Heroes. Everyone says it, but it is bloody ace.
  • Battlestar Galactica. Don't laugh. I mean the new series, not the ropey old one. I'm half way through series one, and think it is possibly the best science fiction series I've ever seen. I particularly like the idea of a religious android.
  • The West Wing. I'm a latecomer to this one, but can see what the fuss is about. Fantastic, zippy writing, great characters, moral dilemmas, humour, what more could you want?
  • House of Cards. The BBC series from the early 90s, starring Ian Richardson. Marvellous, and Ian Richardson is completely convincing, horrible yet somehow sympathetic. Get it.
  • Firefly. The short-lived science fiction series by Josh Whedon, of Buffy fame. Really good. Funny, interesting, quirky, good characters. Shame they didn't make more.

As for books:

  • The Cogwheel Brain by Doron Swade is a great biography of Charles Babbage, written by one of the blokes who recently built a working difference engine. Vivid, thorough, and does a good job of placing Babbage (and Ada Lovelace - who apparently wasn't really the first programmer) in the context of computing history.
  • Rendezvous with Rama by good old Arthur C. Clarke was one of the first science fiction books I ever read, when I was about 10. It blew me away when I was that age. I got a new copy cheap recently, and have started reading it again in a fit of nostalgia. It's grand-scale hard sf, brilliantly done.
  • The Brief and Frightening Reign of Phil by George Saunders is one of the best books I've read for ages. I'm convinced this guy is one of the funniest and potentially most significant writers of our time. I reckon his books will eventually gain the reputation of a Pynchon or Kafka, in terms of how well he satirises and captures the spirit of his age. Not heavy like those writers, which I suppose reflects the culture which produced him, but utterly brilliant, laugh-out-loud hilarious, and piercingly perceptive.

Planningtorock

One of my favourite recent finds in the music sphere is Planningtorock. I think this is a performance artist originally from the UK. She recently released an album called Have It All, which I bought through eMusic. It is a really unusual, exotic, hilarious, deranged, baroque album, reminding me of The Residents, Aphex Twin, Kate Bush, Lydia Lunch, Moloko, Kurt Weill, Goldfrapp, and Bjork, often all at the same time in one song. It's a while since I've heard something so outrageously inventive, especially in how the vocals are layered and manipulated. Well worth a listen.

Here are some of her videos on YouTube:

Syndicate content