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.

Installation

Image

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

Image

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

Image

Click Change keyboards…

Image

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

Image

Select Vietnamese from the list and click OK.

Image

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.

Image

 

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:

C:\projects\tests\utilities\fileutil

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:

F:

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


cannot_login

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.

References

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
this:

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

Tags: