Archive for February, 2007

Getting Radio buttons value with Prototype.js

In Prototype.js, there’s a handy function $F to get the value of a form element.
However it doesn’t work well with a group radio buttons. The argument of $F is the id of the element, and since id is unique, we can’t use the name of the radio group to get the value, which is essentially […]

Hash recursive merge in Ruby

For multi-dimension Hash, .merge will replace the values as a 2 dimension hash.

>> {”number” => {”1″ => “one”,”2″ => “two”}}.merge({”number” => {”3″ => “three”}})
=> {”number”=>{”3″=>”three”}}

We needed the keep the hash values and merge complex hash together that is loaded from YAML.
Solution?

class Hash
def recursive_merge(h)
[…]




I am the founder of RoRCraft Ltd., a web consultancy firm that develops usable and speedy web applications for our clients.


Based in Sydney, I travel to Hong Kong and HangZhou China to meet with my team regularly. I love exploring new technologies and business ideas that helps making our world a better place.



An online video conversion tool. It allows everyone to freely convert their videos for ipods, mobiles and flash.


Rails Job


Job board for Ruby and Rails developers.


View Rex Chung's profile on LinkedIn

www.flickr.com