Thursday, December 27

Ruby vs PHP - I

The more I speak on or about Ruby or Ruby on Rails, I got to face more and more questions.
I found list of few interesting videos comapring Ruby/RoR with existing languages/frameworks.
All the videos do reflect the points I have stressed with respect to Ruby:
1. Ruby easy to pickup
2. Ruby clean to code and easy to maintain.
3. Improves the coding standards and abilities of the developers.
4. Convention over Configuration.
5. Many built-in features and support.
6. DRY (Don't Repeat Yourself) principle

Do observe the above points while you go through the video presentations :)

Do observe the above points while you go through the video presentations :)

Do observe the above points while you go through the video presentations :)

Tuesday, December 18

Ruby on Rails simple examples & String Class

After the previous post, hope you successfully installed the ruby on to your machine and ready to speed up our tutorials.
Now let us see a simple math example, factorial function. How do we write a program that would calculate the factorial value of integer that we would pass.
Basically factorial is:
n! = 1                (when n==0)
   = n * (n-1)!       (otherwise)
  • The simple logic that we are aware is, factorial is nothing but a recursive function call.
It means we write a function and will be calling the same function within that. So this would look something like this:

If you notice here there are lot of points to carry with us,
  • You may notice the repeated occurrence of end.
  • You may also notice the lack of a return statement.
  • It is not needed because a ruby function returns the last thing that was evaluated in it. Though use of a return statement is permissible but it is not necessary here.
  • ARGV is an array which contains the command line arguments, and to_i converts a character string to an integer.
  1. What happens if I pass string as argument instead of integer?
  2. At the line “12”, replace the double quote with single quote and see what happens?
Download or View on Scribd

Ruby String Class:

A String object holds and manipulates an arbitrary sequence of bytes, typically representing characters. String objects may be created using String::new or as literals.

Because of aliasing issues, users of strings should be aware of the methods that modify the contents of a String object.

· Methods with names ending in ``!’’ modify their receiver.

· Methods without a ``!’’ return a new String.

Ruby deals with strings as well as numerical data. A string may be double-quoted ("...") or single-quoted ('...').

· A double-quoted string allows character escapes by a leading backslash, and the evaluation of embedded expressions using #{}.

· A single-quoted string does not do this interpreting; what you see is what you get.


If you had done the above mentioned experiments, it is easy to understand the above two points. The difference between the double and single quotes around a string. There are plenty of methods that ruby offers, they come very handy!


str.capitalize => new_str

This method turns the first letter of the string to upper case.

"ruby".capitalize    #=> "Ruby"

Methods with names ending in ``!’’ modify their receiver.


str.capitalize! => str or nil
Modifies str by converting the first character to uppercase and the remainder to lowercase. Returns nil if no changes are made.

   a = "hello"
   a.capitalize!   #=> "Hello"
   a               #=> "Hello"
   a.capitalize!   #=> nil
Find more examples and other methods ruby supports.
Download or View on Scribd

Tuesday, December 11

Ruby on Rails Installing Ruby

Though you continue to work/experiment more on the online ruby editor, today we see how we would install the ruby on windows OS.
Recollect "Ruby is portable, which means can be installed on all OS's possible"

Ruby Installer for Windows. Download the executable ruby186-25.exe and double-click this file to install Ruby on your PC. (Accept all the defaults.)
Once you have installed your Ruby software, the System Environment Variable path is already set to point to the bin folder of Ruby. The installation also includes the First Edition of Programming Ruby book and the SciTE editor.

Just recollect what we had done and what's the Ruby Environment looks like.

Assuming that you installed Ruby in the folder c:/ruby, then the installation creates a number of sub-folders. See the list below.

c:/ruby/bin : Here the Ruby executables (including ruby and irb) have been installed.
c:/ruby/src : Here you get the Ruby source code.
c:/ruby/lib/ruby/gems : Here are the Ruby-Gems.
c:/ruby/lib/ruby/1.8 : Here you'll find program files written in Ruby. These files provide standard library facilities, which you can require from your own programs if you need the functionality they provide.
c:/ruby/lib/ruby/1.8/i386-mswin32 : Here you find architecture-specific extensions and libraries. These files are C-language extensions to Ruby; or, more precisely, they are the binary, runtime-loadable files generated from Ruby's C-language extension code, compiled into binary form as part of the Ruby installation process.
c:/ruby/lib/ruby/site_ruby : Here you store third-party extensions and libraries. This include your own code or some third party.
c:/ruby/samples/RubySrc-1.8.6/sample : Well, here you will find some sample Ruby programs.

