March 2007 Archives

The Wonders of TextMate

The more that I use TextMate, the more that I love it. While it has yet to reach the same level of utility for me as Quicksilver (the single best free application available for the Mac bar none), I already use it for all of my Ruby editing (although that may change with the addition of Ruby introspection to NetBeans). But now, it turns out, that TextMate includes a Blogging “bundle” that almost provides the same features of MarsEdit–itself a $29.95 purchase. While TextMate isn’t free, that it handily provides so many features out of the box simply adds to its value.
If you’re a Mac user and a coder, it is well worth the expense.

Posted by evan on Mar 25, 2007

AppleTV

There is so little to say…
In terms of usability. it’s what a PC-to-TV interface should be. My wife, who is a far cry from the most tech literate of people, was ably navigating through most of our digital content in less than a minute.
But then I did say “most”…
The AppleTV supports MPEG-4 and h.264. Left out from this is support for any Microsoft formats and, more importantly, XviD and DivX. However, intrepid geeks are already busily hacking support into the AppleTV for both decoders and larger hard drives. That’s all well and good but talk to me once I can add these features without voiding my unit’s warranty.
As the AppleTV comes equipped with a 40GB drive, those of us with large-ish collections must stream content from iTunes. Is there a penalty? Only slightly. You can stream from up to five different iTunes libraries. Also, streaming start-up time, over an 802.11g network, takes on the order of a few seconds. Finally, fast forwarding and rewinding only works to the extent of the content buffered in memory – somewhere around 30 seconds to 2 minutes depending on the file size, I suppose.
All in all, I’m extremely pleased. It’s usable, makes my content portable, and now I can get to all of it through our 55” widescreen LCD DLP TV.
Oh, and all of that preparation that I did a couple of weeks ago? So worth it.

Posted by evan on Mar 25, 2007

Capistrano Conundrums

These past few weeks, I’ve been tinkering with Ruby on Rails – a few hours hear, an hour there. This afternoon, the web app that I’d been working on, a simple blogging application for my wife, was finally ready to be deployed. I certainly could have deployed the app manually but then I’d have deprived myself of the opportunity to further test just how much I can automate with Ruby.

So I installed the Capistrano gem, pulled out my Rails Cookbook, and went to work. I’m glad to say that the Rails Cookbook’s treatment, although brief, is more than enough to get a Capistrano neophyte, such as myself, off to a good start. However, as so often happens, what began as a simple exploration turned into a multi-hour campaign.

Don’t misunderstand: Capistrano is fairly simple if you have a basic web application – such as the blog I had built. However, the eccentricities of my webhost’s Rails support added to the complexity. Fortunately, several intrepid souls pieced together a wiki page on Dreamhost Capistrano support as well as Dreamhost Ruby on Rails guidance. Ultimately, I was successful.

However, the one peculiarity that I cannot fully account for involves Dreamhost’s handling of subdomains. When creating a subdomain, a directory is created, under your user directory, with the name of the subdomain (i.e., “/home/yourname/yoursubdomainname). This subdomain directory, by default, functions as your subdomain’s htdoc directory. Through the Dreamhost UI, it is possible to specify a directory beneath the subdomain directory to act as the subdomain’s htdoc directory. However, I’m uncertain how Dreamhost implements this feature. In my case, I pointed the subdomain’s htdoc to /myhome/current/public where “current” is a link created by Capistrano to my latest deployment. Oddly, when I deploy a new release, the new release does not appear on the subdomain until I go into the Dreamhost subdomain adminisration page and reapply my htdoc path as described above. Literally, I go into the subdomain administration page and hit “apply” without making any changes. Suddenly, the subdomain’s new release appears.

Other than this one peculiarity, I have to say that I’m overall very pleased with the abundance of information provided by Dreamhost and it’s user community as well as the overall effectiveness of Capistrano.

Posted by evan on Mar 18, 2007

Ruby + RubyOSA = No more hand-jamming metadata in iTunes!

Having a Mac and a lot of DVDs, I happen to be quite fond of Handbrake. However, how is one supposed to organize all of this video within iTunes for inevitable use on an AppleTV, I ask you?

Videos imported into iTunes 7 automatically register as “Movies”. So how do you handle TVShows? By changing/adding metadata to each of the populated fields on these screens:

video.png

info.png

That’s a whole lot of metadata! Sure, you can update all of the metadata by hand but, really, who has the time?

So I wrote some code.

With RubyOSA, the world of AppleScript is now available to Ruby developers – without the trama of learning AppleScript!

If you can understand the code below, you should be able to figure out how to tweak it ever so slightly as necessary to have it manipulate your media of choice.

require 'rubygems'
require 'rbosa'

$show = "Babylon 5"
$year = 1994
$itunes_search_str = "B5"

app = OSA.app('iTunes')
exit unless not app.nil?
movies = app.sources[0].playlists.find { |p| p.name == "Movies" }

tracks = movies.search $itunes_search_str
tracks.each do |track|

  puts track.name

  track.name.match /B5\\s-\\s(\\d+)\\s(.*)/
  track.name = $2
  track.track_number = $1.to_i
  track.artist = $show
  track.album_artist = $show
  track.album = $show

  track.show = $show
  track.episode_id = $1.to_i
  track.episode_number = $1.to_i
  track.year = $year
  track.season_number = 1

  track.video_kind = OSA::ITunes::EVDK::TV_SHOW
end

Posted by evan on Mar 11, 2007

Who is this Evan Light guy anyway?

Geek ergo sum

Evan Light is a professional software developer of 14 years the majority of which were woefully misspent working in Java. His more redeeming attributes include being married to a wonderful wife, raising three cats (who are his true masters), and having several years of C and a few of Ruby under his belt. He only developed the itch to code in his spare time upon discovering Ruby. Now, entirely too much of his life (and his wardrobe) is made up of Ruby.

Posted by evan on Mar 11, 2007