Friday, December 16, 2011

Removing MacPorts completely

Macports is a utility to install tools on your MacOS machine. Incase if you want to remove macports completely then this post would definitely be your savior

Thursday, November 17, 2011

Unpacking the PACKER scripts

PACKER by Dead Edwards is an awesome tool to pack your JS files to make it difficult to read. It is good when you are giving away your code to someone else but at times you want to unpack it in absence of backup. Something which happened with me. Thankfully I got an awesome tool which unpack PACKER file quite well. SO here it is. Enjoy.

http://www.strictly-software.com/unpacker

Sunday, October 02, 2011

MySQL to JSON on Github


This morning I tried to fiddle with Git, a version control system by Linus Trovals. Github is a social coding website which has definitely beaten sourceforge.

For long time I had been thinking to test it out and transfer my only open source contribution, MySQL2Json, a PHP class to convert mysql resultset into JSON. The class actually released in 2006. At that time there was no built-in support of JSON encoding in PHP.

Lots of people who used it asked me to move it to Github but I was not getting time to focus on it. This morning I finally did it. The URL of the code is given below:


https://github.com/kadnan/MySQL2JSON


I am not so good at Licensing thing. The prior code released under PHP License. If it allows you to contribute then do it otherwise let me know. So make a fork and improve it, fix it if necessary.

Happy coding.

Thursday, September 22, 2011

G-: A Chrome and Firefox extension for Google Plus notification removal

Google Plus is getting popular. One of the killing feature of G+ is the notification bar that works on all Google sites. Since the bar keeps you notified about latest updates on your account, it could also become the reason of distraction while you are at workplace. In order to cater that I made a simple script, called G- which would remove the red notification button and help you to concentrate on your work. YOu can download it from here. It would work on both Chrome and Firefox.

Wednesday, September 21, 2011

PHP: Get first key in Associative Array

If you want to get the very first key in associative array then use Reset and key method to get the key. Reset brings the pointer on first index and key returns the key name. Code snippet given below:


$shapes = array("Box" =>"Square","Moon" => "Circle");
//Set the internal pointer of an array to its first element
reset($shapes);
//get the first key that is "Box"
$keyname = key($shapes);

Wednesday, August 31, 2011

How to find Query Source in MySQL general Log

Most of the time similar queries are used in different modules of the code-base. At times it gets difficult to find out the page where buggy or slow query is being executed. MySQL provides the option of logging slow and general queries in files. In order to record the source of the executed query it is best that you append a string in query which is then being executed via mysql_query() function of PHP.

$sql = "-- Executed via yourfilename.php:
SELECT * from table;"
;
$resulr = mysql_query($sql,$connection);



By doing this you can now find out where your query got executed. Easy and handy, No? :-)

Sunday, August 28, 2011

Revival

I remember how I started out this blog as a technical blog but later moved my technical rants to http://weblogs.com.pk/kadnan (which is dead now)

For past few weeks I had been thinking to start sharing my technical experience I encounter every day at workplace or at home while working on my personal projects or client based projects. For last two years I am not so active in blogging stuff. Specially after getting married and having a son, it got quite difficult to cope up with many things. Change of priorities made me to abandon many things which were kind of part of my life in past.

I have not quit habit of sharing, thus I use micro blogging tools now for this purpose like Twitter,G+ etc but I think there are still such things which needs to say more. This blog, I am re-opening with the intention that I would share all or most of my technical encounters I face every day.

Stay tuned