Archive for the 'Ruby' Category

Rails + Merb = <3

Wednesday, December 24th, 2008

Boy, this cetainly was a surprise. I’ve been watching rather intently the recent uptick in animosity between Merb and Rails. Merb started out great, promising a stripped-down Rails and thread-safety to boot. But in the end, Merb’s claimed thread safety didn’t actually pan out, and it lacked the polish that Rails has when it comes to programmer-friendliness. Plus, with the addition of Rails ‘Metal’, it’s become very easy to chuck action controller altogether for request processing and directly hook up a resource-intensive task.

So, more and more, Rails was eating into Merb territory, and not surprisingly so. It’s the same story with products – “faster X”, “cleaner Y” and “easier Z” are always doubtful propositions in the long run because those X,Y or Z will catch up to you, and your raison d’etre is no longer there. But not just that – I found Merb and Rails are very similar in their structure, and very complementary goals. So it only makes sense that they merge.

What I would think is more interesting, or worth learning as opposed to spending time over Merb is even more bare-bones frameworks like Sinatra. It has a uncanny resemblance to Web.py, and that is a good thing. It’s not always that you start out to write an MVC web app. Recently things have been getting very interesting in the Ruby world, with Github being the center of all this spurt of innovation. Exciting times in Rubyland, as always.

Print

Neat Ruby Guide

Saturday, October 18th, 2008

A pretty basic but interesting ruby guide. There are some surprises too. I didn’t know irb has such a cool tab-completion feature. Neat.

Print

Shoes – a ruby GUI toolkit

Friday, April 4th, 2008

Ruby is not only showing its power in Rails but also applications like “shoes” ,”shoes” is graphics and windowing toolkit. It will run on all platforms like Windows, Mac OS X and Linux , which help you to build desktop applications easily.Its creating GUI components some what similar to web applications.shoes library making our task easier by providing lots of methods to build a desktop item.Ruby Shoes is written in C and uses Ruby native extensions to allow interaction with Ruby code.
First of all you need to install ruby “shoes” ,available here download

1.Download source

2.Extract(unzip)

3.Install

Now run

$ shoes

Which will give take you to a graphical mode there you can choose your ruby file for shoes.Or run your shoes file by

$ shoes <filename.rb>

Here is examples to show the simplicity and elegance of ruby shoes.Start with a small ones

Example for a button click
Shoes.app {
button("Hello") { alert("You have clicked on hello") }
}

example for drop down box
shape = nil
Shoes.app do
shape = list_box :items => ["Square", "Oval", "Rectangle"]
button "Report" do
Shoes.p [shape.text]
end
end

You can see all the methods available for shoes “CLICK ME” or type on command line
$ shoes --manual - you can see a helper.

Ideal example to see the power of shoes is given below , in those few lines its doing a big job !!
Shoes.app :width => 500, :height => 100, :margin => 10 do
def answer(v)
@answer.replace v.inspect
end
button "Ask" do
answer ask("Enter your name")
end
button "Confirm" do
answer confirm("Like to proceed??")
end
button "Open File" do
answer ask_open_file
end
button "Save File" do
answer ask_save_file
end
button "Select Your Color" do
answer ask_color("Select yours")
end
@answer = para "Answers appear here"
end

Print

Ramaze Ruby is amazing !!!

Saturday, March 1st, 2008

Ramaze-means Ruby Amaze , light and modular open-source web application framework written in Ruby.Which is more easy to work with and no complexities for a new user.Ramaze is claiming to have more advantages than ruby on rails in speed , safety , user friendliness etc.

Installation is very simple

$ gem install ramaze installing as rubygem

Now your ramaze is ready to use.You can build ur applications by saying

$ ramaze --create my_app

Which will give u the basic format and you can edit and build your application in the way you want.Ramaze follows MVC architecture , unlike Rails it can work on a single ruby program also.You can run your ramaze application like

$ramaze or
$ruby start.rb

Or if u want to run a single script just run
$ ruby yourscript.rb

Ramaze is well documented with basic examples and easy to use even for a newbie.Ramaze stays close to the ruby’s principles such as simplicity n elegance.Basically Ramaze contains a controller called MainController and which maps to ‘/’. Here data is getting saved in a ‘.yaml’ file instead of database.

class MainController < Ramaze::Controller
end

Also we can map to other URL s if we want.Its pretty simpler than Rails i guess.

class AnotherController < Ramaze::Controller
map '/another'
end

You will get the basic examples to run your application from here.

Ramaze supports a lot of templating engines and such as Haml, Erubis,Markaby an d Ezmar.Also includes support for several adapters, including Mongrel, Evented Mongrel and FastCGIetc.
In the homepage of Ramaze you can see the tutorials ,just give a try you will understand more.

Print