Instead of specifying –no-ri –no-rdoc in the gem install command every time, put the following in your local gemrc file located in ~/.gemrc, it will skip installing documentation for all the gem installation by default, which is ideal for production environment.

新浪微博关系图 – Social Graph of Sina MicoBlog 2
近由于需要数据来测试一些HTML SVG的绘图工具的性能,想到运用新浪微博的API调用个人数据构成‘朋友’和‘粉丝’的关系图。假设以个人为中心,我的朋友和粉丝是与自己相连的节点… 每一个人代表一个节点,我个人位于中间的节点。在这个数据组里面,连接自己的节点数量较多,中心的点weight递加之后,便形成较大的节点。图1有遗漏一些信息,比如节点并不能说明这个粉丝也同时是我的朋友,也许此人是我的粉丝而我们却没有互相关注。图2和图3就可以显示出更近一部的关系 [...]

GitHub – Merge in a Fork
Fork is a great way to start a new routine of software feature or improvement. There are situations when you would like to merge your current forked version with a latest/ongoing branch. The following code is an example of how to pull from another branch. The ‘project directory’ is your current git project root. The [...]

Localisation Challenge: Lego NTX
After having been hard working on this Lego robot for the past 2 months, we finally get to this last challenge. Again, this is based on Monte Carlo Localisation and Place Recognition. The implementation is based on RobotC. There are several challenges: The robot will be placed randomly by the examiner in one of the [...]
Pass JavaScript variables to Rails controller 1
Google query doesn’t give much useful result on this topic. What we discuss here is if there is a value/function getParameters() in JavaScript returns “message = hello_world” (a URL query). How do you pass the JS variable into controller? link_to_remote Most common way is using link_to_remote which constructs an Ajax call, but the drawback is [...]
Passing Rails restful_authentication in rspec
Plugins in Rails are useful shortcuts, they produce better implementations for some areas. I recently come across an issue of passing model controller authentication, but the before_filter :login_required stops me testing my code in Rspec. By using mock and stub technique can pass the authentication test. All you have to do is inserting these code [...]
Offline Rails Documentation
Although you can run gem server to have a rails rdoc running on localhost, the rdoc rails document could be troublesome to find a specific method you would like to know about. Fortunately, you may want to try out an ajax improved rails documentation: RailsBrain provides a free downloadable (free) offline documentation for rails. It [...]
“Fork Ruby” Summary (RubyConf 2008)
I like screencast and keynote, they are great ways of learning practically. But some people don’t have much time to watch or listen to all these. Or maybe you forgot some ideas were presented, but it’s difficult to select the part you want to find in the video – you end up with watching the [...]
Configure Rails migration version type
Rails use a UTC time stamp as migration version by default. Although most examples in books have simple number based system for managing migration versions, there isn’t much information about version type configuration. By default, a migration file(>=Rail 2.0) name look similar to: We can turn this off and use numeric prefixes by adding this [...]
config.gem ‘rspec-rails’ on Rails 2.2.2
Update on 5th April 2009: This rspec-rails gem issue has been fixed and released in rspec-rails milestone “1.2.0”. see details here If you are still working on Rspec before version 1.20: After googling, I counld’t find much information about including rspec-rails in the ruby gems config/environment.rb. The only reason I include it in gem dependency [...]