Tuesday, January 29, 2008

Kent Beck on Implementation Patterns

"Kent Beck on Implementation Patterns"

I want to be in the environment where people understand what Kent says in this interview, where I can talk about it and where we can thrive for better together.

Sunday, January 27, 2008

I like Spec::Rails from a different perspective as well

I like Behaviour-Driven Development very much. And that's my primary reason why I like RSpec.

I have another perspective as well about why I like Spec::Rails (RSpec for Rails). The specifications of Views are completely isolated from the Controllers and vice versa. This makes isolating and finding a problem much easier.

Also with the built-in Mock framework, Controller specifications and View specifications become more like Unit Tests (or Unit Specifications, I should say).

With stories to verify the interactions between two components acting as integration test/acceptance test, this approach is much closer to an effective software development dealing with the reality of software development such as frequent changes.

Saturday, January 19, 2008

Bio-diesel hybrid car

I was listening to a radio and it was saying that electric cars were coming out.

I always thought that the next car I would buy is a hybrid car. But after hearing it, I felt like getting electric car instead when it comes out.

Also I have been wondering if they can produce hybrid car using bio-diesel. That is much cleaner than gasoline hybrid car. The source of fuel is clean because it's a plant. And the fuel itself is cleaner.

I want to work on contributing for cleaner energy source.

Thursday, January 10, 2008

Installing MySQL driver gem

I have upgraded MySQL from 5.0.27, which I installed about a year ago when I bought MacBook, to 5.0.45 yesterday. The reason is that I learned from a MySQL users group meeting that there are lots of important fixes in the versions above 5.0.30.

In Ruby on Rails 2.0, it is recommended to install MySQL driver gem because the one that comes with Rails is not for production use. The gem command is described in config/database.yml.
i.e. On Mac OS X 10.5 Leopard,
sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

Previously, installing MySQL driver gem had failed. I tried it again today now that I have the latest 5.0 version of MySQL. Then the installation was successful.

Monday, January 07, 2008

Ruby on Rails: Symbol#to_proc defined in ActiveSupport

I found it in a blog entry "An Introduction to Ruby's Enumerable Module"

It is interesting and I think I can describe it as very powerful.

Tuesday, January 01, 2008

Ruby on Rails 2.0: link_to for nested resources

If you specify nested resources in routes.rb such as

map.resources :daily_contents do |daily_content|
daily_content.resources :vocabularies

you have to specify a parameter for link_to like this:

<% for vocabulary in @daily_content.vocabularies %>
<%= link_to 'Show', [@daily_content, vocabulary] %>
<% end %>

The generated URL is like this:


Moreover, if @daily_content.entities is just an array, which happens to contain an object of type, Vocabulary, the following works as well:

<% for entity in @daily_content.entities %>
<%= link_to 'Show', [@daily_content, entity] %>
<% end %>

Again the generated URL is same as above like: