2006/03/31

QEMU上裝winXP

參閱:
http://uwhug.org.uk/index.pl?QEmu_Installation_Guide
http://www.linuxquestions.org/questions/showthread.php?t=320569

設一個4G的檔案為虛擬硬碟空間:
dd if=/dev/zero of=XP.img bs=1M seek=4000 count=0

以CDROM開機是這樣:
qemu -cdrom /dev/hdc -hdb XP.img

以光碟ISO檔開機是這樣:
qemu -cdrom ../XP_SP1_TW.iso -hdb XP.img

然後....

2006/03/29

SCIM上設定嘸蝦米

依據下列的文章才順利把嘸蝦米設定成功:
http://www.suse.idv.tw/viewtopic.php?t=379
首先把嘸蝦米的big5 table 砍頭砍尾成:
a 對
aa 寸
aaa 鑫
...
]]v ︼
]]v ︾
然後把原有的嘸蝦米的big5 table 轉成utf8:
piconv -f big5 -t utf8 < liu5.big5 > liu5.utf8

給 scim 的table 依該文的範本製作,
但到了嘸蝦米的 table 需像:
a 對 100
aa 寸 100
aaa 鑫 100
aaa 龘 99
aab 鎯 100

用以下很簡陋的perl程式就順利轉成:

%index = ();
open(F,'liu5.utf8');
while() {
chomp;
my($code,$word) = split (' ',$_);
$index{$code}++;
my $tmp = 101 - $index{$code};
print "$code $word $tmp\n";
}
close(F);

然後依其指示完成。
倒是其中的liu.png不知何處有現成的?
用gimp自製的圖總是會超過1K,
搞不定小小圖的問題。

-------------------
我弄過這個,過程有放在我的網頁裡,不過我的網站目前不一定都有上線。
網頁在 www.starjou.idv.tw/ 裡 SuSE筆記 的 中文輸入 那部份。
內容我把它剪過來,斷章取義可能有的地方不太通,參考參考吧:
(不過我現在都用 gcin 了,很久沒試 SCIM 了說)

要加入嘸蝦米到 SCIM 中,需要有嘸蝦米的對照表格,另外再下載 SCIM table file 的 source file scim-tables-0.4.0.tar.gz,取一個裡面的輸入法對照表 (例如 scim-tables-0.4.0/zh/Jyutping.txt.in) 然後拿它的檔頭跟嘸蝦米的字根對照內容,做成嘸蝦米的對照表。
我修改過的檔頭如下:
### File header must not be modified
### This file must be encoded into UTF-8.
### This file comes from xcin module.
SCIM_Generic_Table_Phrase_Library_TEXT
VERSION_1_0

### Begin Table definition.
BEGIN_DEFINITION

### An unique id to distinguish this table among others.
### Use uuidgen to generate this kind of id.
UUID = 3d872a7a-760e-400c-8b23-688d38390e81

### A unique number indicates the version of this file.
### For example the last modified date of this file.
### This number must be less than 2^32.
SERIAL_NUMBER = 20040922

ICON = /usr/share/scim/icons/liu5.png

### The default name of this table
NAME = Liu5

### The local names of this table
NAME.zh_CN = 嘸蝦米
NAME.zh_TW = 嘸蝦米
NAME.zh_HK = 嘸蝦米

### Supported languages of this table
LANGUAGES = zh_TW,zh_HK,zh_CN,zh_SG

### Prompt string to be displayed in the status area.
STATUS_PROMPT = 中

### If true then the first candidate phrase
### will be selected automatically during inputing.
AUTO_SELECT = FALSE

### If true then a multi wildcard will be appended
### at the end of inputing string automatically.
AUTO_WILDCARD = TRUE

### If true then the result string will be committed to client automatically.
### This should be used with AUTO_SELECT = TRUE.
AUTO_COMMIT = FALSE

### If true then the inputed string will be automatically splitted during inputing.
AUTO_SPLIT = TRUE

### If true then the phrases' frequencies will be adjusted dynamically.
DYNAMIC_ADJUST = TRUE

### If true then the preedit area will be filled up by the current candidate phrase automatically.
AUTO_FILL = FALSE

### If true then the lookup table will always be shown if there is any candidate phrase.
### Otherwise the lookup table won't be shown unless the user requires it by moving the preedit caret left.
ALWAYS_SHOW_LOOKUP = TRUE

### Use full width punctuation by default
DEF_FULL_WIDTH_PUNCT = TRUE

### Use full width letter by default
DEF_FULL_WIDTH_LETTER = FALSE

### The maxmium length of a key.
MAX_KEY_LENGTH = 4

