<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><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>Dr Nic</title>
	
	<link>http://drnicwilliams.com</link>
	<description>Ruby makes Rails, Javascript makes Ajax, Dr Nic makes Magic</description>
	<lastBuildDate>Sat, 07 Nov 2009 20:35:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/DrNic" type="application/rss+xml" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">DrNic</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Hacking someone’s gem with github and gemcutter</title>
		<link>http://drnicwilliams.com/2009/11/04/hacking-someones-gem-with-github-and-gemcutter/</link>
		<comments>http://drnicwilliams.com/2009/11/04/hacking-someones-gem-with-github-and-gemcutter/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 06:44:17 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Gems]]></category>
		<category><![CDATA[Mocra]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=635</guid>
		<description><![CDATA[
Ever used a rubygem, found a bug, and just wanted to quickly bust out the big guns and fix it quickly?
The gem command doesn&#8217;t come packed with a way to find the original source repository for a gem. At best, most gems at least come bundled with the complete source, tests and documentation. Some gems [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2008/12/21/migrating-project-websites-to-github-pages-with-sake-tasks-new-websites-with-jekyll_generator/' rel='bookmark' title='Permanent Link: Migrating project websites to github pages with sake tasks, new websites with jekyll_generator'>Migrating project websites to github pages with sake tasks, new websites with jekyll_generator</a> <small> Its almost Christmas time and that means presents. It...</small></li><li><a href='http://drnicwilliams.com/2008/10/31/newgem-100-all-thanks-to-cucumber/' rel='bookmark' title='Permanent Link: newgem 1.0.0 all thanks to Cucumber'>newgem 1.0.0 all thanks to Cucumber</a> <small>The New Gem Generator (newgem) was exciting, moderately revolutionary, and...</small></li><li><a href='http://drnicwilliams.com/2008/08/19/my-attempt-at-sake-task-management/' rel='bookmark' title='Permanent Link: My attempt at sake task management'>My attempt at sake task management</a> <small> I&#8217;ve used sake intermittently in my workflow. It competes...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p><img src="http://img.skitch.com/20091104-fthwimr335wsm3rfgad9a7jh5k.jpg" alt="gemcutter" style="float: right"/></p>
<p>Ever used a rubygem, found a bug, and just wanted to quickly bust out the big guns and fix it quickly?</p>
<p>The <code>gem</code> command doesn&#8217;t come packed with a way to find the original source repository for a gem. At best, most gems at least come bundled with the complete source, tests and documentation. Some gems <a href="http://github.com/notahat/machinist/issues#issue/14">don&#8217;t</a>. Fair enough, since having access to the complete source via the gem still doesn&#8217;t allow you to fix a bug and share it with the world.</p>
<p>For that you access to the repo, a quick way to fork it, and a post-github way to share a gem version from yours truly.</p>
<p>The <code>github</code> gem and gemcutter are the modern day tools of master hackermanship.</p>
<h1 id="instant_forking_fun">Instant forking fun</h1>
<p>Let&#8217;s say you find a bug in a gem, say <code>rails</code>, and you want to go to town on its source.</p>
<p>You know the gem is called <code>rails</code> but you&#8217;ve no idea what the github repo is called. Never fear. </p>
<pre><code>$ sudo gem install drnic-github
$ gh clone --search rails
Select a repository to clone:
1.  rails/rails                         # Ruby on Rails
2.  technoweenie/restful-authentication # Generates common user ...
3.  justinfrench/formtastic             # A Rails form builder plugin ...
?
</code></pre>
<p>Press <code>1</code> and you&#8217;ll get a clone of <code>rails/rails</code>.</p>
<p>Alternately, if you want a fork or you know the exact user/repo already:</p>
<pre><code>$ gh clone rails/rails
</code></pre>
<p>Now, fork your own version:</p>
<pre><code>$ cd rails
$ gh fork
</code></pre>
<p>You now have your own fork. The <code>origin</code> remote also now points to your fork rather than the <code>rails/rails</code> repository:</p>
<pre><code>$ git remote show origin
* remote origin
  Fetch URL: git@github.com:drnic/rails.git
  Push  URL: git@github.com:drnic/rails.git
</code></pre>
<p>So, make your changes, push them. Send a pull request or github issue or lighthouse ticket or what have you.</p>
<p>Want to get to the github project home page for your fork?</p>
<pre><code>$ gh home
</code></pre>
<h1 id="instant_gem_sharing">Instant gem sharing</h1>
<p>Let&#8217;s say you patched the <code>rails</code> gem <a href="http://github.com/drnic/rails/commit/3c26910cfd5aa4b484d63e912b3881c31f19782a">itself</a> but you want to share your changes via your own gem.</p>
<p>In the olden days, github did this for you. Now you use <a href="http://gemcutter.org/">gemcutter</a>, and a little manual effort to do your own renaming.</p>
<p>First, install the gems locally, use them, and make sure all is good.</p>
<p>For rails, you install the edge gems (3.0.pre) with:</p>
<pre><code>$ rake install
</code></pre>
<p>You can&#8217;t see &#8216;rake install&#8217; in the <code>rake -T</code> list (hence my patch), but I think the following expression displays all tasks regardless if they have a description or not:</p>
<pre><code>$ rake -P | grep "^r"
</code></pre>
<p>Rails is composed of several gems, unlike most projects that are distributed as a single gem. Here we want to share our commit within a new <code>drnic-rails</code> gem, but not touch the others.</p>
<p>Edit the <code>railties/rails.gemspec</code> file from:</p>
<pre><code>Gem::Specification.new do |s|
  s.platform = Gem::Platform::RUBY
  s.name = 'rails'
  s.version = '3.0.pre'
...
</code></pre>
<p>and give your personal gem a new name:</p>
<pre><code>Gem::Specification.new do |s|
  s.platform = Gem::Platform::RUBY
  s.name = 'drnic-rails'
  s.version = '3.0.pre'
</code></pre>
<p>To build and distribute the new gem:</p>
<pre><code>$ gem build railties/rails.gemspec
$ sudo gem install gemcutter
$ gem push drnic-rails-3.0.pre.gem
  Pushing gem to Gemcutter...
  Successfully registered gem: drnic-rails (3.0.pre)
</code></pre>
<p>Follow any first-time gemcutter instructions and SUCCESS! Now I have my own <a href="http://gemcutter.org/gems/drnic-rails">drnic-rails</a> gem.</p>
<h1 id="summary">Summary</h1>
<p>To find, clone, and fork any rubygem that is hosted on github:</p>
<pre><code>$ sudo gem install drnic-github
$ gh clone --search rails
$ gh fork
</code></pre>
<p>To personalise the gem and share it on gemcutter:</p>
<pre><code>&gt; edit the project.gemspec to have a unique name, e.g. yourname-project
$ gem build project.gemspec
$ sudo gem install gemcutter
$ gem push yourname-project-1.0.0.gem
</code></pre>
<p>I think this makes it much easier, faster and more fun to hack other people&#8217;s stuff.</p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2008/12/21/migrating-project-websites-to-github-pages-with-sake-tasks-new-websites-with-jekyll_generator/' rel='bookmark' title='Permanent Link: Migrating project websites to github pages with sake tasks, new websites with jekyll_generator'>Migrating project websites to github pages with sake tasks, new websites with jekyll_generator</a> <small> Its almost Christmas time and that means presents. It...</small></li><li><a href='http://drnicwilliams.com/2008/10/31/newgem-100-all-thanks-to-cucumber/' rel='bookmark' title='Permanent Link: newgem 1.0.0 all thanks to Cucumber'>newgem 1.0.0 all thanks to Cucumber</a> <small>The New Gem Generator (newgem) was exciting, moderately revolutionary, and...</small></li><li><a href='http://drnicwilliams.com/2008/08/19/my-attempt-at-sake-task-management/' rel='bookmark' title='Permanent Link: My attempt at sake task management'>My attempt at sake task management</a> <small> I&#8217;ve used sake intermittently in my workflow. It competes...</small></li></ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DrNic?a=4I-bA7HLVnI:sxe5lERmsYk:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/DrNic?i=4I-bA7HLVnI:sxe5lERmsYk:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=4I-bA7HLVnI:sxe5lERmsYk:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/DrNic?i=4I-bA7HLVnI:sxe5lERmsYk:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=4I-bA7HLVnI:sxe5lERmsYk:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/DrNic?i=4I-bA7HLVnI:sxe5lERmsYk:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2009/11/04/hacking-someones-gem-with-github-and-gemcutter/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>First look at rails 3.0.pre</title>
		<link>http://drnicwilliams.com/2009/11/03/first-look-at-rails-3-0-pre/</link>
		<comments>http://drnicwilliams.com/2009/11/03/first-look-at-rails-3-0-pre/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 04:05:16 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Mocra]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=630</guid>
		<description><![CDATA[
This article is out of date in some aspects. See comments.


Today I had my first look at rails 3.0.pre and below are the sequence of steps I had to take to create a rails 3.0.pre application, and get it&#8217;s generators to work.
Why was I looking at the top-secret, yet open-source Rails 3.0? Their generators are [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2009/10/07/rails-themes-can-remember-things/' rel='bookmark' title='Permanent Link: Rails themes can remember things'>Rails themes can remember things</a> <small>I was getting annoyed at having to remember all the...</small></li><li><a href='http://drnicwilliams.com/2009/10/06/install-any-html-themetemplate-into-your-rails-app/' rel='bookmark' title='Permanent Link: Install any HTML theme/template into your Rails app'>Install any HTML theme/template into your Rails app</a> <small> Have you ever even bothered to Google for &#8220;rails...</small></li><li><a href='http://drnicwilliams.com/2009/03/30/closing-in-on-the-dream-one-click-to-deploy-rails-apps/' rel='bookmark' title='Permanent Link: Closing in on The Dream: &#8220;one-click-to-deploy Rails apps&#8221;'>Closing in on The Dream: &#8220;one-click-to-deploy Rails apps&#8221;</a> <small> Got a simple app you want to build? Allocate...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<div class="notice">
<p>This article is out of date in some aspects. See <a href="http://drnicwilliams.com/2009/11/03/first-look-at-rails-3-0-pre/#comments">comments</a>.</p>
</div>
<p><img src="http://img.skitch.com/20091103-q3w8qjy8wmr3e9wasjqc95nf6g.jpg" alt="3.pre" style="float: right" /></p>
<p>Today I had my first look at rails 3.0.pre and below are the sequence of steps I had to take to create a rails 3.0.pre application, and get it&#8217;s generators to work.</p>
<p>Why was I looking at the top-secret, yet open-source Rails 3.0? Their generators are being migrated over to Thor and I wanted to see them in action. I was thinking I might migrate newgem to use Thor too.</p>
<p>Here&#8217;s a quick poke around of getting started and interesting things I found. Any hiccups and workarounds are meant as a guide to pre-pre-3.0 users/developers and not as a criticism of rails-core. Rails 3.0 is looking shiny and awesome.</p>
<p>NOTE: Since this is a &#8220;how to install and use&#8221; rails 3.0 edge, which is still in heavy development, this set of instructions might break. Let&#8217;s hope not.</p>
<h2 id="getting_started">Getting Started</h2>
<p>As of today, you cannot install 3.0.pre from rubygems [1]. So, let&#8217;s install them from source. Which is handy, you might like to patch something.</p>
<pre><code>$ cd ~/gems
$ git clone git://github.com/rails/rails.git
use_ruby_191 *
</code></pre>
<p>[*] If you are on OS X Snow Leopard I think you can ignore this. Otherwise, since you don&#8217;t have the 3.0.pre gems installed, you&#8217;re about to hit bump #1. Ruby 1.8.6 doesn&#8217;t have <code>Symbol#to_proc</code> but it&#8217;s required to create a rails app. This means you&#8217;ll need to be able to switch to another version of ruby temporarily if you&#8217;re on ruby 1.8.6 [2].</p>
<pre><code>cd ~/Sites
ruby ~/gems/rails/railties/bin/rails
</code></pre>
<p>Oooh, look at all the new options! Some new ones are:</p>
<pre><code>-F, [--freeze]             # Freeze Rails in vendor/rails from the gems
-O, [--skip-activerecord]  # Skip ActiveRecord files
-T, [--skip-testunit]      # Skip TestUnit files
-J, [--skip-prototype]     # Skip Prototype files
</code></pre>
<p>The <code>-D, --with-dispatchers</code> flags have been removed. <code>--freeze</code> isn&#8217;t new, but <code>-F</code> is.</p>
<p>So, to create an app, I dutifully used:</p>
<pre><code>ruby ~/gems/rails/railties/bin/rails edgerailsapp -F
</code></pre>
<p>BAM! Fail. The -F option to freeze/vendor rails fails without the gems installed. So don&#8217;t use it.</p>
<pre><code>ruby ~/gems/rails/railties/bin/rails edgerailsapp
ln -s ~/gems/rails vendor/rails
</code></pre>
<p>If you&#8217;re on Windows without the symlink command <code>ln</code>, then copy the downloaded rails source into <code>vendor/rails</code>.</p>
<h3 id="fetch_rails8217_dependencies">Fetch Rails&#8217; dependencies</h3>
<p>Rails 3.0 source uses the new bundler project to describe its own dependencies. From <a href="http://litanyagainstfear.com/blog/2009/10/14/gem-bundler-is-the-future/">Nick Quaranto&#8217;s article on bundler</a>, get the latest:</p>
<pre><code>cd ~/gems
git clone git://github.com/wycats/bundler
cd bundler
sudo rake install
</code></pre>
<p>Now, back in your app, you need to install some rails dependencies here too. It&#8217;s a good chance to see how you&#8217;ll bundle gem dependencies in the future.</p>
<pre><code>$ cd ~/Sites/edgerailsapp
</code></pre>
<p>Change the <code>Gemfile</code> in your project to the following:</p>
<pre><code>gem "rack",          "1.0.1"
gem "rack-mount",    :git =&gt; "git://github.com/rails/rack-mount.git"
gem "rack-test",     "~&gt; 0.5.0"
gem "erubis",        "~&gt; 2.6.0"
gem "arel",          :git =&gt; "git://github.com/rails/arel.git"
gem "sqlite3-ruby"
gem "rails", "3.0.pre", :git =&gt; "git://github.com/rails/rails.git"
</code></pre>
<p>Welcome to the future of gem dependencies for rails apps. Ultimately you won&#8217;t need to manually add these lines yourself. When rails is distributed as gems it will automatically install these for you, I assume/hope/guess. But for today, you seem to need them.</p>
<p>Now locally (within your app) install these gems:</p>
<pre><code>$ gem bundle
</code></pre>
<p>If you get &#8220;can&#8217;t convert Pathname into String&#8221; then revert to ruby 1.8.X and reinstall bundler into your 1.8 gem cache.</p>
<p>Phew. Ooh, my god. Phew. Only now will <code>script/generate</code> work.</p>
<pre><code>$ script/generate
</code></pre>
<p>For me, this outputs:</p>
<pre><code>Please select a generator.
Builtin: app, controller, generator, helper, integration_test, mailer, metal, migration, model, model_subclass, observer, performance_test, plugin, resource, scaffold, scaffold_controller, session_migration, stylesheets.
Others: app_layout:app_layout, check_migration_version:check_migration_version, home_route:home_route.
</code></pre>
<p>The &#8220;Builtin&#8221; generators are the latest and greatest in Thor technology. Rails 3.0 no longer uses its own generator but is built upon Thor.</p>
<p>For example, our old favourite <code>model</code> generator works thusly:</p>
<pre><code>$ script/generate model Post title:string --no-fixture
    invoke  active_record
    create    db/migrate/20091103030824_create_posts.rb
    create    app/models/post.rb
    invoke    test_unit
    create      test/unit/post_test.rb
</code></pre>
<p>Interestingly, <code>--no-fixture</code> isn&#8217;t mentioned in the usage information for <code>script/generate model</code>. It mentions the <code>--fixture</code> flag, but I had to guess that <code>--no-fixture</code> was also supported.</p>
<p>Hmm, I want to use rspec. So, let&#8217;s destroy these files:</p>
<pre><code>$ script/destroy model Post title:string
      invoke  active_record
.../vendor/gems/dirs/rails/railties/lib/rails/generators/active_record.rb:14:in
  `next_migration_number': uninitialized constant ActiveRecord::Base (NameError)
</code></pre>
<p>Oh well.</p>
<p>What if I wanted to run rspec and cucumber generators, for example, against an edge rails app?</p>
<h2 id="rails_2_generators">Rails 2 generators</h2>
<p>The &#8220;Others&#8221; generators are my own local generators from <code>~/.rails/generators</code>. Amusingly, instead of <code>app_layout</code> it is called <code>app_layout:app_layout</code>. Not surprisingly at all, if I try to run the rails 2 generator it fails:</p>
<pre><code>$ script/generate app_layout:app_layout
[WARNING] Could not load generator at "/Users/drnic/.rails/generators/app_layout/app_layout_generator.rb". Error: uninitialized constant Rails::Generator
Could not find generator app_layout:app_layout.
</code></pre>
<p>Poop. </p>
<p>Note, I have rspec, rspec-rails and cucumber gems installed locally but I cannot see their rails generators above. Rails 3 doesn&#8217;t look for generators in the same way and old Rails 2 generators don&#8217;t work anymore.</p>
<p>That&#8217;s the news: every rails 2 generator is broken. </p>
<p>When I start to migrate some of mine I&#8217;ll post about it. In the meantime, <a href="http://twitter.com/josevalim">José Valim</a> has written some introduction thoughts on <a href="http://blog.plataformatec.com.br/2009/07/creating-your-own-generators-with-thor/">using Thor as a generator</a>.</p>
<p>You can also probably learn about how to write rails 3.0 generators by looking at the source code for the new generators like <a href="http://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/app/app_generator.rb">rails</a>, model (see <a href="http://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/model/model_generator.rb">main</a> and  <a href="http://github.com/rails/rails/blob/master/railties/lib/rails/generators/test_unit/model/model_generator.rb">test_unit</a>), and <a href="http://github.com/rails/rails/blob/master/railties/lib/rails/generators/rails/resource/resource_generator.rb">scaffold/resource</a>.</p>
<p>Finally, José Valim has a <a href="http://github.com/josevalim/third_rails">sample Rails 3 app</a> with some vendored generators in it.</p>
<p>These are the things I&#8217;m researching now.</p>
<h2 id="summary">Summary</h2>
<p>This article is long, mostly because rails 3.0.pre hasn&#8217;t been released as a set of RubyGems. If it had, then all the dependencies would be installed automatically.</p>
<p>It also introduces gem/plugin writers to the first upgrade issue: your current generators are neither discovered nor work by a rails 3.0 app. We&#8217;re all clever cookies, so here&#8217;s hoping we can figure out the upgrade path and that it&#8217;s simple enough to not be the topic of Dan Brown&#8217;s next book.</p>
<h2 id="footnotes">Footnotes</h2>
<p>[1] Two portions of rails 3.0.pre are available as pre-release gems: activesupport (which is now very modularised and only loads up the parts that you require) and activemodel (which is shiny and new and hence completely safe for rails-core to release).</p>
<p>[2] There are two popular ways to have easy, non-intrusive access to alternate versions of ruby: <a href="http://www.rubyinside.com/rvm-ruby-version-manager-2347.html">rvm</a> and <a href="http://blog.thinkrelevance.com/2009/7/29/ruby-switcher-working-with-multiple-ruby-versions-has-never-been-this-easy">ruby_switcher.sh</a>.</p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2009/10/07/rails-themes-can-remember-things/' rel='bookmark' title='Permanent Link: Rails themes can remember things'>Rails themes can remember things</a> <small>I was getting annoyed at having to remember all the...</small></li><li><a href='http://drnicwilliams.com/2009/10/06/install-any-html-themetemplate-into-your-rails-app/' rel='bookmark' title='Permanent Link: Install any HTML theme/template into your Rails app'>Install any HTML theme/template into your Rails app</a> <small> Have you ever even bothered to Google for &#8220;rails...</small></li><li><a href='http://drnicwilliams.com/2009/03/30/closing-in-on-the-dream-one-click-to-deploy-rails-apps/' rel='bookmark' title='Permanent Link: Closing in on The Dream: &#8220;one-click-to-deploy Rails apps&#8221;'>Closing in on The Dream: &#8220;one-click-to-deploy Rails apps&#8221;</a> <small> Got a simple app you want to build? Allocate...</small></li></ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DrNic?a=uTRxWpITAIE:PU_gloH6Vh4:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/DrNic?i=uTRxWpITAIE:PU_gloH6Vh4:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=uTRxWpITAIE:PU_gloH6Vh4:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/DrNic?i=uTRxWpITAIE:PU_gloH6Vh4:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=uTRxWpITAIE:PU_gloH6Vh4:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/DrNic?i=uTRxWpITAIE:PU_gloH6Vh4:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2009/11/03/first-look-at-rails-3-0-pre/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
		<item>
		<title>During integration tests you might want to load public/ files</title>
		<link>http://drnicwilliams.com/2009/10/10/during-integration-tests-you-might-want-to-load-public-files/</link>
		<comments>http://drnicwilliams.com/2009/10/10/during-integration-tests-you-might-want-to-load-public-files/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 21:46:17 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Mocra]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=624</guid>
		<description><![CDATA[I&#8217;ve been wondering recently &#8220;If I cache a file in public/ how do my integration tests access the file?&#8221;
By default, Rails&#8217; integration stack only calls into the routes/controllers. So the following fails, ironically with a 404 error:
$ script/console
&#62;&#62; app.get '404.html'
=&#62; 404

It should return 200. If I cache a file into public/ I want to be [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been wondering recently &#8220;If I cache a file in public/ how do my integration tests access the file?&#8221;</p>
<p>By default, Rails&#8217; integration stack only calls into the routes/controllers. So the following fails, ironically with a 404 error:</p>
<pre>$ script/console
&gt;&gt; app.get '404.html'
=&gt; 404
</pre>
<p>It should return <code>200</code>. If I cache a file into public/ I want to be able to pull it back out during the normal course of integration testing.</p>
<p>In integration testing, this problem manifested when I clicked a link to a cached asset, or an action redirected to a cached asset.</p>
<p><a href="http://tomayko.com/">Ryan Tomayko</a> seems to also have wondered about this, and had this conversation with <a href="http://m.onkey.org/">Pratik Naik</a> on twitter the other day that solved the problem for me:</p>
<p><img src="http://img.skitch.com/20091009-jpmxu4ucisw6ai73bndb4xxm3f.jpg" alt="Ryan Tomayko learns about Rails::Rack::Static" style="border: 10px solid #999;" /></p>
<p>What worked for me was to put the following at the bottom of my config/environments/cucumber.rb file (or your &#8230;/test.rb file if you do integration testing in that environment):</p>
<pre>config.middleware.use "Rails::Rack::Static"
</pre>
<p>Now, I can successfully load assets via the <code>get</code> helper, or indirectly via webrat clicking links, etc:</p>
<pre>$ script/console cucumber
&gt;&gt; app.get '404.html'
=&gt; 200
</pre>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DrNic?a=jnMAoVeOucA:q30kZUbmr6s:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/DrNic?i=jnMAoVeOucA:q30kZUbmr6s:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=jnMAoVeOucA:q30kZUbmr6s:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/DrNic?i=jnMAoVeOucA:q30kZUbmr6s:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=jnMAoVeOucA:q30kZUbmr6s:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/DrNic?i=jnMAoVeOucA:q30kZUbmr6s:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2009/10/10/during-integration-tests-you-might-want-to-load-public-files/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails themes can remember things</title>
		<link>http://drnicwilliams.com/2009/10/07/rails-themes-can-remember-things/</link>
		<comments>http://drnicwilliams.com/2009/10/07/rails-themes-can-remember-things/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 11:23:26 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Mocra]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[install_theme]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=604</guid>
		<description><![CDATA[I was getting annoyed at having to remember all the csspath/xpath expressions for a theme I reused in a new project.
So, install_theme now helps each theme folder remember the previously used settings.

gem install install_theme  # version 0.7.0+
install_theme path/to/rails_app path/to/template #content_box \
      --partial "header:#header h2" \
     [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2009/11/03/first-look-at-rails-3-0-pre/' rel='bookmark' title='Permanent Link: First look at rails 3.0.pre'>First look at rails 3.0.pre</a> <small> This article is out of date in some aspects....</small></li><li><a href='http://drnicwilliams.com/2009/10/06/install-any-html-themetemplate-into-your-rails-app/' rel='bookmark' title='Permanent Link: Install any HTML theme/template into your Rails app'>Install any HTML theme/template into your Rails app</a> <small> Have you ever even bothered to Google for &#8220;rails...</small></li><li><a href='http://drnicwilliams.com/2009/03/30/closing-in-on-the-dream-one-click-to-deploy-rails-apps/' rel='bookmark' title='Permanent Link: Closing in on The Dream: &#8220;one-click-to-deploy Rails apps&#8221;'>Closing in on The Dream: &#8220;one-click-to-deploy Rails apps&#8221;</a> <small> Got a simple app you want to build? Allocate...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>I was getting annoyed at having to remember all the csspath/xpath expressions for a theme I reused in a new project.</p>
<p>So, install_theme now helps each theme folder remember the previously used settings.</p>
<pre>
gem install install_theme  # version 0.7.0+
install_theme path/to/rails_app path/to/template #content_box \
      --partial "header:#header h2" \
      --partial sidebar:#sidebar"
</pre>
<p>Now, the next time you apply that same theme to another project you don&#8217;t need to mention &#8220;#content_box&#8221; or use the <code>--partial</code> flags:</p>
<pre>
install_theme path/to/another_rails_app path/to/template
</pre>
<h3>How?</h3>
<p>If you squint your eyes just right, you&#8217;ll notice that your original template folder now has an <code>install_theme.yml</code> file. It contains your original settings. You can imagine for yourself how the rest of the &#8220;themes can remember things&#8221; magic might work.</p>
<h3>Templates &#8220;For Ruby on Rails&#8221;</h3>
<p>If you are a template maker, you can now easily make your HTML template &#8220;For Ruby on Rails&#8221; by including an <code>install_theme.yml</code> file. Think of the children.</p>
<h3>Major change</h3>
<p>I changed the order of the first two arguments. In future, the path/to/template will be optional. Why? Imagine if each theme you ever used was cached in <code>~/.install_theme/themes</code> and you could select a theme from a list or by <code>--theme theme_name</code>. That seems neat.</p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2009/11/03/first-look-at-rails-3-0-pre/' rel='bookmark' title='Permanent Link: First look at rails 3.0.pre'>First look at rails 3.0.pre</a> <small> This article is out of date in some aspects....</small></li><li><a href='http://drnicwilliams.com/2009/10/06/install-any-html-themetemplate-into-your-rails-app/' rel='bookmark' title='Permanent Link: Install any HTML theme/template into your Rails app'>Install any HTML theme/template into your Rails app</a> <small> Have you ever even bothered to Google for &#8220;rails...</small></li><li><a href='http://drnicwilliams.com/2009/03/30/closing-in-on-the-dream-one-click-to-deploy-rails-apps/' rel='bookmark' title='Permanent Link: Closing in on The Dream: &#8220;one-click-to-deploy Rails apps&#8221;'>Closing in on The Dream: &#8220;one-click-to-deploy Rails apps&#8221;</a> <small> Got a simple app you want to build? Allocate...</small></li></ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DrNic?a=nSMIu1-C6oA:rq_SSerCpUE:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/DrNic?i=nSMIu1-C6oA:rq_SSerCpUE:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=nSMIu1-C6oA:rq_SSerCpUE:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/DrNic?i=nSMIu1-C6oA:rq_SSerCpUE:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=nSMIu1-C6oA:rq_SSerCpUE:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/DrNic?i=nSMIu1-C6oA:rq_SSerCpUE:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2009/10/07/rails-themes-can-remember-things/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>hash bang cucumber</title>
		<link>http://drnicwilliams.com/2009/10/07/hash-bang-cucumber/</link>
		<comments>http://drnicwilliams.com/2009/10/07/hash-bang-cucumber/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 04:37:02 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Cucumber]]></category>
		<category><![CDATA[Trick]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=594</guid>
		<description><![CDATA[I don&#8217;t know if this is a good idea or not, but often I just wish I could copy and paste a cucumber feature file into the command line and have it just run the frigging scenarios without having to prefix it with &#8220;cucumber&#8221;.

Perhaps I&#8217;m a bit delirious but I think it would be fun [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2009/04/15/cucumber-building-a-better-world-object/' rel='bookmark' title='Permanent Link: Cucumber: building a better World (object)'>Cucumber: building a better World (object)</a> <small>How to write helper libraries for your Cucumber step definitions...</small></li><li><a href='http://drnicwilliams.com/2009/03/26/testing-outbound-emails-with-cucumber/' rel='bookmark' title='Permanent Link: Testing outbound emails with Cucumber'>Testing outbound emails with Cucumber</a> <small> My testimonial for Cucumber still stands even in 2009....</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>I don&#8217;t know if this is a good idea or not, but often I just wish I could copy and paste a cucumber feature file into the command line and have it just run the frigging scenarios without having to prefix it with &#8220;cucumber&#8221;.</p>
<p><img src="http://img.skitch.com/20091007-fpa5dmbe4npyiyh3y61y3g1ahj.jpg" alt="running scenarios directly from command line" style="width: 100%" /></p>
<p>Perhaps I&#8217;m a bit delirious but I think it would be fun to paste <code>features/112_users_crud.feature</code> into the console and it would run the scenarios:</p>
<pre>$ features/users_crud.feature</pre>
<p>instead of having to always do the extra key strokes:</p>
<pre>$ cucumber features/users_crud.feature</pre>
<h3>Solution?</h3>
<p>Two steps:</p>
<ol>
<li>At the very top of each feature file add: <code>#!/usr/bin/env cucumber</code></li>
<li>Run <code>chmod +x features/*.feature</code>
</ol>
<p>Shazam!</p>
<h3>Hash bang me up!</h3>
<p>To apply this to all your feature files, jump into <code>script/console</code> or <code>irb</code> and run the following code within your project:</p>
<pre>
Dir["**/*.feature"].each do |feature|
  contents = File.read(feature)
  File.open(feature, "w") do |f|
    f << "#!/usr/bin/env cucumber\n\n"
    f << contents
  end
  `chmod +x "#{feature}"`
end
</pre>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2009/04/15/cucumber-building-a-better-world-object/' rel='bookmark' title='Permanent Link: Cucumber: building a better World (object)'>Cucumber: building a better World (object)</a> <small>How to write helper libraries for your Cucumber step definitions...</small></li><li><a href='http://drnicwilliams.com/2009/03/26/testing-outbound-emails-with-cucumber/' rel='bookmark' title='Permanent Link: Testing outbound emails with Cucumber'>Testing outbound emails with Cucumber</a> <small> My testimonial for Cucumber still stands even in 2009....</small></li></ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DrNic?a=R1GgMp1ESA4:GkEDdxWisVg:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/DrNic?i=R1GgMp1ESA4:GkEDdxWisVg:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=R1GgMp1ESA4:GkEDdxWisVg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/DrNic?i=R1GgMp1ESA4:GkEDdxWisVg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=R1GgMp1ESA4:GkEDdxWisVg:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/DrNic?i=R1GgMp1ESA4:GkEDdxWisVg:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2009/10/07/hash-bang-cucumber/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Install any HTML theme/template into your Rails app</title>
		<link>http://drnicwilliams.com/2009/10/06/install-any-html-themetemplate-into-your-rails-app/</link>
		<comments>http://drnicwilliams.com/2009/10/06/install-any-html-themetemplate-into-your-rails-app/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 23:55:58 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Announcement]]></category>
		<category><![CDATA[Mocra]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[install_theme]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=580</guid>
		<description><![CDATA[
Have you ever even bothered to Google for &#8220;rails html template&#8221;? There are millions of &#8220;Wordpress themes&#8221; you can download for free or less than $100, a thousand times more static HTML templates, but never any category of template called &#8220;Ruby on Rails theme&#8221;. 24 millions results for Googling single column html theme.
So we&#8217;re only [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2009/11/03/first-look-at-rails-3-0-pre/' rel='bookmark' title='Permanent Link: First look at rails 3.0.pre'>First look at rails 3.0.pre</a> <small> This article is out of date in some aspects....</small></li><li><a href='http://drnicwilliams.com/2009/10/07/rails-themes-can-remember-things/' rel='bookmark' title='Permanent Link: Rails themes can remember things'>Rails themes can remember things</a> <small>I was getting annoyed at having to remember all the...</small></li><li><a href='http://drnicwilliams.com/2009/03/30/closing-in-on-the-dream-one-click-to-deploy-rails-apps/' rel='bookmark' title='Permanent Link: Closing in on The Dream: &#8220;one-click-to-deploy Rails apps&#8221;'>Closing in on The Dream: &#8220;one-click-to-deploy Rails apps&#8221;</a> <small> Got a simple app you want to build? Allocate...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p><img src="http://img.skitch.com/20091005-8at43u9msix8pbky8p2ft5ejj3.preview.jpg" alt="theme applied and menu update" style="float: right; display: inline; margin: 0 0 2px 7px; width: 40%"/></p>
<p>Have you ever even bothered to Google for &#8220;rails html template&#8221;? There are millions of &#8220;Wordpress themes&#8221; you can download for free or less than $100, a thousand times more static HTML templates, but never any category of template called &#8220;Ruby on Rails theme&#8221;. 24 millions results for Googling <a href="http://www.google.com/search?hl=en&amp;q=single+column+html+theme">single column html theme</a>.</p>
<p>So we&#8217;re only left with HTML templates. Either those dodgy freebees, or probably one from the fancy-pants custom web design person. But how do we install them to our Rails apps?</p>
<p>I don&#8217;t know. It sucks. And it takes more time than it should. Here&#8217;s my idea &#8211; a tool to install any HTML template into your Rails app. To treat any HTML template as if it was a &#8220;Ruby on Rails HTML Template&#8221;.</p>
<p>So I&#8217;ve started to try and make any &#8220;HTML Template&#8221; into a &#8220;Ruby on Rails Template&#8221; with the helper app <a href="http://github.com/drnic/install_theme">install_theme</a>.</p>
<h3 id="what8217s_it_do">What&#8217;s it do?</h3>
<p>Take any HTML/CSS template, <code>install_theme</code> will install the various assets into the appropriate places of your Rails application, and convert the main sample page of the template into your app/views/layouts/application.html.erb (or .haml). Easy peasy.</p>
<p>Instead of taking a few hours or a day to install a template into your Rails app, the most part now just takes a minute or two. Into either ERB or Haml. Repeatable if the original HTML/CSS template changes.</p>
<p>Consider a free admin template <a href="http://www.oswd.org/design/information/id/2312">Refreshed</a> [<a href="http://www.oswd.org/design/download/id/2312">download</a>].</p>
<p><a href="http://skitch.com/drnic/nb731/refreshed-theme"><img src="http://img.skitch.com/20091005-teh6s3axcj275q8tx7tjkwu3ht.jpg" alt="refreshed theme" /></a></p>
<p>Installing a theme for fun and profit into a fresh rails app:</p>
<pre>$ gem install install_theme
$ rails my_app
$ cd my_app
$ install_theme . path/to/theme/folder ".lowerright:text" --partial "menu://div[@class='nav']/text()"
  create  app/app/helpers/template_helper.rb
  create  app/controllers/original_template_controller.rb
  create  app/helpers/template_helper.rb
  create  app/views/layouts/_menu.html.erb
  create  app/views/layouts/application.html.erb
  create  app/views/original_template/index.html.erb
  create  public/images/footer.png
  ...
  create  public/stylesheets/style.css

Your theme has been installed into your app.
</pre>
<p>When you launch the app, it will be instantly themed. The section of the original template with DOM path <code>.lowerright</code> will be removed and replaced by your rendered actions.</p>
<p>The <code>--partial</code> flag converts a section into a partial template (or via <code>content_for</code> helper). More on this in a minute.</p>
<p>Note: the example above uses both CSS path and XPath expressions. For each section of the template you want to convert to a partial you use then <code>--partial</code> flag. The argument is &#8220;label:xpath&#8221; or &#8220;label:csspath&#8221;. So either <code>--partial "header://div[@id='header']/h2"</code> or <code>--partial "header:#header h2"</code>.</p>
<p>Here are the content and partial selections using CSSpath:</p>
<pre>$ install_theme . path/to/theme/folder ".lowerright:text" --partial "menu:.nav:text"
</pre>
<p><img src="http://img.skitch.com/20091005-e7wbqw6m198qtbdbe9y3h1s7j2.jpg" alt="refreshed theme - identifying partials" /></p>
<p>Here are the content and partial selections using XPath:</p>
<pre>$ install_theme . path/to/theme/folder "//div[@class='lowerright']/text()" --partial "menu://div[@class='nav']/text()"
</pre>
<p><img src="http://img.skitch.com/20091005-x673pwf9bshi4sbjhxa91ksenj.jpg" alt="refreshed theme - identifying partials" /></p>
<h2 id="overriding_the_theme_partials">Overriding the theme partials</h2>
<p>Now that you&#8217;ve selected portions of the template to be dynamically changeable partials, how do you change them?</p>
<ol>
<li>Use <code>&lt;% content_for :menu do %&gt; ... &lt;% end %&gt;</code> from any view template</li>
<li>Create a <code>_menu.html.erb</code> partial in your controller&#8217;s views folder, e.g. <code>app/views/posts/_menu.html.erb</code></li>
<li>Modify the <code>_menu.html.erb</code> partial in the <code>app/views/layouts</code> folder. This is the default source.</li>
</ol>
<p>The original template&#8217;s menu items (home, about, forum, etc) have been moved into <code>app/views/layouts/_menu.html.erb</code>. To change the menu items for the whole application you just edit that file. For this template, it will look like:</p>
<pre>&lt;a href="#"&gt;home&lt;/a&gt;
&lt;a href="#"&gt;about&lt;/a&gt;
&lt;a href="#"&gt;forum&lt;/a&gt;
&lt;a href="#"&gt;design&lt;/a&gt;
&lt;a href="#"&gt;info&lt;/a&gt;
&lt;a href="#"&gt;contact&lt;/a&gt;
</pre>
<p>This is the extracted content of the <code>.nav</code> DOM element. You now modify it to have the same DOM structure, a bunch of links, and you&#8217;ll get the same theme output.</p>
<p>Let&#8217;s change the menu across the entire application. Edit <code>app/views/layouts/_menu.html.erb</code>:</p>
<pre>&lt;%= link_to "home", "/" %&gt;
&lt;%= link_to "posts", posts_path %&gt;
&lt;%= link_to "new post", new_post_path %&gt;
</pre>
<p>If you wanted to change the menu for all actions in the posts controller, then create a similar partial in <code>app/views/posts/_menu.html.erb</code>.</p>
<p>If you wanted to change the menu for a specific action, then use <code>content_for</code> in your view:</p>
<pre>&lt;% content_for :menu do: %&gt;
  &lt;a href="/"&gt;home&lt;/a&gt;
  &lt;a href="/login"&gt;sign in&lt;/a&gt;
  &lt;a href="/signup"&gt;create account&lt;/a&gt;
&lt;% end %&gt;
</pre>
<h2 id="haml">Haml</h2>
<p>I use Haml and I like it. <code>install_theme</code> automatically detects if you are using Haml, and generates haml HTML views and sass CSS files.</p>
<pre>$ gem install drnic-haml --source http://gemcutter.org  # see below
$ rails my_haml_app
$ cd my_haml_app
$ haml --rails .
$ install_theme . path/to/theme/folder ".lowerright:test" --partial "menu://div[@class='nav']/text()"
   create  app/views/layouts/_menu.html.haml
   create  app/views/layouts/application.html.haml
   create  app/views/original_template/index.html.haml
   create  public/stylesheets/sass/style.sass
</pre>
<p>NOTE: there is a new version of haml&#8217;s html2haml (which install_theme uses) coming that fixes many bugs. In the short term, use the drnic-haml above.</p>
<h2 id="where8217d_my_original_content_go">Where&#8217;d my original content go?</h2>
<p>Your template might include examples of how a table looks, or a form, or pagination. It would good if they weren&#8217;t lost on the chopping floor.</p>
<p>The original template&#8217;s contents are stored at <code>app/views/original_templates/index.html.erb</code> and viewable at <a href="http://localhost:3000/original_template">http://localhost:3000/original_template</a></p>
<p>That means you can now copy + paste any sample HTML snippets as you need them.</p>
<h2 id="how_it_works">How it works?</h2>
<p>Look inside the generated <code>application.html.erb</code> file and you&#8217;ll see the following for each named partial:</p>
<pre>&lt;%= yield(:menu) || render_or_default('menu') %&gt;
</pre>
<p>The <code>yield(:menu)</code> enables the <code>content_for</code> helper to override the partials.</p>
<p>The <code>render_or_default</code> helper finds the appropriate partial to use (see app/helpers/template_helper.rb for source).</p>
<h2 id="the_future">The Future</h2>
<p>Let me know if anyone else thinks this is useful, and what other fun things you think it could do.</p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2009/11/03/first-look-at-rails-3-0-pre/' rel='bookmark' title='Permanent Link: First look at rails 3.0.pre'>First look at rails 3.0.pre</a> <small> This article is out of date in some aspects....</small></li><li><a href='http://drnicwilliams.com/2009/10/07/rails-themes-can-remember-things/' rel='bookmark' title='Permanent Link: Rails themes can remember things'>Rails themes can remember things</a> <small>I was getting annoyed at having to remember all the...</small></li><li><a href='http://drnicwilliams.com/2009/03/30/closing-in-on-the-dream-one-click-to-deploy-rails-apps/' rel='bookmark' title='Permanent Link: Closing in on The Dream: &#8220;one-click-to-deploy Rails apps&#8221;'>Closing in on The Dream: &#8220;one-click-to-deploy Rails apps&#8221;</a> <small> Got a simple app you want to build? Allocate...</small></li></ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DrNic?a=ed_z5YLd1jo:bDjSBmk8WpU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/DrNic?i=ed_z5YLd1jo:bDjSBmk8WpU:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=ed_z5YLd1jo:bDjSBmk8WpU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/DrNic?i=ed_z5YLd1jo:bDjSBmk8WpU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=ed_z5YLd1jo:bDjSBmk8WpU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/DrNic?i=ed_z5YLd1jo:bDjSBmk8WpU:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2009/10/06/install-any-html-themetemplate-into-your-rails-app/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>FutureRuby talk: Living With 1000 Open Source Projects</title>
		<link>http://drnicwilliams.com/2009/07/13/futureruby-talk-living-with-1000-open-source-projects/</link>
		<comments>http://drnicwilliams.com/2009/07/13/futureruby-talk-living-with-1000-open-source-projects/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 15:56:59 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Cucumber]]></category>
		<category><![CDATA[Mocra]]></category>
		<category><![CDATA[Presentation]]></category>
		<category><![CDATA[Speaking]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=574</guid>
		<description><![CDATA[The FutureRuby conference has been (and still is, as of 11:43am on Sunday) wonderful. I just finished my talk on &#8220;Living With 1000 Open Source Projects&#8221; which was great fun, good for a bunch of laughs, and more importantly allowed me to share some thoughts on Zero Maintenance, Managing community expectations, self-sustaining communities, and the [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://futureruby.com">FutureRuby</a> conference has been (and still is, as of 11:43am on Sunday) wonderful. I just finished my talk on &#8220;Living With 1000 Open Source Projects&#8221; which was great fun, good for a bunch of laughs, and more importantly allowed me to share some thoughts on Zero Maintenance, Managing community expectations, self-sustaining communities, and the difficulty of scaling pet children.</p>
<p>Below are the slides and all the nice things people said about the talk, which has made me feel very good for sharing, and for the 60hr return flight from Brisbane to Toronto.</p>
<p>If you want to hear the jokes, and an Australian &#8220;mistaking&#8221; Canada for a state of America, perhaps wait for <a href="http://infoq.com">InfoQ</a> to publish the video.</p>
<h3>The slides</h3>
<div style="width:425px;text-align:left" id="__ss_1710647"><a style="font:14px Helvetica,Arial,Sans-serif;display:block;margin:12px 0 3px 0;text-decoration:underline;" href="http://www.slideshare.net/drnic/living-with-1000-open-source-projects" title="Living With 1000 Open Source Projects">Living With 1000 Open Source Projects</a><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=livingwith1000opensourceprojects-novideos-090712054221-phpapp01&#038;stripped_title=living-with-1000-open-source-projects" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=livingwith1000opensourceprojects-novideos-090712054221-phpapp01&#038;stripped_title=living-with-1000-open-source-projects" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object>
<div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/drnic">Dr nic Williams</a>.</div>
</div>
<h3>Nice things people said</h3>
<p><a href="http://skitch.com/drnic/bacp4/drnic-futureruby"><img src="http://img.skitch.com/20090712-txxryk4juqm8kib2xmhherebd8.jpg" alt="@drnic #futureruby" /></a></p>
<h3>Thanks to&#8230;</h3>
<p><a href="http://designbyelle.com">Elle Meredith</a> who helped me design and theme the slides so they looked spot-on-awesome.</p>
<p>My <a href="http://www.flickr.com/photos/drnic/sets/72157620673400036/">two children</a> for not being old enough to be disturbed by some of the things I said about them during the talk.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DrNic?a=hNUGdTL9kNw:ajenhI4oi18:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/DrNic?i=hNUGdTL9kNw:ajenhI4oi18:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=hNUGdTL9kNw:ajenhI4oi18:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/DrNic?i=hNUGdTL9kNw:ajenhI4oi18:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=hNUGdTL9kNw:ajenhI4oi18:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/DrNic?i=hNUGdTL9kNw:ajenhI4oi18:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2009/07/13/futureruby-talk-living-with-1000-open-source-projects/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Proof of Doctorhoodedness</title>
		<link>http://drnicwilliams.com/2009/07/05/proof-of-doctorhoodedness/</link>
		<comments>http://drnicwilliams.com/2009/07/05/proof-of-doctorhoodedness/#comments</comments>
		<pubDate>Sun, 05 Jul 2009 03:34:42 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[For Hire]]></category>
		<category><![CDATA[Mocra]]></category>
		<category><![CDATA[Speaking]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=564</guid>
		<description><![CDATA[At recent conferences, other speakers have taken up an amusing new sport: ask Dr Nic to prove he&#8217;s a real doctor. Traditionally my reply is &#8220;I&#8217;m just not that clever to make it up.&#8221; Undeterred the personal challenges continued. At JAOO in Sydney and Brisbane (my home town) Glenn Vanderburg even challenged me to bring [...]]]></description>
			<content:encoded><![CDATA[<p>At recent conferences, other speakers have taken up an amusing new sport: ask Dr Nic to prove he&#8217;s a real doctor. Traditionally my reply is &#8220;I&#8217;m just not that clever to make it up.&#8221; Undeterred the personal challenges continued. At JAOO in Sydney and Brisbane (my home town) <a href="http://www.vanderburg.org/Blog">Glenn Vanderburg</a> even challenged me to bring my thesis to the conference. I accepted this challenge but then promptly forgot.</p>
<p>Today I actually found the thing. It&#8217;s red. The colour of the binding was my only chance to impose some sense of personalisation.</p>
<p>The title was <strong>The Morphing Architecture: Runtime Evolution of Distribute Applications.</strong> The abstract is too long to be bothered reciting here. Succinctly, as best I remember it, it could be:</p>
<blockquote><p>If you have distributed applications (components owned by multiple organisations) that run 24&#215;7, and you need to upgrade behaviour, how the hell do you sequence the live upgrade?</p></blockquote>
<div class="thumbnail"><a href="http://skitch.com/drnic/bst6h/the-thesis-cover"><img src="http://img.skitch.com/20090705-r57qnqxhbas51hr44fn5p2err8.preview.jpg" alt="the thesis: cover" /></a></div>
<p><br/></p>
<div class="thumbnail"><a href="http://skitch.com/drnic/bst67/the-thisis-submission"><img src="http://img.skitch.com/20090705-c63dw6t2fq16m817nite8n7dkc.preview.jpg" alt="the thisis: submission" /></a></div>
<p><br/></p>
<div class="thumbnail"><a href="http://skitch.com/drnic/bst66/the-thesis-acceptance"><img src="http://img.skitch.com/20090705-mekj64x9jbpcx7aqi5xx9cbe2e.preview.jpg" alt="the thesis: acceptance" /></a></div>
<p><br/></p>
<p>Like most PhDs, it is a project of theoretical usefulness, but not significantly close to any commercial interests so that some large company doesn&#8217;t solve all your interesting problems before you get around to writing a 200 page thesis.</p>
<p>In 220+ pages, the only interesting parts (to me now) are from my Acknowledgments section:</p>
<blockquote><p>As [my parent's] eldest of two sons, I am that person in each family who is the &#8220;first experiment in parenting.&#8221;</p></blockquote>
<p>The Acknowledgements section ended with this:</p>
<blockquote><p>And finally [thanks]&#8230;<br />
To all the people who ever came up to me&#8230;<br />
&nbsp;&nbsp;&nbsp;&nbsp;Asked me how my thesis was going&#8230;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Laughed hideously&#8230;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;And ran off.</p></blockquote>
<p>Ah, memories.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DrNic?a=OJrYBs_5TWY:j6iXfdFepPU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/DrNic?i=OJrYBs_5TWY:j6iXfdFepPU:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=OJrYBs_5TWY:j6iXfdFepPU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/DrNic?i=OJrYBs_5TWY:j6iXfdFepPU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=OJrYBs_5TWY:j6iXfdFepPU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/DrNic?i=OJrYBs_5TWY:j6iXfdFepPU:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2009/07/05/proof-of-doctorhoodedness/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Nifty Threaded IM Chat within Gtalk/Gmail Chat</title>
		<link>http://drnicwilliams.com/2009/07/04/nifty-threaded-im-chat-within-gtalkgmail-chat/</link>
		<comments>http://drnicwilliams.com/2009/07/04/nifty-threaded-im-chat-within-gtalkgmail-chat/#comments</comments>
		<pubDate>Fri, 03 Jul 2009 20:00:54 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Announcement]]></category>
		<category><![CDATA[Greasemonkey]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Mocra]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=550</guid>
		<description><![CDATA[Ever had IM chats where a conversation splits into multiple topics? You&#8217;ll be able to follow along, intelligently piecing together which-message-goes-with-which-topic, until the following scenario inevitably occurs:

  me: What's on this weekend? Going to the football?
  me: Are you and Jackie still seeing each other?
  you: Yes
  me: Eh? Yes - [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2009/06/07/tdd-for-greasemonkey-scripts-and-introducing-ninja-search-js/' rel='bookmark' title='Permanent Link: TDD for Greasemonkey scripts; and introducing Ninja Search JS'>TDD for Greasemonkey scripts; and introducing Ninja Search JS</a> <small>&#8220;this article shows how I used test-driven development tools and...</small></li><li><a href='http://drnicwilliams.com/2006/08/29/yehuda-katz-starts-a-blog/' rel='bookmark' title='Permanent Link: Yehuda Katz starts a blog'>Yehuda Katz starts a blog</a> <small>Yehuda is the creator of autoDB &#8211; the wonderful admin...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Ever had IM chats where a conversation splits into multiple topics? You&#8217;ll be able to follow along, intelligently piecing together which-message-goes-with-which-topic, until the following scenario inevitably occurs:</p>
<pre>
  me: What's on this weekend? Going to the football?
  me: Are you and Jackie still seeing each other?
  you: Yes
  me: Eh? Yes - football or yes to Jackie?
</pre>
<p>That is, eventually the messages become ambiguous as to which topic they go to.</p>
<h3 id="the_solution">The solution</h3>
<p><img alt="" src="http://img.skitch.com/20090703-js9ahnd44qmq6ue8ya8fdiryau.preview.jpg" title="Threaded example" class="alignright" width="265" height="311" /></p>
<p>A <a href="http://designbyelle.com/" target="_blank">designer friend of mine</a> and I discovered this problem every day as we talked about different projects and completely unrelated things. Ironically, this led to a new inline topic: <em>what if each thread/topic could be visually identifiable?</em></p>
<p>Perhaps we could just modify one of the HTML-based IM clients, such as Gmail Chat/Gtalk (same could be done for Facebook&#8217;s IM client I guess), and use twitter-esque #tags to identify threads (no fancy jabber protocol changes). If we did this we could prototype something, see if it was a useful way to solve the multi-threaded IM chat problem. <em>I mean, how hard could it be?</em></p>
<h3 id="prototype_greasemonkey_script_firefox_safari">Prototype: Greasemonkey Script (Firefox + Safari)</h3>
<p>Since I have a thing for <a href="https://addons.mozilla.org/en-US/firefox/addon/748">Greasemonkey</a> scripts at the moment (which also run on Safari/<a href="http://mailplaneapp.com/">Mailplane</a> using <a href="http://8-p.info/greasekit/">GreaseKit</a>), it immediately came to mind as a way to hack into Gmail&#8217;s Chat.</p>
<p>After installing Greasemonkey or GreaseKit, <a href="http://drnic.github.com/threaded-gtalk-gmscript/dist/threaded_gtalk.user.js">click to install the extension</a> for Gmail&#8217;s inline Jabber/Gtalk chat.</p>
<p>Restart Gmail, fire up a chat to someone (for example, complain of bugs to <a href="drnicwilliams@gmail.com">drnicwilliams@gmail.com</a>) and try the following:</p>
<pre>
  greasemonkey is fun
  gmailchat is very nifty and hackable
  its cool that I can annotate gmail chat with #greasemonkey
  no way, #gmailchat is colour highlighted
  sexy
</pre>
<p>Which will look something like the picture at the top.</p>
<p>Sadly, I&#8217;m talking to myself here. QA testing can be a lonely man&#8217;s sport.</p>
<h3 id="success">Success?</h3>
<p>Technically, yes. I mean, it works. You use a different #tag and it will be a different colour. </p>
<p>It was a prototype to determine if using #tags was a friendly, non-invasive way to identify threads. And it kind-of works, as long as you remember to use them. In IM, less-so than twitter, it seems unnatural to add #tags, or prefix a keyword with a # character. But, in time, I think you&#8217;d learn to do it to get the benefit.</p>
<p>The bigger issue is that I don&#8217;t want to use Gmail&#8217;s Chat for my IM client. I didn&#8217;t find the source to Apple&#8217;s iChat client lying around on github; and I really don&#8217;t want to go hacking Cocoa/Win32 apps just to try out an idea. A greasemonkey script is an awesome way to try out something like this.</p>
<p>Now, if everyone could just make this idea of #tagging intra-IM conversation threads/topics, then perhaps 5 years from now Apple will pick it up and implement it in iChat. Any of the more accessible, open source clients could implement this too. Probably a lot sooner.</p>
<h3 id="known_bugs">Known bugs</h3>
<p>In Mailplane (though not Safari), the 2nd+ threads aren&#8217;t coloured differently. I&#8217;m having trouble fixing this at the moment due to an <a href="http://github.com/relevance/blue-ridge/issues/#issue/13">issue</a> in <a href="http://github.com/relevance/blue-ridge">blue-ridge</a>&#8217;s setup on Safari.</p>
<p>It currently shares thread colouring across all open chat windows. Probably not a big issue. I forgot to consider multiple chat windows when I wrote the code.</p>
<p>When you use a new #tag, it only finds one previous message with &#8216;tag&#8217; in it. Really, once a word is #tagged, then any message containing &#8216;tagged&#8217; could be included in the thread.</p>
<h3 id="quirky_thing_i_learnt">Quirky thing I learned</h3>
<p>You can&#8217;t really use the <a href="http://docs.jquery.com/Plugins/livequery">jquery.livequery.js</a> plugin to watch for DOM changes in Greasemonkey scripts. It works by hooking into jQuery DOM modification calls, such as <code>append</code> and <code>prepend</code>, to know instantly that something has changed. Gmail, and many other websites, don&#8217;t use jQuery. So it doesn&#8217;t work. Even though your beautiful unit tests say it will. Use <code>setInterval</code> instead.</p>
<h3 id="project_status">Project status</h3>
<p>It&#8217;s finished. It was a prototype to try out an idea. It has unit tests, it works and if you want to use it for your own research project or &#8220;oh oh oh how cool would it be if&#8230;?&#8221; hackathon, go for gold with the code base. Rename it, abuse it. Have fun.</p>
<p>Source on github: <a href="http://github.com/drnic/threaded-gtalk-gmscript/">http://github.com/drnic/threaded-gtalk-gmscript/</a></p>
<h3 id="a_pleasant_word_from_my_sponsor">A pleasant word from my sponsor</h3>
<p>When I was hacking on Threaded Gtalk GMScript, I wasn&#8217;t doing something more productive at my firm <a href="http://mocra.com/">Mocra</a>. Ironically, you could reward my wayward efforts by considering us for your awesome new Rails or iPhone project. It will make you happy. Especially if its chock-full of JavaScript.</p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2009/06/07/tdd-for-greasemonkey-scripts-and-introducing-ninja-search-js/' rel='bookmark' title='Permanent Link: TDD for Greasemonkey scripts; and introducing Ninja Search JS'>TDD for Greasemonkey scripts; and introducing Ninja Search JS</a> <small>&#8220;this article shows how I used test-driven development tools and...</small></li><li><a href='http://drnicwilliams.com/2006/08/29/yehuda-katz-starts-a-blog/' rel='bookmark' title='Permanent Link: Yehuda Katz starts a blog'>Yehuda Katz starts a blog</a> <small>Yehuda is the creator of autoDB &#8211; the wonderful admin...</small></li></ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DrNic?a=fxw_KuHc_mk:ipGXFJSG45A:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/DrNic?i=fxw_KuHc_mk:ipGXFJSG45A:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=fxw_KuHc_mk:ipGXFJSG45A:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/DrNic?i=fxw_KuHc_mk:ipGXFJSG45A:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=fxw_KuHc_mk:ipGXFJSG45A:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/DrNic?i=fxw_KuHc_mk:ipGXFJSG45A:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2009/07/04/nifty-threaded-im-chat-within-gtalkgmail-chat/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Refer us a client for fun and profit</title>
		<link>http://drnicwilliams.com/2009/06/30/refer-us-a-client-for-fun-and-profit/</link>
		<comments>http://drnicwilliams.com/2009/06/30/refer-us-a-client-for-fun-and-profit/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 00:10:02 +0000</pubDate>
		<dc:creator>Dr Nic</dc:creator>
				<category><![CDATA[Announcement]]></category>
		<category><![CDATA[Mocra]]></category>

		<guid isPermaLink="false">http://drnicwilliams.com/?p=545</guid>
		<description><![CDATA[There&#8217;s only so many hours in the day and only so many technologies people can be awesome at. So sometimes there are projects that developers can&#8217;t do themselves. Either the scope is too big, the timeframe to urgent, or it falls outside their areas of expertise. Or you&#8217;ve already got yourself a sexy job and [...]


Related posts:<ol><li><a href='http://drnicwilliams.com/2009/04/06/easy-scheduling-by-location-tasks-and-people-a-case-study-of-a-client-application-from-mocra/' rel='bookmark' title='Permanent Link: Easy scheduling by location, tasks and people &#8211; a case study of a client application from Mocra'>Easy scheduling by location, tasks and people &#8211; a case study of a client application from Mocra</a> <small> UPDATE: Orchestrate was reported in TechCrunch Several years ago...</small></li></ol>]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s only so many hours in the day and only so many technologies people can be awesome at. So sometimes there are projects that developers can&#8217;t do themselves. Either the scope is too big, the timeframe to urgent, or it falls outside their areas of expertise. Or you&#8217;ve already got yourself a sexy job and you just don&#8217;t need the work. If this situation ever happens to you I would love for you to ask me if I can help with the work you can&#8217;t do or don&#8217;t want.</p>
<p>Hopefully you can find good reasons to refer clients to myself and the crack-squad at <a href="http://mocra.com/">Mocra</a>. For example, we have had two client Rails projects appear in TechCrunch in 2009 (<a href="http://www.techcrunch.com/2009/04/08/orchestrate-saas-task-management-for-service-and-maintenance-businesses/">Orchestrate</a> and <a href="http://www.techcrunch.com/2009/05/25/connect-your-thoughts-to-the-mindex-with-imindi-private-beta-invites/">Imindi</a>). Also, our Oakley Surf Report iPhone app has appeared in Apple&#8217;s own TV commercials for the AppStore (first 10 secs of video below).</p>
<p><object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/p9yYdGvCA3M&amp;hl=en&amp;fs=1&amp;rel=0&amp;color1=0x006699&amp;color2=0x54abd6"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/p9yYdGvCA3M&amp;hl=en&amp;fs=1&amp;rel=0&amp;color1=0x006699&amp;color2=0x54abd6" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></p>
<p>In the past, we&#8217;ve received lots of referrals but rarely have we gone beyond saying &#8220;thank you&#8221;. We think its time to put a dollar value on all our future &#8220;thank you&#8221;s. They are incredibly valuable to us, so we&#8217;d like to share some of the value.</p>
<p>To say thanks to you, we want to share 10% of the total consulting fees for any new client work as a referral incentive.</p>
<p>If we can help a friend or client of yours and we receive $10k in fees, then we&#8217;ll give you 10% or $1k. If we receive $250k, then we&#8217;ll give you $25k.</p>
<h2 id="how_to_refer">How to refer?</h2>
<p>There&#8217;s no wrong way to ping us with a referral for a client we can potentially help.</p>
<p>One approach is to email me at <a href="mailto:referrals@mocra.com">referrals@mocra.com</a> or on Skype at <code>nicwilliams</code>. We can quickly check if we&#8217;re able to help with the project, discuss anything interesting, and then contact the client. </p>
<p>Alternatively, you can give your friend/client our enquiry emails (<a href="mailto:rails@mocra.com">rails@mocra.com</a> or <a href="mailto:iphone@mocra.com">iphone@mocra.com</a>), or skype at <code>nicwilliams</code>. Then you claim the referral via an email to <a href="mailto:referrals@mocra.com">referrals@mocra.com</a>.</p>
<p>In the medium-term future, we&#8217;ll release a Referral Management system so you can see the status of your referrals, payments etc. Until then, use <a href="mailto:referrals@mocra.com">email</a> to ask questions.</p>
<h2 id="receiving_payments">Receiving payments</h2>
<p>In order to distribute payments to you, could you please email us at <a href="mailto:referrals@mocra.com">referrals@mocra.com</a> with your contact details and either PayPal address or international banking details. Telepathic transfer of banking details nor referrals isn&#8217;t guaranteed to work. Emails are much more likely to succeed.</p>
<p>You are providing us with a valued service of marketing/advertising. We think you are awesome and will invite you to Christmas parties. Australian GST-registered businesses will have 10% GST added to payments.</p>
<h2 id="basic_referral_rules">Basic referral rules</h2>
<p>Whilst we continue to draw up the fancy pants, small-print rules, some of the basic ones are:</p>
<ul>
<li>We&#8217;ll send out payments within a month of receipt of client payments. </li>
<li>We don&#8217;t think you&#8217;re a bad person if your referral doesn&#8217;t hire us.</li>
<li>In the event there is a dispute by 2+ claimants for a referral, the decision by me is final.</li>
<li>You cannot work with or be a family member of Mocra nor the referred client.</li>
<li>You are providing Mocra with a service. It makes us very happy. So we&#8217;re paying you for it.</li>
<li>You may be required to send us a Tax Invoice for each amount payable (templates available).</li>
<li>You can give away your referral income to charity or use it to fund open source development.</li>
<li>We think you are awesome for reading this far, even if you never refer any work to us. Thanks for caring.</li>
</ul>
<h2 id="happy_developers">Happy developers</h2>
<p>It makes us very happy to be contacted by new clients who tell us &#8220;I was told I should contact you.&#8221; Hopefully we can thank every referrer explicitly from now on. Thanks in advance.</p>


<p>Related posts:<ol><li><a href='http://drnicwilliams.com/2009/04/06/easy-scheduling-by-location-tasks-and-people-a-case-study-of-a-client-application-from-mocra/' rel='bookmark' title='Permanent Link: Easy scheduling by location, tasks and people &#8211; a case study of a client application from Mocra'>Easy scheduling by location, tasks and people &#8211; a case study of a client application from Mocra</a> <small> UPDATE: Orchestrate was reported in TechCrunch Several years ago...</small></li></ol></p><div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/DrNic?a=mZ100MrmMUc:5kDZDpwSdiU:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/DrNic?i=mZ100MrmMUc:5kDZDpwSdiU:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=mZ100MrmMUc:5kDZDpwSdiU:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/DrNic?i=mZ100MrmMUc:5kDZDpwSdiU:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/DrNic?a=mZ100MrmMUc:5kDZDpwSdiU:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/DrNic?i=mZ100MrmMUc:5kDZDpwSdiU:F7zBnMyn0Lo" border="0"></img></a>
</div>]]></content:encoded>
			<wfw:commentRss>http://drnicwilliams.com/2009/06/30/refer-us-a-client-for-fun-and-profit/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
