Friday, December 21, 2007

Installing Vista Language Packs Take a Long Time

I've been doing some locale testing on Vista and needed to install a language or two. Rather than just install the languages I needed for the test, I decided to choose all the language packes available from Windows Update. Big mistake as it turns out. Unfortunately, I didn't run across this until I'd let the system run overnight (and still not finish).

From now on, I'll take the advice -- install one language at a time.

Thursday, December 6, 2007

Deleting VMWare workstation snapshot faster

VWMare workstation is a product I use everyday in my development activities. I use it to create isolated debugging and testing environments. I tend take many snapshots so that I can easily rollback any changes I've made to the environment. As a result I often end up with a snapshot manager that often looks something like this:


I find that when deleting a snapshot and it's children VMWare often spends a great deal of time "cleaning up deleted files". Recently, however, I noticed that if I "Go to" a snapshot that isn't included in the set of snapshots that I want to delete things go much faster.
So in the example above, if I wanted to delete "snap 3" and its children (that is, "snap 4" and "snap 6", it will be faster to first go to "Snap 1", "Snap 2" or "Snap 5" before the delete.














Wednesday, October 24, 2007

Vista and the "Windows cannot connect to the printer" error message

Several months ago I purchased a new PC with Windows Vista Home Premium. I purchased it mostly to be able to make use of the parental control features of Vista and I'm pretty happy with it from that point of view.

There has been one nagging sticking point however. I couldn't get the Vista system to connect to a printer shared from another computer running Windows XP. From the Printer control panel I selected "Add Printer", clicked on "Add a Network Computer" and then choose the shared printer from the list. This resulted in a "Windows cannot connect to the printer. Access is denied" error message. In printing emergencies I was able to save the documents to the XP systems "Shared Documents" folders and then print it from the XP system but that is less than an ideal solution.

Fortunately, I've found a solution. Rather than choosing "Add a Network Computer", select "Add a local computer". Then click on "Create a new port" and click "Next". In the dialog box that appears enter \\ComputerName\PrinterName where computer name is the name of the computer sharing the printer and printer name is the shared name of the printer. (I found these instructions here).

Note however this won't work if you've already browsed the computer in Explorer to find out the printer name. Apparently, Vista will already create a port with that name and so the steps above will fail. So, be sure to shared the printer from the remote computer and then remember the name so you can type it in.

How to Debug with SOS in Visual Studio

Want to make use of the power of SOS (Son of Strike)? Are you a regular Visual Studio user intimidated by the relatively user unfriendly WinDbg? Tess has a post here to get you started using SOS with Visual Studio. There are also excellent references here and here.

Wednesday, October 17, 2007

How to declare out and ref parameters with managed C++

Lately, I've been using managed C++ quite a bit. Managed C++ would not be my choice for a project of any size but it's really convenient when you need to create a managed wrapper for C++ classes that you have in-hand.

The replacement syntax available with Visual Studio 2005 is much improved over Visual Studio 2003 (which was the last time I attempted to use managed C++ and so certainly isn’t news). However, I did struggle a bit trying to figure out how to declare what would be out and ref parameters in C# using managed C++.

Normally, I might use the most excellent Reflector in these cases. I just code up the construct in C#, load the assembly into Reflector and then choose the target language in the dissembler window. Unfortunately, Reflector only support the /clr:oldSyntax managed C++ syntax. Various Google searches proved unhelpful as well.

Finally, I stumbled upon the syntax for the tracking reference. Combine that with the System::Runtime::InteropServices::OutAttribute and it’s easy:

public ref class ExampleClass
{
public:
void OutParameter([System::Runtime::InteropServices::Out] String^% v);
void ByRefParameter(String^% v);
};

Simple (and unforgettable) once you know!

Tuesday, October 16, 2007

How to Read Performance Counters Without Administrator Privileges

This is mostly as a reminder to myself. Adding the user to the "Performance Monitor Users" groups, logging out and logging back resolve the unauthorized access exception with the PerformanceMonitor class when running on Vista. The BCL team blog has the source post here.

Wednesday, August 8, 2007

I'm Feeling Lucky

Jeff Atwood recently blogged about the Google "I'm Feeling Lucky" button. As a number of other comments to the post pointed out, the button is not terribly useful for general searches. However, it's serves as a great bookmark. I use it most frequently to find Lutz Roeder's most excellent Reflector tool. Just type "reflector", click the "I'm Feeling Lucky" button and I'm there.