Posted by & filed under PHP.

Want to see if a single item is in an array in PHP? Use in_array. For example, you have an array of colors and you want to find if red exists. Try this…

$array = array(red, blue, green); 

if (in_array("red", $array)) {
    echo "has red";

Posted by & filed under Javascript.

We created a quiz on that allows people to get coins if they get the right answer. If you get enough coins you can get on the high score list. However, I found that some people were using the back button on the browser and doing the same question again and again. The better idea would be to track if the user had done that question before and penalize or prevent them from  getting coins for doing the same question, and I will try to do that for the long term. I did learn a little trick though to prevent people from using the back button. By adding this javascript in the head (I didn’t test if this would work at the bottom)

  <script type="text/javascript"> 
    function noBack() { window.history.forward(); }

and add the following to the body tag…

<body onload="noBack();"
    onpageshow="if (event.persisted) noBack();" onunload=""> 

this would prevent people from easily going back to the question they just finished. There are ways to get around this for the user, but they would have to have a lot more free time than me to waste to do it.

Posted by & filed under Website Development.

Here are several URLs you can go to if you want to add your website to Chinese search engines for free.

Google China

Yahoo! China



MSN China



Posted by & filed under Website Development.

Google Trends Pic

Google offers a new tool to learn the trends of keywords and websites. You simply type in the words you want to compare (non-English words are ok too) into the input box. Google Trends then provides you a chart of the search patterns using these key words over the past few years. You can do the same with websites, and compare activity as well.

For example I did a search on a few of the top Chinese websites ( – blue, – red, – yellow) and discovered that in the past 2 years has really taken off in views. You can also do a country specific search by country and sub-region. So you could check China and then look into activity just within Beijing. This tool is also useful for SEO (Search Engine Opitimization). Once again, a great tool by Google.

You can try Google Trends at