First I tried poking around to see if anyone had done anything similar. I couldn’t find anything, although I found plenty of clocks. Close but no cigar.
With a bit more reading I realised I could do it quite directly and elegantly using the famed canvas element in HTML5. Which, you know, is here now. So, let’s see…
After some clicking…
I’m sure there are other fancy things that one could do, like putting coloured lines to indicate the start and end direction (in case your directions go backwards), and maybe putting an image in the background with a “N” at the top, just in case you are prone to forgetting. But I am pretty happy with the couple of hours work to get these looking as they do.
It’s my first time using Bitbucket. I started using Mercurial at work for my own little projects a couple of months ago. I’ve used Bazaar for my little projects at home in the past, and I’ve been reasonably impressed with Launchpad, but Bitbucket seems to have a lot of fans so I doubt I will mind too much. I am not sure which I will end up using. This time I just happened to reach for hg. It would be nice if Bitbucket knew about having multiple email addresses, but then, it would be nice if bzr was smarter about symlinks, so hey, you can’t have everything.
So I have been working on a little web app, mwfeeds, designed to provide some additional useful feeds for MediaWikis. Namely, feeds of user contribs, feeds of log events and “new section” feeds. MediaWiki already provides page history feeds (edits to a page), as well as Recent changes, New pages and watchlist feeds, but for some reason logs and user contribs don’t have their own feeds.
And as it would be harder for me to figure out how to add them to MediaWiki vs build an external application that produces them based on the API, I decided to go with the latter. Anyone who can do the former should feel free to go ahead and add such feeds directly. :)
The “new section” feed is intended for use on high-traffic talk pages and community noticeboards, where subscribing to the page history feed and getting ALL edits would be overkill.
So it’s written using web.py which is a light-weight Python framework. I got it to a state of minimal working, just running it on my laptop, and used bzr to push it up to Launchpad. I love how light-weight bzr is. Within minutes the whole world could see my code. woot!
Today my task was to figure out how to get it working as a web app that people other than me could access. So far all my webhosting (this site, and modernthings.org) is done by Dreamhost, although I can tell I’m almost ready to leap out to my own VPS. But for now — shared hosting it is.
Although Dreamhost gets a bad rap for Django, at least setting up web.py was simple. Dreamhost’s wiki has good instructions.
However the next challenge was to get the code from Launchpad to my webhost. bzr seemed the obvious way, and its install instructions on the Dreamhost wiki also worked to a T. But then there was a problem:
bzr branch lp:mwfeeds .
bzr: ERROR: Target directory "." already exists.
Hmm! But surely it must be possible to put a branch in an existing directory? I did a bit of googling and came up with naught, so I jumped on IRC to see if someone could give me an answer. And I found out that the
--use-existing-dir flag was only being added to
branch in 1.17. And the 1.17 release candidate was only released this month, so it will be a while before it is released as stable.
The folks on IRC seemed confused about why I would want to mix “versioned and unversioned data”. I explained what I’m doing and one of them suggested the plugin bzr-upload. As the readme explains,
bzr-upload is a plugin for Bazaar which lets you upload your working tree to a remote location using ftp/sftp. The main target audience is web developers who keep their web pages version controlled with bzr.
To install it, I just need to do
bzr co lp:bzr-upload ~/.bazaar/plugins/upload
Oh, and install the PPA for bzr since the one provided by Hardy Heron was only 14 releases behind. :) I love PPAs. Oh and
sudo apt-get install python-paramiko.
So then, to set myself up:
bzr upload ftp://[username]@[host]/mwfeeds.modernthings.org/
bzr upload --auto
(If you only use ftp, not sftp, you don’t need to install paramiko.)
And on my next commit… sure enough! FTP jumped on board as well. Sweet.
Now this just means I’ve solved my code syncing problem, mind, not the couple-dozen errors I get when I try to run it for the world… solving [default webserver?] vs Apache differences and Dreamhost idiosyncracies will have to wait for another day.