2010年4月10日 星期六

Google Earth 中文亂碼

剛裝完 Google Earth 後,發現完全看不到中文字,幸好找到一篇解法:修正 Google Earth 在 Mandriva Linux 中的中文亂碼 ( http://yowlab.shps.kh.edu.tw/wordpress/?p=710 )

  1. 為了安全起見,把原來的程式改個名就好。
    • mv libQtCore.so.4 libQtCore.so.4.bak
    • mv libQtGui.so.4 libQtGui.so.4.bak
    • mv libQtNetwork.so.4 libQtNetwork.so.4.bak
    • mv libQtWebKit.so.4 libQtWebKit.so.4.bak
  2. 把系統本身的 qt 相關程式做個軟連結過來
    • ln -s /usr/lib/libQtCore.so libQtCore.so.4
    • ln -s /usr/lib/libQtGui.so.4.5.3 libQtGui.so.4
    • ln -s /usr/lib/libQtNetwork.so.4.5.3 libQtNetwork.so.4
    • ln -s /usr/lib/libQtWebKit.so.4.5.3 libQtWebKit.so.4
  3. 完工,Google Earth 會出現正常中文字了。

2010年4月8日 星期四

尋找過期的檔案

 find ./ \( -path "./base" -o -path "./user" \) -name "*.php" -o -exec fgrep -l "Zend" {} \; -exec php {} \; | grep "expire" 

2010年3月31日 星期三

CSS Hack: Quick Tip: How to Target IE6, IE7, and IE8 Uniquely with 4 Characters

資料來源: Quick Tip: How to Target IE6, IE7, and IE8 Uniquely with 4 Characters (http://net.tutsplus.com/tutorials/html-css-techniques/quick-tip-how-to-target-ie6-ie7-and-ie8-uniquely-with-4-characters/)
body {
color: red; /* all browsers, of course */
color : green\9; /* IE8 and below */
*color : yellow; /* IE7 and below */
_color : orange; /* IE6 */
}

2010年3月23日 星期二

rsyslog 接收外部 log 設定 (openSUSE)

編輯 /etc/rsyslog.d/remote.conf 這個檔案,將
# UDP Syslog Server:
#$ModLoad imudp.so # provides UDP syslog reception
#$UDPServerRun 514 # start a UDP syslog server at standard port 514
改為
# UDP Syslog Server:
$ModLoad imudp.so # provides UDP syslog reception
$UDPServerRun 514 # start a UDP syslog server at standard port 514
相關參考資料:

CSS Hack

CSS Hack
/* Firefox (Begin) */
#valignMiddle #middleField, x:-moz-any-link {
/* styles for Firefox 2.0 or older*/
margin: 3px 1px 0 3px;
}
#valignMiddle #middleField, x:-moz-any-link, x:default {
/* restore styles for Firefox 3.0 and newer */
margin: 3px 228px 0 228px;
}
/* Firefox (End) */
/* IE (Begin) */
#valignMiddle #middleField {
#margin: 0 228px 0 228px;
}
/* IE (End) */

立即載入 wacom.ko

# insmod /lib/modules/$(uname -r)/kernel/drivers/input/tablet/wacom.ko
# depmod -e

2010年3月18日 星期四

將 CTH-460 的觸控模式關掉,只留筆控的模式

只需執行底下的指令即可。
$ xsetwacom set touch Touch off

2010年3月17日 星期三

WACOM Bamboo Pen & Touch 在 openSUSE 的設定

嘗試了許久,終於將 WACOM CTH-460/K0 Bamboo Pen & Touch 成功驅動,也可以正常使用,也因此決定灌溉一下這荒廢已久的 Blog。

首先的準備工作不可少,先透過 zypper 或 yast2 將 kernel-source 與 gcc 等編譯時所需的軟體先安裝好,接下來就開始準備編譯 wacom linux 的驅動程式了。