From now we can also execute ruby snippets on the locally installed SciTE editor.
Open the Editor: start/Programs/Ruby-186-25/SciTE.
Press F8 to open an output window.

Create a folder named, say. rubyexamples on your C:\ and will keep all our programs in this folder. Let us repeat the our first program, that we had done yesterday online. That is

puts "Hello World!"

Now save the file as "hello.rb" under c:\rubyexamples folder. Note all ruby source files have the .rb extension.

Pressing on F5 would execute the program and outputs the string "Hello World!" on right side window.

  1. # hello.rb
  2. puts 'Hello'

Alternatively you can also type command "ruby hello.rb" to execute the hello.rb file.

Having installed the ruby on local system now repeat the yesterdays examples and practice more for better understanding.

Download the pdf version of Installing Ruby post.

Monday, December 10

Ruby on Rails Learning through examples

What ruby is used for?
Let us recollect the statement:
Ruby is "an interpreted scripting language for quick and easy object-oriented programming".
Ruby is used for many kind of applications be it writing automation scripts and run on your local pc's, or developing automation tools, or Website, or Blogs, Web Application or web based products and the list goes on...

We here pick up basics of Ruby just enough to get going with Rails and start developing simple websites and web applications.
All the things that we had said about ruby in earlier post What is Ruby? will be discussed in coming posts.
Learning through Examples:

Before even going for installing the ruby in your desktop, let us experiment on ruby with small examples and work/execute them here online.

This is our play ground:
This is called interactive ruby shell and we find ">>" similar to command/shell prompt. Now let's start with famous example of printing out "Hello World!" statement.
  1. type puts "Hello World!" >> puts "Hello World!"
  2. then click "Enter" button
  3. Now you would find the expected returned
  • >> puts "Hello World!"
  • Hello World!
    => nil
So puts is the ruby way of printing the things to console/prompt. The first line means to print the string within the quotes(i.e. Hello World!). Your would also find "=> nil" displayed in the next line of the Hello World! statement, puts always returns nil, which is Ruby’s absolutely-positively-nothing value.

Going on to the next example:
  • Ruby has simple syntax.
  • Ruby is dynamically typed.
  • Ruby needs no variable declarations.
  • Ruby operators are also methods.
Now I want to do simple math. Based on the above points,
to add two integers just type : 4+2
to subtract two integers just type : 4-2
to multiply two integers just type : 4*2
to divide two integers just type : 4/2
You can check out with other types also. Need not be of same type, since ruby is dynamic language at the run time they would be evaluated.
for example you type 2.0+3 and see for yourself.

Coming on to the variable declaration, ruby does not require the variable declarations. Let us the see this point also:
you type
>> a=5
As you see we have not declared the variables a,b,c and what type they hold. All these variables are evaluated at the run time and treated accordingly.
Ruby treat the operators(+,-,*,/,%...) as just like methods, which is conceptually derived from Smalltalk.

Download the pdf version of Learning Through Examples.
The pdf includes:
  • Useful links
  • Duck typing explained with example.
  • Examples with appropriate comments and explanation.
  • Ruby resources links.

Friday, December 7

Ruby on Rails - What is Ruby?

So, I am not just going to stop by providing the Ruby on Rails course structure.
I am here to start sharing the concepts what I understood about Ruby on Rails.
A gentle disclaimer, Nobody is perfect and in my attempt to become close to perfection I relied on world wide web to learn better and to understand the concepts clearly.

So let's start today with Introduction topic and discuss more on What is Ruby? If you are in hurry you can download What is Ruby?

Initially Some History about Ruby:

The language was created by Yukihiro "Matz" Matsumoto, who started working on Ruby on February 24, 1993, and released it to the public in 1995. "Ruby" was named as a gemstone because of a joke within Matsumoto's circle of friends alluding to Perl's name.

Some useful links that come handy when you are going through the course material:

Scripting Language :

