Monster Oasis
覺得累就是進步的開始!

2010/09/03

把 wordpress blog 立即變成 mobile friendly 的套件

Filed under: Article or News,Programming/php,Software — Tags: — 11:50 am

阿毛介紹的: http://mobilepress.co.za/

裝好後它會偵測 user 的 user agent 若是 mobile 就會把頁面換成 ‘手機’ 版.

Related URL:
  1. wordpress 的 schema
  2. 裝了一個訪客計數器 ( Visitors Tracking & Statistics Tool ) ( blog / wordpress )
  3. 裝了 SyntaxHighlighter Plus , 程式碼可以看清楚了

2010/06/24

Protected: Web Design Blog, Tutorials and Inspiration

Filed under: Copy_N_Paste,Programming/php,Software — Tags: — 5:41 pm

This post is password protected. To view it please enter your password below:


Related URL:
  1. 50 好看好用的 icon

2010/06/18

Question: google chart api

Filed under: Programming/php — Tags: — 5:34 pm

Open flash chart 有這樣的 數值 data 在線上

2擷取

可是要怎樣 google chart 才會有呢?

1擷取

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

Related URL:
  1. PChome 超越 雅虎奇摩 , 成為臺灣第一大入口網站 – Google公布全球網站Top1000,台灣9站入榜
  2. Google 提供 Public 的 DNS , IP 是 8.8.8.8 帥氣又好記!
  3. 換了 XMAS 版型 , 忘記加 google analytics 的偵測碼 …. merry christmas!!
  4. ADSL / DDWRT 動態 IP 用 DynDNS 設定 DNS 及 Google Apps
  5. Protected: [摘] 垂直搜尋引擎
  6. Protected: [摘] Google 的十大信條 — 有時我會忘記東西, 也怕有用的資訊不見, 所以看到就順手留下來了(不公開).
  7. Protected: [不公開] 神秘的 google server 照片
  8. Google 的 server 照片 , data center ,
  9. 北橫獨騎 , 板橋 –> 三民 –> 羅浮 –> 巴陵 –> 明池 –> 員山 –> 宜蘭
  10. 網站贊助廣告版位出租 – Pagerank 5 / 10 , SEO

2010/06/04

Protected: [sample code] preg_match , regular expression match ,

Filed under: Copy_N_Paste,Programming/php — Tags: — 9:24 am

This post is password protected. To view it please enter your password below:


Related URL:
  1. debian / ubuntu 裝 memcached 跟 pecl memcache
  2. 一些 memcache 的資料
  3. debian / ubuntu 裝 oracle instant client / sqlplus / oci8 / apache2 config / steps by steps
  4. gentoo emerge php options
  5. PHP Coding Standards
  6. 用 pecl inclued 產生關聯圖
  7. oci / compile php with oracle instant client
  8. [note] javascript 的 foreach / split / php explode style 寫法
  9. Codeigniter 聯接 Oracle database 要改的地方
  10. install oracle instant client basic on gentoo linux step by step

2010/04/27

[php] inline string vs 兜字串的寫法 速度比較 / 測試 sample code

Filed under: Copy_N_Paste,Programming/php — Tags: , — 10:32 am
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: 速度比較這種題目很多人都會陷入某種迷失, 每個人的環境/需求都不盡相同, 並不是最快的就是適合自己的.

2010/04/26

Protected: [ruten] code 陷阱 / 地雷

Filed under: JOB,Programming/php — Tags: — 10:55 am

This post is password protected. To view it please enter your password below:


Related URL:
  1. ebay token usage
  2. Protected: oracle 的一些 SOP command
  3. INTEL vs Transcend SSD little PK (LAB )
  4. 2010.0621 露天業績爆量! 7-11免運取貨活動
  5. Maximum Availability Architecture – Oracle Streams Configuration Best Practices
  6. Protected: [memo] Streams process
  7. Protected: oracle standby SOP
  8. Protected: sample quotation for server
  9. Protected: dbs222 mysql innodb Troubleshutting
  10. Protected: ..刊登費…

2010/03/31

[php] array_key_exists vs isset 那一個比較快?

Filed under: Programming/php — Tags: — 12:56 pm

這些微差異要在大量的 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

Related URL:
  1. [php] regular expression match
  2. USE Oracle / oci8 with PHP
  3. 範例程式 jQuery /JSON / PHP /json_encode / json_decode sample code
  4. PHP 小筆記
  5. opensolaris / Optimized Open Source Software Stack (Cool Stack)
  6. memcache sample code
  7. Protected: Senna for mysql install 安裝說明

2010/01/23

50 個超好用的 PHP 工具 – 50 Extremely Useful PHP Tools

Filed under: JOB,Programming/php — 10:04 pm

http://www.smashingmagazine.com/2009/01/20/50-extremely-useful-php-tools/

2009/12/21

CodeIgniter MVC CRUD + memcache = Secret Message http://msg.monster.com.tw

這個 idea 是來自這個網站 : https://privnote.com/ , 簡單的說它是一個經由 https 保護傳送內容的網路服務 , user 用這個服務把臨時要給朋友的機密/私人資料譬如 password / URL 之類的 data 存放在這網站上, 然後此系統會給 user 一個唯一網址, 再把這網址給朋友, 開啟這個唯一網址後, 就可以看到這個訊息, 系統同時會把這訊息從系統中刪除… 哈哈! 看懂了嗎?

我的改進是用 memcache 的 expire 機制, 設定 10分鐘後, 若 user 沒讀過此訊息, 訊息會 ‘自動’ 銷毀… 我的站若再去申請 ssl 加密的話就跟那個站功能是類似的了.

codeigniter 的 MVC 架構, 讓我很快的把這個 idea implement 出來了 , 基本上就是一個簡單版的 CRUD

我的 Secret Message 服務長像非常的陽春 :P , 僅用簡單的 HTML , 若有空再加上 style 美化一下版面, 不過基本功能是有的了, 大家用看看, 有 idea 或意見請再告訴我.

目前 message 不提供 HTML / VBB , 但是有簡單的 skype 版表情符號 ( icon 正在慢慢搜集中 ) ….

Secret Message 網址是: http://msg.monster.com.tw/

 

dc34889242b1d25e1f4c4d477e85c96c

4185a388c19629704edc284514c6cfe5

CI 表情符號改寫例:

0fe1a40bfd47887c51ed60fc2af4a3a0

3a21610697fc7f7b5983a1358a9f7713d5617ad16b86596c9c44642a08193875

Related URL:
  1. 用 pecl inclued 產生關聯圖
  2. oci / compile php with oracle instant client
  3. codeigniter / ci / oracle database.php 的設定方式 / utf8 / big5 粉難搞
  4. another high performance PHP framework – Yii
  5. codeigniter CRUD sample
  6. Protected: 一些 codeigniter 的 link
  7. codeigniter 已經很方便了 , 還有 based on 它的 “套件”
  8. 這段 code 可以抓出 php / codeigniter 定義過的 class
  9. Codeigniter 聯接 Oracle database 要改的地方
  10. 設定 .htaccess 讓 網址比較短

2009/12/12

用 php code 產生 1×1 pixel 的 小黑點 sample code

Filed under: Copy_N_Paste,Programming/php — 10:20 pm

這個可以用來做 tracking 輸出用

header("Content-Type: image/gif");
header("Content-Length: 49");
echo pack('H*',
  '47494638396101000100910000000000ffffffff'
 .'ffff00000021f90405140002002c000000000100'
 .'01000002025401003b'
);
下頁»

www.monster.com.tw , © Copyright 2008