LeopardでGNU screenを使っているとき、以下のような エラーメッセージが出てくることがあるようです。

   1  ****** Returning nil _server **********

これはLeopardに付属している/usr/bin/screenに当たっているパッチの影響であるらしく、Macports版のGNU screenを使えばこの問題は発生しないようです。

posted by Png genki on Mon 22 Sep 2008 at 09:35

iPhone-2.1になってから、SafariでSVGを表示できるようになったらしい。

SVG working on the iPhone

30AA30FC30AC30CA30A430B6

おお。

See Also

posted by Png genki on Thu 18 Sep 2008 at 23:04

Today, I added the feature mentioned in the title above to the Gist Ubiquitifier.

Gist Ubiquitifier
Uploaded with plasq's Skitch!

Obviously, it lacks title of the commands. This spec came from our purpose of providing transparent service to make pages for installing ubiquity commands.

But it might be provided in the future.

posted by Png takiuchi on Tue 16 Sep 2008 at 21:47

DBにyyyy,mm,dayというカラムがあるのだがmm,dayがなぜかvarcharで発狂しそう。日付型か数値型に置き換えよう。PostgreSQLの数値型へ変換する関数「TO_NUMBER」では書式指定が必須となっている。

詳細はこちら。

http://osb.sra.co.jp/PostgreSQL/Manual/PostgreSQL-8.1-ja/functions-formatting.html#FUNCTIONS-FORMATTING-NUMERIC-TABLE

to_number(year,9999) 10000 + to_number(month,99)100+to_number(day,99))>=20080401

