<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>it { should be_useful }</title>
	<atom:link href="http://itshouldbeuseful.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://itshouldbeuseful.wordpress.com</link>
	<description>[ useful snacks ]</description>
	<lastBuildDate>Wed, 22 May 2013 00:35:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='itshouldbeuseful.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>it { should be_useful }</title>
		<link>http://itshouldbeuseful.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://itshouldbeuseful.wordpress.com/osd.xml" title="it { should be_useful }" />
	<atom:link rel='hub' href='http://itshouldbeuseful.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Import a gemset without bundler</title>
		<link>http://itshouldbeuseful.wordpress.com/2012/02/02/import-a-gemset-without-bundler/</link>
		<comments>http://itshouldbeuseful.wordpress.com/2012/02/02/import-a-gemset-without-bundler/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 15:18:46 +0000</pubDate>
		<dc:creator>Ed James</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rvm]]></category>

		<guid isPermaLink="false">http://itshouldbeuseful.wordpress.com/?p=249</guid>
		<description><![CDATA[Here&#8217;s the scenario&#8230; I&#8217;m trying to get a Rails 2.1.1 application up-and-running on my Mac (Lion). The application uses Ruby 1.8.7-p334. Bundler is not used so there&#8217;s no chance of doing a bundle install&#8230; drat! I have a gemset export from another developer&#8217;s machine, which was created by doing this: That gives me a file [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=249&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Here&#8217;s the scenario&#8230;</p>
<p>I&#8217;m trying to get a Rails 2.1.1 application up-and-running on my Mac (Lion). The application uses Ruby 1.8.7-p334. Bundler is not used so there&#8217;s no chance of doing a <code>bundle install</code>&#8230; drat!</p>
<p>I have a gemset export from another developer&#8217;s machine, which was created by doing this:</p>
<pre class="brush: plain; title: ; notranslate">
rvm gemset export my_app
</pre>
<p>That gives me a file which looks like this (truncated for brevity)&#8230;</p>
<blockquote><p># my_app.gems generated gem export file. Note&#8230;<br />
actionmailer -v2.1.1<br />
actionpack -v2.1.1<br />
activerecord -v2.1.1<br />
activeresource -v2.1.1<br />
activesupport -v2.1.1<br />
&#8230;</p></blockquote>
<p>So, in theory it should be as easy as pie to import this gemset like this:</p>
<pre class="brush: plain; title: ; notranslate">
rvm gemset import my_app
</pre>
<p>Wrong!</p>
<p>The main problem arises when you install these gems, because the dependencies are not managed properly (this is what bundler was created for). So you end up with multiple versions of gems installed. </p>
<p>Pain.</p>
<p>The trick now is I need to be able to do a diff between my currently installed list of gems and the desired list given to me by the other developer. You could do this manually, but I&#8217;m far too lazy for that&#8230;</p>
<p>So, I created a little ruby script which will accept two files to be used for the diff operation, together with a third optional argument depending on whether I want to install or remove the gems.</p>
<p>Here&#8217;s the script&#8230;</p>
<pre class="brush: ruby; title: ; notranslate">
#!/usr/bin/env ruby

unless ARGV.count &gt;= 2
  puts &quot;Please provide two files to perform diff...&quot;
  exit
end

def load_file file
  arr = File.readlines(file).map(&amp;:chomp).compact
  arr.shift if arr.first =~ /^#/
  arr
end

f1, f2 = load_file(ARGV[0]), load_file(ARGV[1])
command = ARGV[2] || 'install'

((f1 - f2) + (f2 - f1)).uniq.each do |gem|
  puts &quot;gem #{command} #{gem}&quot;
end
</pre>
<p>Save this into a file called <code>file_diff.rb</code> and make the file executable:</p>
<pre class="brush: plain; title: ; notranslate">
chmod +x file_diff.rb
</pre>
<p>Now, it&#8217;s easy to get the exact gems installed by following these simple steps&#8230;</p>
<pre class="brush: plain; title: ; notranslate">
./file_diff.rb file1 file2 uninstall &gt; uninstall.sh
chmod x+ uninstall.sh
./uninstall.sh
</pre>
<p>And that&#8217;s it! You should now have the same gems in your gemset that your friend has in his gemset, as per his exported list.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itshouldbeuseful.wordpress.com/249/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itshouldbeuseful.wordpress.com/249/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=249&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itshouldbeuseful.wordpress.com/2012/02/02/import-a-gemset-without-bundler/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4b555dd4017f3fd30ccb9094aa03cf6f?s=96&#38;d=wavatar&#38;r=G" medium="image">
			<media:title type="html">rubysoop</media:title>
		</media:content>
	</item>
		<item>
		<title>Install Ruby 1.8.7 on OSX Lion using RVM</title>
		<link>http://itshouldbeuseful.wordpress.com/2012/02/01/install-ruby-1-8-7-on-osx-lion-using-rvm/</link>
		<comments>http://itshouldbeuseful.wordpress.com/2012/02/01/install-ruby-1-8-7-on-osx-lion-using-rvm/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 16:58:48 +0000</pubDate>
		<dc:creator>Ed James</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rvm]]></category>

		<guid isPermaLink="false">http://itshouldbeuseful.wordpress.com/?p=238</guid>
		<description><![CDATA[I&#8217;ve got a brand spanking new MacBook Pro which is running OS X Lion. I use RVM to manage my Ruby versions. So should you&#8230;probably. Anyway, I needed to install Ruby 1.8.7 for a work application, and although doing this using rvm seems to work, it doesn&#8217;t. Although rvm will tell you it&#8217;s installed Ruby [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=238&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve got a brand spanking new MacBook Pro which is running OS X Lion. I use RVM to manage my Ruby versions. So should you&#8230;probably.</p>
<p>Anyway, I needed to install Ruby 1.8.7 for a work application, and although doing this using <code>rvm</code> seems to work, it doesn&#8217;t. Although rvm will tell you it&#8217;s installed Ruby 1.8.7 cleanly, as soon as you try to install a gem it will blow up in your face with a segmentation fault&#8230;</p>
<blockquote><p>/Users/m/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/timeout.rb:60: [BUG] Segmentation fault</p></blockquote>
<p>Nice.</p>
<p>So after pulling my hair out for the best part of, oh&#8230; about 27 minutes, I came across the solution on stackoverflow. Thought I&#8217;d just post it here for my own blogging pleasure. Credit to <a href="http://stackoverflow.com/users/1006183/matt-sanders" title="Matt Sanders" target="_blank">Matt Sanders</a> for the answer:</p>
<p><a href="http://stackoverflow.com/a/7884957" title="http://stackoverflow.com/a/7884957" target="_blank">http://stackoverflow.com/a/7884957</a></p>
<p>As per Matt&#8217;s solution, after you&#8217;ve installed Xcode from the App Store, downloaded and installed the <a href="https://github.com/kennethreitz/osx-gcc-installer" title="OSX gcc installer" target="_blank">OSX gcc installer</a>, run the following to get Ruby 1.8.7 installed cleanly using rvm (adjust the patch level to your own needs):</p>
<pre class="brush: plain; title: ; notranslate">
rvm remove 1.8.7-p334
CC=/usr/bin/gcc-4.2 rvm install 1.8.7-p334 --force
</pre>
<p>I&#8217;m happy now.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itshouldbeuseful.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itshouldbeuseful.wordpress.com/238/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=238&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itshouldbeuseful.wordpress.com/2012/02/01/install-ruby-1-8-7-on-osx-lion-using-rvm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4b555dd4017f3fd30ccb9094aa03cf6f?s=96&#38;d=wavatar&#38;r=G" medium="image">
			<media:title type="html">rubysoop</media:title>
		</media:content>
	</item>
		<item>
		<title>Enable tethering and Wi-Fi hotspot on your HTC Desire</title>
		<link>http://itshouldbeuseful.wordpress.com/2011/12/01/enable-tethering-and-wi-fi-hotspot-on-your-htc-desire/</link>
		<comments>http://itshouldbeuseful.wordpress.com/2011/12/01/enable-tethering-and-wi-fi-hotspot-on-your-htc-desire/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 13:59:06 +0000</pubDate>
		<dc:creator>Ed James</dc:creator>
				<category><![CDATA[Android]]></category>

		<guid isPermaLink="false">http://itshouldbeuseful.wordpress.com/?p=229</guid>
		<description><![CDATA[I&#8217;ve just bought a new Samsung Galaxy 10.1 Tablet, which is a beautiful piece of kit. It&#8217;s Wi-Fi only &#8211; not 3G enabled, but I was assured that I could easily share my phone&#8217;s 3G connection with my tablet should I need data access on the move. However, while it turned out to be a [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=229&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve just bought a new Samsung Galaxy 10.1 Tablet,  which is a beautiful piece of kit. It&#8217;s Wi-Fi only &#8211; not 3G enabled, but I was assured that I could easily share my phone&#8217;s 3G connection with my tablet should I need data access on the move. However, while it turned out to be a rather simple solution, it&#8217;s not exactly made easy by Orange.</p>
<p>Before I show you what I did, here is my setup:</p>
<ul>
<li>Samsung Galaxy 10.1 Tablet running Android 3.1. This is standard (NOT rooted).</li>
<li>HTC Desire running Android 2.2. This is standard (NOT rooted).</li>
<li>Orange is my network provider.</li>
</ul>
<p>I have no idea if my solution will work given any other setup, but this is what worked for me.</p>
<p><strong>On your HTC Desire&#8230;</strong></p>
<p>&#8230;we will change the details of an Access Point Name, which can be found here:</p>
<pre>
Wireless &amp; Networks &gt; Mobile networks &gt; Access Point Names
</pre>
<p>You should then see the following 3 Access Point Names:</p>
<ul>
<li>Orange Internet</li>
<li>Consumer Broadband</li>
<li>Orange MMS</li>
</ul>
<p>Select the <code>Consumer Broadband</code> option, and then make the following changes (case-sensitive!):</p>
<ol>
<li>Set <strong>APN</strong> to <code><strong>orangeinternet</strong></code></li>
<li>Set <strong>Username</strong> to <code><strong>Orange</strong></code></li>
<li>Set <strong>Password</strong> to <code><strong>Multimedia</strong></code></li>
<li>Set <strong>Authentication type</strong> to <code><strong>CHAP</strong></code></li>
</ol>
<p>Press the <code>Menu</code> button and then press <code>Save</code>.</p>
<p>Then just turn on your Portable Wi-Fi hotspot.</p>
<p><strong>On your Galaxy Tablet&#8230;</strong></p>
<p>&#8230;just connect to your phone, which will be recognized as just another Wi-Fi network. Provide the necessary credentials and you&#8217;re good to go.</p>
<p>These steps are really simple and hardly worth documenting, so I won&#8217;t. But this process is worth documenting because it&#8217;s hardly something that the average non-technical user would be able to find. Thanks Orange.</p>
<p>We now have a working Wi-Fi hotspot and an internet-enabled non-3G tablet. </p>
<p>Sweet.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itshouldbeuseful.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itshouldbeuseful.wordpress.com/229/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=229&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itshouldbeuseful.wordpress.com/2011/12/01/enable-tethering-and-wi-fi-hotspot-on-your-htc-desire/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4b555dd4017f3fd30ccb9094aa03cf6f?s=96&#38;d=wavatar&#38;r=G" medium="image">
			<media:title type="html">rubysoop</media:title>
		</media:content>
	</item>
		<item>
		<title>Custom bash auto-completion using Ruby</title>
		<link>http://itshouldbeuseful.wordpress.com/2011/11/30/custom-bash-auto-completion-using-ruby/</link>
		<comments>http://itshouldbeuseful.wordpress.com/2011/11/30/custom-bash-auto-completion-using-ruby/#comments</comments>
		<pubDate>Wed, 30 Nov 2011 12:12:28 +0000</pubDate>
		<dc:creator>Ed James</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://itshouldbeuseful.wordpress.com/?p=225</guid>
		<description><![CDATA[Using what I showed you in the how to run Ruby code from within a bash script post, I will follow that up with an easy way to create a custom bash auto-completion function. The Scenario&#8230; I like to keep all my code and projects in my ~/Development directory. I typically create an alias which [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=225&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Using what I showed you in the <a href="http://itshouldbeuseful.wordpress.com/2011/11/11/run-ruby-code-from-within-a-shell-script/" title="Ruby in a bash script" target="_blank">how to run Ruby code from within a bash script</a> post, I will follow that up with an easy way to create a custom bash auto-completion function.</p>
<p><strong>The Scenario&#8230;</strong></p>
<p>I like to keep all my code and projects in my <code>~/Development</code> directory. I typically create an alias which takes me to this path, and depending what projects I&#8217;m working on, I&#8217;ll add/remove aliases accordingly to get to the relevant projects quickly. But this is quite manual and cumbersome, and it requires constant maintenance. What I&#8217;d like is an auto-complete function that dynamically picks up any new directory I create in the <code>~/Development</code> directory.</p>
<blockquote><p>All the functions detailed below should either go into your <code>.bashrc</code> file, or a file that is sourced from your <code>.bashrc</code> file.</p></blockquote>
<p><strong>Get rid of that alias</strong></p>
<p>The first thing to do is change my alias to a function. So, instead of this&#8230;</p>
<pre class="brush: plain; title: ; notranslate">
alias d=&quot;cd ~/Development&quot;
</pre>
<p>&#8230;we want this:</p>
<pre class="brush: plain; title: ; notranslate">
function d { cd ~/Development/$1; }
</pre>
<p><strong>Create the list of choices</strong></p>
<p>Next, we need a function which returns a list of all the directories in the <code>~/Development</code> directory, which will serve as our auto-completion choices. We can use Ruby here to make things nice and clean&#8230;</p>
<pre class="brush: ruby; title: ; notranslate">
#!/usr/bin/env sh

/usr/bin/env ruby &lt;&lt;-EORUBY

class ProjectCompletion
  def initialize(command)
    @command = command
  end
  
  def matches
    projects.select do |task|
      task[0, typed.length] == typed
    end
  end
  
  def typed
    @command[/\s(.+?)$/, 1] || ''
  end
  
  def projects
    %x[ls ~/Development].split
  end
end

puts ProjectCompletion.new(ENV[&quot;COMP_LINE&quot;]).matches

EORUBY
</pre>
<p><strong>Bootstrap it!</strong></p>
<p>Finally, all we need is to tell bash to use this script. We do that with this command (your own paths may vary of course):</p>
<pre class="brush: plain; title: ; notranslate">
complete -C ~/.dotfiles/completion_scripts/project_completion -o default d
</pre>
<p>Reload your shell and voila! You now have bash auto-completion for all your coding projects. This is very easily customised too, so you can create auto-complete scripts for all kinds of other things, locations, tasks etc.</p>
<p>You can now easily reach your coding projects using auto-complete, without the need for aliases. For example, if you had a directory structure like this&#8230;</p>
<pre>
~/Development
~/Development/project_1
~/Development/project_2
</pre>
<p>&#8230;you could easily see a list of projects doing this:</p>
<pre class="brush: plain; title: ; notranslate">
d proj&lt;tab&gt;
</pre>
<p>For more information see my <a href="https://github.com/edjames/dotfiles" title="dotfiles" target="_blank">dotfiles</a> project.</p>
<p>Hope this helps.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itshouldbeuseful.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itshouldbeuseful.wordpress.com/225/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=225&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itshouldbeuseful.wordpress.com/2011/11/30/custom-bash-auto-completion-using-ruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4b555dd4017f3fd30ccb9094aa03cf6f?s=96&#38;d=wavatar&#38;r=G" medium="image">
			<media:title type="html">rubysoop</media:title>
		</media:content>
	</item>
		<item>
		<title>Setting up Ubuntu 11.10 for Rails development&#8230; Just Right!</title>
		<link>http://itshouldbeuseful.wordpress.com/2011/11/28/setting-up-ubuntu-11-10-for-rails-development-just-right/</link>
		<comments>http://itshouldbeuseful.wordpress.com/2011/11/28/setting-up-ubuntu-11-10-for-rails-development-just-right/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 11:57:45 +0000</pubDate>
		<dc:creator>Ed James</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rvm]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://itshouldbeuseful.wordpress.com/?p=218</guid>
		<description><![CDATA[Further to my previous post on how to setup Ubuntu 11.10 for Rails development, I have now created a bash installer script to automate the whole laborious process for your pleasure&#8230; well it&#8217;s for my own pleasure really, but I like to share! There are two installer scripts: Ubuntu user will setup your Ubuntu 11.10 [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=218&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Further to my previous post on <a href="http://itshouldbeuseful.wordpress.com/2011/11/23/setting-up-ubuntu-11-10-for-rails-development/" title="how to setup Ubuntu 11.10 for Rails development" target="_blank">how to setup Ubuntu 11.10 for Rails development</a>, I have now created a bash installer script to automate the whole laborious process for your pleasure&#8230; well it&#8217;s for my own pleasure really, but I like to share!</p>
<p>There are two installer scripts:</p>
<ol>
<li><strong>Ubuntu user</strong> will setup your Ubuntu 11.10 environment will all the usual goodies you normally should install after a clean install / upgrade.</li>
<li><strong>Rails developer</strong> will setup your Ruby environment using RVM, along with all the supporting things that you will need to get up and running in no time.</li>
</ol>
<p>The installers are updated regularly so check the git pages for full details, but some of the key things that are installed are&#8230;</p>
<p>The <strong>Ubuntu user</strong> installer will hook you up with these (among others)&#8230;</p>
<ul>
<li>Medibuntu repositories</li>
<li>Ubuntu Restricted Extras</li>
<li>Configuration Editor (dconf-tools)</li>
<li>Compiz Config Settings Manager</li>
<li>Synaptic</li>
<li>Terminator</li>
<li>GNOME Tweak Tool</li>
<li>VLC</li>
<li>Jupiter</li>
<li>Caffeine</li>
<li>Web apps and Sushi file previewer</li>
<li>Simple LightDM Manager</li>
<li>Sysmonitor App Indicator</li>
<li>Dropbox</li>
<li>OpenJDK (Java 7) &#8211; optional</li>
</ul>
<p>Some of the things the <strong>Rails developer</strong> installer will setup are&#8230;</p>
<ul>
<li>SSH key &#8211; optional</li>
<li>Essential Ubuntu libraries</li>
<li>Ruby 1.8.7 from Ubuntu repostories with additional libraries</li>
<li>Git and Git Gui</li>
<li>MySQL 5.1 with admin GUI tools</li>
<li>MongoDB 2.0.1 &#8211; optional</li>
<li>ack</li>
<li>ImageMagick</li>
<li>RVM (Ruby Version Manager) with these rubies: 1.8.7 stable and 1.9.2 stable</li>
</ul>
<p>Head over to the git repository for instructions on how to run the installers and also for more details about what it actually installs: </p>
<p><a href="https://github.com/edjames/just_right" title="just_right" target="_blank">https://github.com/edjames/just_right</a></p>
<p>Simples.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itshouldbeuseful.wordpress.com/218/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itshouldbeuseful.wordpress.com/218/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=218&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itshouldbeuseful.wordpress.com/2011/11/28/setting-up-ubuntu-11-10-for-rails-development-just-right/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4b555dd4017f3fd30ccb9094aa03cf6f?s=96&#38;d=wavatar&#38;r=G" medium="image">
			<media:title type="html">rubysoop</media:title>
		</media:content>
	</item>
		<item>
		<title>Nice &amp; clean config using dotfiles</title>
		<link>http://itshouldbeuseful.wordpress.com/2011/11/28/nice-clean-config-using-dotfiles/</link>
		<comments>http://itshouldbeuseful.wordpress.com/2011/11/28/nice-clean-config-using-dotfiles/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 11:43:11 +0000</pubDate>
		<dc:creator>Ed James</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[rake]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://itshouldbeuseful.wordpress.com/?p=214</guid>
		<description><![CDATA[Clean up your shell environment by using my dotfiles project. It&#8217;s as easy as running a simple rake task&#8230; then you have a clean, customizable shell environment all set up and ready to go! Please see the git repository for more details on what is does and how to install. You can find it all [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=214&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Clean up your shell environment by using my <a href="https://github.com/edjames/dotfiles" title="https://github.com/edjames/dotfiles" target="_blank">dotfiles</a> project.</p>
<p>It&#8217;s as easy as running a simple rake task&#8230; then you have a clean, customizable shell environment all set up and ready to go!</p>
<p>Please see the git repository for more details on what is does and how to install.</p>
<p>You can find it all here: <a href="https://github.com/edjames/dotfiles" title="https://github.com/edjames/dotfiles" target="_blank">https://github.com/edjames/dotfiles</a></p>
<p>As mentioned before, you will have to have Rake installed before you run the automated installer, but it will set things up nicely. Just right in fact.</p>
<p>Hope you like it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itshouldbeuseful.wordpress.com/214/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itshouldbeuseful.wordpress.com/214/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=214&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itshouldbeuseful.wordpress.com/2011/11/28/nice-clean-config-using-dotfiles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4b555dd4017f3fd30ccb9094aa03cf6f?s=96&#38;d=wavatar&#38;r=G" medium="image">
			<media:title type="html">rubysoop</media:title>
		</media:content>
	</item>
		<item>
		<title>Setting up Ubuntu 11.10 for Rails development</title>
		<link>http://itshouldbeuseful.wordpress.com/2011/11/23/setting-up-ubuntu-11-10-for-rails-development/</link>
		<comments>http://itshouldbeuseful.wordpress.com/2011/11/23/setting-up-ubuntu-11-10-for-rails-development/#comments</comments>
		<pubDate>Wed, 23 Nov 2011 00:35:25 +0000</pubDate>
		<dc:creator>Ed James</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rvm]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://itshouldbeuseful.wordpress.com/?p=211</guid>
		<description><![CDATA[This method is depricated and has been replaced by an automated installer. See this post for more details: Setting up Ubuntu 11.10 for Rails development… Just Right! The setup for Ubuntu 11.10 almost identical to the 11.04 setup. A few libraries have changed but otherwise it&#8217;s exactly the same. As before, I like to have [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=211&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<blockquote><p><strong>This method is depricated and has been replaced by an automated installer. See this post for more details:<br />
<a href="http://itshouldbeuseful.wordpress.com/2011/11/28/setting-up-ubuntu-11-10-for-rails-development-just-right/" title="just_right">Setting up Ubuntu 11.10 for Rails development… Just Right!</a></strong></p></blockquote>
<p>The setup for Ubuntu 11.10 almost identical to the <a href="http://itshouldbeuseful.wordpress.com/2011/05/04/setting-up-ubu…ls-development/">11.04</a> setup. A few libraries have changed but otherwise it&#8217;s exactly the same.</p>
<p>As before, I like to have a system Ruby installed. This has always been a precautionary measure but has saved me plenty of pain with past installs.</p>
<pre class="brush: plain; title: ; wrap-lines: false; notranslate">
sudo apt-get install build-essential openssl ri ruby ruby1.8 ruby-dev rake libruby1.8 git-gui gitk libxslt1-dev libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison
</pre>
<p>Then install RVM (see the <a href="http://rvm.beginrescueend.com/rvm/install/">RVM website</a> for the latest installation instructions).</p>
<pre class="brush: plain; title: ; wrap-lines: false; notranslate">
$ bash &lt; &lt;(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
</pre>
<p>Then run the following command, and&#8230; <strong>READ THE NOTES!</strong></p>
<pre class="brush: plain; title: ; notranslate">
rvm notes
</pre>
<p>Make sure you read the RVM post-installation notes. You will get an updated list of OS dependencies and instructions on how to modify your .bash file. If you don&#8217;t do this you will probably drive yourself crazy trying to get RVM to work. You will fail.</p>
<p>Finally, install whatever rubies you want:</p>
<pre class="brush: plain; title: ; notranslate">
rvm install 1.8.7
rvm install 1.9.2
rvm install 1.9.3
</pre>
<p>Finally, install MySQL (and the MySQL GUI tools)&#8230;</p>
<pre class="brush: plain; title: ; notranslate">
sudo apt-get install mysql-server libmysqlclient-dev libmysql-ruby mysql-admin
</pre>
<p>Happy coding!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itshouldbeuseful.wordpress.com/211/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itshouldbeuseful.wordpress.com/211/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=211&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itshouldbeuseful.wordpress.com/2011/11/23/setting-up-ubuntu-11-10-for-rails-development/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4b555dd4017f3fd30ccb9094aa03cf6f?s=96&#38;d=wavatar&#38;r=G" medium="image">
			<media:title type="html">rubysoop</media:title>
		</media:content>
	</item>
		<item>
		<title>Run Ruby code from within a shell script</title>
		<link>http://itshouldbeuseful.wordpress.com/2011/11/11/run-ruby-code-from-within-a-shell-script/</link>
		<comments>http://itshouldbeuseful.wordpress.com/2011/11/11/run-ruby-code-from-within-a-shell-script/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 09:59:39 +0000</pubDate>
		<dc:creator>Ed James</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://itshouldbeuseful.wordpress.com/?p=207</guid>
		<description><![CDATA[If you need to run Ruby code from within a shell script, you could easily execute a Ruby script with a simple bash command. This means you will have two files &#8211; one bash script and one Ruby script. However, what if you want to combine the two file into a single file? Simple, using [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=207&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>If you need to run Ruby code from within a shell script, you could easily execute a Ruby script with a simple bash command. This means you will have <strong>two</strong> files &#8211; one bash script and one Ruby script.</p>
<p>However, what if you want to combine the two file into a single file?</p>
<p>Simple, using a <strong>heredoc</strong> in your bash script, we simply pass the entire <strong>heredoc</strong> to the ruby executable. Create a file called <code>hybrid</code> which contains the following code:</p>
<pre class="brush: plain; title: ; notranslate">
#!/usr/bin/env sh

echo &quot;This is bash!&quot;

/usr/bin/env ruby &lt;&lt;-EORUBY

  puts 'This is ruby!'

EORUBY
</pre>
<p>Running the above bash script will produce this:</p>
<pre class="brush: plain; title: ; notranslate">
$ . hybrid
This is bash!
This is ruby!
</pre>
<p>Hope this helps.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itshouldbeuseful.wordpress.com/207/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itshouldbeuseful.wordpress.com/207/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=207&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itshouldbeuseful.wordpress.com/2011/11/11/run-ruby-code-from-within-a-shell-script/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4b555dd4017f3fd30ccb9094aa03cf6f?s=96&#38;d=wavatar&#38;r=G" medium="image">
			<media:title type="html">rubysoop</media:title>
		</media:content>
	</item>
		<item>
		<title>Active Record Migrations without a Rails application&#8230; sort of.</title>
		<link>http://itshouldbeuseful.wordpress.com/2011/11/08/active-record-migrations-without-a-rails-application-sort-of/</link>
		<comments>http://itshouldbeuseful.wordpress.com/2011/11/08/active-record-migrations-without-a-rails-application-sort-of/#comments</comments>
		<pubDate>Tue, 08 Nov 2011 17:02:08 +0000</pubDate>
		<dc:creator>Ed James</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[ActiveRecord]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[migrations]]></category>
		<category><![CDATA[rake]]></category>

		<guid isPermaLink="false">http://itshouldbeuseful.wordpress.com/?p=201</guid>
		<description><![CDATA[If you&#8217;ve ever wanted to take advantage of Active Record&#8217;s powerful migrations functionality without the need for a Rails application, here&#8217;s how to do it. Rather than go through all the details here, I&#8217;ve created a small github repository with a fully-functional demo. It&#8217;s easy to follow and has comments throughout the code. In fact, [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=201&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>If you&#8217;ve ever wanted to take advantage of Active Record&#8217;s powerful migrations functionality without the need for a Rails application, here&#8217;s how to do it.</p>
<p>Rather than go through all the details here, I&#8217;ve created a small github repository with a fully-functional demo. It&#8217;s easy to follow and has comments throughout the code. In fact, there&#8217;s very little code at all!</p>
<p>Here&#8217;s what you&#8217;ll get:</p>
<ul>
<li>Active Record migrations without a Rails web application</li>
<li>A stripped-down list of available Rake tasks &#8211; only the ones you need. No filler.</li>
<li>A clean, DSL-like syntax for generating new migrations, all through the use of Rake tasks.</li>
</ul>
<p>Hopefully this will prove to be useful &#8211; we&#8217;re about to roll this out to our production environments (with a few mods).</p>
<p>Here&#8217;s the code: <a href="https://github.com/edjames/ar_migrations" title="https://github.com/edjames/ar_migrations">https://github.com/edjames/ar_migrations</a></p>
<p>Simples.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itshouldbeuseful.wordpress.com/201/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itshouldbeuseful.wordpress.com/201/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=201&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itshouldbeuseful.wordpress.com/2011/11/08/active-record-migrations-without-a-rails-application-sort-of/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4b555dd4017f3fd30ccb9094aa03cf6f?s=96&#38;d=wavatar&#38;r=G" medium="image">
			<media:title type="html">rubysoop</media:title>
		</media:content>
	</item>
		<item>
		<title>Passing parameters to a Rake task</title>
		<link>http://itshouldbeuseful.wordpress.com/2011/11/07/passing-parameters-to-a-rake-task/</link>
		<comments>http://itshouldbeuseful.wordpress.com/2011/11/07/passing-parameters-to-a-rake-task/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 15:05:29 +0000</pubDate>
		<dc:creator>Ed James</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[rake]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://itshouldbeuseful.wordpress.com/?p=188</guid>
		<description><![CDATA[I&#8217;ve been building a few custom rake tasks of late and I wanted to pass a parameter to one of my tasks. Typically you would use a named variable to do this. However, I wanted a cleaner approach, something which was closer to the syntax used for a Rails generator. So instead of this&#8230; &#8230;or, [&#8230;]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=188&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been building a few custom rake tasks of late and I wanted to pass a parameter to one of my tasks. Typically you would use a named variable to do this. However, I wanted a cleaner approach, something which was closer to the syntax used for a Rails generator.</p>
<p>So instead of this&#8230;</p>
<pre class="brush: plain; title: ; notranslate">
$ rake say_hello NAME=eddie
</pre>
<p>&#8230;or, god forbid, this&#8230;</p>
<pre class="brush: plain; title: ; notranslate">
$ rake say_hello[eddie]
</pre>
<p>&#8230;I wanted something more like this&#8230;</p>
<pre class="brush: plain; title: ; notranslate">
$ rake say_hello eddie
</pre>
<p>Hmm. Seems easy enough, but there&#8217;s a catch. Let&#8217;s look at an example.</p>
<p><strong>Method 1: Using a named variable</strong></p>
<pre class="brush: ruby; title: ; notranslate">
task :say_hello do
  name = ENV['NAME']
  puts &quot;Hello, #{name}.&quot;
end
</pre>
<p>This is the typical approach, examples of which you will find everywhere. Running the task is easy and the intention of the command is clear:</p>
<pre class="brush: plain; title: ; notranslate">
$ rake say_hello NAME=eddie
=&gt; Hello, eddie.
</pre>
<p>Nothing new here.</p>
<p><strong>Method 2: Using arguments</strong></p>
<pre class="brush: ruby; title: ; notranslate">
task :say_hello, :name do |t, args|
  name = args.name
  puts &quot;Hello, #{name}.&quot;
end
</pre>
<p>You would run this task like so&#8230;</p>
<pre class="brush: plain; title: ; notranslate">
$ rake say_hello[eddie]
=&gt; Hello, eddie.
</pre>
<p>This is a slightly more cryptic approach, which I don&#8217;t like at all. The syntax is unintuitive and totally obscures the intention of the command, not to mention the use of square parenthesis to wrap the argument. Ugly!</p>
<p><strong>Method 3: Custom black magic!</strong></p>
<pre class="brush: ruby; title: ; notranslate">
task :say_hello do
  name = ARGV.last
  puts &quot;Hello, #{name}.&quot;
  task name.to_sym do ; end
end
</pre>
<p>For me, this method gives us a much more DSL-like syntax, which seems cleaner and more intuitive (this is obviously entirely dependant on your own set of circumstances). To run the task using this method, you would do this&#8230;</p>
<pre class="brush: plain; title: ; notranslate">
$ rake say_hello eddie
=&gt; Hello, eddie.
</pre>
<p>A few things are happening here that are worth an explanation. </p>
<p><strong>Firstly</strong>, we are using the ARGV collection of command line arguments to grab the value for our argument. Standard Ruby stuff. Beware though, that this collection will contain all the arguments for <strong>Rake</strong>, not our task. That&#8217;s why we grab the last element in the collection because the first element is the name of our rake task. Modifying the task as follows will illustrate this point:</p>
<pre class="brush: ruby; title: ; notranslate">
task :say_hello do
  puts ARGV.inspect
  name = ARGV.last
  task name.to_sym do ; end
end
</pre>
<pre class="brush: plain; title: ; notranslate">
$ rake say_hello eddie
=&gt; [&quot;say_hello&quot;, &quot;eddie&quot;]
</pre>
<p>As you can see, the ARGV collection contains two elements: the name of our rake task and the value of the argument we are trying to set. Grab the last one and we&#8217;re halfway there.</p>
<p><strong>Secondly</strong>, we have to define a new rake task on the fly with the same name as the value of our argument. If we don&#8217;t do this, rake will attempt to invoke a task for each command line argument.</p>
<pre class="brush: plain; title: ; notranslate">
$ rake say_hello eddie
</pre>
<p>By default, the above command will first invoke a task called &#8220;say_hello&#8221;, and then try to invoke a task called &#8220;eddie&#8221;. This behaviour is hard-coded into rake. So, we simply define a &#8220;no op&#8221; task with the corresponding name (&#8220;no op&#8221; means &#8220;no operation&#8221;). This avoids an exception being thrown when rake inevitably doesn&#8217;t find a defined task of that name.</p>
<p>There you have it. A DSL-like syntax for passing arguments to a rake task.</p>
<p>Simples.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/itshouldbeuseful.wordpress.com/188/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/itshouldbeuseful.wordpress.com/188/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=itshouldbeuseful.wordpress.com&#038;blog=20670354&#038;post=188&#038;subd=itshouldbeuseful&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://itshouldbeuseful.wordpress.com/2011/11/07/passing-parameters-to-a-rake-task/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/4b555dd4017f3fd30ccb9094aa03cf6f?s=96&#38;d=wavatar&#38;r=G" medium="image">
			<media:title type="html">rubysoop</media:title>
		</media:content>
	</item>
	</channel>
</rss>
