<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Slash Dot Dash</title>
    <link>http://www.slashdotdash.net</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Rolling on Rails</description>
    <item>
      <title>Getting started with Merb and Datamapper</title>
      <description>&lt;p&gt;Merb is the up-and-coming Ruby web framework, designed to improve upon the ideas in Rails whilst being faster, lighter and less opinionated (or more agnostic). I wanted to discover whether it provides any benefits over Rails and what it does differently. The best way to find out; get it installed it and create a new app.&lt;/p&gt;


	&lt;p&gt;The &lt;a href="http://www.merbivore.com/"&gt;official Merb website&lt;/a&gt; gives the following simple installation instructions.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;sudo gem install merb&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;However, since I wanted to also try DataMapper as the &lt;span class="caps"&gt;ORM&lt;/span&gt; those instructions failed to install a working setup due to a &lt;a href="http://wm.lighthouseapp.com/projects/4819/tickets/440-merb_datamapper-is-out-of-date-version-mismatch-with-dm-more"&gt;conflict between Merb and DataMapper dependencies&lt;/a&gt;. Unperturbed, I finally got them both installed and working happily together by getting the bleeding edge code from each project&amp;#8217;s github repository and following the instructions provided by Mathew Ford&amp;#8217;s &lt;a href="http://4ninjas.org/merb/"&gt;Living life on the edge&lt;/a&gt;. The book is also available on &lt;a href="http://github.com/deimos1986/book_mdar/tree/master"&gt;github&lt;/a&gt;, you can contribute patches there. Hopefully this issue will be resolved soon enough so that you&amp;#8217;ll be able to install the official release gems for both Merb and DataMapper from Rubyforge (instead of running on edge).&lt;/p&gt;


	&lt;h3&gt;Prerequisites&lt;/h3&gt;


	&lt;ul&gt;
	&lt;li&gt;You must have git installed (&lt;code&gt;sudo port install git-core&lt;/code&gt; using MacPorts on &lt;span class="caps"&gt;OS X&lt;/span&gt;).&lt;/li&gt;
		&lt;li&gt;Remove any older versions of merb (and datamapper) that you might have installed. Use &lt;code&gt;gem list&lt;/code&gt; to view local gems and &lt;code&gt;sudo gem uninstall &amp;lt;name&amp;gt;&lt;/code&gt; to remove each individual gem.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h2&gt;The Easy Way&lt;/h2&gt;


	&lt;p&gt;Matt&amp;#8217;s book outlines an &lt;em&gt;easy way&lt;/em&gt; of installing the latest merb &amp;#38; datamapper source, however it failed to properly install the DataMapper gem for me so I had to resort to the &lt;em&gt;hardcore&lt;/em&gt; approach.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;sudo gem install sake
sake -i 'http://edgy.4ninjas.org/edgy.sake'
sake edgy:install packages="merb-stack"&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;After installing, to keep up-to-date you just need to execute:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;sake edgy:update&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Now, if you&amp;#8217;re hardcore&amp;#8230;&lt;/p&gt;


	&lt;h3&gt;Installing the required dependencies&lt;/h3&gt;


	&lt;p&gt;Start by installing the gem dependancies.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;sudo gem install rack mongrel json erubis mime-types rspec hpricot mocha rubigen haml markaby mailfactory ruby2ruby&lt;/code&gt;&lt;/pre&gt;

	&lt;h2&gt;Installing Merb&lt;/h2&gt;


	&lt;p&gt;Download the merb source:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;git clone git://github.com/wycats/merb-core.git
git clone git://github.com/wycats/merb-plugins.git
git clone git://github.com/wycats/merb-more.git&lt;/pre&gt;&lt;/code&gt;

	&lt;p&gt;Then install the gems via rake:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;cd merb-core ; rake install ; cd ..
cd merb-more ; rake install ; cd ..
cd merb-plugins; rake install ; cd ..&lt;/pre&gt;&lt;/code&gt;

	&lt;h2&gt;Installing DataMapper&lt;/h2&gt;


&lt;pre&gt;&lt;code&gt;git clone git://github.com/sam/extlib.git  
git clone git://github.com/sam/do.git

cd extlib ; rake install ; cd ..
cd do
cd data_objects ; rake install ; cd ..
cd do_mysql ; rake install ; cd ..
cd ..

git clone git://github.com/sam/dm-core.git
git clone git://github.com/sam/dm-more.git

cd dm-core ; rake install ; cd ..
cd dm-more ; rake install ; cd ..&lt;/pre&gt;&lt;/code&gt;

	&lt;h3&gt;Keeping updated&lt;/h3&gt;


	&lt;p&gt;To update your local gems with the latest code changes you&amp;#8217;ll need to do a &lt;code&gt;git pull&lt;/code&gt; and then &lt;code&gt;rake install&lt;/code&gt; for each of the git repositories previously downloaded.&lt;/p&gt;


	&lt;h2&gt;Creating your first Merb app&lt;/h2&gt;


	&lt;p&gt;You create a new empty Merb app via the &lt;code&gt;merb-gen&lt;/code&gt; utility.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;merb-gen app demo&lt;/pre&gt;&lt;/code&gt;

(You can also create flattened or single file applications if you wish).
&lt;pre&gt;&lt;code&gt;merb-gen app app_name --flat      (for a flattened application)
merb-gen app app_name --very-flat (for a single file application)&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;As we&amp;#8217;re using DataMapper we need to edit &lt;code&gt;config/init.rb&lt;/code&gt; and uncomment the &lt;code&gt;use_orm :datamapper&lt;/code&gt; line. The next step is to create the database settings file &lt;code&gt;config/database.yml&lt;/code&gt;:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;---
development: &amp;#38;defaults
  adapter:    mysql
  database:   demo_development
  username:   demo
  password:        p@ssword
  host:       localhost

test:
  &amp;lt;&amp;lt;:         *defaults
  database:   demo_test

production:
  &amp;lt;&amp;lt;:         *defaults
  database:   demo_production&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;You can now fire up the Merb server to make sure it runs.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;$ merb
 ~ Loaded DEVELOPMENT Environment...
 ~ Connecting to database...
 ~ loading gem 'merb_datamapper' ...
 ~ Compiling routes...
 ~ Using 'share-nothing' cookie sessions (4kb limit per client)
 ~ Using Mongrel adapter&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Some other useful commands to know:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;merb -i                                                        # Interactive merb console

merb-gen model &amp;lt;name&amp;gt;                            # Creates a Datamapper Model stub
merb-gen resource &amp;lt;name&amp;gt;                    # Creates a full resource (incuding model, controller, views &amp;#38; test spec)

