Speaking at Rails Underground 0

Speaking at Rails UndergroundI haven’t seen a schedule yet, but I’ve been told by Mark that I’ll be speaking at Rails Underground this year.

My talk will be on the topic of Git. In about 45 minutes time I’ll show you all the basic git features you’ll need on a daily basis. Not only that, but I’ll also explain how git manages all those commits and branches so you can be on your way to become a git power user.

IMDB Ruby Gem 0.4.0 Now available at RubyForge! 1

I just released version 0.4.0 of the IMDB Ruby Gem into the wild. There are only a few minor updates:

Changes in 0.4.0

  • Updates to the console ‘imdb’ utility
    • Show the IMDB ID
    • Show the full IMDB URL

Installation or upgrade

$ sudo gem install imdb
$ sudo gem update imdb

Issues, source or contributions

Best Practice – The Git Development Cycle 6

Git is quite an awesome version control system. Why? Because it’s lightning fast, even for large projects (among other reasons).

But, how do you use Git effectively for development on a daily basis? Let me explain to you.

Branches

ActiveRecord: Skipping callbacks like after_save or after_update 3

Active Records provides callbacks, which is great is you want to perform extra business logic after (or before) saving, creating or destroying an instance of that model.

However, there are situations where you can easily fall into the trap of creating an infinite loop.

class Beer < ActiveRecord::Base
  def after_save
    x = some_magic_method(self)
    update_attribute(:my_attribute, x)
  end
end

has_one – find all that have no associated object 0

Let me pose a typical Rails situation:

class Person < ActiveRecord::Base
  has_one :fancy_hat
end
 
class FancyHat < ActiveRecord::Base
  belongs_to :person
end

Now, how can you get all the people that don’t have a fancy hat?

class Person < ActiveRecord::Base
  has_one :fancy_hat
 
  named_scope :hatless, :joins => 'LEFT JOIN fancy_hats ON fancy_hats.person_id = people.id', :conditions => 'fancy_hats.person_id IS NULL'
end

Now you can find all the hatless people you want.

FYI: Finding fancy hats that have no one to wear them is a lot easier, because the foreign key is stored in the fancy_hats table.

IMDB 0.3.0 now including console utility – query IMDB from your console 2

With the release of IMDB 0.3.0, a command-line utility is included!

Why is this awesome for you? Basically, because you can now query IMDB and process the results with any of the great GNU tools available to you like grep.

Let me show you:

Search IMDB

$ imdb Star Trek
>> Searching for "Star Trek"
 > 0060028 | Star Trek (1966) (TV series)    
 > 0796366 | Star Trek (2009)    
 > 0092455 | Star Trek: The Next Generation (1987) (TV series)    
 > 0112178 | Star Trek: Voyager (1995) (TV series)     
 > 0106145 | Star Trek: Deep Space Nine (1993) (TV series)    
 > 0117731 | Star Trek: First Contact (1996)    
 > 0084726 | Star Trek: The Wrath of Khan (1982)    
 > 0092007 | Star Trek IV: The Voyage Home (1986)    
 > 0079945 | Star Trek: The Motion Picture (1979)    
 > 0244365 | Enterprise (2001) (TV series)

Install Hpricot on Ubuntu 0

It’s quite easy. Make sure you have RubyGems and Ruby installed first, of course.

The problem:

$ sudo gem install hpricot
Building native extensions.  This could take a while...
ERROR:  Error installing hpricot:
	ERROR: Failed to build gem native extension.
 
/usr/bin/ruby1.8 extconf.rb
extconf.rb:1:in `require': no such file to load -- mkmf (LoadError)
	from extconf.rb:1

The solution:

sudo apt-get install ruby1.8-dev build-essential
sudo gem install hpricot
  • Twitter
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • Technorati
  • E-mail this story to a friend!

Ruby Gem: IMDB 0

I just released version 0.1.0 of my IMDB gem which allows your app to search IMDB for IMDB movie ID’s and access most data that’s publicly available.

Installation

sudo gem install imdb

This will also install the dependencies Hpricot and HTTParty.

Usage

In your project, include the gem (and possibly rubygems as well).

Speak louder! I can’t hear you over the sound of how awesome I am! 0

Get the t-shirt!

  • Twitter
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • Technorati
  • E-mail this story to a friend!

Second RubyFest Speaker: Geoffrey Grosenbach 0

Geoffrey Grosenbach is going to deliver a talk about MacRuby at RubyFest on may 14th! He’ll be joining us over a live video feed. Afterward Geoffrey will be available for a short Q&A session.

More details about Geoffrey’s talk are expected shortly.

Next Page »