Saturday, December 19, 2009

United Nations Press Conference in Copenhagen Climate Change Conference

The most interesting press conference I have ever seen in the conference.

Press Conference by United Nations on December 19, 2009.

Copenhagen Climate Change Conference

First of all, I have a great respect to all the people, delegates and leaders of the countries, who worked so hard for long hours day and night, staying overnight into late in the morning. Many of them haven't slept for 48 hours.

I have been following it watching the webcast.

At around 3am in the local time, the draft of what is called Copenhagen Accord was presented in front of the Plenary, asking the parties to consider in one hour, after only small number of countries in the closed door spent many hours to draft it, leaving majority of delegates waiting. It was good that the one hour timeline approach was soon dropped.

Basically majority of the parties were forced to swallow what was created by small number of countries (it seems to me, possibly even before the beginning of the conference). The draft should have been created in the Plenary involving all the parties. All the parties were working hard and willing to do whatever takes to solve this difficult problem of climate change all two weeks.

I have been following the last Plenary overnight taking a break here and there and after almost 12 hours later, I couldn't continue any more unfortunately, so I could not see how it was ended. But the those hours saw the involvement of all the parties and that should have been the way all throughout the two weeks. I think that may have brought a better result.

Friday, December 18, 2009

United States' attitude in Copenhagen Climate Change Conference

Since the beginning of the Conference, there have been many informal consultations involving only a small number of countries despite the fact that the delegates from many countries were there to work in the plenaries. And many countries expressed their concern about "transparency".

Now the United States is using the same word, "transparency", for a different context.

First of all, if "transparency" is important, they should ratify the Kyoto Protocol, instead of just announcing what they do about clean energy technology in their country.

Second, while they used the word, "transparency", they formed a closed door meeting with only handful of countries, despite the fact that great majority of the head of states and the leaders are there in the Conference. What they are doing doesn't have any "transparency".

It almost sounds like to me that they took advantage of the situation where many countries are upset about "transparency" in the Conference and used the same word in a different context to diffuse people's attention away from their own responsibilities. In other words, the perception of the majority of parties have been that the United States and China are the blocker of the deal and the United States manipulated to make it look as if China is the only problem.

Wednesday, December 16, 2009

Tokyo Cabinet (rufus-tokyo) - TableQuery :stroreq and :numoreq

Quick note about what I found.

The documentation for Rufus::Tokyo::TableQuery says "string/number which is equal to at least one token" for :stroreq and :numoreq, respectively. But this collection of tokens cannot be an array. It must be a string with tokens separated by comma.

How did I find that array doesn't work?

First, it didn't return the expected result.

Then I looked at the code for the add method by clicking on "View source" and found that to_s is called immediately on the passed val (in this case, a collection of tokens). So if array is passed, to_s is called on it, which only returns a string concatenating all the array elements. So how the code following it can distinguish the tokens for the string, e.g. "123"? - (1 and 23) or (1 and 2 and 3), etc?

So I simply tried passing a string with tokens separated by comma, e.g. "1,2,3". Then it worked.

Ruby on Rails: background job for uploading file

Quick note.

Running the work of uploading file in the background using Delayed Job doesn't work well because it has a problem with serializing the data into YAML::Object that it uses.

Workling with Spawn works well.

Wednesday, December 09, 2009

Very informative webcast about climate change

It was very informative.

COP 15 Media Training Workshop

Bolivia's position on the climate crisis

I think what they say hits the points.

