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
Contents
Event Report: Offline Meeting for Offline Renderists
IPアドレスをソートする
growlとautotestを連携させる
Comments
瀧内元気: MacOS版は以下にあります * [genki/ViMouse](https://githu... '23-1
KingofSmack: Here also good reads for this mobile applicatio... '14-5
Spencer: You don't have to re-compile it, this version w... '14-4
staiano: Any chance we can get a recompile for 10.9? '14-1
dsjf: https://gist.github.com/6bf1bf2c3cbb5eb6e7a7 これ... '13-1
Services from s21g
twpro(ツイプロ)
Twitterプロフィールを快適検索
地価2009
土地の値段を調べてみよう
MyRestaurant
自分だけのレストラン手帳
Formula
ブログに数式を埋め込める数式コミュニティ