Posts

Showing posts from April, 2012

SQL Statements

--1) Reseed Indentity column --drop table TABLE_NAME if  exists (select * from sys.objects where name='TABLE_NAME') drop table TABLE_NAME create table TABLE_NAME (ID int primary key identity (1,1),Increment int ) insert into TABLE_NAME (Increment ) values(1) insert into TABLE_NAME (Increment ) values(1) insert into TABLE_NAME (Increment ) values(1) insert into TABLE_NAME (Increment ) values(1) select 'Max of id is ' ,max(id) from TABLE_NAME delete from TABLE_NAME select 'Max of id after delete  ', isnull(max(id),0) from TABLE_NAME insert into TABLE_NAME (Increment ) values(1) insert into TABLE_NAME (Increment ) values(1) insert into TABLE_NAME (Increment ) values(1) insert into TABLE_NAME (Increment ) values(1) select 'Max of id after delete  insert', max(id) from TABLE_NAME --Reseed the Identity column with with one, so that the autoincremented delete  TABLE_NAME DBCC CHECKIDENT (TABLE_NAME, RESEED, 1) insert into TABLE_NA

List of useful tools(Must have tools/Application)

 Snoop WPF (allows you to spy/browse the visual tree and change properties of a WPF UI) http://bit.ly/HgOHYc 7zip ( Zipping utility that supports number of different compression and extraction format 7zip,.tar,.zip,.rar,.bz etc:.) http://bit.ly/HQG6RC Free download manager(Accelerate downloading of files by using sliced download and support built-in bit-torrent protocol which can be enabled/disabled, once it is disables we cannot download using .torrent files) http://bit.ly/HgQ0ql Winmerge Compare and merge plain text files or directories . read more here  http://winmerge.org/ Libere office, replacement for MS Office  http://www.libreoffice.org/download/ Unstopcopy (Copies files from a source , can be useful if you would like to read corrupted files from your old VCD/CD/DVD)  http://bit.ly/HgRgti Sysinternals Suit (Complete set of tools required to master windows)  http://technet.microsoft.com/en-us/sysinternals/bb842062 Free English dictionary , select the word and

.NET 4.5 Beta- WPF Changes

The new Ribbon control, which enables you to implement a ribbon user interface that hosts a Quick Access Toolbar, Application Menu, and tabs. The new INotifyDataErrorInfo interface, which supports synchronous and asynchronous data validation. New features for the VirtualizingPanel and Dispatcher classes. Improved performance when displaying large sets of grouped data, and by accessing collections on non-UI threads. Data binding to static properties, data binding to custom types that implement the ICustomTypeProvider interface, and retrieval of data binding information from a binding expression. Repositioning of data as the values change (live shaping). Ability to check whether the data context for an item container is disconnected. Ability to set the amount of time that should elapse between property changes and data source updates. Improved support for implementing weak event patterns. Also, events can now accept markup extensions. http://msdn.microsoft.com/en-us/library/bb613588(v=vs

How to find out to which table the column name belongs to ?

How to find out to which table the column name belongs to ? Ans: SELECT TABLE_NAME=SYSOBJECTS.NAME, COLUMN_NAME=SYSCOLUMNS.NAME, DATATYPE=SYSTYPES.NAME, LENGTH=SYSCOLUMNS.LENGTH FROM SYSOBJECTS JOIN SYSCOLUMNS ON SYSOBJECTS.ID = SYSCOLUMNS.ID JOIN SYSTYPES ON SYSCOLUMNS.XTYPE=SYSTYPES.XTYPE WHERE SYSOBJECTS.XTYPE=’U’ AND SYSCOLUMNS.NAME LIKE (‘COLUMNAME2FIND%’) ORDER BY SYSOBJECTS.NAME,SYSCOLUMNS.COLID --keep posting

Map more than one sitemap in asp.net webform

How to map more than one  sitemap in same asp.net webforms application ? If there are  multiple sitemap in an asp.net application eg: for your administrator you need to show entirely different set of menu compared to normal user . After adding following entry in web.config will help in using multiple sitemap, you can have 2 different sitemap files named AppDefaultMap.sitemap and AdminSitemap.sitemap (remember by default we can have only one web.sitemap file in our project)                         name="AppDefaultSiteMap"           type="System.Web.XmlSiteMapProvider"           siteMapFile="~/Application.sitemap" />                    name="AdminSitemap"           type="System.Web.XmlSiteMapProvider"           siteMapFile="~/AdminMenu.sitemap" /> --keep posting.

Swap mouse button

Code to swap the mouse button's action using System; using System.Runtime.InteropServices; using System.Windows.Forms; namespace MouseSwap /// Summary description for Class1. /// class Class1 { [DllImport("user32.dll")] static extern bool SwapMouseButton(bool fSwap); /// /// The main entry point for the application. /// [STAThread] static void Main(string[] args) { bool b; using(System.Threading.Mutex m=new System.Threading.Mutex(true, "ajai_myname_is Different _guid",out b)) { if(!b) { MessageBox.Show("An Instance Already Runnig!","Error", MessageBoxButtons.OK,MessageBoxIcon.Stop); return; }    Console.WriteLine("Swapping Primary Button From {0}",System.Windows.Forms. SystemInformation.MouseButtonsSwapped?"Right to Left":"Left to Right");    SwapMouseButton(!System.Windows.Forms.SystemInformation. MouseButtonsSwapped);    Console.WriteLine("Swapped\n\a\a \t \n Developed by Ajai NP"); }} } } --keep posi