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

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

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'
);

2009/11/29

PHP / MySQL 一些容易被忽略的 Optimization

Filed under: Programming/php — 7:54 pm

URL : http://www.dublish.com/articles/10.html

  • Use NOT NULL as default value as much as you can, it speeds up execution and saves one bit.
  • 一個 <? … ?> 比多個 <? .. ?><? .. ?><? .. ?> 還快
  • 少用 . 去串接字串, 改用這樣的較快 “select addr,name from tbl_addr where id=$id
  • 或者用 ‘ “ 區分出 需要 PHP 不解譯/解譯的字串
  • echo 比 print 快
  • 在 loop 前就把終值先算好, 放變數裡,NG: for($i=0; $i<strlen($str); $i++) ….

2009/11/17

[php] regular expression match

Filed under: Programming/php — Tags: — 4:05 pm
preg_match( '/c=([0-9]+)/' , $t->log['dest_query'] , $data);
這樣可以取出 c=xxxx

抓 user agent 版本

preg_match( '/MSIE ([0-9]+.[0-9])/' , $_SERVER['HTTP_USER_AGENT'] , $data_msie_ver);
preg_match( '/Windows NT ([0-9]+.[0-9])/' , $_SERVER['HTTP_USER_AGENT'] , $data_nt_ver);
  if ( !( (float)$data_msie_ver[1]>=6 && (float)$data_msie_ver[1]<=8 ) ) $valid_useragent = 0;

2009/11/06

一些 memcache 的資料

http://code.google.com/p/memcached-tag/

http://blog.developers.api.sina.com.cn/?tag=php-memcached

http://code.google.com/p/dbcached/

http://tech.ddvip.com/2008-10/122405777578200.html

http://hi.baidu.com/jrckkyy/blog/item/cb68141e8afa621740341771.html

2009/09/08

Protected: [收藏好文] 網站背後技術與技巧

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


2009/09/02

ubuntu 裝 oracle instant client / sqlplus / oci8 / apache2 config / steps by steps

Filed under: DATABASE, Programming/php, Software, System/Linux/Unix* — Tags: , , , , — 2:50 pm

Ubuntu 安裝 RPM 要用 alien …
sudo apt-get install alien

Ref. https://help.ubuntu.com/community/HowToBuildToraWithOracle

先去 http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/linuxsoft.html

download 這幾個 files (rpm)

Instant Client Package – Basic Lite
oracle-instantclient11.1-basiclite-11.1.0.7.0-1.i386.rpm

Instant Client Package – SQL*Plus
oracle-instantclient11.1-sqlplus-11.1.0.7.0-1.i386.rpm

Instant Client Package – SDK
oracle-instantclient11.1-devel-11.1.0.7.0-1.i386.rpm

下 alien 指令安裝 rpm

alien -i oracle-instantclient11.1-basiclite-11.1.0.7.0-1.i386.rpm
alien -i oracle-instantclient11.1-sqlplus-11.1.0.7.0-1.i386.rpm
alien -i oracle-instantclient11.1-devel-11.1.0.7.0-1.i386.rpm

裝好後用 sqlplus 聯看看 , 因為我得到一個 lib error

所以我要裝 apt-get install libaio1

然後

apt-get install php5

apt-get install php5-dev

因為 oci8 是由 pecl 來安裝的, 所以要 apt-get install php-pear

再來裝 oci8 : pecl install oci8

在 /etc/php5/conf.d 下建一個 oci8.ini 檔 , cat > /etc/php5/conf.d/oci8.ini 內容是

extension=oci8.so

重新啟動 apache2 :

service apache2 restart

看看 phpinfo 有沒有出現 oci8 等字樣就 ok 了

53420fcc8f6596bc2b6cd3511eae7d84 
cebcda336140c38e51b889ec7f9319c3

加一個 virtual host :

在 /etc/apache2/sites-enabled 增加一個 xxx.conf 檔

CodeIgniter 需要用 rewrite module :

ls -sf /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled

2009/08/20

編程最佳的字型 consolas / notepad++ 及 winscp 設定 / Best programming fonts

http://www.sitepoint.com/blogs/2009/05/01/top-10-programming-fonts/

173dd6cf51cee56ee41c03a4eea53d43 5f51869c4d702101b28643d2ce7ee81f eb97be5da4e6ee5ee99f97467c5b3187

2009/08/07

Protected: Oracle down time / problem records / 經典

Filed under: DATABASE, JOB, Programming/php, System/Linux/Unix* — Tags: , , , — 11:49 am

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


下頁»

www.monster.com.tw , © Copyright 2008