### Valid input chars.
VALID_INPUT_CHARS = ,.'abcdefghijklmnopqrstuvwxyz[]

### Single wildcard char, can have multiple chars.
SINGLE_WILDCARD_CHAR = ?

### Multi wildcard char.
MULTI_WILDCARD_CHAR = *

### The key strokes to split inputed string.
SPLIT_KEYS = space

### The key strokes to commit the convert result to client.
COMMIT_KEYS = space

### The key strokes to forward the inputed string to client.
FORWARD_KEYS = Return

### The key strokes to select candidiate phrases.
SELECT_KEYS = space,v,3,4,5,6,7,8,9,0

### The key strokes to page up the lookup table.
PAGE_UP_KEYS = Page_Up

### The key strokes to page down the lookup table.
PAGE_DOWN_KEYS = Page_Down,space
END_DEFINITION

### Begin Table data.
BEGIN_TABLE

底下接嘸蝦米的對照表,最後接檔尾
a 對 100
aa 寸 100
.
.
.
END_TABLE

大部份的設定等安裝完輸入法之後,到 SCIM 的設定視窗裡都還可以重新設定。在製作 table 時需要注意的只有幾個地方:

UUID = 3d872a7a-760e-400c-8b23-688d38390e81
NAME = Liu5
NAME.zh_CN = 嘸蝦米
NAME.zh_TW = 嘸蝦米
NAME.zh_HK = 嘸蝦米
VALID_INPUT_CHARS = ,.'abcdefghijklmnopqrstuvwxyz[]
SELECT_KEYS = space,v,3,4,5,6,7,8,9,0

UUID 是在 terminal 下執行 uuidgen 產生的一串字串。
VALID_INPUT_CHARS 是嘸蝦米的字根鍵。
SELECT_KEYS 可以設定選字的字根,設成 space,v 就可以保留嘸蝦米以 v 送次選字的習慣。
其它還有一些設定,可以等到安裝完之後,再到 SCIM 的設定視窗裡去更改,了解它的功能。
icon 的圖檔要自己生,如果沒有做的話,也可以到 /usr/share/scim/icons 底下借用其它輸入法的圖檔暫用一下。不然就留白了。
關於嘸蝦米字根對照的部份,它的格式跟製作 xcin 所使用 .tab 檔的 source .cin 檔格式稍有不同,.txt 中的字根跟對照字是用 tab 隔開的,.cin 中是用空白,再則 .cin 中可以在一行中以一個字根對應幾個字,如
deev 旦 曜
但是在 .txt 中則要分成兩行
deev 旦 100
deev 曜 99
而且 .txt 中每個字根後面都會有代表選字順序的數字。如果一個字根只對應一個字,該數字就是 100,如果有兩個,就分別是 100、99,依此類推。
所以如果沒有現成的嘸蝦米 for SCIM 的 .txt 檔的話,自行製作可能會花不少工夫,或是需要自己寫個處理的小程式轉換。
.txt 檔準備好之後,在 terminal 下執行 scim-make-table 將 .txt 轉成 .bin,命令格式如下:
$ scim-make-table liu.txt -b -o liu.bin
-b 指定輸出二進位檔,-o 指定輸出的檔名,執行 scim-make-table 不加任何參數就會顯示這些參數的說明。
產生 .bin 檔之後,再到 SCIM 的設定視窗中的 泛用對照表->管理對照表 安裝嘸蝦米,然後重新啟動 SCIM,就有嘸蝦米用了。
重新啟動 SCIM 需要手動 kill 掉蕉的 SCIM 執行緒,再重新執行 scim -d。
目前還有一些小問題就是如果拆錯碼 SCIM 不會自動清除拆字區的錯誤拆碼,另外雖然改變選字鍵,讓 v 可以上次選字,不過這跟嘸蝦米的 v 上次選字略有不同,傳統的嘸蝦米按了 v 之後還要再按 space 再上字,SCIM 則是按了 v 之後直接上字(因為其實它的 v 就等於在選字列按了 2),這些小地方比較不習慣,拆錯碼要自己 按 esc 取消,然後用 v 選字時常會在文件中多打一個空白。不知道 SCIM 中的設定是否有地方可以調整?
_________________
Linux 菜鳥周星星使用 SuSE 9.1 全紀錄
http://www.starjou.idv.tw/suse.php

2006/03/12

win98 傳輸速度加速

Windows 9x/ME Registry Tweaks
03.31.2001 11:20 EST by Philip


Different Network protocols benefit from different Network settings in the Windows Registry. The optimal Registry settings for broadband Internet connections are somewhat different than the Windows defaults. Windows is somewhat optimized for dialup, as well as Ethernet (high speed / low latency), however that isn't the case with Cable modems, DSL, Satellite, etc.

