Skip to main content


Showing posts from November, 2010

Deals You Can't Miss

1 Year Subscription

Ordered Hashes in Ruby

Today, while playing a story in my web app development project, I felt the need to have an ordered hash in Ruby 1.8.7. Argh, this version of Ruby doesn't have ordered hash at all! Surprisingly enough, JRuby versions 1.3.1 or 1.5.1 preserves insertion order. The way Ruby 1.8.7 hash behaves: The way Ruby 1.9.1 hash behaves: The way JRuby 1.3.1 hash behaves: Coming back to our problem, how do I do have something like Ordered Hash data structure with Ruby 1.8.7? There are several libraries that either extend or replace Ruby's Hash. OrderedHash and RubyFacets being some of the famous ones. However, if you are developing a web application using Rails, then you have to search no where - just use Rails' ActiveSupport::OrderedHash. All you need to use it is require 'active_support/ordered_hash' in your class/module With Ruby 1.9, this wouldn't be a problem because Ruby 1.9 preserves the insertion order into the data structure. This onl

Git-SVN bridge

This post should serve as a quick reference material for Git-ites (wannabes and me) who'll have to use svn as configuration management system for whatever reason it be. In such situations install git-svn onto your system so that you can have git as your local repository and pull from/push to remote svn that the team uses as central versioning system. Remember that for all actions on your local repository use the regular git commands. The need for git-svn commands arises only when you need some information/artifacts from svn repository. 1. What is the command to update my local git repo with changes from the remote svn repo?      git svn rebase 2. What is the command to commit my local changes to svn repository?       git svn dcommit 3. What is the sequence of steps to push my local changes to svn repo?      i. When you change existing or add new files, you need to add it to the local git repo          git add <file_path>  or          git add <directory_path&g