confessions of a ruby programmer

16 March 2009 updated 16 March 2009
Online accounting for freelancers

When I decided to go freelance, I spent a lot of time researching the different options available when it comes to running my own business. The simplest route is to register as a sole trader but this increases your liability and isn’t the most tax-efficient route (all profit is treated as taxable income). I briefly considered operating through an umbrella company but after some troubles getting up and running with one I decided to bite the bullet and form my own limited company.

Of course, with this option comes a whole host of administration and responsibilities; you’re going to need an accountant. You can either find a good accountant and pay them for advice and preparing your end of year returns as and when you need them to or you can pay for a monthly service and have them take care of almost everything for you. Whichever option you choose, it is well worth learning some basic accounting principles and even if you’re accountants are doing everything for you, I highly recommend keeping your own books too because ultimately as the company director you are liable for any mistakes.

Accounting software, the options

If you’re going to do your own books, you’re probably going to need some kind of software to keep track of everything. You could use a spreadsheet but there are slicker options available. There are a variety of desktop software packages but there isn’t much available for the Mac (and don’t want to boot up Windows in a virtual machine just to do my accounts). After some research I came across two online services that cater for the UK: FreeAgent and Xero. I have used Xero for the past couple of months and have now moved over to FreeAgent for reasons I’ll outline towards the end of this article.

Xero, “the worlds easiest accounting system”

Xero was the first service I came across; a New Zealand-based company who have recently branched out into the UK. They offer a full accounting solution for £19 + VAT per month.

Xero has an attractive and intuitive interface and it presents an overview of your company finances in a clear and concise manner. It will allow you to set up your various bank accounts (including any credit card or Paypal accounts) and import statements directly from your bank (it supports the standard OFX and QIF formats). It will generate attractive looking invoices for you and makes it really simple to track and manage your outstanding debtors including the ability to generate PDF statements and email reminders.

Dealing with expense claims can be a bit convoluted if you’re a one-man company. Xero’s expense claims features seem to be aimed more at larger companies that deal with multiple claims from multiple employees, requiring each claim to be itemized and approved which makes the process a bit long-winded.

Xero’s killer feature is it’s transaction reconciliation interface. Xero maintains a strict separation between your “Xero balance” and your various bank account balances, which are reconciled when you import a statement. This is all done using a combination of clever transaction matching and an intuitive interface that makes bank reconciliation a piece of cake.

FreeAgent, “online accounting nirvana”

FreeAgent offers an online accountancy solution for a range of different setups, starting from £15 + VAT per month for sole traders up to £25 + VAT per month for limited companies. They also offer a great referral scheme where you receive a permanent 10% discount for each person you refer (and who signs up to a paying account) meaning you can actually get the service for nothing if you refer 10 people. Each person you refer also receives a 10% discount on the monthly subscription.

FreeAgent is aimed squarely at freelancers and small businesses. Whilst Xero can be a bit intimidating for a newcomer to the world of accountancy, FreeAgent keeps things simple; instead of Accounts Receivable and Accounts Payable, you simply deal with Invoices and Bills. Reports are accessible and clear and concise and like Xero, the user dashboard prevents a great overview of your accounts. It even has an iCal feed of important dates (such as when PAYE, VAT and company returns are due).

FreeAgent’s focus on freelancers who operate their own limited companies is one of its strongest selling points; out-of-pocket expenses are dealt with easily, it has basic project management and time-tracking functionality and it does basic payroll for company directors. It even does the calculations for your personal self-assessment tax return.

Xero vs FreeAgent, a conclusion

Having used Xero for a few months (and finding it a pleasure to use), I ultimately decided to move to FreeAgent for several reasons.

Firstly, and most importantly, was it’s support for the flat-rate VAT scheme which Xero doesn’t currently support. This effectively made Xero’s reporting functionality useless to me as it wasn’t able to deal with my VAT and turnover figures correctly. FreeAgent deals with this perfectly, even remembering to exclude revenue outside of the scope of VAT (i.e. for US-based clients).

Secondly, the features aimed at small, one-man companies such as mine like the directors payroll, self-assessment calculations and simplified expense tracking means my life is made all the more easier, to the point where I’m actually considering canceling my monthly accountancy service and getting advice on an ad-hoc basis instead (at around a third of the cost).

