Capture Single Monitor Screenshot on Dual Monitors

When you hit PrintScreen key,  windows will take screenshot on the monitor and copy it to clipboard. But if you have dual monitors setup, you will find screenshot of both monitors are captured. You might wonder how to just capture the single screenshot on the monitor you are working on.

The answer is ALT + PrintScreen. Note that it will take screenshot of the active monitor on your desktop, the one has keyboard/mouse focus.

In addition, you can use CTRL + ALT + PrintScreen to capture the active dialog box or menu on your desktop.

IE9 Go to an intranet site for a single word entry in the address bar

Unlike IE8, in IE9, if you type an intranet site name in the address bar without http, IE9 will redirect you to the bing search page with the site name as keyword. IE9 also recognize you might want to go to an intranet so there is prompt pop up ask if you want to go to internal site.

5181943752_6bd422793e

This means one more click for many users. You can enforce IE 9 to go to intranet site directly for single word entry by following these steps.

Continue reading

IDE/ATAPI Account does not have sufficient privilege to open attachment

You might get following error after you move or replace a virtual disk drive file of a hyper-v virtual machine.

An error occurred while attempting to start the selected virtual machine(s).
‘TestVM’ failed to start.
Microsoft Emulated IDE Controller (Instance ID
{83F8638B-8DCA-4152-9EDA-2CA8B33039B4}): Failed to Power on with Error ‘General
access denied error’
IDE/ATAPI Account does not have sufficient privilege to open attachment
‘D:\VM\TestVM\TestVM.vhd. Error: ‘General access denied error’
Account does not have sufficient privilege to open attachment
‘D:\VM\TestVM\TestVM.vhd. Error: ‘General access denied error’

This is because the permissions on the new virtual hard drive (D:\VM\TestVM\TestVM.vhd in this case) are incorrect. Here is the steps to fix this permission file.

  1. Open Hyper-V manager, Right click settings of the virtual machine,
  2. Find the Virtual Hard Drive and choose "Remove".
  3. Re-add the same Virtual Hard Drive back to the machine.
  4. Now start the VM again, it should boot successfully.

IIS 7.5 Error The temp directory in chart handler configuration is not accessible

If you build a web application with Chart control for ASP.NET 4.0 and deploy the site to web server.  You might get following error on the live site:

The temp directory in chart handler configuration is not accessible

To resolve this, first go to web.config and find the ChartImage directory in appsettings.

<appSettings>
<add key="ChartImageHandler" value="storage=file;timeout=20;dir=c:\TempImageFiles\;" />
</appSettings>

The go to the temp chart image directory and grant read and write permission to IIS working process account in share properties – security tab. Note that the account runs IIS working process is different between IIS 7 and IIS 7.5

  • On Windows Server 2008 has IIS7, grant Read and Write permission to Network Service
  • On Windows server 2008 R2 has IIS 7.5, grant Read and Write permission to AppPool\<PoolName>. Replace <PoolName> to the actual machine pool your site is running on, for example, if your site is running on pool named ASP.NET v4.0, then the account you need grant permission would be IIS AppPool\ASP.NET v4.0, you can refer this step by step instructions for detail

iPhone Tips–Change Calendar TimeZone

When you move or trip to other timezone, iPhone won’t refresh the timezone information in to correct one, this results calendar syncs to Exchange server still on the old timezone and all meetings show wrong start time than they are. To fix this, go to Settings => Mail, Contacts, Calendars =>Calendars => Time Zone Support,  either turn it off or set to proper TimeZone

Could not load file or assembly TraceWrapper, Version=1.0.523.0

There are two versions of the TraceWrapper.dll in SCVMM install CD. One is x86 version and the other is x64 version. When you build your application on top of SCVMM library Microsoft.SystemCenter.VirtualMachineManager, it’s very important to pick up the correct version TraceWrapper.dll. In general, you should copy the 32 bit dll if you are using 32 bit system, copy 64 bit dll if you are using 64 bit system. Otherwise following BadImageFormatException would occur during runtime.

Could not load file or assembly ‘TraceWrapper, Version=1.0.523.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35′ or one of its dependencies. An attempt was made to load a program with an incorrect format.

However, you should keep using 32 bit TraceWrapper on a 64 bit system for following scenarios:

  • You need debug your app in Visual Studio directly. In this case, process launched from Visual Studio debugger runs in WOW64 mode.
  • IIS is configured to run in 32 bit mode. In this case, all working processes run in WOW64 mode.

This is because in 64 bit windows, processes in WOW64 mode are 32 bit processes and can’t load 64 bit TraceWrapper.dll.

CSharp – Get Assembly and File Version

If you want to know the version of currently executing managed assembly, you can use Reflection.Assembly.

Here is code snippet which can be used to do get managed assembly version.

private string GetVersion()
{
      return Assembly.GetExecutingAssembly().GetName().Version.ToString();
}