最新 追記

いがいが日記


2010-12-05 [長年日記]

_ [ruby][en] SapporoRubyKaigi03

The SapporoRubyKaigi03 was held yesterday in Hokkaido, one of the largest northern islands in Japan.

The total attendees were about 150, of these 110 people were local, and the reset of 40 people came from Honshu(main island in Japan) include Matz.

There were 10 sessions and 11 lightning talks about testing, math library, pair programming, ruby block goodness, using dRuby library, Rails, e-publishing and Ruby culture.

An unique session was curling(http://en.wikipedia.org/wiki/Curling) and Ruby, to make DSL for writing result of curling tournament for people not familiar computer. And he was speaking about his life with agriculture and Ruby in Moseushi, Hokkaido.

And we enjoy delicious seafoods and Rubyist meetup too. :)

I translate a part of Matz Keynote speech in below.

--- Matz Keynote ---

"Let there be light"

Ruby was born in 1993.

User number was 1(of course me!) at that time.

In 2010, Ruby is 10th in TIOBE index.

When I was making Ruby, what should I do in that days?

I'd like to bring more light into the language.

For example, Lisp power, Smalltalk power, Perl power!

I'd like to use higher-order function and OOP in it.

Lisp is very good, but can we write business apps using CommonLisp?

(Of course some people are still writing...)

In 1993, OOP == C++.

Few people knew Smalltalk and Lisp.

It was not common to use OOP with scripting languages.

I wanted to bring these lights to the user of the language (the user was only me at that time!).

There are 2 things I am doing recently, HPC and Embedded.

HPC

Prof Hiraki of Tokyo Univ started a project to apply Ruby in HPC(High Performance Computing) env.

I am helping his project, and encouraging him to open source the result.

The things to do are

- Improving YARV

- Type Inference = You may be able to inline only integer so that number calculation could be faster. There are already some prototype showing that

some of the calculation is 80% as fast as C.

- NArray

Embedded.

Rite

Why do I do these?

I would like to bring the expressiveness of OO and functional feature into these fields via Ruby.

The policy of Ruby.

If there are nice things, let's deliver to the world.

If none, then let's make it by ourselves.

In future, I want Ruby to keep being the light which brings new concepts and ideas to people.

I also would like people to see such light, add their own, and spread it to other people.

Back then, the "light" was OO and functional paradigm.

Now, there are lots of interesting techniques, concept, and paradigm which are still not popular and only be found at some thesis level (or only some small community knows).

I would like to include these new concepts into Ruby as long as it does not conflict with Ruby's syntax and so on. I also would like people to add their own thoughts by adding, extending, and bending Ruby.

Eventually such light will change the world (not just through Ruby, but also through you).

So, today's theme was "Let your light shine".

Sorry for being a bit too "religious" like, but I would like to conclude my talk by quoting from new testament.

- Matthew 5:16 -

"Let your light so shine before men,

that they may see your good works,

and glorify your Father which is in heaven."

-

Yes, this idea is there since 2000 years ago.

