2008年8月14日 星期四

用HAL mount ntfs-3g時, 如何使用中文與強制reset log

先安裝 NTFS-3G 套件:

$ sudo aptitude install ntfs-3g

於 /etc/hal/fdi/policy/preferences.fdi 檔案內的 區段加入下面內容:






ntfs-3g
ntfs-3g
locale=
dmask=000
fmask=111





有前輩對HAL的設定方式比較熟悉的嘛?
上面的 hal 設定檔中,volume.mount.valid_options 裡面我就算設定好 locale / iocharset 等為 UTF8 都無法作用。
只好用網路查的方式,轉個彎解決:

sudo rm /sbin/mount.ntfs-3g

建立 /sbin/mount.ntfs-3g 並加入下面內容
------
#!/bin/bash
/usr/bin/ntfs-3g $1 $2 $3 $4 -o locale=zh_TW.UTF-8
------
$ sudo chmod +x /sbin/mount.ntfs-3g

2008年8月7日 星期四

How to use patch

Patch Single file:
make a patch:
cd program_folder # go into the target folder
diff -Nu old_file new_file > patch_file
# the patch_file is the patch, it can use to patch file for another user
patch a file:
cd program_folder # go into the target folder
patch -p 1 < patch_file
# if you want to UnPatch the file
patch -R -p 1 < patch_file

Patch a Directory:
make a patch:
diff -rNu old_folder new_folder > patch_file
# no need to exec the command inside the program folder
patch the folder:
patch -p 0 < patch_file
# if you want to UnPatch, also use -R
patch -R -p 0 <>

2008年7月5日 星期六

使用 WINS 解析 Netbios Name

vi /etc/nsswitch.conf

hosts: files wins dns

/etc/init.d/winbind start

chkconfig winbind on

2008年6月26日 星期四

FreeBSD, Linux Serial Console

Serial Console 在沒有 VGA 的環境下很好用
FreeBSD 的 Serial Console 設定
在 /boot/loader.conf 加上 'console="comconsole"
編輯 /etc/ttys 的 ttyd0 那行
ttyd0 "/usr/libexec/getty std.9600" vt100 on secure
很簡單吧, Kernel 不要忘記加上 COM Port 的支援 (device sio0)
ref. FreeBSD Handbook: 21.6 Setting Up the Serial Console

Linux 的 Serial Console 設定
有 Boot Loader, Kernel 參數, inittab 三個地方要設
以 GRUB 為例, 在 menu.lst 前加入
serial --unit=0 --speed=9600
terminal serial
在 kernel 那一行的最後加上 console=tty0 console=ttyS0,9600
在 /etc/inittab 最後加上 s0:2345:respawn:/sbin/agetty ttyS0 115200 linux
ref. Using GRUB via a serial line, Linux Serial Console

支援 Serial 的 Terminal 軟體, X 下有不少, for Windows 最基本的就是 Windows 附的超級終端機,
商業軟體 SecureCRT, PowerTerm 都不錯,
也是有 Open Source 如 RealTerm, 但功能較差.

查看rpm內容及install/uninstall 的script

包的内容: rpm -qpl MySQL-server-4.0.24-0.i386.rpm
执行的操作: rpm -qp --scripts MySQL-server-4.0.24-0.i386.rpm

VirtualBox Bridge Mode

先裝好 tunctl 及 bridge-utils 套件
tunctl -t tap0 -u virtualbox
brctl addbr br0
ifconfig eth0 0.0.0.0 promisc
brctl addif br0 eth0
ifconfig br0 192.168.0.1 (把原來設在 eth0 的 IP 設到 br0)
brctl addif br0 tap0
ifconfig tap0 up
chmod 0666 /dev/net/tun
在 VirtualBox 網路設定為 Host Interface, Interface Name 為 tap0
就跟 VMware 的 Bridge Mode 一樣.

2008年6月24日 星期二

手動安裝gcin

/etc/sysconfig/i18n:

LANG="en_US.UTF-8"
SYSFONT="latarcyrheb-sun16"
LC_CTYPE="zh_TW.UTF-8"
LC_MESSAGES="en_US.UTF-8"
GTK_IM_MODULE=gcin
QT_IM_MODULE=gcin
XIM_PROGRAM=gcin

/etc/X11/xinit/xinput.d/gcin.conf

XIM=gcin
XIM_PROGRAM=gcin
XIM_ARGS="-x gcin"
GTK_IM_MODULE=gcin
QT_IM_MODULE=gcin


要注意!!確定gtk跟qt的im module有確定copy到指定的地方, 並且個別測試gtk以及qt的application
gtk application有可能因為支援XIM模式, 所以可以使用