29 Aug 2007

CruiseControl.rb: A Continuous integration tool for your rails projects.

CruiseControl, rails, ruby, RubyonRails, Technology, Tools posted by Akhil Bansal

We at vinsol recently started using CruiseControl for our rails project. CruiseControl is a continuous integration tool. Which keeps an eye on you code repository and runs all test cases (or the command you specify) whenever new version of code is found, it also sends a mail to all members specified when testcases fails with details. I found this tool very helpful and customizable. If you don’t use CruiseControl , I suggest you to give it a try.

21 Jul 2007

Second Delhi Ruby(delhi.rb) Meetup.

events, ruby, vinsol posted by manik

The second delhi.rb meetup was organized at VinSol on Thursday, 19th July, 2007. It was attended by 11 rails enthusiasts.
I gave an introduction to Full Text Search and Solr. And then gave a demo of acts_as_solr plugin. Seems it was well received by all.

Sur, then presented Advanced Ruby, with a lot of live code. Everybody was amazed at what all ruby has to offer for metaprogramming. Infact the talk inspired more people to write plugins. I definitely know of one which is being written and will post about it as soon as it’s released.

Here’s a pic from the meetup, very interesting titled by Sur as Manik with MAC.

It was a great evening. Looking forward to more of these.

update: Sur just blogged about the meetup here

Here’s the flicker photopool for the event.

20 Jul 2007

Second delhi.rb meetup – Some Advance Ruby Skills

advance_ruby, classes, delegation, delhi.rb, duck typing, metaprogramming, rails, ror, ruby, RubyonRails posted by SUR

Hey Everyone,
Vinsol is proudly taking charge to spread Rubyism in delhi and to grow the Ruby & Rails communities here in New Delhi, India. We are organizing delhi.rb meetups around once every month, the meetup is all about ruby and rails as well. The meetup was on 19th July 2007 was our second meetup, first was on 22nd June 2007.

Manik presenting SOLR
Manik presenting SOLR



Me presenting Some Advance Ruby Skills
Me presenting Some Advance Ruby Skills

More photos here.

It was really a nice experience attending the meetup, sharing the ruby/rails thoughts and upcoming features. It helps keeping yourself up-to-date with the latest trends in this technology domain at least in Ruby and Rails(what else m talking except ruby :D). So, there were two presentations in the meetup — first Manik presented Full text search implementation for Rails using SOLR(it was really an interesting presentation, i got SOLR learning for free, thanks Manik :)), second I presented Some Advance Ruby Skills which i am going to share in this post too. Though in the first meetup I presented Caching on RubyOnRails but i haven’t posted here…

Some Advance Ruby Skills

1.) Everything is object

A popular phrase about Ruby, “Everything is Object”. At the root of the ruby it is Object. Everything we define in ruby is object. Even the classes we define are actually object. A class defined with class ClassName; end is actually an object of the class Class.
The Object keeps the record of whatever class or module we define. We can justify it as

2.) module_eval

Use module_eval to define instance and class methods of a class at runtime, when you are outside the class.
example 1
defining an instance method

example 2
defining a class method

example 3
another form of using module_eval
when method body is available as a String object

3.) alias_method

It is NOT method call delegation but insertion of customized functionalities on a specific method call.

4.) The Anonymous class

I just presented same a la this post

5.) send

Calling a method when method name is stored as a string object in a variable i.e. you can not see which method to call.
example 1
when method name is simply stored as a String object

example 2
making set method at runtime

example 3
this is interesting, when attribute name itself is send

well, don’t say “what if attribute name is __send__” :P

6.) The Method class

Methods of the class are objects of the Method class when retrieved with the method method and can be called with the method call.
example 1
anything we define with def-end is an object of the class Method

example 2
method can hold the object’s reference and associated instance variables

example 3
we are able to let this method object flow throughout the application code and let it available anywhere in the code.

7.) what is “self”

I just presented a la this post

8.) Single Method Delegation - using Forwardable

Allows you to delegate named method calls to other objects.

Notice the beauty of ruby here… The methods [], []= of a hash object are usually called as

BUT in the above delegation code we are calling them as(delegating the method call on them as)

9.) Full class Delegation - using Delegator

Extending an object(instance of Class) with the capabilities of another.

10.) SimpleDelegator

Write memory optimized code with SimpleDelegator…

11 Jul 2007

How to make arrow keys working in irb in Linux/Ubuntu

feisty fawn, irb, linux, rails, ruby, ubuntu posted by SUR

It was ruining all my mood and concentration when i was trying some sample ruby code in irb and again and again i had to retype the things because the arrow keys were not working there. I searched the problem on net and found that i need to have readline library on my linux and in ruby as well. Now the point is readline should be available on the linux before you compile ruby so as you can give the readline option while compiling ruby. BUT we have ruby already installed !! Now What ?

Now, first you will need to install system based readline libraries as

If you are not able to install linux based readline with the above method the refer this for more details.

Now you will need to compile the ruby based readline interface to let you readline library available in irb.
Do it by this…

thats it, all done!!
Try your tips on arrow keys in irb, it should work now.
enjoy!!

04 Jul 2007

How to install RMagick Gem on Linux/Ubuntu

feisty fawn, gem, linux, rails, ror, ruby, RubyonRails, ubuntu posted by SUR

While installing RMagick on Linux, if you are getting errors like this
“GraphicsMagick-config… no configure: error: Can’t install RMagick. Can’t find Magick-config or GraphicsMagick-config program. …”,
below is the solution for this error.

RMagick requires ImageMagick and which further requires loads of dependencies already available to get installed and work properly. I was figuring out of those all, and thank god got a quite simple and elegant way to do all that in just three commands.
First you will have to install imagemagick then libmagick9-dev and then finally you can install rmagick.

Here are the commands…

Next Page »« Previous Page