Thursday, February 14, 2008

beware a Deleted flag on tables

some of our tables have a 'Deleted' flag, and a row cannot be considered to really be in a table unless the Deleted flag = 0. this means your joins will always have something like "t1.Id = t2.Id AND t1.Deleted = 0".

the design goal here was to keep some historical record of changes without the hassle of a history table, but it was really a bad idea since it’s way too easy to forget about when writing queries, and all indexes are irrelevant unless they start with the Deleted bit...

Thursday, February 7, 2008

vista shadow copies just saved me

vista keeps shadow copies of files and folders when it creates its daily restore points. so if you delete something accidentally, right-click on the folder and go to the “Previous Versions” tab; you can browse through the contents of the folder as it existed at the last restore point. there’s no fancy gui and you only get the last 2 restore points, but it got the job done--

Monday, February 4, 2008

chaining the C# ?? Operator

?? operator was news to me, Rick Stahl's blog is great: http://www.west-wind.com/weblog/posts/236298.aspx. snippet:

string value1 = null;
string value2 = "Test1";
string result = value1 != null ? value1 : value2;

which causes result containing Test1 or the second value.

In C# you can shortcut this special null comparison case with the new ??:

string result = value1 ?? value2;

Friday, January 25, 2008

debug .net library code

msft released the code to a whole bunch of .net libraries last week, Shawn Burke details the steps to take to see it:

http://blogs.msdn.com/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx

Friday, December 21, 2007

helpful sql perf queries

Ian Strike has a very interesting article on some of the perf stats that sql2005 automatically maintains:

http://msdn.microsoft.com/msdnmag/issues/08/01/SqlDmvs/default.aspx

Thursday, November 1, 2007

sourcevault DOES do unicode diffs

not sure how i missed this, but in the Diff window, go to Tools…Options… then in ‘Character Encodings’ section, pick UNICODE. when you refresh the diff, it’s happy--