Author: Moazzam

  • 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…

  • PHP and MySQL

    Someone recently sent me a message asking me to explain how to use a database with PHP. So, here it is as an article so everyone can take advantage of it. The following 5 things will be enough for a lot of PHP programmers (and get you started). Connect to MySQL Select the database you…

  • Adding a new post in wordpress

    WordPress is a great tool for blogging. However, sometimes it can be a bit confusing (and cluttered). So here’s my attempt at explaining how to add a new post to your wordpress blog. Below is what you see when you login to the wordpress control panel: And, below is the page where you add/edit blog…

  • The world of programming

    A friend of mine sent me this picture which shows who did what in the field of computing. He found the picture on Smash magazine’s website (don’t know where). But here it is:

  • Setting up your Android environment

    I have seen quite a few posts on some lists asking about how to set up a programming environment for Android. While it is very straight forward, the documentation is all over the place. So, I decided to write this tutorial :). In this tutorial, we will install Android SDK in eclipse (Galileo), we will…