Here is a sample LINQ to SQL query to return all the customers who don't have an order in the Orders table:
var query =
from c in Customers
where !( from o in Orders select o.CustomerId ).Contains( c.CustomerId )
select c;
Wednesday, February 16, 2011
Tuesday, February 8, 2011
Useful Keyboard Shortcuts for Microsoft Visual Studio
Here are some useful keyboard shortcuts for Microsoft Visual Studio:
F5 => Build
CTRL+F5 => Execute
F9 => Breakpoint for debugging
F10 => Single step during debugging
F11 => Get into function or method during debugging
CTRL+K+K => Book Mark
CTRL+K+N => Go to next book mark
CTRL+K+P => Go to previous book mark
CTRL-C => Copy
CTRL-V => Paste
CTRL-X => Cut
CTRL-A => Select All
CTRL-Z => Undo
ALT-TAB => Switch between open programs
CTRL-TAB => Switch between windows in the current program
CTRL-END => Go to the end of the document
CTRL-HOME => Go to the start of the document
END => Go to the end of the line
HOME => Go to the start of the line
SHIFT-END => Select from the current cursor position to the end of the line
SHIFT-HOME => Select from the current cursor position to the start of the line
F4 => Repeat the last action (only works in most Microsoft Office
applications, such as Excel/Visio/ Word, but very powerful in those)
CTRL-SHIFT-RightArrow => Select from the current cursor position to the end of the current word (including space)
CTRL-SHIFT-LeftArrow => Select from the current cursor position to the start of the prior word
CTRL-F => Find (open the Find dialog in many applications)
CTRL-H => Find and Replace (open the Find and Replace dialog in many
applications)
CTRL-SHIFT-UpArrow => Select from the current cursor position to the start of the current line of next line up
CTRL-SHIFT-DownArrow => Select from the current cursor position to the end of the current or next line down
CTRL-G => Go to a specific line number (works in notepad, Visual Studio,
other editing programs)
F5 => Build
CTRL+F5 => Execute
F9 => Breakpoint for debugging
F10 => Single step during debugging
F11 => Get into function or method during debugging
CTRL+K+K => Book Mark
CTRL+K+N => Go to next book mark
CTRL+K+P => Go to previous book mark
CTRL-C => Copy
CTRL-V => Paste
CTRL-X => Cut
CTRL-A => Select All
CTRL-Z => Undo
ALT-TAB => Switch between open programs
CTRL-TAB => Switch between windows in the current program
CTRL-END => Go to the end of the document
CTRL-HOME => Go to the start of the document
END => Go to the end of the line
HOME => Go to the start of the line
SHIFT-END => Select from the current cursor position to the end of the line
SHIFT-HOME => Select from the current cursor position to the start of the line
F4 => Repeat the last action (only works in most Microsoft Office
applications, such as Excel/Visio/ Word, but very powerful in those)
CTRL-SHIFT-RightArrow => Select from the current cursor position to the end of the current word (including space)
CTRL-SHIFT-LeftArrow => Select from the current cursor position to the start of the prior word
CTRL-F => Find (open the Find dialog in many applications)
CTRL-H => Find and Replace (open the Find and Replace dialog in many
applications)
CTRL-SHIFT-UpArrow => Select from the current cursor position to the start of the current line of next line up
CTRL-SHIFT-DownArrow => Select from the current cursor position to the end of the current or next line down
CTRL-G => Go to a specific line number (works in notepad, Visual Studio,
other editing programs)
Firebug for Firefox
Firebug integrates with Firefox to put a wealth of web development tools at your fingertips while you browse. You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page.
Download Firebug from here: http://getfirebug.com/
Download Firebug from here: http://getfirebug.com/
Internet Explorer Developer Toolbar
The Microsoft Internet Explorer Developer Toolbar provides a variety of tools for quickly creating, understanding, and troubleshooting Web pages.
Download the IE Developer Toolbar here: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=95e06cbe-4940-4218-b75d-b8856fced535
Download the IE Developer Toolbar here: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=95e06cbe-4940-4218-b75d-b8856fced535
Tuesday, January 25, 2011
Silverlight error: The debugger cannot continue running the process.
Today I got this error while debugging my silverlight application and the debugger just crashed without any useful error information. I got this error when the debugger crashed:
"The debugger cannot continue running the process. Process was terminated."
After doing some debugging and research I found this thread online where in many people had the same issue because of recursive call in class property:
http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/f9b08dd4-8d20-4104-9a24-9f002caceb48/
I looked at my code and indeed I had a recursive call in one of my property by mistake.
private bool isUser;
public bool IsUser
{
get { return IsUser; }
set
{
IsUser = value;
OnPropertyChanged( "IsUser" );
}
}
As you can see in the above code my getter was recursively referring to IsUser property itself instead of the field isUser. This was just coding error but it took some time to figure out the root cause as the debugger was crashing without proper error information.
"The debugger cannot continue running the process. Process was terminated."
After doing some debugging and research I found this thread online where in many people had the same issue because of recursive call in class property:
http://social.msdn.microsoft.com/Forums/en-US/vsdebug/thread/f9b08dd4-8d20-4104-9a24-9f002caceb48/
I looked at my code and indeed I had a recursive call in one of my property by mistake.
private bool isUser;
public bool IsUser
{
get { return IsUser; }
set
{
IsUser = value;
OnPropertyChanged( "IsUser" );
}
}
As you can see in the above code my getter was recursively referring to IsUser property itself instead of the field isUser. This was just coding error but it took some time to figure out the root cause as the debugger was crashing without proper error information.
Tuesday, October 26, 2010
Date format in WPF/Silverlight
Here is an example for formatting date in WPF (Format: MM/DD/YYYY):
<TextBlock Text="{Binding CreationDate, StringFormat=\{0:MM/dd/yyyy\}}" />
<TextBlock Text="{Binding CreationDate, StringFormat=\{0:MM/dd/yyyy\}}" />
Wednesday, September 22, 2010
Error when referencing assembly from network share - Silverlight 4 (.NET Framework 4.0)
I got this error today when I added reference to an assembly from network share:
"Error 3 Could not load the assembly file://\\CM\libraries\Microsoft\Rx\Reactive Extensions v1.0.2677.0\SL4\System.Observable.dll. This assembly may have been downloaded from the Web. If an assembly has been downloaded from the Web, it is flagged by Windows as being a Web file, even if it resides on the local computer. This may prevent it from being used in your project. You can change this designation by changing the file properties. Only unblock assemblies that you trust".
I am using Silverlight 4 (.NET Framework 4.0).
To fix this issue I added following entry in the Visual Studio 2010 devenv.config file.
< loadFromRemoteSources enabled="true" />
To the runtime section of:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config
"Error 3 Could not load the assembly file://\\CM\libraries\Microsoft\Rx\Reactive Extensions v1.0.2677.0\SL4\System.Observable.dll. This assembly may have been downloaded from the Web. If an assembly has been downloaded from the Web, it is flagged by Windows as being a Web file, even if it resides on the local computer. This may prevent it from being used in your project. You can change this designation by changing the file properties. Only unblock assemblies that you trust".
I am using Silverlight 4 (.NET Framework 4.0).
To fix this issue I added following entry in the Visual Studio 2010 devenv.config file.
< loadFromRemoteSources enabled="true" />
To the runtime section of:
C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe.config
Subscribe to:
Posts (Atom)