• "One [memory] always stuck with me was him showing a moody, uplit black-and-white press portrait of Richard Meier in the cliché black-turtleneck and severe glasses in front of venetian blinds – eyes directed up and away in search of the future – very fountainhead. Kaplicky rumbled: “This is not design”. He pointed at me to click the slide carousel forward. An image of a carpark full of Boeing employees, from design engineers to HR to office cleaners in 777 project t-shirts waving at the camera. Kaplicky, now beaming, crookedly: “This. This is design.”" Sounds about right to me.
    (tags: none)
  • "Multiplayer Design Lead Tyson Green checked a week ago in with a lengthy explanation of the melee system in Halo 3, how it’s different from Halo 2’s what worked about both versions, what didn’t work and how it’s being addressed by the auto update. here's a reminder of what he explained." Via Offworld, this frankly excellent explanation of a Halo 3 patch from early 2008, explaining the problems latency brough to melee combat, and why Bungie implemented their solutions as they did. Clear, educational, and it feels like the right answer. More writing like this, please, games industry!
  • Playground for Google's Ajax APIs. Well implemented, and very useful.
  • "Isla Lyddle End lies on the far east of the British Archipelago. It is the largest of the eastern islands in what was once the continuous land mass known as Hornbyshire. Isla Lyddle End celebrates the Golden Jubilee of The Grand Iman of Britain HH Patel bin Windsor with a minaret clock tower, constructed of hard-pack, molded synthetic carbon nodules in full compliance with the Rock and Soil Conservation Act of 2038." Julian's Lyddle End 2050 entry is excellent.

Making things is fun. It’s satisfying to watch things spring forth from nothing, made by your own hands.

The greater the gap between your own capabilities (or your perception of them) and your output, the more satisfying – not to mention bemusing – the process is. That’s why Moo‘s public API is so exciting – using nothing but code, you can create real, physical, things. Imagine that! Objects you can hold that sprung forth out of bits and bytes.

I mentioned last week that I’d worked on extending Ruminant, a Ruby library for interfacing with Moo’s API, to also handle the creation of stickers. I wasn’t doing so purely out of generosity, though; I had a project up my sleeve that I wanted to work on.

I can now show you the results of that project. Why only now? Because now, I have the physical products in my hands. I think it’s really important with something like the Moo API that you only talk about what you’ve made when it’s actually real – no showing off code and saying “oh, they’ll be here soon“. You’ve got to make the things.

Anyhow: now I can tell you what I was up to.

moostickrs.jpg

These are two books of stickers, made from of my most recent photos on Flickr. They’re built by taking data from the Flickr API, processing it on my computer, uploading it to the web, and sending it to Moo’s API. This is a single shell command. You fill out a configuration file with the important details – such as your API keys for both Moo and Flickr – and run the file. A short while later, you’ll be asked to pay for your stickers, and off you go.

The fun part of this isn’t the whole one-step thing; it’s what goes on when we process the images. We don’t just print them straight, you see.

Another short aside: making real things out of code is fun because you don’t think it should be possible, and image-processing is actually similarly entertaining, just because it feels like it should be harder than it is. Most “easy” programming comes down to processing text in, and text out. Images seem like they should be harder. In fact, images are now much easier than they used to be thanks to things like GD and ImageMagick. I had a lot of fun playing with RMagick, and it wasn’t difficult at all.

So, what did I make?

dadist-moostickrs.jpg

The first are what I called Dadaist Photographs. Moo stickers are small; it’s quite hard to see a proper photo on their small dimensions. So why not make something at once very vague, and yet also entirely precise? That’s what these are. The background of the image is the average colour of the photo, determined by summing the red, green, and blue values of each pixel in the image, and then dividing each of those by the area of the image to get the average red, green, and blue values – and then making a colour out of those. In the foreground, we super-impose the title of the photograph in text. This is, as you can tell, somewhat silly. But! It’s a hyper-realistic single-pixel photograph, and ideal for Moo’s stickers. (A quick note – I didn’t quite add enough padding to the text on these. I’ve learned my lesson for next time).

Whilst I was working on that, I had another fun idea. It turned out to be just as easy to build, as it resuses most of the same code as the Dadaist Photographs. This let me abstract lots of things out, and at the same time learn how to write slightly tidier object-oriented Ruby. Anyhow, a short while later, and we had these:

stripy-moostickrs.jpg

These are less silly, and to my mind more beautiful – they render wonderfully on paper. They are very simple to make. First, we squash the photo down to being a 500×500 square. Then, we take the middle row of pixels in the image, and replace every row of pixels in the image with the middle row. The net result is essentially a “stretched” image, based on a single row from the image. RMagick made this very easy. Like I said, I think the results are very beautiful, and it’s amazing how easily identifiable they all are.

