jlaine.net

Making Capistrano Not Suffocate on Cleanup

When trying to deploy an app on the production server, the deploy:cleanup task always died for me like this:

  * executing `deploy:cleanup'
  * executing "ls -x /opt/sites/mysite/releases"
    servers: ["myserver"]
    [myserver] executing command
    command finished
 ** keeping 3 of 4 deployed releases
  * executing "rm -rf /opt/sites/mysite/releases/20080220092659"
    servers: ["myserver"]
    [myserver] executing command
 ** [out :: myserver] sudo: no passwd entry for app!
 ** [out :: myserver] 
    command finished
command "rm -rf /opt/sites/mysite/releases/20080220092659" failed on myserver

Turns out capistrano is for some reason trying to use a user called app in the cleanup task even though the :user parameter is set to something else in config/deploy.rb. The solution was to set the :runner parameter as well:

set :runner, 'someotheruser'

Don’t ask me why that worked. It seems a bit counterintuitive that the cleanup task uses the runner param rather than user. Found the hint towards the solution here.

Hate to Say…

December 2007

For gawd’s sake, what did they smoke in your company’s Christmas party?

(A text message I sent to my buddy Thomas who works in Sampo Pankki in reference to the news that the bank (recently bought by Danske Bank) would deploy a new “security” system (that uses a Java applet) in their online banking solution).

April 2008

The latest reactions inclule [sic] 52-year old male customer returing to the bank with an axe after hearing that his account is empty, money exchange company Forex stopping accepting payment cards from Sampo Bank and Sampo Bank customers not being able to buy train tickets online.

(Finnish Sampo Bank’s ICT problems cause extreme reactions in their clientele)

On Multitasking

Now, this has been talked about in detail in the past, but here are two recent interesting discussions about multitasking. On the Ruby on Rails Podcast, Geoff interviews Dr. John Medina in a "two-part series about his new book, Brain Rules: 12 Principles for Surviving and Thriving at Work, Home, and School.

One of the most interesting topic in the discussion is about human multitasking, and to be precise, the lack of it. One of the hot topics in this discussion is the debate about talking in phone while driving. Medina brings up recent studies that show talking while driving is as dangerous as drunk-driving, no matter whether you use a hands-free set or not. As a reason, Medina proposes that when discussing with someone remote interactively, you build a mental image of the counterpart (just like you do when reading a novel) which takes your concentration away from driving. That sounds certainly believable. I have many times noticed that I’ve been driving for minutes while talking in the phone (with the iPhone headset, of course) and then suddenly kind of wake up back to the traffic.

Meanwhile, Rands explains how he doesn’t multitask even though it might appear as if he would to the outsider.

A Track of Two

If you’re into photography, here’s a couple of quick links that might be of interest:

  1. Scott Bourne and Alex Lindsay, of MacBreak Weekly and many other fames, have started a new podcast under the Pixelcorps.tv umbrella: This Week in Photography. The guys are really great podcasters and the content is kind of semi-advanced so that it’s not boring even if you’re fairly competent (even pro, I would say) but also not overwhelmingly technical. Great stuff during long exercises like a track of two1. The third episode of TWIP discussed the state of Aperture and namely the lack of announcement of version 2 during the PMA. That gives us a nice segue to the next topic:
  2. Aperture 2 is here! Downloading it right now and have high hopes for the performance. Especially creating previews and exporting photos leaves a lot to be desired in 1.5, and if the first comments around the ’net are to be trusted, the newcomer should be vastly better in this regard.

1 A track of two (or “kakkosen latu” in Finnish) is a term that came from a two-hour cross-country skiing (preferably classic) exercise and is now a synonym for any longer training pass (run, ski, hike, whatever) of around or over two hours.

The Best of Times, the Worst of Times

I’m kind of sad that Blu-ray has taken the lead in the next generation digital video disc race, and that has little to do with the fact that I don’t really like Sony. The reason the lurking death of HD DVD makes me really sad is that while it has smaller capacity than BD, it has one thing really going for it: it’s void of one of the pests of modern times: regional codes.

Jeremy Keith recently wrote about DVD’s and Wii games that he bought during his Christmas trip to US that he cannot use because they are limited to be played only by a player with the US region code. Now, there are region code-free players available, but that only makes the whole scheme more pointless.

Now, with HD DVD being free of the region codes, we could have gotten rid of them once and for all. However, with Blu-ray seemingly winning the war, we seem to be stuck with the same hassle into the unforeseeable future. And people wonder why Pirate Bay is the #1 movie distribution channel in Europe these days…

Note to Self: When Autotest Fails…

I just run into the following error when running autotest within a Rails app:


/Users/jarkko/Sites/koulutusweb/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:402:in `to_constant_name': Anonymous modules have no name to be referenced by (ArgumentError)
	from /Users/jarkko/Sites/koulutusweb/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:214:in `qualified_name_for'
	from /Users/jarkko/Sites/koulutusweb/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:477:in `const_missing'
	from /Users/jarkko/Sites/koulutusweb/vendor/plugins/rspec/lib/spec/example/example_group_factory.rb:7:in `reset'
	from /Users/jarkko/Sites/koulutusweb/vendor/plugins/rspec/lib/spec/example/example_group_factory.rb:59
	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
	from /Users/jarkko/Sites/koulutusweb/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:496:in `require'
	from /Users/jarkko/Sites/koulutusweb/vendor/rails/activerecord/lib/../../activesupport/lib/active_support/dependencies.rb:342:in `new_constants_in'
	 ... 59 levels...
	from /Library/Ruby/Gems/1.8/gems/rspec-1.0.8/lib/spec/runner/command_line.rb:17:in `run'
	from /Library/Ruby/Gems/1.8/gems/rspec-1.0.8/bin/spec:3
	from /usr/bin/spec:19:in `load'
	from /usr/bin/spec:19

It turned out I had typed “sudo gem update zentest” to get the latest version of the gem. However, the correct way would have been to use the camel-cased version ZenTest. The funny thing is, that if you run the command in lower case (like I’m use to do with RubyGems), you will get ZenTest, it’s just version 3.5.0 (as opposed to 3.8 that I supposedly got).

So here’s hoping that the next time I do the same mistake, this page will pop up from the big G.

Sony BMG “Goes DRM-free” (or: Sony BMG, the Dumbest of the Dumb)

(cross-posted to dotherightthing.com)

Last weeks, the air has been thick about even Sony BMG, the last of the big four music labels finally abandoning it’s rootkit-stained history of draconian DRM schemes and publishing “at least part of its collection” available DRM-free":http://www.businessweek.com/technology/content/jan2008/tc2008013_398775.htm. However, the actual way of how it’s going to happen has been unclear until very recently. And boy, what scheme that came to be:

The No. 2 record company after Universal Music will sell plastic cards, called Platinum MusicPass, for individual albums for a suggested price of $12.99. Buyers enter a code from the card at new Sony BMG (SNE) site MusicPass.com to download that card’s album.

That’s right. Plastic frikkin’ cards. Marco has a good view of how this happens:

To get Sony BMG’s DRM-free music files, someone burns some coal to manufacture these petroleum-based plastic cards, then delivers them to stores on a series of diesel trucks. I drive to Best Buy in my 3056-pound gas-burning car and find my particular little plastic card, assuming that store carries the album I want in plastic-card format and it’s in stock. (If not, I need to drive to more stores, or just give up and try again next weekend.) But they probably have these cards taking up space somewhere in their massive store that requires tons of energy to keep well-lit and ventilated (since it has no windows).

And as far as the “part of the collection” part goes, the DRM-free collection will be a whopping 37 albums. Three-seven. Combining the convenience of going to a store to be able to buy tunes online, and the width of the supply, I’m sure people will be buying the albums like crazy.

John Gruber links to an article by John Scalzi, aptly titled Why It Won’t Work.

Kid #2: So to recap, what you’ve got here is a system that makes people leave their house in order to download music at their house, and makes them go to a store to get music that they could get at the store, somewhere else.

Sony BMG dude: Er.

Kid #1: Why don’t you just sell non-DRM’d MP3s off Amazon, like every other major music corporation?

Sony BMG dude: Well.

Kid #2: You don’t actually want to sell unprotected MP3s, do you? You want to be able to say you’re doing it, but really, you want to make it so ridiculously inconvenient that people keep just keep buying CDs and DRM’d tracks off iTunes. Just admit it, bro.

Sony BMG dude (pointing): Look! It’s Celine Dion! And Barry Manilow! (runs away as kids avert their eyes in terror)

Won’t they ever learn?

[UPDATE:] They will indeed start selling music through Amazon MP3, according to MacWorld. The question remains, why on earth did they publicize the born dead plastic card scheme if the whole Amazon deal was about to be announced. The other question is, doesn’t it sound like a cartel that three of the big four labels refuse to sell Apple DRM-free songs but sell them somewhere else? Let’s hope there are some announcements coming next week in San Francisco.

Get Your Pan Ready!

It’s hard to write a full book for a seasoned Rails hacker nowadays. Most of every tutorial-like tome will be fluff and even if there are some useful tidbits to gather, they’re often hard to find among the sea of surely useful but hardly nouvelle information. That’s why I really enjoy reading concise, to-the-point articles about specific solutions, and there is a genre of books that are chock-full of those nifty solutions: the cookbook style books. Chad’s Rails Recipes, Lucas’s and Leonard’s Ruby Cookbook and Rob’s Rails Cookbook have often made my day when even the mighty G has failed.

And now, fresh from the pragmatic oven, prepared with tenderness and love by Mike Clark and a slew of contributors, comes Advanced Rails Recipes. From a quick look through the beta PDF (available for purchase now through the beta book program), this will surely be one of the most useful Rails books for an advanced hacker ever written. Mike has managed to gather a respectful pile of recipes from experienced Rails people like Ezra, PJ and Chris, Adam, Giles and many, many more. Getting access to all these people’s heads within one book is something really unique and privileged.

Disclaimer: Advanced Rails Recipes contains a recipe written by me, “Validating Required Form
Fields Inline”. However, I don’t get any royalties from the book sales so this recommendation is an honest review of the book. I really think it’s that good.

Harvest Time

Congrats to Sami Korjus and my cousin Jussi Syrjä for securing a spot for their short film Harvest Time at the Sundance Festival. I’ve seen the film now twice, in its premiere in the Tampere Film Festival last year (where it won the special prize) and last week on the national tv, and the mojo hasn’t worn off. It was one of the few movies in the festival shot on real 35mm film and the same quality can be seen throughout the whole film. If you’re into black comedies and heading to Sundance, I heartily recommend giving it a shot.

Do NOT Hire iTechArt

It’s annoying enough that quite a few spam messages creep through Google Groups filters to the many mailing lists I’m subscribed to. Fortunately, SpamSieve has learned to bash them quite effectively. Today, however, spam on Rails-Core and Rails-Spinoffs hit the new low (right in there with people advertising pirate copies of the first AWDWR book on the Rails mailing lists a while back).

A company apparently specialized (among many other technologies, oh the irony) in Ruby on Rails development and outsourcing, iTechArt, considered it appropriate to advertise their services by spamming pretty much every Ruby and Rails-related mailing list on Google Groups. I not only think it’s pretty darn stupid to crap in your own cubicle (so to speak), I also think it’s worth giving them a lesson. So anyone considering outsourcing or buying Ruby or Rails development, please:

  1. Do not hire iTechArt.
  2. If you receive a proposal from them, let them know you won’t hire spammers.

In any case, if you’re a blogger, please spread the word. iTechArt is not worth anyone’s money.