Friday, November 30, 2012

Windows 7: Japanese not displaying in Windows

SkyHi @ Friday, November 30, 2012
Your problem probably stems from the fact that you're font chache probably is corrupted; delete the fileC:\Windows\system32\FNTCACHE.DAT and restart, your problem should be solved.

Windows XP had a “supplemental language support” section under Regional and Language options. You had to select them and perform the installation (which required the CD and was annoying) if you wanted to work with Asian languages. This was removed with Vista and support for these languages came by default. Windows 7 turns out to be a little different, however.
I usually do not find what Microsoft chooses to hide from the UI very useful. Why do I need to hit the alt key to see the file menu for example? This started with Internet Explorer and seems to be applied to other apps as well, including Windows Explorer. All of a sudden, the menu disappeared… Yes, it provides a little more space on the screen, but that space is not very useful as menu bar is not located at direct eye sight anyway. Does anybody browse the Internet full screen? No.
Lets get back to the Font issue. I launched an html document with Japanese strings in Notepad and was presented with a bunch of boxes! Boxes are how Windows expresses “I don’t know how to display this character”. I went to Format > Font to pick a font which supports Japanese script but none existed! Ah, must be the newest victim of Microsoft hiding team…
Windows 7 hides fonts depending on your language settings. Go to Control panel > Fonts > Font settings and uncheck “Hide fonts based on language settings”
Hiding the fonts is supposed to simplify the font selection in applications. I am not sure which applications are targeted for this but Notepad is definitely not one of them. The font selection dialog has always been and is still far from being user friendly and having 80 fonts instead of 200 doesn’t really provide any improvement.
I picked MS Minco for the font and Japanese for the script and there we go. No more boxes!


Thursday, November 29, 2012

Find command: Exclude / Ignore Files ( Ignore Hidden .dot Files )

SkyHi @ Thursday, November 29, 2012

Q. How do I ignore hidden .dot files while searching for files? How do I ignore or exclude certain files while running Linux / UNIX find command?

A. Find command support standard UNIX regex to match or exclude files. You can write complex queries easily with regex.

Find command and logical operators

Find any file whose name ends with either 'c' or 'asm', enter:
$ find . -type f \( -iname "*.c" -or -iname "*.asm" \)
The parentheses must be escaped with a backslash, "\(" and "\)", to prevent them from being interpreted as special shell characters. The -type f option force to only search files and not directories. The or operator either find .c or .asm file.

Understanding find command operators

Operators build a complex expression from tests and actions. The operators are, in order of decreasing precedence:
( expr )Force precedence. True if expr is true
-not expr
True if expr is false. In some shells, it is necessary to protect the ‘!’ from shell interpretation by quoting it.
expr1 -and expr2And; expr2 is not evaluated if expr1 is false.
expr1 -or expr2Or; expr2 is not evaluated if expr1 is true.
WARNING! The '-or', '-and', and '-not' operator are not available on all versions of find. Usually GNU find supports all options. Refer your local find command man page for more information.

How do I ignore hidden .dot files while searching for files?

Find *.txt file but ignore hidden .txt file such as .vimrc or .data.txt file:
$ find . -type f \( -iname "*.txt" ! -iname ".*" \)
Find all .dot files but ignore .htaccess file:


Find Command Exclude Directories From Search Pattern

SkyHi @ Thursday, November 29, 2012

How do I exclude certain directories while using the find command under UNIX or Linux operating systems?

You can use the find command as follows to find all directories except tmp directory:
find /path/to/dest -type d \( ! -name tmp \) -print
Find all directories except tmp and cache:
find /path/to/dest -type d \( ! -name tmp \) -o \( ! -name cache \) -print
The -prune option make sure that you do not descend into directory:
find /path/to/dest -type d \( ! -name tmp \) -o \( ! -name cache -prune \) -print
You can find all *.pl find except in tmp and root directory, enter:
find /  \( ! -name tmp \) -o \( ! -name root -prune \)  -name "*.pl" -print