Monday, November 16, 2009

Rails and Amazon Web Services

Hi all,

One of the Most wanted skills in Ruby on Rails right now is "Rails and Amazon: Libraries and Plugins for EC2, S3, SimpleDB, SQS, FPS and DevPay Integration". The below link will much useful those who are looking to learn about these integartions.

http://bit.ly/yQsuS

Rails become like a ocean now itself, just think after the official release of "Rails 3". That should be a cyclone on web development industries.

Think more about "Rails", do more development :)

Wednesday, October 21, 2009

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!!!

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.

Saturday, June 13, 2009

Searching String(s) in file(s) using Ruby

Searching String(s) in file(s) using Ruby is very simiple. Here is the sample code to manipulate it.

# searching a string in a file
def print_line_containing(file, str)
File.open(file).grep(/#{str}/).each do |line| puts "#{line}" end
end

# searching multiple strings in a file
def print_line_containing(file, str1, str2)
File.open(file).grep(/#{str1}\s+#{str2}/).each do |line| puts "#{line}" end
end


# searching multiple strings in multiple files
def print_line_containing(file_array, str)
file_array.each do |file|
File.open(file).grep(/#{str1}\s+#{str2}/).each do |line| puts "#{line}" end
end
end

I hope this will help you all!

Wednesday, June 10, 2009

Building Shopping Cart with Ruby on Rails in few minutes

we can easily build a shopping cart application in a fraction of few minutes.

http://code.google.com/p/substruct/

Use the above link and download the substruct application. Follow the instructions like installation, svn updating the substruct engine, and etc., from the left nav bar on that page.

Then you will get the shopping cart application with payment integration with the Active Merchant plugin.

Get use of open source and explore your thoughts with your application.

Friday, May 22, 2009

Array Mapping in Ruby

Hi to All,

Here is the sample code to know the usage of array mapping in Ruby.

>> User.find_all_by_office_id(20)
=> [#, #]

If you want to map only the User id's from the above result set. then you should use like this:

>> User.find_all_by_office_id(20).map(&:id)
=> [1032, 3646]

If you want to use these User id's in an another query with "IN" predicate. Then you should use like this:

>> User.find_all_by_office_id(20).map(&:id).compact.join(",")
=> "1032,3646"

the compact will you delete the blank array element from the result set.

then it joins with "," (comma). So finally you will get the string with concatenated id's with comma. You can use this string in the another query with "IN" predicate, like this

>>user_ids = User.find_all_by_office_id(20).map(&:id).compact.join(",")

>>y Website.find(:all, :conditions => "user_id in(#{user_ids})")

you will the websites list for these users.

Friday, April 17, 2009

Rails 2.3.2 bugs with solutions

For the rails thinkers this link may helpful a lot to solve their basic issues with recent rails released version 2.3.2


http://tiny.cc/67kLX