Below you will find OS specific information on how to optimize the Registry for broadband, which assumes some proficiency in customizing Windows. If you don't feel comfortable with editing the Registry, please visit our Downloads Section for ready to use patches and programs that can assist you in setting the optimal values in the Windows Registry automatically.

Recommended settings for Windows 9x

Since the introduction of Windows 98, MS has added support for RFC1323 ( the 'DefaultRcvWindow' has a maximum value of 2^30 rather than 2^16 - that is up to 1 GB instead of 64 KBytes limit), support for Selective Acknowledgments (SACK), Fast Retransmission and Fast Recovery.

Below is a list of the Registry setting and values we recommend for residential broadband connections.

Registry Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VxD\MSTCP
Value Name: DefaultRcvWindow
Value Type: String Value
Value Data: 64240
Details:

has to be a multiple of MSS for best results, i.e. (MaxMTU-40) x number... Best settings to try with MSS=1460 are 64240, 46720 and 23360, in that order

Registry Key:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\NetTrans\000n
(Where "000n" is your TCP / IP protocol. It contains "TCP / IP" assigned to the "DriverDesc" Value)
Value Name: MaxMTU
Value Type: String Value
Value Data: 1500
Details: If you're using DSL and your ISP has implemented PPPoE, you should set MaxMTU to 1492 or less.

Registry Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VxD\MSTCP
Value Name: DefaultTTL
Value Type: String Value
Value Data: 64
Details: range 1-255, use any number between 32 and 128

Registry Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VxD\MSTCP
Value Name: PMTUDiscovery
Value Type: String Value
Value Data: 1
Details: Boolean vlue, 0-false or 1-true. Many connections perform better with this entry at 1, however, if you prefer to set your upstream to send fixed 1500 packets, you might want to use 0 instead. When set at 1, establishing connections and initial transfer speed might slow down a bit, however you will get better throughput if somewhere in the path large packets need to be fragmented.

Registry Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VxD\MSTCP
Value Name: PMTUBlackHoleDetect
Value Type: String Value
Value Data: 0
Details: zero for optimal performance

Registry Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VxD\MSTCP
Value Name: Tcp1323Opts
Value Type: String Value
Value Data: 1
Details: The possible settings are 0 - No Windowscaling and Timestamp Options, 1 - Window scaling but no Timestamp options, 3 - Window scaling and Time stamp options. The value is documented in RFC 1323. According to Microsoft, Tcp1323Opts should be a DWORD, rather than a string value, however seems that the documentation is incorrect and a string value is necessary to enable large RWIN suppert.

Registry Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VxD\MSTCP
Value Name: SackOpts
Value Type: String Value
Value Data: 1
Details: Possible settings are 0 - No Sack options or 1 - Sack Option enabled. Selective Acknowledgements are documented in RFC 2018

Registry Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\VXD\MSTCP\Parameters
Value Name: MaxDupAcks
Value Type: DWORD Value
Value Data: 2
Details: taking integer values from 2 to N

Clamav-milter 的參數

/etc/sysconfig/clamav-milter

CLAMAV_FLAGS=" --quiet --external --dont-wait --noxheader --noreject --force-scan --dont-log-clean --server=localhost --pidfile=/var/run/clamav/clamav-milter.pid local:/var/run/clamav/clamav-milter.sock "

sendmail.mc
INPUT_MAIL_FILTER(`clamav', `S=local:/var/run/clamav/clamav-milter.sock, F=, T=S:4m;R:4m')dnl
define(`confINPUT_MAIL_FILTERS', `clamav')dnl

改檔名:空格變點 space2dot.sh

#!/bin/bash

rename()
{
startDir=.

for arg in "$@" ; do
find $startDir \( -name "* *" -o -name "* *" \) -print |
while read old ; do
new=$(echo "$old" | tr -s '\011' ' ' | tr -s ' ' '.')
mv "$old" "$new"
done
done
}
rename d f # Renames your directories with spaces first, then files

2006/03/11

有關perl的非SQL的資料儲存參考

Using a flat-file database in Perl
http://www.databasejournal.com/sqletc/article.php/1428581

Disk-based data structures (DBM)
http://www.wdvl.com/Authoring/Languages/Perl/PerlfortheWeb/index20.html

HTML Optimizer
optimize.pl - Replaces two or more spaces or returns with one, and removes comments (not in PRE, SCRIPT, or STYLE).
http://www.webreference.com/scripts/optimize.pl

Open Source Scripts
http://www.webreference.com/scripts/

CGI and Perl
http://links.rizenet.com/CGI_and_Perl