So far, it\’s RoR

Ruby on Rails, PostgreSQL, SVN, etc….

Archive for the ‘Windows’ Category

Installing PostgreSQL on Windows Vista

Posted by Chirag Patel on August 15, 2007

Just a few notes to be very careful when installing PostgreSQL 8.2.4 on Windows Vista:

Because PostgreSQL needs to be installed as a Windows service, it needs to create an account that will be granted Logon On as a Service permission. When I first installed it, I allowed the installation wizard to use a default account name (postgres) and it generated a password for me. The password was extremely long (25 random chars) and difficult to remember, and for that matter, I could not copy and paste their auto-generated password from the the dialog box that came up. It installed successfully, but when I tried to change the password with the GUI (pgAdmin III), it was unsuccessful. So, I uninstalled PostgreSQL and re-installed it with my own Windows login (instead of the default postgres account) and that’s when things went terribly wrong. After that point, the PostgreSQL would not allow me to reinstall (Error message: “another installation in process”) and on top of that Windows would not allow me to delete the files manually because of permissions rights on the C:\Program Files\PostgreSQL directory. I finally had to do a System Restore and got it working.

To summarize:

  1. Do not use a member of the local administrators group as your Windows login for the service (such as your own personal Windows login) in step 5 of the installation guide!! Using their default postgres is the easiest. But use your own password instead of an autogenerated one. The FAQ (topic 2.3) explains why a non-administrator account is needed for security reasons. By the way, you can start and stop the PostgreSQL service within the Services control panel and also from the PostgreSQL group under the Start Menu.
  2. I would go ahead and allow it to create a database cluster in step 6 of the installation guide. I used the HTTP port number they suggested (5432) and allowed only localhost to access the database. In this step, the account name is the superuser (i.e. root access) of the database cluster.
    Here’s PostgreSQL’s explanation of a database cluster:

    Before you can do anything, you must initialize a database storage area on disk. We call this a database cluster. (SQL uses the term catalog cluster.) A database cluster is a collection of databases that is managed by a single instance of a running database server. After initialization, a database cluster will contain a database named postgres, which is meant as a default database for use by utilities, users and third party applications. The database server itself does not require the postgres database to exist, but many external utility programs assume it exists.

  3. After I successfully installed PostgreSQL, I used these settings to create a new database

Last, see the FAQ for the installation process for further explanations.


Posted in PostgreSQL, Windows | 1 Comment »

Visualize your Rails database schema for free on Windows

Posted by Chirag Patel on August 9, 2007

Using Railroad and Graphviz

Blog update (10/22/2007): Thanks to the comment posted by Blog de Kilgore, I tried Railroad (instead of using the below method with starUML) to visualize my RoR app. Very easy to setup and use (see examples on web page).

Here’s a quick command to create a .png graphic file of your models:

    railroad -a -i -M | dot -Tpng > models.png


This command will directly write to a .png file without the need of Graphviz

  1. Database Models
  2. Mailer models
  3. Observer models
  4. Associations (with lines and arrows)
  5. Inheritance among classes (for regular models, mailers, and observers)



Using starUML

Rails keeps your schema is a file called db/schema.rb (which I assume is updated every time you run a Rails migration). To visualize your schema in Windows:

  1. Install and run the following plugin to convert your schema (db/schema.rb) to an XML format:

    This will generate schema.xml (uses a open standard fromat called XMI).

  2. Download the latest version of starUML for Windows (Version 5.0, released Dec 29, 2005). StarUML is a “software modeling tool and also platform that is a compelling replacement of commercial UML tools such as Rational Rose
    • Open schema.xml from starUML’s Import -> XMI (I chose “Design Model” when importing, but it doesn’t really matter)
    • starUML
    • Go to the Model Explorer (under Design Model”) and drag each table to the design surface

Thanks to Miroslav Škultéty for writing the script and cnruby for converting into a plugin!

Posted in Database, Ruby on Rails, Windows | 1 Comment »

Slick Flash charts (Ziya + XML/SWF) for Rails for a great price

Posted by Chirag Patel on July 21, 2007

I recently installed a really nice set of charts and graphs called XML/SWF Charts using the Ziya plugin for Rails. The nice part is that it costs only $45 for your entire domain. This license fee will remove the link when you click on the chart (it currently goes to their website)

For the most part, the instructions in Ziya’s README were very good. I did run into a few snags, but they didn’t take me too long to figure out. Here’s a rundown. Hopefully this will make it even easier to implement Ziya and XML/SWF:

Under the “Steps” section of the the README:

1. If you get an error message when trying to install the Rails plugin on Windows, be sure to install the Window’s subversion client. This will install the command line svn client and add the subversion path to your environment variables. Be sure to open a new command prompt after installing the subversion client. This is the quickest way to get the latest version 0.12 of Ziya since they don’t make the latest code downloadable.

2. There’s an obvious typo in the following line

graph  = license, title, chart_id )

I changed it to the following to get something working quickly:

graph  = nil, nil, "mychart" )

Here, "mychart" is the name of the YAML stylesheet which will be:


3. My biggest mistake: You can not instantiate the Ziya object in the controller corresponding to the chart’s view. It needs to be in a separate controller. Otherwise, an XML file (instead of a chart) will be returned when that controller is invoked.