Compiled Language :

Compilers :

Interpreters :

Object Oriented Programming :

Jargon to watch out:
Ruby, Interpreters, Compilers, Scripting Language, Compiled Language, Mixins, Operating System, Unix, Linux, Modules, Closures, Threads, Exceptions, Garbage Collectors,

Download the detailed Ruby on Rails Course contents.

Reach me @ tosumanthkrishnaATgmailDOTcom for more discussions.

Ruby is "an interpreted scripting language for quick and easy object-oriented programming".

Don’t be alarmed. We will take one by one:

Interpreted Scripting Language:

  • Ability to make operating system calls directly
  • Powerful string operations and regular expressions
  • Immediate feedback during development
  • Ruby programs can be executed from source code.(means to say need not be compiled)
Object Oriented Programming:
  • Everything is an object
  • Classes, inheritance, methods, etc.
  • Singleton methods
  • Mixin by module
  • Iterators and closures


  • Runs on many different operating systems.
  • Windows 95 through XP, Linux, UNIX...

Simple and Fast:

  • Variable declarations are unnecessary (remember: everything is an object... including primitives)
  • Variables are not typed
  • Syntax is simple and consistent (like you are expressing something)
  • Automatic memory allocation and garbage collection


  • Exception processing model
  • Dynamic loading
  • Threads

Download the detailed Ruby on Rails Course contents.

Download What is Ruby?

Reach me @ tosumanthkrishnaATgmailDOTcom for more discussions/tips/suggestions.

Wednesday, December 5

Ruby on Rails - Course structure

You find lot of materials, websites and many articles where you get information about Ruby and Ruby on Rails.
Well, do not get over loaded with the information. If anybody is serious about learning and practicing Ruby on Rails, can make use of the below course structure. This course structure, I had just jotted down to train freshers and friends whoever interested to know more about RoR.
Note: This structure is framed based on
  1. my experience in RoR.
  2. my previous session on RoR gathering.
If anybody is interested can contact me for more information.

Download Ruby on Rails course structure in pdf

Prerequisites for the RoR Course:
The course is structured keeping in view of less experienced/freshers in the industry. So considereable time is given for all introductory topics.
However, having knowledge/experience is an added advantage:

