## How to pronounce symbols on keyboard?

21-11-2013

copied from here

~ “tilde” or “tweedle” or “squiggly line”. Also used as a “swung dash” and in mathematics with other signs to mean “approximately” and in logic sometimes used to mean “not”. See Tilde on wiki

 “grave accent” or “stress mark”. See http://en.wikipedia.org/wiki/Grave_accen… .

! “exclamation point” or “exclamation mark’. Used to end an emphatic sentence. Also often used in computer languages to mean “not” and in mathematics to indicate “factorial’. See Exclamation on wiki.

@ “at sign” or “commercial at sign”. See it on wiki.

# “number sign” or “pound sign’ or “octothorpe” or “hash mark”

$ “dollar sign”, for example$29.00 would be read as “twenty-nine dollars’

## Differences between StoredProcedure and UDF

01-09-2013

The differences between Stored Procedure (SP) and User Defined Functions (UDF) in MSSQL

Ability SP UDF
Return Values Can return zero, single or multiple values Mandatory to return one and only one value
Can use transaction Yes No
Can have input/output parameters Both Input parameters only
Interop Can call functions from SP Cannot call SP from function
Can be used in SELECT WHERE HAVING statement No Yes
Exception Handling Yes, can Try-Catch NO

Written with StackEdit.

## Extract SQL Query From Linq Expression

08-08-2013

##How to Extract sql query from LINQ expressions?

###GetCommand You can use the DataContext.GetCommand method to get the generated SQL:

var query = dataContext.Persons.Where(p => p.Name == "Alice");
string generatedSql = dataContext.GetCommand(query).CommandText;


###Display in VisualStudio Output Window Redirect/set the DataContext’s log to Console.Out. Then we can see the SQL statements in the VisualStudio’s output window when the query gets executed.

dataContext.Log = Console.Out;
var query = dataContext.Persons.Where(p => p.Name == "Alice");
var persons = query.ToList();


Written with StackEdit.

## Insert Value for Identity Column in MSSQL

05-08-2013

##Turn on IDENTITY_INSERT

Sometimes we want to copy a table that contains an identity column from another one exactly with the id column’s values kept, e.g. Migration, Recovering from a backup table. In this case we need to turn on the IDENTITY_INSERT, which enables the ability to insert specific values into the target table. And after inserted we should turn it off to bring the behaviour back to normal.

The following commands work on MSSQLServer.

# to turn on
SET IDENTITY_INSERT YourTableName ON
# to turn off
SET IDENTITY_INSERT YourTableName OFF


Written with StackEdit.

## ElementName As Source Of Content Menu Command Binding

26-05-2013

ElementName As Source Of Content Menu Command Binding

We can’t bind using ElementName for a context menu command binding as popups` are not on the visual tree, thus not able to find the element by its name. But we can workaround it using a couple of tricks though…

1. Use RoutedUICommands with a command binding on the UserControl, then no binding is needed.
2. Use the placement target binding on the context menu’s DataContext. This allows you to at least get the data context of the element the context menu appears on to the context menu.

DataContext=”{Binding RelativeSource={RelativeSource Mode=Self}, Path=PlacementTarget.DataContext}”.

3. Use [ElementSpy][1] to link to the window using a static resource so we can then use a defacto ElementName bindings.

Copied and modified from here

Written with StackEdit.