In Valid Logic

Endlessly expanding technology

Experimenting in Rails

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 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:


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.

Thursday, February 21, 2008

blog comments powered by Disqus