まつもとさんも何度か記事を書いていたMUDA (作者が発音してるのを聞いた感じだと「ムーダ」と読むみたい)の サイト がオープンしたようです。

MUDA site opens!

I’ve launched MUDA project page! Check it.

MUDA is a vector language for CPU. Yeah, not for GPU or (dead and gone) GPGPU ;-)

I’m planning to use MUDA to code core computation part of my lucille renderer.

おめでとうございます!

posted by Png genki on Mon 10 Dec 2007 at 01:09

最近話題の ActiveScaffold の開発メンバーでもあるLance Ivy氏のレポート。

How Rails' Benchmarks Lie

I’ve been on a benchmarking blogging spree lately. Creating BenchmarkForRails (B4R) with its non-invasive benchmarking technique has made it very easy to play around with timing of key Rails methods and develop a better picture of the true costs. The results have been amazing.

Railsのベンチマークでは測定しきれない部分の ベンチマークを可能にする BenchmarkForRails というプラグインを作ったとの事。

具体的には、こんな感じで違いが出るようです(以下に抜粋)

Rails

Completed in 0.85246 (1 reqs/sec)
Rendering: 0.48872 (57%)
DB: 0.02561 (3%)

BenchmarkForRails

- [0.9532] GET /plans ----------------------------
   0.8528 processing action
   0.5015 rendering
   0.2533 activerecord find
   0.0461 development mode
   0.0073 before filters
   0.0046 session management
   0.0000 after filters
------------------------------ BenchmarkForRails -

かなり細かいところまで計測できていますね。ちょっと面白いです。

posted by Png genki on Mon 10 Dec 2007 at 00:36

今では、このプラグインのお世話になるような状況にはならなくなった のですが、多人数でRailsアプリケーションを開発している場合には 便利なプラグインかもしれません。

Renumber clashing Rails migrations in one easy step

If you work in a team on a Rails project, chances are that you and your team mates occasionally create identically-numbered migrations. Renumbering a migration that you're working on is a pain, unless you're using this handy 'renumber_migrations' plugin.

このプラグインを使うと、マイグレーション番号が衝突した場合に、 Subversionのリポジトリを確認して、あるべき順序に番号を 振りなおしてくれます。

Subversionを使って管理していないプロジェクトでは使えないですが、 ちょっとソースを書き換えれば他のSCMを使ってる場合でも対応できる ようにするのは難しくなさそうです。

使い方

まずは、以下のコマンドでプラグインをインストールします。

   1  % ./script/plugin install http://rails.sanityinc.com/plugins/renumber_migrations

あとは、Rakeタスクを実行するだけです。

   1  % rake db:migrate:renumber

posted by Png genki on Mon 10 Dec 2007 at 00:20

巷では Google Chart API が注目を集めていますが、 その裏でひっそりとリリースされたもうひとつの Chart APIがあるをご存知でしょうか。

Kao Chart API

kao_chart

この画像は、元同僚の安藤さんが開発した Kao Chartというサービスが提供している Kao Chart APIを使って生成しています。

サーバが弱いらしく、ちょっと重たいですが、 面白いですね。「ざわざわ」パラメータが秀逸。

posted by Png genki on Sun 9 Dec 2007 at 22:12

思い返せば、Widgetという名前を最初に見かけたのは、 wxWindowsなどのGUIツールキットのクラス名(wxWidgetとか) だったような気がします。

最近、Yahoo! WidgetやGoogle Gadgetなど、WidgetやGadgetという名称を よく見かけますが、意味的な違いの認識が曖昧だったので ちょっと調べてみました。

ウィジェット - Wikipedia

グラフィカルユーザインターフェースを構成する部品要素、およびその集まり→ウィジェット (GUI)、ウィジェット・ツールキット。「window gadget」の合成語ともいわれている。

なるほど、Window + GadgetでWidgetだったのか。

posted by Png genki on Sun 9 Dec 2007 at 21:37

xxxx_controller.rbはXxxxControllerが定義されているべき、 というようなエラーメッセージが出た場合、 XxxxControllerのクラス定義のなかでエラーが発生している 事が原因だったりするみたいですね。

お手製の acts_as_xxxxx を使ってたりする場合、 その辺でエラーを出してないかチェックすると良いようです。

posted by Png genki on Sun 9 Dec 2007 at 05:12

debianで普通にsnmpdをパッケージからインストールすると、

   1  # netstat -lnp | rak snmp
   2    17|udp    0   0 127.0.0.1:161   0.0.0.0:*   13404/snmpd

このように、127.0.0.1にbindしてlistenするようになっているため、 プライベートネットワーク内のほかのサーバ (cactiとかが動いているもの)から接続できません。