One thing missing from both Xero and FreeAgent is multi-currency support although both of them are apparently working on this. However, its not impossible to manage your foreign-currency invoices in either system although it requires doing the currency conversion and handling of exchange rate fluctuations manually.

Despite having moved away from Xero, my overall experience with it was positive and they were very receptive to my feedback (several members of the Xero team can be found on Twitter). To get the most out of Xero it can be useful to learn about double-entry bookkeeping and some basic accountancy terminology but this isn’t necessarily a bad thing; in fact I’d recommend doing this whichever system you use.

Both offer free 30-day trials and neither lock you into contracts so if you’re looking for a great, intuitive online accountancy system I’d recommend giving them both a try. Overall I feel that right now, FreeAgent offers the best combination of features and simplicity for freelancers. If you want to grab that 10% discount, you’re welcome to use my referral code.

03 March 2009 updated 01 March 2009
Automating iPhone releases with Rake

So far for me the release process for Squeemote has been fairly manual. After checking the final release several times using a development build, then an ad-hoc build, the time would come to create a distribution build. I’ve done this several times now and each time I’ve gone through the same tedious steps so I thought it’s time I wrote myself a Rake task to automate the process somewhat.

If you’re a Ruby/Rails developer you will no doubt have Rake installed. Otherwise, with Ruby installed (which you should have as it ships with Leopard) then you can install the latest version of Rake using the command gem install rake. If you’re not familiar with Rake, to use this task, create a file named Rakefile in the root of your project and add the code below. To run it, simply execute rake release from a Terminal.

The Rake task is still in it’s infancy but I will continue to update the gist as I make further improvements. It performs the following steps:

  1. Bumps the build number using agvtool (see this article on using agvtool)
  2. Builds the release using my main target and by default the Development distribution
  3. Creates a folder in my saved releases folder and copies the built package (and the dsym file) to the release folder.
  4. Compresses the package into a zip file ready for uploading to Apple.

Feel free to modify this to your needs; I encourage you to fork the gist and make your changes available for everybody else.

The configuration and SDK can be overridden using environment variables so its possible to use this task to build ad-hoc releases too. The main feature currently missing is checking whether or not the build was successful or not before continuing, something I’ll fix shortly. It also doesn’t set the agvtool “marketing version” (e.g. 1.2), which I generally do manually on my repository master branch when starting work on the next version of my app.

If anybody else has any nice tips for automating their iPhone development workflow, I’d like to hear them.

17 February 2009 updated 17 February 2009
Bringing device sync to Squeemote

Since the first release of Squeemote arrived in the app store in mid-December, over 500 people have bought a copy, which is more than I’d ever imagined considering it was only originally built to fulfill my own needs (I’ve wanted to be able to control my Squeezebox like this for years).

It’s been a busy couple of months for me, ever since I decided to go it alone and especially since starting a new client project a few weeks ago, I’ve not had a lot of time to focus on Squeemote. I’m starting to pick it up again and I thought I’d give a small insight into one of the forthcoming and oft-requested features, device synchronization.

Getting the interface right

Device synching isn’t something I’ve used much in the past being the owner of just a single Squeezebox but now I also own a Squeezebox boom its something that has become more interesting to me. I’m also very aware that a lot of Squeemote owners own numerous devices and use synching frequently.

I’ve always intended to support device synching but I omitted from the first release due to the complexity involved; I believe in releasing early and frequently and I didn’t want this to hold back the initial release. When I say complexity, I don’t mean so much on a technical level (the SqueezeCenter API makes it reasonably simple to sync devices) but more in terms of how to create an effective interface for synching devices.

Having spent some time pondering the issue, I think I’ve come up with a good first draft of the interface and I want to get it out there for existing Squeemote owners to leave feedback.

I’ve reworked the now playing interface slightly to accommodate some extra controls. On the left is the as-yet unimplemented mute control. The Squeemote icon on the right brings up the new Device Selector screen.

It’s still in it’s early stages but here’s how I see it working:

I’m still not sure how this will take into account sync groups but I have a feeling that this might be enough, certainly for an initial release. Other little bonus features from this interface are:

