Why You Need VPN to Get Online in China

Many first time travellers to China are surprised or chocked to find out that they can’t access popular websites such as Google, Gmail, Twitter, Facebook, YouTube etc. in this country. Welcome to the People Republic of China! You might have heard of the Great Firewall of China (or GFW). In short, it means that a lot of western websites are blocked in China.

That sucks, isn’t it? Especially if you depend on Gmail and are addicted to social media posting on Twitter or Facebook. Not to mention a lot of business related services or website are not accessible either.

The good news is, there are a number of solutions for this problem. One of the popular way of bypasssing the Internet blocking is to use a VPN service.

VPN stands for virtual private network. Basically, it can help you bypass Internet censorship and visit blocked site anonymously.

However, since many people in China use VPN, many big VPN providers are blocked in China. Therefore, choosing a good VPN service is a little bit tricky. The good news is, there’re some VPN monitoring and testing websites in China that keep an eye on which VPNs work in China and which ones are blocked. One of such services I would recommend is called VPN大大, or VPNDada.com. This website not only reviews VPN services, but also  recommend VPNs that work well in China.

If you plan to travel to China and plan to stay there for a while, be sure to be prepared. Signing up for a good VPN service before the trip might save you a lot of trouble.

Read More

BOTW Coupon Promo Codes 2012

BOTW (Best of the Web) is one of the best web directories. The regular price for submitting websites to BOTW is pretty high. However, BOTW occasionally offers coupon promo codes that users can use to submit websites at a discount price.

A Huge ONE DAY SALE Featuring 50% Off All BOTW Products and Services

Use Promo code SINCE94 starting at 12:01am EST on April 20th, 2012 and receive an instant 50% off discount on all directory submissions, local listings, bundles and sponsorships. Submit as many sites as you want, as often as you want, but do it quickly because a sale this great can’t last more than a day!

To use this coupon, CLICK HERE and use the Coupon Promo Code SINCE94.

BOTW Coupon Promo Codes 2012

Read More

Godaddy 4GH Web Hosting Sucks

Recently, I found Godaddy.com was advertising a new hosting package called “4GH Web hosting” and it was claimed to be the “4th generation hosting”, which is cloud-based, “revolutionary”, even better than Rackspace, GoGrid etc. I was intrigued and signed up. The result? It’s been quite disappointing.

If you’ve been using other hosting services and familiar with cPanel, you’d find the control panel of Godaddy’s 4GH hosting not that user-friendly. It could take 5 minutes to add a new domain and even setting up a SQL database will involve something like 5 minutes’ waiting.

One of my projects needs an additional Perl module that’s not pre-installed. With other hosting companies, I can get it installed using cPanel or write a ticket and they will usually quickly get it installed. With Godaddy’s 4GH hosting service, there’s no way to install additional Perl modules in the control panel. When I ask them to help me, I got a plain No as the answer.

I’ve been using some PHP scripts that runs as cron jobs thus needs to be run as command line and those scripts failed mysteriously once I’ve moved my site to GoDaddy’s 4GH hosting. To my surprise, I found it you run those script via a web browser, they run without problem, but if I launch them in SSH, they all failed. I’ve also heard from other people that PHP scripts often have problem running on GoDaddy’s 4GH hosting.

I contacted their customer service, which is not that good either. While other hosting companies might take a couple of hours to reply a support ticket, it usually takes up to a whole day to get a reply for Godaddy 4GH’s supporting tickets, and the replies are mostly canned messages copied from their help section. When I contacted to the customer service reps from other hosting companies, I usually knew I was talking to a tech person, but at Godaddy, I got a feeling that those people who replied my technical tickets are not tech person at all.

Based on my experience with Godaddy’s 4GH hosting, I guess I must say: it really sucks!



Read More

PHP Cheat Sheet: Regular Expression

1. preg_match():

