Nov
9
2011

Parse MVC style urls in PHP

If you have used codeigniter or some mvc php framework then you might be aware of urls like www.yoursite.com/index.php/class/method/param1/param2?a=b&c=d or www.yoursite.com/class/method/param1/param2?a=b&c=d if you use mod rewrite to add the index.php The htaccess code could be like this : The above kind of urls need to be parsed inside PHP to extract the class name , method name and parameters. The parsing approach could be different based on the Server API (sapi) PHP is using. 1. [...]

Nov
8
2011

Check Ubuntu version from command line

Here is a simple command to get your Ubuntu version from terminal / commandline. or or or Try any of them. Cheers!

Nov
8
2011

Choose between modphp , suphp , cgi , fastcgi , suexec

PHP Handlers PHP handlers are a link between a webserver(say Apache) and the PHP libraries. PHP handlers enable a webserver to load the PHP library in a certain manner and execute the PHP code and return the output to the webserver. There are many different kind of PHP handler setups available. Each has its own advantages and disadvantages. Mod_php (DSO) modphp or the Apache 2 Handler is a apache module for running PHP scripts. modphp [...]

Nov
7
2011

Install suphp on Ubuntu Linux

suphp is an apache module (mod_suphp) that replaces mod_php and runs php scripts with a specific user. To install on Ubuntu : 1. Install libapache2-mod-suphp 2. Now disable the mod_php 3. Now restart Apache : This should install and enable suphp. mod_suphp is loaded here : and suphp is configured here : The above configuration make suphp the handler for php files. Suphp consists of two components: 1. mod_suphp – an Apache module that replaces [...]

Nov
6
2011

Suppress Errors & Warnings With @ operator in PHP

The at sign (@) is an error control operator in PHP. You can suppress errors, warnings and notices using @ operator in PHP. It is quite common to prefix function calls with @ to suppress errors like this – In my opinion, you should never make use of @ in your code regardless of the environments (development, production or testing) because it hides all the errors (and not just the annoying notice or such you [...]

Nov
6
2011

Get Bitcoin Market Rate

Bitcoin is a decentralized digital currency that can be used to make payments to anyone and anywhere in the world. Many institutions and organizations these days have started to accept payments in bitcoins. Even many freelancers these days accept payments in bitcoins! From Wikipedia – Bitcoin is a decentralized, peer-to-peer network that tracks and verifies transactions. Satoshi Nakamoto created Bitcoin in 2009 and described his work in a self-published paper. The term Bitcoin is also used to refer to the digital currency implementation [...]

Nov
5
2011

Monitor bandwidth used by each process on Ubuntu Linux with nethogs

nethogs is a command line utility for linux which can be used to monitor the network bandwidth used by each application. Url : http://nethogs.sourceforge.net/ Install on Ubuntu : sudo apt-get install nethogs Usage : and the output would be something like : It shows the PID , username , process , network interface being used , data sending speed and data receiving speed. Other options with help Change the delay between updates to 5 seconds [...]

Nov
4
2011

Search network traffic with ngrep

ngrep or network grep is a command line utility that can be used to search network packets for a given regex pattern. ngrep uses the pcap library to capture network packets and gnu regex library to perform regex searches. ngrep is like tcpdump + grep. Url : http://ngrep.sourceforge.net/ Install on Ubuntu : The windows version can be downloaded from : http://ngrep.sourceforge.net/download.html Windows version uses Winpcap packet capture library. Usage : Ubuntu Linux 1. Search network [...]

Nov
4
2011

Connect to BSNL Broadband using Airtel Beetel 110TC1 Router

To connect to your bsnl broadband connection using the 110TC1 router follow the simple steps : 1. Switch on the modem , connect the ethernet wire , and connect the phoneline/adsl line. 2. Open http://192.168.1.1 in your browser. Use the following username password to login username : admin password : admin or password It should open up the status page like this :   2. Now go to Interface Setup  > Internet. and select settings [...]

Nov
4
2011

Solve Programming Challenges and Earn Cash

Recently I came across CloudSpokes and would like to share it with you all. CloudSpokes is a community where you can participate in programming contests and earn some money! As their website say – Participate in challenges, build a diverse portfolio, learn something new, and earn a little cash money on the side too. You will find a variety of challenges that requires skills like Ruby, Java, jQuery, HTML5, CSS3, deploying apps on Heroku, Google App Engine, etc. [...]