Code Snippets

Hello World

As a computer software programmer, one must have learned and use these two words “Hello World”. It is unsaid theory to write a hello world program to start learning a programming language. You can read the “greatness” of hello world at http://en.wikipedia.org/wiki/Hello_world_program. Or get a Hello world program for your programming language from this collection [...]

Creating SQL Table from another table

Often we need to take quick backup of database with data before we can make changes in table. for this I create the image of table within same database, as it is the fastest method. It is one of the reason why one need to create image a table.. or copy one table from another. [...]

Setting/Resetting Auto increment value in MSSQL 2005

Once you create a table and what to reset autoincrement value of a table to your desire number, you need to set some system table values, which are not available for direct editing. To perform this you need to do following: SELECT OBJECT_ID,OBJECT_NAME(OBJECT_ID) AS TABLENAME, NAME AS COLUMNNAME, SEED_VALUE, INCREMENT_VALUE, LAST_VALUE, IS_NOT_FOR_REPLICATION FROM SYS.IDENTITY_COLUMNS ORDER [...]

Calculating distance

With increasing use of Map service such as google, yahoo and MSN one often need to calculate distance between two location. This can be done many ways I suppose. However, to calculate the short distance we can perform calculation based on longitude and latitude values of those two location.  However, it is simply a math [...]

How to remove all child movieClip through AS 2.0 Code

To remove all child from a given movie clip simple loop through its all object and remove the type of object you want. Following code does the same for related_mc.sp_related name movie clip: for (obj in related_mc.sp_related){ // root.mc1[obj] instanceof MovieClip same as typeof(_root.mc1[obj])==”movieclip”        if (typeof(related_mc.sp_related[obj])==”movieclip”){          related_mc.sp_related[obj].removeMovieClip();   [...]

Printing Text Document in .NET 2.0

Some time reporting tools are too heavy to use with a small application. Something similar happens with me, I need to print a Single page text information for this I cannot use any Heavy reporting software although this information is fetched from XML/Database. So I opt to use in built .NET feature and having following [...]