Friday, May 29, 2009

RDR : Rails Dynamic Routes

While working on a CMS project we came across with requirement to build SEF urls dynamically in rails. rails have out-of-the-box support for SEF urls having routes.rb.
But what if I need to add new SEF urls without restarting server.. dynamically.
This need gave birth to RDR Rails Dynamic Routes. This is pretty simple utility that I have share on rubyforge. This will enable you to define customised(user friendly) url mapping for your selected controller/action making rails' routes.rb dynamic. No need to have server restart new url mapping is loaded dynamically. No additional dependency of any gems. You can also keep track of new updates on Rubyforge

Enjoy!!

Saturday, May 23, 2009

Evaluating Amazon EC2 for a new startup

Recently I got involved in shaping up a new job portal site. While architecting the application I was sure that it will be best to go for Amazon S3(Simple Storage Service) for storing my unstructured data in forms of pdf, word-docs, ppts. When I started thinking upon deployment options I started digging into Amazon EC2 . This was some interesting thing that I want share about..
We were very clear about our plan. The steps till final release we defined were 1) nightly build release 2) alpha release 3) beta release

Nightly build release is just for developers and testers. alpha release is going to be accessed by some real market users ( a trial access invitations being sent to few top recruiters in US market) and once its accepted by industry then beta release with some marketing. Plan was to have 500 odd recruiters and 5000~6000 candidates in first 3~4 months, which was very modest. But We wanted to keep the application scalable and our deployment architecture such that we can go and keep adding city after city ..Boston..Chicago..NewYork..and so on.. the way craigslist done !

After so much of buzz of "cloud computing" , adding up of Elastic term by Amazon I seriously started looking for it.. claims are really promising.. you are paying only for what you are using and you can scale it factor-n without any hassle and very rapidly.

Big question for us was whether to go for EC2 service from day one? Will it be cost effective from day one?

I started searching answer for these questions.. I revisited pricing of Amazon EC2.

The pricing below is based on data transferred "in" and "out" of Amazon EC2.

Data Transfer In
All Data Transfer $0.10 per GB

So I am going to pay $0.10 for every GB starting from my first byte. When I requested for some quotes from hosting service provider for dedicated server , I got response with quotes ranging from 5$ to 75$ per month with 1500 GB bandwidth included.
It was appearant that if my bandwidth usage is going to be above 500 GB but below 1500 GB then dedicated server is the best bargain for me.. but the day I start consuming more than 1500 GB bandwidth amazon Ec2 would turn me cheaper and also very scalable solution..

Decision was obvious start with a dedicated server and switch to EC2 when you are real candidate for it.. when you really are a growing and scaling application.

So take a pill only when you require it and if you require it :)

Monday, May 18, 2009

Nofollow script for SEO experts

After requested again and again from my SEO expert colleagues, I thought its high time to device something very basic but good tool fir my friends.
nofollow is an HTML attribute value used to instruct some search engines that a hyperlink should not influence the link target's ranking in the search engine's index. SEO experts want to build links for their pages and get their page ranked up high on yahoo/google/msn search engines.
you will get exact idea about how different search engine treats "nofollow" tag from following chart

rel="nofollow" Action Google Yahoo! MSN Search Ask.com
Follows the link Yes Yes Yes Yes
Indexes the "linked to" page No Yes No Yes
Shows the existence of the link Only for a previously indexed page Yes Yes Yes
In SERPs for anchor text Only for a previously indexed page Yes Only for a previously indexed page Yes
courtsey : wikipedia.org
The demand is that when server serves html to bot it should add rel="nofollow" to all external links. Another caveat was that it should not add nofollow to links whose class is "letmefollow"
The solution must be very easy to implement shud not require changes in existing code base php/html

I had played with apache filter in my previous projects . With new APR introduced in Apache2.0 output filtering became more easy and more clean and efficient. Also most of the hosting service provide with apache 2.0 provides mod_ext_filter module enabled in their installation. I deviced a very simple apache output filter using "sed" command. I had to use some advance sed options linke block, goto for this case.

So basically solutions was mainly doing following things
1) configure mod_ext filter
2) add environment variable using apache setenvif instruction
3) enable filter only for bots "bot" in User_Agent field of http request

If anybody wants me to know more on this then please contact me.

Saturday, May 16, 2009

Prologue

Hello firends..
There is prologue for every story, so why dont I.. As this is story of me and Open Source . Working with Open source for last 8-9 years of my IT career it was a overwhelming experience. I still remember days JDK1.1 was introduced and iting experience when EJB got introduced.. days when I memorized ACID properties saying A for Atomicity and C for concurrency..days when I started definining my own MVC architecture based on command design pattern . The warm welcome that we offered when struts got introduced.
Over the nine years thangs had been changed and lots of new things got introduced... lots of experiments been done, open source did not remain confined to Linux or J2EE. PHP came in big way.. apache evolved astonishingly. Journey to the Apache2.0 was mind blowing.. mod_rewrite, mod_proxy, mod_ext_filter, php modules, mod_cache its coming great. An then it was Ruby started very humbly but got into limelight with Rails framework. The days when I worked on ajax using XMLHTTP object and using document.getElementById to access DOM element to the days when we have jQuery and out of the box support for ajax using Rails Tags, isnt it interesting..

I am going to use this blog to share all my experience with these technologies and how they moulded me as they got evolved. How I helped my clients, friends and colleagues in my this journey to bring up applications/solutions for them.

I hope you will also cherish this with me.

Nilesh