Monthly Archives: April 2008

ImageShack 的 BitTorrent 下載服務

在 ImageShack Starts Free BitTorrent Download Service 這篇看到 ImageShack 開始提供 BitTorrent 下載服務了。 看了一下介面,把 torrent 檔傳上去後就會開始抓,另外一個比較特別的功能是選擇下載的檔案 (在 Windows 上的 BitTorrent 軟體還蠻常見的功能)。開 µTorrent 同時抓可以看出用的是 Transmission 1.10。目前服務在 beta,有兩個 15GB 的限制,一個是空間,一個是每個月的 HTTP 下載流量,在正式上線後可能會有修改。 丟了一個 torrent 上去測,下載到 ImageShack 的速度好像還蠻快的,不過我沒測完 :p

Posted in Computer, Murmuring, Network, P2P, WWW | 1 Comment

Zend_Json + Zend_Config + Zend_Db

如果使用 Zend_Json 放設定檔,這「可能」是一個比較好的解法: public function __construct() { $j = file_get_contents(dirname(__FILE__) . ‘/db.json’); $conf = Zend_Json::decode($j); $conf = new Zend_Config($conf['Db']); $this->rDb = Zend_Db::factory($conf->rDb); $this->wDb = Zend_Db::factory($conf->wDb); } 參考:Zend_Db 的參數 (與 Zend_Config、Zend_Json)。

Posted in Computer, Database, Murmuring, Network, Programming, Software, WWW | Leave a comment

重印四庫全書

在 mclee 那邊看到台灣商務印書館打算印全套的《四庫全書》:「商務印書館要印行文淵閣四庫全書了」。 整套一千五百本,預約價是 158 萬元。如果只要其中幾本,單冊的預約價是 $1200。除了新台幣外,也接受美金下訂。不過前提是要達到 20 套才會開始印…

Posted in Book, Murmuring, Recreation | Leave a comment

升級到 WordPress 2.5 的注意事項

剛剛幫別人升級時注意到的,wp-config.php 裡有一段註解是要你設定 SECRET_KEY,看起來是為了當作 private secret 用: // Change SECRET_KEY to a unique phrase. You won’t have to remember it later, // so make it long and complicated. You can visit https://www.grc.com/passwords.htm // to get a phrase generated for you, or … Continue reading

Posted in Blog, Computer, Murmuring, Network, Security, Software, WWW | 3 Comments

Zend_Db 的例外處理

照 Manual 所列出來的功能,Zend_Db 似乎沒有提供 INSERT … ON DUPLICATE KEY UPDATE 的功能,所以就得自己做了。 正常的作法是自己寫 SQL query 處理,但我想到的方法就是先 ->insert(),如果失敗再 ->update()。拆開來的這兩個動作會使得 MySQL 多花不少 CPU resource,但我暫時不想自己寫 SQL Query (主要是因為嫌 escape 麻煩),先放個 XXX 等以後再 tune。 問題在 ->insert() 後如果遇到 Duplicate 會丟出 Exception,用 try-catch 的方法我不是很喜歡,但稍微翻過 Zend_Db 的 code,似乎沒辦法改成 … Continue reading

Posted in Computer, Database, Murmuring, MySQL, Network, Software, WWW | 1 Comment

Zend_Db 的參數 (與 Zend_Config、Zend_Json)

Zend_Db::factory() 可以吃兩種語法,第一種是用兩個參數指定所有的資訊,像這樣: $params = array(‘host’ => ‘localhost’, ‘username’ => ‘my_username’, ‘password’ => ‘my_password’, ‘dbname’ => ‘my_database’); $db = Zend_Db::factory(‘pdo_mysql’, $params); 第二種是吃一個參數,Zend_Config (或者繼承他的 class): $conf = Zend_Config_Ini(‘filename.ini’); $db = Zend_Db::factory($conf); 如果想把資料庫設定放在檔案裡,再用 Zend_Config 讀進來傳給 Zend_Db,目前官方有 Zend_Config_Ini 與 Zend_Config_Xml 兩種方法,不過這兩種方法我都不喜歡,用 Google 找 “Zend_Config_Yaml”,沒有什麼人在研究這個 … Continue reading

Posted in Computer, Database, Murmuring, MySQL, Network, Programming, Software, WWW | Leave a comment

PIXNET Album Expander

除了幫無名小站寫以外,也幫自己公司 (PIXNET) 寫 Album Expander,這樣我自己看圖片才方便 XD 這隻程式請配合 Greasemonkey 服用:PIXNET Album Expander。 另外在 trace DOM 的時候有一些感想,照片的部份全部都是 ul + li,再用 CSS 做出來的,當初設計這個 Template 的人不賴啊 XD Update:修正了兩個問題,第一個是 Google Code 今天一直噴 502 而讀不到 jQuery,所以只好用 code.jquery.com。第二個是修正相本 .thumgBox 與 .thumbImg span 裡設定 width/height 時會產生的 bug。

Posted in Computer, CSS, Murmuring, Network, Programming, WWW | 8 Comments