Posts filed under 'RoR'
Generate Unique ID
Here is a very simple way to generate a unique id.
[Background support : Abhishek S.]
def generate_unique_id( len )
chars_pattern = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
unique_id = ""
1.upto(len) {
|i| unique_id << chars_pattern[rand(chars_pattern.size-1)] }
return unique_id
end
#generates a key of length 10
mykey = generate_unique_id(10)
print mykey # gives a result like "qeKX0myIQh"
Add comment June 23, 2008
Agile web development 3rd Edition
DHH’s Agile web development - 3rd Edition is now in the market covering RAILS 2. Hope again this will rock.
Add comment June 18, 2008
Sorting an Array of hashes
We get a situation where we fetch some set of records from db as an array of hashes, and later we need to sort this array based on some field of DB.
Here is a very hand code to do so.
array_objs =[ {:title => "row1_title" ,:name => "Mumbai"},
{:title => "row2_title" ,:name => "Delhi"},
{:title => "row3_title" ,:name => "Bangalore"} ]
array_objs .sort_by {|array_objs| array_objs [:name] }.each do |res|
puts "#{res[:name] }"
end
O/P:
Bangalore
Delhi
Mumbai
Add comment May 13, 2008
Ruby Hero Awards
Reasons to nominate someone
- They write educational blog posts / tutorials
- They contribute to a useful open source project
- They help organize educational events
- They give free support on the mailing list / IRC
Ruby Heroes was created to show some gratitude and give these people the recognition they deserve. Hopefully the type of recognition that keeps them doing what they’re doing, and continuing to make our community stronger.
Time has come to nominate such person for an honorary award.
Ruby Heroes is produced by the guys over at Rails Envy, and coded up by Brandon Beacher.
Add comment April 17, 2008
Heroku & Morph AppSpaces : Rails Hosting
Heroku and Morph Labs are Ruby on Rails hosting providers, offering a complete environment for running Ruby on Rails applications. Compared to traditional hosters, they don’t just give you a server but offer some interesting tools and interfaces to make your live easier and relieve you from all the hassle of installing, configuring, managing and securing a server. Both are using the Amazon EC2 grid computing technology to run the
applications, so you don’t have to worry about scaling and performance issues either.

James Lindenbaum explains the unique features of Heroku:
“Heroku is hands down the easiest deployment platform for Rails apps. No humans in the loop, just drop in your code and you’re up and running. Heroku handles everything, from version control and collaboration to auto-scaling (built on top of Amazon’s EC2). We offer a full suite of tools for developing and managing your app, through either the web
interface or our new external API.“
Asked about their target audience, James replied:
“Honestly, almost everyone who wants to develop or deploy Rails apps should use Heroku. About a third of our users are beginners (many of whom haven’t written a web app before at all), and they love it because they can get up and running instantly. Another third of our users are more serious Rails developers, who just don’t want to deal with the hassles of setup, configuration, and deployment. We have started to offer features for this group over the last couple of months, and thousands of these users have been happily banging away on our private beta. The last third of our users are really hardcore Rails developers.
We’ve just begun to offer features for this group (the API, external access to Git code repositories), and have many more to be released in the coming months. It’s this hardcore group that has accounted for the largest part of the load on our platform over the last 6 weeks. “
Morph eXchange is a portal into Morph Labs’ Software as a Service offerings. The Morph AppSpaces can be found in their DevCenter. We asked Macel Legaspi from Morph Labs about the characteristics of their offering:
Morph AppSpaces are a Platform as a Service for Ruby on Rails applications. The Morph AppSpace provides all of the technology and infrastructure needed to deploy, deliver and manage a web application written in Ruby on Rails. Each Morph AppSpace provides a highly available, fault tolerant environment for a web application. Load balancers, distributed application servers, integrated web delivery stacks, security and managed backups are all part of every Morph AppSpace. A Morph AppSpace subscription is near nirvana for a Ruby on Rails web application developer. The Morph AppSpaces run on top of the Morph Application Platform. The Morph Application Platform brings together a collection of open source technologies and Morph intellectual property to provide the Morph AppSpace environment. The Morph Application Platform uses cloud computing including Amazon EC2 and Amazon S3 to provide computer power and online storage as needed by the Morph AppSpaces.
Add comment April 16, 2008

