elliot's blog

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:

Thank you, GParted

I bought a new Maxtor Personal Storage 3200 (external USB drive with 400Gb capacity) this week, so I could make better backups. It came it at £60 from eBuyer, which I thought seemed reasonable.

When I first plugged it in, Ubuntu Linux recognised it OK, but wouldn't let me write to it, even as root. On inspecting the output of dmesg, it turned out it had been formatted using NTFS, and mounted as read-only. Not much use for backups.

I decided to delete the existing partitions and create new ones, using fdisk and parted, two command-line tools which I know a bit. However, while I could create the partitions, there seemed to be a problem with the partition table, and fdisk kept spitting out an error message which looked like this:

Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table.
The new table will be used at the next reboot.
Syncing disks.

This seemed to render the drive unusable: it wouldn't mount; then it mounted but was unreadable. I tried different filesystems, but couldn't get anything to work. I googled around, and apparently this is something to do with how NTFS and the BIOS interact (see this article for details). I thought "There goes £60 of hardware". Though I then thought "Probably Windows can fix it, if necessary".

Just as I was starting to despair, mainly at the prospect of having to boot Windows, I decided to give GParted (Gnome Graphical Partition Editor) a go, to see if this could help. I haven't used this before, but I am bloody glad I did today. The interface is similar to PartitionMagic (if you're familiar with that), and it was really simple to delete my screwed partitions and create a new ext3 one on the external drive with it. Once I unplugged the USB cable then reattached, the drive was recognised and writable. Thanks GParted guys!

iPlayer - response to petition

I recently signed a petition asking that the BBC's iPlayer be made available for users on platforms other than Windows (I use Ubuntu Linux on my laptop). iPlayer is an initiative to make the last 7 days' TV available to computer users via an in-browser viewer; however, the beta version is only available for Windows, and until now the BBC have been cagey about whether it will make it to other platforms. (Though I note that they now mention on the iPlayer page that they intend to get it to work on Linux and Mac eventually.)

The government's response to the petition (see petition and response) seems positive, as it states:

The BBC Trust made it a condition of approval for the BBC's on-demand services that the iPlayer is available to users of a range of operating systems, and has given a commitment that it will ensure that the BBC meets this demand as soon as possible. They will measure the BBC's progress on this every six months and publish the findings.

Let's hope they keep to the promise so every licence payer can take advantage of iPlayer. Ideally, I'd like to see it open-sourced as well. I can't see any benefit to keeping the source closed, particularly as the BBC is publically-funded, and (I'd argue) has an obligation to return as much as it can to the public. They might also find that open sourcing would help get it ported to Linux far more quickly.

Patchworking and being a generalist

As I've mentioned previously, my current contract with OpenAdvantage runs out at the end of September. (The organisation will continue to exist, but at different premises and with a slightly different structure, by the way.) During my job hunting, I considered various ways of working, including becoming a contractor, working part time, or taking up a full time post; I've also been talking to my wife (Nicola) about which road I should go down, and had a big shake out of my ambitions and career goals.

One lesson I've learned from my interviews and job hunting is this: I am a generalist. I have moved across the whole spectrum of computing, from doing a Ph.D. in Artificial Intelligence, through to developing e-learning materials, administering virtual learning environments, to programming and web development, to broader "business analysis" and open source advocacy. Along the way I've picked up a lot of knowledge of many different areas of computing, from the business level right down to the code level, with bits of everything in-between. However, the only thing I am a real specialist in is the theory of abductive interpretation (my Ph.D. topic), which you don't see on many job descriptions.

My worry, then, was that I didn't have a path to follow, a career I was definitely looking for. I was unlikely to find another role like the one I have at OpenAdvantage, very flexible with a huge range of activities. Consequently, I've been applying for a variety of roles, from business analyst to programmer to lecturer to trainer. Does this mean I don't know what my "career" should be? Or that I am sufficiently generalised to be able to fit to several types of role? Maybe it's not me that needs to be more specialised, but the jobs which need to be more general.

The main thing I've realised is that I need flexibility, so that I can work around my family, rather than work against them. That has been one of my main guiding principles throughout.

This then got me thinking about how I, Nicola and our friends organise our time, and how they'd like to work. We know quite a few people with young families, and there is a definite shift to parents wanting to share child care responsibilities. I was talking with Nicola about this this morning and she came up with a brilliant definition for this:

patchworking: working in two, three or more jobs, most of them part-time, perhaps shared between two people, to make up a full salary.

Here are some examples of patchworkers we know:

  • A. and S.: A. works 4 days a week and has the children for one day; S. works a few days and evenings to make up the rest of their salary.
  • A. and N.: A. works on contracts 2.5 days of the week; N. works 5 half days; they share the childcare.
  • X. works as a photographer and writer; Y. has a near full-time job.
  • C. works for half of the week and makes up the rest of her income selling items on eBay.

Nicola and I work a bit like this: I have a full-time job, but Nicola works evenings or the occasional weekend to provide a bit more money for luxuries. I have also been working a few evenings where I feel like it, again for a bit of extra money.

I think patchworking is an interesting trend, and one I'd like to see supported by more companies. One thing I've noticed when applying for jobs is how few part-time, flexi-time or home-working opportunities there are available. I suppose this is partly for efficiency reasons: it's easier to manage one person full-time than two people part-time. Though I'm sure there might be benefits to splitting a role in two: having two heads might be better than one; you could specialise roles to a finer grain and make sure you get the right person for the right part of the job; you could commodotise certain parts of a role to a less-skilled employee; etc.. Perhaps some of you know of good references looking at the pros and cons of full-time vs. part-time staff?

There is the option of contracting, of course, and setting your own hours, but I am fairly risk-averse, and have shied from this for that reason. It would be nice to get some of the benefits of patchworking, but without having to take the risks associated with contracting.

In I.T., lack of support for patchworking seems particularly crazy: as open source projects have proven, there is no reason why software and I.T. projects can't be carried out by distributed teams who hardly ever meet and work at different times of day. I understand the need and efficacy of physical meetings to support particular phases of a project. But in many situations, the requirement to physically be in an office derives from habit rather than need.

Patchworking also points, perhaps, to the trend towards people having lots of short-term careers, rather than one over-arching one. You quite often hear about people changing career quite late into life, or moving between vastly different areas of work. Again, this is a trend which is likely to continue, and one I think businesses in the UK should take notice of and respond appropriately to.

Syndicate content