Choosing the Right Geolocation Database
The other day (to be specific around mid April), I had to re-evaluate the accuracy of available Geolocation Database that we can use for our application and the result isn't as what we consider an accurate as we thought it should be. For the case study I tested varies IP using IP2Nation, Maxmind and IP2Location. Result after the jump.
Best Practices in Javascript Library Design
This is an excellent presentation by John Resig, lead developer for jQuery.
Disable 404 Header Response for WordPress
I have a numbers of project running on WordPress and each of it extend the functionality of WordPress using plugin or integration with 3rd party application (which I would be able to share as for now). However, WordPress tend to send 404 header response to the browser which is may break your code or disable access to the 3rd party application.
Avoid Your E-mail From Becoming Spam
Let forget about mail() function in PHP, as most emailservers today will eventually mark e-mails sent using this function as spam. But fear not, there are better way to send e-mail and today and one of it is PHPMailer, it support e-mail sending using both method (mail() or SMTP method) but our problem will not be solve if we still using mail(), the use SMTP is the way to go by minimizing the possibility of your e-mails to end up in spam/junk folder.
No whitespace after HereDoc Syntax
In one of my previous entry I have introduce the usage of HereDoc Syntax in PHP, but please be cautious not to add whitespace right after you close your syntax or you will end up with this error.
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/example/domains/example.com/public_html/home.php on line 111
This may look like a simple error but most of the time you might forget that this error where from HereDoc Syntax because the message "on line 111" wouldn't help you solve the mistery as in most cases the problem started before line 111. Where actually do we not have whitespace? Sample code below illustrate the location of the actual error.
<?php
return <<<AJAX
"alertpop":"",
"jumpto":"",
"exec":"",
"result":""
AJAX;{do not add any whitespace here}