Text

The Garden of the Night

Our protagonist starts in the middle of an ocean on a small sail boat. He doesn’t know how he got there, but he knows he’s alone.

Half starved, the cold wind cuts into him. He takes down his sail and uses it as a blanket. Attaching his lamp to the mast, the blackness of his surroundings are held at bay. For now. Finding a small amount of comfort he falls into an uneasy sleep.

He’s aware of being in a lush paradise. People! There are happy, friendly people here. He meets, he takes fanciful trips around the gardens. He falls in love.

One by one, his friends fall asleep. Everyone is asleep, but he is still awake, afraid to drift off. Even in this dream land he finds loneliness.

Crash! A heavy wave slaps the side of the boat and he’s awake. Back adrift in the ocean. Back in his boat. Back being alone.

http://www.youtube.com/watch?v=NQ5ku4z1pjs

Text

Using a locally developed rubygem with Bundler

I was working with the Embedly API earlier on and thought I’d extract my code into a rubygem (released as tinyembedly, source on github). Preparing the gem was pretty straightforward (thanks to New gem with bundler) however getting the gem back into the ‘host’ application was proving difficult.

The problem I was trying to solve: I wanted to test my gem locally before pushing it out into the real world.

To do that, I thought I’d have to update Bundler to point to my local .gem file.

I added the gem to my Gemfile:

gem :tinyembedly, '0.0.1', :path => ~/dev/tinyembedly/pkg/tinyembedly-0.0.1.gem

Bundler couldn’t find the gem. Strange. After a bit of reading I updated my Gemfile to reference the .gem file folder instead.

gem :tinyembedly, '0.0.1', :path => ~/dev/tinyembedly/pkg/

Now, Bundler was more content, but I just couldn’t get my gem to require. A quick look at the $LOAD_PATH:

$LOAD_PATH.grep(/tiny/)

This revealed that instead of using the .gem file (as I thought) it was expecting :path to point to the unpacked .gem. Duh.

The solution had been staring me in the face. If I wanted to use the locally developed gem (before it had been uploaded to rubygems) I simply installed it, locally, and then added it to my Gemfile:

rake install

Updated my Gemfile:

gem 'tinyembedly', '0.0.1'

This works, because Bundler checks rubygems for the gem and when that fails, checks locally afterward. And with that, all was well. Huff.

Text

Using a Steelseries Kinzu on a Mac (OSX Lion)

This blog post is for all of the mac (Lion) owners who are given (or who buy themselves) a Steelseries Kinzu mouse at Christmas. This writeup may be of use to owners of other gaming mice (with Windows only driver software).

I wanted a mouse for gaming. Being impatient, I headed to the local shops and had a look about. I popped into PC World / Currys but left disappointed with the service [1]. Game were selling a Steelseries Kinzu for a little more than the online price so I picked it up. It’s a seemingly high spec mouse without the cosmetic frills.

Wait, what is a gaming mouse?

For Quake it’s beneficial to have a mouse that polls at 500hz. Secondly, a higher DPI allows for smoother aiming motion. I’m not going to pretend that these are necessary in order to win (I’ll leave that to the people hawking mice), but for a game as high paced and ‘twitchy’ as Quake, I feel like I notice a difference.

But I own a mac!

With a bit of research I came to the conclusion that none of the major companies provided stable drivers or configuration software for OSX. I thought if the rate was set in hardware I might get away with not configuring it.

So, when I returned home with my Steelseries Kinzu, I plugged it in and it felt… suprisingly OK. I had a look at the OSX USB prober, which suggested the mouse was polling at 1000hz. Good news, although I’d read of ‘stability issues’ at that high a rate. When playing Quake, it felt reasonably good, though it would intermittently disconnect and reconnect itself (usually in the middle of a firefight). This wouldn’t do.

I’d also read that a firmware upgrade for the mouse (mice have firmware now? How long was I gone!) resolved a similar issue a user was having on Ubuntu. You need access to a Windows machine that you can install their software on. Through their configuration software you can upgrade your mouse firmware and configure the sampling rate / DPI. These settings are remembered (mice have memory now! How long was I go…) so when you return to your mac, all will be peachy.

