Wednesday, April 29, 2009

PHP - How to prevent/disable caching by proxy server

Add the following code into the very top of your php script.


header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s", time() + 300) . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");


Hope this help :)

Monday, April 27, 2009

How to Stop Skype using Port 80, IIS, Apache Web server cannot start

Hey! My IIS, Apache Web server cannot start, port 80 used by some other application..
I believe many of you might face the problem where Port 80 being used, while trying to
1) Run IIS
2) Run Apache
or
3) Xampp installation - for Xampp user, you can try to run xampp-portcheck.exe to check what application is utilising the port 80.

One of the main reason is due to the Skype utilising the port 80 as its communication channel.
So, let's stop it from using this port
Here the steps to stop Skype from using port 80.
Steps:
1) Open skype, follow the following instructions
2) Goto menu tools==> options ==> connections
3) uncheck the "use port 80 & 433" and save it.

If you don't have Skype installed, the try following steps to indentify what application is using your port 80
1) click "Start"
2) select "Run"
3) type "cmd" to open the console
4) type command
-----"netstat -n -a" for Windows 2000 users, you will be able to check whether your port 80 is being used or not.
-----"netstat -o" for Windows XP and above users, with "-o", it will show the process id - PID, and based on the pid, you will be able to identify what exactly the application is running on your port 80.

Beside, Windows firewall might be the other reason that blocking your port 80. Try to turn it off if you have not other way to tackle this issue.
Hope this help you all :)

Wednesday, April 22, 2009

My baby girl - 黃心月

After months of waiting, at last she was born. With the same birthday of myself, 18th Apr.
等了这么多个月,终于我的小宝贝女儿出世了,4月18日,和我同一天生日。


Monday, April 13, 2009

FZ28 Photo: KL PC Fair 2009 - Pretty Girls 美女魔豆

Went to buy Asus Netbook during this PC Fair 2009, here are some photo I toke with my Panasonic FZ28.These models were very friendly and show the sweetest smile in front of the camera :)
今届的 KL PC Fair 2009, 美女魔豆都很友善大方,一看见镜头就摆出了她们最甜美的笑容。







Tuesday, April 7, 2009

Panasonic FZ28 Photo: Petronas Twin Tower Night Scene 马来西亚国油双峰塔 夜景

Panasonic FZ28 photo : Petronas Twin Tower Night Scene
Please click to enlarge for better viewing pleasure.
马来西亚国油双峰塔 夜景
请点击以便放大以下照片。

Monday, April 6, 2009

香蕉。香蕉。我爱你


原來熟透的香蕉 . 產生攻擊異常細胞的物質 TNF
您可能會發現不久的將來
........ 香蕉會缺貨 !!
《网络文摘》
香蕉愈成熟即表皮上黑斑愈多,它的免疫活性也就愈高。日本人愛吃香蕉不是沒原因的,
大、小朋友們都喜歡吃香蕉 ~ 真方便,每日五蔬果,疾病遠離我喔 ........

根據日本科學家的研究發現,香蕉中具有抗癌作用的物質
TNF 。


而且,香蕉愈成熟其抗癌效果愈高。日本東京大學教授山崎正利利用動物試驗,比較了香蕉、葡萄、蘋果、西瓜、菠蘿、梨子、柿子等多種水果的免疫活性,結果證實其中以香蕉的效果最好,能夠增加白血球,改善免疫系統的功能,還會產生攻擊異常細胞的物質
TNF 。

山崎教授的試驗也發現,香蕉愈成熟即表皮上黑斑愈多,它的免疫活性也就愈高。所以從現在開始要吃熟一點的香蕉唷!
香蕉不會使白血球盲目增長只有在數量少的時候才會大幅度增加。
因此,專家們研究認為,香蕉具有的免疫激活作用比較溫和 , 在人體狀態健康時並不會使免疫力異常升高
. 但對病人、老人和抵抗力差的體弱者則很有效果。


因此,在日常生活中,我們不妨每天吃1~2根香蕉,透過提升身體的抗病能力來預防感染,特別是預防感冒和流感等病毒的侵襲。山崎教授指出,在黃色表皮上出現黑色斑點的香蕉,其增加白血球的能力
......... 要比表皮發青綠的香蕉強8倍。

