A blog where Moazzam … rambles

  • Cool things you can do with MySQL

    Run a query from command line # Use the -e flag shell>mysql -e “select * from table” Tell MySQL to output the results of a query in HTML or XML # On command line you would write the following to # tell MySQL to output the results in HTML format shell>mysql -e “select * from…

  • Tips for a Speedy Zend Studio

    I found a good article on how to speed up your Zend Studio (eclipse based) on Zend’s website. Hopefully everyone else will find it as helpful as I found it to be: http://kb.zend.com/index.php?View=entry&EntryID=480

  • Zend Server and Zend Studio9

    If you have Zend Server installed and you have an instance of MySQL that didn’t come with Zend Server, then Zend Studio will try to connect to the one that came with Zend Server. I discovered this the hard way when my PHPUnit tests kept failing in Zend Studio but ran perfectly from the command…

  • Virtual hosts look up taking too long in OSX Lion

    If your mac (OSX Lion) is taking too long to get pages with your local web server and you have virtual hosts setup, then it’s probably because it is checking the DNS servers before it checks for it in your /etc/hosts. The way to resolve this is to have a ::1 entry in your hosts…

  • Some information on booking flights with Sabre

    A lot of people contacted me asking about how Sabre works, etc. So, I decided to post this here. The way it works is: You sign up with Sabre for a web services account and you they will give you an IPCC, username and passwrord that you use for communicating with their web services.You will…

  • Nexus S and TMobile data connection

    Here’s an interesting tidbit. If you go out of the country and come back. Nexus S won’t automatically connect to TMobile’s 3G or edge network. You have to switch it off and start it again for it to connect to the data network. It will, however, let you make phone calls, and send and receive…

  • Writing good Javascript code

    Here’s a link someone I know found on how to write good Javascript code. It talks about how to make your javascript run faster and with a small footprint. It also talks about how to avoid memory leaks. http://code.google.com/speed/articles/optimizing-javascript.html

  • Validating An Email Address in PHP 5

    In PHP 5.2 Zend has added a function called filter_var(). It validates a lot of things for you without having to write any regular expressions or anything else. You do it like this: if (filter_var($emailAddress, FILTER_VALIDATE_EMAIL) !== false) { print ‘valid email’; } else { print ‘Invalid email’; } filter_var()returns the value back if its…

  • PHP – Get a visitor’s IP address

    /** * This function tries to get the real IP of the visitor even if they * are behind a proxy */ function getClientIp() { if (!empty($_SERVER[‘HTTP_CLIENT_IP’])) { $ip = $_SERVER[‘HTTP_CLIENT_IP’]; } elseif (!empty($_SERVER[‘HTTP_X_FORWARDED_FOR’])) { $ip = $_SERVER[‘HTTP_X_FORWARDED_FOR’]; } else { $ip = $_SERVER[‘REMOTE_ADDR’]; } return $ip; }

  • PHP Inheritance – Calling parent’s functions in child object

    Before I begin, let me just say that I have tested this in PHP 5.2. I don’t know if this will work for PHP 5.3. If anyone can confirm that it does, it will be great. You can do it with parent::someFunctionName(). You can do this from within an overloaded function also. It was confusing…

Got any book recommendations?