August 2008 Entries

Magic Windows Trick: Query and Reset Terminal Sessions

Have you ever tried to remote into a windows machine and couldn't because the machine had exceeded its available sessions? Can't RDP into a machine because there are already 2 active sessions? Want to play party tricks on your friends and wow them with your "techie-ness?!" Say hello to my little friends qwinsta and rwinsta (AKA query session and reset session, respectively) The Disappearing Session Magic Trick Open a command line. Find the computer in your network you want to query. Type this, smile, ......

Inserting into Microsoft SQL Server Database Identity Columns

This came up in a discussion the other day so I thought I would share it. CREATE TABLE dbo.TestIdentity ( ID bigint identity(1,1) --primary key ,[Desc] char(20) ) INSERT INTO dbo.TestIdentity ([Desc]) values ('first') INSERT INTO dbo.TestIdentity ([Desc]) values ('second') SET IDENTITY_INSERT TestIdentity ON --note the identities being inserted INSERT INTO dbo.TestIdentity (ID,[Desc]) values (1200,'id-third') INSERT INTO dbo.TestIdentity (ID,[Desc]) values (1,'id-fourth') -–this works until you set ......

Happy Birthday Randy!

......

Test Driven Success Story Plus Side Effects of Good Design

Once you understand good design and the benefits, you don't go back. One of our projects at work has nearly 800 tests in it (across 5 test projects). The point isn't that we have 100% test coverage (because I doubt we do). The point is that we know how a method behaves when sent empty and null values, and also for nearly every edge case in addition to the happy path. Most of these are 800 tests are logical unit tests. Some are system integration tests (parts of the system working with each other). ......

Continuous Integration Enhancement : The Broken Build Token!

I thought I would post about this because I find myself putting notes about this in comments here and there. One of our team members bought the rabies plush doll from ThinkGeek a little over a month ago. From the site: Most folks never realize how cute microbes can be when expanded 1,000,000 times and then fashioned into cuddly plush. Until now, that is. Keep one on your desktop to remind yourself that there is an "invisible" universe out there filled with very small things that can do incredible ......

.NET Framework 3.5 SP1: No More Need for CasPol on Network Shares

http://www.infoq.com/news/2... In the past, one could not run managed code from network shares due to security reasons. That feature was introduced in .NET from the beginning to prevent security attacks coming from network locations. The feature did not resolve the respective security threats because unmanaged code always was allowed to run in such a circumstance. A pool organized by Brad Adams, Program Manager at Microsoft, shows that many people would like to have ......

Calling PowerShell Functions with Parameters

This threw me for a loop today. You can't call a PowerShell function with commas "," or parentheses "()" and have it believe it goes to both parameters. Try running the following and see what your output is on every line call to "foo." function foo([string]$a, [string]$b) { Write-Host "a:", $a, " b:", $b } foo("A", "B") foo "A", "B" foo "A" "B" foo("A", "B") "C" rm function:/foo You may find you get different results than you may first expect. I did. Reference: http://weblogs.asp.net/soev... ......

TFS 2005 Team Build Error: Referenced Assembly Missing (Not In Build Folder)

You may run into this at some point. TFS Team Build may not deploy some assembly file you needed. If you look through the logs, you will see something like this (cleaned up for readability): C:\WINDOWS\Microsoft.NET\Fr... /noconfig /optionstrict+ /rootnamespace:Company.Proj... /doc:obj\Release\Company.Pr... /define:"CONFIG=\"Release\"... /reference:..\libs\Castle\C... ..\libs\Castle\Castle.Dynam... ......

Possible Performance Counter Corruption Or Performance Counters are Just Disabled | SQL Server 2008 Installation Errors

If you are installing SQL Server 2008 (or anything for that matter) and it won't let you continue for the following reason: Rule "Performance counter registry hive consistency check" failed. The performance counter registry hive is corrupted. What does this mean? This may mean that the value in HKEY_LOCAL_MACHINE\SOFTWARE... NT\CurrentVersion\Perflib under Last Counter and the last number value in Counter under HKEY_LOCAL_MACHINE\SOFTWARE... NT\CurrentVersion\Perflib\009 ......

Always Use Nullables for Dates Follow-up

I have always wondered why you can't have an "empty" date in VB and C#. I had some good feedback on my recent post on nullable dates and I wanted to clarify why I think nullables are great for dates. The point I am trying to get across is that with dates, in a business sense, you either have a date or you don't. You never really have a 01/01/0001. Using 01/01/0001 or 01/01/1753 is a hack for lack of being able to say that you have an empty date. I am going to make a quick comment on strings. Strings ......

SQL Server 2008 Ready - VS2008 SP1 Coming Aug11

On MSDN you are greeted with this: The fun begins: Thanks Steve ......

Always use Nullables for Dates: C# and VB.NET

Always use Nullables for dates at the least. Trust me on this. I dogged Nullables for the longest time because I thought they were buggy, then I realized today when testing that I was using them wrong. Nullables allow you to actually have null values, which for dates is arguably a must. Why? Keep reading... Tip: Never call Nullable.Value. The nullable item will error out if it is a null value. This is where I was going wrong and thought they were buggy. Just call the nullable item and it will return ......

Why I Need to Keep Up With My Google Reader

Oren posts faster than I can read. I give him 16 days and he gives me 56 unread posts! Has no one found him a girlfriend yet? :D ......

How Did I Get Started Programming?

How old were you when you started programming? Well, most people don't know that I am still kind of new to computers. I grew up poor and my first experience with computers was in high school (Apple IIs and Craptastic Macs). I almost failed keyboarding class in 7th grade (required a minimum of 27 WPM with less than 4 errors/minute). I actually didn't own a computer until I was in my second semester of college. It was a Gateway and it broke so much I got good at fixing computers. That was 1998. I have ......

Drunk Driving

Say you're too s--tfaced to drive and you pass the keys off to your friend.  Your friend has been drinking but you don't know what state they are in.  You allow them to make the decision to drive or not.  If they decide to drive, is it your fault at all if they drive drunk?  Does giving the keys to your friend (because you are too drunk) give you any responsibility in the drunk driving?