Archive for the ‘Programming’ Category

MySQL database has a handy and simple string function REPLACE() that allows table data with the matching string (from_string) to be replaced by new string (to_string). This is useful if there is need to search and replace a text string which affects many records or rows, such as change of company name, postcode, URL or […]

Pictures from a developer’s life

Posted: 2nd March 2013 by Babar Shafiq in Internet, Programming
Tags: , , ,

Deploying code to production When the sales people announce they have sold our product to the customer

  Updating PHP in CentOS to latest PHP 5.3 or PHP 5.4 is not an easy task so I am writing this post. I had to do this for a project in which I need to install latest Zend Loader with PHP 5.3 support.

  Yappy, I just won a price by "Liking" a page on facebook "Like & Win" competition Actually some company announced that they will give free gifts to the 2000th and 2011th users, who like their facebook page. So what I did was simple,  I just made a python script (that's not hacking, just power […]

Advance Bash Scriptiong Tricks

Posted: 21st December 2010 by Babar Shafiq in Networking, Programming
Tags: , , , , ,

Here are some of my Linux bash shell findings, I hope it is good for everyone Find some text in current folder, sub-folders and files:- find . | xargs grep ‘string_to_find’ Getting current time from some time server:- cat < /dev/tcp/time.nist.gov/13 Convert Unix Timestamp (aka Epoch):- date -d @1292946804 Tue Dec 21 20:53:24 2010 Downloading a […]

Simple Construction of a RAW TCP/IP Packet

Posted: 11th August 2010 by Babar Shafiq in Programming
Tags: , , ,

#!/usr/local/bin/perl use Socket; $src_host = $ARGV[0]; # The source IP/Hostname $src_port = $ARGV[1]; # The Source Port $dst_host = $ARGV[2]; # The Destination IP/Hostname $dst_port = $ARGV[3]; # The Destination Port. if(!defined $src_host or !defined $src_port or !defined $dst_host or !defined $dst_port) { print “Usage: $0 <source host> <source port> <dest host> <dest port>\n”; exit; […]