Archive for the ‘programming’ Category

Make deleted file unrecoverable by undelete software

How do you make sure your deleted sensitive documents are really deleted? Drag it into recycle bin and empty it? Use ‘del’ in windows command prompt or ‘rm’ in linux?

Continue reading …s

PHP integer and float

I found a problem while trying to do some bitwise operations (e.g. 32 bits XOR) in PHP. Consider the following case:


$a = -3036738507; // stored in float type
$b = 98758; // stored in integer type
$c= ($a & 0xFFFFFFFF) ^ $b;

Note: In PHP, if you specify a number beyond the bounds of the integer type, it will be interpreted as a float instead.

Continue reading …s

MySQL randomly sort query result

How do you choose records randomly from MySQL database. Normally we will select all the related data from database and then store it to a buffer array. From the array, we randomly choose the records that we want.

Continue reading …s

Avoid additional Adsense impression from publisher

It is always a problem for Adsense publishers that always visit their own websites for testing purpose - Google Adsense will report additional Ad impression. The statistic at Google Adsense’s report becomes inaccurate and might affect the overall earning especially when publisher does a lot of testing on his/her own sites. When impression is increased, page CTR (click through rate) will be decreased and as well as eCPM (effective cost per 1000 impression).

Continue reading …s

Running PHP Scripts with Cron

I used Cron to generate daily report (writen in PHP) of my website and send the report to my email inbox everyday automatically. Basically, Cron a utility in Unix/Linux that enables users to execute commands or scripts (groups of commands) automatically at a specified time/date.

Continue reading …s

My Adsense Tracker

I have created an Adsense Tracker script to keep track adsense clicks on my websites. The scripts are pretty simple but can be expanded to generate a useful report. However, the scripts only work for ad unit and not ad link.

Continue reading …s

Happy Birthday Java

Java Technology is celebrating its 10th birthday at JavaOne conference. You can read more about JavaOne conference here.

Continue reading …s