Archive for April, 2006

Windows SubVersion / TortoiseSVN – Compare two versions of a file

26 April, 2006 6 comments

Today I needed to compare two different versions of a source file. One in the main trunk folder and the other in a previously tagged version folder. This is easily done in TortoiseSVN, snippet from the TortoiseSVN manual:

Compare two revisions of a file
If you want to compare two revisions in a file’s history, for example revisions 100 and 200 of the same file, just use TortoiseSVN => Show Log to list the revision history for that file. Pick the two revisions you want to compare then use Context Menu => Compare Revisions.

If you want to compare the same file in two different trees, for example the trunk and a branch, you can use the repository browser to open up both trees, select the file in both places, then use Context Menu => Compare Revisions.

If you want to compare two trees to see what has changed, for example the trunk and a tagged release, you can use TortoiseSVN => Revision Graph Select the two nodes to compare, then use Context Menu => Compare HEAD Revisions. This will show a list of changed files, and you can then select individual files to view the changes in detail. Alternatively use Context Menu => Unified Diff of HEAD Revisions to see a summary of all differences, with minimal context.

The process of comparing two trees is really nicely done, you get a list of all the files which have been changed between the two trees. You can then drill into this list and see the changes made to individual files. Kewl!

Categories: Subversion

Connecting Ruby on Rails to Microsoft SQL Server

7 April, 2006 8 comments

NOTE: These instructions are now seriously out of date. You may want to check out my always up to date ebook instead. The secret of connecting Rails to Microsoft SQL Server

It appears rails does not connect to MS SQL Server right out of the box. You need to do the following to get the connection to work:

Get the latest source distribution of Ruby-DBI and copy the file:




NOTE: The ADO directory does not exist on a standard install, you will need to create it.

Then simply set up your railsapp/config/database.yml

Here’s an example for reference:

  adapter: sqlserver
  database: database_name
  host: server_name
  username: user_name
  password: your_pw_here
Categories: Ruby on Rails

Migrations 'Zombie State' and MS SQL

4 April, 2006 1 comment

Getting ‘Zombie State’ errors with migrations and MS SQL Server? Add the following to your config/enviroment.rb:

ActiveRecord::Base.connection.instance_variable_get("@connection")["AutoCommit"] = false
Categories: Ruby on Rails

Pluralize table names – no thanks!

4 April, 2006 11 comments

Sorry I just can’t live with plural table names, I just can’t get my head around it! Luckily it is easily turned off. In RadRails there is a simple tick box when creating the project which simply adds the following line to the end of your applications config/environment.rb file:

# Include your application configuration below
ActiveRecord::Base.pluralize_table_names = false

I may live to regret not embracing plural table names but I doubt it!

Categories: Ruby on Rails

Setting up Ruby on Rails

4 April, 2006 5 comments

I’m going to give Ruby on Rails (RoR) a try on my Windows XP machine. Here’s how I’ve set it up…

  1. Install Ruby
    Using the Ruby One Click Installer Ruby One Click Installer (v184-16 release candidate 1)
  2. Setup proxy
    set HTTP_PROXY=http://wwwcache:8080
  3. GEM install Ruby on Rails
    gem install rails --include-dependencies
  4. Install RadRails
    I also downloaded and installed the latest RadRails (v0.6.1)
  5. Database
    I’m going to try rails with our dev MS-SQL server so no database to install. No doubt lots of configuring to do though!


There appears to be a problem with the WEBrick web server in this setup. I couldn’t find the answer on google but I did find a work around. If you run the WEBrick server using the standard ruby script\server you will get the following error:

ruby script\server
=> Booting WEBrick...
=> Rails application started on
=> Ctrl-C to shutdown server; call with --help for options
[2006-04-04 13:20:35] INFO  WEBrick 1.3.1
[2006-04-04 13:20:35] INFO  ruby 1.8.4 (2005-12-24) [i386-mswin32]
[2006-04-04 13:20:35] WARN  TCPServer Error: Bad file descriptor - bind(2)
c:/ruby/lib/ruby/1.8/webrick/utils.rb:73:in `initialize': Bad file descriptor - bind(2) (Errno::EBADF)
        from c:/ruby/lib/ruby/1.8/webrick/utils.rb:73:in `create_listeners'
        from c:/ruby/lib/ruby/1.8/webrick/utils.rb:70:in `create_listeners'
        from c:/ruby/lib/ruby/1.8/webrick/server.rb:75:in `listen'
        from c:/ruby/lib/ruby/1.8/webrick/server.rb:63:in `initialize'
        from c:/ruby/lib/ruby/1.8/webrick/httpserver.rb:24:in `initialize'
        from c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/webrick_server.rb:59:in `dispatch'
        from c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/commands/servers/webrick.rb:59
        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
        from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/dependencies.rb:136:in `require'
        from c:/ruby/lib/ruby/gems/1.8/gems/rails-1.1.0/lib/commands/server.rb:30
        from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in `require'
        from c:/ruby/lib/ruby/gems/1.8/gems/activesupport-1.3.0/lib/active_support/dependencies.rb:136:in `require'
        from script/server:3

There appears to be some problem binding to the port 3000, netstat shows nothing running on port 3000 so I’ve no idea what is causing it. Any hoose a work around is simply to run on another port:

ruby script\server --port=8000

If I do find out what is causing the problem I’ll update this post.

Categories: Ruby on Rails

Tagging in subversion

3 April, 2006 2 comments

We have started tagging our source when releasing to QA/porduction which means we can easily roll back to an ealier verison of the code if a problem is found in production. Here’s how we do it using TortoiseSVN.

First commit your source then open up the TortoiseSVN repository browser:

Right click in a folder in windows to get a context menu then select TortoiseSVN => Repo-Browser.

You should now see Repository browser:

Repository Browser

Find the trunk of the project you wish to tag then right click on the trunk folder and select ‘Copy to…’ from the context menu.

You will now see the Copy to… dialog:


Enter the path to your tagged copy, along the lines of svn://server/project/tags/Version2.00

You now have tagged version of your project which you can revert to anytime.

Categories: Subversion