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

<channel>
	<title>emson... &#187; windows</title>
	<atom:link href="http://blog.emson.co.uk/category/windows/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.emson.co.uk</link>
	<description></description>
	<lastBuildDate>Thu, 24 Jun 2010 08:27:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<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 <strong>Word\Data</strong> 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>
		<slash:comments>52</slash:comments>
		</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 <img src='http://blog.emson.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .</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(&#8220;~/.hoerc&#8221;)</strong> as below:</p>

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

def define_tasks # :nodoc:
 def with_config # :nodoc:
   rc = File.expand_path(get_home_dir + '.hoerc')
   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>
		<slash:comments>5</slash:comments>
		</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>
		<slash:comments>0</slash:comments>
		</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>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>Named Pipes and TCP/IP Connection Strings</title>
		<link>http://blog.emson.co.uk/2008/05/named-pipes-and-tcpip-connection-strings/</link>
		<comments>http://blog.emson.co.uk/2008/05/named-pipes-and-tcpip-connection-strings/#comments</comments>
		<pubDate>Wed, 28 May 2008 16:45:58 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[windows]]></category>
		<category><![CDATA[.net]]></category>

		<guid isPermaLink="false">http://blog.emson.co.uk/?p=5</guid>
		<description><![CDATA[Manually Creating a SQL Connection String

There are many different connection strings for connecting to a SQLServer database for C#.  Have a look at this web site http://www.connectionstrings.com/?carrier=sqlserver for examples.

I needed to create a connection to a SQLServer and started using this as my connection string:

server=myServer;database=myDatabase;uid=someUser;pwd=somePassword


However I got the following error:

An error has occurred while [...]]]></description>
			<content:encoded><![CDATA[<h2>Manually Creating a SQL Connection String</h2>

<p>There are many different connection strings for connecting to a SQLServer database for C#.  Have a look at this web site <a href="http://www.connectionstrings.com/?carrier=sqlserver">http://www.connectionstrings.com/?carrier=sqlserver</a> for examples.</p>

<p>I needed to create a connection to a SQLServer and started using this as my connection string:</p>

<pre><code>server=myServer;database=myDatabase;uid=someUser;pwd=somePassword
</code></pre>

<p>However I got the following error:</p>

<pre><code>An error has occurred while establishing a connection to the server. 
When connecting to SQL Server 2005, this failure may be caused by
the fact that under the default settings SQL Server does not allow 
remote connections. (provider: Named Pipes Provider, error: 40 - 
Could not open a connection to SQL Server)
</code></pre>

<p>Pipes are actually quite an old technology, but what are they?</p>

<p><span id="more-5"></span></p>

<h2>What are Named Pipes on Windows</h2>

<p><a href="http://msdn.microsoft.com/en-us/library/aa365590.aspx">MSDN</a> defines a pipe as:</p>

<blockquote>
  <p>A named pipe is a named, one-way or duplex pipe for communication between the pipe server and one or more pipe clients.</p>
</blockquote>

<p>Pipes are like sockets and allow peer-to-peer communication.  Additionally any process can act as either a server or a client.
Pipes can be accessed remotely but you can also deny access to it from other networked authorities.</p>

<p>Really we should use TCP/IP for our database connections and initially I thought I had to create a special connection string defining TCP/IP settings.</p>

<p>Again as I looked into the problem more closely it turned out that I was again connecting to a server that was not running SQLServer.
Anyway I am now using the following connection string:</p>

<pre><code>Data Source=myServer;Database=myDatabase;User ID=someUser;Password=somePassword;
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.emson.co.uk/2008/05/named-pipes-and-tcpip-connection-strings/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IManage error &#8211; The semaphore is set and cannot be closed</title>
		<link>http://blog.emson.co.uk/2008/05/imanage-error-the-semaphore-is-set-and-cannot-be-closed/</link>
		<comments>http://blog.emson.co.uk/2008/05/imanage-error-the-semaphore-is-set-and-cannot-be-closed/#comments</comments>
		<pubDate>Wed, 28 May 2008 10:30:04 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[windows]]></category>
		<category><![CDATA[imanage]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.emson.co.uk/?p=4</guid>
		<description><![CDATA[Using the Interwoven IManage API, I was trying to create a connection to the IManage server and kept getting this error message:

The semaphore is set and cannot be closed.


It turns out that this error message is misleading and can hide a multitude of symptoms.  In this case it was returned because the system cannot [...]]]></description>
			<content:encoded><![CDATA[<p>Using the Interwoven IManage API, I was trying to create a connection to the IManage server and kept getting this error message:</p>

<pre><code>The semaphore is set and cannot be closed.
</code></pre>

<p>It turns out that this error message is misleading and can hide a multitude of symptoms.  In this case it was returned because the system cannot create a connection to the server, as I had accidentally put in an incorrect server name into my connection method.</p>

<p>I did however do some research into what a <strong>semaphore</strong> actually is.
The choice of word comes from a time when flags were used to signal telegraph messages.</p>

<p>However the <a href="http://dictionary.reference.com/browse/semaphore">Dictionary</a> computer definition of a semaphore is:</p>

<blockquote>semaphores are a software mechanism to regulate process synchronization, proposed by Edsger W. Dijkstra.</blockquote>

<p><a href="http://en.wikipedia.org/wiki/Semaphore_%28programming%29">Wikipedia</a> gives a more detailed explaination of a <strong>semaphore</strong>, see below:</p>

<blockquote>A semaphore, in computer science, is a protected variable (an entity storing a value) or abstract data type (an entity grouping several variables that may or may not be numerical) which constitutes the classic method for restricting access to shared resources, such as shared memory, in a multiprogramming environment (a system where several programs may be executing, or taking turns to execute, at once). Semaphores exist in many variants, though usually the term refers to a counting semaphore, since a binary semaphore is better known as a mutex. A counting semaphore is a counter for a set of available resources, rather than a locked/unlocked flag of a single resource. It was invented by Edsger Dijkstra. Semaphores are the classic solution to preventing race conditions in the dining philosophers problem, although they do not prevent resource deadlocks.</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://blog.emson.co.uk/2008/05/imanage-error-the-semaphore-is-set-and-cannot-be-closed/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>.Net not recognising regional settings</title>
		<link>http://blog.emson.co.uk/2008/05/net-not-recognising-regional-settings/</link>
		<comments>http://blog.emson.co.uk/2008/05/net-not-recognising-regional-settings/#comments</comments>
		<pubDate>Fri, 23 May 2008 13:58:54 +0000</pubDate>
		<dc:creator>ben</dc:creator>
				<category><![CDATA[windows]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[debug]]></category>

		<guid isPermaLink="false">http://blog.emson.co.uk/?p=3</guid>
		<description><![CDATA[The other day I had the following problem.
One of my test servers had been setup with US regional settings and should have been setup with UK settings.

The problem had been unnoticed for a while until our C# .Net application tried to call a stored procedure on a database on another server. This database server had [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I had the following problem.
One of my test servers had been setup with US regional settings and should have been setup with UK settings.</p>

<p>The problem had been unnoticed for a while until our C# .Net application tried to call a stored procedure on a database on another server. This database server had UK regional settings. 
The stored procedure expected to get a date in UK &#8216;Long format&#8217;.  The error message was a database error saying something like:</p>

<pre><code>convertion error can't convert from NVarChar to DateTime
</code></pre>

<p>As the application was already compiled and being used on a live server I could not modify the code, I therefore had to run SQL Profiler and see what values were being passed into the stored procedure.  This is where I saw the US &#8216;Long Date&#8217; format being passed in.</p>

<p><span id="more-3"></span></p>

<h2>.Net regional settings fix</h2>

<p>So I tried changing the regional settings on my server back to the UK, but the application was still sending the US &#8216;Long Date&#8217; value.
I dug real deep and suspected that IIS was doing something funny and found further regional settings in an <strong>Advanced</strong> tab, but still this didn&#8217;t fix the issue.</p>

<p>The problem I soon discovered is that when you install the .Net framework it internalises the regional settings but when you try and change them on the server these internalised settings don&#8217;t get changed.<br />
The only solution to this is then to modify the <b>machine.config</b> file.</p>

<p>The <b>machine.config</b> file is in each installation of the .Net framework.  I happen to have both .Net 1.1 and .Net 2.0, however I changed the <b>machine.config</b> file in only the .Net 1.1 installation directory (even though our application is .Net 2.0) and all worked fine.
The <b>machine.config</b> can be found in this directory:
    <pre>C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\CONFIG</pre></p>

<p>If you are using .Net 2.0 I&#8217;m sure you can make the same changes to the <strong>globalization</strong> XML node.
Please change the <strong>globalization</strong> XML node to have the correct cultural settings in our case <strong>en-GB</strong>:
<code><pre>
    &lt;globalization
        fileEncoding="utf-8"
        requestEncoding="utf-8"
        responseEncoding="utf-8"
        culture="en-GB"
        uiCulture="en-GB"<br />
    /&gt;
</pre></code></p>

<p>To test that a .Net application would send the correct settings I wrote a simple test app which would print the &#8216;Long Date&#8217; to the console.  Here is the source code if you want to quickly test it yourself:</p>

<p><strong>ShowLongDate.cs</strong></p>

<pre><code>using System;

namespace examples
{
    class ShowLongDate
    {
        static void Main(string[] args)
        {
            DateTime current = DateTime.Now;
            string longDate = current.ToLongDateString();
            System.Console.WriteLine(string.Format("Date as longDate: {0}", longDate));
        }
    }
}
</code></pre>

<h2>Interesting things I learned</h2>

<p>You can open the regional settings from the commandline or from <strong>Start/Run</strong> by typing</p>

<pre><code>    intl.cpl
</code></pre>

<p>Also all the regional settings are located in the registry here:</p>

<pre><code>    HKEY_CURRENT_USER/Control Panel/International
</code></pre>

<p>Useful URLs:
<a href="http://www.microsoft.com/globaldev/reference/localetable.mspx">http://www.microsoft.com/globaldev/reference/localetable.mspx</a></p>

<p>Anyway I hope this helps if you have the same problem.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.emson.co.uk/2008/05/net-not-recognising-regional-settings/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
