Killed Two Stones With One Bird

By Scott on November 28th, 2007 @ 01:08 AM

Posted in: Ruby
Comments: 3

For a long time I've wanted to learn Apple's Cocoa and Objective-C. I've also been very interested in the completely unrelated Amazon Simple Storage Service (S3). Last night I embarked upon a quest to teach myself whatever I could of those by building a rather simple, but cool Ruby on Rails application. What I should have been doing was reviewing a chapter from an upcoming Ruby on Rails book but this was an itch I had to scratch.

Instead of teaching myself Objective-C however I decided to use the wonderful RubyCocoa library. To get at the Amazon S3 service I used the also very cool library that is appropriately namespaced AWS::S3. Removing Objective-C from the equation both hindered and helped. It is a pretty tough language to read so there was a good deal of trial and error when trying to understand some Objective-C code and translate it to Ruby and RubyCocoa.

My inspiration for this tangent comes from Panic, or more specifically their Coda application. It's an awesome tool and I was really impressed by its ability to generate thumbnails of your website or project. Creating website thumbnails isn't new, Alexa at least has been doing it for years. The way Coda does it is inspiring however. They paint nice icons that look like sheets of paper curling up with a well defined shadow, giving it a believable 3D look. It's a small thing, and it's the small things that matter.

My goal isn't to reproduce Coda's thumbnails, I don't have the time or skills to do that yet. My goal is to simply create decent full or partial page screen captures of active websites. The image of the Coda web site here is a result of my efforts. Using a simple web app I enter a URL, the viewport size (default is 1024x768) and the resized version (default is 320x240). If you leave the height off it'll go full height and get entire web page without cropping. Likewise if you leave the resize height off it'll scale it in proportion to the width.

In the end I finally have a good understanding of S3 and I know that I have a long long way to go with Cocoa. Especially if I want to get into Core Image and Quartz.

Here are a few more examples:


Comments

  • David F on 28 Nov 11:19

    Nice!

    Where does Amazon S3 come into it, out of curiosity?

    Funnily enough you’ve just done something I was thinking about messing around with myself at work :)

  • Scott on 28 Nov 13:19

    David – The images are stored on s3. The rails app generates the images using RubyCocoa and the the awesomeness we call the Mac then sends them to s3 and provides a public link. If you right click any of those images and get the location you’ll see they are on s3. I probably should’ve described that part in more detail. The work flow goes like this:

    • User inputs URL, view dimensions, resize dimensions, and presses Submit.
    • Rails app generates the thumbnail, posts it to s3 with public access rights, generates URL, and ajaxically displays the image as it resides on s3.
  • Scott on 28 Nov 13:20

    OH, btw, the next stone I want to throw a bird at is using the Amazon SQS service to allow thumbnail submissions to be queued up while a little daemon works away at processing the requests one at a time. I might have to buy another Mac Mini and make it my deamon friend.

Post a comment

Boiler Plate theme for Mephisto Copyright 2006 by Scott Deming.