Monday, September 28, 2009

Ruby on Rails Vs Java

Java is very popular programming language in the world but ruby on rails is relatively new and young programming language. To compare two programming languages normally SW Engineers consider about language performance, security, Development speed, Maintainability,Scaling and Development tools
By comparing with Rails and Java, Rails Development speed and Maintainability little bit higher than Java. Reason for that is ruby on rails is less configuration and also it practice agile development, further more lot of plugins are available for ruby on rails development.But consider about scalability rails is in far behind to java. Java supports multi- threading but ruby not that much.Clustering also good in Java but not that much in rails. Ruby on Rails is easy to learn and code is more human readable but Java is hard to learn and not that much human readable.




Ruby on Rails Vs PHP

Ruby on Rails is a relatively new and young programming language. But Php is little bit older than ruby on rails and many people have experience with it. According to my view both languages are easy to learn.
Before select a language for a project SW Engineers normally consider about language performance, security, Development speed,Maintainability,Scaling and Development tools
By comparing rails and php , ruby development speed and maintainability little bit higher than php. Reason for that is ruby on rails is less configuration and also it practice agile development, further more lot of plugins are available for ruby on rails development.According to my view security is same in both rails and php.Because both lanuages are support SSL implementation.And Ruby has less code than php.And also ruby codes are more human readable than the php code..

What is the Best????????








Google Map With Ruby On Rails Application

In this post i like to describe integration of the google map with the ruby on rails application. Most of the time for our projects ,we have to use google map for find a place,mark some important locations ect..

Mark a location in a google map

Google map API is totally javascript. So convert to java script variable in to Ruby variable little bit difficult. So i use a trick for make life easy. Trick was i placed a hidden fields for both' lag' and 'lat'.And get those variables as 'params' when submit the form

Find Mark Locations

It is easy.You want to get lng and lat values from your database and Simlpy can disply by Using following code

For more informtaion- http://code.google.com/apis/maps/

Ruby on Rails Vs .NET








Sending and Receiving SMS messages via a GSM modem or Mobile phone

Most of the time, we need to send and receive SMS messages in our University/School Projects. I Used Java library called SMSLib for my above requirement. SMSlib is a Java library for sending and receiving SMS messages via a GSM modem or mobile phone. It also supports some bulk SMS operators, by implementing their HTTP interfaces.

For more Information - http://code.google.com/p/smslib/

Friday, September 18, 2009

Date Time Formats in Ruby

strftime( string ) method of the 'Date' class can use for that purpose..

eg - t = Time.now
t.strftime("%m/%d/%Y") #=> "19/09/2009"
t.strftime("%I:%M%p") #=> " 12:22PM"

Format Strings

%a - The abbreviated weekday name (``Sun'')
%A - The full weekday name (``Sunday'')
%b - The abbreviated month name (``Jan'')
%B - The full month name (``January'')
%c - The preferred local date and time representation
%d - Day of the month (01..31)
%H - Hour of the day, 24-hour clock (00..23)
%I - Hour of the day, 12-hour clock (01..12)
%j - Day of the year (001..366)
%m - Month of the year (01..12)
%M - Minute of the hour (00..59)
%p - Meridian indicator (``AM'' or ``PM'')
%S - Second of the minute (00..60)
%U - Week number of the current year,
starting with the first Sunday as the first
day of the first week (00..53)
%W - Week number of the current year,
starting with the first Monday as the first
day of the first week (00..53)
%w - Day of the week (Sunday is 0, 0..6)
%x - Preferred representation for the date alone, no time
%X - Preferred representation for the time alone, no date
%y - Year without a century (00..99)
%Y - Year with century
%Z - Time zone name
%% - Literal ``%'' character

Fixed Length Random numbers Ruby On Rails

Generating Random numbers in Ruby On Rails is very easy even without gems.

If u want 6 Digit random number try bellow code.
rand(999999).to_s.center(6, rand(9).to_s)

If you want 5 digit try bellow
rand(99999).to_s.center(5, rand(9).to_s)

Like this we can generate any number of digits random number..