Dec 04 2010

String interpolation in module_eval gotcha

ruby metaprogramming | comments

If you find yourself doing some meta-programming in ruby with module_eval (aka class_eval), you may want to take heed of this gotcha if you exercise string interpolation inside the evaluated block. This was tested on versions 1.8.7, 1.9.1 and 1.9.2.

Continue reading »

Dec 02 2010

Multiple ways in implementing delegation pattern in ruby

ruby patterns | comments

There are multiple ways to implement the delegation pattern in ruby. This blog post will illustrate four of them. Let's provide some context first.

Continue reading »

Nov 20 2010

Simple Academia DSL in Ruby Tutorial

ruby dsl | comments

It's been an itch to scratch lately and finally got around to understanding how to go about writing an example DSL in ruby. Machinist, sinatra, rake, cucumber were all

Continue reading »

Oct 13 2010

Git remote tracking existing local branch

git | comments

As of git 1.7.0...

Say you have checked out a new local branch on your project:

$ git checkout -b feature_x 

Made your code changes and committed to 'feature_x' branch. You would now like to keep a copy of this branch in your remote repository called 'origin':

Continue reading »

Aug 18 2010

MySQL Gem Install Caveats on Red Hat (32/64 bit)

ruby gem mysql ruby19 linux redhat yum | comments

If you're using redhat, it's likely you heavily depend on yum to manage your packages. If not, you probably should. Anyhow, I use yum to manage MySQL installation on my RHEL boxes. Installing MySQL is as easy as:

Continue reading »

Mar 28 2010

Playing around with string encoding on Ruby19

ruby19 encoding activeworlds questatlantis multibyte chars | comments

Lately I've been working with ActiveWorlds 5.0 SDK, wrapped with ffi running on Ruby 1.9.

Continue reading »

Jul 03 2009

Setting up NFS on Red Hat Ent. 64-bit Linux Boxes

nfs sysadmin linux | comments

Come August, we will need to be able handle a surge in traffic to our Quest Atlantis system. Load balancer with multiple app servers mounting an NFS volume is what we have in mind. The diagram below explains it pretty clearly hopefully:

Continue reading »

Apr 29 2009

Checking named routes in rails console

ruby rails | comments

I tend to use named routes in my link_to, link_to_remote, remote_form_for etc prototype helpers, so that my action paths in the view always conform to the declarations in routes.rb and so it's expressive.

Continue reading »

Apr 14 2009

Self-Referential ActiveRecord

ruby rails active_record | comments

Migrating a legacy bulletin board system based on Perl/CGI to Rails (2.2.2). I am doing this as BDD with cucumber & rspec goodness and I'll be posting my travails on BDD pretty soon.

Continue reading »

Apr 13 2009

Getting up & running with Sinatra ( on Dreamhost

rack ruby sinatra webapp dreamhost passenger | comments

Since passenger has rack support and since dreamhost supports passenger, I went with a forked scanty blogging app as my du jour.

Continue reading »