You can get it by installing wl-pprint package.

   1  # cabal install wl-pprint

See Also

posted by Png takiuchi on Mon 8 Jun 2009 at 04:09

Now I am using Haskel and investigating its package system. I found that I can display the list of packages already installed in the environment by typing the command as follows.

   1  ghc-pkg list

And then I want to prepare cabal-install. The tool might be found here

I had got it and extracted it. After that, I could build the module by this command.

   1  runhaskell Setup.hs configure

At this point, I got error messages like this:

   1  Setup.hs: At least the following dependencies are missing:
   2      Cabal >=1.6&&<1.7,
   3      network >=1&&<3,
   4      HTTP >=4000.0.2&&<4001,
   5      zlib >=0.4&&<0.6

It means I must get them in advance from the HackageDB.

After I got downloaded them all, I must do just runhaskell repeatedly. It's a simple job.

   1  runhaskell Setup.hs configure
   2  runhaskell Setup.hs build
   3  runhaskell Setup.hs install

If you are a Rubyist, you probably find the similarity between the command above and the usage of setup.rb. Do you know which is the chicken or the egg? :-)

About 30 minutes went by...

Finally, I got the cabal command.

See Also

posted by Png takiuchi on Mon 8 Jun 2009 at 03:56

The edge version of do_postgres with JRuby causes misterious error like this.

   1   ~ (1) SELECT "id", "digest", "fetched_at", "created_at", "site_id" FROM "pages" WHERE ("site_id" IN (1)) ORDER BY "id"
   2   ~ ERROR: syntax error at or near "("merb : worker (port 4000) ~ ERROR: syntax error at or near "(" - (PostgresError)

The SQL that had been performed is here.

   1  SELECT "id", "digest", "fetched_at", "created_at", "site_id" FROM "pages" WHERE ("site_id" IN (1)) ORDER BY "id"

This is able to be performed successfully at the psql console. So I wonder what the error message means.

Updates

I found the bug.

For example, this code

   1  Page.repository.adapter.execute('SELECT * FROM "pages" WHERE ("id" IN ?) AND ("site_id" = ?)', [1], nil)

generates this sql

   1  SELECT * FROM "pages" WHERE ("id" IN (1)) AND ("site_id" = (NULL))

(NULL) causes parsing error.

This issue happens if the first value is an Array and the succeeding values are not Arrays.

posted by Png takiuchi on Sun 7 Jun 2009 at 20:12

I am very surprised to hear this.

Needless to say, Eric Veach is a guru of GI researcher. I have wondered where he vanished after his great doctor thesis. And now I know he was at Google, and used his speciality of probability statistics for the AdWords.

I've been believing that GI problem has very rich context. It can be used as the best tool to think algorithms.

posted by Png takiuchi on Sat 6 Jun 2009 at 21:12

RubyGemsを使うときに、たびたびGemのバージョンを指定する機会があります。 '=', '>=', '>' などの等号、不等号は、対応するRubyのオペレータと同じような機能なのでわかりやすいのですが、'~>'についてはどういう意味なのか若干わかりにくい感じです。一応マニュアルにはこんな感じに書かれています。

  • = Equals version
  • != Not equal to version
  • > Greater than version
  • < Less than version
  • >= Greater than or equal to
  • <= Less than or equal to
  • ~> Approximately greater than (see "Pessimistic Version Constraint" below)

'~>' は、悲観的(pessimistic)なバージョン指定です。 例えば、'~> 1.2.0' は、'1.2.0', '1.2.1.1' などにはマッチしますが、 '1.3'にはマッチしません。 最後の数字の桁だけがGrater than or equal toで、それ以外は厳密一致のようです。

posted by Png genki on Sat 6 Jun 2009 at 02:04

UIImageJPEGRepresentationのcompressionQualityを0.0にするとどれくらい圧縮されるかのテスト:

  • 3.3MBのファイル => 804KB
  • 1.5MB(1600x1200) => 116KB

ファイルによって違うでしょうが参考までに。 下記にテストに使ったファイルを挙げておきます。

3Mの画像ファイル

オリジナルのサイズ:5354x3570、3.3MB
joi_3m_small.jpg
photo by Joi

iPhoneで取った1600x1200のファイル

1600x1200、1.5MB
1200x1600.jpg

posted by Png satoko on Fri 5 Jun 2009 at 06:31

なんか忘れて探したのでメモ:

   1  /Users/satoko/Library/Application Support/iPhone Simulator/User/Media/DCIM/100APPLE

posted by Png satoko on Fri 5 Jun 2009 at 04:25

小ネタです:Passengerのステータス確認

   1  passenger-status
   2  ----------- General information -----------
   3  max      = 6
   4  count    = 6
   5  active   = 4
   6  inactive = 2
   7  Waiting on global queue: 43
global gueueが43もあるのは異常で、こういう場合はapacheをrestartする。

上記の他にBacktracesやDomainsなどの情報を表示してくれます。

passenger-statusコマンド

http://www.modrails.com/documentation/Users%20guide.html

posted by Png satoko on Thu 4 Jun 2009 at 02:49

ばらばらとですが、メモ。

key, pemの作成

key(プライベート), 暗号化を解除したkey, pem(署名要求書CSR)を作成

http://postfix.robata.org/tls-set.html

pem作成時、参考になった値:

Common Name ウェブサーバのFQDNです
Email Addres 入力不要です。 -
A challenge password 入力不要です。 -
An optional company name 入力不要です。
http://jp.globalsign.com/support/index.php?sid=757&lang=ja&action=artikel&cat=21&id=201&artlang=ja

pemファイルの内容確認

作成した証明書は以下のコマンドで内容の確認ができます。

   1  openssl x509 -in cacert.pem -text
http://openssl.robata.org/

証明書のマージ

ただ単にkeyファイルに、送られて来た証明書ファイルの内容をprependするだけらしい(確かに発行しているコマンドは二つのファイルをcatして一個にしてるだけだ)

CAからサーバ証明書が送り返されてきたなら、必要に応じてプライベートキーとマージしてしてください。
(WebサーバやメールのTLS化では、プライベートキーとマージが必要です)
このときマージするキーはパスフェーズを解除したキーを利用してください。
http://postfix.robata.org/tls-set.html

証明書を再発行するときのTips

元の証明書(pem)を上のコマンドで確認し、Subject部分を再発行時に使うとよいかも:

   1  Subject: O=s21g LLC...

Organization Name => O
Organizational Unit Name => OU
Common Name => CN

ちなみにkey作成時、suコマンドができなくて困っていたら、下記を教えてもらいました:

   1  sudo su

posted by Png satoko on Thu 4 Jun 2009 at 02:19

MySQLのbackupデータの復旧の際、掲題のエラーが発生したので、 対処法をメモしておきます。

このエラーに関する詳しい情報は以下のサイトにまとまっています。

とくに後者では、

段階 4: 非常に困難な修復

などと脅かされるのですが、my.cnfでInnoDB関係の設定が抜けている場合にも同じエラーがでるようです。その場合はInnoDBの設定を書き足せばなおります。

posted by Png genki on Tue 2 Jun 2009 at 08:51