Monday, July 28, 2008

catching and ignoring an exception

if you want to catch an exception and ignore it, do this to avoid the compiler warning:

catch
{
//do nothing
}

instead of:

catch (Exception ex)
{
//do nothing
}

you can similarly catch exceptions of a certain type without assigning a variable to them, for example:

catch (ArgumentException)
{
//do nothing
}

instead of:

catch (ArgumentException ex)
{
//do nothing
}

Friday, July 25, 2008

if you ever get locked out of your own database...

if you set your default database, and then you kill that database, you might end up locked out of sql server entirely. if so, do this:

- open admin command prompt

- run this: sqlcmd –E -S YOURCOMPUTERNAME –d master

o alter login [DOMAIN\USERNAME] with default_database = master
o go

Tuesday, July 22, 2008

copy and paste files when remote desktop'ing

something i’ve wanted for a long time, not sure if this is new with the Vista version of RDP (6.0) but it’s very easy to setup:

- click ‘Options >>’ button after you run Remote Desktop

- go to the ‘Local Resources’ tab and click ‘More…’ button

- check one of your drives

two things will happen: you’ll see the drive you picked listed as a drive on the remote computer’s list of drives, and you’ll be able to copy files to the clipboard on the remote computer and paste them locally--

Friday, July 18, 2008

when logging exceptions, use Exception.ToString()

this will get you error type, message, and stacktrace, not only for the Exception but also for its InnerException if there is one--

Friday, July 11, 2008

josh smith's wpf binding article in this month's msdn magazine

http://msdn.microsoft.com/en-us/magazine/cc700358.aspx

a couple of things new to me:

- the way he uses IsSynchronizedWithCurrentItem and nested, hierarchical bindings like {Binding Path=CurrentItem.Orders.CurrentItem.OrderDetails}

- the capabilities of the .NET 3.5 validators (implementing validation logic in code using System.ComponentModel.IDataErrorInfo)

also check out how smoothly he binds an object hierarchy to a treeview, good stuff--

Thursday, July 10, 2008

error adding service reference to silverlight 2 app

if you run into problems adding a service reference to a sl2b2 app, it’s likely due to a sl2b2 install bug that manifests itself if you installed with certain pre-conditions. to fix it:

-----
(from http://silverlight.net/forums/t/17500.aspx)

First check your Silverlight Tools for VS 2008 install size on Add/Remove Programs window. If it is 1.14 MB, then you need to do the following:

1) Uninstall your Silverlight Tools for VS 2008,

2) Remove (delete) the following dll C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Microsoft.VisualStudio.ServicesProxy.dll

3) Re-Install Silverlight Tools for VS 2008.

-----