Archive for February, 2007

youtube: forró universitário

Saturday, February 24th, 2007

Great vid of a couple of kids dancing forró (universitário style). Looks a lot like cuban casino salsa with all that octopus stuff (technical term).

Here’s another.

I’m missing moz… At least tomorrow night I am going to a carnival-style party, sort of a second launch for trustedplaces.com.

techno weenie: Understanding the Rails Initialization process

Monday, February 12th, 2007

“The Rails initialization process changed in subtle ways for Rails 1.2 due to a Dependencies rewrite, and some changes to plugins. If you’re interested in extending the Rails framework through plugins, it’s very important you understand the process…” - techno weenie: Understanding the Rails Initialization process: Part 1 , Part 2 and Understanding the Rails Plugin Initialization process.

See also “Environments and the Rails initialisation process” at toolmantim.com.

SafariWatir: Automating Safari with Watir

Sunday, February 11th, 2007

I’ve just noticed that there’s an effort to put Watir on Safari: SafariWatir. By Dave Hoover.

The project has a gem released. It’s not clear what functionality is so far accessible. It’s currently using rb-appscript Apple event bridge.

Via Mike Clark’s gem listing, via Chad Fowler.

I’ll be giving it a try, at the same time as doing normal watir IE7 automation in Parallels.

Related: FireWatir (Watir for firefox) only seems to support windows, right now.

london snow photo search on flickr feb 2007

Thursday, February 8th, 2007

DSC09463
Originally uploaded by welostinthefire.


Here’s a flickr search for photos tagged london snow, posted after 6th feb 2007, sorted by most interesting. One might filter instead for photos taken after 6th feb 2007, but when I tried this I got noise from ppl whose camera clock wasn’t set right.

Snow has something of a novelty for me again, though we did get a freak hailstorm in Maputo once which the locals said was first in ~20 years.

I just took a couple of photos but nothing good. Was reminded of the old truth: snow is cold. Soaked my only shoes, sniffled home again.

The Reactable

Wednesday, February 7th, 2007

The reactable is a “state-of-the-art multi-user electro-acoustic music instrument with a tabletop tangible user interface”. See also audiopad (blogged in 2003).

via hackaday.com.

Robot Parade 14: GAIENT BOT

Monday, February 5th, 2007

Robot Parade 14: GAIENT BOT
Originally uploaded by Lizette Greco.

Lizette Greco creates stuffed critters out of drawings made by her kids, like this gaient bot, which gous to rmis, can shut, and can baig erithing. Her kids can sew too, as you can read in this interview.

from another artist… Jack’s Robots on voicethread.com

Dabble DB

Saturday, February 3rd, 2007

Dabble DB looks great. Think google spreadsheets but with refactoring, mashups (planned), multiple views. Actually, no, just don’t think that; rather, watch this 7 minute introductory video to Dabble DB.

via Chad Fowler’s enthusiastic post about their plugin API.

Tinker.it! launched

Saturday, February 3rd, 2007

Massimo and Gianluca from the Arduino team have launched their new company, Tinker.it!:

“Tinker.it! makes products and platforms to help designers and artists make the best use of digital technologies. We cover the whole design and artistic process by providing early consultancy during the concept phase down to the implementation stage. Being part of the Arduino project means we are on the forefront of this business.”

Announcement on the blog.

Tinker.It! web site. The more detailed version of the about page is probably a good starting point.

Oh, and the Arduino Bluetooth is now on sale!

“Deploying Rails” thread quickly becoming a “Who’s who” for RoR

Friday, February 2nd, 2007

this “Introduce yourself” thread on Robby Russell’s new “Deploying Rails” group on google is quickly becoming a “who’s who” of RoR. (Note that it spans multiple pages).

For some reason I prefer this to workingwithrails.com. I guess it’s because the signal-to-noise ratio is better; everyone posting to the “introduce yourself” thread is doing a good writeup, whereas the web app allows you (correctly) to just register yourself. Also, pretty much everyone (of the early posters) has deployed.

It won’t last, I guess.

dotherightthing.com is live

Friday, February 2nd, 2007

dotherightthing.com is a place online where you can get unfiltered information about the impacts of companies on people and the world and make it worth their while to “do the right thing.”"

(announcement on Jarkko’s blog).

About dotherightthing.com

via Jarkko’s “about me

Ruby: How to disable stack-trace shortening?

Friday, February 2nd, 2007

How to disable stack-trace shortening? in ruby.

begin
  #do stuff here
rescue Exception => e
  puts "Exception: #{e.class}: #{e.message}\n\t#{e.backtrace.join("\n\t")}"
  exit 1
end

I had to follow a big stack trace because I wanted to know where digest:sha1 was being required in the rails initialisation.

keywords: How to get a full stack trace in rails, ruby. Avoid truncation (sic). … nn levels…

Rails: who’s requiring ‘digest/sha1′ for me?!

Friday, February 2nd, 2007

Answer: it varies by environment (webrick/mongrel, mysql native/simple), and, of course, you should require it for yourself.

As rails boots, ‘digest/sha1′ may or may not be required automatically, depending on your environment and gems. So if you’ve referred to Digest::SHA1 without requiring that file yourself (tsk!), you may get:

The error "NameError: uninitialized constant Digest::SHA1"
  • It is required automatically by the pure ruby mysql library, but not by the native mysql gem (2.7)
  • It is required automatically by webrick (1.3.1), but not by mongrel (1.0.1)
Obviously, you should require what you need explicitly, where you need it, rather than depending upon it being loaded for you in the environment. That’s simple to fix, but I spent a bit of time trying to find out why the problem existed on only some machines and not others, running identical code. (Not my codebase). Some of these environments fail to find Digest::SHA1 and some of them had no problems because they were running with mongrel instead of webrick, or had the native mysql gem installed.

This is another reason to nail down your development platform with your colleagues; mongrel’s a drop in replacement for webrick in some respects, but its interface with your code is a complex one. It ought to go without saying that your testing environment should resemble your production environment as closely as possible.

Ways to test:
You can detect if mysql’s class loading has had an effect by doing
ruby script/runner 'Digest::SHA1'
or
ruby script/console
Digest::SHA1

Both will pass if you don’t have the native mysql gem installed, and may fail if you do (depends on the rest of your env).

To test whether or not web server’s loading the class, I guess you could put the same line at the end of environment.rb, or just hit a page that tries to use Digest::SHA1.

Another way to find out if the class is being required, in any environment, which also allows you to see WHERE it is being required, is to hack the require mechanism to be a tell-tale.

I’m on rails 1.2.1, mongrel 1.0.1, webrick 1.3.1, mysql gem 2.7, ruby 1.8.5 on mac os x 10.4

ruby: Have ‘require’ tell you who’s loading a class

Friday, February 2nd, 2007

I wanted to know who was making a certain require (digest/sha1). Sometimes it’s easiest just to mod the file being loaded and have it raise an exception. In this case, I didn’t want to make a change to that file (because I wanted to keep my ruby install clean).

Instead, I hacked the require mechanism to look at each require and raise an exception when it finds what we’re looking for.

module Kernel
  alias  old_require require
  def require(x)
    old_require(x)
    if (x=='digest/sha1')
      raise "Hacked require() stopping because '#{x}' was required."
    end
  end
end

If you’re doing this in a rails context then the stack is likely to be large, so you might want to just generate a stack trace and explicitly print it so that you get the full thing. Or you can catch the exception yourself and print the backtrace in full.

Disclaimer: this is almost certainly not the right way to do this. Works for me.