Category Archives: Tips & Tricks

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.


How to Install .apk File onto an Android Device

The Problem

I am new to the Android platform. At work, I need to side-load our app for testing. My device is an HTC one of 2012. At first, I installed and ran the HTC Sync Manager from my MacBook Pro with hope that it could help me, but after half an hour, I gave up: I copied the .apk file to the file section, sync, then check the phone: I could not find that .apk file anywhere. It could be me, but for the life of me, I could not find a way to copy the file in question onto the device. There must be a better way.

My Solution

As I stated before, the problem is with me being a novice. However, I did spend a good half an hour googling for solutions to no avail. Finally, an idea came to me: what if I can transfer the file from my Mac to the HTC One via HTTP? With that though, I opened up a terminal session, cd to the directory where my .apk file is, and issued the following command:

python -m SimpleHTTPServer

That command created an impromptu web server to serve all the files within the current directory. From the HTC One, I fired up a web browser and jumped to my server: haiv-mac1.local:8000 and expected to see the directory listing. However, I could not connect to my Mac at all. Frustrated, I tried again and again, prepending http:// to the address, check my spelling, knelt down and prayed… But nothing worked. I tried the same address using my iPhone and it works. So the problem was with the Android device. Finally, I was able to connect using my Mac’s IP address. How I love Android!

Once I downloaded the file, it was a simple matter of tapping the Downloads icon, find my file, and tap on it to install.


I like the Android platform for giving me the ability to side-load apps, which is great for testing. However, the process could be simpler. Veteran Android users and developers might laugh hearing this story, but it is no joke to me. Until I gain enough expertise, I’ll stay with my trusty iPhone.

Drobo Saved My Day for the Third Time

A few hours ago, I went home to see one of the lights on my Drobo blinking in red color: one of my hard drives in the Drobo has died. For those who don’t know, a Drobo is an external hard drive enclosure which houses five (in my model) 3.5-inch hard drives. Drobo offers protection against drive failures such as the one I am currently experienced.

In the old days, a failed hard drive meant data loss—that is how I lost several photographs and video clips of my family. When I lost my first batch of files due to hard drive failure, I got wiser and backed up my desktop’s hard drive. Sadly, when my hard drived failed the second time, I found out my back-up CDs (those old days) also turned bad. For years, I struggled with back-up solutions, none were reliable enough for my use. Then came Drobo.

The first time I saw this black box, I knew it should be part of my data storage and back up plan. The initial price for the empty Drobo S, my model, was nearly 700 USD—a very steep price indeed. However, the more I thought about my past incidents, the more sense the Drobo makes. Finally, I bit the bullet and purchased one. Let me cut right to the point: I experienced today’s episode twice before, and had not lost a single file due to hard drive failure. I believe that was the best $680 I have ever spent.

Tonight, I will replaced the doomed drive knowing that my Drobo is working hard to ensure my data integrity. My Drobo has saved my day yet again.

How I Name My Printers

At home, we have two printers that I set up so the whole family can print. Their names were HP LaserJet xxx and Epson xxx, the default my OS gave them. Things were fine until my wife and kids start asking me which one is the color printer.

What? Don’t they know that the Epson printer is the color one? The truth is, for the people who wants to print, they don’t care if the printer is laser or inkjet, made by HP or Epson. All they care about is which one can print in color and which one cannot.

Finally, I named them Black & White Printer and Color Printer. This makes a lot of sense for them: they don’t have to wonder which one is which. It also releases me of the answering duty.

Easy Way to Create Colorful Bash Prompt

The Problem

I often want to fiddle with the bash prompt, but don’t want to deal with bash prompt escape sequences. I wish for a utility which simplify setting a bash prompt. I finally wrote that utility myself: mkprompt


Copy mkprompt to a directory in the path.

Using mkprompt

The best way to show mkprompt usage is via a couple of examples.

PS1=$(mkprompt "red workdir" space dollar)  
PS1=$(mkprompt "cyan Workdir" space "green dollar")  
mkprompt # display help

For more information, see my shell_tools page.

What’s Next?

The following are improvements which I plan for mkprompt, depends on my free time:

  • Implement the rest of the prompt escape sequences
  • Improve the help output
  • Implement installation script

The Script

I current host my script as part of my shell_tools collection on GitHub.

Squeeze Multiple Blank Lines within vim

The Problem

I want to squeeze multiple blank lines into just one while editing in vim. I often receive source code which the author used multiple blank lines to separate functions. I don’t mind if functions or code block are one or two lines apart, but I have seen sources where functions are four or more blank lines from each other. This is annoying and I want to squeeze many of them into one.

The Solutions

The obvious solution is to use vim’s search-and-replace feature, as discussed in this post. However, my regular expression skill is very basic and I tend to forget the syntax when I need it. Hence, I devised my own solution, one which I have better luck memorizing.

My solution involes the cat command:

:%!cat -s

This short little command applies ‘cat -s’ on my entire file contents, which squeezes multiple blank lines down to one. Note that this solution will only work on Unix-like systems such as BSD, Linux, and Mac OS X. It does not work on Windows. This is one of the shortcoming of this method compare to the previous one.