2009年3月13日 星期五

page cache, sweeper

Scaling Rails - 第二章 Page Caching
Scaling Rails - 第三章 Cache Expiration
Ruby on Rails Caching Tutorial

要注意的地方:
Sweeper 不僅可以 Observes the Controller 更可以 Observes Models。!!
sweeper 可以使用任何 ActiveRecord 的 callbacks 。
還可以用 controller callbacks,更還可以細到 action level。
ex:
after_posts
before_posts_index

如果觀察物件的object 被觸發了, 但當前的action 並沒有被sweeper 監視, 則呼叫exprie 的function就不會叫了



cache my pagination pages?



Playing nice with Apache/Lighttpd
Clearing out a partial/whole cache

Character entity

wiki Character_entity_reference
HTML character entity

apache: install mod_expire and use

如何向已經安裝好的apache添加一個模塊
使用mod_expires模組來加速網頁瀏覽
Apache Module mod_expires

1. download the apache source
http://httpd.apache.org/download.cgi

2. compile source

3. edit http.conf
LoadModule expires_module modules/mod_expires.so

and

2009年3月12日 星期四

ubuntu 8.10 遇到的問題

1. 因為gcin 造成的一直閃的問題,
我就換成scim了
im-switch -s scim

2. flash 方塊字
將/etc/fonts/conf.avail/49-sansserif.conf
這個檔案刪除即可。

3. opera 和 scim 衝突
sudo apt-get install scim-qtimm
sudo gedit /usr/bin/opera
在第二行添加 export export QT_IM_MODULE=SCIM ,保存後重啟 opera

4.virtualbox 的鳥問題
直接重灌到2.1.0了
http://www.virtualbox.org/wiki/Linux_Downloads

2009年3月11日 星期三

ActiveRecord memo(3)

1. Observer


2. validate 錯誤時, 可以

2009年3月10日 星期二

ActiveRecord memo(2)

1. 18.1 p379


2. 18.3 p384

3. dependent


4 18.3 p389, :finder_sql, and order


5. 18.3 p391 has_many 的一些method, <<, push, replace, clear, uniq(好像拿掉了)

6. 去除重覆的部份
sql distinct


7. has_many, extend

2009年3月5日 星期四

backup restore database

backup up database in hostrails


MySQL編碼由 latin1 轉 utf8
把 dump 出來的 database.sql 下載回去 .. 用 emEditor(網路上可免費下載,是個支援 utf-8 的編輯器)把 database.sql 打開,

它可以正常識別 utf8 的文字 ..用取代的功能,把 latin1 都取代成 utf8 ,之後直接另存新檔 .. 這時把檔案類型設定儲存成 UTF-8

最後
mysql -uUsername -pDbpassword iwakela_production < earlybirds.sql