Archive for the ‘Ruby’ Category

Djerb: Django-ish templates in Ruby

Thursday, April 10th, 2008

As is fairly well documented by now, I like Rails, and I’ve done quite a bit of stuff in it. However, through a brief stint of work on The Carbon Account I’ve been getting my feet wet with arch-rival (ok, not really) framework Django, and I found myself hugely impressed with its templating system. A less stubborn person than me would think “That’s a nice idea. Maybe I should think about switching to Django.” My reaction, however, is “That’s a nice idea. I think I’ll steal it.”

New album from Glencoe Horse!

Monday, January 14th, 2008

Tonight I’m thrilled to be able to bring you an exclusive first glimpse of Are Great Things Born, the forthcoming album from Glencoe Horse.

[cover art: Are Great Things Born by Glencoe Horse]

…okay, so that’s a lie. Glencoe Horse (and their album) are a figment of random chance, generated by the following fiendishly complicated algorithm as introduced by Burr on the FAWM forum:

A general call went out to come up with an automatic online generator, and, well, how could I resist? My first attempt at an application in Camping (chosen so that I could take advantage of the wonderful HTML-parsing capabilities of Hpricot without the monster truck of Rails sitting underneath), it took about 3 hours to complete starting from no knowledge of the framework whatsoever, of which half was taken up finding out the best way to deploy it.

It lacks the human touch of the lovingly-photoshopped artworks that have previously come out of this concept (and replaces it with some rather horrific random colour schemes instead) but it’s still a curiously addictive way to pass a few minutes, with your finger poised over the Refresh key.

Passing remote web data to attachment_fu

Thursday, August 16th, 2007

This week I have been mostly discovering what a wonderful Rails plugin attachment_fu is for handling image uploads. You just hand it the contents of an upload field on a form, and it takes care of everything else – checking that it’s a valid image, working out its file type, choosing a sensible filename for it, resizing it appropriately, and sticking the resulting image file into either the filesystem, the database, or Amazon S3.

That last feature has been particularly handy on Demozoo, which is currently hosted in borrowed space on a server that doesn’t really have 100-odd megabytes of free space for demo screenshots. However, attachment_fu comes a bit unstuck when you’re dealing with files that don’t come from a form upload – for instance, in my case I’m planning to have a scheduled task that leeches new productions and their screenshots from Pouët, and I’d quite like to take advantage of the Imagemagick-and-S3 goodness that attachment_fu brings. A bit of digging around was in order.


Sunday, August 5th, 2007

I’m back from Assembly Summer 2007, where I launched my long-promised demoscene database site Demozoo to not very much fanfare at all. It’s been in development on and off for at least two years – I ambitiously chose it as my ‘hello world’ project to learn Ruby On Rails with, subsequently aborted and restarted it about seven times over as I learned more and more Right Ways To Do Things, and eventually reached the stage of hacking on Rails internals to make it do what I wanted (most significantly the Nested has_many_through patch/plugin, which lets you achieve simple and yet bizarrely normally-impossible relationships like ‘all productions made by members of this group’).

The initial reception of the site has been mixed; there have been excited noises from people who have immediately seen its potential, and it’s already been useful for filling in those ‘dammit, what group is he in again’ memory lapses at the pub (as well as a cunning way to startle Smash on AssemblyTV, by introducing him as “Smash of jecoute” rather than his rather more well-known role in Fairlight). It’s also attracted some (not entirely unfair) comments that it’s basically a very unfinished clone of Pouët, to which I have three replies:

  • Yes. Deadlines, party coding etc, mumble mumble, not enough time to add much data at all besides Pouët / add whizzy features other than the minimum necessary to make it work. *shuffles feet*
  • Yes. But the massively important and really subtle difference is that it can handle individual people’s nicknames properly, even where they’re duplicated all over the place. (And that’s what’s taken two years to get right, pretty much.) For example, there are at least three people on the scene who go by the name of Simon and at least two groups called CPU, but if you enter a production by “Simon / CPU” then it knows exactly who you mean. And once you’ve got individual authors in the database, you can start indexing graphics and music. And if you don’t have to pick authors from a dropdown every single time, it becomes viable to enter a whole heap of complete party results in one sitting. Which will happen, soon.
  • Yes. How about I stop trying to justify its existence right now, and work on it some more until it speaks for itself?

I like answer number 3 best.

bbgateway: Reading web forums the 1982 way

Friday, June 29th, 2007

As anybody who’s been on the internet long enough knows, online discussion was perfected in the 1980s by Usenet, and it’s all gone downhill since. Not even Google have managed to translate it into the friendly pastel shades of the Web successfully. But time marches on, and slowly but surely the conversation moves over to web forums, attracting newcomers who will never know what they’re missing – decent message threading, tracking of the posts you’ve already read – and instead have to endure topics that get locked by moderators just as they’re getting to the good bit, and (oh, the horror) graphical smileys.

And thus a great rift opened up in the ZX Spectrum fanbase. The community was divided between the ones in comp.sys.sinclair who would never touch a web forum even if their life depended on it, and the ones in the WOS forums who would never venture into the rugged wastelands of Usenet even if they were the last person alive and the second last person alive had just, in their dying gasp, posted a message to entitled “Survival tips for the last person alive”.

bbgateway is my solution to this sorry state of affairs. It’s a suite of Ruby applications that will scrape a web forum of your choosing for new posts, reformat them into old-school plain text (you know, angle brackets for quoting, and – yes! – ASCII smileys) and make them available in an NNTP feed that you can follow with your newsreader, or share with the world if you’re feeling generous. (more…)

Extreme Sudoku Solving with Ruby

Wednesday, July 26th, 2006

This is a talk I gave at last night’s Ask Later event (formerly known as Techa Kucha) in London. As per the house rules of the night, the format was 20 slides, 20 seconds per slide; in those six-and-two-thirds minutes, I told the tale of my attempt to wangle free booze from the Rupert Murdoch empire with a bit of help from a worldwide puzzle phenomenon, some home-spun OCR algorithms and a most excellent programming language from Japan.

Extreme Sudoku Solving – slides (328K, PDF)

Unfortunately the slides don’t have an awful lot of text on them, so you’ll have to do a lot of the storytelling yourself until I get chance to do a proper write-up…