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

Wednesday, March 09, 2005

MSN trojan

today i accidently clicked the link which my friend send on MSN,the file was omg.pif..Thanks God i had closed the IE immediately othwise....

any way to getrid of this?

Tuesday, March 08, 2005

Reasons why Reiser4 is great for you:

due to following reasons

GoogleDesktop Final Release

Google has finally released the final version of its Desktop version. Google comes more closed to developers/programmings by provding API to use GDS(Google Desktop Search) in your application ,you can check documentation here

Monday, March 07, 2005

I can`g getinto CP website

I have been trying to getinto Codeproject website but its giving me Unknown host error,i am thinking to call Helpline of my frigging ISP
its makig me frustrated,i cant live without CP :(

Creating an administrative install point for the .NET Framework, a service pack and a hotfix

read here

Friday, March 04, 2005

MSIL IDE

Hi

i am writing here after a week or so,been busy in solving different things,which i will describe later

anyway here i am to let you guys know about a good MSIL editor,link is given below:

http://ilide.aspfreeserver.com/default-en.aspx

-adnan

Monday, February 21, 2005

Two Kinds of Developers

Mark is trying to tell readers about different kinds of developers,read yourself what`s he trying to say

nice C# tips

Check this out

Sunday, February 20, 2005

Compressed FileSystem(CFS)

I have been thinking /willing of a Compressed File system which can work similar to MP3 mechanism(i am not 100% aware of Mp3 mechanism but heard that it decompresses the file during playing and then it compresses again) ..

what I mean to say that,that Applications are deployed in compressed format(say have extension .cmp) on User machines,i am not talkig about Zipping the EXEs or MSI stuff in Zipped format..what i mean that instead of making simple MSIs or Setup Exes who get extracted on client machine during installation, the Compressed program gets installed on client machine with a shortcut link on Desktop or in start menu,the link will point to .cmp file which will initially opene the Header section or Base system section for the user (it could be a GUI or a Command line application..whatever)the base system system will have all necessary options which are part of that system.Whenever user selects some particular option of the system the files(dlls or whatever) of that particular section will get loaded only,and when the user closes that particular section,e.g Form Dialog)the files will get decompressed again)

Well will be wondering how come a single Compressed file could do all this?well i think that associated DLLs or exes could be loaded in memory to perform required tasks,it involves temporary Assembly registration in GAC and Registry,we could add references of all files who are packaged in .cmp format in Registry,so that they can be refer during uncompression of required files..

once the dialog form is unloaded,the files will also get removed from hardisks and from registry as well as memory..

these are just crazy thoughs..not sure how it could be done..what i know its not impossible,maybe we cant achieve 100% results but i think 70% could be achieved and 100% if filesystem itseld supports the mechanism,custom mechanism might not get so much success

Filesystem Watcher -A nice article

Luc Archambaultn has posted a very nice article about file System watcher class ,and came up with very wonderful utility.

Saturday, February 19, 2005

AntiProgramming Day

for last 36 hours,i have not been writing a word which could help me to finish my projects,,reason?well i didn`t want to..i was tired ..

this morning i recieved mail from one of my good friend Taylor replied my mail about Mozilla Extension development

he came up with two good articles mentioned in his post,i am very tired ,there was a looong journey,because most of routes were block due to Moharram rallies..

tomorrow i have to resume work on my project(i won`t reveal details :D )and prolly i would do some more research on Mozilla/Firefox Extensions

Wednesday, February 16, 2005

Assigning keyvalues pair to ComboBox in C#

it took a lot of time to find some solution to assign more than one values to combobox,since comboObject.Items.Add("MyValue") only allows to add a single value in comboBox which can be fetched by using comboObject.text property.

Hans de Bruijn has provided very clean and nice solution to tackle this problem for both combobox and List values.

Happy Coding

Tuesday, February 15, 2005

Diplay Virtual Direcotries in C#

the code i mentioned earlier fetches the website Names only..what if you want to show the virtual folders as well?well it`s not so difficult.If you run the code in my previous post,it will display a numeric number which is unique Identifer for each site hosted on IIS,this can be retrieved by calling Site.Name in for each loop
In order to retrieve the virtual folders under that specific Website simple do the following

//Save Website Unique Identified in a variable

String SiteId=Site.Name

DirectoryEntry W3SVC = new DirectoryEntry("IIS://" + ServerName + "/w3svc/"+SiteId+"/ROOT, "Domain/UserCode", "Password");


foreach (DirectoryEntry Site in W3SVC.Children)
{

//display Virtual Directories
Console.WriteLine(Site.Name.ToString());

}

Diplay IIS hosted Site Names in C#

I have been working on a project module which will interact with IIS and will display hosted sites or virtual directories,so far i have done this by using ADSII ,the code is very raw,i will submit final snippet once it`s done..this code will display website names hosted on IIS


try
{
const string WebServerSchema = "IIsWebServer"; // Case Sensitive
string ServerName = "SIDDIQI";
DirectoryEntry W3SVC = new DirectoryEntry("IIS://" + ServerName + "/w3svc", "Domain/UserCode", "Password");
foreach (DirectoryEntry Site in W3SVC.Children)
{

if (Site.SchemaClassName == WebServerSchema)
{
//Console.WriteLine(Site.Name + " - " + Site.Properties["ServerComment"].Value.ToString());
}
}
}
// Catch any errors
catch (Exception e)
{
Console.WriteLine("Error: " + e.ToString());
}