Nov 12, 2009

Public Key Token of an assembly


There are times when you need to get the public key token of an assembly. Okay the only time is when you need to put in config files. The answers is same old sn.exe. That's right the same .NET strong name tool we use to generate snk files.

sn -T helloWorld.dll
This gives you the public key token of the strong named assembly.

Just wanted to share.

Apr 25, 2009

Passing parameters to a function in setTimeout()

While working on some 'animation' effect on one of my pages, I came across a problem when using setTimeout(). I am using it to call a function repeatedly in certain interval. I am not much into javascript so had quite a trouble figuring it out. If the function which is being called does not have any input parameters,
setTimeout(MyFunc(),10); // calls 'MyFunc' function every 10 ms.
But my 'Animate' function takes a parameter ( divId ),so I tried
setTimeout(Animate(divId),10); // wrong !!
This did not work.
The correct way to call a function with parameters in setTimeout function is.
setTimeout(function(){Animate(divId);}, 10);
This concept is called 'Closure' in javascript.
Just wanted to share...

Mar 30, 2009

Database Indexes

I went through a lot of articles to find out the exact differences between clustered and non-clustered indexes.
I have "simplified" the findings, especially for the people (like me) who like to learn things in brief.

Non-Clustered Index
The index in the back of any book is good example of a non-clustered index. Any topic may be easily found in the book by first finding it in the book index and the index will give the page number of the topic.
So, it requires two "look ups" to find a topic. Now in database context we need to first find the position of the index entry and the go to the data page where the rows are present. The leaf node of the B-Tree (data structure index are built on) are the data pages where the rows are stored physically.

Clustered Index
A Phonebook is good example of a clustered index i.e. data and index both are merged together. It requires just one look up to find the data row. Since the data are stored as per the order of the index, there can be only one Clustered Index on a database table.

Top Ad 728x90