Category Archives: Windows

How to type Vietnamese on Windows 7

Typing Vietnamese on Windows 7 does not require any third-party software. All we need is to enable the Vietnamese keyboard and learn how to type special characters.



Open Control Panel and click on Clock, Language and Region.


Click on Change keyboards or other input methods at the bottom of the right pane.


Click Change keyboards…


In the Text Services and Input Languages window, click Add…


Select Vietnamese from the list and click OK.


We will see the Vietnamese keyboard added. Click  OK and we are done with the installation.


How to Type Vietnamese Text

The first step is to switch the keyboard from English (or your current language) to Vietnamese.  Look at the bottom of right of the screen, we will see “EN” for English. Click on it and select “VI” for Vietnamese.



Next, we will learn how to type special Vietnamese characters:

Huyền = 5
Hỏi = 6
Ngã = 7
Sắc = 8
Nặng = 9

ă = 1
â = 2
ê = 3
ô = 4
đ = 0
ư = [
ơ = ]

Good luck.


Use subst to Deal with Long Path Names

The Problem

I want to shorten the paths to a directory that is buried deep in the file system. In my daily work, I often need to cd into such directory as long as:


Although Windows command line has file name completion, it is still a long and tedious process to change into and out of these directories.

The Solution

There are several solutions, such as using environment variable to point to the destination directory, or to create alias to cd there (via doskey). My favorite solution uses subst to substitute the long path with a drive letter:

subst F: C:\projects\tests\utilities\fileutil

From this point on, I can switch to this long directory using the shorter drive alias. Instead of

cd C:\projects\tests\utilities\fileutil

I can get to it by changing the drive:


By using a drive to access a deeply buried directory, I also get around the problem of 260-character path name limit in Windows.

Fix for Interactive Login Problem


Originally uploaded by haivu_ed

The problem
I have a Windows 2003 Server which for some reason does not let me log in interactively (that is, locally). The machine issue the following error message when I tried logging in: “The local policy of this system does not permit you to logon interactively.”

The solution
From another machine in the network, I downloaded the Windows Server 2003 Resource Kit Tools (what a mouthful), then issue the following commands:

net use \\mymachine\c$
ntrights.exe -m \\mymachine -u username -r SeDenyInteractiveLogonRight

Where mymachine is the machine name for your stuck machine, and username is the user name you use to log in. When the net use command asks for credentials, I use mymachine\username and the corresponding password. This command is essential to allow ntrights.exe to gain access to your stuck machine.


Microsoft knowledge base article that deals with this problem.

Windows Server 2003 Resource Kit Tools Download 

A discussion about the use of net use to gain permission

Solution for Vista to Leopard Connection Problem

I had my Leopard set up for file sharing, which I can connect from my other Mac and XP computers. However, for the longest time, I could not connect to it from my Vista machine.After doing some research, I finally found the solution posted in Apple’s discussion forum. If your user name on the Leopard machine is haivu, then you should use DOMAIN\haivuinstead of plain old haivu to log in.

Reference: Sharing files with Vista (look for the post by StatMan). Thank you StatMan.
Keywords: login, log in, file sharing, networking, windows, os x, mac

How to Redirect Console Output to a File in C#

I encountered the need to redirect the console output to a file in my attempt to automate testing of functions which does not return any value but writes to the console. Basically, we need to save the old output (Console.Out) before assigning the output to a file stream by means of Console.SetOut(). After the test, I also need to restore the console output.

After doing this for a while, it gets old and I told myself, “Self, I can create a simple class to simplify this task.” In my vision, output redirect should be easy, simple, and practical. The user should not have to remember the details such as which data type to use (TextWriter, FileStream, StreamWriter, …), or which steps to take. Thus, I created OutToFile, a simple class which encapsulate this idea. Using OutToFile is … you guessed it, easy:

Console.WriteLine(“This goes to console”);

using (new OutToFile(“output.txt”)) // redirect the output to a text file
    Console.WriteLine(“This text goes to a file”);
} // redirection ends upon exiting the using block

Console.WriteLine(“This goes back to console”);

The source code for this class is available, you are free to use it, but I reserve the bragging right :-).

Blogged with Flock

Tags: , ,

Tcl Command Line Parsing Problem

I have this one-liner:

puts “argc = $argc”

and saved it to cmdline.tcl. If I invoke the program directly like

cmdline.tcl one two three

then the result is:

argc = 0

If I invoke it as:

tclsh cmdline.tcl one two three

then the result is correct:

argc = 3

The same program works fine on my Mac OS X Leopard machine. After posting my problem on comp.lang.tcl, I received help from Cameron Laird and was able to pinpoint the problem to the following registry key: HKEY_CLASSES_ROOT\tcl_auto_file\shell\open\command whose value was:

“C:\Tcl\bin\tclsh.exe” “%1”

After making the modification below, everything worked beautifully.

“C:\Tcl\bin\tclsh.exe” “%1” %*

UPDATE: After installing ActiveTcl 8.5, I found out a couple of changes:

  1. tclsh.exe no longer exists, instead, use tclsh85.exe
  2. HKEY_CLASSES_ROOT\ActiveTclScript\shell\open\command is the new registry location, by default, it invokes wish85.exe instead of tclsh85.exe

Blogged with Flock


Windows XP/Vista Auto-completion Mystery

I have an XP and a Vista box. On the XP box, the auto-completion works beautifully: it automatically suggests the name of the files or directory based on the first few characters that I typed. Auto-completion works in places such as the file open/save dialogs, the Run command, and the Internet Explorer’s web address line. On my Vista box, auto-completion does not seem to work. After some research, I finally came to this thread which basically told me to turn on a setting in Internet Explorer. Here is how:

  1. Start Internet Explorer (IE)
  2. Click the Internet Options menu off the Tools Menu
  3. Click the Advanced tab
  4. Click to select the Use inline AutoComplete check box
  5. Click OK to commit the change

That’s all there to it. Perhaps Microsoft can re-think the situation and put the settings somewhere in the control panel instead of IE.

Swap Windows and Alt Keys in VMWare Fusion

In the past few days, I have used VMWare Fusion to run Windows XP on my MacBook and I am pretty happy with it. However, as soon as I am in windows, I have trouble getting used to the Control – Alt – Windows key order. For those who do not know, the Windows keyboard’s order is Control – Windows – Alt. Fortunately, my research took me to a VMWare’s forum article where I found just what the doctor order.

Essentially, the solution calls for creating a file called config off ~/Library/Preferences/VMWare Fusion/ and add the following line:

mks.keyboard.swapAlt = TRUE

All credits go to the original poster in the article, magi.

Exporting Multiple from Numbers to Excel

I have a simple (really!) sheet that I created in the Numbers (part of the new iWork ’08). In this sheet, I created two tables and a text box.

When I exported this sheet to Excel and viewed the result from Excel, I was disappointed, but not surprised that the exported sheet looks horrible: each table is on a different sheet, even the text box gets its own sheet.

The lesson? If you want to create a spreadsheet using Numbers and later exported to Excel, keep it simple with one table. Or, you might want to export your sheet to PDF for read-only sharing.