I will also show you a photo of Ruby Kaigi staff(http://www.flickr.com/photos/recompile_net/4935820587/).

You can tell that they are shining.

------

Ruby Advent Calendar jp-en: 2010

This entry is for the event Ruby Advent Calendar jp-en: 2010. The previous post was from udzura and the next post will be from sorah. He is the youngest Ruby geek in all I know.

------

I've added a lot of more detail sentences by makoto_inoue. thanks! :) and I've replaced the link to sorah.

本日のツッコミ(全2件) [ツッコミを入れる]

_ sora_h [my blog is here. plz fix link. http://codnote.net/]

_ いがいが [>sora_h I've replaced it. thx!]


2010-12-25 [長年日記]

_ TupleSpaceとクリスマスに読みたい2冊の赤い本

メリークリスマス!

これは Ruby逆引きレシピAdvent Calendar の参加エントリです。

12/25担当のいがいがです。

前日の担当は @ukstudio さんの IRCでミサワをいつも側に… でした。

今日は「レシピ133:タプルスペースを介した分散処理を行いたい」のタプルスペースを紹介します。

タプルスペースは那須のKent Beck こと関さん作のライブラリRindaで実装されています。

「プロセス間で通信できる箱」といったイメージです。

TupleSpace1

タプルスペースという箱を作り、その中にタプル(オブジェクト)を出し入れできます。

タプルとしてArrayやHashなどさまざまなRubyのオブジェクトを扱うことが可能です。

これを使うと、プロセス間通信キューが簡単に実装できる優れものです。

■タプルスペースを動かしてみよう

レシピ先輩に教えてもらったサンプルコードでタプルスペースを起動します。

次に、irbを起動してこの箱にArrayオブジェクトを出し入れしてみましょう。

箱に入れるのは write, 取り出すのは take メソッドを使います。

takeして、その前にwriteでタプルスペースに格納したオブジェクトを取得できました。

(ちなみに、$ts.take(["message",nil])の引数の "message"はラベルのようなもので、

nilはそのラベルを持つオブジェクトの中からパターンマッチで取得が可能です。(nilは全マッチ))

■タプルスペースのメリット

拙作のLTタイマーTwYMもタプルスペースを使っています。

タイマーはtwitterやIRCなど複数のソースから表示メッセージを取得するため、

それぞれ別のプロセスとして起動してメッセージをタプルスペースにつめています。

表示アプリはタプルスペースからデータを取り出して表示しているだけで、

元のデータがIRCだったのかtwitterだったのかを意識しなくても済みます。

プロセスが別れているので、接続の調子が悪いときなどは

OSのshellから問題のプロセスだけを再起動して復活させることができます。

他の問題ないプロセスを動作させたまま問題対応できるのが利点です。

(運用中にタイマーとは別の画面でソースを書き換え、

取得するハッシュタグを切り替えたりなんてこともたまにしてます)

さらに、dRubyでお話ができれば誰でもタプルスペースを操作できるので、

Ruby1.8で起動しているタプルスペースにRuby1.9プロセスがwrite, take なんてこともできます。

これのおかげでタイマーもモジュールごとにRuby1.9対応を進められそうです。

プロセスが別れることのデメリットとしては処理のオーバーヘッドがあります。

処理速度を気にする場合はスレッドとQueueクラスの利用を検討してみてください。

■惚れさすタイトルをタイマーに流してみた

Ruby逆引きレシピAdvent Calendar 12月17日

「地獄のRuby札幌の「女に惚れさす逆引きレシピ集」 - 準二級.jp」から

ミサワネタにふれなくてはいけないような流れになっているので、

タイマーに惚れさすタイトルを流してみました。

所定のクラスへ詰めてタプルスペースへ格納するだけなので、

このような新しいソースへの対応が簡単で、タプルスペースを重宝してます。

horesasu

■レシピ先輩への道

今日はタプルスペースがプロセス間通信する入れ物であることを紹介しました。

より詳しくは最近電子版も出版されたdRubyによる分散・Webプログラミング(初刷り)を参照ください。

また、タイマーの仕組みに関してはとちぎRuby会議でお話した資料を参照ください。

逆引きレシピ本には日々の生活を便利にしてくれるレシピがたくさん載っています。

困ったことがあったとき、目次を眺めてみると解決のヒントを教えてくれる頼りになるレシピ先輩です。

これは、本に限ったことでなく、日常の会話やtwitterでも同じことが起こっています。

「○○で困ってるのだけどいい方法ない?」

と聞くと、世界に散らばる先輩方がヒントを教えてくれたりします。

このAdventCalendarのように、レシピ先輩の活躍は本を飛び出し、世界へ広まっています。

ぜひあなたも時にはレシピ先輩の一員としてレシピを紹介してみてください。

また来年、どこかのブログであなたのレシピ先輩と会うことを楽しみにしています!

あと、ミサワ流れを作った @june29 さんはけしからんので、来年ももっとやるように。

4798119881

4274066096


2010-12-30 [長年日記]

_ carbon emacs から cocoa emacs へ移行した

年末休みで時間ができたので前からやりたかったcocoa emacsへの移行をしました。

メモ的に作業ログを残しておきます。

いまのところうまく動いている感じですが、

いろいろ使ってみないとですね。

auto-async-byte-compile でコンパイル時にwarningが出るとお知らせしてくれる機能は切りたい。

作業時間は.elのリファクタリングとか

設定フォルダを.emacs.d へ移動とか整理をあわせて5時間くらいでした。

emacs22→23への移行もできたので、いろいろ新機能の試してみたいです。

今のところ、行番号表示が標準ですっきり出せるようになったのがお気に入りです。

■フルスクリーン化と日本語入力まわりのパッチを入手

https://github.com/typester/emacs/downloads からダウンロードできます。

$ curl -O http://cloud.github.com/downloads/typester/emacs/fix-shiftmodifier-with-ime.patch

$ curl -O http://cloud.github.com/downloads/typester/emacs/feature-fullscreen.patch

■emacs本体のビルド

もっとさきっちょを使いたい方は git://git.savannah.gnu.org/emacs.git

など。

$ curl -O http://ftp.gnu.org/pub/gnu/emacs/emacs-23.2.tar.gz

$ tar zxvf emacs-23.2.tar.gz

$ cd emacs-23.2

$ patch -p1 < ../feature-fullscreen.patch

$ patch -p1 < ../fix-shiftmodifier-with-ime.patch

$ ./configure --with-ns --without-x

$ make bootstrap

$ make install

nextstep/emacs.app ができるので Applications など好きなとこへ移します。

■言語を日本語にする

(set-language-environment 'Japanese)

■極力UTF-8とする

(prefer-coding-system 'utf-8)

■フォント設定:ヒラギノ丸ゴ と Menlo

■その他

・hiki-mode でエラーになったので要調査

・デバッグ起動

$ open Emacs.app --args --debug-init

・emacsclientは以下にあります

Emacs.app/Contents/MacOS/bin/

・起動時のtoolbar非表示の設定

旧:(tool-bar-mode nil)

新:(tool-bar-mode -1)

・mac専用設定の判定を修正

旧:(if (eq window-system 'mac)(load "~/.emacs.d/iga_emacs_mac.el"))

新:(if (eq window-system 'ns)(load "~/.emacs.d/iga_emacs_mac.el"))

・Deleteキーの動作が旧バージョンと違ったので設定

(global-set-key [delete] 'delete-char)

(global-set-key [kp-delete] 'delete-char)

・フォントサイズの動的変更をmeta +, meta - に割り当て

(global-set-key [(meta ?+)] (lambda () (interactive) (text-scale-increase 1)))

(global-set-key [(meta ?-)] (lambda () (interactive) (text-scale-decrease 1)))

・Drag&Drop時にinsertではなく新規タブでファイルを開く

(define-key global-map [ns-drag-file] 'ns-find-file)

(setq ns-pop-up-frames nil)

・global-linum-mode で行番号表示できるようになった。整形指定。

(setq linum-format "%4d ") ;; 4桁とspace

■参考サイト

http://sakito.jp/emacs/emacs23.html

ほか、いろいろ参考にしたおかげでほとんどはまりませんでした。ありがたや。


2010-12-31 [長年日記]

_ 2010年のふりかえり

今年の目標に沿ってふりかえってみます。

■総合

> 今年は新しい挑戦の年に。

転職して、新しいフレームワークを2つ(iPhoneとRails)使い始められたので○。

■健康

> ひきつづき健康でありたい。

> ちょっとした体の異変は体からのメッセージなので、早めに休むようにしたいです。

ありがたいことに体調は総じて良かった。

年の後半に体がたくさん睡眠を欲していたのがやや気がかりなくらい。

■英語

> 英語と日本語を意識せずに情報を吸収していきたい。

> 直近はヒヤリング力の向上に力をいれたい。

大きな目標だったTOEIC600点が達成できてうれしかった。

CNNニュースを聞いてて理解できる量が増えたのでヒヤリングも力がついたと思う。

■Ruby

> Rubyコミュニティに貢献できる方法を考えていきたい。

> あと、海外のRubyイベントに参加したい。これは目標ってより希望。(笑)

Rubyコミュニティへの貢献はあんまりできなかったかも。

Ruby会議で企画をできたことくらいかなぁ。

海外のRubyイベントはRubyConfへ会社のお金で参加させていただきました。ありがたや。

RubyConfはかなり刺激になりました。

あと、早い時期にRuby黄金聖闘士になれたのは予想よりもプラスでした。

■発信する

> 去年と同じ目標、発信に向けて力を蓄えたい。

これはあんまりできなかったかなぁ。来年は発信したい。

■高専カンファレンス

> 何か新しいアイデアを出して実行したい。

> 来た人が、その場だけでなく、戻ってからも継続できるような。

これは、できたかな・・・。新しいアイデアは出したし実行もできたけど、

来た人にどれくらい影響を与えられただろうか。

■卓球

> 得意型を作る。サーブからこの流れで点を取れる、という形を作っていきたい。

今年は全然練習時間がとれずにしょんぼりです・・・。

卓球.rbが開催できたのはよかった。

■その他追記

・ついに車を手放した

・RubyGemsデビューできた(1つだけだけど)

igacs(emacs勉強会)はとてもおもしろかった。ので第2回をやりたい。年次でやりたいね。

・はやぶさの帰還に胸が熱くなった。ust中継してくれた方ありがとう。

・日記を書く量は減っちゃったなぁ。

・dropbox や git-hub、iphone と新しいインフラを使い始めて便利でした。

■まとめ

いろんなことにチャレンジできた1年で、

いろんな人にいろんなアドバイスをいただいた1年でした。

これを踏まえて来年の目標を立てよう。

今年もいがいが日記をご贔屓くださりありがとうございました。

みなさま良いお年を!


最新 追記