Microsoft, Information Technologies...



  • From Taiwan, living and working at Tokyo, Japan.

Recent Posts


Microsoft Sites

Other Sites

Blog pools



Site Info

Locations of visitors to this page

Logos & Chicklets


Rex's Certifications
Rex's Certifications

Creative Commons授權條款
本 著作 係採用
Creative Commons 授權條款

July 2007 - Posts

Debugging managed code using WinDbg and SOS.dll

crosspost from

This should be must tools and skills that every .net developer needs to learn, to use WinDbg and SOS.dll to debug your managed code application. the following are some links to lead one into the in-depth debugging world.

Or just search with the keyword "sos.dll" .


Modifying HOSTS file in Vista...

crosspost from

When you trying to modify the "Windows\system32\drivers\etc\hosts" file to add some local dns mappings in Vista, the system will not allow you to save the file. It's because of the tighten security in Vista.

to solve this, refering to this KB, run your editor by right-clicking it and "run as Administrator", then will be able to save the file.

or by referring to Matthew's post, just grab the ownership of the HOSTS file so that one will be able to edit it without having administrator priviledges.

(by running cmd.exe as administrator...)

takeown /f c:\windows\system32\drivers\etc\hosts
icacls c:\windows\system32\drivers\etc\hosts /grant yourusername:f


Technorati tags: , , , , ,
Terminal Service: Connect and/or Shadow to a Console Session...

crosspost from

Seems some of my friends still didn't know how to use Microsoft Terminal Service Client to connect to the console session of a windows pc (server or client OS) so here is a memo for it also during the search I found the other interesting thing that can let Terminal Service to function like a VNC server (2 users share the same session, called "shadow session" here).

By reading this KB, to connect to the console session, just using the "-console" parameter on command line:

mstsc -v:servername -console

sometimes it's not that convenient to open a cmd window and type the command, my way is to duplicate the Remote Desktop Connection shortcut and on the target command input to plus the "-console" argument.

also there is a way to share the same session by using the shadow ability of terminal service connection. document here for further reference. (for full setup guide refer to the KB pointed above)

1.Open the Group Policy snap-in (Gpedit.msc).

2.In the left pane, under the Computer Configuration branch, expand the Administrative Templates branch.

3.Expand the Windows Components branch.

4.Click the Terminal Services folder.

5.In the right pane, double-click Sets rules for remote control of Terminal Services user sessions.

6.On the Setting tab, click Enabled.

7.In the Options box, click Full Control with users' permission, and then click OK.

8. (added!) open a cmd window and use command "gpupdate /force" to force a group policy update of the local machine.

by doing so to set up the permission of using shadow function.

now, open a non-console terminal service session to the same machine and using a cmd window to type "shadow 0" to shadow to the console window. to exit the shadow on this session just press "Ctrl + * " (the * seems have to use the * key at the number pad, which is not there if using most of notebook keyboard. wondering if there are settings to change the key map.)

Now terminal service connection can perform console manipulation also be used like a VNC viewer.

Check Terminal Service Team Blog for more further information.


Technorati tags: , , , ,
C#: What does it mean about statement "int? varA = 3;" ?

crosspost from

Ok, I have to admit that I didn't really go through the whole C# language reference and today when I was reading some code I got confused with the follow syntax:

int? varA = 3;

what's the "?" means in this statement? don't have this in earlier C# specifications. An internet search found out the answer that according to this post it is a shortcut of Nullable Type definition:

Nullable<Int> varA = 3; // or
Nullable<T> variable; // is equal to T? variable;

Agreed to what Justin Rogers said that it easily confuse programmer if one didn't read most of the language definitions (well, I do think it is basic and necessary to read all the language definition before starting to using a programming language).

Also there is (new?) operator "??" that using like this:

int? varA = null;
int varB = 3;
int? varC = 4;
int result1 = varA ?? varB; // will return varB = 3 since varA is null
int result2 = varB ?? varC; // will return varB = 3 since varB is not null

the "??" operator is to check if the left-hand operand is null. if the left-hand operand is not null than it return left-hand operand, or else it return right-hand operand. see the ?? definition here.

So now we know that the "?" means a Nullable type in C# 2.0 and ?? is to check null values. (maybe it's only me that don't know about it) 


Posted: 2007/7/3 20:47 by rextangtw | with no comments
Filed under: