Monday, November 8, 2010

How to: write rcov test

'rcov' is a ruby test coverage tool which tells you how effective is the test by giving you the complete coverage of the test that you have written.

You can use it in any of your projects and check your test effectiveness.

First install the gem

$gem install rcov

Next generate the rcov documents like below

$rcov -I lib spec/*.rb --exclude ^spec,/gems/ -T --no-html

The above parameters tell rcov to include lib directory as well as all files inside spec dir and exclude all the gems.
Also, it displays the output in terminal and doesn't generate the html file. You can take the --no-html flag off if you like an interactive html view which is inside the coverage folder.

You can achieve the same with rake task also like below:

Include the 'rcov_custom' file in the rake file.

# In Rake
require File.expand_path(File.dirname(__FILE__) + '/lib/tasks/rcov_custom')

Next you write the following in the file.
# rcov_test.rb
desc "Custom rcov" do |t|
t.rcov = true
t.rcov_opts = %w{--exclude gems\/,spec\/ -T}

In terminal, check the rake tasks.

$Rake -T

You should see a custom rake task named 'Custom rcov'.
Finally, generate the rcov test whenever you feel like with the rake command.

$rake rcov_custom

Hope your code is 100% covered up by your test. :)

Wednesday, September 1, 2010

mySysGit and Pik -- Git and RVM for Windows


1) mySysGit - Git for Windows:


Git is almost inseparable from Rails as they both go hand in hand. The Rails development process suddenly becomes professional, managed and easy with Git. To get it working on windows, we need a windows version of Git i.e. mySysGit.

Watch the video below on installing and using Git On Windows from then just download and install mySysGit from




2) Pik – RVM for Windows:


If you would like to manage multiple versions of ruby on windows, just download the latest pik-0.2.8.msi from and install it.

Pik is an excellent windows tool by Gordon Thiesfeld in the place of Ruby Version Manager (RVM). You can find more about pik on Github at and try installing ree and ruby 1.8.7 along with 1.9.2 with ‘pik add’ command.

 >pik add C:\ruby\IronRuby-091\bin
Adding: 091: IronRuby on .NET
Located at: C:/ruby/IronRuby-091/bin

If pik is not working, you may need to add path to your installed directory in Windows enviroment by following this guide. Assuming, the directory C:\bin is in my path:


Tuesday, August 31, 2010

Cut & Paste in Mac OS X


As recently, I started working with Mac and at once realized that a simple functionality was missing in the Snow Leopard OS X Finder, and that’s Cut & Paste. With googling I found this app, moveAddict which solves this basic problem for free. This means you no longer have the hassle to arrange the two windows and drag n’ drop the item to accomplish the feat.

moveAddict provides a systemwide menu, Finder-window toolbar buttons, and customizable keyboard shortcuts for cutting and pasting files—along with a few useful extras.



MoveAddict provides cut and paste commands in the menu bar (left) and in Finder-window toolbars (right); you can also use keyboard shortcuts.


  • It works with the usual keyboard shortcuts for cut and paste (cmd-x/cmd-v) as default.
  • A notification window and Finder file labels provide user-friendly feedback at every stage.
  • Original data remains untouched until the move gets safely registered by the Finder.
  • moveAddict does not modify the Mac system in any way, it is just a small (5 MB) application.
  • Hide moveAddict’s icon which will only show again when you cut a file.

The free version can only move one item at a time and doesnot have the feature of merging folders priced $4.99.

Download moveAddict

Monday, August 30, 2010

Ruby on Rails on Windows

So, you guys wanna kick start Ruby on Rails (ROR) on Windows as you can’t afford a Mac or you can’t get to work with *nix platform. Then this step by step guide just for you and what a better day to start as with the grand launch of .

Well, there’re two popular ways to install ROR on a PC with Windows OS, one is a normal installation with exe setup files and another(recommended) is through cygwin in a *nix environment under windows. I will discuss the latter one in next post.


1)  Download Ruby Installer (1.9.2 or 1.8.7) and run through the wizard with all the defaults to install Ruby. If you don’t have a preferred IDE or editor, windows ruby comes with scite, which is pretty cool.

2)  Next, we’ll need to install some gems (standard Ruby package manager or ruby plugin libraries). So just download the RubyGems zip file, extract, then run “ruby setup.rb” in your newly installed Ruby prompt or just double click the setup.rb file. If your RubyGems system is old, update it by running (in cmd or Ruby CLI)

gem update —system

3) We will be using SQLite instead of mySQL to minimize pain.   Download the pre-compiled version of sqlite-3_7_2 (install) from the SQLite web site and, unzip it and copy sqlite3.dll and sqlite3.def to your ruby/bin directory (or copy to c:\Windows\System32).

4) Now that SQLite3 is installed, just install the gem:
gem install sqlite3-ruby

5) Install all of latest Rails (gem) and its dependencies through the command line:

gem install rails –pre

6) Test ROR by Creating your application skeleton and start the server: 

rails new path/to/your/new/application
cd path/to/your/new/application
rails server

You're running Ruby on Rails! Follow the instructions on http://localhost:3000.


Click about your application’s environment to see the details. If you see the above screen, you’re successfully running ROR. Cheers.

6) Finally don’t forget to read the first 2 sections of this tutorial to get going

Now enjoy Ruby on Rails.

Thursday, June 10, 2010

FIFA World Cup 2010 Schedule in Nepali Standard Time

The 2010 FIFA World Cup will be the 19th FIFA World Cup, the premier international football tournament. It is scheduled to take place between 11 June and 11 July 2010 in South Africa. The 2010 FIFA World Cup will be the culmination of a qualification process that began in August 2007 and involved 204 of the 208 FIFA national teams. As such, it matches the 2008 Summer Olympics as the sports event with the most competing nations.
This will be the first time that the tournament has been hosted by an African nation, after South Africa beat Morocco and Egypt in an all-African bidding process. This decision left the Oceania Football Confederation as the only confederation yet to host the FIFA World Cup. Italy are the defending champions. The draw for the finals took place on 4 December 2009 in Cape Town.
This is the first World Cup that does not include any teams that are qualifying for the first time, although two of the qualifiers (Slovakia and Serbia) have previously appeared only as parts of former competing nations. Slovakia was previously part of Czechoslovakia, and Serbia has competed as part of Yugoslavia and Serbia and Montenegro. In both cases FIFA considers these teams to have retained the earlier nations’ records.

Well, I just caught the football fever since World Cup starts tommorow. I downloaded the original shcedule from fifa with GMT time and converted the time schedule according to Nepali time format (+5:45 GMT), so feel free to click the image below and save it.

FIFA World Cup 2010 Schedule in Nepali Standard Time

FIFA 2010 World Cup Venues

JohannesburgSoccer City91,141
DurbanMoses Mabhida Stadium70,000
Cape TownCape Town Stadium69,070
JohannesburgEllis Park Stadium62,567
PretoriaLoftus Versfeld Stadium51,760
Port ElizabethNelson Mandela Bay Stadium48,000
BloemfonteinFree State Stadium48,000
PolokwanePeter Mokaba Stadium46,000
RustenburgRoyal Bafokeng Stadium44,530
NelspruitMbombela Stadium43,589

2010 FIFA World Cup Official Song with Lyrics

Hope you catch the flu... and may Argentina win..

(Source:,, soccerinnepal.blogspot, ktm2day)

Sunday, March 21, 2010

Register for Visual Studio 2010 Beta Exams for Free

You are invited to take part in one or more beta exams for Visual Studio 2010 and the Microsoft .NET Framework 4.
If you pass one of the beta exams, the exam credit will be added to your transcript and you will not need to take the exam in its released form. The 71-xxx identifier is used for registering for beta versions of MCP exams, when the exam is released in its final form the 70-xxx identifier is used for registration.
By participating in beta exams, you have the opportunity to provide the Microsoft Certification program with feedback about exam content, which is integral to development of exams in their released version. We depend on the contributions of experienced IT professionals and developers as we continually improve exam content and maintain the value of Microsoft certifications. The following exams are a part of this beta offering.
Exam 71-511, TS: Windows Applications Development with Microsoft .NET Framework 4
Exam 71-515, TS: Web Applications Development with Microsoft .NET Framework 4
Exam 71-513: TS: Windows Communication Foundation Development with Microsoft .NET Framework 4
Exam 71-516: TS: Accessing Data with Microsoft .NET Framework 4
Exam 71-518: Pro: Designing and Developing Windows Applications Using Microsoft .NET Framework 4
Exam 71-519: Pro: Designing and Developing Web Applications Using Microsoft .NET Framework 4

Registration begins: March 17, 2010
Beta exam period runs: April 5, 2010 – April 30, 2010
Receiving this invitation does not guarantee you a seat in the beta; we recommend that you register as soon as registration opens. Beta exams have limited availability and are operated under a first-come-first-served basis. Once all beta slots are filled, no additional seats will be offered. If you register, please ensure you are committed to attend.
Testing is held at Prometric testing centers worldwide, although this exam may not be available in all countries (see Regional Restrictions). All testing centers will have the capability to offer this exam in its live version.
Regional Restrictions: India, Pakistan, China

Registration Information
You must register at least 24 hours prior to taking the exam.
Please use the following promotional codes when registering for your chosen exam(s):
Exam Number Beta Code
71-511 511BC
71-515 515AA
71-513 513CD
71-516 516B1
71-518 518PE
71-519 519ZS
To register in North America, please call:
Prometric: (800) 755-EXAM (800-755-3926)
Outside the U.S./Canada, please contact:

Test Information and Support
You are invited to take this beta exam at no charge.
You will be given four hours to complete the beta exam. Please plan accordingly.
Find exam preparation information:
Exam 70-511, TS: Windows Applications Development with Microsoft .NET Framework 4
Exam 70-515, TS: Web Applications Development with Microsoft .NET Framework 4
Exam 70-513: TS: Windows Communication Foundation Development with Microsoft .NET Framework 4
Exam 70-516: TS: Accessing Data with Microsoft .NET Framework 4
Exam 70-518: Pro: Designing and Developing Windows Applications Using Microsoft .NET Framework 4
Exam 70-519: Pro: Designing and Developing Web Applications Using Microsoft .NET Framework 4

Frequently Asked Questions
For Microsoft Certified Professional (MCP) help and information, you may log in to the MCP Web site at contact your Regional Service Center:
What is a beta exam?
Where can I learn more about the registration process?
Where can I learn more about the beta exam invitation process?
Where can I learn more about the new structure of Microsoft Certification?
Who do I contact for help with this beta exam or other MCP questions?