Wednesday, December 17, 2008

The Great Ice Storm of 2008

This is probably one of thousands of blogs noting that without the modern convenience of electricity life is a bit unusual.

We lost power last Thursday night and won't see it again until this coming Saturday at the earliest.  So far, it's five days without power and counting...

It's cold and snowy with major snow storms forecast for this coming Friday and Sunday.   This seems likely to add major delays to the power company estimates of when repairs will be complete.

However, I count my blessings for friends and neighbors willing to lend a hand.  We've had someplace warm to sleep every night, a borrowed wood stove to keep the pipes in the house from freezing and with any luck we'll have a generator up and running this evening.

Friday, October 17, 2008

Enabling disabled performance counters

Recently I wanted to use Performance Monitor to monitor the memory usage of a program while it was under stress.   However, when I opened up perfmon and attempted to add performance counters this is what I encountered:

snap

It appears that there are no performance counters available.

After a bit of searching I came up with this solution:

  1. Run regedit
  2. Go to this key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib
  3. Set the "Disable Performance Counters" REG_DWORD value to zero.

Thursday, September 25, 2008

Shrink the size of the VMWare guest desktop icons

I use VMWare on a daily basis to debug basis.   While my host OS is run with two monitors set at their highest resolution, I typically run the guest OS at 800x600.  This way, the guest OS only occupies part of one of the host monitors making it easy to drag and drop files from the host onto the guest desktop.

As a result of all this dragging and dropping from the host, the desktop of my guest OS is typically littered with icons for test applications, utilities etc.  Unfortunately, with a Windows Vista guest the icons can be rather large and rapidly fill the available area.

Recently, there was a post on The Old New Thing blog that provided a solution to my problem.    The post describes two ways to change the size of the desktop icons on Windows Vista:

  • Click on the desktop, then hold the Control key while rotating the mouse wheel.
  • Right-click on the desktop and choose an icon size from the View menu.

For Windows Vista guests, at least, I can just scroll down the size of the icons to a size appropriate to an 800x600 desktop.  Problem solved!

Wednesday, September 17, 2008

VMWare Shared Folders and Sysinternals FileMon

I use VMWare on a daily basis to develop, test and debug.  I also use tools from the Sysinterals suite on nearly a daily basis.  Today, I ran into a gotcha with respect to VMWare shared folders and Sysinternals Filemon.

If you open a file using the shared folders UNC path (as describe here) FileMon won't see the file operations.  Fortunately, the more recently updated Sysinternals Process Monitor behaves as expected.

Tuesday, September 16, 2008

Sysinternals Live is Live

I have no idea how long this has been available but today when I was updating my Sysinternals suite on my development system I noticed the following on the Sysinternals home page:

Sysinternals Live

Sysinternals Live is a service that enables you to execute Sysinternals tools directly from the Web without hunting for and manually downloading them. Simply enter a tool’s Sysinternals Live path into Windows Explorer or a command prompt as http://live.sysinternals.com/<toolname> or  \\live.sysinternals.com\tools\<toolname>.

You can view the entire Sysinternals Live tools directory in a browser at http://live.sysinternals.com.

This certainly wouldn't be the way one would choose to run ProcMon on a daily basis but in a pinch if you're debugging an issue on a test machine it's certainly useful.

Friday, September 12, 2008

Debugging a Service on Vista with VMWare Virtual Debugger

Note to self about using the VMWare Visual Studio Integrated Virtual Debugger to attach to a service running on a VMWare Vista guest OS --

If you get the message similar to "Failed to attach to process" as below:

FailedToAttach

Don't forget to do the following in the Vista guest OS:

  1. Turn off firewall
  2. Add logged in user to Administrators group
  3. Disable User Account Control (UAC) by clicking "User Accounts" on the Control Panel, typing "user" in the search box and then clicking "Turn User  Account Control (UAC) on or off".

Fool me once shame on you Vista, fool me twice  shame on me -- I should have written this down the first time!

Thursday, September 11, 2008

