2009年10月30日 星期五

Linux init script

/etc/rc.d/init.d/ include all the daemon scripts
/etc/rc.d/rc0.d
/etc/rc.d/rc1.d
/etc/rc.d/rc2.d
/etc/rc.d/rc3.d
/etc/rc.d/rc4.d
/etc/rc.d/rc5.d
/etc/rc.d/rc6.d
We can put soft-link between the above folders to link to the real script under the /etc/rc.d/init.d/

2009年10月22日 星期四

Windows XP - Fix various woes

Q1. How to fix Windows while happen some urgent error?
I ever happen an urgent error in my NB (Microsoft Windows XP). The message was as bellow

STOP: c000015 Hard Error
Hard Error

Finally I fix this problem use the following procedures.
1. Reboot the NB and use M.S. Windows XP CD to boot the system.
2. Important: Don't select the Repair the Windows at the beginning. Select the "Setup Windows" first.
3. Press F8 to allow the Windows License
4. Select the "Repair Windows"

Q2. Add Environment Variable Path into Windows XP system. The procedure can refer the following diagram

2009年10月20日 星期二

WANem Tips


1. First, connect to the WANem config page, e.g. http://172.16.0.252/WANem/
2. Configure the following parameters, include
Delay - e.g. Delay time(ms): 4, Jitter(ms): 4, Correlation(%): 5
Loss - e.g. Loss(%): 5, Correlation(%): 5
Duplication - None
Packet reordering - None
Corruption - None
Bandwidth - Choose BW "Choose the data by yourself", Other: Specify 1024 BW(Kbps)
If you choose "Other", than the bandwidth will adopt the afterwards value
3. Click "Apply settings"
4. Click "Refresh settings"
5. Click "Check current status"

Linux Command - vi with various tips

快速的搜尋字串

/〔pattern〕<return>



?〔pattern〕<return>

其中 / 表示前向搜尋,?表示背向搜尋。

我們可以用”n”來繼續同向搜尋,若用”N”,表示反向動

作,而於現在列搜尋字元,可使用下列方式:

f<char> 正向搜尋

F<char> 背向搜尋

t<char> 正向

T<char> 背向

F、f 指令表示移動游標到<char>上

T、t指令表示移動游標到<char>前


調整游標位置(重要)

z[Enter] position line with cursor at top
z. position line with cursor at middle
z- position line with cursor at
% goto matching parenthesis () {} []


vim 才有顏色 (syntax on in the $HOME/.vimrc, setting after finish install vim) 並且delete /sbin/vi ln -s /usr/local/sbin/vim /sbin/vi or set "vi" command alias
vi 並沒有顏色

安裝vi 6.3 時,需同時download 下面四個檔案(很重要,不要只有download 一個檔案,我曾經因此找了很久才發現原因)
-rw-r--r-- 1 vincent vincent 1423701 Dec 9 16:38 vim-6.3-rt1.tar.gz
-rw-r--r-- 1 vincent vincent 1132075 Dec 9 16:38 vim-6.3-rt2.tar.gz
-rw-r--r-- 1 vincent vincent 1397231 Dec 9 16:38 vim-6.3-src1.tar.gz
-rw-r--r-- 1 vincent vincent 560845 Dec 9 16:38 vim-6.3-src2.tar.gz

將四個檔案都解壓縮後
drwxr-xr-x 5 1000 1000 4096 Dec 10 11:48 vim63

再利用
1. make run configure, compile and link
2. make install installation in /usr/local
即可完成安裝

如果是安裝vim 7.2版就不用download 4個files, 只要download 1個file即可
ftp://ftp.vim.org/pub/vim/unix/
ftp://ftp.vim.org/pub/vim/unix/vim-7.2.tar.bz2
# vi --version
VIM - Vi IMproved 7.2 (2008 Aug 9, compiled Mar 30 2010 10:37:54)



vi search / replace regular expression
vi 不support "+" metacharacter

下面這些方法都可以work
:%s/\(--l7proto.*\)\(-j RETURN$\)/\1${IPGROUP}${SRC}${DST}\2/c
:%s/\(--l7proto[ a-z]*\)\(-j RETURN$\)/\1${IPGROUP}${SRC}${DST}\2/c
:%s/\(--l7proto \w* \)\(-j RETURN$\)/\1${IPGROUP}${SRC}${DST}\2/c

:%s/ \(${\w*}\)\(-j\)/\1 \2/c

下面這些方法不work (vi 不support unicode?)
:%s/\(--l7proto[\w ]*\)\(-j RETURN$\)/\1${IPGROUP}${SRC}${DST}\2/c
:%s/\(--l7proto[\w\x20]*\)\(-j RETURN$\)/\1${IPGROUP}${SRC}${DST}\2/c
:%s/\(--l7proto\x20\w*\x20\)\(-j RETURN$\)/\1${IPGROUP}${SRC}${DST}\2/c

search / replace 從特定行數到檔案結尾
:244,$s/MSN/FASTTRACK/g

對某一特定行做字串替換
:79,79s/MSN/SOULSEEK/g

將空白行(empty line) 刪除
:g/^[ ^I]*$/d

command mode
"#" 會自動搜尋目前游標的字串, 並且把該字串標示為反白


How to copy data from vi and paste the buffer into another file
Solution1:
1. Put the cursor on the first line you want to copy out.
2. Press "ma", i.e., "m" followed by "a"
3. Go to the last line you want to copy out.
4. Press ":'a,.w filename"
In step 2, you are marking the first line you want to write out with the "a" marker. In step 4, you are selecting all the lines from the "a" marker to the current line, inclusive, and writing them out to "filename".

Solution2:
If you know the starting and ending line numbers, say 1 to 100...
:1,100w newfile

2009年10月8日 星期四

2009年10月2日 星期五

Antivirus software

NOD32 seems has high performance in the virus blocking
http://www.eset.com.tw/

While I extended my personal SONET broadnetwork license, the SONET gave me one-year ESET (NOD32) free license. So ESET is the same as NOD32.
THE ESET program is "ESET Smart Security4"
license account:EAV-45911320
license password:6hnkre7t7x

upgrade pattern serial number web site
http://www.nod328.com/

Free antivirus software introduction
http://briian.com/?p=243

Windows XP needs to install service-pack (until 2010.12 the version is service pack 3)


『免費掃毒網址』 (Free web site to scan virus)

賣咖啡 Mcafee
http://www.mcafee.com/myapps/mfs/default.asp
熊貓 Panda
http://www.pandasoftware.com.tw/freescan/activescan.htm
Panda ActiveScan
http://www.pandasoftware.com/activescan/com/activescan_principal.htm
F-Secure Online Virus Scanner
http://support.f-secure.com/enu/home/ols.shtml