ShootingStarの進捗
どうもこの辺のエラーが出ていて困り中。

VC++2008 Expressで開発しているのだけれど、
ActiveScri
どうもこの辺のエラーが出ていて困り中。

VC++2008 Expressで開発しているのだけれど、
ActiveScri
基本的にはnetstatコマンドを使えばいいのですが、 linux系とはオプションがちょっと違います。
1 > netstat -a -o | grep 12345
上記のコマンドを実行すると、一番右端のカラムにPIDが出力されます。
cmd.exeから以下のようにコマンドを実行することで、 WindowsのプロセスをIDでKillすることができます。
1 > taskkill /PID 12345
強制終了する場合は、/Fオプションを追加します。
In prototype.
1 Event.observeOnce = function(element, event, observer){ 2 var handler = function(){ 3 Event.stopObserv ing(element, event, handler); 4 return observer.apply(null, $A(arguments)); 5 }; 6 Event.observe(element, event, handler); 7 };
The usage is same to Event.obse
1 Event.observeOnce(document, 'dom:loaded ', function(){ 2 /* some code goes here */ 3 });
It may be useful if you copy this into public/jav
prototype.Event.obseは非常に便利なのですが、
初期化処理など、一度だけイベントの処理したい場合にはちょっと不便です。
度々そのような処理を行う機会があったので、以下のような
一度だけイベントをハンドルする関数を作ってみました。
1 Event.observeOnce = function(element, event, observer){ 2 var handler = function(){ 3 Event.stopObserv ing(element, event, handler); 4 return observer.apply(null, $A(arguments)); 5 }; 6 Event.observe(element, event, handler); 7 };
使い方は、通常のEvent.obseと同様です。
1 Event.observeOnce(document, 'dom:loaded ', function(){ 2 /* some code goes here */ 3 });
Railsアプリケーションであれば、public/jav
以前は、Railsのhelperメソッドのオプションや細かい挙動を調べるために、
secondlife
細かい理由はいろいろあるのですが、一番大きいのは、 以前紹介したRak を使って直接Railsのソースを確認するのが便利な事です。
使い方はこんな感じです。
vendor/rai ls以下にRailsをfreezeさせます。cd vendor/rai lsしたスクリーンを用意しておきます。rak def\ method_nam eを実行して、出てきたファイルをvimで読む。さらに、細かい挙動やメソッドに渡ってきた値を調べたい時などは、
vendor/raidebuggerと書き込んで、
script/serでデバッグモードを起動します
(「Rails 2.0でデバッグをする新しいやり方」参照)
apt-get install git-coreですんなり終わるかと思っていたら、
GNU Interactiv
1 git, the filemanager with GNU Interactiv e Tools, is now called gitfm. 2 3 If you are looking for git, Linus Torvald's content tracker, install 4 the cogito and git-core packages and see README.Deb ian and git(7). 5 6 This transition script will be removed in the debian stable 7 release after etch. 8 9 If you wish to complete the transition early, install git-core 10 and use (as root): 11 update-alt ernatives --config git 12 13 Press RETURN to run gitfm
指示の通り、update-altを実行すると、
今度はこんな感じのメッセージが出るので、
1 # update-alternatives --config git 2 3 There are 2 alternativ es which provide `git'. 4 5 Selection Alternativ e 6 ---------- ---------- ---------- ---------- ------- 7 *+ 1 /usr/bin/g it.transit ion 8 2 /usr/bin/g it-scm 9 10 Press enter to keep the default[*], or type selection number:
2の/usr/bin/gを選択します。
これでGitを使えるようになりました。
技術評論社さま、献本ありがとうございます。
今号は連載の最終回が多いですね。季節を感じる一冊です。
個人的に面白かったのは、
ですね。参考にさせていただきます。
OpenIdAuth
ruby-openi
1 gem install ruby-openid
pluginのインストール
1 $ ./script/plugin install http://svn .rubyonrai ls.org/rai ls/plugins /open_id_a uthenticat ion/
パッチをあてる
パッチを入手ticket1060
http://dev
プラグインのところに移動させておく
1 #{RAILS_ROOT}/vendor/pl ugins/open _id_authen tication/t icket10604 .diff
プラグインのルートに移動して、patchを当てる
1 $ patch -p1 < ticket10604.diff 2 patching file init.rb 3 Hunk #1 FAILED at 1. 4 1 out of 1 hunk FAILED -- saving rejects to file init.rb.re j 5 patching file lib/genera tors/open_ id_authent ication_ta bles/open_ id_authent ication_ta bles_gener ator.rb 6 patching file lib/genera tors/open_ id_authent ication_ta bles/templ ates/migra tion.rb 7 patching file lib/open_i d_authenti cation.rb 8 Hunk #5 succeeded at 69 with fuzz 1 (offset -2 lines). 9 Hunk #6 succeeded at 88 (offset -2 lines). 10 Hunk #7 succeeded at 152 (offset -2 lines). 11 patching file lib/open_i d_authenti cation/ass ociation.r b 12 patching file lib/open_i d_authenti cation/db_ store.rb 13 patching file lib/open_i d_authenti cation/non ce.rb 14 patching file lib/open_i d_authenti cation/set ting.rb 15 patching file tasks/open _id_authen tication_t asks.rake 16 patching file test/norma lize_test. rb 17 patching file test/open_ id_authent ication_te st.rb 18 patching file test/statu s_test.rb
READMEにあるExampleの作業
テーブル作成
1 rake open_id_authenticati on:db:crea te
routesに下記を加える
1 map.open_id_complete 'session', :controller => "sessions", :action => "create", :requiremen ts => { :method => :get } 2 map.resource :session
SessionsCo
ここでmatakeさんと同じようにはまったのですが、SessionCon
1 def open_id_authenticati on 2 authentica te_with_op en_id do |result, identity_u rl| 3 if result.successful ? && @current_us er = @account.users.find_by_id entity_url (identity_u rl) 4 successful _login 5 else 6 failed_log in(result.message || "Sorry, no user by that identity URL exists (#{identity_u rl})") 7 end 8 end 9 end
ruby-openi
1 #open_id_authenticati on/init.rb 2 begin 3 # gem 'ruby-openi d', '=1.1.4' 4 gem 'ruby-openi d'
OpenIdAuth
So, I applied patch(Ticket#10604) and they works well.
Install gem ruby-openi
1 gem install ruby-openid
Install plugin
1 $ ./script/plugin install http://svn .rubyonrai ls.org/rai ls/plugins /open_id_a uthenticat ion/
Apply patch
Get a patch and save as ticket1060
http://dev
Move diff file to plugin root
1 #{RAILS_ROOT}/vendor/pl ugins/open _id_authen tication/t icket10604 .diff
Move to plugin root and do patch command
1 $ patch -p1 < ticket10604.diff 2 patching file init.rb 3 Hunk #1 FAILED at 1. 4 1 out of 1 hunk FAILED -- saving rejects to file init.rb.re j 5 patching file lib/genera tors/open_ id_authent ication_ta bles/open_ id_authent ication_ta bles_gener ator.rb 6 patching file lib/genera tors/open_ id_authent ication_ta bles/templ ates/migra tion.rb 7 patching file lib/open_i d_authenti cation.rb 8 Hunk #5 succeeded at 69 with fuzz 1 (offset -2 lines). 9 Hunk #6 succeeded at 88 (offset -2 lines). 10 Hunk #7 succeeded at 152 (offset -2 lines). 11 patching file lib/open_i d_authenti cation/ass ociation.r b 12 patching file lib/open_i d_authenti cation/db_ store.rb 13 patching file lib/open_i d_authenti cation/non ce.rb 14 patching file lib/open_i d_authenti cation/set ting.rb 15 patching file tasks/open _id_authen tication_t asks.rake 16 patching file test/norma lize_test. rb 17 patching file test/open_ id_authent ication_te st.rb 18 patching file test/statu s_test.rb
Do some work in README
Creating tables
1 rake open_id_authenticati on:db:crea te
Add some routes
1 #config/routes.rb 2 map.open_id_co mplete 'session', :controller => "sessions", :action => "create", :requiremen ts => { :method => :get } 3 map.resource :session
Generate SessionsCo
Tip:NOT to use sample code in agilewebde
1 def open_id_authenticati on 2 authentica te_with_op en_id do |result, identity_u rl| 3 if result.successful ? && @current_us er = @account.users.find_by_id entity_url (identity_u rl) 4 successful _login 5 else 6 failed_log in(result.message || "Sorry, no user by that identity URL exists (#{identity_u rl})") 7 end 8 end 9 end
Ommit version of ruby-openi
1 #open_id_authenticati on/init.rb 2 begin 3 # gem 'ruby-openi d', '=1.1.4' 4 gem 'ruby-openi d'