me

Feb01

Tic Tac Toe in Ruby

ruby game | comments

Just wanted to do it, 'is all. An N x N tictactoe game on the CLI in ruby. Actually, I wanted to see just how quickly I could write a functional one. It took about an hour and a half.

Continue reading »

Dec04

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 »

Dec02

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 »

Nov20

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 »

Oct13

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 »

Aug18

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 »

Mar28

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 »

Jul03

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 »

Apr29

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 »

Apr14

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 »