Resque me with a custom Redis host

If you’re working outside of Ruby on Rails and want to have Redis hosted non-locally than this is the command you’re looking for:

Resque.redis = '<non_localhost_address>:<port>'

To paint the full picture: You’ve got Redis running on Machine1.Hostname and your Resque workers on Machine2.Hostname and you need those two wired up. In your Rake file for Resque workers you should add the line of code from above.

One little caveat, if you’re told Resque is an uninitialized constant than you just simply need to get Resque into your environment. Here’s an example IRB session where I’m using Bundler/Gemfile:

ree-1.8.7-2011.03 :001 > require 'rubygems'
 => false 
ree-1.8.7-2011.03 :002 > require 'bundler/setup'
 => true 
ree-1.8.7-2011.03 :003 > Bundler.require
=> [<Bundler::Dependency type=:runtime name="SystemTimer" requirements=">= 0">, <Bundler::Dependency type=:runtime name="rake" requirements=">= 0">, <Bundler::Dependency type=:runtime name="redis" requirements=">= 0">, <Bundler::Dependency type=:runtime name="redis-namespace" requirements=">= 0">, <Bundler::Dependency type=:runtime name="yajl-ruby" requirements=">= 0">, <Bundler::Dependency type=:runtime name="resque" requirements=">= 0">, <Bundler::Dependency type=:runtime name="ruby-prof" requirements=">= 0">, <Bundler::Dependency type=:runtime name="json" requirements=">= 0">, <Bundler::Dependency type=:runtime name="nokogiri" requirements=">= 0">, <Bundler::Dependency type=:runtime name="fastercsv" requirements=">= 0">, <Bundler::Dependency type=:runtime name="yieldmanager" requirements=">= 0">]

Cool, now we’ve got our environment and can do what we want. It’s not necessary to use a Gemfile, you can manually install your gems and then require them in your Ruby file. But since I have multiple files doing many different things it makes sense to have one common section for inclusion of my packages. I also encourage creating a ruby include file with your Redis setups; this will prevent you from having that Resque.redis scattered in all of your files that access Redis.

Hope this saves someone a minute. More information is in Defunkt’s Resque package on Github.

Visualizing Subversion’s Commit History

Yeah, it’s Friday! Woohoo. Yup, that’s right people, it’s time to kick off your shoes and code…

I have not posted in like two weeks. Lemme tell ya, One of those weeks I spent in Vegas on a much needed vacation without a laptop. It was pretty spectacular. This week has just flown by. But today I felt like doing something fun; I felt like being a movie producer, director, composer, etc. However, I don’t really like to get off the couch just to film a movie when I have a at least 25 storylines wandering around my computer.

Without further pause here is my story of the main Subversion repository I contribute to at work:
[ By the way, dots (or nodes) are directories or files. As the two people-icons run around the screen they are making subversion commits. Explosions typically occur when a big check-in happens. ]

Enjoy? Let’s make you a video. Visualizing Subversion commit activity is crazy simple. Dayum! I’m running Mac OS X 10.6.8 so all of following was done on that environment.

You’ll want to get ffmpeg and some codecs. I use Darwin Ports to manage packages like these so if you’re like me here’s the quick fix

sudo port install ffmpeg +gpl +lame +x264 +xvid

Next, we’re going to need Gource, and ffmpeg.

Download gource. unzip it and head into the directory. once in the gource directory go ahead and

sudo ./configure
sudo make; sudo make install
gource --help

Alright we’re pretty much ready to go. Head over to one of your subversion root directories. Add this file to your directory: summerfun.conf
and in it put


You’ll see the my-project-log.xml is nowhere to be found. Let’s create it:

svn log -r 1:HEAD --xml --verbose --quiet > my-project-log.xml

That will make the video play a little faster. You can remove or muck with all of the settings; just read the README for available options. Now here is the command I executed:

gource --load-config summerfun.conf -1280x720 -o - | ffmpeg -y -b 10000K -r 60 -f image2pipe -vcodec ppm -i - -vcodec libx264 -vpre default -threads 0 -bf 0 gource.x264.mp4

This command launches a video; watch it & interact with it. Give it a try. All interactions get recorded in the video output. So zoom as you wish, to entertain your watchers. Let me know how it goes and post your videos.