In Valid Logic

Endlessly expanding technology

Experimenting in Rails

with 4 comments

Lately, have had some late night hacking to experiment with some Ruby/Rails apps. For a long time, I’d been neglecting Rails and had intentions of learning it, though always put it off. Though I’d been reading some books on it, but I tend to learn new languages by doing rather than reading.

Recently, had started using Skitch to take screenshots in OS X, but was disappointed with their Skitch.com service for posting photos online. It was ok, but didn’t have configurable thumbnail sizes for embedding and always included a tagline below the image.

It offered posting photos online via WebDAV, so I thought, what if I wrote a quick Rails app to handle the WebDAV PUT request and then I could have my own page to go along with it with customizable thumbnail settings, various pre-formed content, and no taglines. Normally, Skitch will post it then copy the image location to the clipboard (it knows the location, won’t let you return the location unfortunately), so I can paste that URL into a browser then add on ".view" to go to a custom page with options for the image:

skitchdav-20080214-003225.jpg

Right now, have it just have a regular thumbnail/link, one for thumbnail/larger in a lightbox pop-up, and a thumbnail/link in BBCode. I have global thumbnail defaults, and individual image overrides. If the thumbnail would be bigger than the original, then it doesn’t scale it and instead just does an IMG tag for the image itself. Also can upload images over the web interface, as opposed to always having to use Skitch. And it has authentication.

Nothing really super fancy and would likely take a Rails expert a few hours to whip up, though it was a good amount of experimenting for me over the course of a few nights, slowly adding this/that, getting it working on OS X, then Windows, then OS X again, and then on Linux. There are some things to be cautious of when changing environments, especially with the uploaded files (in dev, it was a UploadedTempFile, on Linux it was UploadedStringIO, on Windows I could remove it when done, on OS X/Linux I couldn’t).

I’m not about to pull a Mike Gunderloy and jump ship from .NET to Ruby, though I definitely find the "convention over configuration" approach to Rails refreshing. I think ASP.NET will get a lot better with ASP.NET MVC, and I’m impressed with it from what I’ve seen so far. But I think .NET still has a couple of lessons it could learn from Rails, such as ease of deployment, ease configuration and definition of environments, and programmatic database migrations.

A big part of it has to do with Windows developers aversion of the command line. When I used to run Linux full time, I’d always have 2-3 console sessions open, especially when coding. When developing on Windows? Most likely none, unless I need to do a ping or something. Any console window is probably just a quick test console application that is running in debug mode. The command line has so much more power than the GUI, as the command line can be nicely organized while the GUI gets cluttered with add-ons, widgets, to-dads, and task bar icons.

Perhaps I should do a short series on some of my thoughts on how .NET could adopt some of the things that make Rails so easy.

Written by krobertson

February 21st, 2008 at 8:01 pm

Posted in Technology

4 Responses to 'Experimenting in Rails'

Subscribe to comments with RSS or TrackBack to 'Experimenting in Rails'.

  1. That’s a cool hack! Email me if you’d like to talk about any of your other Skitch ideas…

    Anonymous

    22 Feb 08 at 11:22am

  2. Hi Ken! you’re looking for attachment_fu, I believe. Basically allows you to upload an image, specify if you want a thumbnail and then it stores it to your location of choice. Currently, file system, db or s3.

    clarkware.com/…/24

    enjoy rails! :)

    Anonymous

    6 Mar 08 at 1:27pm

  3. Yes, I was going to be changing it to use attachment_fu. I just found it like a week ago and was like ‘ooo’. :)

    ken

    6 Mar 08 at 1:57pm

  4. [...] years since I first started working with Ruby. Back in February of 2008, I’d posted about my first experiments with Rails.  Lo and behold, its now been two years.  I do say two years with Ruby though, not Rails. [...]

Leave a Reply