のように使う。(日付型にした方が早かったか?

posted by Face ysakaki on Tue 16 Sep 2008 at 16:07

.autotestを書き換えるたびに思い出すのに苦労するのでまとめておきます。

Hook List of autotest
hook namewhen does it happen?
:initialize起動直後
:interruptINT割り込み発生時
:reset初期化の後およびING割り込み時の初期化が完了した後
:run_commandテストの実行前
:ran_commandテスト完了時
:all_goodINTによる全体テストが成功裏に完了した場合
:waitingテスト実行完了後にsleepする直前
:quit終了時

posted by Png genki on Tue 16 Sep 2008 at 08:32

I attended the event called OoO, which is an offline meeting for offline renderists. The word renderist means people who are making renderer or interested in it.

IMG_0188.JPG

The contents of the event is as follows.

  • Keynote by Toshiya Hachisuka
  • Report of SIGGRAPH 2008
  • An introduction of DEMO scenes.

These were all attractive and interesting. And talks about the Larrabee also were ubiquitous.

I have a long standing issue. The issue is if providing server-side offline renderer itself is able to be a business going concern. Once I had tried at 2003, but it failed. I thought it was too early and it would need a time of 5 years. So I gave up the business and switched to make a web application.

And the 5 years went by...

The gang's all near.

posted by Png takiuchi on Mon 15 Sep 2008 at 21:09

IPアドレスのソートがちょっと面倒。

普通にRubyを使ってIPアドレスをソートしようとすると、

   1  ip_addrs = ["192.100.100.1", "192.11.11.1", "192.11.100.1"]
   2  ip_addrs.sort
   3  #=> ["192.100.100.1", "192.11.100.1", "192.11.11.1"]
となって、きちんとソートされない。 まぁ、当たり前と言えば当たり前なんですが・・・。

きちんとソートするためには、こんな感じにしてみる。

   1  ip_addrs.sort_by{|a| a.split(".").map{|i| "%3d" % i.to_i}}
   2  #=> ["192.11.11.1", "192.11.100.1", "192.100.100.1"]

もうちょっと綺麗に書けんなぁ? "%3d"とか、なんか嫌やなぁ。

ちなみにシェルだと、

   1  $ echo '
   2  192.100.100.1
   3  192.11.11.1
   4  192.11.100.1
   5  ' | sort -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 -n 
   6  
   7  
   8  192.11.11.1
   9  192.11.100.1
  10  192.100.100.1

とかできるけど、-kオプションが気に入らない感じ。

もっと綺麗に書ける方法はないのだろうか・・・。

posted by Png y_tsuda on Mon 15 Sep 2008 at 17:45 with 3 comments

早速Growlとautotestを連携させてみようと思ったのですが、 growlnotify-1.1.4でメッセージを出そうとすると、

   1  % growlnotify -m "test"
   2  2008-09-15 09:13:20.929 growlnotify[901:10b] could not find local GrowlApplicationBridgePathway, falling back to NSDNC

こんな感じのWARNINGが出てきます。 メッセージ自体はきちんと表示されるので、実用上問題ないのですが、 毎回警告が出てくるのはちょっと気になるので、 警告が出ない方法が無いかいくつか試してみた所、 以下のようにホストを指定すると大丈夫なようでした。

   1  % growlnotify -m "test" -H localhost

ということで、autotestと連携させるために、 以下のような.autotestファイルを作成しました。

   1  class Autotest
   2    module Growl
   3      IMG_OK = '/Developer/Examples/Carbon/Dial/English.lproj/' +
   4               'rotate_knob_select.tiff'
   5      IMG_NG = "/Applications/Mail.app/Contents/Resources/Caution.tiff"
   6      class << self
   7        def growl(title, msg, img = nil, pri = 0, sticky = "")
   8          img ||= IMG_NG
   9          msg += " at #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}"
  10          system "growlnotify -n autotest #{title} -m #{msg.inspect}" +
  11            " -H localhost --image #{img} -p #{pri} #{sticky}"
  12        end
  13      end
  14  
  15      Autotest.add_hook :run_command do |at|
  16        growl "autotest running", "Started", IMG_OK
  17      end
  18  
  19      Autotest.add_hook :ran_command do |at|
  20        result = [at.results].flatten.join("\n")
  21        examples = result.slice(/(\d+)\s+examples?/).to_i
  22        tests = result.slice(/(\d+)\s+tests?/).to_i
  23        failures = result.slice(/(\d+)\s+failures?/).to_i
  24        errors = result.slice(/(\d+)\s+failures?/).to_i
  25        if failures + errors > 0
  26          growl "Tests Failed",
  27            "#{failures} failures #{errors} errors", IMG_NG, 2#, "-s"
  28        else
  29          growl "Tests Passed", "#{tests + examples} tests", IMG_OK
  30        end
  31      end
  32    end
  33  end

最初はrequire 'autotest/growl'をしてモンキーパッチを当てていたのですが、 結局ほとんど書きかえてしまったのでこうなりました。

エラーが発生した場所や、エラーメッセージなんかも表示できるようになるともっと便利になるかもしれないですね。

posted by Png genki on Mon 15 Sep 2008 at 09:24 with 2 comments

Mac環境でうまく動いていない状況だったので、修正を行いました。

http://github.com/genki/trident/tree/master

基本的な使い方の変更は特にありません。

複数の端末でTridentを起動しているときに、 'Trident.reload'を呼び出した端末でのみリロードが実行されるようになりました。 よろしくお願いします。

posted by Png genki on Sat 13 Sep 2008 at 15:48

まだMacの起動スクリプトのことをなんと呼べばいいのかわからないのですが、 とりあえずなくて困ったので、 HyperEstraier用の起動スクリプトを作ってみました。

hyperestraier.plist

   1  <?xml version="1.0" encoding="UTF-8"?>
   2  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
   3  <plist version="1.0">
   4  <dict>  
   5          <key>Debug</key>
   6          <false/>
   7          <key>Label</key>
   8          <string>org.macports.hyperestraier</string>
   9          <key>OnDemand</key>
  10          <false/>
  11          <key>ProgramArguments</key>
  12          <array> 
  13                  <string>/opt/local/bin/daemondo</string>                <string>--label=hyperestraier</string>
  14                  <string>--start-cmd</string>
  15                  <string>/opt/local/etc/LaunchDaemons/org.macports.hyperestraier/hyperestraier.wrapper</string>
  16                  <string>start</string>
  17                  <string>;</string>
  18                  <string>--stop-cmd</string>
  19                  <string>/opt/local/etc/LaunchDaemons/org.macports.hyperestraier/hyperestraier.wrapper</string>
  20                  <string>stop</string>
  21                  <string>;</string>
  22                  <string>--restart-cmd</string>
  23                  <string>/opt/local/etc/LaunchDaemons/org.macports.hyperestraier/hyperestraier.wrapper</string>
  24                  <string>restart</string>
  25                  <string>;</string>
  26                  <string>--pid=none</string>
  27          </array>
  28          <key>RunAtLoad</key>
  29          <false/>
  30  </dict>
  31  </plist>

plistファイルの中で指定されているhyperestraier.wrapper は以下の通り。

   1  !/bin/sh
   2  #
   3  # MacPorts generated daemondo support script
   4  #
   5  
   6  #
   7  # Init
   8  #
   9  prefix=/opt/local
  10  
  11  #
  12  # Start
  13  #
  14  Start()
  15  {
  16    if test ! "`netstat -a -n | grep 1978`"; then
  17      rm -f /opt/local/var/run/hyperestraier/_pid
  18    fi
  19  
  20    /opt/local/bin/estmaster start -bg /opt/local/var/run/hyperestraier
  21  }
  22  
  23  #
  24  # Stop
  25  #
  26  Stop()
  27  {
  28    /opt/local/bin/estmaster stop /opt/local/var/run/hyperestraier
  29  }
  30  
  31  #
  32  # Restart
  33  #
  34  Restart()
  35  {
  36    Stop
  37    Start
  38  }
  39  
  40  #
  41  # Run
  42  #
  43  Run()
  44  {
  45  case $1 in
  46    start  ) Start   ;;
  47    stop   ) Stop    ;;
  48    restart) Restart ;;
  49    *      ) echo "$0: unknown argument: $1";;
  50  esac
  51  }
  52  
  53  #
  54  # Run a phase based on the selector
  55  #
  56  Run $1

macportsで入れたmysql5-develの起動スクリプトを元にしているので、 ディレクトリ構成などがmacports的になっています。

posted by Png genki on Fri 12 Sep 2008 at 15:11 with 1 comment