Contributing to "Advanced Rails Recipes"

The latest Beta update to the new Pragmatic Programmers book Advanced Rails Recipes: 72 New Ways to Build Stunning Rails Apps includes two chapters authored by myself.
They are both complete rewrites and updates of two of my popular blog posts Rails searching with Sphinx and iPhone on Rails – Creating an iPhone optimised version of your Rails site using iUI and Rails 2.
The new recipes are:

- Full-Text Search with Sphinx – includes a Rails site that uses Sphinx to index the Rails API.

- Support An iPhone Interface – with a TODO list app.
Along with these two (worth the purchase price on their own!), there are another 79 great recipes with some of the latest Rails best practices in small, easy to implement chunks.
Ruby Tidbit: Timeout code execution
Just a small tip, if you wish to ensure a snippet of Ruby code doesn’t run for too long you can use the timeout function. You might want to do this when making a request to a remote server with net/http for example.
A way of performing a potentially long-running operation in a thread, and terminating it‘s execution if it hasn‘t finished within fixed amount of time.
Here’s a quick example using the excellent rFeedParser (Universal Feed Parser in Ruby) to fetch an RSS feed.
require 'timeout'
require 'zlib'
require 'rubygems'
require 'rfeedparser'
fp = nil
begin
# Don't take longer than 20 seconds to retrieve & parse an RSS feed
Timeout::timeout(20) do
fp = FeedParser.parse("http://feeds.feedburner.com/slashdotdash")
end
rescue Timeout::Error
# Too slow!!
end