But I don’t have a Windows machine

But wait, you have a mac. You don’t have access to a Windows machine. I had to make do with installing the software on a Virtualbox instance (a Windows 7 instance provided by the Internet Explorer for browser testing). Initially the mouse wasn’t accepted as a valid mouse by the software. I shut down the VM and set the USB filter options to cover the Kinzu. When I booted up the VM the mouse wouldn’t move, but running the mouse configuration software again it was detected and installed correctly. Truth be told, I don’t know if the USB filters was the key to getting this working, or whether it just needed a few random reboots to pick up properly. YMMV. Mine certainly did.

So to summarise:

  • If you buy a Steelseries Kinzu mouse, don’t expect any useful help from their under-resourced support team
  • If you have access to a Windows machine, install the mouse software on that to configure your mouse. I found 500hz rid me of my mouse freezing / disconnecting / reconnecting issue.
  • If you don’t have access to a Windows machine, fiddle about with the VM images provided by the Internet Explorer team. It can be done.

Upgrading the firmware on your mouse and lowering the polling rate made this mouse feel spot on.

[1] PC World / Currys Workington were selling ex-display model mice as new with no discount.

Audio
[Flash 9 is required to listen to audio.]

Rof playing with his new giant tennis ball. Thanks Uncle Ian.

Photo
Glasgow snow, full on: 

Added an exposure gradient to the bottom of this pic, I always find it makes snow pictures ‘pop’ a little more.
Also, I think my lens must have some dust specs on it ;)
Glasgow snow, full on:

Added an exposure gradient to the bottom of this pic, I always find it makes snow pictures ‘pop’ a little more.

Also, I think my lens must have some dust specs on it ;)

Text

Rails 2.3.9 weirdness in eager loading an ordered has_many :through assocation

Snappy title, eh.

I ran into this bug while trying to update an app to 2.3.9. I know of a workaround but I’m struggling to write a test that reproduces it in the AR source. So until I get around to doing that, heres the weirdness:

class Job < ActiveRecord::Base
  has_many :job_memberships, :dependent => :destroy
  has_many :users, :through => :job_memberships, :order => "users.last_name, users.first_name"
end

(I’m sure you can guess what job_memberships and users look like)

Job.find(165, :include => :users)

Results in:

ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'users.last_name' in 'order clause':
SELECT `job_memberships`.* FROM `job_memberships` WHERE (`job_memberships`.job_id = 165) ORDER BY
users.last_name, users.first_name

Now a similar bug exists and has been fixed, which lead me to the workaround.

In job.rb, add the :source key to the has_many through definition

  has_many :users, :through => :job_memberships, :order => "users.last_name, users.first_name", :source => :user

… and the eager loading works.

I’ve been so busy trying to write a test that replicates it in the AR test suite that I’ve not actually looked into fixing it, but I suspect like the bug mentioned above it’s in the preload_through_records method in association_preload.rb.

I’ll try again later to write it, but in the mean time this may be useful to someone :)

Text

Searching vs Knowing

When I first moved from Textmate to Vim I really missed Command-T; the file finder-opener. At first I tried FuzzyFinder, made popular by Jamis Buck but couldn’t get comfortable with it.

I also missed the project drawer, an ideal way to browse a tree. I gave Nerdtree a shot but again, it just didn’t mesh.

The problem I was having was trying to ease myself into vim with processes that worked well in Textmate.

I felt the greatest benefit when I jumped into vim with both feet. Away went the tree view and in came :e (which don’t forget supports tab-completion). This helped reduce my dependence on the mouse.

With rails.vim, you’re gifted some helper commands for opening files. :Rcontroller (or :Rc to save your fingers) with an argument is a shortcut to load a controller. When in a controller action, :Rview takes you to that action’s view. :help rails for more information.

And lo a pattern emerges. Rather than searching for the file to open, know which file you want to open and do it.

Tags: vim
Text

Zzzz

Nothing here yet, but if you subscribe you’ll be the first to know when there is!

(note: I’ve only added a template for text posts, so if you view the archive, mainly delicious spam, it probably won’t render)

Link
Link

This sounds pretty interesting, though it’s another point of failure for your app. That said, they claim high-availability