rake dm:db:automigrate            # Perform automigration
rake dm:db:autoupgrade            # Perform non destructive automigration&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Let&amp;#8217;s see how it goes from here with Merb!&lt;/p&gt;</description>
      <pubDate>Sat, 05 Jul 2008 23:46:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:2d4c7560-2c0c-4594-90fc-a0db36b5edb9</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2008/07/05/getting-started-with-merb-and-datamapper</link>
    </item>
    <item>
      <title>Lifestreaming - combining your online activity into a single stream (using trawlr)</title>
      <description>&lt;p&gt;It&amp;#8217;s been &lt;a href="http://www.slashdotdash.net/articles/2007/03/09/last-update-on-trawlr-com-until-the-next-time"&gt;a year since I last mentioned&lt;/a&gt; &lt;a href="http://www.trawlr.com/"&gt;trawlr&lt;/a&gt; on this blog at which point I promised no further status updates here. Well I&amp;#8217;m going to just pretend I didn&amp;#8217;t say that for now as I wanted to get some feedback (and usage) on the latest feature I&amp;#8217;ve been working on.&lt;/p&gt;


	&lt;h2&gt;Streaming your life away&lt;/h2&gt;


	&lt;p&gt;It&amp;#8217;s support for &lt;em&gt;&amp;#8220;lifestreaming&amp;#8221;&lt;/em&gt; &amp;#8211; combining your online identity from various different social sites into a single stream. Very much like a diary or timeline of events, grouped by date.&lt;/p&gt;


	&lt;p&gt;The inspiration for this feature came from a &lt;a href="http://adactio.com/journal/1202/"&gt;blog post by Jeremy Keith&lt;/a&gt; (hence the title) so props to him for the idea.&lt;/p&gt;


	&lt;p&gt;Lifestreaming is like Twitter, but covers everything you do online that is publicly available and has an &lt;span class="caps"&gt;RSS&lt;/span&gt; feed. Currently there&amp;#8217;s support for Delicious, Flickr, Twitter, Upcoming, Last.fm, your own blog feed (RSS) and any other site that provides an &lt;span class="caps"&gt;RSS&lt;/span&gt; feed.&lt;/p&gt;


	&lt;p style="float:right"&gt;&lt;a href="http://www.slashdotdash.net/images/lifestream.png"&gt;&lt;img src="http://www.slashdotdash.net/images/lifestream-small.png" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;You can see an example of &lt;a href="http://www.trawlr.com/users/ben/lifestream"&gt;my lifestream&lt;/a&gt; in the screen shot. If you already have a &lt;a href="http://www.trawlr.com/"&gt;trawlr.com&lt;/a&gt; account then why not give it a whirl and create your own lifestream. Don&amp;#8217;t have an account yet? &lt;a href="http://www.trawlr.com/signup"&gt;Registration&lt;/a&gt; is quick &amp;#38; simple (with no email activation required) and once you&amp;#8217;ve tried out the lifestreaming, you might also be interested in the main &lt;span class="caps"&gt;RSS&lt;/span&gt; reader.&lt;/p&gt;


	&lt;p&gt;Once you&amp;#8217;ve created your lifestream, it&amp;#8217;ll be automatically updated throughout the day.&lt;/p&gt;


	&lt;p&gt;Let me know if you can think of any important sources I&amp;#8217;ve missed, such as; YouTube, Picassa, SmugMug, FaceBook, MySpace, Google Reader shared items, Digg (dugg by) and Reddit (activity).&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;m planning to create a &amp;#8220;widget&amp;#8221; version of the lifestream so that it may be embedded within your own blog or website, allowing customisation of the display&lt;/p&gt;</description>
      <pubDate>Wed, 12 Mar 2008 01:07:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:60dfe400-123f-465c-b53c-1f8da609638c</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2008/03/12/lifestreaming-combining-your-online-activity-into-a-single-stream-using-trawlr</link>
    </item>
    <item>
      <title>Sphinx search with delta indexing thanks to Ultrasphinx</title>
      <description>&lt;p&gt;Evan Weaver has &lt;a href="http://blog.evanweaver.com/articles/2008/03/08/delta-indexing-support-in-ultrasphinx/"&gt;just announced delta indexing support&lt;/a&gt; for his UltraSphinx Rails plugin.&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;Delta indexing speeds up your updates by not reindexing the entire dataset every time.&lt;br /&gt;&lt;br /&gt;First, in your .base file, set the indexer option delta to your maximum interval between full reindexes. A day or a week is good, depending. Add a little bit to account for the time it takes the actual index to run:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;delta = &amp;lt;%= 1.day + 30.minutes %&amp;gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now, configure your models for delta indexing in the is_indexed call:&lt;br /&gt;&lt;br /&gt;&lt;code&gt;is_indexed :fields =&amp;gt; ['created_at', 'title', 'body'], :delta =&amp;gt; true&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;Now you can run &lt;code&gt;rake ultrasphinx:index:delta&lt;/code&gt; frequently, and only records that were changed within 1 day will be reindexed. You will need to run rake ultrasphinx:index:main once a day to move the delta contents into the main index.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;From the &lt;a href="http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/files/README.html"&gt;UltraSphinx documentation&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve previously written about how fast Sphinx search is in &lt;a href="http://www.slashdotdash.net/articles/2007/08/06/rails-searching-with-sphinx"&gt;Rails searching with Sphinx&lt;/a&gt; using the &lt;code&gt;acts_as_sphinx&lt;/code&gt; plugin (and also contributed a chapter to the Advanced Rails Recipes book using the UltraSphinx plugin). I&amp;#8217;d now recommend using the UltraSphinx plugin if you want to take advantage of Sphinx for your Rails application.&lt;/p&gt;


	&lt;p&gt;In my opinion, this completes the &amp;#8216;missing&amp;#8217; piece of functionality and should make Sphinx your default full-text search engine (if you&amp;#8217;re using MySQL).&lt;/p&gt;</description>
      <pubDate>Sun, 09 Mar 2008 13:58:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:f61c10fc-ffc3-4d10-808d-a5a933f7e532</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2008/03/09/sphinx-search-with-delta-indexing-thanks-to-ultrasphinx</link>
      <category>Ruby on Rails</category>
    </item>
    <item>
      <title>Pimp my MacBook Pro</title>
      <description>&lt;p style="float:right"&gt;&lt;a href="http://www.slashdotdash.net/images/pimp1.jpg"&gt;&lt;img src="http://www.slashdotdash.net/images/pimp1p.jpg" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Thanks to the increasing prevalence of Apple laptops &amp;#8211; including the MacBook, MacBook Pro and new Air &amp;#8211; having a Mac no longer makes you &lt;em&gt;l33t&lt;/em&gt;!  To combat this, a couple weeks ago I decided to &lt;em&gt;pimp my MacBook Pro&lt;/em&gt; by changing the illuminated Apple logo on the case. A &lt;a href="http://www.icolours.ca/"&gt;Canadian site&lt;/a&gt; sells a multitude of inserts that can be used to &lt;a href="http://www.icolours.ca/gallery.html"&gt;alter the logo&lt;/a&gt;.&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;Customize your laptop for only $4.99! These high-quality inserts will make your laptop one of a kind! Free Worldwide Shipping! Compatible with: iBooks, Powerbooks, MacBooks and MacBook Pros&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p style="float:left"&gt;&lt;a href="http://www.slashdotdash.net/images/pimp3.jpg"&gt;&lt;img src="http://www.slashdotdash.net/images/pimp3p.jpg" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p style="float:right"&gt;&lt;a href="http://www.slashdotdash.net/images/pimp2.jpg"&gt;&lt;img src="http://www.slashdotdash.net/images/pimp2p.jpg" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;The &lt;a href="http://www.icolours.ca/installation.html"&gt;installation guide&lt;/a&gt; steps you through the process, the MacBook Pro is rated as &amp;#8220;Medium&amp;#8221; difficulty. Apart from the tight angle to unscrew the 2 retaining screws at the bottom of the screen, the tricky part to the process is removing the back of the screen using a credit card. You need a steady hand and a slightly cavalier attitude to prise the cover apart!&lt;/p&gt;


	&lt;p&gt;I went for the &amp;#8216;Rainbow&amp;#8217; design &amp;#8211; one of the &lt;a href="http://apple2history.org/history/ah04.html"&gt;original Apple logos&lt;/a&gt; &amp;#8211; the end result is rather pleasant update to the plain white logo and it still glows in the dark.&lt;/p&gt;</description>
      <pubDate>Sat, 08 Mar 2008 20:19:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:f030daad-4298-4f33-85f1-9ef4646740df</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2008/03/08/pimp-my-macbook-pro</link>
      <category>Apple</category>
    </item>
    <item>
      <title>BBC iPlayer on the iPhone </title>
      <description>&lt;p style="float:right"&gt;&lt;a href="http://www.slashdotdash.net/images/iplayer1.jpg"&gt;&lt;img src="http://www.slashdotdash.net/images/iplayer1p.jpg" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Yesterday the &lt;a href="http://news.bbc.co.uk/1/hi/technology/7283702.stm"&gt;&lt;span class="caps"&gt;BBC&lt;/span&gt; announced&lt;/a&gt; that their &lt;a href="http://www.bbc.co.uk/iplayer/"&gt;iPlayer&lt;/a&gt; video on demand service was available for the iPhone (and iPod Touch). There&amp;#8217;s a more in depth post on the &lt;a href="http://www.bbc.co.uk/blogs/bbcinternet/2008/03/bbc_iplayer_on_iphone_behind_t.html"&gt;&lt;span class="caps"&gt;BBC&lt;/span&gt; Internet Blog&lt;/a&gt; where they give details on the technical implementation.&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;Back to &lt;span class="caps"&gt;BBC&lt;/span&gt; iPlayer on iPhone implementation: we&amp;#8217;re not using the new Apple &lt;span class="caps"&gt;SDK&lt;/span&gt;, nor are we using the much-rumoured Flash for iPhone (no &amp;#8211; we haven&amp;#8217;t seen it, either). Instead, we&amp;#8217;re creating 516Kbps streams (400Kbps H.264 video, 116Kbps &lt;span class="caps"&gt;AAC&lt;/span&gt; audio) that show off &lt;span class="caps"&gt;BBC&lt;/span&gt; programmes brilliantly on an iPhone.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;It&amp;#8217;s interesting to read about the raw processing power required to transcode their 24 simultaneous incoming programmes, for a peak data rate of over a gigabit per second of incoming video.&lt;/p&gt;


	&lt;p&gt;I tried out an episode of Top Gear and was impressed with both the streaming speed and the quality of the video (check out the images below). The only downside is that it only supports streaming and requires a WiFi connection; unsurprisingly, &lt;span class="caps"&gt;EDGE&lt;/span&gt; isn&amp;#8217;t fast enough. Ideally it would be fantastic to be able to download a programme to watch &amp;#8216;offline&amp;#8217;, such as on a train (I&amp;#8217;ll keep my finger&amp;#8217;s crossed).&lt;/p&gt;


	&lt;p style="float:left"&gt;&lt;a href="http://www.slashdotdash.net/images/iplayer2.jpg"&gt;&lt;img src="http://www.slashdotdash.net/images/iplayer2p.jpg" style="margin:0;" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p style="float:left"&gt;&lt;a href="http://www.slashdotdash.net/images/iplayer3.jpg"&gt;&lt;img src="http://www.slashdotdash.net/images/iplayer3p.jpg" style="margin:0;" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p style="float:left"&gt;&lt;a href="http://www.slashdotdash.net/images/iplayer4.jpg"&gt;&lt;img src="http://www.slashdotdash.net/images/iplayer4p.jpg" style="margin:0;" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;h3 style="clear:both;"&gt;Update&lt;/h3&gt;


	&lt;p&gt;I knocked up a &lt;a href="http://pastie.org/164454"&gt;quick Ruby script to download the mp4 files&lt;/a&gt; that the iPhone version uses (it uses wget).&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;ruby iplayer_download.rb http://www.bbc.co.uk/iplayer/page/item/b0074fvk.shtml&lt;/pre&gt;&lt;/code&gt;

	&lt;p&gt;&lt;strong&gt;Now enhanced with the help of Richard &amp;#38; Richard via the comments.&lt;/strong&gt;&lt;/p&gt;</description>
      <pubDate>Sat, 08 Mar 2008 18:23:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:03366842-64bc-4a93-91cd-073be1aca36a</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2008/03/08/bbc-iplayer-on-the-iphone</link>
      <category>iPhone</category>
    </item>
    <item>
      <title>Contributing to &amp;quot;Advanced Rails Recipes&amp;quot;</title>
      <description>&lt;p style="float:right"&gt;&lt;img src="http://www.slashdotdash.net/images/fr-arr-100.jpg" alt="" /&gt;&lt;/p&gt;


	&lt;p&gt;The latest Beta update to the new Pragmatic Programmers book &lt;a href="http://www.pragprog.com/titles/fr_arr"&gt;Advanced Rails Recipes: 72 New Ways to Build Stunning Rails Apps&lt;/a&gt; includes two chapters authored by myself.&lt;/p&gt;


	&lt;p&gt;They are both complete rewrites and updates of two of my popular blog posts &lt;a href="http://www.slashdotdash.net/articles/2007/08/06/rails-searching-with-sphinx"&gt;Rails searching with Sphinx&lt;/a&gt; and &lt;a href="http://www.slashdotdash.net/articles/2007/12/04/iphone-on-rails-creating-an-iphone-optimised-version-of-your-rails-site-using-iui-and-rails-2"&gt;iPhone on Rails &amp;#8211; Creating an iPhone optimised version of your Rails site using iUI and Rails 2&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;The new recipes are:&lt;/p&gt;


	&lt;p style="float:right"&gt;&lt;img src="http://www.slashdotdash.net/images/api_search.gif" alt="" /&gt;&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;Full-Text Search with Sphinx&lt;/strong&gt; &amp;#8211; includes a Rails site that uses Sphinx to index the Rails &lt;span class="caps"&gt;API&lt;/span&gt;.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p style="float:right"&gt;&lt;img src="http://www.slashdotdash.net/images/iphone_todo.gif" alt="" /&gt;&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;Support An iPhone Interface&lt;/strong&gt; &amp;#8211; with a &lt;span class="caps"&gt;TODO&lt;/span&gt; list app.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;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.&lt;/p&gt;</description>
      <pubDate>Thu, 28 Feb 2008 23:10:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:e8229783-1a49-45cb-882c-cf1393a2f34f</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2008/02/28/contributing-to-advanced-rails-recipes</link>
      <category>Ruby on Rails</category>
      <category>iPhone</category>
    </item>
    <item>
      <title>Ruby Tidbit: Timeout code execution</title>
      <description>&lt;p&gt;Just a small tip, if you wish to ensure a snippet of Ruby code doesn&amp;#8217;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 &lt;code&gt;net/http&lt;/code&gt; for example.&lt;/p&gt;


