Career tips at Microsoft

I have always been hesitated to write this post but since I’ve been fortunately enough to have great career mentors and I recently got to a new career stage, I’d like to share some of the career tips that benefited me over the years: Before you get to senior level, there’s only one tip: Get things Done, well,…


ExpectedExceptionBaseAttribute and "Object reference not set to an instance of an object"

You’re writing unit tests with Visual Studio and you want to verify that you’re throwing the correct Exception. You could use ExpectedExceptionAttribute class but it only allows you to verify the type of the Exception. You might want to verify other properties so you decide to create a subclass of ExpectedExceptionBaseAttribute, which allows you to have…


Programmatically Paste Clipboard Text to a CMD Window (C# or C++)

To accomplish this, I have tried different approaches: posting WM_PASTE, SendKeys sending ctrl-v… None of the method seems to be working so well. A friend from work suggested trying WM_COMMAND. Since Spy++ doesn’t work with cmd.exe, we had to use brute force to find the correct WPARAM for pasting. The result is really simple, just one line code with C++: // hwnd…


DOS Command Script: uninstall an application

The scenario is you have an application which was installed through MSI. And you only know the application name (in this case, the beginning part of the application name). Using msiexec command requires you to know the product GUID but the application might have different GUID for its different version. So here is the solution I…


Control Panel Search Tip for Windows Vista/Windows 2008

In order to search for any Control Panel item, you should not use “Classic View”. As an example, if you wnat to turn off UAC (not recommended though), you search for “uac” with the normal Control Panel view and the option should come out. The good news is the issue is fixed in Windows 7,…


Me in A Magic Session

Other than being a software developer, I am also a magician. Check out this blog post (you will probably have difficulties understanding some of the magic jargons if you are not a magician):


DOS Command Script: Use Date/Time in File Names

Nowadays, we have different choices of script languages in Windows: VBScript, JScript, PowerShell script, etc. Coming from the old DOS world, I still prefer a simple batch (.cmd) script. Say we have a simple sql query and we want to run it every 10 minutes and save the output to a file. We can simply have…


Moving to Office

Re-orgs happen frequently at Microsoft and I am about to experience one. I just got two Ship-Its for the product I have been working on for almost 2 years, Microsoft Equipt, which will be discontinued after April 30th. We just finished the last feature of the product: requesting refund via the home page. The feature…


Microsoft’s Effort on 2008 Summer Olympics Coverage

Excited about upcoming Summer Olympics? Microsoft brings you a great digital coverage. Extracted from a promotional email: On the eve of 08.08.08 and the excitement around the XXIX Olympiad, Microsoft and NBC Sports have teamed to deliver event coverage on a scale never seen before on the Internet, let alone on TV.  NBC and Microsoft…


Weird Error of Log Parser

Log Parser is a great Microsoft tool for processing text-based data. Its scriptable COM components can be easily consumed by .NET applications. Recently I ran into an interesting error when using the COM components with C#. The data input for the parser is a TSV ((tab-separated values) formatted text log file. Here is code: LogQueryClassClass…