Blog Not just another WordPress weblog


memcache for a dull life

Life is very exciting with real time MySQL queries...but I prefer not to wait for my badly structured query to take more time than it is (static final)necessary...

memcached for all object manipulation...YES

Also, using sub-queries makes life quite dull instead a of JOIN(LEFT/RIGHT/MIDDLE/MESSEDUP any kind...). MySQL should have an "experience lock" on that, unless someone been using sub-queries for 3 years...oh wait, the old version never had sub-queries...well, like always, I am often wrong(but never in doubt).


PHP end tag ?>

A lot of time web programmers make Ajax call to a PHP script to verify content(information). The PHP script usually have a true/false echo, (sometimes 1/0). The PHP script looks something like this

/* do some crazy validation and set $valid value */
if(!$valid) {
 echo "false"
} else {
 echo "true";

This is all good and fun, but SFU when the interpretor reaches ?>! The PHP end tag prints a few CrLfs.

So the Ajax script having the following
will always fail. So trim the Ajax output! Here is the trim function...

function trim(stringToTrim) {
 return stringToTrim.replace(/^\s+|\s+$/g,"");


ISO 3166, ISO 3166-1 & ISO 3166-2

WTF is ISO 3166?

I found a lot of sources for ISO 3166-1 complete MySQL database, but no solid source for ISO 3166-2. So I decided to build my own!

So here is the MySQL dump for these 2 tables.

The "id" field for both table probably is unnecessary as both have ISO 3166-1 alpha-2(I just named it "iso") field.