Integrating Lighthouse API with Fluid
We use Lighthouse at my company to track bugs and milestones. I used Fluid to create a Site Specific Browser (SSB) so I could have my ticket dashboard in front of me all the time, but separate from my normal browsing activity.
If you’re not familiar with either, here are some links to point you in the right direction:
http://lighthouseapp.com/
http://fluidapp.com/
I use Fluid for Google Reader, and one thing I really like is the application badge that shows up to tell me when I have unread items. I wanted to apply that concept to Lighthouse to see how many open tickets I have assigned to me.
First, I created the SSB by opening Fluid and filling in my details. I used the sexy icon found here.

Next, I opened the Lighthouse app I just created, and selected “New Userscript” in the scripts menu, which is the small scroll icon that shows up in the menubar.

I’ve posted my script over here at userscripts.org. Copy, customize, and paste the source code into your new userscript. Then just save it, make sure it’s enabled under “Manage Userscripts”, and you should be good to go.
You’ll need to have an API key enabled in your Lighthouse account, which is located on your user settings page. I created a read-only key since I’m only retrieving open ticket info.
Now I have a nice badge on my app that updates itself every 10 minutes (customizable):

I’ll be glad to help out if you have any problems or questions; just drop me a line on Twitter - @adamjt.
WaterFire - Providence, RI
Full-size photos at Flickr.
Ruby on Rails and PostgreSQL on Snow Leopard
Upgrading from 10.5 to 10.6 last night was painless. I got back well over 10gb of space on my drive, and everything feels zippier. Hooray! Unfortunately, Snow Leopard completely trashed my Rails development setup. When I tried to run script/server, I was greeted with various gems barfing all over the place.
Here’s how I fixed my setup (YMMV, not responsible for any loss or damage, etc.):
First Things First
I had to install the Xcode.mpkg package from the Optional Installs folder of the Snow Leopard installation DVD. No problems here.
I then needed to rebuild all of my gems with:
'gem pristine --all'
PostgreSQL
The previous step blew up when it got to the ‘postgres’ gem with:
ERROR: Error installing postgres: ERROR: Failed to build gem native extension.
I had installed PostgreSQL on Leopard with the now outdated one-click installer, so I removed all of that using the included uninstaller, found in /Library/PostgreSQL/8.3/. Of course, please back up all your important databases first.
I installed the latest version of MacPorts from http://www.macports.org/install.php (1.8.0 at the time of writing) and then followed some of the steps from this article to get PostgreSQL up and running. Those boiled down to:
sudo port install postgresql83 postgresql83-server
sudo mkdir -p /opt/local/var/db/postgresql83/defaultdb
sudo chown postgres:postgres /opt/local/var/db/postgresql83/defaultdb
sudo su postgres -c '/opt/local/lib/postgresql83/bin/initdb -D /opt/local/var/db/postgresql83/defaultdb'
sudo launchctl load -w /Library/LaunchDaemons/org.macports.postgresql83-server.plist
I rebooted to start PostgreSQL, opened up ~/.bash_profile and added /opt/local/lib/postgresql83/bin/ to my PATH, then reloaded the file with:
source ~/.bash_profile
Now I was able to rebuild my gems, but I had to include the architecture type, otherwise ‘postgres’ would barf again.
sudo env ARCHFLAGS="-arch x86_64" gem pristine --all
Rubynode and Gem Install Path
Oh great, another gem failed. This time it was rubynode. I don’t use it, so I tried to uninstall it, but got:
ERROR: While executing gem ... (Gem::InstallError)
cannot uninstall, check `gem list -d rubynode`
Very strange considering the output I got from my gem list was this:
gem list -d rubynode
*** LOCAL GEMS ***
rubynode (0.1.5)
Author: Dominik Bathon
Homepage: http://rubynode.rubyforge.org/
Installed at: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
RubyNode is a library that allows read only access to Ruby's internal NODE structure.
After some research I found out I needed to manually specify the install path:
sudo gem uninstall --install-dir /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8 rubynode
Successfully uninstalled rubynode-0.1.5
I once again ran:
sudo env ARCHFLAGS="-arch x86_64" gem pristine --all
Everything seemed to be working at that point, but there were a couple of steps left.
PL/pgSQL Language
When I tried to run our development bootstrapping script I got this back:
ERROR: language "plpgsql" does not exist
All I needed to do was add that language to the template1 database so that all new databases would receive that language by default. The command (in the shell, not SQL) is simply:
createlang plpgsql template1
Ruby 1.8.7 Pitfalls
Another important thing to note is that Snow Leopard pushes Ruby up from 1.8.6 to 1.8.7. This won’t be a problem for most people, but I ran into one major snag.
undefined method `length’ for Enumerable Enumerator on text_helper.rb:50:in `truncate’
I found a simple workaround here that suggests adding the following to environment.rb. It worked nicely.
module ActionView
module Helpers
module TextHelper
def truncate(text, length = 30, truncate_string = "...")
if text.nil? then return end
l = length - truncate_string.chars.to_a.size
(text.chars.to_a.size > length ? text.chars.to_a[0...l].join + truncate_string : text).to_s
end
end
end
end
I’ll update this article with anything else that comes up, but for now everything seems to be working and I can get back to writing code.
These Days
I’m content with the fact that I now get more joy out of getting rid of old, unnecessary items than I do in procuring new ones. The methods (Craigslist, etc) leave much to be desired (spam, spam, spam,) but it all works out in the end.
Running a self-hosted WordPress blog was fun, but led down an endless path of plugins, themes, upgrades, backups, and analysis. All of that muck turned into tedium which I eventually abandoned. I’m starting fresh here at Tumblr, which so far seems to be a very simple and pleasant experience.