• 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
 
 
undefined method `parse' for nil:NilClass
posted by Png genki on Wed 9 Mar 2011 at 19:42

DHHがGithub上でrubygemsがデフォルトで--no-ri --no-rdocになるように しようという 運動をしている ようです。 やっぱみんなそう思うよね!

ss

すでに結構賛同者がいる模様。

訂正 git request-pull はメールを送信する機能は無いらしい。

http://rubygems.org にいけば rdoc は読めるし、デフォルトですべての環境にインストールされる必要なんてないよね。

Let's join!

posted by Png genki on Fri 25 Feb 2011 at 18:46

Though it may be needless to say.

There must be languages or grammars hidden in the manner of developing games to have human-beings worked for various tasks.

posted by Png genki on Thu 24 Feb 2011 at 18:50 with 1 comment

コンパイル時に -D オプションで指定したパラメータを文字列化して使用する方法のメモです。 以下は -DFOO_DIR=hoge のようにした場合に、何らかのディレクトリ名の PREFIXとしてこれを使う方法。

   1  #define STRINGIFY(x)  STRINGIFY_(x)
   2  #define STRINGIFY_(x) #x
   3  #define BAR_PATH      (STRINGIFY(FOO_DIR) "/bar")

二度マクロ適用しなければいけないのがややトリッキーです。

posted by Png genki on Wed 23 Feb 2011 at 16:22
21st Mon

CGImageAlphaInfo

リファレンスでは kCGImageAlphaNone は kCGImageAlphaNoneSkipLast と equivalent とあるけど、CGBitmapContextCreate の bitmapInfo パラメータに渡すときの挙動は違う。 bitsPerComponent が 8 のときに kCGImageAlphaNone を渡すと 1 Pixel あたり 3 バイト、 kCGImageAlphaNoneSkipLast を渡すと 1 Pixel あたり 4 バイト、 で計算した値を bytesPerRow に渡してやる必要がある。

posted by Face Saturn on Mon 21 Feb 2011 at 16:20

UIViewControllr は IB で nib の名前を指定しないと自動的にクラス名と同じ名前+'.nib' をロードするようだが、UITableViewController はこれをやらないので、nib から読むときは必ず nib 名を指定しなくてはいけない。

posted by Face Saturn on Mon 21 Feb 2011 at 05:20

長いこと Apache + passenger環境で奇妙な高負荷状態が続いていたため、 nginx + passengerに移行してみました。

nginxはreloadしてもコネクションが切れないのが素晴らしいですね。 unicornの-USR2/-QUIT 的な感じです。 設定ファイルも簡潔で良い感じです。

ということで、しばらく様子見です。

posted by Png genki on Sun 13 Feb 2011 at 23:53

まずはPostgreSQLをこの辺からDLしてインストールします。

インストール先のディレクトリはデフォルトでは /Library/PostgreSQL/9.0 になります。

pg gemをインストールするには、以下のようなコマンドを実行。

   1  % gem install pg -- --with-opt-dir=/Library/PostgreSQL/9.0

これでok

posted by Png genki on Thu 13 Jan 2011 at 21:52

の回避方法。

freetypeの最新バージョンをソースからインストールして、 .zshrcあたりに以下を設定

   1  export DYLD_LIBRARY_PATH=/usr/local/lib:$DYLD_LIBRARY_PATH

prefix=/usr/localを想定。

MacOSのバージョンアップが原因で発生するようになったらしい。

posted by Png genki on Wed 12 Jan 2011 at 17:47

The main reason of which I was felt in love with Merb is it uses same context for controller and view. By sharing same context, view_helpers and instance variables become simple. You just use them in controller then you can use them in view by same manner. But as you know, Rails3 doesn't.

The reason Rails3 doesn't is probably for caching. If the view has many outer variables that affects its result, the cache key tends to be very complicated. In the manner of Rails3, we can use both action caching and partial caching easily. Because the all variables used in view are clear and small.

But in these days, I am doubting the use of those caching. Now we don't use browsers that has no capability of JavaScript. In addition, Google treats Ajax pages for indexing well. Haven't you ever seen the URI that has '#!'? That's for it. So now, the most of pages can be provided as static html with dynamic JSON. They are combined by JavaScript. There's few situations that the action caching and the partial caching go well.

In conclusion, I think the context should be shared between view and controller so that we can use view helpers simply.

posted by Png genki on Wed 12 Jan 2011 at 09:07