1. Exposure to any of the programming languages (c,c++,c#,java...)/Scripting languages(perl, php, smalltalk...).

2. Overview on how web application works.

3. Understanding of the necessity of Data models, Configuration Management.

4. Necessary tools/IDE's (Eclipse IDE, notepad...)

5. Good Analyzing skills.

6. Web Technologies (HTML, JavaScript, CSS, XML, )

Download Ruby on Rails course structure in pdf



· What is Ruby?

· What is it used for?

· Where do I get and install Ruby?

· Core facilities, built-in library and standard library.

· Basic concepts - object orientation, regular expressions, arrays, hashes, etc.

Basic Ruby Language Elements

· Structure of statements and comments.

· Variables and constants.

· Operators. Assignments, calculations, etc. Integer, float and string formats.

· Single and double quotes, here documents, general strings.

Control Structures

· Blocks and the if statement.

· Writing conditions.

· Comparative, boolean and range operators.

· Conditionals - if, unless, case, etc. Loops - while, for in, until, etc. break, next, retry and redo. defined? and ternary operators.

Object Orientation: Individual Objects

· History - unstructured and structured code. Introduction to object oriented programming.

· Classes and methods.

· Static and nonstatic.

· Instances, constructors and destructors.

· Accessing members of a class.

· Loading and using classes.

· Direct access to variables.

· Encouraging class use.

Classes and Objects

· Objects, classes and methods.

· Constructors and attributes.

· Instance and class variables.

· Local and global variables.

· Class and object methods.

· Including files - load and require.

Collections (Arrays and Hashes) in Ruby

· What is a collection?

· Arrays and hashes.

· Constructing an array.

· Nesting arrays. Hash keys, iterators, etc.

More Classes and Objects

· Public, private and protected visibility.

· Singletons and defs.

· Inheritance mixins, and super.

· Destructors and garbage collection.

· Namespaces and modules.

· Hooks.

· Calling methods with code blocks.

· Looking inside objects - reflection.

Strings and Regular Expressions

· Anchors, literals, character groups and counts.

· Matching in Ruby.

· Modifiers i, o, x and m.

· Pattern matching variables.

Special Variables and Pseudo-Variables

· ARGV, $0 and friends - the command line.

· Other special variables from $: through $ to Other special variables from $: through $ to Other special variables from $: through $ to Other special variables from $: through $ to $<. lt;. lt;.

· Environment variables.

· Pseudo-variables.

· Reserved words in Ruby.


· begin and end (and a mention of BEGIN and END).

· Raise and rescue.

· Throw and catch.

Download Ruby on Rails course structure in pdf

Ruby on the Web

· CGI and the Ruby Apache Module.

· Using cgi.rb; URL decoding, forms, sessions, cookies, etc.

· Embedding Ruby in HTML - the <% <%= and <%# tags.

Ruby GUIs, XML, MySQL Database Connectivity

· Using Ruby/DBI to connect to MySQL, Oracle, etc.


· What is MVC Architecture?

· Importance of it?

· How it helps?


· What are WebApplications?

· Essentials of WebApplications?

· SDLC (Software Development Life Cycle)

· Database Architecture

· Configuration Management (concept & tools)

· Application/Web Servers

Rails Framework

· What is Ruby on Rails?

· MVC (Model, view, controller) design principles.

· Rails structures -

o WEBrick servers,

o URLs and embedded code.

o Directory structure.

o Database connections.

· Creating the application

o the database and tables.

· First application through Scaffolds.

· Validation and customising the display.

· Adding a new controller.

· Adding viewers and layouts.

· Active Records.

· Emailing and logging from within Rails.


· What is AJAX?

Ajax on Rails

· How to implement AJAX on Rails framework?

· What is Protoype?

· What is Scriptaculous?

· Ajax Effects.

· Rich UI experience.

· Visual Effects.


Download Ruby on Rails course structure in pdf
I am open to receive any enhancement tips and open for discussion on the course structure.(tosumanthkrishna AT gmail DOT com)

Ruby on Rails - The 10 Most Marketable Web Development Skills

After the brief talk on Ruby on Rails at Twincling society which was successful and satisfactory, I am keen on writing and talking more on Ruby on Rails development.
So one of the FAQ's I face most is
What is Ruby on Rails and what is the market for it?
I stumbled across one such article "The 10 Most Marketable Web Development Skills", where the list of web development skills provided.

  • This is not any comparison but just listing out current web developement skills that have market.
  • The order of the list is not based on any popularity.

Thursday, November 22

Ruby on Rails - RoR

It's been quite appreciable amount of time that I spent on Web Technologies and been involved with many web based products. I was working on RoR. Yes it's the same thing much talked topic among developers and many web gurus.
Ruby on Rails :

Why to re-invent the wheel?
I am not going to talk on
What is ruby?
What is Rails?
Because many had already done enough work on that.

Then Why this post?
Recently I had been to a talk on Ruby on Rails, attended by many people belonging to different groups like from developers to mangers. I was very much inspired by the speaker. Mr. Rajasekhar an eminent speaker, I would say he did really good job by framing up all necessary details for any fresher to start experiments on Ruby on Rails in just 3 - 4 hours of session.
I got an oppurtunity to explain and elaborate the concepts with working examples and live projects here and there between Rajashekar's session.

The session went on so well and also it was a gentle reminder for me to start sharing on RoR.

Geeks watch out this space... more to come!
More about the Session
More about the OpenSource Community

Tuesday, October 30

Halloween across TimeLine

Wondering how come a technical blog has a post on Halloween festival!!!

The reason is I am inherently talking about yet another new website.
Website that is more creative, more useful, more informative, more unique and what not all possible features - I would say web2.0 example
Yes it is xtimeline.

Since tomorrow is Halloween day, I am embedding the history of Halloween, just replaced x with Halloween.
Happy Halloween!!!!!!

Saturday, September 22

Quotes Collection just crossed 100 - Quotiki

The concept of bookmarking sites is to collect the favorite website or posts that user likes and make it available all the time. Of course many added features include even sharing them, discussing on them... These bookmarking sites are big hit. So also I feel this Quotiki would be... as I mentioned even in my earlier posts about this, it is the place where the user would collect his favorite quotes, read new quotes, share the quotes, find/submit more info on the quotes he come across.

Why this Post ?
This is my way of telling/expressing my thanks to Quotiki as I collected little more than 100 quotes. You too can read through my collection.

Wednesday, June 6

Behind the Scenes - Part 5 general Interview Q&A

As part of Behind the Scenes, today I would like to dwell upon the general Questions that interviewers are fond to ask. It is well known that however technically strong you are, you still need to have good communication, commitment .... Though these are not related to the technical questions they ask you, and answers you give them, inherently interviewers evaluate you basing on how you communicate, your confidence level and so on.
But there are few questions that interviewers ask you to find more about candidates personality, willingness to unlearn, relearn, and many more.
I am here embedding set of such Questions
"How to answer the 64 toughest interview questions?"

Wednesday, May 23

Permission-based Marketing - mGinger

From past few days everywhere I am hearing about this new site based on "permission-based marketing" - that is mGinger
It is unique of its kind of marketing. Now you will be paid for reading advertisements that you wanted. Interestingly, you can set the kind of ads you want and read about. Though the CEO says
"People can make anywhere between Rs 300 to Rs 1,600 per month through this and When users get paid by us, whether it is Rs 300 or Rs 500, it can atleast cover their mobile phone bills"

So as usual with new idea there comes the cloud of doubts and allegations about the genuineness of this campaign. Though even I am sceptical about this but still I would like to share the related articles regarding this

Wednesday, May 2

Quick References for developers - 2

This is one more useful site for developers to refer the syntax while they code.
Quick References

Earlier Posts:
Cheat sheets -2
Cheat sheets

Wednesday, February 28

Behind the Scenes - Part4 Ground work

Whenever a candidate comes for an interview, surely he would have prepared a lot on his subject and he would have brushed through the latest happenings. This will give him lot of confidence, indeed he will be more confident. But when the interviewer asks any simple out of box question they will fall flat. Take it from me interviewers always try to make candidates comfortable, they always put simple and straight questions.

Some of them will be very silly. But for candidates they seem out of box questions. Watchout for some questions like:
-> Which version of the tools that you are working on?
(Good Practice: Know more about your tools that you are daily working with)
-> Which version of the software that you are working on?
(Good Practice: Know more about your software that you are daily working with)
-> Some details about the company.
(Good Practice: Go through the company's site before attending the interview)

Tuesday, February 6

Monitor any webpage with Page2RSS

We are all aware of the recent buzz that was created by RSS . RSS helps to get the feeds of the favorite/selected sites that gives away the xml/RSS feed (more on RSS). But what if my favorite sites are not publishing any feeds?
Page2RSS is just a perfect solution. Just enter your favorite site which you want to monitor and it will display a meesage as below:
This page is monitored for updates. There are no any changes detected since 02/05/07 06:57:40.
To receive updates for this page in RSS format copy-paste this link into your feed reader. And add the link to your RSS readers and you will start receiving the changes.
You can drag and bookmark the link Add to Page2RSS and click on the bookmarked link if you want to monitor the site you are viewing.
This way we can monitor almost every site that we browse across.

Monday, February 5

Goals - Revise, Revisit, Realize

Everybody will have tasks/aims/goals in their life, be it personal/career/business. I was reading a book Goals written by Brian Tracy which talks about the importance of having goals in one's life and Brian Tracy also site's that making a list of Goals, Revising, Revisiting them often will help in Realizing them. I stumbled upon few sites where you can make you goals/things you wanted to achieve public/private and keep monitoring them. There are many websites that will help you in this way.

43 Things

Online Photo Editing Tools

How many time you felt to brighten/edit those photographs of yours taken on your trips/occassion ? You need not have the Photoshop tool to make these minor changes. You read it correctly, there are enough web based tools that will do the similar job of that of your photoshop. Here I am listing down few of such online photo editing tools:
Try them out!

Wednesday, January 31

Mind Maps -2

Reading through the Mind maps, will ignite anybody. The following are the links with lots of mind maps.


Mind-mapping tools are finding a home in corporate IT

Using mind mapping software for web research

Turning systems models into projects
(Related to ORM - Outcome Relationship Model)

Funnel timeline: A visual approach to project planning

Project estimating - Mindmaps are a tool in the armory

How to use mind mapping software for project management

Mind Mapping and Project Management

Mind maps provide a view for collaboration

Tuesday, January 30

Mind Maps -1

"A Picture is worth than thousand words !" I hope everyone will agree with this fact. This is the fundamental principle that backed our growth, association to things, relations... Let me put this way, You might have noticed in the kindergarden days how the text books, guides and all the tools and material carried more pictures and images than the content. So why not to follow the same way in every thing we do in our daily life/business life?
Mind map is the answer.
A mind map is a diagram used to represent words, ideas, tasks or other items linked to and arranged radially around a central key word or idea. It is used to generate, visualize, structure and classify ideas, and as an aid in study, organization, problem solving, and decision making. More...
In the life of a Software Programmer, there are few key things like SDLC of any project and TROUBLESHOOTING skills while coding which he/she should be knowing. Here I am going to link two mind map samples for the above :
Believe it or not! We can use this technique of Mind maps in almost anything. Learn Mind maps, use them, enjoy the benefits and see the difference.

Monday, January 29

Quotiki - Collect your favourite Quotes

Quotations are very much power boosters. I stumbled upon this Quotiki where anybody can publish quotes they know, rate the quotes, tag the quotes and filter the quotes based on the Author, User, Tag(s). Here are some of my favourite quotes.

Friday, January 19

Behind the Scenes - Part3 Ajax

When I joined the interview panel in selecting PHP developers, I used to get minimum of 5-6 resume a week. In many of the resumes I notice them mentioning Web 2.0 and Ajax in their skill sets. During the interviews, either in person or telephonic they will be trapped by these terms. Many candidates fill up their resume with latest and hot technologies. But when we proceed towards asking any questions, many reply that they just started preparing/playing around with it.
But Ajax is not a technology in itself, it is a term that refers to the use of a group of technologies. The intention was to bring more user respone by exchanging small amounts of data with the server behind the scene, without refreshing entire page for every request that user sentds. I do not want define about this here as many sites/blogs have already done in better ways and with lots of examples. There are many Ajax based applications, many frameworks/toolkits are available. May it be Scriptaculous, Backbase ...
Ajax Solutoire lists down all the Ajax based frameworks, toolkits, applications and many resources. Have a look and feel the user friendliness.

My earlier posts on Interviews:
Behind the Scenes - Part2
Behind the Scenes - Part1

In my previous post I listed many such successful applications.
YUI Ajax feed reader

Wednesday, January 17

Behind the Scenes - Part2

This time I was in the panel where candidates with Java and .NET experience were interviewed. To make the candidate feel more comfortable I was asking them about their project experience and told them to explain us about the projects they handled. A candidate told us that he did his project using ASP.NET and of course the database was SQL. I asked him what queries they used to retrieve data from more than two - three database tables. His answer really amazed me, "he said he uses the data set!". He could not give more information for that question.
The data set is a simple GUI box through which queries will be formed by simply filling up the fields with respective table names with which it makes contact.
I feel this kind of a tool will effectively enhance the productivity but sooner they will make developers dumb. I am not saying NO to such tools, but we should always keep in mind that even such tools also use the basic query form and to get the results. I feel it is good for us to get our basics right first!

Earlier Post: Behind the Scenes - Part1

Tuesday, January 16

Google co-op - Customize Google search engine for your site

What is this?
Co-op is a customized Search Engine that is built using Google's core search technology. It prioritizes or restricts search results based on websites and pages that user specify, and which can be tailored to reflect user's point of view or area of expertise.

How does it Work?
User can specify/submit the websites that he wants Google to search (It can be his own blog/website). Once you choose the list of websites Google needs to search in, create it. There will be a piece of code generated that user needs to add in his/her website. This code contains a simple search box and button to search.

Want to see it in action. You can try it out this in the Techsavvy Tips I have given in this page itself on top.

Do not worry about the look and feel of the results shown here, you can actually customize the look and feel of it!

This is very effective and useful as it

  • Searches in the specific site. You can replace existing search option in sites.
  • Easy to customize the look and feel.
  • Can connect to web results too...
Know more about this by learning FAQ's
Register here for the Google to search in your website/blog.