把 wordpress blog 立即變成 mobile friendly 的套件
阿毛介紹的: http://mobilepress.co.za/
裝好後它會偵測 user 的 user agent 若是 mobile 就會把頁面換成 ‘手機’ 版.
阿毛介紹的: http://mobilepress.co.za/
裝好後它會偵測 user 的 user agent 若是 mobile 就會把頁面換成 ‘手機’ 版.
Open flash chart 有這樣的 數值 data 在線上
可是要怎樣 google chart 才會有呢?
google chart: http://code.google.com/intl/zh-TW/apis/chart/docs/chart_params.html
感謝 Hunter 提供解答 ^_^
hunter 說:
新版是有標示,看看是不是你要的:
http://chart.apis.google.com/chart?cht=bvg&chs=250×150&chd=t:20,66,40,55,20,90&chxt=x,y&chxs=0,000000,12,0,lt|1,000000,10,1,lt&chm=o,ff0000,0,,3|o,ff0000,0,,3,,c|o,ff0000,0,,3,,s|N,000000,0,0,10,,rs|N,000000,0,1,10,,ls|N,000000,0,2,10,,c|N,000000,0,3,10,,e|N,000000,0,4,10,,e::15|N,000000,0,5,10,,e::-12
Rimmon 2.0 說:
YES , 這樣就夠了
hunter 說:
http://code.google.com/intl/zh-TW/apis/chart/docs/chart_params.html#gcharts_data_point_labels
function timeFunc($function, $runs) {
$times = array();
for ($i = 0; $i < $runs; $i++) {
$time = microtime();
call_user_func($function);
$times[$i] = microtime() - $time;
}
return array_sum($times) / $runs;
}
function Method1() {
$foo = 'some words';
for ($i = 0; $i < 10000; $i++)
$t = "these are $foo";
}
function Method2() {
$foo = 'some words';
for ($i = 0; $i < 10000; $i++)
$t = "these are {$foo}";
}
function Method3() {
$foo = 'some words';
for ($i = 0; $i < 10000; $i++)
$t = sprintf("these are %s", $foo);
}
function Method4() {
$foo = 'some words';
for ($i = 0; $i < 10000; $i++)
$t = "these are " . $foo;
}
function Method5() {
$foo = 'some words';
for ($i = 0; $i < 10000; $i++)
$t = 'these are ' . $foo;
}
print timeFunc('Method1', 10) . "\n";
print timeFunc('Method2', 10) . "\n";
print timeFunc('Method3', 10) . "\n";
print timeFunc('Method4', 10) . "\n";
print timeFunc('Method5', 10) . "\n";
RESULT:
0.0023114
0.002422
0.0072015
0.001946
0.0017625
但是這是 loop 10萬次才有一點點的差距.
結論是 method5(單 quote + concate string) 速度較佳! method3 (sprintf) 最慘!
inline 寫法有兩種, 這兩種都差不多, 所以就 codeing 時的手順上, 以 $foo 這種是比較好寫這也是多數人的寫法 , {$foo} 這種比較好閱讀.
若是在需求上需要加上換行的話, 在一個 strings 中用 inline 寫法把 \n 放在 quote 中, 這種速度卻又比 concate string 寫法來得快.
ps: 速度比較這種題目很多人都會陷入某種迷失, 每個人的環境/需求都不盡相同, 並不是最快的就是適合自己的.
這些微差異要在大量的 loop 中才會有一些差別, 不過還是寫 code 時一次寫好吧 —> 給我自己的提醒!
答案是 isset 比較快!
ref. URL: http://www.alternateinterior.com/2006/11/comparing-array_key_exists-with-isset.html
相關資訊: A HOWTO on Optimizing PHP
http://phplens.com/lens/php-book/optimizing-debugging-php.php
Tuning Apache and PHP for Speed on Unix
http://phplens.com/phpeverywhere/tuning-apache-php
這個 idea 是來自這個網站 : https://privnote.com/ , 簡單的說它是一個經由 https 保護傳送內容的網路服務 , user 用這個服務把臨時要給朋友的機密/私人資料譬如 password / URL 之類的 data 存放在這網站上, 然後此系統會給 user 一個唯一網址, 再把這網址給朋友, 開啟這個唯一網址後, 就可以看到這個訊息, 系統同時會把這訊息從系統中刪除… 哈哈! 看懂了嗎?
我的改進是用 memcache 的 expire 機制, 設定 10分鐘後, 若 user 沒讀過此訊息, 訊息會 ‘自動’ 銷毀… 我的站若再去申請 ssl 加密的話就跟那個站功能是類似的了.
codeigniter 的 MVC 架構, 讓我很快的把這個 idea implement 出來了 , 基本上就是一個簡單版的 CRUD
我的 Secret Message 服務長像非常的陽春
, 僅用簡單的 HTML , 若有空再加上 style 美化一下版面, 不過基本功能是有的了, 大家用看看, 有 idea 或意見請再告訴我.
目前 message 不提供 HTML / VBB , 但是有簡單的 skype 版表情符號 ( icon 正在慢慢搜集中 ) ….
Secret Message 網址是: http://msg.monster.com.tw/
CI 表情符號改寫例:



這個可以用來做 tracking 輸出用
header("Content-Type: image/gif");
header("Content-Length: 49");
echo pack('H*',
'47494638396101000100910000000000ffffffff'
.'ffff00000021f90405140002002c000000000100'
.'01000002025401003b'
);
www.monster.com.tw , © Copyright 2008