if (preg_match("/php/i", "PHP is the web scripting language of choice.")) {
    echo "A match was found.";

Note: $matches[0]will contain the text that matched the full pattern, $matches[1] will have the text that matched the first captured parenthesized subpattern, and so on.

$str = http://www.php.net/index.html;
if (preg_match('@^(?:http://)?([^/]+)@i', $str, $matches) {
    $host = $matches[1];

2. preg_match_all():

$str = "<b>example: </b><div align=left>this is a test</div>";
preg_match_all("|<[^>]+>(.*)</[^>]+>|U", $str, $out);
echo $out[0][0];  // "<b>example: </b>"
echo $out[0][1];  // "<div align=left>this is a test</div>"
echo $out[1][0];  // "example: "
echo $out[1][1];  // "this is a test"


$userinfo = "Name: <b>Joe Black</b> <br> Title: <b>PHP Guru</b>";
preg_match_all("/<b>(.*)<\/b>/U", $userinfo, $pat_array);
echo $pat_array[0][0];  // "Joe Black"
echo $pat_array[0][1];  // "PHP Guru"

3. preg_replace():

The preg_replace() function replaces all occurrences of pattern with replacement, and returns the
modified result.

$text = "This is a link to http://www.google.com/.";
echo preg_replace("/http:\/\/(.*)\//", "<a href=\"\${0}\">\${0}</a>", $text);
// "This is a link to
// <a href="http://www.wjgilmore.com/">http://www.wjgilmore.com/</a>."

If you pass arrays as the pattern and replacement parameters, the function will cycle through each
element of each array, making replacements as they are found.

$draft = "In 2010 the company faced plummeting revenues and scandal.";
$keywords = array("/faced/", "/plummeting/", "/scandal/");
$replacements = array("celebrated", "skyrocketing", "expansion");
echo preg_replace($keywords, $replacements, $draft);
// "In 2010 the company celebrated skyrocketing revenues and expansion."

4. Regular Expression Modifiers

  • i:     case-insensitive
  • m:     Treat a string as several (m for multiple) lines. By default, the ^ and $ characters match at the very start and very end of the string in question. Using the m modifier will allow for ^ and $ to match at the beginning of any line in a string.
  • s:    Let a dot metacharacter in the pattern matches all characters, including newlines. Without it, newlines are excluded.
  • U:    Turns off greety matching.

Read More

PHP Cheat Sheet: Working with Directories

1. Retrieving a Path’s Filename:

$path = '/home/www/data/users.txt';
$file_nm = basename($path);  // "users.txt"
$file_nm_1 = basename($path, ".txt");  // "users", no extension.

2. Retrieving a Path’s Directory:

$path = '/home/www/data/users.txt';
$dir_nm = dirname($path)  // "/home/www/data"

3. Learning More about a Path:

$pathinfo = pathinfo('/home/www/htdocs/book/chapter10/index.html');
echo $pathinfo['dirname'];   // "/home/www/htdocs/book/chapter10"
echo $pathinfo['basename'];   // "index.html"
echo $pathinfo['extension'];   // "html"
echo $pathinfo['filename'];   // "index"

4. Identifying the Absolute Path

$imgPath = '../../images/cover.gif';
$absolutePath = realpath($imgPath);   // "/www/htdocs/book/images/cover.gif"

5. opendir() and readdir()

if ($dh = @opendir($directory)) {
    while (($filename = readdir ($dh))) {
        if ($filename != "." && $filename != "..") {
            if (is_file($directory."/".$filename)) {
                echo "File: $filename";
            if (is_dir($directory."/".$filename)) {
                echo "Dir: $filename";


Read More

PHP Cheat Sheet: File Handling

1. Checking Whether a File Exists:

if (file_exists("testfile.txt")) echo "File exists";

2. Reading from Files:

Method 1: Using fgets() to read one line a time:

$fh = fopen("testfile.txt", 'r') or die("Cannot open file.");
while (!feof($fh)) {
    $line = fgets($fh);
    $out .= $line;


Method 2: Using file_get_contents() to read the entire content:

$userfile= file_get_contents('users.txt');

3. Writing Files:

Method 1: Using fwrite():

// Regular writing, no locking.
$fh = fopen("testfile.txt", 'w') or die("Failed to create file");
fwrite($fh, $text) or die("Could not write to file");

// Writing with locking
$fh = fopen("testfile.txt", 'w') or die("Failed to create file");
flock($fh, LOCK_EX) or die("Cannot lock file");
fwrite($fh, $text) or die("Cannot not write to file");
flock($fh, LOCK_UN) or die ("Cannot unlock file");

// File append
$fh = fopen("testfile.txt", 'a') or die("Failed to create file");
fwrite($fh, $text) or die("Could not write to file");

Method 2: Using file_put_contents():

// No appending
file_put_contents('output.txt', $data) or die("Cannot write file");

// File append
file_put_contents('output.txt', $data, FILE_APPEND) or die("Cannot write file");

4. Determining a File’s Last Modified Time:

echo "File last updated: ".date("m-d-y g:i:sa", filemtime($file));

5. Determining a File’s Size:

$bytes = filesize($file);
$kilobytes = round($bytes/1024, 2);


Read More

How to Register a Facebook Application

Before registering a new Facebook application, you need to make sure you have verified your Facebook account. There’re two ways to verify your developer account:

1. You can confirm your phone number at the fololowing URL: http://www.facebook.com/confirmphone.php

2. You can verify your Facebook account by adding your payment (credit card information) at here: https://secure.facebook.com/cards.php

Once your Facebook account has been verified, you can go to this page to register a new Facebook application: https://developers.facebook.com/apps. Just click on the “+ Create New App” button and enter the detailed information about your new application.

Once registered, you will be given a application ID and a application Secret. These two pieces of information is very important. You will need them when developing your application.

Read More

How to turn ipod touch into iphone (怎样让 iPod Touch 变 iPhone 手机)

If you have an iPod Touch (for example, iPod Touch 4), you might know that it’s more or less like an iPhone without the capability of making phone calls. You might wonder: how nice would it be if I can make phone calls from my iPod Touch? Yes, since an iPod Touch is much cheaper than an iPhone, if it can be used as a phone, you will definitely save a lot of money.

你想让你的 iPod Touch 变成 iPhone 手机,可以用来打电话吗?

Actually, this can be done. You can really turn an iPod Touch into an iPhone if you have the right equipments. Currently, as far as I know, there’re two major options for turning an iPod into an iPhone:

目前让 iPod Touch 变 iPhone 手机主要有两种办法。

Option 1: Apple Peel 方法 1:使用“苹果皮”。

An Apple Peel looks like a regular iPhone case, but it’s a little bigger and you can insert a SIM card into it. Once you have connected your iPod to an Apple Peel (just like putting a case around your iPod touch) and have downloaded and installed some software, you will be able to use it like an iPhone! The drawback of Apple Peel is that it looks bigger and thicker than a regular iPhone.

If you’re interested in buying an Apple Peel, you can try finding it on Taobao.com: Click here to search for Apple Peel on Taobao.com

“苹果皮”就像一个 iPhone 套子,但“苹果皮”可以装入 SIM 卡,然后经过越狱和安装适当软件之后,你的 iPod Touch 就可以像 iPhone 一样打电话了。“苹果皮”的缺点是体积较大,装上“苹果皮”的 iPod Touch 看起来比一般的 iPhone 体积大,有些笨重。


Option 2: Gmate  方法 2:使用 Gmate

Unlike Apple Peel, a Gmate is a stand-alone equipment that connects to your iPod Touch using bluetooth technology. You don’t have to connect your iPod Touch to Gmate directly. Instead, as long as your iPod Touch can communicate with your Gmate using bluetooth, you will be able to make phone calls on your iPod Touch. You can insrt a SIM card inside a Gmate, and you must download and install some software on your iPod Touch. As a matter of fact, Gmate can be used not only for iPod Touch, you can use it with your iPhone (or an Android phone) so that you can have two numbers at the same time with one phone.

If you’re interested in buying a Gmate, you can try finding it on Taobao.com: Click here to search for Gmate on Taobao.com.

Gmate 不需要和 iPod Touch 直接连接,而是通过蓝牙连接。Gmate 本身体积不大,可以插入 SIM 卡。在 iPod Touch上安装适当软件后,你就可以用它像 iPhone 一样打电话了。此外,Gmate 还可以用在 iPhone 和 Android 手机上,让你的手机可以实现“一卡双号”。

如果要购买 Gmate 的话,可以到“淘宝网”找一找:Gmate 的淘宝链接

Read More

How to Read Chinese on Kindle (Kindle 汉化的方法)

Update 2010-07-30: Amazon.com 将于8月27日发布新版的6吋屏 Kindle


Below are steps to allow Kindle to display Chinese characters (汉化). It should work for the most current versions of Kindle 2 and Kindle DX. The one I used myself is Kindle DX Graphite International Version 2.5.5.

WARNING: This could be dangerous and might cause your Kindle not functioning. DO IT AT YOUR OWN RISK!!!!

Step 1: Jailbreak

— Visit this link: http://www.mobileread.com/forums/showthread.php?t=88004.

— Download the attached kindle-2.5-jailbreak-0.1.N.zip file, and unpack it. In here, you’ll find a bunch of .bin files, and a src directory.

— Leave the directory alone, and upload the correct update_*_install.bin file for your kindle to the root directory of your Kindle. (As always, k2 means K2 US, k2i means K2 GW, dx means KDX US, dxi means KDX GW, and dxg means KDX Graphite). For a Kindle 2 International, that would be update_jailbreak_k2i_install.bin for example.

— Now, eject your Kindle, and go to [HOME] -> [MENU] > Settings -> [MENU] > Update Your Kindle. It should be quick, and it should FAIL (With a U006 error, in the bottom left corner of the screen). It’s completely normal, intended, and harmless.

— (To uninstall the hack, just copy the appropriate “uninstall” bin file to the root of your Kindle and update.)

Step 2: Font Hack

— Visit http://www.mobileread.com/forums/showthread.php?t=88004 or http://wiki.mobileread.com/wiki/Kindle_Font_Hack_for_all_2.5.x_Kindles

— Download the kindle-2.5-fonts-3.5.N.zip file and the DroidSansFallback1.rar and DroidSansFallback2.rar file.

— Unpack kindle-2.5-fonts-3.5.N.zip. Copy the appropriate font hack bin file to the root of your Kindle along with the “linkfonts” folder found inside the “src” folder.

— Unpack DroidSansFallback1.rar and DroidSansFallback2.rar file. Place the resulted font set in the “linksfont/fonts” folder. If you are asked if you want to overwrite files that are already in that folder, say “yes”.

— Visit http://www.duokan.com/viewthread.php?tid=392 and download free_font.part1.rar, free_font.part2.rar, free_font_bold.part1.rar and free_font_bold.part2.rar. Unpack them. You will see two font files: free_font and free_font_bold.

— Go to kindle\linkfonts\fonts, Rename Serif_Regular to Serif_Regular.bak and then rename Serif_Bold to Serif_Bold.bak.

— Copy free_font and free_font_bold to kindle\linkfonts\fonts, then rename free_font to Serif_Regular and then rename free_font_bold to Serif_Bold.

— Safely eject your Kindle from your computer. Click Menu > Settings > Menu > Update Your Kindle. Your new font is installed.

— Anytime you want to change your fonts, add the new fonts to the “linkfont/fonts” folder and just drop a blank “reboot” file in the linkfonts folder (By copying and renaming the existing “autoreboot” blank file, for example) and you’ll be good to go.

— (To remove the font hack, just copy the appropriate “uninstall” bin file to the root of your Kindle and update. Note that you shouldn’t have to deactivate/uninstall it in order to be able to install official Amazon updates.)


Read More

Should I Turn My Kindle Off?

Recently I bought a new Kindle. It’s pretty cool and easy to use. However, there’s one question that puzzled me: Should I turn my Kindle off when not using it?

As a matter of fact, if you don’t touch your Kindle for several minutes, it will automatically go into the “Sleep” mode, just like most computers do. I’ve heard that, since Kindle uses the E-ink technology, it only consume electricity when you turn pages, transfer files, turn it on/off etc. When you read a particular page, unless the wireless is on, it doesn’t use the battery.

I’ve read some Kindle forum postings and found most people agree that it’d be better to let the Kinlde “sleep” than regularly turning it on and off.

But I’m still not convinced, so I emailed the Kindle customer service and below is their answer:

When you’re not using Kindle, it will automatically enter sleep mode. Unless you are storing your Kindle longer than a few days, turning it off is not necessary.

Therefore, from now on, I will not regularly turn my kindle off but just let it sleep. However, I’d remember to turn the wireless off when not using it for a while (such as overnight) because the wireless signal might drain the battery.

Read More