Sunday, April 5, 2009

.htaccess Rewrite Engine Tutorial Guide

Found this .htaccess rewrite engine tutorial very useful from netfirms.com
Keep this as a reference for myself, it might be useful to you too.

How do I configure URL forwarding using mod_rewrite?

To configure URL forwarding using mod_rewrite:

I. ENABLE .HTACCESS
  1. Login to the Netfirms Control Panel at https://controlpanel.netfirms.com
  2. Click Site Tools
  3. Click .htaccess
  4. Enable .htaccess
II. CONFIGURE YOUR .HTACCESS FILE USING REWRITE ENGINE (mod_rewrite)

Example #1:
The following converts http://yourdomain.com/xyz.html into http://yourdomain.com/index.php?xyz):

RewriteEngine on
RewriteBase /
RewriteRule ^([a-z]+).html$ /index.php?$1 [R,L]

NOTE: The RewriteBase cannot be empty. It must indidcate the base directory or a referring directory.

Example #2:
The following converts http://yourdomain.com/directory/xyz.html into http://yourdomain.com/directory/index.php?xyz):

RewriteEngine on
RewriteBase /directory
RewriteRule ^([a-z]+).html$ /index.php?$1 [R,L]

Example #3:

RewriteEngine On
RewriteRule ^tutorials/(.*)/(.*).php /tutorials.php?req=tutorial&tut_id=$1&page=$2

Example #4:
The following will display contents in newpage.html when visitor browses to oldpage.html:

RewriteEngine on
RewriteRule ^oldpage.html$ /newpage.html

Example #5:
The following will rewrite the URL to
http://yourdomain.com/directory/newpage.html when visitors browse to http://yourdomain.com/anypage.html

RewriteEngine on
RewriteRule ^([a-z]+).html$ /directory/newpage.html [R,NC,L]

The following will display contents of http://yourdomain.com/folder1/folder2/folder3/index.php when visitors browse to http://yourdomain.com/folder1/index.php (while maintaining http://yourdomain.com/folder1/index.php in the address bar of the browser)


RewriteEngine On
RewriteBase /folder2/folder3/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index.php
RewriteRule (.*) /index.php/$1 [L]
RewriteRule ^$ /$1 [L]

Example #6:
The following example will forward a visitor coming from a specified IP address (eg. 123.45.67.8) to another location (eg. /):

RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^123.45.67.8$
RewriteRule ^.*$ - [F]

The following example will forward a visitor coming from a specified IP address (eg. 123.45.67.8) to another location (eg. /) if they try to access any .php files:

RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^123.45.67.8$
RewriteRule .php$ - [F]

Another example of a similar .htaccess file using ip blocking in RewriteCond directive will forward user to http://www.yahoo.com URL if they come from a specified IP address (eg. 123.45.67.8):

RewriteEngine on
RewriteCond %{REMOTE_ADDR} ^123.45.67.8$
RewriteRule ^(.*)$
http://www.yahoo.com [L]

Example #7:
Hot linking (ie. bandwidth stealing) happens when people link to files and images on a different server, display them on their website and the bandwidth is at the other website owner's expense. The following example can prevent hot linking to your website:

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www.)?yourdomain/.*$ [NC]
RewriteRule .(gif|jpg)$
http://yourdomain.com/image.gif [R,L]

Other Examples of .htaccess configurations:

Example #8:
If you have problems with certain visitors to your website, you can ban them. There are two different ways to ban visitors: (1) using their IP address they came from or (2) using the domain name which they came from.

The following example denies a visitor coming from IP address 123.45.67.8:

order allow,deny
deny from 123.45.67.8
allow from all

The following example denies visitors coming from a block of IP addresses coming from 123.45.67.0 to 123.45.67.255

order allow,deny
deny from 123.45.67.
allow from all

The following example denies a user by the domain name from which they came from:

order allow,deny
deny from www.theirdomain.com
allow from all

The following example denies a visitor from a domain name and all subdomains within the domain name:

order allow,deny
deny from .theirdomain.com
allow from all

