• 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

まずは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

Postgresを使っている場合、新規にユーザを作成する場合には、ユーザ作成時にDB作成権限の付与の設定を行えるのですが、 あとからこれを変更する方法がわからなかったのでメモ。

   1  # update pg_authid set rolcreatedb = true where rolname = 'username';

こんな感じでokのようです。

権限周りのSQLはRDBMSごとにまちまちで統一されてないあたりが、素のSQLが敬遠されてORマッパーが隆盛する原因かもしれないですね。

posted by Png genki on Wed 5 Jan 2011 at 19:36

I added a new feature to irb_rocket. It's a simple utility for ease of daily irb use. Have you ever felt annoying for typing left cursor to enclose exprs by parens to be receiver like this?

   1  irb> 1 + 2 + 3  # Oh, I want to call "to_s"
   2  irb> (1 + 2 + 3 # back to the head
   3  irb> (1 + 2 + 3).to_s # return to the tail

I've experienced stuffs like this very often. Very annoying.

So I added the new feature named "irb_dollar" Its usage is simple, like this.

   1  irb> require "irb_dollar"
   2  irb> 1 + 2 + 3 $ to_s #=> "6"

Nice!

You can use "$" sign to make the left hand statement be receiver by installing irb_rocket version that is newer than 0.2.0

Enjoy :)

Links

posted by Png genki on Mon 3 Jan 2011 at 19:18