Thoughts on Technology, Methodology and Programming.

Archive for November, 2006

Resource Refactoring Tool

Posted by Marcus Wyatt on 10 November 2006

What a cool utility as part of the Power Toys for Visual Studio. The Resource Refactoring Tool provides you a way to extract hard coded strings from your code to a new or existing resource files. It is a aplha release, but I’ve used it now for about a day and it is stable.

How does the tool work?

The first thing I have done is to give it a keyboard shortcut. I don’t use the standard refactoring tools, so I have re-assigned the Ctrl+R, Ctrl+R keyboard shortcut to the “Extract to Resource” item. The command your looking for in the keyboard scheme is “Microsoft.VSPowerToys.ResourceRefactor.Connect.RefactorLiteral”.

Now you just select some hard coded text and hit your shortcut. You should see the following dialog box.























What you can do now is select if you want to create a new resource file or use an existing resource file. The screenshot shows an existing resource file. It also tells you if the Resource name you want to assign is already in use. I also like how it shows what the code will look like after the refactoring. I am a big Resharper fanatic, but this is one of the better Microsoft refactoring offerings. Good job MS…

tags: , , ,

Currently listening to: Zee – Dreamtime (Vocal MIx)


Posted in Development | 4 Comments »

Rails scaffold method problems (actually connection)

Posted by Marcus Wyatt on 1 November 2006

I’m trying out Ruby in Steel the past week and where pulling my hair out because the scaffold method did not work. The database was hosted on a SQL2005 server and I did not think you need to do anything special to use Ruby in Steel against SQL.

So after a couple of hours trying to solve the problem, I decided to try my project against a MySQL database and scaffold worked. So I figured that there must be a problem with rails connecting to the sql database.

If you get the following message “identical test/fixtures/posts.yml is not a class/module” when running script/generate scaffold, then you have a problem connecting to the sql database (that’s of course if you using sql as your data store).

I found a solution to the SQL2005 connection problem on a fellow wordpress blog.

Just in ram posted the following:

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:

NOTE: These instructions are a tweaked version of http://wiki.rubyonrails.com/rails/pages/HowtoConnectToMicrosoftSQLServer

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

Thanx… just in ram

Posted in RoR | 1 Comment »