The following example denies all visitors except your own IP address assigned to you by your ISP (Internet Service Provider):

Order deny,allow
Deny from all
Allow from youripaddress

Example #9:

The following example denies access to all files if the visitor is browsing from IP address 123.45.67.8:


Order allow,deny
Deny from 123.45.67.8
Satisfy All

Example #10:
You can configure .htaccess to redirect a visitor visiting a non-existing asp page to a custom error page as long as your hosting plan supports Windows hosting (eg. Business hosting plans and higher). Since our webservers are Windows aware, it tries to process the asp script before making a determination whether the asp file exists or not. As such, using htaccess will not work to redirect them to a custom error page because it will simply err with Service Unavailable (on ADV plan, ASP is not supported). That is, the redirection will not work if the (asp) file does not exist. However if on a plan with Windows support the redirection will work with the following similar coding in .htaccess file:

RewriteEngine on
RewriteBase /
RewriteRule ^([a-z]+).asp$ /directory/customerrorpage.html [R,NC,L]

Example #11:
The following example will redirect a user browsing to yourdomain.com to www.yourdomain.com:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourdomain.com
RewriteRule ^(.*)$ http://www.yourdomain.com [R=permanent,L]

Example #12:
The following example redirects all requests to the new domain saving the URI in the variable and passing it through to the new domain:

RewriteEngine ON
RewriteRule ^(.*)$ http://newdomain.com/$1 [R=301,L]


Note: Once your .htaccess file has been created you may upload it to the remote server via FTP. Please ensure that the .htaccess is uploaded in ASCII mode if your are using an FTP client such as filezilla or wsftp.

Example #13:
The following example redirects all http:// requests to https:// assuming a dedicated SSL certificate has been installed and activated:

RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteCond %{REQUEST_URI} foldername
RewriteRule ^(.*)$ https://www.domain.com/foldername/$1 [R,L]

Example #14:
The following example allows visitors to browse to .html pages and parse them as PHP pages (.html will be retained in the URL):

RewriteEngine On
Rewritebase /
RewriteRule ^index.html$ index.php [L,NE]
RewriteRule ^(.*).html $1.php [QSA,L]

Example #15:

The following example will allow all of files in .php extension to be accessed using .html or .htm extension:

RewriteEngine On
RewriteRule (.*).htm$ $1.php [NC,L]


TROUBLESHOOTING:
We recommend that you make small changes to .htaccess saving frequently, and testing your site. That way, you'll know when you've made a mistake, and will be able to quickly roll the change back. If after you configure an .htaccess file your website displays a 500 Internal Server Error, please review your newly created .htaccess file to ensure that you have followed the above instructions properly.

For further instructions on how to configure .htaccess with the above supported commands, we recommend browsing to www.apache.org or httpd.apache.org/docs/misc/rewriteguide.html

FZ28 Photo: F1 2009 Malaysia KLCC roadshow - Crystal Race Car

This is the crystal race car for F1 2009 Malaysia Sepang in KLCC.
Please click on the photo to enlarge for better viewing presure.
这是 F1 2009 马来西亚 雪邦赛事 在 KLCC 的展览。
透明水晶赛车。

大上海天-最著名的特色甜品 榴莲pancake

这就是 吉隆坡 Avenue.K 最著名的特色甜品 榴莲pancake。
喜欢吃榴莲的朋友,来到了吉隆坡大上海天餐馆,一定要记得点上这 著名的特色甜品 榴莲pancake哦!

Saturday, April 4, 2009

Canon 5d Mark II USB 隨身硬碟

最近在网上看到一则报道,有关 Canon 推出了 Canon 5d Mark II USB 隨身硬碟,看了照片候,觉得蛮可爱和特别。由于 Canon 5d Mark II 是许多摄影爱好者的梦想相机,价钱约马币14千元,买的起的人不多,对于一般的市民,只好买一个 Canon 5d Mark II USB 隨身硬碟来望梅止渴了 :)
据说价钱是约新币28元



Canon 450D 隨身硬碟

Wednesday, April 1, 2009

上海红烧肉 - 大上海天餐馆 Avenue K

肥的部分入口即溶,瘦的部分松软可口,太好吃了。