&lt;a href="http://www.ruby-doc.org/stdlib/libdoc/timeout/rdoc/index.html"&gt;timeout.rb&lt;/a&gt;
	&lt;blockquote&gt;
		&lt;p&gt;A way of performing a potentially long-running operation in a thread, and terminating it&#8216;s execution if it hasn&#8216;t finished within fixed amount of time.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;Here&amp;#8217;s a quick example using the excellent &lt;a href="http://rfeedparser.rubyforge.org/"&gt;rFeedParser&lt;/a&gt; (Universal Feed Parser in Ruby) to fetch an &lt;span class="caps"&gt;RSS&lt;/span&gt; feed.&lt;/p&gt;


&lt;pre&gt;
require 'timeout'
require 'zlib'
require 'rubygems'
require 'rfeedparser'

fp = nil
begin
  # Don't take longer than 20 seconds to retrieve &amp;#38; parse an RSS feed
  Timeout::timeout(20) do
    fp = FeedParser.parse("http://feeds.feedburner.com/slashdotdash")
  end
rescue Timeout::Error
  # Too slow!!
end
&lt;/pre&gt;</description>
      <pubDate>Fri, 15 Feb 2008 00:39:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:4fb9acf2-d6a0-497e-abe0-edaab6ab76f4</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2008/02/15/ruby-tidbit-timeout-code-execution</link>
      <category>Ruby on Rails</category>
      <category>ruby</category>
    </item>
    <item>
      <title>yabb.com - the art of conversation</title>
      <description>&lt;p style="float:right"&gt;&lt;img src="http://www.slashdotdash.net/images/yabb-home.gif" alt="" /&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.slashdotdash.net/articles/2008/01/21/london-this-week-rails-free-pizza-beer-and-cominded-de-stealth"&gt;Thursday was the launch party&lt;/a&gt; for &lt;a href="http://www.cominded.com/"&gt;Cominded&amp;#8217;s&lt;/a&gt; latest social application &lt;a href="http://www.yabb.com"&gt;yabb&lt;/a&gt;. It&amp;#8217;s currently still in private beta, although everyone who attended the event had the opportunity to register on the night and should have received an invitation the following day.&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://paulfwalsh.com/"&gt;Paul Walsh&lt;/a&gt; was first off the mark to &lt;a href="http://paulfwalsh.com/bebo-co-founder-paul-birch-strikes-again/"&gt;blog about yabb&lt;/a&gt; and followed up with an &lt;a href="http://paulfwalsh.com/interview-with-paul-birch-about-yabb/"&gt;interview with Paul Birch&lt;/a&gt;. On Friday, &lt;a href="http://uk.techcrunch.com/2008/01/25/yabb-launches-voip-micro-blogging-service/"&gt;Techcrunch UK&lt;/a&gt; (&lt;a href="http://www.techcrunch.com/2008/01/25/from-across-the-pond-yabb-a-seesmic-for-voipmails/"&gt;followed by US&lt;/a&gt;) wrote about the launch of yabb and there were &lt;a href="http://voicesage.blogspot.com/2008/01/enabling-online-interactions-yabb.html"&gt;further&lt;/a&gt; &lt;a href="http://thayer18.livejournal.com/6902.html"&gt;blog&lt;/a&gt; reactions. &lt;a href="http://www.olibarrett.co.uk/"&gt;Oli Barrett&lt;/a&gt; at the &lt;a href="http://www.dailynetworker.co.uk/"&gt;Daily Networker&lt;/a&gt; wrote a great article about yabb titled &amp;#8216;&lt;a href="http://www.dailynetworker.co.uk/2008/01/26/a-little-more-conversation/"&gt;A Little More Conversation&lt;/a&gt;&amp;#8217;.&lt;/p&gt;


	&lt;h2&gt;yabb lets you talk more and type less by connecting you with people and topics you&#8217;re interested in&lt;/h2&gt;


	&lt;p style="float:right"&gt;&lt;img src="http://www.slashdotdash.net/images/yabb-art.gif" alt="" /&gt;&lt;/p&gt;


	&lt;p&gt;For those who haven&amp;#8217;t yet joined yabb (with a lowercase y), it&amp;#8217;s a social network that facilitate one-to-one conversations between like-minded people using Skype. With yabb we&amp;#8217;re promoting the art of conversation; you find a topic you&amp;#8217;re interested in, choose who you want to talk to and invite them to contact you using a call request.&lt;/p&gt;


	&lt;p&gt;Why not head along to &lt;a href="http://yabb.com/account/register_beta_interest"&gt;register&lt;/a&gt; and keep up to date via the &lt;a href="http://blog.yabb.com/"&gt;blog&lt;/a&gt;. If you&amp;#8217;re already signed-up and using yabb then we&amp;#8217;re very interested in &lt;a href="http://yabb.com/info/contact"&gt;getting your feedback&lt;/a&gt; and any &lt;a href="http://yabb.com/conversations/41-new_features_for_yabb"&gt;ideas for new features&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Sun, 27 Jan 2008 17:40:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:c026bee4-839f-4944-b4d6-73c7515aca65</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2008/01/27/yabb-com-the-art-of-conversation</link>
    </item>
    <item>
      <title>London this week; Rails, free pizza &amp;amp; beer and Cominded de-stealth</title>
      <description>&lt;p style="float:right"&gt;&lt;img src="http://www.slashdotdash.net/images/pizzaonrails.gif" alt="" /&gt;&lt;/p&gt;


	&lt;p&gt;This Thursday, 24th Jan, is the latest &lt;a href="http://www.pizzaonrails.com/"&gt;Pizza on Rails&lt;/a&gt; event where you can enjoy free pizza &amp;#38; beer, &lt;strong&gt;meet-up with fellow Rails developers&lt;/strong&gt; and find out what Cominded has been working on when we announce our exciting new Rails site.&lt;/p&gt;


	&lt;p&gt;Join the Pizza On Rails mailing list for further details and to &lt;span class="caps"&gt;RSVP&lt;/span&gt; to indicate your attendance. It looks like it&amp;#8217;ll be another great night with almost 100 people already signed up.&lt;/p&gt;</description>
      <pubDate>Mon, 21 Jan 2008 23:03:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:963bf2aa-aba0-429a-8945-cbbede63e86f</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2008/01/21/london-this-week-rails-free-pizza-beer-and-cominded-de-stealth</link>
      <category>Ruby on Rails</category>
    </item>
    <item>
      <title>Quick Tip: Watch movies on your iPhone - conversion from AVI files on Mac OS X</title>
      <description>&lt;p style="float:right"&gt;&lt;img src="http://www.slashdotdash.net/images/iSquint.gif" alt="" /&gt;&lt;/p&gt;


	&lt;p&gt;Want to watch a movie on your iPhone (or iPod)? The simplest method of converting to the correct format and size is to use &lt;a href="http://www.isquint.org/"&gt;iSquint&lt;/a&gt; an &amp;#8220;iPod video conversion app for Mac &lt;span class="caps"&gt;OS X&lt;/span&gt;&amp;#8221;.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Install, then fire up the iSquint application.&lt;/li&gt;
		&lt;li&gt;Drag &amp;#38; drop your .avi file onto the window.&lt;/li&gt;
		&lt;li&gt;Select &lt;strong&gt;Optimize for iPod&lt;/strong&gt;, &lt;strong&gt;Add to iTunes&lt;/strong&gt; and &lt;strong&gt;H.264 Encoding&lt;/strong&gt;.&lt;/li&gt;
		&lt;li&gt;Set the &lt;strong&gt;Quality&lt;/strong&gt; slider (I&amp;#8217;d recommend High) and click &lt;strong&gt;Start&lt;/strong&gt;.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;&lt;img src="http://www.slashdotdash.net/images/iSquint2.gif" alt="" /&gt;&lt;/p&gt;


	&lt;p&gt;Leave iSquint to do its stuff and you&amp;#8217;ll have the converted film available in iTunes. For a single CD avi file, expect a final file size of around 300-350MB for High Quality or 150-200MB for Standard Quality settings (at 127kbps bit rate).&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You&amp;#8217;ll need to manually select the movie for synching when your iPhone or iPod is connected to iTunes.&lt;/p&gt;</description>
      <pubDate>Wed, 16 Jan 2008 20:37:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:ca5afe50-c1dc-4152-a02f-982119d8c25a</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2008/01/16/quick-tip-watch-movies-on-your-iphone-conversion-from-avi-files-on-mac-os-x</link>
      <category>Apple</category>
      <category>Mac OS X</category>
      <category>iPhone</category>
    </item>
    <item>
      <title>When did you start working with Rails?</title>
      <description>&lt;h2&gt;Got a copy of Agile Web Development With Rails&lt;/h2&gt;


	&lt;pre&gt;&lt;code&gt;Wed 9th Nov, 2005
Order #: 202-0160452-2867026 (&lt;a href="http://www.amazon.co.uk"&gt;amazon&lt;/a&gt;)
Items: 1 x Agile Web Development with Rails&lt;/code&gt;&lt;/pre&gt;


	&lt;h2&gt;Purchased TextMate (and a Mac to run it on)!&lt;/h2&gt;


	&lt;p&gt;&lt;img src="http://www.slashdotdash.net/images/textmate.png" alt="" /&gt;&lt;/p&gt;


	&lt;h2&gt;Announced first Rails site&lt;/h2&gt;


	&lt;pre&gt;&lt;code&gt;Sat, 29th Apr 2006
&lt;a href="http://www.slashdotdash.net/articles/2006/04/29/trawlr-com-online-rss-agregator"&gt;trawlr.com online rss agregator&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;


	&lt;h2&gt;Started working professionally with Rails&lt;/h2&gt;


	&lt;pre&gt;&lt;code&gt;Mon, 5th November 2007
&lt;a href="http://www.cominded.com/"&gt;Cominded&lt;/a&gt;&lt;/code&gt;&lt;/pre&gt;</description>
      <pubDate>Wed, 16 Jan 2008 09:00:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:91ed3db2-9a9c-44b9-955b-41412767dd33</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2008/01/16/when-did-you-start-working-with-rails</link>
      <category>Ruby on Rails</category>
    </item>
    <item>
      <title>iPhone on Rails - Creating an iPhone optimised version of your Rails site using iUI and Rails 2</title>
      <description>&lt;p style="float:right"&gt;&lt;a href="http://www.slashdotdash.net/images/iPhone3.gif"&gt;&lt;img src="http://www.slashdotdash.net/images/iPhone3p.gif" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p style="float:right"&gt;&lt;a href="http://www.slashdotdash.net/images/iPhone2.gif"&gt;&lt;img src="http://www.slashdotdash.net/images/iPhone2p.gif" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.slashdotdash.net/articles/2007/12/03/rails-2-upgrade-notes"&gt;After upgrading trawlr.com to Rails 2&lt;/a&gt; I thought I&amp;#8217;d make use of some of the new features and attempt to create an iPhone version of the site. 
With Rails 2 you can create a mime type specifically for the iPhone and then use that format in a &lt;code&gt;respond_to&lt;/code&gt; block (along with views such as &lt;code&gt;index.iphone.erb&lt;/code&gt;).&lt;/p&gt;


	&lt;h2&gt;Before you start &amp;#8211; iPhoney&lt;/h2&gt;


	&lt;p&gt;&lt;a href="http://www.marketcircle.com/iphoney/"&gt;iPhoney&lt;/a&gt; is an indispensable Mac-only tool for aiding the development of an iPhone specific site.&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;Looking for a way to see how your web creations will look on iPhone? Look no further. iPhoney gives you a pixel-accurate web browsing environment&#8212;powered by Safari&#8212;that you can use when developing web sites for iPhone. It&amp;#8217;s the perfect 320 by 480-pixel canvas for your iPhone development. And it&amp;#8217;s free. iPhoney is not an iPhone simulator but instead is designed for web developers who want to create 320 by 480 (or 480 by 320) websites for use with iPhone. It gives you a canvas on which to test the visual quality of your designs.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;Ensure iPhoney&amp;#8217;s user agent is set to &lt;code&gt;iPhone User Agent&lt;/code&gt; in the menu.&lt;/p&gt;


	&lt;h2&gt;iPhone mime type&lt;/h2&gt;


	&lt;p&gt;Create an iPhone mime type alias using Rails 2 &lt;code&gt;initializers&lt;/code&gt;.&lt;/p&gt;


&lt;code&gt;config/initializers/mime_types&lt;/code&gt;
&lt;pre&gt;
Mime::Type.register_alias "text/html", :iphone
&lt;/pre&gt;

	&lt;h2&gt;Detecting iPhone user agents&lt;/h2&gt;


	&lt;p style="float:right"&gt;&lt;a href="http://www.slashdotdash.net/images/iPhone1.gif"&gt;&lt;img src="http://www.slashdotdash.net/images/iPhone1p.gif" alt="" /&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;Apple recommends that rather than redirecting iPhone users to an iPhone-optimised version of your site you should instead show the original site with a link to the alternative.&lt;/p&gt;


	&lt;p&gt;This can be achieved via user agent sniffing; looking for &lt;code&gt;Mobile Safari&lt;/code&gt; (as Apple suggests), rather that iPhone or iPod touch, to allow for future device support.&lt;/p&gt;


	&lt;p&gt;Adding a helper method to &lt;code&gt;application_helper.rb&lt;/code&gt; allows a notification message to be shown for &lt;em&gt;only&lt;/em&gt; iPhone users (try accessing &lt;a href="http://www.trawlr.com"&gt;www.trawlr.com&lt;/a&gt; from an iPhone).&lt;/p&gt;


&lt;code&gt;app/helpers/application_helper.rb&lt;/code&gt;
&lt;pre&gt;
# Request from an iPhone or iPod touch? (Mobile Safari user agent)
def iphone_user_agent?
  request.env["HTTP_USER_AGENT"] &amp;#38;&amp;#38; request.env["HTTP_USER_AGENT"][/(Mobile\/.+Safari)/]
end
&lt;/pre&gt;

	&lt;p&gt;In your view, show a message for iPhone user agents directing them to the iPhone version.&lt;/p&gt;


&lt;pre&gt;
&amp;lt;% if iphone_user_agent? # Show message for iPhone users -%&amp;gt;
&amp;lt;div class="message"&amp;gt;
    &amp;lt;p&amp;gt;Using an iPhone? &amp;lt;a href="http://iphone.trawlr.com/"&amp;gt;Use the optimised version&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;% end -%&amp;gt;
&lt;/pre&gt;

	&lt;h2&gt;iPhone subdomain&lt;/h2&gt;


	&lt;p&gt;Instead of forcing users straight to our iPhone version, we offer them the option by using a separate subdomain (&lt;a href="http://iphone.trawlr.com"&gt;iphone.trawlr.com&lt;/a&gt;) with a link back to the &lt;em&gt;regular&lt;/em&gt; site if they wish. When developing locally I modified my &lt;code&gt;/etc/hosts&lt;/code&gt; file as follows so that I could use http://iphone.localhost.com:3000/.&lt;/p&gt;


&lt;code&gt;/etc/hosts&lt;/code&gt;
&lt;pre&gt;
127.0.0.1 iphone.localhost.com
&lt;/pre&gt;

	&lt;p&gt;You may need to flush the &lt;span class="caps"&gt;DNS&lt;/span&gt; cache after making the changes.&lt;/p&gt;


&lt;pre&gt;
sudo dscacheutil -flushcache
&lt;/pre&gt;

	&lt;h2&gt;Adjust format for iPhone&lt;/h2&gt;


	&lt;p&gt;I chose to require login for all requests to the iPhone version of the site.&lt;/p&gt;


&lt;pre&gt;
class ApplicationController &amp;lt; ActionController::Base
    before_filter :adjust_format_for_iphone
    before_filter :iphone_login_required

private

  # Set iPhone format if request to iphone.trawlr.com
  def adjust_format_for_iphone    
    request.format = :iphone if iphone_request?
  end

  # Force all iPhone users to login
  def iphone_login_required
    if iphone_request?
      redirect_to login_path unless logged_in?
    end
  end

  # Return true for requests to iphone.trawlr.com
  def iphone_request?
    return (request.subdomains.first == "iphone" || params[:format] == "iphone")
  end
end
&lt;/pre&gt;

	&lt;p&gt;Note that &lt;code&gt;sessions_controller.rb&lt;/code&gt; (handles login) requires &lt;code&gt;skip_before_filter :iphone_login_required&lt;/code&gt;.&lt;/p&gt;


	&lt;h2&gt;Using iUI and creating iPhone views&lt;/h2&gt;


	&lt;p&gt;The &lt;a href="http://code.google.com/p/iui/"&gt;iUI&lt;/a&gt; framework, based on Joe Hewitt&amp;#8217;s iPhone navigation work, hugely simplifies iPhone web development. All you need to do is include the iUI JavaScript and &lt;span class="caps"&gt;CSS&lt;/span&gt; files along with included images and create your views in a particular structure to have native iPhone behaviour such as sliding menus and &lt;span class="caps"&gt;AJAX&lt;/span&gt; page loading.&lt;/p&gt;


	&lt;p&gt;Rails 2 makes it trivial to create different views depending upon the format, including layouts. Our iPhone layout includes a few specifics for iUI and a &lt;code&gt;viewport&lt;/code&gt; meta tag for the device.&lt;/p&gt;


&lt;code&gt;app/views/layouts/application.iphone.erb&lt;/code&gt;
&lt;pre&gt;
&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&amp;gt;
&amp;lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"&amp;gt;
&amp;lt;head&amp;gt;
    &amp;lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&amp;gt;
    &amp;lt;meta id="viewport" name="viewport" content="width=320; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/&amp;gt;
    &amp;lt;title&amp;gt;&amp;lt;%= @page_title -%&amp;gt;&amp;lt;/title&amp;gt;
  &amp;lt;%= stylesheet_link_tag 'iui' %&amp;gt;
  &amp;lt;%= javascript_include_tag 'iui' %&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
    &amp;lt;div class="toolbar"&amp;gt;
        &amp;lt;h1 id="pageTitle"&amp;gt;&amp;lt;/h1&amp;gt;
        &amp;lt;a id="backButton" class="button" href="#"&amp;gt;&amp;lt;/a&amp;gt;
    &amp;lt;/div&amp;gt;

    &amp;lt;%= yield %&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/pre&gt;

	&lt;p&gt;When creating your iPhone views you should follow the iUI style guide, an example page is given below. Standard hyperlinks are loaded using &lt;span class="caps"&gt;AJAX&lt;/span&gt; and &lt;em&gt;slide&lt;/em&gt; into view, navigating back is handled by iUI. Links may be prefixed with &lt;code&gt;target="_self"&lt;/code&gt; to replace the entire page or &lt;code&gt;target="_replace"&lt;/code&gt; to replace the element with the response (using &lt;span class="caps"&gt;AJAX&lt;/span&gt;).&lt;/p&gt;


&lt;code&gt;index.iphone.erb&lt;/code&gt;
&lt;pre&gt;
&amp;lt;ul title="Home" selected="true"&amp;gt;
    &amp;lt;li&amp;gt;&amp;lt;%= link_to 'Example action', example_path %&amp;gt;&amp;lt;/li&amp;gt;
    &amp;lt;li&amp;gt;&amp;lt;%= link_to 'Logout', logout_path, :method =&amp;gt; :delete, :target =&amp;gt; '_self' %&amp;gt;&amp;lt;/li&amp;gt;
&amp;lt;/ul&amp;gt;
&lt;/pre&gt;

&lt;code&gt;show.iphone.erb&lt;/code&gt;
&lt;pre&gt;
&amp;lt;div class="panel" title="Example" selected="true"&amp;gt;
    &amp;lt;h2&amp;gt;Example Content&amp;lt;/h2&amp;gt;
    &amp;lt;p&amp;gt;Here's some content&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/pre&gt;

	&lt;p&gt;It&amp;#8217;s important to remember that iUI will load content using &lt;span class="caps"&gt;AJAX&lt;/span&gt;, thus you &lt;strong&gt;only&lt;/strong&gt; need to render a layout (such as &lt;code&gt;application.iphone.erb&lt;/code&gt;) for the first request or page of your iPhone site. All following requests should use &lt;code&gt;render :layout =&amp;gt; false&lt;/code&gt; (unless loaded into a new page with &lt;code&gt;target="_replace"&lt;/code&gt;). If you experience any wierd rendering issues it&amp;#8217;ll most likely be due to this irregularity.&lt;/p&gt;


&lt;pre&gt;
respond_to do |format|
    format.iphone do  # action.iphone.erb
      render :layout =&amp;gt; false
    end
end
&lt;/pre&gt;

	&lt;h2&gt;Show, don&amp;#8217;t tell&lt;/h2&gt;


	&lt;p&gt;Why not try &lt;a href="http://iphone.trawlr.com/"&gt;iphone.trawlr.com&lt;/a&gt; for yourself? It&amp;#8217;ll work for your iPhone or any web browser. You&amp;#8217;ll need to register via the &lt;a href="http://www.trawlr.com/"&gt;normal site&lt;/a&gt; if you don&amp;#8217;t already have an account (quick, no email registration required)!&lt;/p&gt;


	&lt;h2&gt;References&lt;/h2&gt;


	&lt;p&gt;The following resources on the new Rails 2 iPhone format ability and iUI library were extremely helpful; the documentation from Apple not so much!&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;http://developer.apple.com/iphone/&lt;/li&gt;
		&lt;li&gt;http://www.railspikes.com/2007/11/8/iphone-subdomains-with-rails&lt;/li&gt;
		&lt;li&gt;http://blog.nicksieger.com/articles/2007/09/18/railsconf-europe-david-heinemeier-hansson&lt;/li&gt;
		&lt;li&gt;http://www.joehewitt.com/blog/introducing_iui.php&lt;/li&gt;
		&lt;li&gt;http://code.google.com/p/iui/&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Yes, I&amp;#8217;m still loving the iPhone!&lt;/p&gt;</description>
      <pubDate>Tue, 04 Dec 2007 00:33:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:f392cffa-af1c-44ce-b0d3-4174a232a3ff</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2007/12/04/iphone-on-rails-creating-an-iphone-optimised-version-of-your-rails-site-using-iui-and-rails-2</link>
      <category>Ruby on Rails</category>
      <category>iPhone</category>
      <category>iPhone</category>
    </item>
    <item>
      <title>Rails 2 Upgrade Notes</title>
      <description>&lt;p&gt;Over the weekend I decided to try out Rails 2 by upgrading an existing site (http://www.trawlr.com/) from Rails 1.2.6 to Rails 2 &lt;span class="caps"&gt;RC2&lt;/span&gt;.&lt;/p&gt;


	&lt;h2&gt;Check for deprecations before you upgrade&lt;/h2&gt;


	&lt;p&gt;You may want to check your existing application for deprecated code before upgrading using the following rake task.&lt;/p&gt;


&lt;code&gt;lib/tasks/rails.rake&lt;/code&gt;
&lt;pre&gt;
desc "Checks your app and gently warns you if you are using deprecated code." 
task :deprecated =&amp;gt; :environment do
  deprecated = {
    '@params'    =&amp;gt; 'Use params[] instead',
    '@session'   =&amp;gt; 'Use session[] instead',
    '@flash'     =&amp;gt; 'Use flash[] instead',
    '@request'   =&amp;gt; 'Use request[] instead',
    '@env' =&amp;gt; 'Use env[] instead',
    'find_all'   =&amp;gt; 'Use find(:all) instead',
    'find_first' =&amp;gt; 'Use find(:first) instead',
    'render_partial' =&amp;gt; 'Use render :partial instead',
    'component'  =&amp;gt; 'Use of components are frowned upon',
    'paginate'   =&amp;gt; 'The default paginator is slow. Writing your own may be faster',
    'start_form_tag'   =&amp;gt; 'Use form_for instead',
    'end_form_tag'   =&amp;gt; 'Use form_for instead',
    ':post =&amp;gt; true'   =&amp;gt; 'Use :method =&amp;gt; :post instead'
  }

  deprecated.each do |key, warning|
    puts '--&amp;gt; ' + key
    output = `cd '#{File.expand_path('app', RAILS_ROOT)}' &amp;#38;&amp;#38; grep -n --exclude=*.svn* -r '#{key}' *`
    unless output =~ /^$/
      puts "  !! " + warning + " !!" 
      puts '  ' + '.' * (warning.length + 6)
      puts output
    else
      puts "  Clean! Cheers for you!" 
    end
    puts
  end
end
&lt;/pre&gt;

	&lt;p&gt;Use rake to execute the task.&lt;/p&gt;


&lt;pre&gt;
rake deprecated
&lt;/pre&gt;

	&lt;p&gt;With any luck you won&amp;#8217;t get many warnings; it should give you a rough estimate on how long your upgrade may take.&lt;/p&gt;


	&lt;h2&gt;Getting Rails 2&lt;/h2&gt;


	&lt;p&gt;First you need to get the &lt;span class="caps"&gt;RC2&lt;/span&gt; (or newer) tagged Rails source using rake. This downloads the Rails framework to your appliction&amp;#8217;s &lt;code&gt;vender/rails&lt;/code&gt; directory.&lt;/p&gt;


&lt;pre&gt;
rake rails:freeze:edge TAG=rel_2-0-0_RC2
&lt;/pre&gt;

	&lt;h3&gt;Upgrade issues&lt;/h3&gt;


	&lt;p&gt;After upgrading, it&amp;#8217;s worth running your test suite looking for any problems. The following are issues I ran into to get trawlr.com working.&lt;/p&gt;


	&lt;h4&gt;Singular resources now map to plural controllers &amp;#8211; Override by using the :controller option in &lt;code&gt;routes.rb&lt;/code&gt;&lt;/h4&gt;


&lt;code&gt;config/routes.rb&lt;/code&gt;
&lt;pre&gt;
# Singleton reader resource
map.resource :reader, :controller =&amp;gt; 'reader'
&lt;/pre&gt;

	&lt;h4&gt;&lt;code&gt;with_scope&lt;/code&gt; is now protected &amp;#8211; Use .send(:with_scope) to call method&lt;/h4&gt;


	&lt;p&gt;This caused an issue due to using the &lt;a href="http://blog.hasmanythrough.com/2006/08/19/magic-join-model-creation"&gt;magic join model&lt;/a&gt; pattern, although the fix is relatively simple.&lt;/p&gt;


&lt;pre&gt;
MyModel.send(:with_scope, args)
&lt;/pre&gt;

	&lt;h4&gt;asset_packager plugin broken &amp;#8211; Apply fix&lt;/h4&gt;


	&lt;p&gt;The fabulous asset_packager plugin required a quick change to get working again (single-line change).&lt;/p&gt;


&lt;pre&gt;
Index: vendor/plugins/asset_packager/lib/synthesis/asset_package_helper.rb
===================================================================
--- vendor/plugins/asset_packager/lib/synthesis/asset_package_helper.rb    (revision 86)
+++ vendor/plugins/asset_packager/lib/synthesis/asset_package_helper.rb    (working copy)
@@ -37,7 +37,7 @@
     private
       # rewrite compute_public_path to allow us to not include the query string timestamp
       # used by ActionView::Helpers::AssetTagHelper
-      def compute_public_path(source, dir, ext, add_asset_id=true)
+      def compute_public_path(source, dir, ext = nil, add_asset_id=true)
         source = source.dup
         source &amp;lt;&amp;lt; ".#{ext}" if File.extname(source).blank?
         unless source =~ %r{^[-a-z]+://}
&lt;/pre&gt;

	&lt;p&gt;I still prefer this to the new Rails 2 asset merging as it also minifies JS and &lt;span class="caps"&gt;CSS&lt;/span&gt; files (including stripping comments) and also allows you to specify multiple asset &lt;em&gt;groups&lt;/em&gt; (for example one grouping for the main site, another for an iPhone version). A word of caution if you use asset_packager you cannot take advantage of the new Rails 2 asset servers (see below).&lt;/p&gt;


&lt;pre&gt;
# DOES NOT work with asset_packager
config.action_controller.asset_host = "http://asset%d.site.com" 
&lt;/pre&gt;

	&lt;h4&gt;Nested route helpers changed &amp;#8211; Must specifiy parent resource&lt;/h4&gt;


	&lt;p&gt;If you have any nested routes it&amp;#8217;s likely you will have to alter the named route helpers, for example &lt;code&gt;child_path&lt;/code&gt; is now &lt;code&gt;parent_child_path&lt;/code&gt;.&lt;/p&gt;


	&lt;h4&gt;&lt;code&gt;start_form_tag&lt;/code&gt; and &lt;code&gt;end_form_tag&lt;/code&gt; have been deprecated &amp;#8211; Quick fix is to replace with &lt;code&gt;form_tag&lt;/code&gt; and &lt;code&gt;&amp;lt;/form&amp;gt;&lt;/code&gt; respectively.&lt;/h4&gt;


&lt;pre&gt;
&amp;lt;%= form_tag articles_path %&amp;gt; 
  &amp;lt;%= text_field :article, :title %&amp;gt; 
  &amp;lt;%= submit_tag "Save" %&amp;gt; 
&amp;lt;/form&amp;gt;
&lt;/pre&gt;

	&lt;h4&gt;&lt;code&gt;render_without_layout&lt;/code&gt; has been deprecated &amp;#8211; Use &lt;code&gt;:layout =&amp;gt; false&lt;/code&gt; instead.&lt;/h4&gt;


&lt;pre&gt;
render :layout =&amp;gt; false
&lt;/pre&gt;

	&lt;h4&gt;restful_authentication plugin is broken &amp;#8211; Replace &lt;code&gt;redirect_to_url&lt;/code&gt; (deprecated) in &lt;code&gt;lib/authenticated_system.rb&lt;/code&gt; with to &lt;code&gt;redirect_to&lt;/code&gt;.&lt;/h4&gt;


&lt;pre&gt;
Index: authenticated_system.rb
===================================================================
--- authenticated_system.rb    (revision 86)
+++ authenticated_system.rb    (working copy)
@@ -94,7 +94,7 @@
     # Redirect to the URI stored by the most recent store_location call or
     # to the passed default.
     def redirect_back_or_default(default)
-      session[:return_to] ? redirect_to_url(session[:return_to]) : redirect_to(default)
+      session[:return_to] ? redirect_to(session[:return_to]) : redirect_to(default)
       session[:return_to] = nil
     end
&lt;/pre&gt;

	&lt;h2&gt;Optionally, rename your views&lt;/h2&gt;


	&lt;p&gt;Rails 2 includes some changes to the way views are named. Previously you may have had &lt;code&gt;show.rhtml&lt;/code&gt; and &lt;code&gt;show.rjs&lt;/code&gt; which now become &lt;code&gt;show.html.erb&lt;/code&gt; and &lt;code&gt;show.js.rjs&lt;/code&gt; to indicate the mime type and template engines used. You don&amp;#8217;t have to change your &lt;em&gt;old&lt;/em&gt; views, but the following rake task should make it a quick change if you decide to. For trawlr.com I chose to use the new format for any new view templates but left the existing ones as they were (I&amp;#8217;ll probably rename as changes are made on an individual basis).&lt;/p&gt;


&lt;code&gt;lib/tasks/rails.rake&lt;/code&gt;
&lt;pre&gt;
namespace 'views' do
  desc 'Renames all .rhtml views to .html.erb, .rjs to .js.rjs, .rxml to .xml.builder, and .haml to .html.haml'
  task 'rename' do
    Dir.glob('app/views/**/[^_]*.rhtml').each do |file|
      puts `svn mv #{file} #{file.gsub(/\.rhtml$/, '.html.erb')}`
    end

    Dir.glob('app/views/**/[^_]*.rxml').each do |file|
      puts `svn mv #{file} #{file.gsub(/\.rxml$/, '.xml.builder')}`
    end

    Dir.glob('app/views/**/[^_]*.rjs').each do |file|
      puts `svn mv #{file} #{file.gsub(/\.rjs$/, '.js.rjs')}`
    end
    Dir.glob('app/views/**/[^_]*.haml').each do |file|
      puts `svn mv #{file} #{file.gsub(/\.haml$/, '.html.haml')}`
    end
  end
end
&lt;/pre&gt;

	&lt;h2&gt;Resources&lt;/h2&gt;


	&lt;p&gt;For more information on Rails 2 refer to the &lt;a href="http://weblog.rubyonrails.org/2007/9/30/rails-2-0-0-preview-release"&gt;preview release blog post&lt;/a&gt;. For $9 you can pick up a copy of &lt;a href="http://peepcode.com/products/rails2-pdf"&gt;Ryan Daigle&amp;#8217;s worthwhile Rails 2 &lt;span class="caps"&gt;PDF&lt;/span&gt; book available via peepcode&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Mon, 03 Dec 2007 22:59:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:57aa6e58-09e3-4b78-956f-dfab914cbc70</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2007/12/03/rails-2-upgrade-notes</link>
      <category>Ruby on Rails</category>
    </item>
    <item>
      <title>Mac OS X Leopard</title>
      <description>&lt;p style="float:right"&gt;&lt;img src="http://www.slashdotdash.net/images/leopard.jpg" alt="" /&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.apple.com/macosx/"&gt;Mac &lt;span class="caps"&gt;OS X&lt;/span&gt; Leopard arrives October 26&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;Before you rush to pre-order / buy it from Apple, for &#163;85, visit &lt;a href="http://www.amazon.co.uk/gp/product/B000FK88JK"&gt;Amazon where you can save yourself a fiver and pick up a copy&lt;/a&gt; for &#163;79.98 with free delivery.&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;: Ebuyer.com are currently offering &lt;a href="http://www.ebuyer.com/special/1314"&gt;&#163;10 off any order over &#163;30 if you pay via Google Checkout&lt;/a&gt;. With this you can pick-up &lt;a href="http://www.ebuyer.com/product/134650"&gt;Leopard for even cheaper&lt;/a&gt; at &#163;71.78 (with free delivery).&lt;/p&gt;</description>
      <pubDate>Sat, 20 Oct 2007 14:09:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:c82eea6c-646e-43b6-8d00-f6ccb282ec7b</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2007/10/20/mac-os-x-leopard</link>
      <category>Mac OS X</category>
    </item>
    <item>
      <title>DHH Keynote @ RailsConf Europe 2007</title>
      <description>&lt;p&gt;&lt;a href="http://conferences.oreillynet.com/railseurope/"&gt;RailsConf Europe 2007&lt;/a&gt; in Berlin finished just over a week ago and for those of us who didn&amp;#8217;t make it along the  presentation slides and videos are now appearing online. David Heinemeier Hansson&amp;#8217;s keynote was recorded and published thanks to the guys at &lt;a href="http://www.railsonwave.com/railsonwave/2007/9/27/dhh-keynote-fixed"&gt;Rails on Wave&lt;/a&gt;.&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://conferences.oreillynet.com/pub/w/61/presentations.html"&gt;RailsConf Europe 2007 Presentations&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://railsconfeurope.railsonwave.com/flash/Keynote.swf"&gt;&lt;span class="caps"&gt;DHH&lt;/span&gt; Keynote Video&lt;/a&gt; (full-screen)&lt;/p&gt;


	&lt;p&gt;Further details from &lt;span class="caps"&gt;DHH&lt;/span&gt;&amp;#8217;s talk have been &lt;a href="http://casperfabricius.com/blog/2007/09/18/railsconf2007-dhh/"&gt;blogged in detail&lt;/a&gt;. Personally, I&amp;#8217;m really looking forward to the release of Rails 2.0; evolution rather than revolution.&lt;/p&gt;</description>
      <pubDate>Thu, 27 Sep 2007 23:52:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:0e05f3b0-5133-49da-9db2-689371e918b8</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2007/09/27/dhh-keynote-railsconf-europe-2007</link>
      <category>Ruby on Rails</category>
    </item>
    <item>
      <title>iPhone UK launch date announced</title>
      <description>&lt;p&gt;Friday, 9th November has been added to my diary. After months of speculation the &lt;a href="http://www.apple.com/uk/pr/2007/09/180907_iphone.html"&gt;UK release of the iPhone was announced today&lt;/a&gt; at a press meeting in the London Apple store (which I visited just last week). The &lt;a href="http://www.o2.co.uk/iphone"&gt;iPhone is available from 02&lt;/a&gt; here in the UK at a cost of &#163;269 for the handset and a minimum &#163;35 / month contract (for 18 months).&lt;/p&gt;


	&lt;p&gt;The good news is that you get an &lt;em&gt;unlimited&lt;/em&gt; data plan, the bad news is no 3G, which is a major draw-back. To counteract the 3G slip, Apple announced free WiFi for O2 iPhone users at the 7,500 hotspots serviced by Cloud in the UK.&lt;/p&gt;


	&lt;p&gt;&lt;img src="http://www.slashdotdash.net/images/iphonebanner.jpg" alt="" /&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.apple.com/uk/iphone/"&gt;Apple iPhone&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.o2.co.uk/iphone/"&gt;O2 iPhone&lt;/a&gt;&lt;/p&gt;


	&lt;p&gt;... just in case you were wondering, &lt;strong&gt;&lt;span class="caps"&gt;YES&lt;/span&gt;&lt;/strong&gt; I will be buying one.&lt;/p&gt;</description>
      <pubDate>Tue, 18 Sep 2007 20:32:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:673514f6-decc-47b7-9f06-49b4b7073a07</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2007/09/18/iphone-uk-launch-date-announced</link>
      <category>Apple</category>
    </item>
    <item>
      <title>Firefox on Mac OS X tab problem</title>
      <description>&lt;p&gt;An unexpected behaviour of Firefox on &lt;span class="caps"&gt;OS X&lt;/span&gt; is that when tabbing through web pages, especially forms, certain elements are skipped. This is quite annoying when form filling since you cannot tab to the &amp;#8220;submit&amp;#8221; button (or use the &amp;#8220;I&amp;#8217;m Feeling Lucky&amp;#8221;  button on Google without resorting to the mouse).&lt;/p&gt;


	&lt;p&gt;&lt;em&gt;Correcting this is in fact very simple!&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.robertnyman.com/2007/01/18/551/"&gt;Tabbing problems in Firefox in Mac &lt;span class="caps"&gt;OS X&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;The solution I found to the problem was somewhat unexpected. How to address this is that the end user have to turn on Full keyboard access &amp;gt; All controls in System Preferences for it to work as expected. Like this:&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;1. Open System Preferences&lt;/p&gt;


	&lt;p&gt;2. Go to Keyboard &amp;#38; Mouse&lt;/p&gt;


	&lt;p&gt;3. Select All controls for Full keyboard access&lt;/p&gt;


	&lt;p style="float:center"&gt;&lt;img src="http://www.slashdotdash.net/images/mac-system-preferences.png" alt="" /&gt;&lt;/p&gt;


	&lt;p&gt;Alternatively you can add / change the &lt;code&gt;accessibility.tabfocus&lt;/code&gt; Firefox option via &lt;code&gt;about:config&lt;/code&gt; to one of the following:&lt;/p&gt;


	&lt;p&gt;3 to be able to tab to form controls or
7 to be able to tab to everything&lt;/p&gt;</description>
      <pubDate>Wed, 05 Sep 2007 22:33:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:557c23f3-3e6f-4837-8c07-8ee3e356ba08</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2007/09/05/firefox-on-mac-os-x-tab-problem</link>
      <category>Mac OS X</category>
    </item>
    <item>
      <title>Ruby Hoedown 2007 Presentations</title>
      <description>&lt;p&gt;Videos and slides for every session from the &lt;a href="http://www.rubyhoedown.com/"&gt;Ruby Hoedown 2007&lt;/a&gt; (August 10th &amp;#8211; 11th) are now available to watch on the &lt;a href="http://rubyhoedown2007.confreaks.com/"&gt;confreaks.com&lt;/a&gt; site. Haven&amp;#8217;t watched any of these &lt;em&gt;yet&lt;/em&gt; but there are a few gems, such as Marcel Molina Jr.&amp;#8217;s keynote on beautiful code.&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://rubyhoedown2007.confreaks.com/session01.html"&gt;Charity Workshop: Ruby and Rails Testing Techniques&lt;/a&gt; 
&lt;em&gt;Marcel Molina, Jr., Bruce Tate, Chad Fowler&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://rubyhoedown2007.confreaks.com/session02.html"&gt;Exploring Merb&lt;/a&gt; 
&lt;em&gt;Ezra Zygmuntowicz&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://rubyhoedown2007.confreaks.com/session03.html"&gt;Next-Gen VoIP Development with Ruby and Adhearsion&lt;/a&gt; &lt;em&gt;Jay Phillips&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://rubyhoedown2007.confreaks.com/session04.html"&gt;Keynote Address: The Journey&lt;/a&gt; &lt;em&gt;Bruce Tate&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://rubyhoedown2007.confreaks.com/session05.html"&gt;Building Games with Ruby&lt;/a&gt; &lt;em&gt;Andrea O.K. Wright&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://rubyhoedown2007.confreaks.com/session06.html"&gt;Lightning Talks&lt;/a&gt; &lt;em&gt;Various Authors&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://rubyhoedown2007.confreaks.com/session07.html"&gt;Does Ruby Have a Chasm to Cross?&lt;/a&gt; &lt;em&gt;Ken Auer&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://rubyhoedown2007.confreaks.com/session08.html"&gt;Using C to Tune Your Ruby (or Rails) Application&lt;/a&gt; &lt;em&gt;Jared Richardson&lt;/em&gt;&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://rubyhoedown2007.confreaks.com/session09.html"&gt;Keynote Address: What makes code beautiful?&lt;/a&gt; &lt;em&gt;Marcel Molina, Jr.&lt;/em&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 24 Aug 2007 20:15:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:c30e5e2a-649d-4202-9667-a00ba10e52f6</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2007/08/24/ruby-hoedown-2007-presentations</link>
      <category>Ruby on Rails</category>
    </item>
    <item>
      <title>Starting and Stopping MySql on Mac OS X</title>
      <description>&lt;p&gt;Just a quick reminder, since I always forget how to do this in &lt;span class="caps"&gt;OS X&lt;/span&gt; (which uses &lt;code&gt;launchd&lt;/code&gt;).&lt;/p&gt;


&lt;pre&gt;
$ sudo launchctl start org.macports.mysql5
$ sudo launchctl stop org.macports.mysql5
&lt;/pre&gt;

	&lt;p&gt;(MySql 5 installed from MacPorts)&lt;/p&gt;


	&lt;blockquote&gt;
		&lt;p&gt;In Mac &lt;span class="caps"&gt;OS X&lt;/span&gt; v10.4 Tiger, Apple introduced a new system startup program called launchd. The launchd daemon takes over many tasks from cron, xinetd, mach_init, and init, which are &lt;span class="caps"&gt;UNIX&lt;/span&gt; programs that traditionally have handled system initialization, called systems scripts, run startup items, and generally prepared the system for the user. And they still exist on Mac &lt;span class="caps"&gt;OS X&lt;/span&gt; Tiger, but launchd has superseded them in many instances. These venerable programs are widely used by system administrators, open source developers, managers of web services, even consumers who want to use cron to manage  iCal scheduling, and they can still be called with launchd.&lt;/p&gt;
	&lt;/blockquote&gt;


	&lt;p&gt;&lt;a href="http://developer.apple.com/macosx/launchd.html"&gt;Getting Started with launchd&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 23 Aug 2007 21:27:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:e51238c5-fcd5-4d9c-bf0f-24fb62a24d2e</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2007/08/23/starting-and-stopping-mysql-on-mac-os-x</link>
      <category>Mac OS X</category>
    </item>
    <item>
      <title>Rails searching with Sphinx</title>
      <description>&lt;p&gt;Over the weekend I was implementing search for &lt;a href="http://www.trawlr.com"&gt;trawlr.com&lt;/a&gt; using &lt;a href="http://www.sphinxsearch.com/"&gt;Sphinx&lt;/a&gt;, the nginx of the search world (fast and Russian) according to &lt;a href="http://blog.evanweaver.com/articles/2007/07/09/ultrasphinx-searching-the-world-in-231-seconds"&gt;Evan Weaver&lt;/a&gt;. Previously I was using &lt;a href="http://www.slashdotdash.net/articles/2007/01/09/quick-ferret-primer-with-examples"&gt;Ferret&lt;/a&gt;, but I had to remove the search feature almost immediately due to the ferret indexes constantly corrupting and causing me a major headache. I decided to drop ferret in favour of Sphinx which I&amp;#8217;ve lots of &lt;a href="http://www.mysqlperformanceblog.com/2006/10/30/using-sphinx-as-mysql-data-retrieval-accelerator/"&gt;good things&lt;/a&gt; about recently.&lt;/p&gt;


	&lt;p&gt;Installation on my MacBook Pro required a slight adjustment of the mysql directories with mysql5 from MacPorts.&lt;/p&gt;


&lt;pre&gt;
$ wget http://www.sphinxsearch.com/downloads/sphinx-0.9.7.tar.gz
$ tar xvzf sphinx-0.9.7.tar.gz
$ cd sphinx-0.9.7
$ ./configure --with-mysql-includes=/opt/local/include/mysql5/mysql/ --with-mysql-libs=/opt/local/lib/mysql5/mysql/
$ make
$ sudo make install
&lt;/pre&gt;

	&lt;p&gt;Initally, I chose to use Evan&amp;#8217;s &lt;a href="http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/files/README.html"&gt;UltraSphinx&lt;/a&gt; plugin and it was very helpful to start with by auto-generating the sphinx.conf. After indexing the entire content of trawlr.com &amp;#8211; almost 1.5 million blog posts &amp;#8211; in just a few minutes I was suitably impressed. The search speed was also lightening fast. Unfortunately I had problems with my Rails app with the UltraSphinx plugin installed &amp;#8211; very strange errors started occurring.&lt;/p&gt;


	&lt;p&gt;Having already looked at the alternative Sphinx plugins I decided to try &lt;a href="http://www.datanoise.com/articles/2007/3/23/acts_as_sphinx-plugin"&gt;acts_as_sphinx&lt;/a&gt;. After some small tweaks to the sphinx.conf file (and a re-index) the search was working and more importantly so was my Rails app. An alternative option is &lt;a href="http://seattlerb.rubyforge.org/Sphincter/"&gt;Sphincter&lt;/a&gt; which I did experiment with but struggled with the limited documentation &amp;#8211; mostly concerning the configuration file required but &lt;span class="caps"&gt;YMMV&lt;/span&gt;.&lt;/p&gt;


&lt;pre&gt;
$ rake sphinx:index
$ rake sphinx:start
&lt;/pre&gt;

	&lt;p&gt;Indexing on my MacBook Pro&amp;#8230;&lt;/p&gt;


&lt;pre&gt;
$ time rake sphinx:index

using config file 'sphinx.conf'...
indexing index 'items'...
collected 1455733 docs, 1255.2 MB
sorted 182.4 Mhits, 100.0% done
total 1455733 docs, 1255246639 bytes
total 438.695 sec, 2861316.50 bytes/sec, 3318.32 docs/sec

real    7m25.307s
user    4m28.963s
sys     0m17.578s
&lt;/pre&gt;

	&lt;p&gt;Searching with &lt;code&gt;acts_as_sphinx&lt;/code&gt; via the console (&lt;code&gt;ruby script/console&lt;/code&gt;) for the term &amp;#8216;Google&amp;#8217;, sorted by published date.&lt;/p&gt;


&lt;pre&gt;
&amp;gt;&amp;gt; search = Item.find_with_sphinx 'Google', :sphinx =&amp;gt; {:sort_mode =&amp;gt; [:attr_desc, 'pub_date'], :page =&amp;gt; 1}, :order =&amp;gt; 'items.pub_date DESC'; 0
=&amp;gt; 0
&amp;gt;&amp;gt; search.total
=&amp;gt; 1000
&amp;gt;&amp;gt; search.total_found
=&amp;gt; 73717
&amp;gt;&amp;gt; search.time       
=&amp;gt; "0.000" 
&lt;/pre&gt;

	&lt;p&gt;That&amp;#8217;s with an index of 943Mb and almost 1.5 million items. Note that the search results are limited to 1,000 items due to the settings in my &lt;code&gt;spinx.conf&lt;/code&gt; file.&lt;/p&gt;


	&lt;p&gt;Within the Rails controller, search is done via:&lt;/p&gt;


&lt;pre&gt;
@items = Item.find_with_sphinx(params[:query], 
      :sphinx =&amp;gt; {:sort_mode =&amp;gt; [:attr_desc, 'pub_date'], :limit =&amp;gt; 50, :page =&amp;gt; (params[:page] || 1)}, 
      :order =&amp;gt; 'items.pub_date DESC')
&lt;/pre&gt;

	&lt;h2&gt;Updating the Sphinx index&lt;/h2&gt;


	&lt;p&gt;There&amp;#8217;s another rake task for updating the Sphinx index which can be called via a cron job, rather than &amp;#8216;live&amp;#8217; updates. The rotate command allows the index to be rebuilt whilst the Sphinx daemon is running, forcing a restart once completed.&lt;/p&gt;


&lt;pre&gt;
$ rake sphinx:rotate
&lt;/pre&gt;

	&lt;h2&gt;Update&lt;/h2&gt;


	&lt;ul&gt;
	&lt;li&gt;It looks like the UltraSphinx plugin requires edge Rails (thanks Evan)!&lt;/li&gt;
		&lt;li&gt;I&amp;#8217;ve deployed the search updates to the live &lt;a href="http://www.trawlr.com/reader/"&gt;trawlr.com&lt;/a&gt; site (currently search is only visible from the &lt;em&gt;reader&lt;/em&gt; view for logged in users).&lt;/li&gt;
		&lt;li&gt;&lt;strong&gt;Live search is fantastically quick&lt;/strong&gt;&lt;/li&gt;
		&lt;li&gt;&lt;a href="http://pastie.caboo.se/87943"&gt;Created some new rake tasks&lt;/a&gt; (to go in &lt;code&gt;lib/tasks/sphinx.rake&lt;/code&gt;) that allow you to have a sphinx.conf file per Rails environment (&lt;code&gt;config/sphinx.development.conf&lt;/code&gt; and &lt;code&gt;config/sphinx.production.conf&lt;/code&gt;). The available tasks are: &lt;code&gt;s:index&lt;/code&gt;, &lt;code&gt;s:rotate&lt;/code&gt;, &lt;code&gt;s:start&lt;/code&gt;, &lt;code&gt;s:stop&lt;/code&gt;, &lt;code&gt;s:status&lt;/code&gt; and &lt;code&gt;s:restart&lt;/code&gt;. The rake tasks assume that the Sphinx pid file is in the log directory (&lt;code&gt;pid_file = log/searchd.pid&lt;/code&gt;).&lt;/li&gt;
	&lt;/ul&gt;</description>
      <pubDate>Mon, 06 Aug 2007 20:30:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:fd2fdc8d-d688-477f-9108-34d35177a26a</guid>
      <author>ben@slashdotdash.net (Ben)</author>
      <link>http://www.slashdotdash.net/articles/2007/08/06/rails-searching-with-sphinx</link>
      <category>Ruby on Rails</category>
    </item>
  </channel>
</rss>