編譯時所需的 kernel source,在 openSUSE 底下它將 souce 與 lib object 分成兩個目錄存放,造成編譯時會無法建立 kernel 所需的 wacom.ko 檔。想要解決這個問題,一個是修改 Makefile (我不會修改 Orz),另外一個就是像我這樣的笨方法,將 source 與 lib object 合併放在一起。
$ cd /usr/src/linux-2.6.31.12-0.1-obj/i386
$ mkdir mybuild (名稱隨便,自己喜歡就好)
$ cp -r /lib/modules/$(uname -r)/source/* ./mybuild/
$ cp -r /lib/modules/$(uname -r)/build/* ./mybuild/
這樣就產生了等下編譯時所需的 kernel source

接著,到 The Linux Wacom Project ( http://linuxwacom.sourceforge.net/ ) 將 v0.8.5-11 下載,解壓縮,編驅動程式。
$ tar jxvf linuxwacom-0.8.5-11.tar.bz2
$ cd linuxwacom-0.8.5-11
$ ./configure --enable-wacom --with-kernel=/usr/src/linux-2.6.31.12-0.1-obj/i386/mybuild
$ make
$ make install
$ mv /lib/modules/$(uname -r)/kernel/drivers/input/tablet/wacom.ko /root (備份 wacom.ko)
$ cp ./src/2.6.27/wacom.ko /lib/modules/$(uname -r)/kernel/drivers/input/tablet/
其次,建立 10-wacom.fdi。在 Re: Bamboo pen CTL-460 on opensuse 11.2 linux ( http://old.nabble.com/Bamboo-pen-CTL-460-on-opensuse-11.2-linux-td27198192.html#a27200334 ) 這一篇,可以找到所需的資料
$ cd /usr/share/hal/fdi/policy/20thirdparty/
$ vim 10-wacom.fdi (詳細內容可在上面的連結找到,或是底下的文字)
<?xml version="1.0" encoding="ISO-8859-1"?>

<!-- Wacom: tablets, tablet pc's, and touch screen laptops -->
<deviceinfo version="0.2">
<!-- for all Wacom USB tablets -->
<device>
<match key="input.originating_device" contains="if0">
<match key="info.product" contains="Wacom">
<merge key="input.x11_driver" type="string">wacom</merge>
<merge key="input.x11_options.Type" type="string">stylus</merge>
<append key="info.callouts.add" type="strlist">hal-setup-wacom</append>
<append key="wacom.types" type="strlist">eraser</append>
<append key="wacom.types" type="strlist">cursor</append>
<append key="wacom.types" type="strlist">pad</append>
<!-- for HP dv3-2250 multi-touch laptop -->
<match key="info.udi" contains="e2">
<merge key="input.x11_options.Type" type="string">touch</merge>
</match>
</match>
</match>
</device>
<!-- for most Wacom USB tablets with touch -->
<device>
<match key="input.originating_device" contains="if1">
<match key="info.product" contains="Wacom">
<merge key="input.x11_driver" type="string">wacom</merge>
<merge key="input.x11_options.Type" type="string">touch</merge>
<!-- for Bamboo Pen & Touch tablets -->
<append key="info.callouts.add" type="strlist">hal-setup-wacom</append>
<append key="wacom.types" type="strlist">pad</append>
</match>
</match>
</device>
<!-- for Wacom Serial tablets -->
<device>
<match key="info.capabilities" contains="serial">
<match key="@info.parent:pnp.id" contains_outof="WACf;FUJ02e5;FUJ02e7">
<append key="info.capabilities" type="strlist">input</append>
<merge key="input.x11_driver" type="string">wacom</merge>
<merge key="input.x11_options.Type" type="string">stylus</merge>
<merge key="input.x11_options.ForceDevice" type="string">ISDV4</merge>
<merge key="input.device" type="copy_property">serial.device</merge>
<append key="info.callouts.add" type="strlist">hal-setup-wacom</append>
<append key="wacom.types" type="strlist">eraser</append>
<append key="wacom.types" type="strlist">cursor</append>
<!-- Serial tablets with touch capabilities -->
<match key="@info.parent:pnp.id" contains_outof="WACf008;WACf009;WACf010;WACf008A;WACf00B;WACf00C;WACf00D;WACf00E;FUJ02e7">
<append key="wacom.types" type="strlist">touch</append>
</match>
<!-- Serial tablets that operate at higher baud rate -->
<match key="@info.parent:pnp.id" contains_outof="WACf008">
<merge key="input.x11_options.BaudRate" type="string">38400</merge>
</match>
</match>
</match>
</device>
<!-- Match the Wacom Bluetooth A5 pen tablet -->
<device>
<match key="info.capabilities" contains="input.mouse">
<match key="info.product" contains="WACOM">
<match key="info.product" contains="Tablet">
<merge key="input.x11_driver" type="string">wacom</merge>
<merge key="input.x11_options.Type" type="string">stylus</merge>
<append key="info.callouts.add" type="strlist">hal-setup-wacom</append>
<append key="wacom.types" type="strlist">eraser</append>
<append key="wacom.types" type="strlist">cursor</append>
</match>
</match>
</match>
</device>
<!-- Wacom names "parser" -->
<device>
<match key="info.udi" contains_not="subdev_0">
<match key="info.udi" contains_not="subdev_1">
<match key="info.udi" contains_not="subdev_2">
<match key="input.x11_options.Type" contains="stylus">
<merge key="info.product" type="string">stylus</merge>
</match>
<match key="input.x11_options.Type" contains="eraser">
<merge key="info.product" type="string">eraser</merge>
</match>
<match key="input.x11_options.Type" contains="cursor">
<merge key="info.product" type="string">cursor</merge>
</match>
<match key="input.x11_options.Type" contains="pad">
<merge key="info.product" type="string">pad</merge>
</match>
<match key="input.x11_options.Type" contains="touch">
<merge key="info.product" type="string">touch</merge>
</match>
</match>
</match>
</match>
</device>
</deviceinfo>
至於,60-wacom.rules 這個檔案要不要建,應該是不用,不過我是有建。
$ cd /etc/udev/rules.d
$ vim 60-wacom.rules (詳細內容可在上面的連結找到,或是底下的文字)
# udev rules for wacom tablets.
# These rules were compiled for the Debian GNU/Linux distribution,
# but others may, and indeed are encouraged to, use them also.
#
# Should you do so, PLEASE CO-ORDINATE ANY CHANGES OR ADDITIONS
# of new devices with Ron  so that we can try
# to present users with a standard set of device nodes
# which they can rely on across the board.

KERNEL!="event[0-9]*", GOTO="wacom_end"

# Port specific link for users of multiple tablets of the same type.
# The ID_PATH variable is set by the "path_id" script in an earlier rule file.
ATTRS{idVendor}=="056a", ENV{ID_PATH}=="?*", SYMLINK="input/by-path/$env{ID_PATH}-wacom"

# Multiple interface support for stylus and touch devices.
DRIVERS=="wacom", ATTRS{bInterfaceNumber}=="00", ENV{WACOM_TYPE}="stylus"
DRIVERS=="wacom", ATTRS{bInterfaceNumber}=="01", ENV{WACOM_TYPE}="touch"

# Type-named links for multiple tablets.  If you want to use multiple
# tablets of the _same_ type, you will probably need to use the links
# from /dev/input/by-path to identify which is plugged into what usb
# port.  For different tablet types though, just pick your links from
# the list below.
#
# We override SYMLINK for tabletpc devices because the by-path link
# is not required with such devices, there will only ever be one.
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0000", SYMLINK+="input/tablet-penpartner"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0003", SYMLINK+="input/tablet-cintiq_partner"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0010", SYMLINK+="input/tablet-graphire"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0011", SYMLINK+="input/tablet-graphire2-4x5"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0012", SYMLINK+="input/tablet-graphire2-5x7"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0013", SYMLINK+="input/tablet-graphire3"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0014", SYMLINK+="input/tablet-graphire3-6x8"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0015", SYMLINK+="input/tablet-graphire4-4x5"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0016", SYMLINK+="input/tablet-graphire4-6x8"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0017", SYMLINK+="input/tablet-bamboofun-4x5"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0018", SYMLINK+="input/tablet-bamboofun-6x8"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0019", SYMLINK+="input/tablet-bamboo1-medium"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0020", SYMLINK+="input/tablet-intuos-4x5"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0021", SYMLINK+="input/tablet-intuos-6x8"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0022", SYMLINK+="input/tablet-intuos-9x12"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0023", SYMLINK+="input/tablet-intuos-12x12"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0024", SYMLINK+="input/tablet-intuos-12x18"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0030", SYMLINK+="input/tablet-pl400"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0031", SYMLINK+="input/tablet-pl500"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0032", SYMLINK+="input/tablet-pl600"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0033", SYMLINK+="input/tablet-pl600sx"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0034", SYMLINK+="input/tablet-pl550"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0035", SYMLINK+="input/tablet-pl800"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0037", SYMLINK+="input/tablet-pl700"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0038", SYMLINK+="input/tablet-pl510"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0039", SYMLINK+="input/tablet-dtu710"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="003f", SYMLINK+="input/tablet-cintiq21ux"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0041", SYMLINK+="input/tablet-intuos2-4x5"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0042", SYMLINK+="input/tablet-intuos2-6x8"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0043", SYMLINK+="input/tablet-intuos2-9x12"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0044", SYMLINK+="input/tablet-intuos2-12x12"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0045", SYMLINK+="input/tablet-intuos2-12x18"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0047", SYMLINK+="input/tablet-intuos2-6x8a"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0060", SYMLINK+="input/tablet-volito"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0061", SYMLINK+="input/tablet-penstation2"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0062", SYMLINK+="input/tablet-volito2-4x5"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0063", SYMLINK+="input/tablet-volito2-2x3"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0064", SYMLINK+="input/tablet-penpartner2"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0065", SYMLINK+="input/tablet-bamboo"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0069", SYMLINK+="input/tablet-bamboo1"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0081", SYMLINK+="input/tablet-graphire_bt-6x8"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0090", SYMLINK="input/tablet-tpc90"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="0093", SYMLINK="input/tablet-tpc93-$env{WACOM_TYPE}"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="009a", SYMLINK="input/tablet-tpc9a-$env{WACOM_TYPE}"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b0", SYMLINK+="input/tablet-intuos3-4x5"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b1", SYMLINK+="input/tablet-intuos3-6x8"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b2", SYMLINK+="input/tablet-intuos3-9x12"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b3", SYMLINK+="input/tablet-intuos3-12x12"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b4", SYMLINK+="input/tablet-intuos3-12x19"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b5", SYMLINK+="input/tablet-intuos3-6x11"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b7", SYMLINK+="input/tablet-intuos3-4x6"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b8", SYMLINK+="input/tablet-intuos4-4x6"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00b9", SYMLINK+="input/tablet-intuos4-6x9"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00ba", SYMLINK+="input/tablet-intuos4-8x13"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00bb", SYMLINK+="input/tablet-intuos4-12x19"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00c0", SYMLINK+="input/tablet-dtf521"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00c4", SYMLINK+="input/tablet-dtf720"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00c5", SYMLINK+="input/tablet-cintiq20wsx"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00c6", SYMLINK+="input/tablet-cintiq12wx"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00c7", ENV{WACOM_TYPE}!="touch", SYMLINK+="input/tablet-dtu1931"
ATTRS{idVendor}=="056a", ATTRS{idProduct}=="00d1", SYMLINK+="input/tablet-bamboo-pt"

# Convenience links for the common case of a single tablet.  We could do just this:
#ATTRS{idVendor}=="056a", SYMLINK+="input/wacom-$env{WACOM_TYPE}"
# but for legacy reasons, we keep the input/wacom link as the generic stylus device.
ATTRS{idVendor}=="056a", ENV{WACOM_TYPE}!="touch", SYMLINK+="input/wacom"
ATTRS{idVendor}=="056a", ENV{WACOM_TYPE}=="touch", SYMLINK+="input/wacom-touch"

# Check and repossess the device if a module other than the wacom one
# is already bound to it.
ATTRS{idVendor}=="056a", ACTION=="add", RUN+="check_driver wacom $devpath $env{ID_BUS}"

LABEL="wacom_end" 
最後重開機,就可以享受使用觸控板的快感了。 (應該啦~我逃~)