Geeks With Blogs
Dave Chestnutt: SparklingCode and CodeGaffes Writing better code; for fun and profit February 2006 Entries
Visual Studio and Perforce: Suppress the Open Connection dialog
We've used Perforce source control for a number of years. It's a great tool and it integrates with Visual Studio pretty well. But its Visual Studio integration has one really annoying feature, that fortunately, you can work around. The feature is this: If your solution has 10 projects in it, you can put each of those 10 projects in a separate Perforce Depot. Is that useful? I'll leave that to you. Suffice it to say that we put all our source in one Depot. The problem comes when you reload a solution. ......

Posted On Tuesday, February 28, 2006 2:14 PM

Visual Studio: Macro to automatically collapse the projects in the Solution Explorer
One of the pains of working with Visual Studio is that the Solution Explorer, in a large project, is hard to use. As you open more and more files, it gets harder to navigate in the solution explorer since it opens all the projects for you. Edwin Evans wrote a nice short macro to collapse all the projects. It works with both 2003 and 2005. Assign it to a button your toolbar and give it the smiley face ......

Posted On Tuesday, February 21, 2006 3:02 PM

CodeGaffe: Really Private Data
Today's CodeGaffe is something I see all the time. It creeps into your code over time. Here's the scenario: Your class has grown from its humble beginnings, and there are now fields in your class that should not be used by some of your methods. In essence, you want some of your data to be private from part of your class. As in "really private". If you've ever found yourself thinking, "Most of this class shouldn't access field foo,” then you've experienced this. Here's an example I ran across recently ......

Posted On Thursday, February 16, 2006 8:10 PM

CodeGaffe: Surprising Assignments
This CodeGaffe covers two similar problems. The first one involves Booleans, while the second covers any variable type. Here's some code that contains 2 bugs in one line. This is a practice to avoid. Can you spot the 2 bugs? if (m_condition = true) { // *** DON'T DO THIS! // do something} If you had any trouble spotting the problem, that's because you're normal. And if you didn't have any trouble, that's because you were looking for a problem. If you didn't know there was anything wrong with that ......

Posted On Monday, February 6, 2006 5:35 PM

Copyright © Dave Chestnutt | Powered by: