<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" version="2.0"> <channel><title>Slash Dot Dash</title> <link>http://www.slashdotdash.net</link> <description>Rolling on Rails</description> <lastBuildDate>Tue, 28 Sep 2010 15:49:37 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.2.1</generator> <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/slashdotdash" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="slashdotdash" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item><title>Alistair Cockburn’s lightning talk on CQRS recorded at the Mountain West Ruby Conference 2010</title><link>http://www.slashdotdash.net/2010/09/27/alistair-cockburns-lightning-talk-on-cqrs-recorded-at-the-mountain-west-ruby-conference-2010/</link> <comments>http://www.slashdotdash.net/2010/09/27/alistair-cockburns-lightning-talk-on-cqrs-recorded-at-the-mountain-west-ruby-conference-2010/#comments</comments> <pubDate>Mon, 27 Sep 2010 21:57:43 +0000</pubDate> <dc:creator>Ben</dc:creator> <category><![CDATA[CQRS]]></category> <guid isPermaLink="false">http://www.slashdotdash.net/?p=1256</guid> <description><![CDATA[<p>Here's Alistair Cockburn's lightning talk on "Command Event DTO Architecture" recorded at the <a
href="http://mtnwestrubyconf.org/2010/">Mountain West Ruby Conference 2010</a> by <a
href="http://confreaks.net/">confreaks.net</a>. He talks about how his <a
href="http://alistair.cockburn.us/Hexagonal+architecture">Hexagonal Architecture</a> has been extended by <a
href="http://codebetter.com/blogs/gregyoung/">Greg Young</a> to form a Command-Event Architecture (aka CQRS).</p><p><a
href="http://www.youtube.com/watch?v=9kQ2veoeWZM">Mountain West Rubyconf 2010 - Alistair Cockburn - CQRS</a> (youtube.com)</p>]]></description> <content:encoded><![CDATA[<p>Here&#8217;s Alistair Cockburn&#8217;s lightning talk on &#8220;Command Event DTO Architecture&#8221; recorded at the <a
href="http://mtnwestrubyconf.org/2010/">Mountain West Ruby Conference 2010</a> by <a
href="http://confreaks.net/">confreaks.net</a>. He talks about how his <a
href="http://alistair.cockburn.us/Hexagonal+architecture">Hexagonal Architecture</a> has been extended by <a
href="http://codebetter.com/blogs/gregyoung/">Greg Young</a> to form a Command-Event Architecture (aka CQRS).</p><p><iframe
class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/9kQ2veoeWZM" frameborder="0"></iframe></p><p>This was <a
href="http://confreaks.net/videos/20-mwrc2010-lightning-talks">originally posted</a> as part of a 46 minute collection a talks, I&#8217;ve just extracted Alistair&#8217;s CQRS talk and made it available since the original location is no-longer providing video streaming.</p><p>There&#8217;s a r<a
href="http://cqrs.wordpress.com/">eference library on Command-Query Responsibility Segregation</a> if you&#8217;d like to know more. I&#8217;m posting this here as I&#8217;ve been working on a CQRS library in Ruby recently, with a Rails 3 plugin and small demo app which I&#8217;ll be linking to shortly.</p> <img src="http://feeds.feedburner.com/~r/slashdotdash/~4/-8cURlbXaIo" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.slashdotdash.net/2010/09/27/alistair-cockburns-lightning-talk-on-cqrs-recorded-at-the-mountain-west-ruby-conference-2010/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Rails 3, RSpec and Cucumber setup</title><link>http://www.slashdotdash.net/2010/09/27/rails-3-rspec-and-cucumber-setup/</link> <comments>http://www.slashdotdash.net/2010/09/27/rails-3-rspec-and-cucumber-setup/#comments</comments> <pubDate>Mon, 27 Sep 2010 19:53:07 +0000</pubDate> <dc:creator>Ben</dc:creator> <category><![CDATA[Ruby]]></category> <category><![CDATA[Ruby on Rails]]></category> <guid isPermaLink="false">http://www.slashdotdash.net/?p=1247</guid> <description><![CDATA[This quick how-to runs through creating a new Rails 3 application with both RSpec and Cucumber for testing (rather than Test::Unit). Rails 3 requires (the somewhat confusingly versioned) RSpec 2 and rspec-rails. Similarly, Cucumber uses cucumber-rails for bootstrapping your Rails app and provides generators for creating features. Install RSpec 2 sudo gem install rspec-rails --pre [...]]]></description> <content:encoded><![CDATA[<p>This quick how-to runs through creating a new Rails 3 application with both RSpec and Cucumber for testing (rather than Test::Unit).</p><p>Rails 3 requires (the somewhat confusingly versioned) <a
href="http://rspec.info/">RSpec 2</a> and <a
href="http://github.com/rspec/rspec-rails">rspec-rails</a>. Similarly, Cucumber uses <a
href="http://github.com/aslakhellesoy/cucumber-rails">cucumber-rails</a> for bootstrapping your Rails app and provides generators for creating features.</p><h2>Install RSpec 2</h2><pre><code>sudo gem install rspec-rails --pre</code></pre><h2>Install Cucumber</h2><pre><code>sudo gem install cucumber-rails</code></pre><h2>Create a new Rails 3 application</h2><p>Ensure you have the latest version of Rails 3 installed then create a new application, skipping creation of the test directory since we&#8217;ll be using RSpec and Cucumber (with spec and features) instead.</p><pre><code>rails new <app-name> --skip-testunit</code></pre><p>Add <code>rspec-rails</code> to the <code>:test</code> and <code>:development</code> groups to the Gemfile.</p><pre><code>group :test, :development do
    gem 'rspec-rails', '>= 2.0.0.beta.22'
end</code></pre><p>Add <code>cucumber-rails</code> and dependencies to the <code>:cucumber</code> group in the Gemfile:</p><pre><code>group :cucumber do
    gem 'capybara'
    gem 'database_cleaner'
    gem 'cucumber-rails'
    gem 'cucumber'
    gem 'spork'
    gem 'launchy'
end</code></pre><p>Ensure all gems are installed by using Bundler:</p><pre><code>sudo bundle install</code></pre><p>Then install the RSpec extensions (creates the <code>spec</code> directory and creates a rake task):</p><pre><code>rails generate rspec:install</code></pre><p>Now we can specify that Rails itself uses RSpec when running generators by adding the following inside config/applicaton.rb:</p><pre><code>config.generators do |g|
  g.test_framework :rspec
end</code></pre><p>Next, bootstrap your Rails app, for Cucumber:</p><pre><code>rails generate cucumber:install --rspec --capybara</code></pre><p>That&#8217;s it! Now the following rake tasks exist to execute your specs or cucumber features (by default <code>rake</code> will execute both).</p><pre><code>rake spec
rake cucumber</code></pre><img src="http://feeds.feedburner.com/~r/slashdotdash/~4/1DGhjR4B8EY" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.slashdotdash.net/2010/09/27/rails-3-rspec-and-cucumber-setup/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Rails 3 scopes with chaining</title><link>http://www.slashdotdash.net/2010/09/25/rails-3-scopes-with-chaining/</link> <comments>http://www.slashdotdash.net/2010/09/25/rails-3-scopes-with-chaining/#comments</comments> <pubDate>Sat, 25 Sep 2010 12:33:30 +0000</pubDate> <dc:creator>Ben</dc:creator> <category><![CDATA[Ruby on Rails]]></category> <guid isPermaLink="false">http://www.slashdotdash.net/?p=1236</guid> <description><![CDATA[Here&#8217;s a quick gotcha you should be aware of when using the fantastic new scope facility in Rails 3 (formerly named_scope). Here&#8217;s a snippet that demonstrates how to chain scopes, allowing you to call Post.recent to get posts that have been published, ordered by date. class Post < ActiveRecord::Base scope :published, lambda { where('published_at IS [...]]]></description> <content:encoded><![CDATA[<p>Here&#8217;s a quick gotcha you should be aware of when using the <a
href="http://edgerails.info/articles/what-s-new-in-edge-rails/2010/02/23/the-skinny-on-scopes-formerly-named-scope/">fantastic new scope facility in Rails 3</a> (formerly named_scope).</p><p>Here&#8217;s a snippet that demonstrates how to chain scopes, allowing you to call <code>Post.recent</code> to get posts that have been published, ordered by date.</p><pre><code>class Post < ActiveRecord::Base
  scope :published, lambda { where('published_at IS NOT NULL AND published_at <= ?', Time.zone.now) }
  scope :recent, published.order(:published_at)
end</code></pre><p>However it contains a subtle bug; <strong>when chaining a lambda scope you must also wrap it with a lambda</strong> or else you will end up with the wrong result. The correct example is as follows.</p><pre><code>class Post < ActiveRecord::Base
  scope :published, lambda { where('published_at IS NOT NULL AND published_at <= ?', Time.zone.now) }
  scope :recent, lambda { published.order(:published_at) }
end</code></pre><p>José Valim explains the reason in the <a
href="https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4960">Rails ticket #4960</a>.</p><blockquote
cite="https://rails.lighthouseapp.com/projects/8994/tickets/4960-scopes-cached-in-production-mode"><pre><code>class Auction < ActiveRecord::Base
  scope :started, lambda { where("starting_at <= ?", Time.now) }
  scope :unfinished, lambda { where("ending_at > ?", Time.now) }
  scope :active, started.unfinished
end</code></pre><p>You can chain scopes, but they will be evaluated at the moment you call them.</p><p>That said, when you call started, it will execute the lambda, so it will have a frozen Time.now. In other words, chaining lambda scopes will likely give you the wrong result.</p><p>You need to wrap the scope :active in a lambda as well.</p><p><code>scope :active, lambda { started.unfinished }</code></p></blockquote> <img src="http://feeds.feedburner.com/~r/slashdotdash/~4/o6BBRkdwRvI" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.slashdotdash.net/2010/09/25/rails-3-scopes-with-chaining/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Ruby and Rails Magazines available to Buy or download</title><link>http://www.slashdotdash.net/2009/03/18/ruby-and-rails-magazines-available-to-buy-or-download/</link> <comments>http://www.slashdotdash.net/2009/03/18/ruby-and-rails-magazines-available-to-buy-or-download/#comments</comments> <pubDate>Wed, 18 Mar 2009 22:03:19 +0000</pubDate> <dc:creator>Ben</dc:creator> <category><![CDATA[Blog]]></category> <category><![CDATA[Ruby on Rails]]></category> <guid isPermaLink="false">http://www.slashdotdash.net/?p=1200</guid> <description><![CDATA[The thriving Ruby and Rails communities have produced a couple of magazines that you can buy (to show your support) or download PDF versions absolutely free. Rails Magazine &#8211; Issue 1 (1st March 2009) The Beginning; 36 pages of Rails goodness. Receiving E-Mail With Rails by Jason Seifer Delegation in Ruby by Khaled al Habache [...]]]></description> <content:encoded><![CDATA[<p>The thriving Ruby and Rails communities have produced a couple of magazines that you can buy (to show your support) or download PDF versions absolutely free.</p><p><img
src="http://www.slashdotdash.net/uploads/2009/03/rails_magazine_1-230x300.jpg" alt="" title="" width="230" height="300" class="alignright size-medium wp-image-1197" /></p><h2>Rails Magazine &#8211; Issue 1 (1st March 2009)</h2><p>The Beginning; 36 pages of Rails goodness.</p><ul><li>Receiving E-Mail With Rails by Jason Seifer</li><li>Delegation in Ruby by Khaled al Habache</li><li>Subscription billing with Saasy by Alex MacCaw</li><li>Making the Switch From RSpec to Shoulda by Dan Pickett</li><li>Playing Hooky a.k.a. web hooks by John Nunemaker</li><li>Adhearsion by Jason Goecke &#038; Jay Phillips</li><li>Rails Performance Analysis by Terry Heath</li><li>Getting Started with JRuby and JRuby on Rails by Joshua Moore</li><li>Extending Rails Through Plugins by John Yerhot</li></ul><p><a
href="http://magcloud.com/browse/Issue/7830">Buy Now</a> or <a
href="http://slashdotdash.net/uploads/2009/03/18/rails-magazine-issue1.pdf">Download</a> for free.</p><p><img
src="http://www.slashdotdash.net/uploads/2009/03/the_rubyist_august_2008-230x300.jpg" alt="the_rubyist_august_2008" title="the_rubyist_august_2008" width="230" height="300" class="alignleft size-medium wp-image-1199" /></p><h2>The Rubyist &#8211; Issue 1 (August 2008)</h2><blockquote><p>Hampton Catlin, Rein Henrichs, and friends in the first issue of the Rubyist. INSIDE: An interview with Rein Henrichs on Ruby best practices, an interview with Hampton Catlin about Jabl, columns from Giles Bowkett and Rein Henrichs, a Ruby quiz-esque challenge (you can win an iPhone! Yes, you!), building DataMapper adapters, Ben Scofield shares some techniques for auditing your code, using RubyOSA with Evan Light, Yehuda Katz waxes rhapsodic on performance measures in Merb, and learning about building gems with BDD from Jamie van Dyke!</p></blockquote><p><a
href="http://www.lulu.com/content/3396321">Buy Now</a> or <a
href="http://slashdotdash.net/uploads/2009/03/18/the_rubyist_issue_1.pdf">Download</a> for free.</p><p><br
style="clear:both;" /></p><p><img
src="http://www.slashdotdash.net/uploads/2009/03/the_rubyist_february_2009-230x300.jpg" alt="the_rubyist_february_2009" title="the_rubyist_february_2009" width="230" height="300" class="alignright size-medium wp-image-1198" /></p><h2>The Rubyist &#8211; Issue 2 (February 2009)</h2><ul><li>Regional conferences with Pat Eyler</li><li>Talking about the Rails merge with Zach Inglis, and interviews with DHH, Ted Han, and more</li><li>Scott Chacon drops some Git knowledge</li><li>Yehuda Katz discusses his journey from Rails to Merb to Rails</li><li>Martin Rehfeld shares his solution from last issue&#8217;s homework</li><li>Obie Fernandez talks about client managment</li><li>Aaron Quint spends some time with Sinatra</li><li>Evan David Light talks BDD</li><li>Ben Scofield talks about testing iPhone applications using Ruby</li><li>Eric Hodel talks about the next generation of RubyGems</li><li>Dennis Theisen teaches how to use ActiveMerchant</li><li>Carlo Pecchia shows off JRuby</li></li><p><a
href="http://www.lulu.com/content/6438917">Buy Now</a> or <a
href="http://slashdotdash.net/uploads/2009/03/18/the_rubyist_issue_2.pdf">Download</a> for free.</p> <img src="http://feeds.feedburner.com/~r/slashdotdash/~4/K1vY_l-bY2E" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.slashdotdash.net/2009/03/18/ruby-and-rails-magazines-available-to-buy-or-download/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Migrating this blog from Typo to WordPress</title><link>http://www.slashdotdash.net/2009/01/02/migrating-this-blog-from-typo-to-wordpress/</link> <comments>http://www.slashdotdash.net/2009/01/02/migrating-this-blog-from-typo-to-wordpress/#comments</comments> <pubDate>Fri, 02 Jan 2009 14:50:39 +0000</pubDate> <dc:creator>Ben</dc:creator> <category><![CDATA[Blog]]></category> <category><![CDATA[Typo]]></category> <guid isPermaLink="false">http://www.slashdotdash.net/?p=1171</guid> <description><![CDATA[After recently installing Phusion Passenger under Apache 2 to host my Rails apps I wanted to give Ruby Enterprise Edition a go. However as I was running an old version of Typo (version 4.x) which didn&#8217;t seem to like running under REE I decided to migrate to WordPress; upgrading Typo would be just as much [...]]]></description> <content:encoded><![CDATA[<p>After recently installing <a
href="http://www.modrails.com/">Phusion Passenger</a> under Apache 2 to host my Rails apps I wanted to give <a
href="http://www.rubyenterpriseedition.com/">Ruby Enterprise Edition</a> a go. However as I was running an old version of Typo (version 4.x) which didn&#8217;t seem to like running under REE I decided to migrate to WordPress; upgrading Typo would be just as much work. </p><p>There&#8217;s already a <a
href="http://snippets.dzone.com/posts/show/4326">Ruby upgrade script </a>to create a WordPress compatible WXR file for importing which includes all posts, comments and categories from Typo. I needed to <a
href="http://pastie.org/350548">modify the Ruby script</a> slightly to get working with the version of Typo I had installed.</p><h2>Exporting Typo blog content to WordPress WXR</h2><p>The Ruby script needs to be placed into the script directory of the Typo application root and then run under the production Rails environment:</p><pre><code>RAILS_ENV=production ruby script/wp_export.rb &gt; blog.wxr</code></pre><h2>Installing WordPress</h2><p>Simply <a
href="http://codex.wordpress.org/Installing_WordPress">follow the basic WordPress install guide</a> after <a
href="http://wordpress.org/latest.zip">downloading the latest software</a> (version 2.7 at the time of writing). The pre-requisites for WordPress are PHP 4.3 or newer and MySQL 4.0 or greater.</p><h2>Import existing content</h2><p>Once WordPress is installed, log in to the admin section and select <strong>Import</strong> from the <strong>Tools</strong> menu. Choose the <strong>WordPress</strong> option from the list  (<em>Import posts, pages, comments, custom fields, categories, and tags from a WordPress export file</em>). You&#8217;ll need to select the blog.wxr file created by the Ruby script and then click <strong>Upload file and import</strong>. That should recreate your existing Typo blog content (and comments), you may be asked to map the Typo user(s) to WordPress accounts.</p><p>With the content installed, the final change required is to setup the <strong>Permalink Settings</strong> from <strong>Settings</strong> &gt; <strong>Permalinks</strong>.  Select the <strong>Day and name</strong> option (giving URLs such as http://www.slashdotdash.net/2009/01/02/sample-post/).  You may need to manually edit or create the .htaccess file to get the rewrite rules working.</p><pre><code># .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule></code></pre><p>With this working you should find that the standard Typo permalinks (such as http://www.slashdotdash.net/articles/2009/01/02/sample-post/) will now redirect to the corresponding WordPress blog entry, ensuring no broken links when switching from Typo to WordPress.</p><h2>Known Issues</h2><p>You&#8217;ll probably have a problem with RSS feed readers creating duplicates of the last 10 posts (depending upon your &#8220;Syndication feeds show the most recent&#8221; settings) since the post URLs and GUIDs will have changed.</p> <img src="http://feeds.feedburner.com/~r/slashdotdash/~4/XVLoaQHbE7c" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.slashdotdash.net/2009/01/02/migrating-this-blog-from-typo-to-wordpress/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Easy Merb installation using Thor</title><link>http://www.slashdotdash.net/2008/09/20/easy-merb-installation-using-thor/</link> <comments>http://www.slashdotdash.net/2008/09/20/easy-merb-installation-using-thor/#comments</comments> <pubDate>Sat, 20 Sep 2008 00:42:00 +0000</pubDate> <dc:creator>Ben</dc:creator> <category><![CDATA[Merb]]></category> <guid isPermaLink="false" /> <description><![CDATA[There&#8217;s now a much simpler way to get Merb setup than I previously noted. By using Thor, either the Stable (Gem) or Edge releases of Merb can be installed as a local Ruby Gem or bundled with your Merb app. The thor tasks are context aware. Run them in a Merb application directory and they&#8217;ll [...]]]></description> <content:encoded><![CDATA[<p>There&#8217;s now a much simpler way to get Merb setup than I <a
href="http://www.slashdotdash.net/articles/2008/07/05/getting-started-with-merb-and-datamapper">previously noted</a>. By using <a
href="http://yehudakatz.com/2008/05/12/by-thors-hammer/">Thor</a>, either the Stable (Gem) or Edge releases of Merb can be installed as a local Ruby Gem or bundled with your Merb app.</p><p>The <code>thor</code> tasks are <em>context aware</em>. Run them in a Merb application directory and they&#8217;ll bundle the relevant files with your app; keeping dependencies with the application and making it independent of your system’s Ruby Gems. When run outside any application, they target the system in general (installing as a standard Gem). This is determined by the presence of a local <code>gems</code> directory (or by specifying the <code>--merb-root</code> option).</p><h2>Installing Edge Merb and DataMapper</h2><pre><code>mkdir merb; cd merb
# Install Thor
sudo gem install thor
# Get merb.thor file (or update existing file)
curl -L http://merbivore.com/merb.thor &gt; merb.thor
thor merb:tasks:update
# Merb (edge)
sudo thor merb:edge:core --install
sudo thor merb:edge:more --install
sudo thor merb:edge:plugins --install
# DataMapper
sudo thor merb:edge:dm_core --install
sudo thor merb:edge:dm_more --install</code></pre><p>Keeping updated with the latest Merb (<code>merb-core</code> and <code>merb-more</code> only) is now simply:</p><pre><code>sudo thor merb:edge --install</code></pre><p>Further details are given on the <a
href="http://merbunity.com/tutorials/18">merbunity site</a>.</p> <img src="http://feeds.feedburner.com/~r/slashdotdash/~4/Li-5uoPirHg" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.slashdotdash.net/2008/09/20/easy-merb-installation-using-thor/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Getting started with Merb and Datamapper</title><link>http://www.slashdotdash.net/2008/07/05/getting-started-with-merb-and-datamapper/</link> <comments>http://www.slashdotdash.net/2008/07/05/getting-started-with-merb-and-datamapper/#comments</comments> <pubDate>Sat, 05 Jul 2008 23:46:00 +0000</pubDate> <dc:creator>Ben</dc:creator> <category><![CDATA[Merb]]></category> <guid isPermaLink="false" /> <description><![CDATA[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 [...]]]></description> <content:encoded><![CDATA[<p>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.</p><p><strong>Update</strong>: There&#8217;s now a <a
href="http://www.slashdotdash.net/articles/2008/09/20/easy-merb-installation-using-thor">much easier way of getting Merb &#38; DataMapper installed</a>.</p><p>The <a
href="http://www.merbivore.com/">official Merb website</a> gives the following simple installation instructions.</p><pre><code>sudo gem install merb</code></pre><p>However, since I wanted to also try DataMapper as the <span
class="caps">ORM</span> those instructions failed to install a working setup due to a <a
href="http://wm.lighthouseapp.com/projects/4819/tickets/440-merb_datamapper-is-out-of-date-version-mismatch-with-dm-more">conflict between Merb and DataMapper dependencies</a>. Unperturbed, I finally got them both installed and working happily together by getting the bleeding edge code from each project&#8217;s github repository and following the instructions provided by Mathew Ford&#8217;s <a
href="http://4ninjas.org/merb/">Living life on the edge</a>. The book is also available on <a
href="http://github.com/deimos1986/book_mdar/tree/master">github</a>, you can contribute patches there. Hopefully this issue will be resolved soon enough so that you&#8217;ll be able to install the official release gems for both Merb and DataMapper from Rubyforge (instead of running on edge).</p><h3>Prerequisites</h3><ul><li>You must have git installed (<code>sudo port install git-core</code> using MacPorts on <span
class="caps">OS X</span>).</li><li>Remove any older versions of merb (and datamapper) that you might have installed. Use <code>gem list</code> to view local gems and <code>sudo gem uninstall &lt;name&gt;</code> to remove each individual gem.</li></ul><h2>The Easy Way</h2><p>Matt&#8217;s book outlines an <em>easy way</em> of installing the latest merb &#38; datamapper source, however it failed to properly install the DataMapper gem for me so I had to resort to the <em>hardcore</em> approach.</p><pre><code>sudo gem install sake
sake -i 'http://edgy.4ninjas.org/edgy.sake'
sake edgy:install packages="merb-stack"</code></pre><p>After installing, to keep up-to-date you just need to execute:</p><pre><code>sake edgy:update</code></pre><p>Now, if you&#8217;re hardcore&#8230;</p><h3>Installing the required dependencies</h3><p>Start by installing the gem dependancies.</p><pre><code>sudo gem install rack mongrel json erubis mime-types rspec hpricot mocha rubigen haml markaby mailfactory ruby2ruby</code></pre><h2>Installing Merb</h2><p>Download the merb source:</p><pre><code>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</pre><p></code></p><p>Then install the gems via rake:</p><pre><code>cd merb-core ; rake install ; cd ..
cd merb-more ; rake install ; cd ..
cd merb-plugins; rake install ; cd ..</pre><p></code></p><h2>Installing DataMapper</h2><pre><code>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 ..</pre><p></code></p><h3>Keeping updated</h3><p>To update your local gems with the latest code changes you&#8217;ll need to do a <code>git pull</code> and then <code>rake install</code> for each of the git repositories previously downloaded.</p><h2>Creating your first Merb app</h2><p>You create a new empty Merb app via the <code>merb-gen</code> utility.</p><pre><code>merb-gen app demo</pre><p></code></p><p>(You can also create flattened or single file applications if you wish).</p><pre><code>merb-gen app app_name --flat      (for a flattened application)
merb-gen app app_name --very-flat (for a single file application)</code></pre><p>As we&#8217;re using DataMapper we need to edit <code>config/init.rb</code> and uncomment the <code>use_orm :datamapper</code> line. The next step is to create the database settings file <code>config/database.yml</code>:</p><pre><code>---
development: &#38;defaults
  adapter:    mysql
  database:   demo_development
  username:   demo
  password:        p@ssword
  host:       localhost
test:
  &lt;&lt;:         *defaults
  database:   demo_test
production:
  &lt;&lt;:         *defaults
  database:   demo_production</code></pre><p>You can now fire up the Merb server to make sure it runs.</p><pre><code>$ 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</code></pre><p>Some other useful commands to know:</p><pre><code>merb -i                                                        # Interactive merb console
merb-gen model &lt;name&gt;                            # Creates a Datamapper Model stub
merb-gen resource &lt;name&gt;                    # Creates a full resource (incuding model, controller, views &#38; test spec)
rake dm:db:automigrate            # Perform automigration
rake dm:db:autoupgrade            # Perform non destructive automigration</code></pre><p>Let&#8217;s see how it goes from here with Merb!</p><p><strong>Update</strong>: There&#8217;s now a <a
href="http://www.slashdotdash.net/articles/2008/09/20/easy-merb-installation-using-thor">much easier way of getting Merb &#38; DataMapper installed</a>.</p> <img src="http://feeds.feedburner.com/~r/slashdotdash/~4/2x2xwCZcL8U" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.slashdotdash.net/2008/07/05/getting-started-with-merb-and-datamapper/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Lifestreaming – combining your online activity into a single stream (using trawlr)</title><link>http://www.slashdotdash.net/2008/03/12/lifestreaming-combining-your-online-activity-into-a-single-stream-using-trawlr/</link> <comments>http://www.slashdotdash.net/2008/03/12/lifestreaming-combining-your-online-activity-into-a-single-stream-using-trawlr/#comments</comments> <pubDate>Wed, 12 Mar 2008 01:07:00 +0000</pubDate> <dc:creator>Ben</dc:creator> <category><![CDATA[Uncategorized]]></category> <guid isPermaLink="false" /> <description><![CDATA[It&#8217;s been a year since I last mentioned trawlr on this blog at which point I promised no further status updates here. Well I&#8217;m going to just pretend I didn&#8217;t say that for now as I wanted to get some feedback (and usage) on the latest feature I&#8217;ve been working on. Streaming your life away [...]]]></description> <content:encoded><![CDATA[<p>It&#8217;s been <a
href="http://www.slashdotdash.net/articles/2007/03/09/last-update-on-trawlr-com-until-the-next-time">a year since I last mentioned</a> <a
href="http://www.trawlr.com/">trawlr</a> on this blog at which point I promised no further status updates here. Well I&#8217;m going to just pretend I didn&#8217;t say that for now as I wanted to get some feedback (and usage) on the latest feature I&#8217;ve been working on.</p><h2>Streaming your life away</h2><p>It&#8217;s support for <em>&#8220;lifestreaming&#8221;</em> &#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.</p><p>The inspiration for this feature came from a <a
href="http://adactio.com/journal/1202/">blog post by Jeremy Keith</a> (hence the title) so props to him for the idea.</p><p>Lifestreaming is like Twitter, but covers everything you do online that is publicly available and has an <span
class="caps">RSS</span> feed. Currently there&#8217;s support for Delicious, Flickr, Twitter, Upcoming, Last.fm, your own blog feed (RSS) and any other site that provides an <span
class="caps">RSS</span> feed.</p><p
style="float:right"><a
href="http://www.slashdotdash.net/images/lifestream.png"><img
src="http://www.slashdotdash.net/images/lifestream-small.png" alt="" /></a></p><p>You can see an example of <a
href="http://www.trawlr.com/users/ben/lifestream">my lifestream</a> in the screen shot. If you already have a <a
href="http://www.trawlr.com/">trawlr.com</a> account then why not give it a whirl and create your own lifestream. Don&#8217;t have an account yet? <a
href="http://www.trawlr.com/signup">Registration</a> is quick &#38; simple (with no email activation required) and once you&#8217;ve tried out the lifestreaming, you might also be interested in the main <span
class="caps">RSS</span> reader.</p><p>Once you&#8217;ve created your lifestream, it&#8217;ll be automatically updated throughout the day.</p><p>Let me know if you can think of any important sources I&#8217;ve missed, such as; YouTube, Picassa, SmugMug, FaceBook, MySpace, Google Reader shared items, Digg (dugg by) and Reddit (activity).</p><p>I&#8217;m planning to create a &#8220;widget&#8221; version of the lifestream so that it may be embedded within your own blog or website, allowing customisation of the display</p> <img src="http://feeds.feedburner.com/~r/slashdotdash/~4/MNFxuMLgu40" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.slashdotdash.net/2008/03/12/lifestreaming-combining-your-online-activity-into-a-single-stream-using-trawlr/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Sphinx search with delta indexing thanks to Ultrasphinx</title><link>http://www.slashdotdash.net/2008/03/09/sphinx-search-with-delta-indexing-thanks-to-ultrasphinx/</link> <comments>http://www.slashdotdash.net/2008/03/09/sphinx-search-with-delta-indexing-thanks-to-ultrasphinx/#comments</comments> <pubDate>Sun, 09 Mar 2008 13:58:00 +0000</pubDate> <dc:creator>Ben</dc:creator> <category><![CDATA[Ruby on Rails]]></category> <guid isPermaLink="false" /> <description><![CDATA[Evan Weaver has just announced delta indexing support for his UltraSphinx Rails plugin. Delta indexing speeds up your updates by not reindexing the entire dataset every time. 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 [...]]]></description> <content:encoded><![CDATA[<p>Evan Weaver has <a
href="http://blog.evanweaver.com/articles/2008/03/08/delta-indexing-support-in-ultrasphinx/">just announced delta indexing support</a> for his UltraSphinx Rails plugin.</p><blockquote><p>Delta indexing speeds up your updates by not reindexing the entire dataset every time.</p><p>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:</p><p><code>delta = &lt;%= 1.day + 30.minutes %&gt;</code></p><p>Now, configure your models for delta indexing in the is_indexed call:</p><p><code>is_indexed :fields =&gt; ['created_at', 'title', 'body'], :delta =&gt; true</code></p><p>Now you can run <code>rake ultrasphinx:index:delta</code> 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.</p></blockquote><p>From the <a
href="http://blog.evanweaver.com/files/doc/fauna/ultrasphinx/files/README.html">UltraSphinx documentation</a>.</p><p>I&#8217;ve previously written about how fast Sphinx search is in <a
href="http://www.slashdotdash.net/articles/2007/08/06/rails-searching-with-sphinx">Rails searching with Sphinx</a> using the <code>acts_as_sphinx</code> plugin (and also contributed a chapter to the Advanced Rails Recipes book using the UltraSphinx plugin). I&#8217;d now recommend using the UltraSphinx plugin if you want to take advantage of Sphinx for your Rails application.</p><p>In my opinion, this completes the &#8216;missing&#8217; piece of functionality and should make Sphinx your default full-text search engine (if you&#8217;re using MySQL).</p> <img src="http://feeds.feedburner.com/~r/slashdotdash/~4/PHNe44MccW0" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.slashdotdash.net/2008/03/09/sphinx-search-with-delta-indexing-thanks-to-ultrasphinx/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Pimp my MacBook Pro</title><link>http://www.slashdotdash.net/2008/03/08/pimp-my-macbook-pro/</link> <comments>http://www.slashdotdash.net/2008/03/08/pimp-my-macbook-pro/#comments</comments> <pubDate>Sat, 08 Mar 2008 20:19:00 +0000</pubDate> <dc:creator>Ben</dc:creator> <category><![CDATA[Apple]]></category> <guid isPermaLink="false" /> <description><![CDATA[Thanks to the increasing prevalence of Apple laptops &#8211; including the MacBook, MacBook Pro and new Air &#8211; having a Mac no longer makes you l33t! To combat this, a couple weeks ago I decided to pimp my MacBook Pro by changing the illuminated Apple logo on the case. A Canadian site sells a multitude [...]]]></description> <content:encoded><![CDATA[<p
style="float:right"><a
href="http://www.slashdotdash.net/images/pimp1.jpg"><img
src="http://www.slashdotdash.net/images/pimp1p.jpg" alt="" /></a></p><p>Thanks to the increasing prevalence of Apple laptops &#8211; including the MacBook, MacBook Pro and new Air &#8211; having a Mac no longer makes you <em>l33t</em>!  To combat this, a couple weeks ago I decided to <em>pimp my MacBook Pro</em> by changing the illuminated Apple logo on the case. A <a
href="http://www.icolours.ca/">Canadian site</a> sells a multitude of inserts that can be used to <a
href="http://www.icolours.ca/gallery.html">alter the logo</a>.</p><blockquote><p>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</p></blockquote><p
style="float:left"><a
href="http://www.slashdotdash.net/images/pimp3.jpg"><img
src="http://www.slashdotdash.net/images/pimp3p.jpg" alt="" /></a></p><p
style="float:right"><a
href="http://www.slashdotdash.net/images/pimp2.jpg"><img
src="http://www.slashdotdash.net/images/pimp2p.jpg" alt="" /></a></p><p>The <a
href="http://www.icolours.ca/installation.html">installation guide</a> steps you through the process, the MacBook Pro is rated as &#8220;Medium&#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!</p><p>I went for the &#8216;Rainbow&#8217; design &#8211; one of the <a
href="http://apple2history.org/history/ah04.html">original Apple logos</a> &#8211; the end result is rather pleasant update to the plain white logo and it still glows in the dark.</p> <img src="http://feeds.feedburner.com/~r/slashdotdash/~4/Ycl-MFtGCo0" height="1" width="1"/>]]></content:encoded> <wfw:commentRss>http://www.slashdotdash.net/2008/03/08/pimp-my-macbook-pro/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> </channel> </rss><!-- Dynamic page generated in 0.398 seconds. --><!-- Cached page generated by WP-Super-Cache on 2012-05-04 19:24:00 -->