This will be the focus for the next release (1.2) but there will be a few other extra features thrown in such as browse by Genre.

Finally, in case you missed it, Squeemote now has an official home.

16 February 2009 updated 16 February 2009
Importing comments from Mephisto into Disqus

As part of my continuing effort to strip Marley down to the bare-essentials and make it as simple as possible, I’ve moved my comments over to Disqus. This means I don’t have to worry about having a database for comments, building tools to moderate those comments or handle spam. I simply drop the comments directly into the page using a snippet of Javascript (I’m actually using Norman Clarke’s Ruby disqus library to make this even easier).

To import my old Marley comments into Disqus, I used Locomotivation’s handy Sinatra Disqus Importer. It’s a super-simple Sinatra app that takes an RSS feed of your existing blog posts and comments and uses that to feed the comments into Disqus using it’s API.

I wanted to do the same for all of my old Mephisto-powered blog comments. Doing this was fairly trivial, it just required a script to take the content from the Mephisto database and spit out an RSS feed that I could use with the Sinatra importer. Having imported a mysql dump from my server into my local MySQL database, I was able to use ActiveRecord and Builder to generate the RSS feed; here’s the code in case it’s of any use to anybody. It’s a bit rough and you might need to tweak it a bit but it does the job.

03 February 2009 updated 17 February 2009
Remote pair-programming using iChat

When I worked at Reevoo we tried to live by a mantra of “pair on all production code”. Sometimes this wasn’t practical (there would often be times when there was an odd number of us available) but its a rule we tried to stick to wherever possible.

Obviously, now I have gone freelance, pairing isn’t always a luxury I’ll have – that’s fine, I’m comfortable working on my own – but I’ve always felt that some of the best code I’ve ever written has been code that I have written in a pair. Fortunately, for my latest client, I am able to work with my former Reevoo colleague James Adam who some of you may know as the author of the Rails Engines plugin and one of the co-organisers of the London Ruby User Group and the awesome RubyManor conference (don’t forget to check out some of the videos).

Coding remotely

From the outset, we were both agreed that we would prefer to pair on as much code as possible. The problem would be that we wouldn’t always be in the same location. We’ve both taken up membership at The Hub which gives us a shared space to work once a week or so but the rest of the time we would both be working from home.

This isn’t a new problem; in fact it was one that some of us at Reevoo have experience with using a combination of screen and vim. However, vim isn’t really my bag and I’m far more productive using my editor of choice, Textmate.

