Tuesday, November 17, 2009
extended array or specifically enum methods in ruby
%w{ ant bear cat}.all? {|word| word.length >= 3} #=> true
%w{ ant bear cat}.all? {|word| word.length >= 4} #=> false
[ nil, true, 99 ].all? #=> false
%w{ ant bear cat}.any? {|word| word.length >= 3} #=> true
%w{ ant bear cat}.any? {|word| word.length >= 4} #=> true
[ nil, true, 99 ].any? #=> true
Enjoy coding...
Wednesday, October 28, 2009
OOPS: Creating object for an Interface is Possible
- Use the below sample code to create an object for an interface. This is called as "anonymous inner class".
public interface MyInterface {
public void myMethod() ;
}
...
MyInterface myIntfObj = new MyInterface() {
public void myMethod() {
....
}
};
myIntfObj.myMethod();
Thursday, October 22, 2009
install gems by .gem files
To install gems by .gem files use the below command on command prompt or terminal.
Note: To download .gem files for a specific gem, do a search in rubyforge.org
gem install –install-dir PATH library_name
then the output will like this
Successfully installed library_name.version
1 gem installed
Hope this will help for someone or me!!!
Simple Array Comparison in Ruby
Here is a simple method to compare two arrays using Ruby, few examples:
> [1,2,3] <=> [1,2,3]
=> 0
> [1,2,3] <=> [2,2,3]
=> -1
> [1,2,3] <=> [3,2,3]
=> -1
> [1,2,3] <=> [1,3,3]
=> -1
> [1,2,3] <=> [1,1,3]
=> 1
By use of Terinary Operator (<=>), we can acheive the simple method to compare two arrays of comparison.
Hope this will help for someone or me in future!!!
Saturday, August 1, 2009
Lyrics - sambo siva sambo song from Nadodigal movie
Download this song
Sambo Siva Sambo Lyrics – Nadodigal
சம்போ சிவ சம்போ, சிவ சிவ சம்போ
சம்போ சிவ சம்போ, சிவ சிவ சம்போ
உறங்கும் மிருகம் எழுந்துவிடட்டும்
தொடங்கும் கழகம் குனிந்து விடட்டும்
பதுங்கும் நரிகள் மடிந்து விடட்டும்
தோள்கள் திமிரட்டும்
துடிக்கும் இதயம் கொழுந்துவிடட்டும்
தெறிக்கும் திசைகள் நோறிங்கிவிடட்டும்
வடிக்கும் பகைமை மறைந்துவிடட்டும்
நட்பே ஜெய்கட்டும்!!!
சம்போ சிவ சம்போ, சிவ சிவ சம்போ
சம்போ சிவ சம்போ, சிவ சிவ சம்போ
நீ என்ன நானும் என்ன, வேதங்கள் தேவையில்லை..
எல்லோரும் உறவே என்றால், சோகங்கள் ஏதும் இல்லை
சிரிக்கின்ற நேரம் மட்டும், நட்பென்று தேடிடாதே
அழுகின்ற நேரம் கூட, நட்புண்டு நீங்கிடாதே
தோல்வியே என்றும் இல்லை........
துணிந்த பின் பயமே இல்லை.....
வெற்றியே.......
சம்போ சிவ சம்போ, சிவ சிவ சம்போ
சம்போ சிவ சம்போ, சிவ சிவ சம்போ
உறங்கும் மிருகம் எழுந்துவிடட்டும்
தொடங்கும் கழகம் குனிந்து விடட்டும்
பதுங்கும் நரிகள் மடிந்து விடட்டும்
தோள்கள் திமிரட்டும்
துடிக்கும் இதயம் கொழுந்துவிடட்டும்
தெறிக்கும் திசைகள் நோறிங்கிவிடட்டும்
வடிக்கும் பகைமை மறைந்துவிடட்டும்
நட்பே ஜெய்கட்டும்!!!
சம்போ சிவ சம்போ, சிவ சிவ சம்போ
சம்போ சிவ சம்போ, சிவ சிவ சம்போ
ஏக்கங்கள் தீரும்மட்டும், வாழ்வதால் வாழ்க்கையாகும்
ஆசைக்கி வாழும் வாழ்க்கை, ஆற்றிலே கோலமாகும்
பொய் வேடம் வாழ்வதில்லை, மண்ணோடு வீழும் வீழும்
நட்ப்பாலே ஊரும், உலகம் எந்நாளும் வாழும் வாழும்
சாஸ்திரம் நட்புக்கு இல்லை.......
ஆத்திரம் நடப்புக்கு உண்டு..........
ஆட்டமே...
சம்போ சிவ சம்போ, சிவ சிவ சம்போ
சம்போ சிவ சம்போ, சிவ சிவ சம்போ
சம்போ சிவ சம்போ, சிவ சிவ சம்போ
சம்போ சிவ சம்போ, சிவ சிவ சம்போ
எரியும் வெளிகள் உறங்குவதென்ன
தெரியும் திசைகள் பொசுங்குவதென்ன
முடியும் துயரம் திமிருவதென்ன
நெஞ்சில் அனல் என்ன
மறையும் பொழுது திரும்புவதென்ன
மனதை பயமும் நெருங்குவதென்ன
இனியும் இனியும் தயங்குவதென்ன
சொல் சொல் பதில் என்ன
சம்போ சிவ சம்போ, சிவ சிவ சம்போ
சம்போ சிவ சம்போ, சிவ சிவ சம்போ
சம்போ சிவ சம்போ, சிவ சிவ சம்போ
சம்போ சிவ சம்போ, சிவ சிவ சம்போ
Enjoy!!!
Sunday, July 19, 2009
Watir - An Automated Testing Tool for Web Applications
I like to share you a best testing tool for all web developers for their web applications. It is platform independent tool, you can test your application which was created with any programming language like PHP, RoR, J2EE, Dot Net, etc.,
Steps to Install and work with watir.
1. Download ruby and follow the installation instructions.
2. gem update --system.
3. gem install watir ( recent version of watir will automatically get install )
Note This gem will test the application with IE browser as default. If you want to check with FireFox browser then you should install "firewatir" and for chrome browser "chromewatir".
supporting gems will automatically get install, perhaps one of the significant gem to co-ordinate with windows api, you should install a gem called "windows-pr" i.e gem install windows-pr
This windows-pr gem will resolve the following error:
Ruby/lib/ruby/gems/1.8/gems/windows-pr-0.9.3/lib/windows/thread.rb:59: uninitialized constant Windows::API::Error (NameError)
Get start to work by follow the watir tutorial
Hope this will help some one or mine too!
Friday, July 3, 2009
Get Start/Switch your projects with Ruby On Rails

For this past few years i missed to read an wonderful article about the succession of Ruby on Rails. This article explains us "How Ruby on Rails succeeded and intention to Create this?" Dont ever miss any one to read this article. Just click the below link and start to work with Ruby on Rails.
http://tinyurl.com/kopbwe
For each and every programmers or technicians or business development managers, this article should read and need to get know about Ruby On Rails(ROR).
Especially in India, so much of them didnt even know about this framework and language. Some bigger companies are not yet started to accomodate this simple framework( rails ) with the base powerful language (ruby). They should come over and start to work on this technology. Its the only language now the direct competitor for Java in the whole world. In Denmark, it almost 90% of programmers using this framework.
It Benefits a lot. In Brief,
-> Reduce the number of hours to develop a application.
-> Reduce the number of developers involved to create a application.
-> Reduce the stress, energy to create the applications by the developers.
-> Easy to learn the framework.
-> More compatible with all platforms.
-> Easy to implement the Agile methods.
Finally, Last but not Least, its everthing "OPEN SOURCE". Get think over the above advantages and start / switch your projects with Ruby On Rails.
Happy coding and will see you in another information.