In other words, if the following view code is in line_chart.rhtml file (note: here the ‘css_id’ is the id attribute for the <object> element that is rendered in the final HTML)

<%= ziya_chart( url_for( :controller => 'blee', :action => 'refresh_my_graph' ), :id => 'css_id', :bgcolor => "transparent", :width => 400, :height => 250 ) %>

Then you cannot put the following code in the line_chart controller

def line_chart
graph  = nil, nil, "mychart" )
graph.add( :axis_category_text, [ "Dog", "Cat", "Rat"] )
       graph.add( :series, "Series A", [10, -20, 30] )
       render :xml => graph.to_xml

The controller name needs to be different. They used refresh_my_graph as an example

4. The parameters passed into into the ziya_chart helper in the line_chart.rhtml file above apply to the canvas_bg property. These parameter apply to main canvas of the chart and cannot be specificed in the YAML file. The attributes for canvas_bg become part of the static html page.

The best way to specify attributes in the YAML stylesheet is to look at XML/SWF’s reference. It is very well documented and very understandble.

5. I was able to get their sample charting application working pretty quick. It’s the code for Ziya’s website. Download it by typing this at the command prompt (after you’ve done #1 above)

svn co svn://

After you download it, you will need to

a. Create a database called “ruby_dev” in your database server

b. Run db:migrate

Thanks a lot to the folks at for providing such a nice and rich set of graphs and charts for next to nothing. And also thanks to Fernand Galiana and Delynn Berry for such a nicely written plugin to the Rails community!

Posted in Ruby on Rails, Windows | Leave a Comment »

RoR IDEs for Windows

Posted by Chirag Patel on July 10, 2007

Updated on 12/11/07

Here’s a breakdown of Ruby on Rails IDEs for Windows. Please feel free to add to this by adding a comment to this blog entry. I currently switch between RoRED (writing and navigating code) and Netbeans (GUI debugging)

I broke it down in 2 types. Free vs. Commercial



RoRED is a low-frills alternative to Netbeans and Aptana. I’m using it exclusively at the moment because Netbeans is too clunky and I love the MVC tabs. It doesn’t have as many features, but is a nice quick and easy IDE. My favorite things about RoRED (in priority order):

  1. Very lightweight (only 7MB in RAM on my Vista tablet)
  2. Special tabs for Model-Views-Controller grouping! This is very nice because you can psychologically group code by functionality as opposed to folder. I use RoRED instead of Netbeans on many occasions just for this feature alone!!!
  3. How it generally uses tabs/panes insead of hierarchal trees (eg. methods within controllers, MVC tabs).
  4. Ability to load existing RoR projects without a “New Project” process or wizard. You can analyze someone else’s project or tutorial quickly.
  5. Global search (search across files) is pretty cool. Searching is quick and the search results windows goes transparent when you click on one of the search result rows.
  6. Ability to quickly switch between the controller and view of a particular method (which is probably available in most IDEs)

The things I don’t like are

  1. Can only load one RoR application at a time (takes too long to re-open all open files when switching projects)
  2. Autocomplete is very slow (and not that impressive). Very annoying when you type an open parentheses and it waits for autocomplete


Since I have 4GB RAM on my Lenovo tablet, I can take advantage of all its rich features. When I launched Netbeans 6.0 M10 with three RoR projects loaded, the Windows process (java.exe) ended up being a whopping 150MB (as opposed to 7MB with RoRED)! Not for the faint hearted.

I’ve seen 2 blog entries claiming that it’s now better than Aptana. I put the dates because obviously opinions change fast.

  1. July 02, 2007 on Technology for Humans
  2. June 11th, 2007 on Eribium

What I like about Netbeans

  1. GUI debugger!
    • Shut down your existing web server!
    • Run -> Attach Debugger
    • Run -> Debug Main Project
    • Veify that debugger is running (Window -> Output -> Output)
    • Warning: sometimes the breakpoint won’t hit
  2. Integration with Subversion, so I can do a quick diff in the editor
  3. Ability to easily create project from an existing Ruby On Rails application
  4. Local history and the ability to label and delete each entry in the local history (Versioning -> Local History)

What I don’t like about Netbeans

  1. Launches very slowly! And is a memory hog!
  2. Seems to index every Rails project every time you launch Netbeans, which is very slow
  3. Autocomplete can be slow (2 to 5 seconds)
  4. Creates a directory called “nbproject” in your Rails root directory. I have Subversion ignore it.


Used to be RadRails, but recently bought by Aptana. It was a little clunky and flaky when I used it as Radrails a few months ago. See Aptana vs Netbeans articles above.


Supposed to include some re-factoring, but haven’t tried it. Seems pretty primitive.

Ride-ME (Rails IE – Minus Eclipse)

A few months ago, it was buggy and not very impressive


Arachno $50-$100

Released a version in July 2007. Haven’t tried it but screenshots look good. Hopefully it would be lighterweight than Netbeans

Ruby in Steel $200 + price of Visual Studio

Runs on top of Visual Studio, which very nice but obviously a resource hog

Komodo $150

Nothing stood out about it when I tried the trial version

IntelliJ IDEA $500

One of the best IDEs ever made, but I hear it’s so big and clunky nowadays, that it’s almost impossible to use. See ruby-rails-ide-comparison-idea-netbeans-radrails

Posted in Ruby on Rails, Windows | 1 Comment »