• 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
 
 

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

おととい見つけました。
前確かベータだったよね。多分。
しかもmassageうけてました、彼ら。
ガンマからどんな成長をとげるのか、楽しみです。

http://rails.office.drecom.jp/hibi/archive/16

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

posted by Png satoko on Sat 10 Jun 2006 at 01:20

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/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/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

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

HATENA-TUBEではRSSでcronぽぃことやっているという話ですが、
(脱帽!発想の転換って大事ですね)
http://fladdict.net/blog/2006/05/hatenatube.html

私は普通にcronに挑戦します。
というかcronも初めてなのねぇ

で調べたら下記に。
へー。らっきー!
http://sb.xrea.com/archive/index.php/t-8618.html

renderはいらないので、下記。
render :nothing => true http://rails.office.drecom.jp/hibi/archive/10

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

posted by Png satoko on Thu 25 May 2006 at 14:11

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

EdgeRailsとはRailsの最新の開発版の事らしい。
一方でGemRailsとは、通常使っている安定したRails。へぇ。
http://wiki.rubyonrails.org/rails/pages/EdgeRails
http://blog.masuidrive.jp/articles/2006/03/19/EdgeRails

で、下記に書いてあるのをやってみることにする。
くまくまーさんのも見たのだけど、win環境なのでできず。残念。symlinkあたらいいのにな。
http://wiki.rubyonrails.org/rails/pages/EdgeRails
http://wota.jp/ac/?date=20060224#p03

rake freeze_edge

とすると最新のrailsを your_app/vendorの下に落としてくれます
で、バージョンも指定できるのだけど、

rake freeze_edge REVISION=1234 #NG うまく動かない

とか適当にするとvendorディレクトリが中途半端にできてしまって後困ります。
vendorディレクトリを一度削除したらいいみたい。
なので、revisionを指定するのは注意してください。

で、普通にアプリケーションを実行したOKみたいです。多分。

追記:edgeRailsからgemRailsに戻す場合は下記。
rake unfreeze_rails http://rails.office.drecom.jp/hibi/archive/9

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

posted by Png satoko on Thu 25 May 2006 at 13:33

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

最近JavaJavaなのでRailsできません。
すみません。


でで音楽でストレス解消〜


Pandoraで音楽聴いて、いいのがあったらそっからUSのiTunesにジャンプ!
Pandoraで時々好きな曲が流れてくるのもいいけど、iTunesで常時好きな音楽が流れてるのもいいです。
テンション上がります♪
といっても10曲も買っていないけどね。
ごついヘッドフォンで音楽聴きながら仕事ができる会社サイコーです♪

------------------------------------------------------------
iTunes、米国/アメリカから音楽を買う
http://kyotosanga.com/satoko/archives/2006/02/itunes.html http://rails.office.drecom.jp/hibi/archive/8

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

posted by Png satoko on Fri 12 May 2006 at 00:14

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

今日勉強したこと。
paginateはそうなんですけど、下記みたいな感じで値をHashに代入して呼び出せます。
こうすると、引数の順とか心配しなくていいのでいいな。
paginate(:entries => @entries, :per_page => 10)
でで、関数の引数としてHashを使いたいときは
関数側:
def fugafuga(params)
 person = Person.find_by_name_and_sex(params[:name], params[:sex])
end
呼び出し元側:
fugafuga(:name => 'hibi', :sex => 'female')
こんな感じでいいらしい。適当に書いたらできた。
へぇ〜。
http://rails.office.drecom.jp/hibi/archive/7

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

posted by Png satoko on Thu 4 May 2006 at 02:03