<?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"
	>

<channel>
	<title>Emson...</title>
	<atom:link href="http://blog.emson.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.emson.co.uk</link>
	<description></description>
	<pubDate>Sat, 20 Sep 2008 23:02:07 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>Chrome is a Desktop Web Application platform</title>
		<link>http://blog.emson.co.uk/2008/09/chrome-is-a-desktop-web-application-platform/</link>
		<comments>http://blog.emson.co.uk/2008/09/chrome-is-a-desktop-web-application-platform/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 15:00:22 +0000</pubDate>
		<dc:creator>ben</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[browsers]]></category>

		<category><![CDATA[google]]></category>

		<category><![CDATA[web apps]]></category>

		<guid isPermaLink="false">http://blog.emson.co.uk/2008/09/chrome-is-a-desktop-web-application-platform/</guid>
		<description><![CDATA[Google Chrome is not just a browser

Google Chrome was launched a few days ago on the 2nd September 2008, since then there has been much hype and articles written about it.  So what is it?
Well, Wikipedia describes it: &#8220;Google Chrome is a free and open source web browser developed by Google.&#8221;, however it is [...]]]></description>
			<content:encoded><![CDATA[<h2>Google Chrome is not just a browser</h2>

<p>Google Chrome was launched a few days ago on the 2nd September 2008, since then there has been much hype and articles written about it.  So what is it?
Well, Wikipedia describes it: <a href="http://en.wikipedia.org/wiki/Google_Chrome">&#8220;Google Chrome is a free and open source web browser developed by Google.&#8221;</a>, however it is more than that.</p>

<p>It comes dressed as a web browser but is actually a <strong>Desktop Web Application platform</strong>.  It facilitates the creation of Web Applications that are desktop like in functionality.
These Web Applications will, be much more responsive, secure and stable than the previous generation of web applications because these new technologies are forming a suitable infrasructure.</p>

<p>It&#8217;s one of the technologies ushering in a new era for the Internet.</p>

<p>I wrote an article recently that describes how these technologies are laying down foundations for applications should use the web: <a href="http://rapidappsgroup.com/content/desktop-web-applications-using-sproutcore/">Desktop web applications using SproutCore/</a></p>

<h2>Why is Chrome significant</h2>

<p>Recently a number of the big Internet centred companies have been making strides to enable the next generation of Web Applications.</p>

<p>Adobe with its AIR technology, Microsoft with Silverlight, Apple with its endorsement of the SproutCore JavaScript framework, and Google, until this announcement, Gears.</p>

<p>The problem is none of these offerings is perfect, and some of them are very much propietary, tying users into their technology.</p>

<p>The problem Google has is that Gears is actually a very good product, but why would anybody download and install it if there aren&#8217;t may web sites using it?  At the moment this is an additional step resulting in the fact that most users have no compelling reason to install it.  In a nut shell nobody is using it.</p>

<p>However with Chrome Google is able to hedge its bets, it has merged several standalone technologies into one very capable and pleasing package.</p>

<ul>
<li>It has an awesome JavaScript engine enabling JavaScript to approach Desktop Application speeds.</li>
<li>It has Gears enabling developers to create offline applications that can interact with your desktop.</li>
<li>It can open a Web Application directly in its own window, without any of the traditional browser tool bar and menu overheads.  Making Web Applications look like Desktop Applications.</li>
<li>It has added stability by making each tab a separate process, essentially each tab behaves like its very own browser.</li>
<li>It is secure in that it has been designed from the ground up following proven security models, such as sandboxing.</li>
<li>Its elegant, meaning that it feels small, light and fit for purpose.  It has taken some leaves out of Apple&#8217;s book and made the UI simple yet powerful.</li>
</ul>

<h2>Chrome is OpenSource and follows standards</h2>

<p>This next era of the Internet is going to very busy.  Everyday there are vast numbers of web pages and Web Applications created, and with this colosal amounts of data and information to sift through.</p>

<p>For an individual it is becoming harder and harder to focus and extract the useful information from all that data.  In essance <strong>attention is a currency</strong> and with all these web sites and applications vying for our eyeballs how do we as users filter the wheat from the chaff?</p>

<p>That part of the Internet isn&#8217;t completely written yet but for certain, by following Web Standards and by incorporating OpenSource technologies we are laying the foundations for future tools to help us do this.  Chrome is one such OpenSource technology.</p>

<p>Chrome needs to follow standards as these will pull it along and it will evolve into something very powerful.  Even if it doesn&#8217;t some of its components may find there way into some technology that does.  I dare say that Google will have a finger in that pie no matter.  As a result it is a win win situation for Google.</p>

<p>This also highlights the point that Microsoft&#8217;s Internet Explorer browser is gradually getting left behind.  Admittedly standards aren&#8217;t followed by all these companies but Microsoft has certainly been more relunctant to endorse them.</p>

<h2>JavaScript is a key web technology</h2>

<p>JavaScript is old, it appeared in the early browser wars and there hasn&#8217;t been any significant changes since.  Its been buggy, doesn&#8217;t scale well, and there are differences on just about every browser implementation, but it is everywhere.</p>

<p>Recently, with Web 2.0, JavaScript has had a bit of a resurgance and some very useful frameworks have emerged which mitigate the implementation issues and improve its stability.  However up until recently it has been slow.  Too slow to be useful in terms of creating sophisticated Desktop like Web Applications.</p>

<p>It seems that in order to compete in the new Desktop Web Application arena companies need to implement a fast JavaScript engine.
Apple&#8217;s Safari is implementing SquirrelFish, and Firefox is implementing TraceMonkey and now Google has created V8.</p>

<p>John Resig has done a <a href="http://ejohn.org/blog/javascript-performance-rundown/">comparison of the relevant JavaScript engines</a> and it seems that V8 is very fast.
Matthieu Riou says that V8 is <a href="http://offthelip.org/?p=113">closer to a compiler than a traditional VM</a>.  It takes JavaScript code and converts it into low level byte code.  It is still early days but we can expect this performance to keep improving.</p>

<h2>Desktop Web Applications, Slickening the Web.</h2>

<p>This era of the Internet is seeing a &#8217;slickening of the web&#8217;.  Web Applications are becoming more Desktop like.  Platforms like Chrome are only going to push us faster along this path.</p>

<p>We can expect to see more applications like Gmail, MobileMe, GoogleMaps, GoogleDocs, etc. but Chrome puts Google very definately in one of the front seats for the future.</p>

<p>Its not fully there yet as its still missing features but it will evolve quickly.
Google has vast resources and is able to test the browser against millions of web sites before it ever sees a user.  This will only help to refine and improve it.</p>

<p>With Google Chrome, the Web is changing up a Gear.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.emson.co.uk/2008/09/chrome-is-a-desktop-web-application-platform/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Cannot select text with mouse in Microsoft Word, fix.</title>
		<link>http://blog.emson.co.uk/2008/08/cannot-select-text-with-mouse-in-microsoft-word-fix/</link>
		<comments>http://blog.emson.co.uk/2008/08/cannot-select-text-with-mouse-in-microsoft-word-fix/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 11:47:30 +0000</pubDate>
		<dc:creator>ben</dc:creator>
		
		<category><![CDATA[windows]]></category>

		<category><![CDATA[word problem]]></category>

		<guid isPermaLink="false">http://blog.emson.co.uk/2008/08/cannot-select-text-with-mouse-in-microsoft-word-fix/</guid>
		<description><![CDATA[A friend had the following problem with their laptop the other day.
When they open Microsoft Word they cannot select any text with the mouse, they couldn&#8217;t even place the cursor into the text by clicking the mouse on the text.

She said that the situation seemed to have occured when Norton Antivirus requested an update at [...]]]></description>
			<content:encoded><![CDATA[<p>A friend had the following problem with their laptop the other day.
When they open Microsoft Word they cannot select any text with the mouse, they couldn&#8217;t even place the cursor into the text by clicking the mouse on the text.</p>

<p>She said that the situation seemed to have occured when Norton Antivirus requested an update at the same time she was doing something in Word.</p>

<p>I suspected that it was that Word had somehow got corrupted, so I ran a repair, by inserting her Microsoft Office DVD and bring up the installer, and selecting <em>Repair</em>.</p>

<p>This made no difference, I then reinstalled Office, still the problem persisted.  This made me think that the problem was related to the Registry, so I did a Google search.</p>

<h2>Fixing Word text selection</h2>

<p>I found these articles:</p>

<ul>
<li><a href="http://support.microsoft.com/kb/921541">http://support.microsoft.com/kb/921541</a> which describes how to troubleshoot problems with Microsoft Word 2007/2003/2002. (Really I&#8217;m not impressed it just stinks of shoddy programming.)</li>
<li><a href="http://www.vistax64.com/vista-general/39390-cant-select-text-word-2007-vista.html">http://www.vistax64.com/vista-general/39390-cant-select-text-word-2007-vista.html</a></li>
</ul>

<p>To summarise the fix:</p>

<ul>
<li>Backup the Word\Data part of the Registry first</li>
<li>delete the the Word\Data section</li>
<li>restart Word </li>
<li>if it works then its completed, else restore the backup and keep Google searching.</li>
</ul>

<h3>Warning about Word registry changes</h3>

<p>This fix involves removing the Word/Data registry key.  By deleting this key you will loose some options you have set, this just means that you will need to reset them again.  Additionally you will loose the list of files in your <em>recently used files list</em> at the bottom of the file menu.</p>

<p>Additionally be really careful about deleting anything out of the registry, because it can cause serious problems.  All the main Windows programs use it, and you could end up reinstalling everything including your copy of Windows.</p>

<h3>Backup the offending part of your computer&#8217;s registry:</h3>

<ol>
<li>Exit all Office programs, Word, Excel, Outlook etc if they are running.</li>
<li>Open regedit by: Clicking <strong>Start/Run</strong>, then type <strong>regedit</strong>, and select <strong>OK</strong>.</li>
<li><p>Navigate the registry and select the appropriate Word registry subkey:</p>

<ul>
<li><strong>Word 2002:</strong> <br/>HKEY_CURRENT_USER\Software\Microsoft Office\10.0\Word\Data</li>
<li><strong>Word 2003:</strong> <br/>HKEY_CURRENT_USER\Software\Microsoft Office\11.0\Word\Data</li>
<li><strong>Word 2007:</strong> <br/>HKEY_CURRENT_USER\Software\Microsoft Office\12.0\Word\Data</li>
</ul></li>
<li><p>Select the Data node, then from the <strong>File</strong> menu choose <strong>Export</strong>.</p></li>
<li>Name this backup file something like <strong>word_data.reg</strong>, and save it your desktop.</li>
</ol>

<h3>Delete the Word\Data registry node</h3>

<ol>
<li>Select the appropriate Word\Data node mentioned in part 3.</li>
<li>From the <strong>Edit</strong> menu select <strong>Delete</strong>, and then click <strong>Yes</strong>.</li>
<li>Exit regedit.</li>
</ol>

<h3>Restart Word</h3>

<ol>
<li>Restart Word.  This will cause Word to recreate this registry node, but you may have to re-enter some of your Word options.  If everything is working as expected you can finish.  If you still have a problem follow the next section.</li>
</ol>

<h3>Restore the backed up registry node</h3>

<p>If the problem still persists then restore your registry back, and keep looking for a solution.
To restore the registry back to normal simply:</p>

<ul>
<li>Double-click the <strong>word_data.reg</strong> file on your desktop.</li>
<li>and select <strong>Yes</strong>, and then <strong>OK</strong>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.emson.co.uk/2008/08/cannot-select-text-with-mouse-in-microsoft-word-fix/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Everyday MySQL Commands</title>
		<link>http://blog.emson.co.uk/2008/08/everyday-mysql-commands/</link>
		<comments>http://blog.emson.co.uk/2008/08/everyday-mysql-commands/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 00:45:51 +0000</pubDate>
		<dc:creator>ben</dc:creator>
		
		<category><![CDATA[databases]]></category>

		<category><![CDATA[sql]]></category>

		<category><![CDATA[mysql]]></category>

		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://blog.emson.co.uk/2008/08/everyday-mysql-commands/</guid>
		<description><![CDATA[I&#8217;m trying to put together a number of blog articles and many of them use the MySQL database, so I figured that I would post up some of my most used everyday MySQL SQL commands.  Most likely I will append further commands as I write more articles so this is page is really a [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m trying to put together a number of blog articles and many of them use the MySQL database, so I figured that I would post up some of my most used everyday MySQL SQL commands.  Most likely I will append further commands as I write more articles so this is page is really a work in progress.</p>

<p>I&#8217;ve also assumed that you want to have full rights when executing these commands so I&#8217;ve used <strong>sudo</strong>, however you may not need this depending on your set up.</p>

<p>Finally if some other web site covers the command better or I&#8217;m feeling lazy I&#8217;ll just pop it in the links list at the bottom of this page.</p>

<h2>Useful MySQL Commands</h2>

<h3>Starting MySQL Demon</h3>

<p>Start your MySQL database and get it running as a background process:</p>

<pre><code>sudo mysqld_safe
Ctrl + Z
bg
</code></pre>

<h3>MySQL create databases script</h3>

<p>Make a SQL script that creates 3 databases and assigns all rights to my username.
Copy the following SQL and paste it into a file called <strong>create_databases.sql</strong>:</p>

<pre><code>create database mydb_development;
create database mydb_test;
create database mydb_production;
grant all on mydb_development.* to 'my_username'@'localhost';
grant all on mydb_test.* to 'my_username'@'localhost';
grant all on mydb_production.* to 'my_username'@'localhost' identified by 'my_password';
</code></pre>

<h3>MySQL drop databases script</h3>

<p>Make a script to drop databases.
Copy the following SQL and paste it into a file called <strong>drop_databases.sql</strong>:</p>

<pre><code>drop database nemos_production;
drop database mydb_development;
drop database nemos_test;
</code></pre>

<h3>Executing a script from MySQL</h3>

<p>The above scripts can be executed from the command-line with the either of these commands:</p>

<pre><code>sudo mysql &lt; create_database.sql
or
sudo mysql &lt; drop_database.sql
</code></pre>

<h3>Showing MySQL databases</h3>

<p>To check that the databases were created :</p>

<pre><code>sudo mysqlshow
or
sudo mysql
show databases;
</code></pre>

<h3>Displaying database tables</h3>

<p>Displaying the tables of a database:</p>

<pre><code>sudo mysqlshow mydb_development
or
sudo mysql
show tables from mydb_development;
</code></pre>

<h3>Displaying details about a database table</h3>

<p>Displaying details about a particular database table:</p>

<pre><code>sudo mysqlshow mydb_development mytable
</code></pre>

<h3>Droping a database table</h3>

<p>Dropping a table from a database:</p>

<pre><code>sudo mysql
use mydb_development;
drop table mytable;
</code></pre>

<h3>Displaying information about a table</h3>

<p>Displaying the fields and field metadata about a table:</p>

<pre><code>show fields from my_table; 
or
desc my_table;
</code></pre>

<h2>Useful Links</h2>

<ul>
<li><a href="http://openmaniak.com/mysql.php">http://openmaniak.com/mysql.php</a></li>
</ul>

<p>These are just a few quick and simple MySQL commands that you will always use.
Hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.emson.co.uk/2008/08/everyday-mysql-commands/feed/</wfw:commentRss>
		</item>
		<item>
		<title>SproutCore and Web Applications</title>
		<link>http://blog.emson.co.uk/2008/08/sproutcore-and-web-applications/</link>
		<comments>http://blog.emson.co.uk/2008/08/sproutcore-and-web-applications/#comments</comments>
		<pubDate>Mon, 18 Aug 2008 10:00:56 +0000</pubDate>
		<dc:creator>ben</dc:creator>
		
		<category><![CDATA[business]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[sproutcore javascript ruby]]></category>

		<guid isPermaLink="false">http://blog.emson.co.uk/?p=15</guid>
		<description><![CDATA[It&#8217;s been a wee while since my last article, which has largely been due to my summer holiday.
Anyway I&#8217;ve been reading up and experimenting with the SproutCore JavaScript framework.

Its excellent but I wanted to explain why companies and developers should consider using it.  So I&#8217;ve written an article on my business partner&#8217;s web site [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a wee while since my last article, which has largely been due to my summer holiday.
Anyway I&#8217;ve been reading up and experimenting with the <a href="http://www.sproutcore.com">SproutCore</a> JavaScript framework.</p>

<p>Its excellent but I wanted to explain why companies and developers should consider using it.  So I&#8217;ve written an article on my business partner&#8217;s web site <a href="http://rapidappsgroup.com/content/desktop-web-applications-using-sproutcore/">http://rapidappsgroup.com/content/desktop-web-applications-using-sproutcore/</a>. <br/></p>

<p>Please check it out as it tries to answer a lot of the general questions about web applications and JavaScript frameworks.</p>

<p>BE&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.emson.co.uk/2008/08/sproutcore-and-web-applications/feed/</wfw:commentRss>
		</item>
		<item>
		<title>An Almost Fix for Creating RubyGems on Windows</title>
		<link>http://blog.emson.co.uk/2008/06/an-almost-fix-for-creating-rubygems-on-windows/</link>
		<comments>http://blog.emson.co.uk/2008/06/an-almost-fix-for-creating-rubygems-on-windows/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 14:20:25 +0000</pubDate>
		<dc:creator>ben</dc:creator>
		
		<category><![CDATA[ruby]]></category>

		<category><![CDATA[windows]]></category>

		<category><![CDATA[gems]]></category>

		<guid isPermaLink="false">http://blog.emson.co.uk/2008/06/an-almost-fix-for-creating-rubygems-on-windows/</guid>
		<description><![CDATA[Introduction

I wrote this article originally so that I could write command-line apps using Ruby, as I got further and further down the line I realised that what I really wanted to do was create a command-line app using RubyGems.  I use both Windows and an Apple Mac and I quickly found myself having problems [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>

<p>I wrote this article originally so that I could write command-line apps using Ruby, as I got further and further down the line I realised that what I really wanted to do was create a command-line app using RubyGems.  I use both Windows and an Apple Mac and I quickly found myself having problems trying to create RubyGems on Windows.</p>

<p>In this article I try to explain my thought process and the problems I encountered.  Unfortunately I had to employ a manual process when trying to package up my project into a <em>tar</em> file, as there isn&#8217;t a simple way to do this in Windows (let me know if you have a solution), however everything else seems to work.</p>

<h2>What&#8217;s a RubyGem?</h2>

<p>One of the joys of Ruby is the <a href="http://www.rubygems.org/">RubyGems</a> packaging system. 
It is essentially a tool written in Ruby, for packaging up source code for deployment.</p>

<p>The RubyGems site describes it as follows:</p>

<blockquote>
  <p>RubyGems is the premier ruby packaging system. It provides:</p>
  
  <ul>
  <li>A standard format for destributing Ruby programs and libraries.</li>
  <li>An easy to use tool for managing the installation of gem packages.</li>
  <li>A gem server utility for serving gems from any machine where RubyGems is installed.</li>
  </ul>
</blockquote>

<h2>Why should I create a RubyGem?</h2>

<p>Maybe a better question should be <em>when</em> should I package my code up into a RubyGem.  Obviously there are no hard and fast rules but if you are going to share your code libraries with others or even with other applications of yours, you should think about using a gem.</p>

<p>Now you might think that you don&#8217;t want to make all your code public on <a href="http://rubyforge.org/">RubyForge</a>, and there are very good reason not to publish every gem, so you don&#8217;t have to.
RubyGems comes with its own <em>local</em> gem server so you can create your own gem library and share it amoung your other Ruby applications.</p>

<p>This is really quite useful, you get the power of RubyGems without the commitment and maintenance work of making your code OpenSource.  Plus at any point in time you can then make it OpenSource, and live off the joy of the Ruby community :).</p>

<p>The reason I wrote this article is because I wanted to create a simple command-line application using Ruby. I went through a number of steps before realising that the best way was to use RubyGems.</p>

<p>I started by creating my own command-line structure and then found this great article by <a href="http://blog.infinitered.com/entries/show/5">Todd Werth</a>.  He has a single Ruby file that you just replace various sections and viola you have a very simple command-line app.  But it wasn&#8217;t quite what I wanted.  I didn&#8217;t want to have to type:</p>

<pre><code>./my_super_app 'some params'
</code></pre>

<p>I wanted to type:</p>

<pre><code>my_super_app 'some params'
</code></pre>

<p>I also wanted the structure of the application to follow a standard structure and I didn&#8217;t want to put &#8216;.&#8217; into my path, for security reasons.
<a href="http://drnicwilliams.com/">Dr Nic</a> came to the rescue with a couple of excellent articles describing how to <a href="http://drnicwilliams.com/2006/10/11/generating-new-gems/">create gems using <strong>newgem</strong></a> and specifically <a href="http://drnicwilliams.com/2006/10/18/create-and-deploy-command-line-apps-with-rubygems/">command-line apps as gems</a>.</p>

<h2>Installing newgem on Windows</h2>

<p>To install <strong>newgem</strong> on Windows use the RubyGems install method.</p>

<pre><code>gem install newgem
</code></pre>

<p>This will install the gem and its dependencies.  However one of its dependencies is the <a href="http://seattlerb.rubyforge.org/hoe/">Hoe gem</a>, and there is a slight issue using it on Windows.</p>

<h3>What is hoe?</h3>

<p>Hoe is a compliment to <strong>rake</strong>, it was created by <a href="http://zenspider.com/">Ryan Davis</a> and provides <strong>rake</strong> tasks for testing, packaging, and releasing RubyGems.  <a href="http://nubyonrails.com/articles/tutorial-publishing-rubygems-with-hoe">Geoffrey Grosenbach has a nice tutorial for using hoe</a> and also describes how to create a project structure using the <strong>sow</strong> task.</p>

<p>Hoe uses a <strong>.hoerc</strong> file for configuration, and this file should reside in the user&#8217;s home directory, something like:</p>

<pre><code>C:\Documents and Settings\MyUserName
</code></pre>

<p>An example <strong>.hoerc</strong> file should look like the one below.  Please note that this is a <a href="http://en.wikipedia.org/wiki/YAML">YAML</a> file and if you copy it from here remember to follow the indentation convention:</p>

<pre><code>---
publish_on_announce: false
exclude: !ruby/regexp/tmp$|CVS|\.svn|_darcs|\.git|log$|local/.*\.rb$|Makefile|.*\.o$|.*\.bundle$|.*\.so$|.*\.dll$/ 
str: ""
"@taguri": tag:ruby.yaml.org,2002:regexp/tmp$|CVS|\.svn|_darcs|\.git|log$|local/.*\.rb$|Makefile|.*\.o$|.*\.bundle$|.*\.so$|.*\.dll$/
blogs:
- user: user
  url: url
  extra_headers:
    mt_convert_breaks: markdown
  blog_id: blog_id
  password: password
</code></pre>

<p>On Unix systems there is a shortcut to the user&#8217;s home directory which is &#8216;~&#8217; and on Windows this isn&#8217;t a shortcut.  Windows however does have an environment variable <strong>HOMEPATH</strong> which will point to the user&#8217;s home directory.  The problem is that the Hoe gem code uses &#8216;~&#8217; in its <strong>hoe.rb</strong> file and this causes problems for Windows users.</p>

<h3>Patching the hoe.rb file</h3>

<p>OK, be brave, lets tweak the hoe.rb file so that it will work on the Windows platform.
The Hoe gem <strong>hoe.rb</strong> file can be found in the following directory (assuming you installed Ruby to the standard location):</p>

<pre><code>C:\ruby\lib\ruby\gems\1.8\gems\hoe-1.6.0\lib
</code></pre>

<p>To make it work for Windows PCs you will need to modify this file with the following changes.</p>

<p>Locate the <strong>define_tasks</strong> method:</p>

<pre><code>def define_tasks # :nodoc:
  def with_config # :nodoc:
    rc = File.expand_path("~/.hoerc")
    exists = File.exist? rc
    config = exists ? YAML.load_file(rc) : {}
    yield(config, rc)
  end
</code></pre>

<p>And add a new method above it such as this, and modify the line <strong>rc = File.expand_path(&#8221;~/.hoerc&#8221;)</strong> as below:</p>

<pre><code>def get_home_dir
  home_file_path = "~/"
  home_file_path = "#{ENV['HOMEPATH']}\\&#8221; if WINDOZE
  home_file_path
end

def define_tasks # :nodoc:
 def with_config # :nodoc:
   rc = File.expand_path(get_home_dir + &#8216;.hoerc&#8217;)
   exists = File.exist? rc
   config = exists ? YAML.load_file(rc) : {}
   yield(config, rc)
 end
</code></pre>

<p>Finally you will need to locate and change the <strong>task :config_hoe</strong> so that it reads:</p>

<pre><code>"signing_key_file" =&gt; "#{get_home_dir}.gem/gem-private_key.pem",
"signing_cert_file" =&gt; "#{get_home_dir}.gem/gem-public_cert.pem",
</code></pre>

<p>If all has gone correctly save this file and you are now ready to create a RubyGem.</p>

<h2>Creating a basic RubyGem</h2>

<p>Using the <strong>newgem</strong> RubyGem enter the following command at the command prompt:</p>

<pre><code>newgem my_app -b greetings -T rspec -W
</code></pre>

<p>This will create a <strong>my_app</strong> subdirectory, with a command-line command app called <em>greetings</em> located in the <strong>bin</strong> directory.  It will use the testing framework <em>RSpec</em> and finally will not generate the RubyForge web site code.  This is assuming you don&#8217;t want to relese your code as OpenSource.
The output will be something like this:</p>

<pre><code>     create
     create  config
     create  doc
     create  lib
     create  script
     ... blah ...
     create  script/console
     create  script/console.cmd
     create  Manifest.txt
     readme  readme
Important
=========

* Open config/hoe.rb
* Update missing details (gem description, dependent gems, etc.)
</code></pre>

<p>If you want to add <a href="http://blog.emson.co.uk/2008/06/understanding-rspec-stories-a-tutorial/">RSpec Stories</a> to this project there is a useful command-line generator to do this.  First navigate into the root of you new project app directory, in this case <strong>my_app</strong>.  Now execute the generate script:</p>

<pre><code>ruby script/generate install_rspec_stories
</code></pre>

<p>You should then get the following output:</p>

<pre><code>  create  stories/steps
  create  stories/steps/my_app_steps.rb
  create  stories/sell_my_app.story
  create  stories/all.rb
</code></pre>

<p>Modify your <strong>greetings</strong> command so that it does something.  Do this by editing the file located here:</p>

<pre><code>my_app/bin/greetings
</code></pre>

<p>Open up this file and at the very end, add some code such as this, and save the file:</p>

<pre><code># do stuff
puts 'Greetings the world is my oyster!'
</code></pre>

<h3>Packaging caveat</h3>

<p>As mentioned in the begining of this article I couldn&#8217;t use <strong>rake</strong> to <em>tar</em> this project up for deployment to RubyForge.
The reason is that <strong>rake</strong> makes a Unix platform dependent call to <em>tar</em> the package using a Ruby task file <strong>packagetask.rb</strong> located:</p>

<pre><code>C:\ruby\lib\ruby\gems\1.8\gems\rake-0.8.1\lib\rake 
</code></pre>

<p>This means that on Windows you will have to manually <em>tar</em> this file.</p>

<p>However you can still create the gem using the rake task, and a gem file <strong>my_app-0.0.1.gem</strong>, will appear in the <strong>pkg</strong> directory:</p>

<pre><code>rake gem
</code></pre>

<p>This new RubyGem can now be installed by using the <strong>gem install</strong> commands:</p>

<pre><code>gem install pkg/my_app-0.0.1.gem
</code></pre>

<p>You should get the following output:</p>

<pre><code>For more information on my_app, see http://my_app.rubyforge.org

NOTE: Change this information in PostInstall.txt
You can also delete it if you don't want it.


Successfully installed my_app, version 0.0.1
Installing ri documentation for my_app-0.0.1...
Installing RDoc documentation for my_app-0.0.1...
</code></pre>

<p>Finally you should now be able to execute your command-line command in the command prompt, simply by typing:</p>

<pre><code>greetings
</code></pre>

<p>I hope this is useful and helps with your understanding of how RubyGems work, specifically on Windows, also please jot down some comments if you have any ideas or suggestions.</p>

<h2>Links</h2>

<p>Here is a list of useful RubyGems links:</p>

<ul>
<li><a href="http://www.rubygems.org/">RubyGems.org</a></li>
<li><a href="http://www.linuxjournal.com/article/8967">Linux Journal article about RubyGems</a></li>
<li><a href="http://drnicwilliams.com/2006/10/11/generating-new-gems/">Dr Nic&#8217;s generating new gems article</a></li>
<li><a href="http://drnicwilliams.com/2006/10/18/create-and-deploy-command-line-apps-with-rubygems/">Dr Nic&#8217;s article for creating and deploying command line apps</a></li>
<li><a href="http://nubyonrails.com/articles/tutorial-publishing-rubygems-with-hoe">NubyOnRails article for using Hoe</a></li>
<li><a href="http://blog.jayfields.com/2006/10/ruby-project-tree.html">Jay Fields Ruby Project Tree</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.emson.co.uk/2008/06/an-almost-fix-for-creating-rubygems-on-windows/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Understanding RSpec Stories - a Tutorial</title>
		<link>http://blog.emson.co.uk/2008/06/understanding-rspec-stories-a-tutorial/</link>
		<comments>http://blog.emson.co.uk/2008/06/understanding-rspec-stories-a-tutorial/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 22:53:30 +0000</pubDate>
		<dc:creator>ben</dc:creator>
		
		<category><![CDATA[ruby]]></category>

		<category><![CDATA[rspec]]></category>

		<category><![CDATA[unittests]]></category>

		<guid isPermaLink="false">http://blog.emson.co.uk/2008/06/understanding-rspec-stories-a-tutorial/</guid>
		<description><![CDATA[When I initially started writing this RSpec guide I had planned to cover both traditional RSpec Specs and the new Stories feature, however the guide quickly became to big so I decided to focus purely on RSpec Ruby Stories, as opposed to RSpec Rails Stories.

Why Unit Testing?

Every pragmatic programmer tells us that we should be [...]]]></description>
			<content:encoded><![CDATA[<p>When I initially started writing this RSpec guide I had planned to cover both traditional RSpec <em>Specs</em> and the new <em>Stories</em> feature, however the guide quickly became to big so I decided to focus purely on RSpec Ruby Stories, as opposed to RSpec Rails Stories.</p>

<h2>Why Unit Testing?</h2>

<p>Every pragmatic programmer tells us that we should be writing unit tests, but are they really that important?  Well unfortunately they are.  Unit test ensure that we write good quality code mitigating the number of bugs we introduce into a software system.
However more than that, they help us think about the problem from different perspectives which leads to further insights and gradually makes the domain problems more manageable.</p>

<p><a href="http://en.wikipedia.org/wiki/Unit_test">Unit testing</a> is especially important when the language you use is interpreted.  With compiled languages like C and C++ for example, the compiler picks up on compile time errors, however with interpreted languages like Ruby, Perl and Python there is no compiler and bugs can easily be introduced which won&#8217;t be uncovered until the interpreter executes that branch of the code.</p>

<p>Traditionally tests have been written using a Unit Test framework like JUnit, NUnit or RUnit.  However it is easy to spending a lot of time writing tests that test every unit of code in your software system, what RSPec does is to provide a subtle shift of focus from Unit testing to Behaviour testing or <a href="http://behaviour-driven.org/">Behaviour Driven Development (BDD)</a>.  By focusing on the behaviour of the system it helps clarify in our minds what the system should actually be doing.  It also means that our energy is directed at more &#8216;useful&#8217; tests.  Useful tests, cover what the system should be doing and build in enough redundancy so that it should be easy to <a href="http://en.wikipedia.org/wiki/Refactoring">refactor</a> our code without having to re-write every test.</p>

<h2>What is RSpec?  Give me some background.</h2>

<p>RSpec is a Behavioural Driven Development (BDD) tool, originally created by Dave Astels and Steven Baker.</p>

<p>However <a href="http://blog.davidchelimsky.net">David Chelimsky</a> is really the gatekeeper of the RSpec project, and because it is an OpenSource project you can find the code on the <a href="http://github.com/dchelimsky/rspec/tree/master">GitHub RSpec Repository</a>.  If you would like to use <a href="http://en.wikipedia.org/wiki/Git_%28software%29">Git</a> to &#8216;check out&#8217; a copy of the source code see my article:  <a href="http://blog.emson.co.uk/2008/06/installing-a-git-client-on-osx/">Installing Git on Apple OSX</a></p>

<p>RSpec is really two projects merged into one.  The RSpec project pages describes these merged projects as:</p>

<ul>
<li>a Story Framework for describing behaviour at the application level</li>
<li>a Spec Framework for describing behaviour at the object level</li>
</ul>

<p><a href="http://dannorth.net/2007/06/introducing-rbehave">Dan North created rbehave</a> which is the Story framework and he describes it as:</p>

<blockquote>
  <p><strong>rbehave</strong> is a framework for defining and executing application requirements. 
   Using the vocabulary of behaviour-driven development, you define a feature 
   in terms of a Story with Scenarios that describe how the feature behaves. 
   Using a minimum of syntax (a few “quotes” mostly), this becomes an executable 
   and self-describing requirements document.</p>
</blockquote>

<p>The Spec framework was created by David Chelimsky, and is orientated at testing the behaviour of objects in your system.</p>

<p>By encompassing two frameworks RSpec equips a programmer with a thorough set of testing tools, allowing you to think about your software problem from a number of perspectives.</p>

<h2>What is an RSpec Story?</h2>

<p><a href="http://dannorth.net/whats-in-a-story">Dan North</a> has a good article about what a Story actually is, but here is a quick summary.  A Story describes the functionality of a specific software feature, and it describes it in a way that is easy to understand from the point of view of a client.  In fact a story should be thought of as a conversation between a client and a programmer over some feature of the software. <br/>
As this story unfolds the programmer guides the client by prompting different <strong>Scenarios</strong> and using specific words <strong>Given, When</strong> and <strong>Then</strong>, to capture the essence of the systems behaviour.</p>

<p>A typical story template will take this structure but does not necessarily have to:</p>

<pre><code>Title (one line describing the story)

Narrative:
As a [role]
I want [feature]
So that [benefit]

Acceptance Criteria: (presented as Scenarios)

Scenario 1: Title
Given [context]
  And [some more context]&#8230;
When  [event]
Then  [outcome]
  And [another outcome]&#8230;

Scenario 2: &#8230;
</code></pre>

<p>The key points to a story are:</p>

<ul>
<li><strong>Title</strong> - this should describe an activity or action</li>
<li><strong>Narrative</strong> - should include a <em>role</em>, <em>feature</em> and a <em>benefit</em>. &#8220;As a [role] I want [feature] so that [benefit]&#8220;</li>
<li><strong>Scenario</strong> - describes what is different in the story. NB you can have a number of different scenarios.</li>
<li><strong>Scenario: Given/Events/Outcomes</strong> - Given [some context], When [I do something], Then [this happens].  It is important to use the Given, When, Then language.</li>
<li><strong>Givens</strong> should define all of, and no more than, the required context</li>
<li><strong>Event</strong> should describe the feature</li>
</ul>

<p>RSpec actually has <a href="http://blog.davidchelimsky.net/articles/2007/10/21/story-runner-in-plain-english">four implementations of a Story</a>, which given the sporadic documentation can lead to much confusion.  Essentially from an RSpec point of view a Story consists of three parts:</p>

<ul>
<li>the <strong>Story</strong></li>
<li><strong>Steps</strong> that the Story undertakes</li>
<li><strong>Components</strong> to be tested, described by the Story</li>
</ul>

<h3>Installing RSpec on Apple OSX</h3>

<p>The quickest and easiest way to install RSpec is to use Ruby gems.  In the Apple <strong>Terminal.app</strong> command prompt enter the following command, and install RSpec as root:</p>

<pre><code>sudo gem install -r rspec
</code></pre>

<p>It should be noted that according to how you have setup your Mac, you may need to use <strong>sudo</strong> to install this gem.
If all goes well you should get output such as this:</p>

<pre><code>Bulk updating Gem source index for: http://gems.rubyforge.org/
Successfully installed rspec-1.1.4
1 gem installed
Installing ri documentation for rspec-1.1.4...
Installing RDoc documentation for rspec-1.1.4...
</code></pre>

<p>Finally if you are an Apple user and are using <a href="http://www.macromates.com">TextMate</a> you might want to read my article on how to <a href="http://blog.emson.co.uk/2008/06/installing-the-latest-rspec-textmate-bundle/">install the TextMate RSpec bundle</a>.</p>

<h2>How to Create an RSpec Story</h2>

<p>The simplest type of RSpec Story consists of a single file that contains both the Story and the executable Steps, all you need to do is require the library or class you wish to test.<br/>
For example if we wish to use RSpec to test an <strong>Account</strong> object you would create your library file such as <strong>account.rb</strong>:</p>

<pre><code>class Account
  attr_accessor :balance

  def initialize(amount)
    @balance = amount
  end

  def transfer_to(account, amount)
    @balance = @balance - amount.to_f
    account.balance = account.balance.to_f + amount.to_f
  end
end
</code></pre>

<p>Now create your RSpec Story and save this file as <strong>account_story.rb</strong> with the following content.  Note that on Apple OSX systems you seem to have to require the <strong>rubygems</strong> library:</p>

<pre><code>require 'rubygems'
require 'spec'
require 'spec/story'
require 'account'

Story "transfer to cash account",
%(As a savings account holder
  I want to transfer money from my savings account
  So that I can get cash easily from an ATM) do

  Scenario "savings account is in credit" do
    Given "my savings account balance is", 100 do |balance|
      @savings_account = Account.new(balance)
    end
    And "my cash account balance is", 10 do |balance|
      @cash_account = Account.new(balance)
    end
    When "I transfer", 20 do |amount|
      @savings_account.transfer_to(@cash_account, amount)
    end
    Then "my savings account balance should be", 80 do |expected_amount|
      @savings_account.balance.should == expected_amount
    end
    And "my cash account balance should be", 30 do |expected_amount|
      @cash_account.balance.should == expected_amount
    end
  end

  Scenario "savings account is overdrawn" do
    Given "my savings account balance is", -20
    And "my cash account balance is", 10
    When "I transfer", 20
    Then "my savings account balance should be", -40
    And "my cash account balance should be", 30
  end
end
</code></pre>

<p>Note that although you did not explicitly define the code in the Steps of the second Scenario the RSpec framework uses the <strong>Given, When, Then</strong> methods defined in the first Scenario.
In fact if you look at the Story and think of it as a plain old Ruby code file you gradually understand what is happening.  The file defines a number of methods <strong>Story, Scenario, Given, When</strong> and <strong>Then</strong>, note that when RSpec analyses this Story file it parses the two Scenarios and is able to match the <strong>Given, When, Then</strong> methods with the other Scenario.</p>

<h2>RSpec Plain Text Stories</h2>

<p>This previous example gives us the basic understanding of how a Story works and is structured, but what about the RSpec plain text stories, how do I create one and how are they structured?</p>

<p>The goal of a Plain Text Story is to extract the Steps into a separate file and write the Story in such a way that it looks just like plain text with no Ruby code.  In fact it is possible to name the Story file such that it does not even have the <strong>.rb</strong> file extension.</p>

<p>However by extracting the Steps from the Story we will require a helper file to bind the Story to the Steps.  Therefore a plain text Story file will consist of four parts:</p>

<ul>
<li>the <strong>Story</strong></li>
<li><strong>Steps</strong> that the Story undertakes</li>
<li><strong>Components</strong> to be tested, described by the Story</li>
<li><strong>Helper</strong> file to bind the Story to the Steps</li>
</ul>

<p>There isn&#8217;t any hard and fast rules about how you should structure the file system with respect to Stories and Steps, however best practice seems to describe a <strong>stories</strong> directory and a <strong>steps</strong> subdirectory.</p>

<pre><code>stories +
        + steps
</code></pre>

<p>Story files are created without the <strong>.rb</strong> file extension and are placed in the stories directory and consequently a Step file is created with the same name as the Story file, but with <strong>_step.rb</strong> extension.
Helper files can be put in the stories directory, and should have the same name as the story file but this time with the <strong>.rb</strong> file extension.</p>

<p>Create a Story file with the following file name, <strong>bank</strong></p>

<pre><code>This is a story about an transferring money between bank accounts. 
Note that the text up here above the Story: declaration won't be 
processed, so you can write whatever you wish!

Story: transfer to cash account
  As a savings account holder
  I want to transfer money from my savings account
  So that I can get cash easily from an ATM

  Scenario: savings account is in credit
    Given my savings account balance is '100'
    And my cash account balance is '10'
    When I transfer '20'
    Then my savings account balance should be '80'

  Scenario: savings account is overdrawn
    Given my savings account balance is '-20'
    And my cash account balance is '10'
    When I transfer '20'
    Then my savings account balance should be '-40'
</code></pre>

<p>Now create a steps file with the following name and place it in the steps directory, <strong>bank_steps.rb</strong></p>

<pre><code>require 'rubygems'
require 'spec/story'
require 'spec/story/extensions/main'
require File.join(File.dirname(__FILE__), "../account")

steps_for(:bank) do
  Given("my savings account balance is '$savings'") do |savings|
    @savings_account ||= Account.new(savings)
  end
end

steps_for(:bank) do
  Given("my cash account balance is '$cash'") do |cash|
    @cash_account ||= Account.new(cash)
  end
end

steps_for(:bank) do
  When("I transfer '$amount'")  do |amount|
     @savings_account.transfer_to(@cash_account, amount)
  end
end

steps_for(:bank) do
  Then("my savings account balance should be '$expected_amount'") do |expected_amount| 
     @savings_account.balance.should == expected_amount.to_f
  end
end
</code></pre>

<p>The helper file by default is given the same name as the Story file but this time <strong>with the .rb</strong> extension.  Here is an example of such a file, called <strong>bank.rb</strong>.</p>

<pre><code>#!/usr/bin/env ruby
require 'rubygems'
require 'spec'
require 'spec/story/runner'
require 'account'

# require all the steps files so that we can link the story to them
Dir[File.join(File.dirname(__FILE__), "steps/*.rb")].each do |file|
  require file
end

# execute the steps in the steps file
with_steps_for :bank do
  run File.expand_path(__FILE__).gsub(&#8221;.rb&#8221;,&#8221;")
end
</code></pre>

<p>Now to run this story all you have to do is from the Apple <strong>Terminal.app</strong> navigate to the stories directory and execute the following Ruby command:</p>

<pre><code>ruby bank.rb
</code></pre>

<p>If all is successful you should see the following output:</p>

<pre><code>requiring files ./steps/addition_steps.rb
requiring files ./steps/bank_steps.rb
Running 2 scenarios

Story: transfer to cash account

  As a savings account holder
  I want to transfer money from my savings account
  So that I can get cash easily from an ATM

  Scenario: savings account is in credit

    Given my savings account balance is '100'
    And my cash account balance is '10'

    When I transfer '20'

    Then my savings account balance should be '80'

  Scenario: savings account is overdrawn

    Given my savings account balance is '-20'
    And my cash account balance is '10'

    When I transfer '20'

    Then my savings account balance should be '-40'

2 scenarios: 2 succeeded, 0 failed, 0 pending
</code></pre>

<p>I hope this gives you a good introduction and a basis for understanding how RSpec Stories work.  Finally here are a list of links which may help you further:</p>

<ul>
<li><p><a href="http://blog.davidchelimsky.net/articles/2007/05/14/an-introduction-to-rspec-part-i">An introduction to RSpec - Part I</a></p></li>
<li><p><a href="http://blog.davidchelimsky.net/articles/2007/10/21/story-runner-in-plain-english">An introduction to RSpec Stories - Part I</a></p></li>
<li><p><a href="http://blog.davidchelimsky.net/articles/2007/10/22/plain-text-stories-on-rails">An introduction to RSpec Stories - Part II</a>, although the <em>run_story</em> method now seems to be depreciated in the source code.</p></li>
<li><p><a href="http://blog.davidchelimsky.net/articles/2007/10/25/plain-text-stories-part-iii">An introduction to RSpec Stories - Part III</a></p></li>
<li><p><a href="http://times.usefulinc.com/2008/01/12-rspec-stories">Quick overview of stories</a></p></li>
<li><p><a href="http://blog.davidchelimsky.net/articles/2007/10/21/story-runner-in-plain-english">RSpec Story Runner Creation</a></p></li>
<li><p><a href="http://www.tomtenthij.co.uk/2008/1/25/rspec-plain-text-story-runner-on-a-fresh-rails-app">Blog describing creating a story and steps</a></p></li>
<li><p><a href="http://www.vaporbase.com/postings/Beginners_Guide_to_Rspec_on_Story_Runner">Clear introduction to stories</a></p></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://blog.emson.co.uk/2008/06/understanding-rspec-stories-a-tutorial/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to determine whether a column exists on SQLServer</title>
		<link>http://blog.emson.co.uk/2008/06/how-to-determine-whether-a-column-exists-on-sqlserver/</link>
		<comments>http://blog.emson.co.uk/2008/06/how-to-determine-whether-a-column-exists-on-sqlserver/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 15:14:42 +0000</pubDate>
		<dc:creator>ben</dc:creator>
		
		<category><![CDATA[sql]]></category>

		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://blog.emson.co.uk/2008/06/how-to-determine-whether-a-column-exists-on-sqlserver/</guid>
		<description><![CDATA[I run some SQL scripts against Microsoft&#8217;s SQLServer in a number of environments, test, staging and production.

One of my problems is that these scripts alter the database schema and I only want them to execute if the change hasn&#8217;t already been made.

One of these changes was to remove a column from the database, so my [...]]]></description>
			<content:encoded><![CDATA[<p>I run some SQL scripts against Microsoft&#8217;s SQLServer in a number of environments, test, staging and production.</p>

<p>One of my problems is that these scripts alter the database schema and I only want them to execute if the change hasn&#8217;t already been made.</p>

<p>One of these changes was to remove a column from the database, so my question is &#8216;how can I ask SQLServer whether a particular column exists&#8217;.</p>

<p>Well the SQL query to check if a column exists and execute a query if it does is as follows:</p>

<pre><code>IF EXISTS ( SELECT * FROM INFORMATION_SCHEMA.COLUMNS
                 WHERE TABLE_NAME='my_table_name' AND
                 COLUMN_NAME='my_column_name' )
BEGIN
  PRINT 'Execute some query here'
END
</code></pre>

<p>Hope it is useful.
Ben&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.emson.co.uk/2008/06/how-to-determine-whether-a-column-exists-on-sqlserver/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Installing Sqlite3 on Windows for Rails</title>
		<link>http://blog.emson.co.uk/2008/06/installing-sqlite3-on-windows-for-rails/</link>
		<comments>http://blog.emson.co.uk/2008/06/installing-sqlite3-on-windows-for-rails/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 14:57:33 +0000</pubDate>
		<dc:creator>ben</dc:creator>
		
		<category><![CDATA[rails]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[windows]]></category>

		<category><![CDATA[database]]></category>

		<category><![CDATA[sqlite3]]></category>

		<guid isPermaLink="false">http://blog.emson.co.uk/?p=10</guid>
		<description><![CDATA[The Windows version of Ruby on Rails does not ship with the Sqlite3 database, even though the database.yaml configuration file is preconfigured to use Sqlite.

This is a how to guide on how to install Sqlite3 on your Windows PC.
This article assumes that you already have Ruby and Ruby on Rails installed on your PC.

First you [...]]]></description>
			<content:encoded><![CDATA[<p>The Windows version of <a href="http://www.rubyonrails.org">Ruby on Rails</a> does not ship with the <a href="http://www.sqlite.org">Sqlite3 database</a>, even though the <strong>database.yaml</strong> configuration file is preconfigured to use Sqlite.</p>

<p>This is a <em>how to</em> guide on how to install Sqlite3 on your Windows PC.
This article assumes that you already have <a href="http://www.ruby-lang.org">Ruby</a> and <a href="http://www.rubyonrails.org">Ruby on Rails</a> installed on your PC.</p>

<p>First you will need to download two files from the Sqlite web site <a href="http://www.sqlite.org/download.html">http://www.sqlite.org/download.html</a>:</p>

<pre><code>    sqlite-3_5_9.zip (214.32 KiB)
    A command-line program for accessing and modifing SQLite databases. 
    See the documentation for additional information.

    sqlitedll-3_5_9.zip (213.17 KiB)
    This is a DLL of the SQLite library without the TCL bindings. 
    The only external dependency is MSVCRT.DLL.
</code></pre>

<p>The first file is the Sqlite command line program used for modifing the Sqlite database.  You may or may not use this.</p>

<p>The second file is the Windows DLL library file and Ruby uses this when Rails makes Sqlite database calls.</p>

<p>When both these ZIP files have been extracted you should have the following files:</p>

<ul>
<li>sqlite3.exe</li>
<li>sqlite3.def</li>
<li>sqlite3.dll</li>
</ul>

<p>Copy these file to the <strong>bin</strong> directory of your Ruby installation, if you followed the default Ruby installation it will be located here:</p>

<pre><code>    C:\ruby\bin
</code></pre>

<p>Now that you have the Sqlite3 files installed you need to tell Ruby how to use them.  To do this you need to download the Ruby bindings for Sqlite3.<br/>Fortunately this is easy to do, using Ruby gems.  Simply at the command prompt type the following command:</p>

<pre><code>    gem install sqlite3-ruby
</code></pre>

<p>You will now need to tell Gems which version you need as you will be presented with the following output:</p>

<pre><code>    Bulk updating Gem source index for: http://gems.rubyforge.org
    Select which gem to install for your platform (i386-mswin32)
     1. sqlite3-ruby 1.2.2 (mswin32)
     2. sqlite3-ruby 1.2.2 (ruby)
     3. sqlite3-ruby 1.2.1 (mswin32)
     4. sqlite3-ruby 1.2.1 (ruby)
     5. Skip this gem
     6. Cancel installation
    &gt;_
</code></pre>

<p>Please select option 1, <strong>sqlite3-ruby 1.2.2 (mswin32)</strong>.  All being successful you will get some output like this:</p>

<pre><code>    Successfully installed sqlite3-ruby-1.2.2-mswin32
    Installing ri documentation for sqlite3-ruby-1.2.2-mswin32...
    Installing RDoc documentation for sqlite3-ruby-1.2.2-mswin32...
</code></pre>

<p>If you are using Rails 2+ you should be able to run the following rake tasks from your Rails application directory.  For example say you created a Rails application located here: <strong>C:\MyApp</strong> you should be able to execute:</p>

<pre><code>    C:\MyApp&gt;rake db:create
    or
    C:\MyApp&gt;rake db:migrate
</code></pre>

<p>Hope this is useful.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.emson.co.uk/2008/06/installing-sqlite3-on-windows-for-rails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Installing the Latest RSpec TextMate Bundle</title>
		<link>http://blog.emson.co.uk/2008/06/installing-the-latest-rspec-textmate-bundle/</link>
		<comments>http://blog.emson.co.uk/2008/06/installing-the-latest-rspec-textmate-bundle/#comments</comments>
		<pubDate>Wed, 04 Jun 2008 09:42:04 +0000</pubDate>
		<dc:creator>ben</dc:creator>
		
		<category><![CDATA[apple]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[git]]></category>

		<category><![CDATA[rspec]]></category>

		<category><![CDATA[textmate]]></category>

		<guid isPermaLink="false">http://blog.emson.co.uk/?p=9</guid>
		<description><![CDATA[If you are using TextMate on your Apple Mac you may wish to download the RSpec TextMate Bundle and install it.  The TextMate bundle can be found in the RSpec Git repository.  In your Terminal.app enter the following commands.  Please note that you will need Git installed on your Apple Mac in [...]]]></description>
			<content:encoded><![CDATA[<p>If you are using <a href="http://www.macromates.com">TextMate</a> on your Apple Mac you may wish to download the RSpec TextMate Bundle and install it.  The TextMate bundle can be found in the <a href="http://github.com/dchelimsky/rspec-tmbundle/tree/master">RSpec Git repository</a>.  In your <strong>Terminal.app</strong> enter the following commands.  Please note that you will need Git installed on your Apple Mac in order to do this, please see my article <a href="http://blog.emson.co.uk/2008/06/installing-a-git-client-on-osx/">Installing Git on Apple OSX</a> on how to do this:</p>

<pre><code>cd /Applications/TextMate.app/Contents/SharedSupport/Bundles
git clone git://github.com/dchelimsky/rspec-tmbundle.git RSpec.tmbundle
</code></pre>

<p>You should get output like this in your <strong>Terminal</strong> window:</p>

<pre><code>Initialized empty Git repository in /Applications/TextMate.app/Contents/SharedSupport/Bundles/RSpec.tmbundle/.git/
remote: Counting objects: 46199, done.
remote: Compressing objects: 100% (10514/10514), done.
Indexing 46199 objects...
remote: Total 46199 (delta 33049), reused 46199 (delta 33049)
 100% (46199/46199) done
Resolving 33049 deltas...
 100% (33049/33049) done
</code></pre>

<p>Now you will need to reload your TextMate Bundle Editor for this new bundle to be applied.  In TextMate select the following menu items and button:</p>

<pre><code>  Bundles &gt; Bundle Editor &gt; Reload Bundles
</code></pre>

<p>If you ever need to get a more uptodate version of the <strong>RSpec.tmbundle</strong> then simply navigate to your TextMate Bundle directory and use Git to pull the latest version down to your machine.  Don&#8217;t forget to reload your bundles once this has been done.  To pull the latest version from the Git hub use this command:</p>

<pre><code>git pull
</code></pre>

<p>For older instructions on how to do this see <a href="http://www.robbyonrails.com/articles/2007/02/12/rspec-bundle-for-textmate">Robby on Rails - RSpec Bundle for TextMate</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.emson.co.uk/2008/06/installing-the-latest-rspec-textmate-bundle/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Installing Git on Apple OSX</title>
		<link>http://blog.emson.co.uk/2008/06/installing-a-git-client-on-osx/</link>
		<comments>http://blog.emson.co.uk/2008/06/installing-a-git-client-on-osx/#comments</comments>
		<pubDate>Tue, 03 Jun 2008 20:24:29 +0000</pubDate>
		<dc:creator>ben</dc:creator>
		
		<category><![CDATA[apple]]></category>

		<category><![CDATA[ruby]]></category>

		<category><![CDATA[git]]></category>

		<category><![CDATA[osx]]></category>

		<guid isPermaLink="false">http://blog.emson.co.uk/2008/06/installing-a-git-client-on-osx/</guid>
		<description><![CDATA[Git is a version control system like CVS and Subversion.  It was created by Linus Torvalds and used for Linux.  It has recently been adopted by the Ruby community and many of the new Ruby and Ruby on Rails projects now use it.  One of the reason&#8217;s for it&#8217;s popularity amongst the [...]]]></description>
			<content:encoded><![CDATA[<p>Git is a version control system like CVS and Subversion.  It was created by Linus Torvalds and used for Linux.  It has recently been adopted by the Ruby community and many of the new Ruby and Ruby on Rails projects now use it.  One of the reason&#8217;s for it&#8217;s popularity amongst the Ruby community is because of <a href="http://github.com/">github</a>.  In there own words:</p>

<blockquote>
  <p>GitHub is the easiest (and prettiest) way to participate in that collaboration: 
  fork projects, send pull requests, monitor development, all with ease.</p>
</blockquote>

<h2>How to quickly setup Git on Apple OSX</h2>

<p>The simplest way to install Git on Apple OSX (for Intel Mac) is to use this pre-packaged installer: <a href="http://metastatic.org/text/Concern/2007/08/18/git-package-for-mac-os-x/">http://metastatic.org/text/Concern/2007/08/18/git-package-for-mac-os-x/</a>, however if you have a PowerPC Mac or wish to use an alternative installation method, try the information on this site: <a href="http://bc.tech.coop/blog/070827.html">http://bc.tech.coop/blog/070827.html</a></p>

<p>Launch the installer, and accept the license agreements.  Once the installer has completed open up OSX Terminal.app (<em>cmd + space</em>, then type terminal), and type <strong>git</strong> at the command prompt, if all has been successful you should see something like this:</p>

<pre><code>usage: git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]

The most commonly used git commands are:
   add           Add file contents to the index
   apply         Apply a patch on a git index file and a working tree
   archive       Create an archive of files from a named tree
   bisect        Find the change that introduced a bug by binary search
   branch        List, create, or delete branches
   checkout      Checkout and switch to a branch

&#8230;  continued with more commands &#8230;
</code></pre>

<h3>Configuring Git</h3>

<p>One of the interesting things about Git is that it can be configured from the command line.  Therefore the first thing to do is setup your user details so that when you add changes it uses your details.  This web site has some very good instructions on how to get up and running using Git very quickly <a href="http://git.or.cz/course/svn.html">http://git.or.cz/course/svn.html</a>.</p>

<p>To configure your Git user details enter the following at the command prompt:</p>

<pre><code>git config --global user.name "Your Name Comes Here"
git config --global user.email you@yourdomain.example.com
</code></pre>

<h3>Clone / Checkout the RSpec Git Repository</h3>

<p>Now you should be able to clone (Subversion calls this <em>checkout</em>) a repository so that you can view the source code.  To do this enter the following command at the command prompt.  I intend to checkout the <a href="http://github.com/dchelimsky/rspec/tree/master">RSpec</a> repository from github:</p>

<pre><code>git clone git://github.com/dchelimsky/rspec.git
</code></pre>

<p>All being well you should see output in your Terminal like this:</p>

<pre><code>Initialized empty Git repository in /Users/myname/my_repositories/rspec/.git/
remote: Counting objects: 46810, done.
Compressing objects: 100% (10646/10646), done.)   
Indexing 46810 objects...
remote: Total 46810 (delta 33521), reused 46810 (delta 33521)
 100% (46810/46810) done
Resolving 33521 deltas...
 100% (33521/33521) done
</code></pre>

<p>Now you should have all the source code in your new repository.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.emson.co.uk/2008/06/installing-a-git-client-on-osx/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
