Archive for the 'Ruby' Category

Arse-peck

Wednesday, April 2nd, 2008

I was entertaining my wife yesterday evening with some witty banter on the subject of RSpec and was most annoyed that she wouldn’t stop laughing. As we all know RSpec is deadly serious so I couldn’t understand what could cause her such paroxysms, perhaps she had become ill of the mind; a raving loon? I made a mental note to check her dosage.

It turns out that she was only half-listening to me and having no idea what I was talking about (she is not a software developer) thought I was talking about something called ‘Arse-peck’. Last time something I said caused her to laugh this much was when I told her there was a UNIX utility called ‘ping’.

I really should get out more. At least that’s what my wife says.

Announcing finder.overcycle.com

Wednesday, January 23rd, 2008

It is my pleasure to announce the Recycling group finder, Something I have been working on for the past couple of weeks with my wonderful employer 29degrees. For those of you who don’t know, Freecycle is a worldwide recycling network, in their own words:

The Freecycle Network™ is made up of 4,205 groups with 4,211,000 members across the globe. It’s a grassroots and entirely nonprofit movement of people who are giving (& getting) stuff for free in their own towns. It’s all about reuse and keeping good stuff out of landfills. Each local group is moderated by a local volunteer (them’s good people).

As the name suggests, Freecycle Group Finder is a new way to find Freecycle groups.

Finding a group - the old way

To find a group you enter a location to search for in the box on the Freecycle homepage. I live in Romiley, so I enter that and click search. But it can’t find any groups! Failed freecycle search

In order for it to find my local group I would have to guess it was called ‘Stockport‘ and search for that. I could have used the Freecycle group browser but who browses anymore? People demand search! I wanted to make this better so I wrote the Recycling Group Finder.

Finding a group - the finder.overcycle.com way

Just enter any location into the search box on the homepage and it will find all your local groups: Successful  freecyclegroupfinder.com search

The Freecycle search gets it right sometimes. Take a search for Alameda, CA. It lists all the groups nearby, but Freecycle Group Finder does better. Freecycle Group Finder shows you a map of where all the local groups are! It lets you scroll around and visually determine the closest group (Try it for yourself!). An improvement we feel, and one that will help more people join up and start recycling.

What keeps it rolling?

At 29degrees we’re big fans of Ruby on Rails. It helps us make web applications faster, and with more fun, and it was no exception for the Freecycle Group finder. We are using Postgres for the database and serving it all with mongrel and of course Apache. Of course if wouldn’t be anwhere near as good if it wasn’t for Tony, 29degrees co-founder and designer extroadinaire!

More glTail absurdity

Wednesday, October 10th, 2007

This is what happens when you change the log file tail command from tail -f to tail -n10000 -f

glTail crazyness

crazy :)

New glTail version, yay! Authentication failed, Boo!

Wednesday, October 10th, 2007

I downloaded the latest version of glTail and got an authentication failed error:

cheetara:~/Desktop will$ ./gl_tail-0.05.rb
Connecting to myserver...
/opt/local/lib/ruby/gems/1.8/gems/net-ssh-1.1.2/lib/net/ssh/session.rb:143:in `initialize': will (Net::SSH::AuthenticationFailed)
from /opt/local/lib/ruby/gems/1.8/gems/net-ssh-1.1.2/lib/net/ssh.rb:47:in `new'
from /opt/local/lib/ruby/gems/1.8/gems/net-ssh-1.1.2/lib/net/ssh.rb:47:in `start'
from ./gl_tail-0.05.rb:1034:in `init'
from ./gl_tail-0.05.rb:1025:in `each'
from ./gl_tail-0.05.rb:1025:in `init'
from ./gl_tail-0.05.rb:1070:in `initialize'
from ./gl_tail-0.05.rb:1159:in `new'
from ./gl_tail-0.05.rb:1159

I am using key based authentication to my server so I had previously set the password to:

:password => ''

This worked in the old version but to get it to work I in the new version I had to change it to this:

:password => nil

glTail - Pretty logs

Tuesday, October 9th, 2007

glTail is really pretty, I just wished I had more traffic :)

This is is glTail mid-way through showing a request for my jokes site:

gltail

There is a more impressive video on the glTail site. I am not sure how useful it will be, but it is nice to look at.

The ‘Britney Bomb’

Tuesday, August 21st, 2007

In the 29degrees office we have an mp3 jukebox that is basically a mac-mini with iTunes and VNC on it, it was playing some ‘Death Cab For Cutie’ when the bomb went off. Everyone is using a Mac as their computer, I have installed RubyOSA. This sets the stage for the ‘Britney Bomb’.

I fired up an irb session and typed the following:

> require 'rubygems'
> require 'rbosa'
> itunes = OSA.app('iTunes', :machine=>'jukebox.local')
> c = OSA.app('Colloquy')
> sleep(30); v = itunes.sound_volume; itunes.sound_volume.downto(0) { |i| itunes.sound_volume = i; sleep 0.05 }; itunes.stop; itunes.sound_volume = v; c.send_message('Britney FTW!'); sleep(4); itunes.sources[2].playlists.first.search(’britney’).first.play

This basically:

  1. Sleeps for 30 seconds (I left the room, I didn’t want to be around when the bomb went off after all).
  2. Gets the current volume.
  3. Scales the volume of the current track down to zero.
  4. Stops playback.
  5. Sets the volume back to the original volume.
  6. Announces to the office IRC channel that Britney Spears is wonderful (in my name).
  7. Sleeps 4 seconds to let the news sink in.
  8. Plays the first Britney Spears tune it finds in Carl’s library (which the jukebox uses), this happens to be ‘Baby One More Time’

This amuses me greatly.

Lazy lazy methods

Monday, August 6th, 2007
Golfr saves you all the hassle of having to type out full method names

Lazy! But quite cool.

Don’t F**king Repeat Yourself

Wednesday, July 4th, 2007

Carl has suggested some interesting improvements to the standard Rails migrations:

So, you’re a Rails developer? CHECK! You have this great idea for a new application, the one which will surely get Yahoo and Google involved in a bidding war? CHECK! But you don’t actually start developing it because you are fed up having to run script/generate model model_name, editing the migration for the table, writing the tests for all the rules which are implied by the database (Such as maximum lengths for columns and column uniqueness), and then editing the model to pass those tests? CHECK!

(digg here if you’re that way inclined)

Rails sucks

Thursday, June 21st, 2007
Logger debug message consisted entirely of “cocksucker.” Took it out. Seemed minimally informative, and impolite.

Excellent.

Hi I’m Ruby on Rails

Wednesday, May 16th, 2007

Another funny Ruby on Rails/PHP video: