This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/38

ふつうのHaskell写経会に行ってきました。サイトはこの辺でしょうか?

12〜14人ぐらい集まって、淡々とペア写経をしました。SICPと比べるとだいぶテンポが速そうですね。3章の始めぐらいまで進みました。

ghci

Prelude> :t length
length :: [a] -> Int

のようにすると出てくる型変数(type variable)の[a], [b], ...というのが26個以上ある場合は枯渇しないんだろうか(ものすごくどうでも良いことなのですが、なんだかとても気になったのです)、という素朴な疑問に遭遇したので、角谷さんと一緒にちょっと調べたりしていました。

しかしよく考えると、この[a]とか[b]というのは、関数の型宣言時に人間がつけた記号をそのまま返しているだけのようなので、そんな心配はするまでも無かったようです。例えば;

foo :: [bar] -> [baz] -> [qux]

というような宣言をされていれば、ghci:tをしたときにはそのまま出てくるだけなんですね。

This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/38

posted by Png genki on Tue 6 Jun 2006 at 22:18

This article was migrated from http://rails.office.drecom.jp/hibi/archive/15

永久って書き方がすごいですが。

アプリを動かしてると、

"Illegal mix of collations
(latin1_swedish_ci,IMPLICIT) and
(sjis_japanese_ci,COERCIBLE) for operation '='"

みたいなエラーが出て。文字コードはUTF8とswedishなんたらだったけど。
したら、take another stepさんが対決してはった。
http://dream.ie.ariake-nct.ac.jp/~naoyuki/archives/000041.php

つまり、サーバとクライアントのコードが違うということらしいです。
ふむ。

mysqlのリファレンスを調べる。したらコレ。
http://dev.mysql.com/doc/refman/5.0/en/charset-connection.html

SET NAMES 'x'

としたらいいらしい。
でもこれだとアプリで毎回しなくちゃいけないし。
大体rubyでどうするのかよくわからない。

そしたら!
先のmysqlのリファレンスのしたーーーのほうに
N Bernhardtさんがコメント。
--------------------------------------------------
Posted by N Bernhardt on August 17 2005 4:51pm

To change the connection charset permanently to UTF-8, add the following line in the [mysqld] section:
[mysqld]
init-connect='SET NAMES utf8'
--------------------------------------------------

で、/etc/mysql/my.cnfの[mysqld]のところにinit-…を追加しました。
show variables like 'character%';
show variables like 'collationr%';
してもやっぱり変数の値は変わってないですが、アプリを起動すると…
あら不思議!ちゃんと動きました!

(ただこれするとほかのアプリとかでUTF8にしたくないときも
UTF8になるので注意って書いてありました。なので注意です。)

とにかくやったーーー!
いやもうなんでも初心者で大変です。 http://rails.office.drecom.jp/hibi/archive/15

This article was migrated from http://rails.office.drecom.jp/hibi/archive/15

posted by Png satoko on Mon 5 Jun 2006 at 15:37

This article was migrated from http://rails.office.drecom.jp/hibi/archive/14

winのとよく似てます。

database.ymlのproductionのDB接続を編集

環境変数RAILS_ENVをセット。
export RAILS_ENV=production

script/aboutで確認
サービススタート!
lighttpd start -f lighttpd.myapp.conf -D

これでおっけー!
なんかあっけなかった。。。 http://rails.office.drecom.jp/hibi/archive/14

This article was migrated from http://rails.office.drecom.jp/hibi/archive/14

posted by Png satoko on Mon 5 Jun 2006 at 15:21

This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/37

RailTies(RailsのCore)への PATCH5003が採用されました。

ちょっと嬉しいです。

これによって、./script/generate pluginuninstall.rb が生成されるので、その中にプラグインのUninstallコードを書けるようになります。

例えば、install.rbでCSSとかJavaScriptとか画像ファイルをpublic/以下にコピーするプラグインなどで、./script/plugin remove時にそれらを取り除くようにする事ができます。

This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/37

posted by Png genki on Sun 4 Jun 2006 at 15:11

This article was migrated from http://rails.office.drecom.jp/hibi/archive/13

すごいタイトルだね、これ。

winでproductionを試そうとしていたら、新井さんがVMWareを教えてくれた。
DebianもDBもRubyもいっぱい入ってお得なvmxももらう♪
なのでwinでproductionは頓挫。

ででlighttpd入ってなさそうなので、入れてみることにする。
--------------------------------------------------
参考:
http://wota.jp/ac/?date=20051113#p04
http://d.hatena.ne.jp/secondlife/20050406/1112719612
http://d.hatena.ne.jp/moro/20060130/1138628101
http://www.kharakawa.com/kh.log/archives/2006/01/lighttpd_fastcgi_rails.html
--------------------------------------------------
■lighttpdインストール
くまくまさんのを参考に。
/etc/apt/source.listに下記を追加
deb http://debian.bougyman.com unstable main

# aptitude update
# aptitude update
# aptitude install lighttpd
なんか途中でインストールするかといってくるけど、Yでリターン

■lighttpd.conf
でで、secondlifeさんのを参考に。
lighttpd.rails.confを作って起動するが、
RailsFCGIHanderが見つからないみたいなエラーが出るので 汗汗。
どうやら、dispatch.fcgiでrequire 'fcgi_handler'ができてないみたい。
でやとこさ、FCGIをインストールしてないことに気づく。

■FastCGIをインストール
kh.logさんのを参考に。
先に追加したsource.listのhttp://debian.bougyman.comの行を削除して、
aptitude update
aptitude instal libfcgi-ruby libfcgi-ruby1.8
で、これもインストールするかって聞いてくるのでYでリターン。

ちなみに、そこで紹介されてたlighttpdのURLではinstallできなかった。。。なんでかな。
URLが有効でなさそう。その辺が素人には大変です。

■Lighttpd開始・停止
下記で起動してエラーが出てないかみます。Ctrl+Cでstopできるみたい。
lighttpd start -f lighttpd.rails.conf -D

-Dつけないときはkill -term PIDで停止。

で、早速アクセス!
動いたーーーー!!!

でも一部動いてない。。。なんでだ。winでは動いてたのに。
エラーも出てなさそう。

明日はとりあえずproductioinをやろう。修正はその後だにゃ。
--------------------------------------------------
PS secondlifeさんが書かれていた、

次にpublic/dispatch.fcgiの二行目あたりに、
RAILS_ROOT = ENV['RAILS_ROOT']
を追加して


というくだりがあるのですが、これはなんで必要なのかなぁ。。。
よくわからないにゃ。
どなたか教えてくださいませませ。 http://rails.office.drecom.jp/hibi/archive/13

This article was migrated from http://rails.office.drecom.jp/hibi/archive/13

posted by Png satoko on Sun 4 Jun 2006 at 03:47

This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/36

CentOSにEthnaを導入する手順をメモしておきます。

まず、CentOSにPHP5.1.4を導入します。 RPMを使う場合は「武蔵流プログラマへの道 - CentOSでPHP5のRPMを作ったよ。」が参考になりそうです。ソースから導入する場合は、僕が以前書いた記事も多少は参考になるかも。

PHPの導入が完了したら、こちらを参考に下記を実行します。

# pear install http://ethna.jp/pear/Ethna-2.1.0-preview1.tgz

次に、include_pathの通ったディレクトリに/usr/share/pear/Ethnaを移動します。

# cp -R /usr/share/pear/Ethna /usr/local/lib/php/Ethna

それから、いくつか依存ライブラリがあるので、無い場合は導入しましょう。

# pear install PEAR/DB
# pear channel-discover pearified.com
# pear install pearified/Smarty

これで完了です。非常に簡単ですね。

This article was migrated from http://rails.office.drecom.jp/takiuchi/archive/36

posted by Png genki on Thu 1 Jun 2006 at 18:09

This article was migrated from http://rails.office.drecom.jp/hibi/archive/12

公開するのはUNIX系だろうけど、自分の環境はwinなので。
とりあえずwinでproductionにしてみる。
bestな方法ではないので、その辺ご了承くださいませ。

まずは、コレを見てみる。


P462を見る。
各Webサーバによってproductionの指定が違うみたい。
お手軽にWEBrickでやるとき。コマンドプロンプトで。

C:\Program Files\ruby\rails_apps\your_app>set rails_env=production
C:\Program Files\ruby\rails_apps\your_app>ruby script\server --environment=production

としたらおっけー!
へぇ、まじで!簡単だ。
あ、もちろん、database.ymlでproductionのDBを設定しとくの忘れないでね。

で、productionにしたらscript\aboutコマンドで本当にproductionになっているか確認しとくといいかも。下記は前の記事のとコピペしてます。

C:\Program Files\ruby\rails_apps\your_app>ruby script\about
About your application's environment
Ruby version 1.8.2 (i386-mswin32)
RubyGems version 0.8.10
Rails version 1.1.2
Active Record version 1.14.2
Action Pack version 1.12.1
Action Web Service version 1.1.2
Action Mailer version 1.2.1
Active Support version 1.3.1
Edge Rails revision 4393
Application root C:/Program Files/ruby/rails_apps/your_app
Environment production
Database adapter mysql
Database schema version 2

本当にproduction環境にするにはWebサーバとかDBとかAPPサーバとかその辺の設定をチューニングする必要ありだろうけど、その辺はほかの人においておいちゃおう。
http://rails.office.drecom.jp/hibi/archive/12

This article was migrated from http://rails.office.drecom.jp/hibi/archive/12

posted by Png satoko on Thu 1 Jun 2006 at 15:32

This article was migrated from http://rails.office.drecom.jp/hibi/archive/11

前の記事の挑戦の確認。
こんな感じでEdgeで動いてるのが確認できるみたいです。

C:\Program Files\ruby\rails_apps\your_app>ruby script\about
About your application's environment
Ruby version 1.8.2 (i386-mswin32)
RubyGems version 0.8.10
Rails version 1.1.2
Active Record version 1.14.2
Action Pack version 1.12.1
Action Web Service version 1.1.2
Action Mailer version 1.2.1
Active Support version 1.3.1
Edge Rails revision 4393
Application root C:/Program Files/ruby/rails_apps/your_app
Environment production
Database adapter mysql
Database schema version 2 http://rails.office.drecom.jp/hibi/archive/11

This article was migrated from http://rails.office.drecom.jp/hibi/archive/11

posted by Png satoko on Thu 1 Jun 2006 at 15:22
Contents
ふつうのHaskell写経会レポート
MYSQLへの接続を永久UTF8化:Illegal mix of collations 
今度はDebianでproduction 
RailsプラグインでUninstallコードが書けるようになりました
Debian@VMWare Player+Lighttpd+FastCGI+Rails 
CentOSでEthnaを使う
winでproduction環境にする 
EdgeRailsのバージョン確認 
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
ブログに数式を埋め込める数式コミュニティ