VNC was an obvious solution but if you’re both Mac users, iChat offers a far more integrated solution, offering instant-messaging, voice chat and most importantly, seamless screen-sharing. iChat’s built-in screen-sharing solution is fast enough to work on one person’s machine whilst making it easy to switch back to your own machine when necessary. Even better is if you have a dual-screen setup (I run my MacBook connected to a Dell 20" monitor). Using this setup, I can run James’ screen on my Dell, leaving my MacBook free for background tasks like email, twitter etc. It’s not perfect, there are a few technical niggles; but it has worked well for us so far.

Remote pairing tips

What has surprised me the most is just how effective this approach has been. I feel like we have been working just as effectively as if we had been sat in the same room together. We get from all of the usual benefits of pairing; the ability to bounce ideas off each-other, catch minor mistakes that the other person has missed, discuss alternative approaches to a problem and tempering another person’s enthusiasm with some caution (e.g. “maybe we could do [some cool idea]…yes that would be good but do we really need to do it now?”). If I would offer some tips when using this approach, they would be:

If you’ve never paired before, or have been put off of pairing because you work remotely, give it a try; you may find you write better code than you ever did before. Does anybody else pair remotely? If so, I’d love to hear your tips.

23 January 2009 updated 15 February 2009
Squeemote 1.1 now available in the iTunes store

Squeemote 1.1 was finally approved by Apple this morning and is now available in the iTunes store. This is quite a hefty update with a number of new features, improvements to existing ones and numerous bug and performance fixes. Here’s the run down of changes:

There are a few outstanding known issues mainly relating to Squeemote no longer picking up changes from the server after coming out of standby. These will be resolved in 1.2 which is progressing nicely and will hopefully be submitted to Apple in the next week or so.

I’m also pleased to announce that Squeemote now has it’s own website. It’s not quite finished yet but I believe in releasing as soon as possible. Look out for a Help/FAQ page over the weekend.

On a technical note, I did a fairly significant piece of refactoring to the underlying code that retrieves the remote data and displays a “Loading…” view whilst this is happening. I hope to write a blog post about the methods I used to accomplish this and will be releasing the generic code behind this under the MIT license.

19 December 2008 updated 02 March 2009
Squeemote, the Squeezebox iPhone remote, ready for sale

Update: You can find out more information about Squeemote on the official website

After some wrangling back and forth, I’m happy to announce that my first iPhone application, Squeemote (formerly iSqueeze) is now available on the iTunes application store.

Squeemote for iPhone and iPod Touch is a remote control application for the SlimDevices Squeezebox™ and similar devices such as the Duet and Boom. This first release is aimed at people who mainly use their own music library rather than streaming services (support of which is currently limited). I intend to add browsing support for streaming services in a later release but my main focus for this initial release was on quality over quantity: I didn’t (and do not) want to cram it with features. I focussed on making this the best possible experience for browsing your SqueezeCentre library and controlling your device.

I already have some ideas on further improving the user experience for music browsing and playlist management that will appear in a future release. Another area which is currently quite basic is device management; Squeemote supports multiple devices and allows you to choose which device to use and set a default device but there is currently no support for grouping devices for synchronous playback. This, plus browsing support for streaming services will be my priority in the next major release.

It’s been an interesting experience writing my first ever iPhone (or Cocoa) application and getting it submitted to the iTunes store but I’ll save the technical notes for a separate post.

If you have any questions or problems, feel free to leave a comment or drop me an email. I have also set up a support page on GetSatisfaction.

Download Squeemote from the iTunes Store

18 December 2008 updated 15 February 2009
Quick and easy hosted websites with GitHub

Chris Wanstrath from GitHub recently tweeted about his new website. Whilst trying to load it earlier today I accidentally misspelt his username, revealing a GitHub feature that I hadn’t come across – GitHub pages.

Simply go to yourusername.github.com and you’ll be presented with a friendly error page explaining how to set up your own github.com sub-domain website. It’s fairly straightforward – create a repository named yourusername.github.com, create a local master branch and push it to GitHub. Within ten minutes or so, your new site will be up and running. Very cool. Here’s mine (yes, fairly pointless I know). And here is another.

Update: It seems that I just beat the guys at GitHub to it with their official announcement.

04 December 2008 updated 15 February 2009
A Brave New World

I’m writing this from the depths of the London Underground system, on a Northern Line train out of the city. I’ve just come from several meetings regarding some forthcoming opportunities. This is the beginning of the next step of my career as a Ruby programmer.

Last Friday was my last day at Reevoo. I had been contemplating leaving for about a month when some unexpected changes at Reevoo forced my hand. In many ways I had become tired of working on the same thing week in, week out and I craved new challenges. It is with some regret however that I leave what is in my opinion (and others) the best Ruby/Rails team in the UK. I have learnt a lot over the last 18 months and much of that is due to the sheer breadth and diversity of knowledge across that team as well as everybody else at Reevoo. I have learnt how to be a better team player, I have come to appreciate pair-programming more than I ever did and I have faced the real day to day challenges of being part of an “agile” team.

As of this week, I officially enter the world of Ruby contracting. Inspired by the likes of Obie Fernandez (I’m a big fan of his blog and I love what the guys over at Hashrocket are doing), Jay Fields (the linked article is what really got me thinking in the first place ) and James Adam, (my former Reevoo colleague, who has recently gone “free-range”), I have decided to take the plunge and fully invest in building my “brand” and jumping head first into the contracting world. I have been working with Rails since almost the beginning and it has taken me nearly four years to get to this point. It’s a scary prospect, leaving the comfort and safety of a regular monthly income but with hard work there is the prospect of great rewards. I look forward to working with other members of the Ruby and Rails community across a wide range of projects.

if you’re looking for a Ruby/Rails expert to help out with your project.

Blogging, Git style

You may have noticed the new design. The main objective of the new design was to move towards a traditional blog-style format; I liked my old design but it certainly placed an emphasis on individual articles, something that I’ve had less and less time to write, hence the scarcity of posts in the last year. The idea is that with the new design, I feel less pressure to write long article-style entries and therefore blog more frequently. I also feel that now more than ever is an appropriate time for a refresh.

I’m no longer running Mephisto but am instead using a heavily modified version of Marley, a lightweight Sinatra app that comes with no admin interface but instead pulls blog entries from a git repository. This means I can write all of my posts offline in my favorite text editor in an iterative fashion, stored in a local git repository and pushed to github when I’m ready to publish (Marley pulls from GitHub by way of a post-receive hook). Marley is relatively new and was a bit rough around the edges but I found it a great base platform to start hacking away on (as you can see by the frequency of commits to my github fork over recent days).

I’ve also abandoned my old nginx/mongrel deployment setup and moved back to Apache running Passenger – the ease with which you can configure and deploy a simple Rack-powered app like Marley (or any Sinatra based app) is astounding. No more messing around with monit configs and restarting of mongrels for me. I’ve set up some mod_rewrite rules so all of the old blog URLs should 301 redirect to the new URLs.

There’s probably a few bugs here and there, and some of the images might be broken until I’ve had a chance to reupload them. There is currently no syntax highlighting on code samples; this is on my todo list. I’ll hopefully iron these issues out over the coming days. People who have subscribed to my feed using the FeedBurner URL should not need to change anything; those who were using the direct URL should subscribe to the FeedBurner URL instead.

Are you a Ruby and/or Rails contractor? How’s it working out for you?

12 August 2008 updated 20 April 2009
iPhone App store: one month on

The iPhone 3G and the app store launched about a month ago now and I think it’s been somewhat of a mixed bag: there is a plethora of shit on there which makes it hard to spot some of the gems.

When Apple announced the $99 fee for the developer program, there was an initial feeling that this would help reduce the number of people with little interest in writing original/interesting/quality apps. Unfortunately it hasn’t; a cursory browse through the app store reveals more tip calculators, fuel/expense trackers, note-taking apps, todo lists, Sudoku, and converters than you could shake a shit-covered stick at. And then there is the really pointless crap: flashlights, novelty apps, fucking candles (and they even have the audacity to charge for this rubbish), not to mention the people who don’t have a clue what user interface guidelines are all about and what makes a good UI (yes, I’m talking about you Stevens Creek Software – you’re apps are an abomination).

That said, there are good apps on there, some of which are of really high quality. Here’s a few that I use regularly:

NetNewsWire

I’ve tried many RSS feed readers on my Mac but I’ve always come back to NetNewsWire. It’s the only feed reader that just feels “right” to me and the syncing between all of my machines courtesy of it’s online NewsGator service is probably it’s killer feature. I’d tried various web-based readers optimised for the iPhone prior to the the app store launch, including NewsGator, but they always seemed slow and clunky so I was quite happy to see NetNewsWire for the iPhone make it out of the door so early.

Downloading feeds over an EDGE or GPRS connection can be painful but since upgrading to the iPhone 3G, it has been a pleasure to use, syncing with my online NewsGator account to retrieve a list of feeds and read/unread data.

A few usability gripes: with a long list of feeds, it can become hard to distinguish between folders and feeds; some kind of visual distinction would be useful. It’s also not immediately obvious that you can view articles with the built-in web view by tapping on the article heading (there is a separate button to view in Safari). Both minor gripes however and if you need your constant RSS fix, NetNewsWire should be at the top of your “to buy” list. NetNewsWire App Store link

Texas Hold’em Poker (Apple)

OK, if you don’t play poker and your eyes are already glazing over, you might as well skip this one. This app is developed by Apple themselves and it shows. The game is straightforward: compete over a number of venues from your garage though Las Vegas all the way up to Dubai with the stakes and difficulty increasing as you progress.

The AI isn’t exactly brilliant and there will be times where the game is just plain frustrating: you’re heads up and you put your opponent all-in with your KQ suited and he/she calls with 10-2 off-suit, only for the flop to come down 10-10-2. It’s probably a good thing that this isn’t for real money, lest you throw your phone out of the nearest window. However, the AI is “good enough” for a fun game of poker and it makes a the daily commute slightly less tedious.

Where this app really shines and makes it so obviously an Apple product is the near-perfect use of the iPhone’s touchscreen gesture support to provide an intuitive and fun user interface; cards can be folded by flicking them into the middle of the table; chips and be pushed into into the pot to go all-in; checking is as simple as tapping the table. You can also switch between a virtual-table mode (where you can see the players as the look at their cards and place their bets) and a more traditional racetrack mode (familiar to anybody who has played online poker) by simply changing the phone’s orientation. Texas Hold’em App Store link

Vicinity

One of the first apps that I’ve played with that takes real advantage of the location-based services available; after working out your location using triangulation or GPS, it provides you with a list of useful locations in your vicinity (do you see what they’ve done there?): nearby places, cafes, banks, pubs, supermarkets, taxis, hotels and restaurants. Again, this wasn’t very useful on the original iPhone as the cell-tower triangulation was just too slow for it to be usable but on the 3G its incredibly useful. The wikipedia/flickr links are a nice added bonus, especially if you live in a busy area/large city with many points of interest such as London. Vicinity App Store link

Facebook

This native app is a continuation of the good work that the Facebook team have already done with their web app – for my money one of the best web apps available for the iPhone. The native app doesn’t offer a whole lot more but it does mean a faster, smoother user experience (e.g., swiping a message in your inbox to reveal a delete button ala Mail) and there is also now a built-in chat option. Unfortunately there still doesn’t seem to be a way to edit your profile (other than your status, which I update through twitter anyway). Facebook App Store link

Twitterific

As well as NetNewsWire, Twitterific was another app that I installed straightaway. It’s not bad but it doesn’t match up to it’s desktop counterpart – I find the dark interface quite ugly on the iPhone (there is a light interface in the paid-for version although I can’t find a screenshot of this anywhere – is it really too much to ask to have this as an option in the free app too?) and scrolling is very slow and clunky. I don’t mind the ads though so I don’t really feel compelled to pay for the premium version (the same goes for the desktop version). Despite it’s lack of polish, I still think it’s the best Twitter client available (at the moment). Twitterific App Store link

Things

I’ve also grabbed a copy of Things. The interface is very pretty and I’m sure the app will eventually be great but I still need to motivate myself to use it. One thing I’ve found lacking is the ability to set alarms/receive reminders for scheduled events although I suspect that is a limitation of the platform itself. You really need to be checking it every morning to get the most out of it (although I suspect that is the idea if you’re a GTD addict). There is also no syncing with the desktop version which is a deal-breaker for many (not me) but I’d encourage you to snap it up at the introductory price and wait for syncing which will arrive as a free update. Things App Store link

Speaking of updates

Unfortunately, the worst part of the whole experience is the App store itself and the way iTunes and the iPhone sync with eachother. When you plug your iPhone in, any apps you’ve downloaded via the iPhone app store don’t seem to sync to iTunes automatically – instead you need to manually select “Transfer purchases”. iTunes also seems to be confused about any updates that I need – it frequently tells me that I have “x apps requiring updates” when in fact there aren’t any. The iPhone App store app itself seems slow and buggy and on occasion has caused my phone to freeze altogether, requiring a hard reset – not good.

Writing my own apps

I’ve been meaning to learn how to write Objective-C/Cocoa Mac applications for a while now but haven’t ever gotten around to it. The release of the App store and the iPhone SDK has turned out to be that kick up the backside that I’ve needed – I’ve recently started learning Objective-C/Cocoa and I have a few apps in mind (I’m already working on a native iPhone interface for the SqueezeCenter software that powers Squeezebox music players.

Given that I have very little knowledge of C and absolutely no GUI app programming experience whatsoever, it’s been an interesting experience and a change of mindset (coming from a web development background) that I’m slowing coming to grips with and I’m sure I’ll be blogging about it over the next couple of months (fucking NDA not withstanding). As a Ruby programmer by day, there are certainly times when Objective-C makes me want to cry although it has some own elegances (sic) of it’s own that I’m starting to appreciate. More to follow…

« View older posts