Taxonomy of Exceptions

Eric Lippert offers an interesting taxonomy of exceptions:

Fatal exceptions are not your fault, you cannot prevent them, and you cannot sensibly clean up from them.  [...]

Boneheaded exceptions are your own darn fault, you could have prevented them and therefore they are bugs in your code. [...]

Vexing exceptions are the result of unfortunate design decisions.  [...]

And finally, exogenous exceptions [...] are the result of untidy external realities impinging upon your beautiful, crisp program logic.

When I worked on DevPartner Fault Simulator (now unfortunately discontinued) we dealt with understanding these kinds of exceptions both in code Fault Simulator analyzed and in our own code.

As Eric points out,  writing good error handling code is hard in any language, whether you have exception handling or not.  I see far to much code that either simply ignores return values or overly aggressively catches exceptions.  Eric's taxonomy is a useful way to think about how your code should handle (or not) error conditions.

Wednesday, September 10, 2008

Go Large Hadron Collider, Go!

I've got to say, I think today's Google homepage image is awesome!

Friday, March 21, 2008

The First Rule of Programming : It's Always Your Fault -- A Corollary

Jeff Atwood, on the CodingHorror blog, recently posted about taking ownership of your code by way of always assuming a problem is your fault:

No matter what the problem is with your software-- maybe it's not even your code in the first place-- always assume the problem is in your code and act accordingly. If you're going to subject the world to your software, take full responsibility for its failures. Even if, technically speaking, you don't have to.

I'll add just one more bit of advice:

Assume that it's the last thing you changed that caused the problem.

(Source control systems make it relatively easy to find the breaking change by allowing you to progressively fetch earlier versions of the source code.  I usually employ a binary search technique that lets me close in on the breaking change pretty quickly.)

Friday, February 22, 2008

MIDL error: 'annotation'

Recently, after upgrading Visual Studio 2005 Professional to Visual Studio 2005 Team Suite (1) I received these errors when building:

unknwn.idl(108) : error MIDL2025 : syntax error : expecting ] or , near "annotation"
unknwn.idl(108) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation

This post has some advice that I suppose would have worked.  However, I found that opening the SDK command prompt and running 'vcintegrate' worked just as well.

Follow these steps:

  1. Start->All Programs->Windows SDK->CMD Shell
  2. cd setup
  3. vcintegrate -i

-----------------------------------------

(1) I just installed the latter over the former.  Perhaps I should have uninstalled Visual  Studio 2005 Professional first.

Thursday, February 21, 2008

Programming Language Cheat Sheets

Here's a really useful thing -- a list of cheat sheets for various programming languages like C++, C#, Ruby, etc. I only which there was a cheat sheet for F#.

Thursday, January 17, 2008

"The Invention of Hugo Cabret" Wins 2008 Caldecott Award

I just saw this:

hugocabretsmallCaldecott_Honor_Seal 

This is an excellent book and certainly deserves this award.

.NET Framework Library Source Code Available

This, of course is all over the Microsoft blogs. One tidbit that's buried in Shawne's post that you should pay attention to and was a "gotcha" for me:

I also use Microsoft Symbol Server to download symbols. What's the difference? Can these two programs co-exist?

Microsoft Symbol Server provides symbols without any source information in them. That information has been removed (sometimes referred to as "stripped") before publishing. The symbols provided on the Reference Source Server are full symbols with debugging information.

The key to using both is to have your Reference Source path above the Symbol Server Path so that those symbols are searched/found first. As described in the ADVANCED USERS section above, you'll likely want to launch your debugger once with this configuration to get all the symbols downloaded, then uncheck both of these paths to avoid debugging launch slowdowns in the future. Also note that this may conflict in the future as more DLLs are added to the Reference Source Project. Meaning, if you've already downloaded the Symbol Server symbol, you'll need to delete that or change your cache path to get the Reference Source one (Visual Studio has no way of knowing which is which).

See the remaining FAQ/TROUBLESHOOTING section for more useful tidbits.