Archive for the ‘Open Source technologies’ Category

Open Source Performance Testing

Friday, March 20th, 2009

Open Source has taken a center stage in the development world. It is a community effort which can not stopped. Either you ride it or get run over by it.

One area where open source has not yet made a big dent is in test automation and performance testing.
This area is still dominated by commercial tools. Most of the commercial tools available for automation and performance testing are extremely expensive. The leading tools from HP (QTP, Loadrunner) and Borland ( Silk Performer, Silk Test) come with a huge price tag.

I used to be a developer before I jumped into Performance Testing back in 1998. That time I was still not able to let go of my development skills. For the first Performance Testing assignment I had built a load testing tool using MS VC++ ( are we not talking of open source here?), the GUI for it is shown below. This was perfect for me. It suited all my needs for driving the load on the server. I had other scripts to automate monitoring, logging and analyzing the results ( see the tool image below).  Well right around then the company I used to work for, decided on standardizing the tool set and we settled on Silk Performer ( then a product of Segue). Using the tool was good for my resume value and it did have lots more bells and whistles.
(more…)

Using Sitemap plugin for Rails

Friday, March 6th, 2009

If you have a web site and you want search engined to index your site properly you need to have sitemap for your site. Sitemap is a way to describe your web site, revealing all the static and dynamic links within your website.

I have recently been building a web site based on ROR and I was looking for a plugin to accomplish this. The plugin I used is queso/sitemap from http://github.com/queso/sitemap/tree/master. This link has instructions and also the readme with the plugin gives enough information to install this plugin. The problem I faced was with setting up widgets and the static link in the sitemap_settings link.

Since I am new to Ruby on Rails it took me a while to figure out how to setup the widgets and static link in the sitemap_settings url.  To explain how I had setup the sitemap I am going to use  the model “Term” as an example. Basically I needed Sitemap to display the url of list of terms http://www.mydomain.com/terms and all the individual terms like http://www.mydomain.com/terms/term1, http://www.mydomain.com/terms/term2 etc.

In the Widgets setting screen I added a widget named Term and entered the information as shown in the image below. The model is going to be “Term”. The named route is “terms_path” which resolves to http://www.mydomain.com/terms. Correction: The named route is “terms_url” which resolves to http://www.mydomain.com/terms. Make sure to look up your routes to see if the name route you are providing is relevant and available ( use  >> rake routes command). If you leave the finder method blank, the sitemap plugin will use find(:all) method of the model to get the list of all items in the model. Sitemap plugin is going to generate an XML comprising of the url for list of terms ( http://www.mydomain.com/terms ) and the url of individual terms (http://www.mydomain.com/terms/term1, http://www.mydomain.com/terms/term2 , etc.).

You can create a custom finder method. We have created a find_sitemap class method in the Term model as shown in the code below:

 def self.find_sitemap(*args)
    find(:all,:conditions=>['state=?','published'])
  end

 This method is going to find all terms that are in published state. One issue I ran into was the url being generated by the sitemap for the list was coming out as “/terms” instead of “http://www.mydomain.com/terms”. I had to hack the sitemap code to get this right. I had to change the code in show.xml.builder of the sitemap plugin. The code block is shown below. The following was added in line 3 in the url_for method: “root_url.chop + “. I am not sure if this is the most graceful way but I was kind of in hurry. Pardon my ignorance. There was nothing wrong with the sitemap plugin it expects a named url ( contains the entire url) instead of the path ( contains relative path). The named route in the following image should be “terms_url” instead of “terms_path”.

Sitemap Widget

Sitemap Widget

Making Permalink_fu work

Tuesday, March 3rd, 2009

I recently came across an issue in trying to use Permalink_fu plugin for rails. The problem happened while trying to create permalinks for existing records. Lets say you are trying to add permalink facility to a model “Designers”. You already have a few records in the database and would like to generate the permalink for them. This can be done as following:

Designers.find(:all).each(&:save)

This would give an error: Iconv::InvalidEncoding: invalid encoding (”ascii//translit//IGNORE”, “utf-8″)

Turns out code needs to be changed in permalink_fu.rb at line 90.
The order is not correct. Commented out portion is what comes with the plugin. The subsequent statement is the correction.

# PermalinkFu.translation_to = ‘ascii//translit//IGNORE’
PermalinkFu.translation_to = ‘ascii//ignore//translit’

Please refer to this tutorial on using permalink_fu.

Also use this Reference

Setting up tiny_mce_plus plugin in rails application

Wednesday, February 25th, 2009

I recently had to struggle with setting up tiny_mce_plugin and spend a whole day trying to get it working. Troubleshooting it was very difficult since tiny_mce_plus plugin has dependencies on other plugins ( mentioned below) and there was no one place where everything was laid out to make it to work. I had to really dig in. The last step is the most important.

The following are the steps I had used to make it work on windows.

(more…)

ActionController::InvalidAuthenticityToken error when using firefox

Friday, February 20th, 2009

I recently came across “ActionController::InvalidAuthenticityToken” error while working on an ROR application. It kind of threw me off track. I was thinking this error is somehow related to cross-site request forgery and something to do with protect_from_forgery option in application.rb controller. This error would only show up in Firefox and not in IE.

The problem is that Firefox as per standards does not allow form elements to be inserted within the “table” or “tr” elements (You can embed a form within the “td” and it will work). The form functionality gets broken if it is within the “table” or “tr” elements and you can get unpredictable results. The following is a mortgage calculator form. Firefox gave the “ActionController::InvalidAuthenticityToken” error when the remote_form_for helper was used within the table as shown below.

(more…)

Setting up Ruby on Rails at Bluehost

Tuesday, February 10th, 2009

I recently hosted my Ruby on Rails (ROR) application at Bluehost and I am laying out a step by step approach. I have tried to keep it as simple as I can.

The following steps are for setting up ROR application in a shared hosting environment at Bluehost. Bluehost does not let you use mongrel in a shared hosting as this requires running the server at a different port (12010 etc..). In order to use mongrel you need to have a dedicated IP.  In a shared hosting environment you will need to enable FastCGI in your web server ( Apache). Also the following example uses an Add on Domain .

(more…)