2008年12月9日 星期二

如何編譯特定的 Linux Module

切換到目標 module 的目錄下,然後執行:
make script (??)
make prepare (??)
make -C /usr/src/linux SUBDIRS=$PWD modules

※粗體字部份改成 kernel source 的位置即可。

2008年11月26日 星期三

如何新增一個.fon字型到wine裡

直接編輯system.reg, 尋找字型的位置, 新增一個項目(類似"Name"="FontPath"), FontPath為字型檔的路徑, 可將字型放在wine的字型目錄裡, 就不用打路徑, 只需要檔名(以安裝在/usr/local/wine為例, 字型目錄為/usr/local/wine/share/wine/fonts)

2008年11月17日 星期一

for Foxit Reader, convert linux path to windows-style path

#!/bin/bash
# Purpose: To convert Linux-style filename to Windows-style to pass as an argument to wine when starting Foxit Reader
Filename="z:"${1//\//\\}
#assuming you use the default installation folder for Foxit in Wine
App='eval wine "C:\Program Files\foxitreader\FoxitReader.exe" "'$Filename'"'
$App

Linux的環境變數

在 Linux 系統裡,一般是利用 LC_* 等環境變數來決定應用程式所該採用的語系。(至於該系統是否支援該 locale 則另當別論)

而一般設定 LC_* 等環境變數的地方有數個:

/etc/default/locale:設定全系統變數,Debian 官方的作法

/etc/profile:使用 bash 登入時會讀取的系統設定檔。

~/.profile:使用 bash 登入時會讀取的個人設定檔。

~/.bashrc:呼叫 bash 時會讀取的個人設定檔。

/etc/X11/xinit/xinitrc:用 startx 進入 X 時會讀取的系統設定檔。

~/.xinitrc:用 startx 進入 X 時會讀取的個人設定檔。

~/.xsession:用 GDM/KDM/XDM 進入 X 時會讀取的個人設定檔。

而至於要使用哪一個則視個人喜好了。如果您是使用 startx 來進入 X 的話,敝人建議使用 ~/.xinitrc。

2008年10月21日 星期二

wine 顯示中文

除了安裝字型外, 在執行時, 需要將locale設成zh_TW, 例如...env LC_ALL=zh_TW wine ultraedit.exe

2008年10月14日 星期二

pulse audio & alsa 混音完美解決方法

網上流行的解決方法:
方法1. 把軟體都改用pulseAudio輸出; 不支援PulseAudio的,就在ALSA中模擬一個channel到pulseAudio。(asound的修改)
參考http://ubuntuforums.org/showthread.php?p=4928900

方法2. 移除PulseAudio,轉回ALSA。
例如: sudo apt-get remove gstreamer0.10-pulseaudio
------------------------------------------------------------
我的特別解決辦法:(又更新了)

既然Ubuntu 8.04嘗試把所有軟體搬到PulseAudio上,那麼就讓已經在成功運行於PulseAudio的繼續基於PulseAudio。只支援ALSA的軟體,繼續使用ALSA。

方法--修改/etc/pulse/default.pa
sudo gedit /etc/pulse/default.pa

找到:
#load-module module-alsa-sink ...
改為
load-module module-alsa-sink device=dmix

找到:
load-module module-suspend-on-idle
改為
#load-module module-suspend-on-idle
(重新logout再login)

Optional:
找到: (解決錄音問題,如skype)
load-module module-hal-detect
改為:
#load-module module-hal-detect

這 樣,通過使用dmix,PulseAudio就不會霸佔整個audio系統。PulseAudio將成為alsa的其中一個Mix Channel。然後,ALSA和PulseAudio便能很好地共存。以後都不再需要什麼libflashsupport for pulseaudio了。

*************************************
還有,安裝PulseAudio的控制器,好好享受PulseAudio的優勢吧~
sudo apt-get install padevchooser

2008年9月23日 星期二

how to backup Ultraedit's configuration and transfer to another new PC

the configuration file is contained in

C:\Documents and Settings\user account name\Application Data\IDMComp\UltraEdit\

or correctly %appdata%\IDMComp\UltraEdit\

and you can keep it by copying them to another place


*.mfg - menu configuration files
*.pfg - popup menu configuration files
*.tfg - toolbar configuration files
Uedit32.* - currently used configuration files
ini - your current settings
kbd - your current key mappings (< v12.20 of UE)
uek - your current key mappings (>= v12.20 of UE)
mnu - your current menu
pmu - your current popup menu
tbr - your current toolbars


Wordfile.txt - syntax highlighting definition file
Htmltidy.cfg - HTMLTidy configuration file, if you have created it manually
Uetmplte.dat - UltraEdit templates (see template list)
taglist.txt - UltraEdit tags (see tag list)
*.mac - your macro files

*.in1 - environment settings (part of the INI)
*.mb1 - menu configuration files
*.pb1 - popup menu configuration files
*.tb1 - toolbar configuration files (also *.tb0)
*.te1 - environment template files
Uedit32.* - currently used configuration files
ini - your current settings
uek - your current key mappings

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模式, 所以可以使用

2008年5月30日 星期五

設定linux存取windows分享的印表機

1. 以瀏覽器開啟下列網址:
http://localhost:631
2. 接著點選「Manage Printers」超鏈結,
3. 然後點選網頁下端「Add Printer」按鍵,
4. 接著CUPS 應該會跳出一個對話框要求輸入使用者帳號及密碼,我在這兒是使用root的身份及密碼登入的,
5. 在接下來出現的網頁裡,有「Name」、「Location」及「Description」三個欄位。這裡面大概只有「Location」一欄
需要說明一下—如果要使用安裝在其他使用Windows系統上的共用印表機的話,這裡應該是要輸入那台Windows主機的IP。然後按下網頁中的「Continue」鍵,
6. 接著,下個網頁會要求您選擇你要使用的Device,點選「Widows Printer via SAMBA」。然後按下網頁中的「Continue」鍵,
7. 接下來的網頁會要求您輸入「Device URI」,這裡請輸入類似的文字
smb://username:password@group/server_name/printer_name


「group」的部分,就是那台Windows電腦上所設定的工作群組,
「server_name」是那台Windows電腦的電腦名稱,
「printer_name」則是Windows裡設定的印表機名稱。
接下來的步驟就是選擇印表機廠牌及型號,這部分我就不再贅述了(而且詳細過程我也不太記得了)。
以上的步驟,其實漏了一些很關鍵的說明。不過整個過程應該不是太困難。所以希望這個不甚完整的印象對您還是有點幫助。
喔!對了,忘了先說明一點。要像這樣透過網路使用Windows系統上的共享印表機,必須先裝「smbclient」套件。如果沒裝這個套件,就算有裝Samba其他套件都沒有用。至於其他samba的套件是不是一定要裝,我就不太清楚啦(要看它們之間的依存關係決定)。

2008年4月20日 星期日

VirtualBox 在Fedora 8, USB 非root無法使用解法

修改/etc/rc.d/rc.sysinit裡mount usbfs的部份
加上-o devgid={groupid},devmode=664
然後重開機

2008年2月18日 星期一

gcin 編輯詞庫無作用

因為~/.gcin/tmpfile裡面有詞的格式錯誤, 導致tsa2d32無法加入新詞, 刪除錯的詞即可, 可以使用tsa2d32 ~/.gcin/tmpfile 來檢查錯誤及加入詞