この辺の設定を変えるには、/etc/default/snmpdを 以下のように編集します。

   1    ..(略)..
   2  
   3  # snmpd options (use syslog, close stdin/out/err).
   4  SNMPDOPTS='-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid 192.168.10.123'
   5  
   6    ..(略)..

192.168.10.123というのは適当な数字です。 あとはsnmpdを再起動しましょう。

posted by Png genki on Sun 9 Dec 2007 at 01:15

先日お伝えしたとおり、Rails 2.0がリリースされましたね。

Rails 2.0: It's done!

Rails 2.0 is finally finished after about a year in the making. This is a fantastic release that’s absolutely stuffed with great new features, loads of fixes, and an incredible amount of polish. We’ve even taken a fair bit of cruft out to make the whole package more coherent and lean.

Railsを使い始めたのが2005年の12月、ちょうどRails 1.0がリリースされた ころの事。あれからちょうど2年の歳月が流れました。 感慨深いものです。

末尾が偶数バージョンがリリースされると、すぐに奇数バージョン が跡を追うのは相変わらずですね ;-)

早速ですが、このブログシステムもRails 2.0(2.0.1)に移行しました。 1.2.5から、RC1、RC2を経て、バージョンアップをしてみましたが、 特に大きな問題は発生しなかったです。

posted by Png genki on Sat 8 Dec 2007 at 09:41

新しいscriptとして、script/performance/requestというものが 新たに加わったみたいです。

   1  h% ./script/performance/request --help
   2  USAGE: ./script/performance/request [options] [session script path]
   3      -n, --times [0000]               How many requests to process. Defaults to 100.
   4      -b, --benchmark                  Benchmark instead of profiling
   5          --open [CMD]                 Command to open profile results. Defaults to "open %s &"
   6      -h, --help                       Show this help

ふむふむ。ベンチマーク系のスクリプトのようですね。 紹介してる記事を見つけました。

New in Rails: a request profiler for profiling your app

Jeremy Kemper (aka bitsweat) committed a very useful tool into the Rails trunk not too long ago: a request profiler! It’s a human-friendly wrapper script around the ruby-prof library, a nice ruby code profiler, that lets you run multiple requests against a URI in your application and get a detailed code profile report in text and HTML.

おーなるほど。前回のRails勉強会で紹介した ruby-prof を human-friendlyにしてくれるツールですか。これは面白そうですね。

試してみようと思って触ってみたら、上のサイトで紹介されてる ものと、Rails 2.0で入ったものは若干インターフェイスが違う模様。

DHHが書いてる こっちの情報 が最新のようです(以下に抜粋)

Action Pack: New request profiler

Figuring out where your bottlenecks are with real usage can be tough, but we just made it a whole lot easier with the new request profiler that can follow an entire usage script and report on the aggregate findings. You use it like this:

$ cat login_session.rb
get_with_redirect '/'
say "GET / => #{path}" 
post_with_redirect '/sessions', :username => 'john', :password => 'doe'
say "POST /sessions => #{path}" 
$ ./script/performance/request -n 10 login_session.rb

And you get a thorough breakdown in HTML and text on where time was spent and you’ll have a good idea on where to look for speeding up the application.

なにやらIntegrationTestのコードのようなものを記述したスクリプト を用意して、そのpathを渡せば良いみたいです。

posted by Png genki on Sat 8 Dec 2007 at 09:39

基本はstableで使いつつ、ちょっと使ってみたい新しい パッケージがある場合だけ、unstableから持ってくるような使い方を する場合のaptの設定メモ。

まずはsources.listにunstableを追加。

/etc/apt/sources.list

   1  deb http://cdn.debian.or.jp/debian/ etch main contrib non-free
   2  deb-src http://cdn.debian.or.jp/debian/ etch main contrib non-free
   3  
   4  deb http://security.debian.org/ etch/updates main contrib
   5  deb-src http://security.debian.org/ etch/updates main contrib
   6  
   7  deb http://cdn.debian.or.jp/debian/ unstable main contrib non-free
   8  deb-src http://cdn.debian.or.jp/debian/ unstable main contrib non-free

それがすんだら、優先度の設定を行います。

/etc/apt/preferences

   1  Package: *
   2  Pin: release a=stable
   3  Pin-Priority: 100
   4  
   5  Package: *
   6  Pin: release a=stable-proposed-updates
   7  Pin-Priority: 110
   8  
   9  Package: *
  10  Pin: release a=unstable
  11  Pin-Priority: 90

ついでに、キャッシュ容量の設定なども行っておきましょう。

/etc/apt/apt.conf

   1  APT::Cache-Limit "100000000";
   2  APT::Default-Release "stable";

上記の設定ファイルファイルが無い場合は、新しく作成します。

これで完了。あとはapt-get updateすればOK。 必要に応じて、-t unstable オプションを指定して unstableの パッケージを利用できます。

posted by Png genki on Sat 8 Dec 2007 at 07:30