Installing Ruby on Rails on Windows

April 06, 2010 by Damien White

So it’s not like this doesn’t exist elsewhere on the ‘net, but in case you stumbled upon one of my other Ruby on Rails posts and I caught your interest, here’s how to get started developing Rails apps on Windows. If you’re a little resistant to try Rails, look how simple the install is. What are you waiting for?

  1. Head over to and install Ruby executable from there. I usually install both 1.8.7 (current release Ruby 1.8.7-p249 (RC2)) and 1.9.1 (current release Ruby 1.9.1-p378 (RC2)) and use pik to switch between the two with ease. I also have the RubyInstaller set my path variable to include the install path for Ruby 1.8.7. The RubyInstaller includes Ruby and RubyGems. If you are not familiar with RubyGems, a gem is a Ruby package. Accessing and using a gem is a simple gem install command, which you will see in a moment.

  2. Fire up cmd on your machine and type ruby -v. You should see the following text. If you don’t, check your PATH variable and make sure you have an entry for your installation path (typically C:\Ruby\bin). Note your version listing may be different than mine. ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]

  3. You may want to update RubyGems. The RubyInstaller (at least at the time of writing) includes v1.3.5. To do this, use the command: gem update –system The current version as of this post is v1.3.6. You can check your gem version with the command **gem -v

  4. Now it’s time to install Rails, which thanks to gems is as easy as running the command: gem install rails. Note that installing Rails takes a bit of time. After Rails is done, use the command rails -v to verify it installed correctly.

  5. After Rails is done, you should install a database. The easiest to get going with is SQLite. You’ll need to download the EXE and the DLLs for SQLite (from here: Look under the Precompiled Binaries For Windows section. You’ll have three files after downloading the two zip files (sqlite-3 and sqlitedll). Put the sqlite3.dll, sqlite3.def, and sqlite3.exe in your Ruby\bin directory (typically C:\Ruby\bin). Once you’ve done that you’ll need to install the sqlite3-ruby gem, which is just: gem install sqlite3-ruby

  6. That’s it! Now you can start working with Rails. Let’s make a simple note taking application…

Read More »

Ruby Beauty – Iteration with an Index

April 05, 2010 by Damien White

I just love how expressive and clean Ruby’s syntax is. How often do you need to iterate over a collection and get a count as well? That sort of code is ugly in something like C#, but in Ruby:

people = %w{Dave Bill Mike Mark John} # Simple collection of names
people.each_with_index { |name, index| puts "#{index}: #{name}" }

And that displays:

0: Dave
1: Bill
2: Mike
3: Mark
4: John

each_with_index – simple and elegant.

And what’s the C# version of something like this look like? Blah :)

Ruby on Rails Shared Hosting Mongrel Issues

April 01, 2010 by Damien White

I have had just about nothing but issues getting my Rails application running on my shared host. I’m not going to mention the company since they have been somewhat helpful, however I’m not thrilled with them. I don’t want to give them any good or bad press without giving them a fair chance. I’ve been with them for around a month now.

Starting back in the beginning of March, I developed a Rails application I wanted to start hosting to play around with the different environments, Capistrano, etc. The more I use Rails, the more I love it. I don’t have the opportunity to use Rails for my day job, but that hasn’t stopped me from doing cool stuff on my own time. I eat this stuff up; I’m a true geek through and through. Anyway, I deployed my app (after some gem snafus) and I was so proud of myself. Little did I know I’d encounter more issues. Bring on the 503 Errors…

Read More »

Ruby on Rails Shared Hosting Gem Issue

March 31, 2010 by Damien White


I recently signed up on a shared hosting plan for playing around with Ruby on Rails apps. I finally had an app roughly together, and I wanted to test out my deployment using Capistrano. I was able to configure my deploy.rb file so everything uploaded correctly, and figured that was the hardest bit. Little did I know that my biggest challenge was getting gems to work. Now to be fair, I haven’t been doing Rails day in and day out like ASP.NET, so it could just be me being naive, but that didn’t seem to be the case.

The Problem

So after the deploy, I went to start up the application using cPanel. I hit the big Run button and got the “The following Ruby on Rails application was started: myapp” message, but when I went back to the Rails section of the cPanel, of course myapp wasn’t running.

Off to the logs where mongrel.log gave me the error “Missing these required gems.”  Duh. I had specified the gems I needed in the environment.rb file using the config.gem method, so I could just do a rake gems:install to fix that. Awesome… err…  not so much. Went to start the application again in cPanel, same deal. The real annoying bit was I got the same “Missing these required gems” message as before. Commence with beating ones head against the wall… Read More »

My Affair with Ruby on Rails

March 25, 2010 by Damien White

As I’m sure most of you know, I’m a hardcore C#/.NET guy. The majority of my work as been on the web, and I’ve been using ASP.NET since the earliest betas. ASP.NET’s profound effect on web development is still going strong to this day. For me, the first choice for web application development has been ASP.NET. Well, I decided to venture out a bit recently.


Believe me, I feel a little “dirty” cheating on ASP.NET MVC with a mistress named Ruby but I have to tell you, Rails is incredible. Let the record show I am still one of Microsoft’s and .NET’s biggest fans, and I still love C#. That said, I am one of those developers who just flat out loves learning. I am so passionate about development, it consumes me (just ask my wife). So one day last year, I decided to broaden my horizons and look at Rails. I attribute my development metamorphosis to Manning Publications and the “Pop Quiz” they ran last fall. Their daily questions got me looking beyond the .NET realm into other areas a bit outside my comfort zone. Being outside your comfort zone allows you as a developer to see things in a totally different light. It’s real good to mix things up a bit, and it makes you an all around better developer. In fact Peter Bromberg recently tweeted “I think one should learn everything they can. Then, you’ll be in a better position to decide what you want to use.” I couldn’t agree more.

Read More »

Getting ActiveTabChanging Functionality from the AJAX TabControl

January 04, 2010 by Dave Marini

I have always considered myself to be quite client-side challenged. Having been soured to the thought of JavaScript by all the browser specific code I used to have to write years ago I swore off it and took to server-side development and never looked back. After a year’s hiatus doing WPF programming, I’ve recently found myself back in the thick of web development with new patterns and technologies at the forefront, namely the MVC framework and the ubiquity of jQuery. Before I begin this post I’d like to say that jQuery is, well, everything that is good about client-side programming in my opinion.

So recently I found the need to roll my own dirty form warning mechanism on a site I was working on. These forms contain quite a lot of fields and so there is gratuitous use of the TabControl from the Microsoft AJAX Control Toolkit. One of the requirements was to alert the user to changes made on one of the tabs and offer the option to save the changes before allowing the user to change tabs. Initially I thought that this task would be a breeze, what with the OnClientActiveTabChanged handler on the TabContainer control and all. Then the sad reality dawned on me. There is no way to cancel the changing of tabs from the client side. Like a freight train full of explosives it barrels on, destroying my workflow and with it any chance I’ll get sleep. But all is not lost, because with a few JavaScript ninja moves, some nifty jQuery (optional) and no personal life there is a clean solution to this problem, So what’s the answer? Read on for the details.

Read More »

Silverlight 3 ElementName DataBinding Problem

November 19, 2009 by Damien White

I’ve been using Silverlight 3 heavily for the past few months, and during that time have discovered many things to love and hate. One problem I faced with Silverlight 3 (that I should have blogged about earlier) is something I think many developers may have faced. In the application I’ve been working on, we’ve broken up our functionality into “partial views” (we’re using MVVM) by encapsulating logic into Silverlight UserControls. Well with this approach, we ran into an interesting binding problem.

Let’s say you have a UserControl, and that UserControl exposes a DependencyProperty. Then within the UserControls content, you try to bind a control to that Dependency Property. Well there’s an interesting issue with that approach in Silverlight 3. Let’s look at a very simple example and see where the problem exhibits itself.

In this example, we’ll be creating a totally useless application to illustrate the point. We’ll have a Page (MainPage.xaml), and one UserControl (MyControl.xaml). The UserControl will consist of a single string property called MyText and the goal is to get that property’s value to be displayed in a TextBlock (which is within the UserControl). We’ll then add that UserControl to the page, and we’ll dynamically set MyText on the UserControl. Simple setup, right? What can go wrong? Well, let’s get started.

Read More »

Book Review – Manning The Art of Unit Testing

September 30, 2009 by Damien White

Art of Unit Testing To some, “unit testing” is a four letter word. While it’s unfortunate, the feeling is justified by poor experiences, lack of knowledge, and so on. Personally, I’ve had mixed experiences with unit tests. I’m sure many of you have encountered similar situations. After reading The Art of Unit Testing by Roy Osherove, I feel far more confident in not only understanding unit tests, but also the best practices for implementation. If this book had only been written years ago, maybe all those poor unit testing experiences would have never happened. 

The fundamental thing that I think is most misunderstood about unit testing is simply not understanding what a unit test is. In fact, Roy just recently posted an updated definition of how he would classify a unit test on his blog. Of course a definition isn’t always enough, and in his book, Roy starts off by fully explaining all the aspects of what a unit test should be and the basic outline for how to succeed. I would highly recommend that you visit his book’s webpage ( and download the sample first chapter

This seriously may be the best book ever written on unit testing. I understand that “the best” is a strong statement, but this book is really the perfect package. Let’s look at what makes this such a winner…

Read More »

Silverlight 3 NavigationCacheMode To The Rescue

September 22, 2009 by Damien White

Missing Piece

I’ve been lucky enough to work on a new project for a client involving Silverlight 3 and the Silverlight Virtual Earth CTP. One reoccurring issue that keeps coming up is performance, and I’m always looking for ways to balance functionality with speed. In the app we are loading up a Virtual Earth map and populating it with data (nothing new). We have a fair amount of data being loaded for various functions and layers. Users are able to show and hide layers as well as interact with the map’s basic functions (zoom, pan, etc). Users can then navigate to other areas based on selections from the map page.

Since we’re using SL3, we’re using the Navigation Framework to navigate between “pages.”  If you’re not familiar with the Navigation Framework, check out Martin Mihaylov’s article, or if you prefer videos, be sure to check out Tim Heuer’s video on the topic. Now let’s move on to the problem, and a solution…

Read More »

ASP.NET 4.0 AJAX Issues

August 27, 2009 by Damien White

Puzzled Man

I’ve been using ASP.NET AJAX 4.0 quite a bit lately in ASP.NET 3.5 applications.  I encountered two issues tonight, and I hope this post saves someone some grief.

The first problem has to do with referencing the ASP.NET AJAX 4.0 library within an ASP.NET 3.5 application, and the second was a surprising data binding issue using the DataView.

If you are looking for more information on ASP.NET AJAX 4.0, be sure check out my other articles on the site.

Issue 1 – The ScriptManagerProxy and CompositeScripts

The first issue I encountered was a client side error when using the DataView on a content page in my ASP.NET 3.5 SP1 application.  This site utilizes master pages, so I’m using a WebForm, otherwise I probably would have just gone with a plain old HTML page.  Regardless, since this is an ASP.NET application and the ScriptManager is declared in the Master page, I added the ASP.NET 4.0 AJAX scripts to a ScriptManagerProxy (instead of the ScriptManager itself). The code for the ScriptManagerProxy looks very similar to that for the ScriptManger.

Read More »