I wrote these by first creating the image processing code. That’s the stuff I was least familiar with, and took the longest to get my head around. Once that was done, it was relatively easy to bolt proper Flickr API import on (thanks to the Net::Flickr gem), and subsequently take my processed images and throw them directly at Moo’s API, thanks to Ruminant. A small amount of tidying, abstraction, and the creation of simple config files later, and we were done.

The only slight catch is that Moo need to get pictures from the public web. I’m running my script locally, because it’s quite processor/memory intensive, so the script SFTPs the pictures to a destination of your choosing before sending them to Moo.

But that’s it. It’s one click. It works most of the time (but with 90 images sometimes chokes a little; still, it’s not hard to salvage that by generating the XML for the order yourself). Because of the processor/memory overhead on rendering the images, I haven’t put this online as a web tool – I’m still thinking if there’s an easy way to do that. This could end up on EC2 one day.

What I’ve done instead is to put it on github, so you can at least see the code to learn from it, and, if you want, download and run your own copy. (If you’re not sure what to do: install git, and then click “clone” on the github page to get the command to type to clone the repository), I can’t guarantee it’ll work on your machine, and I can’t offer any support to help you get it running, but I hope you have fun with it regardless.

So there you go. First, an idea; then, the physical product; finally, the code that makes it all work. This doesn’t serve much real purpose, I’ll admit, but it was a fun making project, and it’s hugely satisfying to see how easy it is to make things out of pictures and paper with code, starting with a simple idea.

I’m not sure if I’ll take this any further – it stands alone quite nicely – but for starters, I’m going to see if I can extend Ruminant to handle other product types – though for various reasons, that might take a little while. If I do anything with it, you’ll hear it here first. In the meantime, I hope this serves as a little inspiration for how easy it is to make fun stuff with Moo, and perhaps that my silly, surreal stickers raised a smile.

Last night, I took a look at James Darling‘s Ruminant library for Ruby. It’s a little Ruby library that lets you assembled designs and orders and send them to the Moo API for printing. It’s really nicely designed, but it’s only in the very early stages of development; it only supported creation of Minicards.

For various reasons, I’m looking at creating stickers through the API, and decided that it only seemed right to add sticker support to Ruminant.

As of last night, I’ve done exactly that. This is in part down to the joy that is GitHub. I forked James’ original code, and started work on my own Ruminant fork. I’ve added support for stickers, and have issued a pull request so that hopefully it’ll get merged back into James’ branch.

To install it, you’ll need Hpricot installed (sudo gem install hpricot). Once you’ve done that, you can install it as a gem directly from my Github code. First, add Github to the list of sources rubygems supports:

gem sources -a http://gems.github.com

and then install my gem:

sudo gem install infovore-ruminant

and follow the instructions in the README.

More to come, along these lines…

Making bridges talk

28 February 2008

I’ve written before about how wonderful Twitter can be as a messaging bus for physical objects. The idea of overhearing machines talking about what they’re doing is, to my mind, quite delightful.

So when I found an untapped data source for such an object, I thought it was worth having a poke. Half an hour of scripting later and Tower Bridge was on Twitter. It tells you when it’s opening and closing, what vessel is passing through, and which way that vessel is going. The times are determined by taking the scheduled time for the “lift” and subtracting five minutes for the opening, and adding five minutes for closing – the official site suggests that, at rush hour, lifts should take five minutes to open and close tops.

That’s it, really; it’s just a simple case of scraping some data and outputting it. It’s not a hugely frequent event, so won’t disturb you very much; if anything, it’s just a little insight into the heartbeat of the Thames.

As a note on its design: it’s very important to me that the bridge should talk in the first person. Whilst I’m just processing publicly available data on its behalf, Twitter is a public medium for individuals; I felt it only right that if I was going to make an object blog, the object should express something of a personality, even if it’s wrapped up in an inanimate object describing itself as “I”.

And, if you want proof that it works… how about this:

Tower Bridge on Twitter

I’d set the server up yesterday; suddenly, this morning, it twittered into life, and we charged out of the office around the corner to the bridge, where the MV Dixie Queen was getting into position for its lift. As it went through, I took a picture. That was a very satisfying moment.

(Thanks to Tom for helping me bash a crontab and a few other server-shaped things into shape. If you’re interested in the technology, which is really not very relevant, it’s about thirty lines of Ruby that glues together a combination of: wget, Hpricot, John Nunemaker’s Twitter gem, and cron.)

Updated June 22nd 2011 with the new URL for the bot, following this whole series of events.