(The embedded video below doesn't seem to work well. So I put a link, too)








Saturday, December 05, 2009

Musique Jazz - Sadao Watanabe "Rendez-vous"

Un saxophoniste, Sadao Watanabe (渡辺貞夫).

Parce que je l'écoute souvent à YouTube parce que je ne le trouve pas encore dans iTune ou autre, j'ai décidé de le mettre ici.

Friday, November 27, 2009

Une pièce de musique traditionnelle du japon « Sakura »

Mon professeur du cours de musique m'a demandé de trouver une vidéo de la pièce de musique japonaise qui s'appelle « Sakura » qui veut dire fleurs de cerise. J'en ai trouvé une. C'est belle.



Monday, November 23, 2009

World Wildlife Fund: Oil and Ice Tour: Are we giving up ice for oil?

I attended an event by World Wildlife Fund the other day.

It is incredible that one barrel of oil (natural gas) is used par three barrels of oil produced being extracted from tar sand. What a waste of natural gas!

The speaker said that in order to sustain civilization, the ratio of the energy used and the energy generated must be at least 1:5.

Saturday, November 21, 2009

Tokyo Cabient and rufus/tokyo table locking

This may be obvious but I just write it anyway.

It is from http://rufus.rubyforge.org/rufus-tokyo/Rufus/Tokyo/Table.html and what I tried out based on the information there.

1. When you instantiate Rufus::Tokyo::Table, it gets the default mode of :write and :create, which locks the table.

-> So instantiating another fails with "Rufus::Tokyo::TokyoError: (err 16) lock error".

2. If the mode is :read and 'f' (non blocking lock), multiple instances can be created and each can read.

-> But when one is with the mode :write and 'f' (non blocking lock), instantiating another with the mode :read and 'f' fails with "Rufus::Tokyo::TokyoError: (err 16) lock error".

3. When one is instantiated with the mode :write and 'f' (non blocking lock), instantiating another with the mode :read and 'e' (non locking) succeeds.

-> And you can read from either instances.

-> When you write a value with that first instance with the mode :write and 'f', you can read the value from that first instance. But in order to read the value from the other second instance with the mode :read and 'e', you have to first close it and instantiate a new one with the mode :read and 'e'. Otherwise, that second instance doesn't read the newly added value.

4. When multiple instances are instantiated in the same thread (e.g same Rails console), thread occurs with "Rufus::Tokyo::TokyoError: (err 1) threading error".

5. If table file is never created, the mode :create must be specified.

20th Anniversary of the fall of Berlin Wall

I wanted to write what I felt at that time but have been busy.

November 9, 2009 was the 20th anniversary of the fall of Berlin Wall.

20 years ago, I was thinking of visiting East Europe to be in the middle of the change. But I didn't because the only experience of traveling abroad that far was China and I wasn't sure if I could go around. Instead, I traveled to Malaysia, Singapore, and Australia.
That itself was a good experience. But I regret that I didn't go to East Europe at that time.

Looking back, after gaining lots of experience traveling abroad, I think I was able to go around there without a problem, finding a hotel, etc.

During these 20 years, what have I done?
Surely, my intention in my mind has been always doing something good, contributing to protect human rights and democracy, etc. But in reality, I haven't achieved anything in those long 20 years, caught up with unimportant things.

Tuesday, September 15, 2009

Upgrade to Mac OS X Snow Leopard (as a development machine for Ruby on Rails) 2

All I was trying to do was to switch to MySQL 64bit. That led to changing the whole thing. Installed MySQL 5.1 64bit. I had to switch to the preinstalled Ruby 1.8.7 instead of the one I had installed using MacPorts before because mysql gem installation failed. And that led to installing the gems under /usr and uninstalling the ones that are not 64bit and reinstalling them. There were much more.

Usually, I write what I did to make it work. But it's too long. So I just leave it to say that I'm happy that it's finally all set.

Sunday, September 06, 2009

Upgrade to Mac OS X Snow Leopard (as a development machine for Ruby on Rails)

I have upgraded from OS X 10.5 Leopard to 10.6 Snow Leopard recently.

Then I couldn't access MySQL any more.

After many trials such as installing 64 bit MySQL, etc, I found that all the directories and files except for data and lib had been deleted under MySQL directory and also symbolic link to it when the Snow Leopard upgrade was done. In my case, I had mysql-5.0.45-osx10.4-i686 under /usr/local and I used to have the symbolic link called mysql under /usr/local pointing to it. I found the problem by looking at Time Machine.

So I restored the /usr/local/mysql-5.0.45-osx10.4-i686 directory from the backup using Time Machine and then restored mysql symbolic link.

MySQL setup GUI under "System Preferences..." (under Apple mark menu) didn't work. i.e. MySQL server didn't either start or stop by clicking on the button there. So I restarted Mac OS X in order to start MySQL server.

Then I was able to access to MySQL as before.

The next step is installing 64 bit MySQL to take advantage of OS X Snow Leopard.

(By the way, I'm using MySQL 5.0 because I learned from a local MySQL user group, it's not worth upgrading to 5.1. But I hope it's worth upgrading OS X to Snow Leopard.)

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.

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):

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.

$ 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).

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"

Wednesday, February 25, 2009

Make successful mistakes

I have watched a talk about business and I just write in here because it was interesting and is important.

Saturday, February 21, 2009

Snowboard Geek

About almost a year ago, I wrote a blog, "Healthy Snowboarding Brand".

Along the same line, some words have come up to my mind today, out of nowhere.

I'm a "Snowboard Geek".

And I like it a lot.

Sunday, February 01, 2009

Outliers

I have listened to the audio book of Malcolm Gladwell's "Outliers".

It was very interesting and I liked it.
It has already changed the way I go on with my life.

By the way, it's true that numbering system in East Asian language is logical - at least I know about my native language, Japanese. It's strictly Base 10 (Decimal). After 13 years of counting in English (and the last one year in French as well), I have started counting numbers in Japanese in my head in the last few days after I listened to the audio book. Works very well.

It's a side issue but I'm glad that I have an advantage of choosing only a good thing from English and Japanese (and French a little) not being stuck with a handicap in one particular language.

Tuesday, January 20, 2009

Saturday, January 03, 2009

Ruby on Rails 2.2 and Spawn

Spawn was updated to work with Ruby on Rails 2.2 very recently.
(Spawn GITHUB commit history)

Ruby on Rails 2.2 and will_paginate

will_paginate 2.2.2 doesn't work with Ruby on Rails 2.2.

You have to have mislav-will_paginate 2.2.3. (will_paginate wiki)