Archive for the Category Development


Getting tomboy notes to appear on the correct monitor in Ubuntu

I’m using a dual monitor setup using multiple X sessions instead of a Xinerama ultra-wide desktop. This means that I can’t drag windows between monitors, but it allows me to change desktops on them independently.

I found that when I set up the Tomboy notes Gnome panel applet on my secondary monitor, the notes would always appear on my primary monitor. To fix it, I had to:

$ sudo emacs /usr/bin/tomboy-panel
# Add the following line before the final “exec mono” line:
export DISPLAY=:0.1

There’s probably a neater solution (ie. could we set this when the tomboy-panel script is invoked?), but this was enough for me.

Export from OpenOffice to clean HTML

OpenOffice’s export to HTML feature produces very crufty HTML because it attempts to make the outputted document appear as similar as possible to the original document. Most of the time, I just want clean HTML. Here’s one way to get it:

  1. Export your OpenOffice document to HTML (I used the XHTML strict option)
  2. Install Ruby and the Sanitize gem
  3. Download this handy script
  4. Run like so:
    ruby sanitize_oo_html.rb < unwashed.html > pretty.html

The script contains a custom Sanitize filter that’s very simple, and it may not meet your needs. If not, feel free to tweak it. The Sanitize docs should help with that.

Deploy a subversion repository to a server without subversion

The problem

You have a website, stored in a subversion repository. The server you’d like to deploy to has shell access (ssh) but subversion is not installed, and you can’t install it. You want to be able to deploy changes to your website quickly and easily.

The solution

  1. Download this ruby script and place it in the parent directory of your working copy of the site.
  2. Edit the script and change the “src” parameter to the name of the directory containing your website.
  3. Determine the SVN revisions you’d like to deploy. This might be something like “128:132″.
  4. Run the script, like so: ruby deploy.rb 128:132
    Insert your own revisions as the command line parameter.
  5. The script will generate a file deploy-128-132.tgz. Copy this to your server.
  6. From within the production directory, untar the deploy-128-132.tgz file. This will overwrite the files that are to be modified in this update. It will also untar a delete script:
  7. Run the delete script: .
  8. Remove the delete script: rm
  9. Party!

Has this been useful? Drop me a line in the comments!

ComicHub makeover

I’ve just completed a makeover of ComicHub, which is the fun, simple and free web comic hosting site that Huy and I made about a year ago. I’ve made a number of changes to optimise the site for search engines and for humans:

  • The front page previously displayed all the features using an image. That’s been replaced by text so search engines can figure out what the site is about.
  • Added the hook text at the top of the page: “Fun, simple and free web comic hosting”
  • The sign up button is much more prominent.
  • Removed the ads from the actual comic pages(!), and refactored the ones on the front page.

If you’re interested in writing your own web comic, if you’d like to check out those that are already there, or if you just want to check out the new and improved home page, head over to


I use a LiveJournal account as a private journal, and so all my posts are private. As far as I’ve been able to tell so far, LiveJournal always defaults to public when posting a new entry.

After getting a bit annoyed, I realised GreaseMonkey would be the perfect tool to fix the UI for myself. So, I wrote a quick script to set the privacy selector to “Private” on the post page. And so, I present possibly the shortest GreaseMonkey script ever. Enjoy!


Even more rapid development with Django and jQuery

Compared to coming up with an idea, writing a web app is like trying to swim through treacle. After completing a week-long iteration on TickTickDone, it typically takes a day or two to unwind and mentally process the iteration’s work, then about an hour to come up with the tasks for the next week. Actually coding and testing those features takes the majority of the week’s 15 hours work.

The one-web-app-per-week idea is limited by how much functionality you can develop within the limited timeframe. I’d like to make my time spent coding as efficient as possible. So, I’m setting myself the challenge of creating a framework on top of Django and jQuery such that I can re-develop the current version of TickTickDone (iteration 8, made up of 8 weeks work) within one week.

At the moment, TTD’s code is not great in the DRY department. That problem exists in the javascript code and also in the python code, which is troubled by many very similar unit tests for very similar AJAX response functions. So as a solution, I plan to start by abstracting as many common patterns as I can. I’ll also try exploring the jQuery plugin library for pre-built components to help along the way, and see if I can form all of these into a cohesive library. Once I feel it’s ready, I’ll try using it to re-develop TickTickDone in a week.

An obvious alternative to this whole approach (and the one commonly used) is to hire more people to code for you. That’s not an option for me at the moment because I don’t have the money to hire more coders (a constraint), but it’s also not a great strategy due to the communication scaling problems in large teams.

Any thoughts? Has anyone done this (or tried to do this) before? Let me know in the comments.

Collapsible forms with jQuery

I spent a few hours recently refactoring the TickTickDone javascript to reduce code duplication. In the process, I generalised out a common pattern – a link that, when clicked disappears and is replaced with a form. If the form is cancelled or submitted, the form disappears and the link returns. An example can be found in the “Add a new milestone” button on the goal page of TickTickDone. I’ve packaged up the HTML template and the javascript, and linked them below. To use it, create your HTML page with a section following the format in collapse-form.html. Include collapse-form.js, and call the following in your javascript init:


Collapsible forms version 1:



Twitter + shell for Python

In response to this post, I’ve written an equivalent script in python (because I’m too lazy to get the CPAN lib):


from twyt.twitter import Twitter
import sys

username = ''
password = ''

def tweet(message):
    twitter = Twitter()
    twitter.setauth(username, password)

if __name__ == '__main__':
    message = ' '.join(sys.argv[1:])

It depends on python-twyt. Enjoy!

Twitter Obliterate

I had a request for a script to delete all the tweets in an account, so here it is:


May be harmful to your tweets, use at your own risk! I’m not sure how fast it is, since I’ve only tested it on an account with about 10 tweets. It has to send a separate HTTP request for each tweet, and it does so serially. Hopefully it’ll be adequate for all but the most massive accounts.

The tarball includes a version of the python-twyt library, modified to add support for the archive command. Patch on the way to the maintainer shortly…

Update: I’ve done a few tests and it appears the code has some bugs, but due to lack of demand I haven’t investigated any further. Let me know if you’re interested in a fix!