I found the quickest way to kill the processes of SQL Server.
USE master;
GO
ALTER DATABASE AdventureWorks
SET SINGLE_USER
WITH ROLLBACK IMMEDIATE;
ALTER DATABASE AdventureWorks
SET MULTI_USER;
GO
Running above script will give following result.
Nonqualified transactions are being rolled back. Estimated rollback completion: 100%.
Welcome to the world of e Gyan.This is an attempt to put together and share the vast and vivid knowledge.The focus will be on sharing of our knowledge on- Latest tools and techniques.etc.So, go ahead and share the Gyan.
Thursday, February 10, 2011
Advanced Query Tool
Cross-database query and admin tool. Powerful, fast, inexpensive.
www.querytool.com
www.querytool.com
SQL Good Practices
1)Avoid use of SELECT * in SQL queries. Instead practice writing required column names after SELECT statement.
Example:
SELECT Username, Password
FROM UserDetails
2)Avoid using temporary tables and derived tables as it uses more disks I/O. Instead use CTE (Common Table Expression); its scope is limited to the next statement in SQL query.
3)Use SET NOCOUNT ON at the beginning of SQL Batches, Stored Procedures and Triggers. This improves the performance of Stored Procedure.
4)Practice using PRIMARY key in WHERE condition of UPDATE or DELETE statements as this will avoid error possibilities.
5)Instead of using LOOP to insert data from Table B to Table A, try to use SELECT statement with INSERT statement.
INSERT INTO TABLE A (column1, column2)
SELECT column1, column2
FROM TABLE B
WHERE ....
6)Do not use the RECOMPILE option for Stored Procedure as it reduces the performance.
7)Always put the DECLARE statements at the starting of the code in the stored procedure. This will make the query optimizer to reuse query plans.
8)Put the SET statements in beginning (after DECLARE) before executing code in the stored procedure.
9)Use BEGIN…END blocks only when multiple statements are present within a conditional code segment.
Example:
SELECT Username, Password
FROM UserDetails
2)Avoid using temporary tables and derived tables as it uses more disks I/O. Instead use CTE (Common Table Expression); its scope is limited to the next statement in SQL query.
3)Use SET NOCOUNT ON at the beginning of SQL Batches, Stored Procedures and Triggers. This improves the performance of Stored Procedure.
4)Practice using PRIMARY key in WHERE condition of UPDATE or DELETE statements as this will avoid error possibilities.
5)Instead of using LOOP to insert data from Table B to Table A, try to use SELECT statement with INSERT statement.
INSERT INTO TABLE A (column1, column2)
SELECT column1, column2
FROM TABLE B
WHERE ....
6)Do not use the RECOMPILE option for Stored Procedure as it reduces the performance.
7)Always put the DECLARE statements at the starting of the code in the stored procedure. This will make the query optimizer to reuse query plans.
8)Put the SET statements in beginning (after DECLARE) before executing code in the stored procedure.
9)Use BEGIN…END blocks only when multiple statements are present within a conditional code segment.
Database Comparator
Compare and Synchronize schema and data of SQL Server quickly
www.devart.com
www.devart.com
10 Commandments for C Programming
10 Commandments for C Programming by Henry Spencer
(Dated but still relevant advice on C Programming)
http://cplus.about.com/od/learningc/a/10-commandments.htm
(Dated but still relevant advice on C Programming)
http://cplus.about.com/od/learningc/a/10-commandments.htm
Use of DEBUG_NEW in C++
What's the functionality of DEBUG_NEW ?
It implements the ability of the debugger to be able to track the line number and file name of where any memory leaks were allocated.
•DEBUG_NEW
It implements the ability of the debugger to be able to track the line number and file name of where any memory leaks were allocated.
•DEBUG_NEW
Interview Questions
1)++i=i++ and i++=++i
2)Features of OOPS
3)Initilizaion List in C++
4)Types of Constructors
5)return type of constructor
6)copy constructor and assignment opertrator
7)Explicit constructor
8)Mutable keyword
9)Use of extern
10)Casting Dynamic cast and static cast
11)difference in mutable and static cast
12)Type of overloading
13)Virtual function
14)use of VTable
15)Abstract Class
16)destructor be virtual?
17)volatile qualifier
18) SafeArrays
19)Object Slicing
20)Polymorphic class
21)A persistent varible
22) Size of class with declaration of virtual function and without declaration of any function
23) #Pragma
24)Inline and Macro
2)Features of OOPS
3)Initilizaion List in C++
4)Types of Constructors
5)return type of constructor
6)copy constructor and assignment opertrator
7)Explicit constructor
8)Mutable keyword
9)Use of extern
10)Casting Dynamic cast and static cast
11)difference in mutable and static cast
12)Type of overloading
13)Virtual function
14)use of VTable
15)Abstract Class
16)destructor be virtual?
17)volatile qualifier
18) SafeArrays
19)Object Slicing
20)Polymorphic class
21)A persistent varible
22) Size of class with declaration of virtual function and without declaration of any function
23) #Pragma
24)Inline and Macro
Wednesday, February 9, 2011
System Tools
Sysntem tool Like procexp and tcpview some more Usefull Tools...
Here is where we can get them,
http://technet.microsoft.com/en-us/sysinternals/default.aspx
Here is where we can get them,
http://technet.microsoft.com/en-us/sysinternals/default.aspx
C++: Some online references
Here are some useful links.
http://www.cplusplus.com/
http://www.cprogramming.com/
http://www.mycplus.com/
http://www.relisoft.com/cpp.html
http://c-faq.com/
http://www.cplusplus.com/
http://www.cprogramming.com/
http://www.mycplus.com/
http://www.relisoft.com/cpp.html
http://c-faq.com/
Detecting memory leaks in C++
References from C++ Professionals group on LinkedIn.
http://www.research.att.com/~bs/bs_faq2.html#memory-leaks
http://www.boost.org/doc/libs/1_40_0/libs/smart_ptr/smart_ptr.htm
http://www.hpl.hp.com/personal/Hans_Boehm/gc/
http://www.flipcode.com/archives/Presenting_A_Memory_Manager.shtml
http://duma.sourceforge.net/
http://www.andreasen.org/LeakTracer/
http://perens.com/FreeSoftware/ElectricFence/
http://valgrind.org/
http://www.research.att.com/~bs/bs_faq2.html#memory-leaks
http://www.boost.org/doc/libs/1_40_0/libs/smart_ptr/smart_ptr.htm
http://www.hpl.hp.com/personal/Hans_Boehm/gc/
http://www.flipcode.com/archives/Presenting_A_Memory_Manager.shtml
http://duma.sourceforge.net/
http://www.andreasen.org/LeakTracer/
http://perens.com/FreeSoftware/ElectricFence/
http://valgrind.org/
Unit testing native (C/C++) code on Windows
"WinUnit offers a unique approach to unit testing native (C/C++) code on Windows."
http://winunit.codeplex.com/
http://winunit.codeplex.com/
Enum in C++
enum name {name-list} var-list;
The enum keyword is used to create an enumerated type named name that consists of the elements in name-list. The var-list argument is optional, and can be used to create instances of the type along with the declaration. For example, the following code creates an enumerated type for colors:
enum ColorT {red, orange, yellow, green, blue, indigo, violet};
...
ColorT c1 = indigo;
if( c1 == indigo ) {
cout << "c1 is indigo" << endl;
}
In the above example, the effect of the enumeration is to introduce several new constants named red, orange, yellow, etc. By default, these constants are assigned consecutive integer values starting at zero. You can change the values of those constants, as shown by the next example:
enum ColorT { red = 10, blue = 15, green };
...
ColorT c = green;
cout << "c is " << c << endl;
When executed, the above code will display the following output: c is 16
The enum keyword is used to create an enumerated type named name that consists of the elements in name-list. The var-list argument is optional, and can be used to create instances of the type along with the declaration. For example, the following code creates an enumerated type for colors:
enum ColorT {red, orange, yellow, green, blue, indigo, violet};
...
ColorT c1 = indigo;
if( c1 == indigo ) {
cout << "c1 is indigo" << endl;
}
In the above example, the effect of the enumeration is to introduce several new constants named red, orange, yellow, etc. By default, these constants are assigned consecutive integer values starting at zero. You can change the values of those constants, as shown by the next example:
enum ColorT { red = 10, blue = 15, green };
...
ColorT c = green;
cout << "c is " << c << endl;
When executed, the above code will display the following output: c is 16
C++ Programming Style
Must read these,
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
http://geosoft.no/development/cppstyle.html
http://www.chris-lott.org/resources/cstyle/
http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
http://geosoft.no/development/cppstyle.html
http://www.chris-lott.org/resources/cstyle/
Design Patterns references
Came across this references while searching for design patterns with C++
http://www.codeguru.com/forum/showthread.php?t=327982
http://www.vincehuston.org/dp/
http://www.codeguru.com/forum/showthread.php?t=327982
http://www.vincehuston.org/dp/
FAQ: C/C++
What are Guard bytes ?
malloc_dbg calls malloc, but requests a few more bytes. These bytes are filled with a predefined value. free_dbg then checks if these extra bytes still hold this value. If they did, you probably wrote beyond the allocated memory (the VC Runtime prints a diagnostic message to the debug output). Typical implementations add 4 bytes at the end.In this case, using free instead of _free_dbg is often not a problem, but depending on the implementation, it might leak the guard bytes. But if an implementation adds guard bytes *before* the memory provided to you (to detect underflows, which are less common), using free instead of -free_dbg is likely to corrupt the heap.
Difference Between WinSock 1.1 and WinSock 2 ?
One of the most important new features is official support for multiple transport protocols. Although Winsock 1.1 was not actually limited to TCP/IP, that was the only protocol that had official support written into the spec. There was no standard way for a vendor to add support for another transport protocol.
Winsock 2 also adds support for technical initiatives like quality of service (QoS) and multicasting. These technologies will become increasingly important as bandwidth requirements become more regimented and intense. For example, QoS allows a videoconferencing program to reserve a certain amount of bandwidth so that a sudden file transfer.
Winsock 2 also allows for "Layered Service Providers." This enables many neat things, such as security plug-ins: drop in, say, an SSL service provider, and all of a sudden your data is automatically encrypted.
What is #Pragmas?
#Pragmas can be used in conditional statements, to provide new preprocessor functionality, or to provide implementation-defined information to the compiler. If the compiler finds a pragmas it does not recognize, it issues a warning, but compilation continues. Some pragmas provide the same functionality as compiler options. When a pragmas is encountered in source code, it overrides the behavior specified by the compiler option.
#pragma once : Used to Compile one time…..Specifies that the file will be included (opened) only once by the compiler when compiling a source code file.
What is Structure Alignment?
Structure Alignment is same as memory padding in structure, add 2 byte for each member for alignment. At the heart of document/view are four key classes:
Q: What are dependent names?
A: Dependent names are names whose definitions are considered to depend upon the template parameters and for which there is no declaration within the template definition. They are resolved only when the template is instantiated. Those that are intended to refer to types or templates may require disambiguation. If the resolution of a dependent function name uses argument-dependent lookup, declarations in the arguments' namespaces that are visible at the point of instantiation will be considered as well as declarations visible at the point of definition. (The former is normally a superset of the latter, but may not be.)
Q: What are non-dependent names?
A: Non-dependent names are those names that are considered not to depend upon the template parameters, plus the name of the template itself and names declared within it (members, friends and local variables). They are resolved when the template is defined, in the normal way, and do not require disambiguation.
Q: Is there a difference between a function template and a template function, or between a class template and a template class?
A: The term "function template" refers to a kind of template. The term "template function" is sometimes used to mean the same thing, and sometimes to mean a function instantiated from a function template. This ambiguity is best avoided by using "function template" for the former and something like "function template instance" or "instance of a function template" for the latter. Note that a function template is not a function. The same distinction applies to "class template" versus "template class".
What is Object Slicing?
Suppose that class D is derived from class C. We can think of D as class C with some extra data and methods. In terms of data, D has all the data that C has, and possible more. In terms of methods, D cannot hide any methods of C, and may have additional methods. In terms of existing methods of C, the only thing that D can do is to override them with its own versions.
If x is an object of class D, then we can slice x with respect to C, by throwing away all of the extensions that made x a D, and keeping only the C part. The result of the slicing is always an object of class C.
What is the difference between GetMessage and PeekMessage?
The major difference between the two is that GetMessage() doesn't return until it finds a message to retrieve from the Application Queue, this allows us to free up precious CPU usage for other programs to use. PeekMessage() returns immediately weather there are any messages or not, this allows us to utilize the time between messages, for example to render a 3D scene.
How to handle command line arguements from simple MFC application ?
Using GetCommandLineArgs() function you can get the arguments in MFC application at any time. In InitInstance () function you can change the behaviour of the application using those values.
malloc_dbg calls malloc, but requests a few more bytes. These bytes are filled with a predefined value. free_dbg then checks if these extra bytes still hold this value. If they did, you probably wrote beyond the allocated memory (the VC Runtime prints a diagnostic message to the debug output). Typical implementations add 4 bytes at the end.In this case, using free instead of _free_dbg is often not a problem, but depending on the implementation, it might leak the guard bytes. But if an implementation adds guard bytes *before* the memory provided to you (to detect underflows, which are less common), using free instead of -free_dbg is likely to corrupt the heap.
Difference Between WinSock 1.1 and WinSock 2 ?
One of the most important new features is official support for multiple transport protocols. Although Winsock 1.1 was not actually limited to TCP/IP, that was the only protocol that had official support written into the spec. There was no standard way for a vendor to add support for another transport protocol.
Winsock 2 also adds support for technical initiatives like quality of service (QoS) and multicasting. These technologies will become increasingly important as bandwidth requirements become more regimented and intense. For example, QoS allows a videoconferencing program to reserve a certain amount of bandwidth so that a sudden file transfer.
Winsock 2 also allows for "Layered Service Providers." This enables many neat things, such as security plug-ins: drop in, say, an SSL service provider, and all of a sudden your data is automatically encrypted.
What is #Pragmas?
#Pragmas can be used in conditional statements, to provide new preprocessor functionality, or to provide implementation-defined information to the compiler. If the compiler finds a pragmas it does not recognize, it issues a warning, but compilation continues. Some pragmas provide the same functionality as compiler options. When a pragmas is encountered in source code, it overrides the behavior specified by the compiler option.
#pragma once : Used to Compile one time…..Specifies that the file will be included (opened) only once by the compiler when compiling a source code file.
What is Structure Alignment?
Structure Alignment is same as memory padding in structure, add 2 byte for each member for alignment. At the heart of document/view are four key classes:
Q: What are dependent names?
A: Dependent names are names whose definitions are considered to depend upon the template parameters and for which there is no declaration within the template definition. They are resolved only when the template is instantiated. Those that are intended to refer to types or templates may require disambiguation. If the resolution of a dependent function name uses argument-dependent lookup, declarations in the arguments' namespaces that are visible at the point of instantiation will be considered as well as declarations visible at the point of definition. (The former is normally a superset of the latter, but may not be.)
Q: What are non-dependent names?
A: Non-dependent names are those names that are considered not to depend upon the template parameters, plus the name of the template itself and names declared within it (members, friends and local variables). They are resolved when the template is defined, in the normal way, and do not require disambiguation.
Q: Is there a difference between a function template and a template function, or between a class template and a template class?
A: The term "function template" refers to a kind of template. The term "template function" is sometimes used to mean the same thing, and sometimes to mean a function instantiated from a function template. This ambiguity is best avoided by using "function template" for the former and something like "function template instance" or "instance of a function template" for the latter. Note that a function template is not a function. The same distinction applies to "class template" versus "template class".
What is Object Slicing?
Suppose that class D is derived from class C. We can think of D as class C with some extra data and methods. In terms of data, D has all the data that C has, and possible more. In terms of methods, D cannot hide any methods of C, and may have additional methods. In terms of existing methods of C, the only thing that D can do is to override them with its own versions.
If x is an object of class D, then we can slice x with respect to C, by throwing away all of the extensions that made x a D, and keeping only the C part. The result of the slicing is always an object of class C.
What is the difference between GetMessage and PeekMessage?
The major difference between the two is that GetMessage() doesn't return until it finds a message to retrieve from the Application Queue, this allows us to free up precious CPU usage for other programs to use. PeekMessage() returns immediately weather there are any messages or not, this allows us to utilize the time between messages, for example to render a 3D scene.
How to handle command line arguements from simple MFC application ?
Using GetCommandLineArgs() function you can get the arguments in MFC application at any time. In InitInstance () function you can change the behaviour of the application using those values.
Subscribe to:
Posts (Atom)