Monday, June 01, 2009
Wednesday, May 27, 2009
Steve Nash and his contribution toward environmental issues
Steve Nash, a professional basketball (NBA) player for Phoenix Suns wears basketball shoes made out of recycled materials. He initiated to put solar panel at the roof of the stadium. He advocates many practices such as riding a bike or skateboard and actually practices them.
I like him very much.
For many years, it has been because of his basketball skills and smart plays.
Now I admire him.
That's because I have learned his initiatives.
I like him very much.
For many years, it has been because of his basketball skills and smart plays.
Now I admire him.
That's because I have learned his initiatives.
Thursday, May 07, 2009
Wednesday, April 08, 2009
Cucumber and restful_authentication
I have started to use Cucumber.
But I'm using restful_authentication for the Ruby on Rails application I'm working on and I had to deal with it.
It turned out that all I have to do was to add a step like the following (My actual code has a role parameter - e.g. admin - but I omitted it here for simplicity):
By the way, in routes.rb, I'm setting the following as described in restful_authentication:
P.S. Actually, it didn't work quite well in the steps later on. I will do more investigation.
But I'm using restful_authentication for the Ruby on Rails application I'm working on and I had to deal with it.
It turned out that all I have to do was to add a step like the following (My actual code has a role parameter - e.g. admin - but I omitted it here for simplicity):
Given /^I am logged in$/ do
User.create!( :first_name => 'quire',
:last_name => 'smith',
:login => 'quire',
:email => 'quire@example.com',
:password => 'test',
:password_confirmation => 'test' )
post "/login", :login => 'quire', :password => 'test'
end
By the way, in routes.rb, I'm setting the following as described in restful_authentication:
map.login '/login', :controller => 'sessions', :action => 'new'
P.S. Actually, it didn't work quite well in the steps later on. I will do more investigation.
Sunday, March 22, 2009
What I did when upgrading from Ruby on Rails 2.2.2 to 2.3.2
I write what I had to do to upgrade Ruby on Rails from 2.2.2 to 2.3.2.
Development machine is Mac OS X Leopard and production server is Ubuntu Hardy.
1. (development machine) Update Ruby on Rails.
2. (development machine) Update all the gems.
(Note: 1. above can be done in one shot in here. But I'm just writing following the order I did as much as possible.)
3. (development machine) Under RAILS_ROOT for the Ruby on Rails application, execute rake to update Rails.
This updates the following files:
4. (development machine) In the Ruby on Rails application, rename application.rb to application_controller.rb.
5. (development machine) In the Ruby on Rails application, in environment.rb, change the version to 2.3.2.
6. (development machine) Installe system_timer gem.
This is because of a warning when script/server:
7. (development machine) In ApplicationController, comment out:
because of the warning in script/server:
8. (development machine) In environment.rb, change as following based on what's written in release note (http://guides.rubyonrails.org/2_3_release_notes.html):
from
to
I use RedCloth and followed what is written here (http://sudothinker.com/2009%2F3%2F2%2Frails-2-3-upgrade-problems-and-solutions) to make it work.
But after the fact, only the steps 1 to 5 above should allow the application to start with script/server.
The following are the steps to make RSpec work.
9. (development machine) In routes specs, change :id => 1 to :id => '1'.
Also for nested routes, do the same thing e.g. :register_id => 1 to :register_id => "1"
10. (development machine) For the controller method that takes care of javascript, which doesn't have a corresponding .html.erb file, add:
for get in spec. e.g.
This is because even though controller spec is separate from view, RSpec couldn't catch up with the change in Ruby on Rails, and the existence of the corresponding .html.erb is required.
11. (development machine) RSpec correctly detects OrderedHash instead of array of array. Ruby on Rails returns OrderedHash for group_by. So change such as following:
to
Note: As far as I observed, Ruby on Rails itself was already using OrderedHash in 2.2.2 but RSpec was failing if I use the Hash format. Now it fails with array format.
The following is a step to make CruiseControl.rb (fork with GIT support) work.
12. (continuous integration server) Delete all the unpacked gems in .cruise/projects/RAILS_ROOT/work/vendor/gems because CruiseControl complains such as
even after unpacked gem is removed from the Ruby on Rails application itself.
The following is a step to make Capistrano work.
13. (production server) Update all the gems. (Actually this had already been done as a part of Ruby on Rails upgrade in production server.)
14. (development machine) Under RAILS_ROOT for the Ruby on Rails application,
because commands/process/spawner that is used Mongrel is deprecated. (http://github.com/rails/irs_process_scripts/tree/master)
Development machine is Mac OS X Leopard and production server is Ubuntu Hardy.
1. (development machine) Update Ruby on Rails.
$ sudo gem update rails
2. (development machine) Update all the gems.
(Note: 1. above can be done in one shot in here. But I'm just writing following the order I did as much as possible.)
$ sudo gem update
3. (development machine) Under RAILS_ROOT for the Ruby on Rails application, execute rake to update Rails.
$ rake rails:update
This updates the following files:
config/boot.rb
public/javascripts/controls.js
public/javascripts/dragdrop.js
public/javascripts/effects.js
public/javascripts/prototype.js
4. (development machine) In the Ruby on Rails application, rename application.rb to application_controller.rb.
5. (development machine) In the Ruby on Rails application, in environment.rb, change the version to 2.3.2.
6. (development machine) Installe system_timer gem.
$ sudo gem install system_timer
This is because of a warning when script/server:
[memcache-client] Could not load SystemTimer gem, falling back to Ruby's slower/unsafe timeout library: no such file to load -- system_timer
7. (development machine) In ApplicationController, comment out:
session :session_key => '_session_id'
because of the warning in script/server:
DEPRECATION WARNING: Disabling sessions for a single controller has been deprecated. Sessions are now lazy loaded. So if you don't access them, consider them off. You can still modify the session cookie options with request.session_options.
8. (development machine) In environment.rb, change as following based on what's written in release note (http://guides.rubyonrails.org/2_3_release_notes.html):
from
config.action_controller.session = { :session_key => '_some_session',
to
config.action_controller.session = { :key => '_some_session',
I use RedCloth and followed what is written here (http://sudothinker.com/2009%2F3%2F2%2Frails-2-3-upgrade-problems-and-solutions) to make it work.
But after the fact, only the steps 1 to 5 above should allow the application to start with script/server.
The following are the steps to make RSpec work.
9. (development machine) In routes specs, change :id => 1 to :id => '1'.
Also for nested routes, do the same thing e.g. :register_id => 1 to :register_id => "1"
10. (development machine) For the controller method that takes care of javascript, which doesn't have a corresponding .html.erb file, add:
:format => 'js'
for get in spec. e.g.
get :index, :format => 'js', :topic_id => "1",
:selected_sub_topic_id => "2"
This is because even though controller spec is separate from view, RSpec couldn't catch up with the change in Ruby on Rails, and the existence of the corresponding .html.erb is required.
11. (development machine) RSpec correctly detects OrderedHash instead of array of array. Ruby on Rails returns OrderedHash for group_by. So change such as following:
[ [ mock_jurisdiction, [ mock_bulletin ] ] ]
to
{ mock_jurisdiction => [ mock_bulletin ] }
Note: As far as I observed, Ruby on Rails itself was already using OrderedHash in 2.2.2 but RSpec was failing if I use the Hash format. Now it fails with array format.
The following is a step to make CruiseControl.rb (fork with GIT support) work.
12. (continuous integration server) Delete all the unpacked gems in .cruise/projects/RAILS_ROOT/work/vendor/gems because CruiseControl complains such as
config.gem: Unpacked gem RedCloth-4.0.1 in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this.
even after unpacked gem is removed from the Ruby on Rails application itself.
The following is a step to make Capistrano work.
13. (production server) Update all the gems. (Actually this had already been done as a part of Ruby on Rails upgrade in production server.)
$ sudo gem update
14. (development machine) Under RAILS_ROOT for the Ruby on Rails application,
$ script/plugin install
git://github.com/rails/irs_process_scripts.git
because commands/process/spawner that is used Mongrel is deprecated. (http://github.com/rails/irs_process_scripts/tree/master)
Saturday, March 14, 2009
Language can be understood even when it's not totally correct
I have attended a Japanese Language Speech Contest because I wanted to know how I feel from the opposite side after struggling to communicate well naturally in English and putting an effort to learn French.
I have found that the language can be understood even when it was not spoken 100% correctly.
I even thought that that's how language evolves.
So it's OK and I don't have to worry about speaking a foreign language even when I accidentally make a mistake.
Native speaker of the language can understand what I'm trying to say.
With that confidence, I write this blog in French as well, even though I will make mistakes.
J'ai assisté au concours d'élocution japonaise parce que j'ai voulu savoir comment j'aurai senti en écoutant de la parole en ma langue maternelle par les gens avec les langues maternelles que j'avais essayé d'apprendre et avec lesquelles j'avais essayé de survivre.
J'ai trouvé que c'est facile de comprendre une parole malgré elle n'est pas tellement correct.
J'ai imaginé que ce soit comment le langage change.
Alors, c'est pas grave si je parle l'autre langue et fais erreur.
長く外国語を使ったり、最近では新しい言葉を習ったりして、いつもうまく通じているか気にかかっていたので、日本語弁論大会があると知ってから、逆の立場になったらどう感じるか、興味がわいてきました。
実際に弁論を聞いてみると、結構間違いがあっても、わかるものだなあ、と思いました。
多分、英語とかフランス語とか、こんなふうにして、少しずつ、世界中で地域によって違いが出てきたんだろうなあ、と想像をめぐらせました。
ネイテイブの人にどうせわかるんだったら、外国語をしゃべって間違いをしても、別に問題はないんだ、と思うようになりました。
Poco a poco. Yo hablo otro idioma. Poquito de Español (Castellano).
I have found that the language can be understood even when it was not spoken 100% correctly.
I even thought that that's how language evolves.
So it's OK and I don't have to worry about speaking a foreign language even when I accidentally make a mistake.
Native speaker of the language can understand what I'm trying to say.
With that confidence, I write this blog in French as well, even though I will make mistakes.
J'ai assisté au concours d'élocution japonaise parce que j'ai voulu savoir comment j'aurai senti en écoutant de la parole en ma langue maternelle par les gens avec les langues maternelles que j'avais essayé d'apprendre et avec lesquelles j'avais essayé de survivre.
J'ai trouvé que c'est facile de comprendre une parole malgré elle n'est pas tellement correct.
J'ai imaginé que ce soit comment le langage change.
Alors, c'est pas grave si je parle l'autre langue et fais erreur.
長く外国語を使ったり、最近では新しい言葉を習ったりして、いつもうまく通じているか気にかかっていたので、日本語弁論大会があると知ってから、逆の立場になったらどう感じるか、興味がわいてきました。
実際に弁論を聞いてみると、結構間違いがあっても、わかるものだなあ、と思いました。
多分、英語とかフランス語とか、こんなふうにして、少しずつ、世界中で地域によって違いが出てきたんだろうなあ、と想像をめぐらせました。
ネイテイブの人にどうせわかるんだったら、外国語をしゃべって間違いをしても、別に問題はないんだ、と思うようになりました。
Poco a poco. Yo hablo otro idioma. Poquito de Español (Castellano).
Monday, March 09, 2009
Continuous Deployment
One of the Kent Beck's talks I watched quite a while ago said that there was a trend of more frequent deployment.
Also a developer I talked to about two months ago mentioned that his team was going into that approach.
And there was an InfoQ article about it today:
"Beyond Continuous Integration: Continuous Deployment"
Also a developer I talked to about two months ago mentioned that his team was going into that approach.
And there was an InfoQ article about it today:
"Beyond Continuous Integration: Continuous Deployment"
Subscribe to:
Posts (Atom)