2011-01-11

為 Ubuntu 增加字型 (Add font types in Ubuntu)

將字型檔案放置在 /usr/share/fonts/truetype
不過為了容易整理文件,建議先在 /usr/share/fonts/truetype 中建立一個資料夾

2011-01-01

讓 Windows Bootloader 載入 GRUB

為避免格式化 Ubuntu 後導致不能起動 Windows ,所以不讓 GRUB 成為 MBR
但使用 Windows 預設的 Bootloader 又不能列出非 Windows 的作業系統,所以需要改寫 C:\boot.ini
注意:胡亂改寫 C:\boot.ini 的會導致所有作業系統不能起動
If you use GRUB as MBR, after format Ubuntu partition GRUB will erase also
However, after re-build Windows Bootloader as MBR, GRUB2 will be replaced, and Ubuntu cannot be started for booting
So, how could let Windows Bootloader as MBR and boot up Ubuntu after GRUB2 is replaces

修復 Ubuntu 的 MBR (Recover Ubuntu GRUB as MBR)

GRUB 是一種出名的 Bootloader
但當 GRUB 被其他 Bootloader 覆蓋,如何重新讓 GRUB 成為 MBR ?
GRUB is a popular Bootloader.
However, how could we recover GRUB is covered by other Bootloader ?

修復 Windows 的 MBR (Recover Windows Bootloader as MBR)

若電腦系統曾經運行 Windows 與 Ubuntu 雙系統
當 Ubuntu 被格式化後,由於會連同 GRUB 一拼刪除,若果 MBR 被 Ubuntu 覆寫 MBR 不會引導 Windows 的 Bootloader
因此將會導致沒有 Bootloader 起動 Windows
若要重新起動 Windows 便需要修復 MBR 引導 Windows 的 Bootloader
If the computer run with Windows and UBunut 2 Systems
After you format Ubuntu, you should recover Windows Bootloader as Master Boot Record, otherwise you cannot boot to Windows Partition
You need to recover Windows Bootloader to boot the Windows Partition

2010-12-21

Regular Expression 測試 3 (Regular Expression Test 3)

只利用 Regex 來測試字串是否符合日期格式



共 512 個字元

Regular Expression 測試 2 (Regular Expression Test 2)

只利用 Regex 來測試字串是否符合 IPv4 格式



共 158 個字元

2010-12-19

Regular Expression 測試 1 (Regular Expression Test 1)

只利用 Regex 來測試字串是否符合24小時制時間格式



共 80 個字元

2010-11-27

更改 Ubuntu 的 Button Layout (Modify button layout in Ubuntu)

Ubuntu10.04+ 的按鈕排放在左邊,變成與 Mac OS 相似的設定
這種設定使部分習慣使用 Windows 或各種 Linux (安裝 X Window System) 的用家或多或少構成不便
Ubuntu 允許使用者更改按鈕的擺放位置
The button layout move to the left side in Ubuntu10.04+, like Mac OS
This settings inconvenience the tranditional user of Windows or Linux (install with X Window System)
Ubuntu allow user to modify the button layout

PHP UTF-8 編碼與 session 及 header 問題 (Solving BOM of UTF-8 File Encoding problem with PHP session and header)

網絡上不少跨語言網頁大部分都是以 UTF-8 作為編碼
但利用 UTF-8 編碼編寫 PHP 文件使用到 session 及 header 時便會發生問題
UTF-8 編碼的文件會在文件檔頭加上 3個bytes 的資料,這 3個bytes 稱為 BOM - Byte Order Mark
在標準制式下 UTF-8 的這 3個bytes 分別是:
第一個byte - 0xef
第二個byte - 0xbb
第三個byte - 0xbf
UTF-8 is a popular File Encoding on the internet.
However, when we use UTF-8 with PHP using session and header there are some error occurs.
UTF-8 file has 3 bytes of data at the beginning of file, this 3 bytes called BOM - Byte Order Mark
The standard of UTF-8 file of this 3 bytes is:
1st byte - 0xef
2nd byte - 0xbb
3rd byte - 0xbf

2010-11-17

Windows VISTA / Windows 7 不能使用 VBScript 的 CommanDialog (VBScript CommonDialog in Windows VISTA and Windows 7)

不少人在 Windows 處理簡單的程序時,往往會用到 VBScript
而使用 VBScript 涉及檔案存取時不少人都會想到使用 File Dialog 讓使用者有一個具 GUI 的檔案選擇工具
VBScript is a light, useful programming language (script) in Windows OS
We can write a VBS with notepad or any text editor
We always select a file with File Dialog
File Dialog is a user-friendly GUI for user to select a specific file