- mkdir /opt/google/chrome/plugins
- cd /opt/google/chrome/plugins
- ln -s `dpkg -L sun-java6-bin | grep libnpjp2.so` .
May 4, 2010
讓 Chrome 支援 Java
recover juniper ex-4200's root password
NOTE: Once in the CLI, you will need to enter configuration mode usingNOTE: the 'configure' command to make any required changes. For example,NOTE: to reset the root password, type:NOTE: configureNOTE: set system root-authentication plain-text-passwordNOTE: (enter the new password when asked)NOTE: commitNOTE: exitNOTE: exitNOTE: When you exit the CLI, you will be asked if you want to rebootNOTE: the system
Apr 29, 2010
hte: 超棒的 Hex's Editor

Apr 27, 2010
auto-update tags
function! UPDATE_TAGS()let _f_ = expand("%:p")let _cmd_ = '"ctags -a -f /dvr/tags --c++-kinds=+p --fields=+iaS --extra=+q " ' . '"' . _f_ . '"'let _resp = system(_cmd_)unlet _cmd_unlet _f_unlet _respendfunctionautocmd BufWritePost *.cpp,*.h,*.c call UPDATE_TAGS()
nmap:!find . -iname '*.c' -o -iname '*.cpp' -o -iname '*.h' -o -iname '*.hpp' > cscope.files \ :!cscope -b -i cscope.files -f cscope.out \ :cs reset
Dec 27, 2009
linux's core dump
先認定 core file size: ulimit -a
如果是 0 的話,我們需要先做一些動作,才有辨法開啟 core dump 的功能.1. sudo vi /etc/security/limits.conf, 加入這行
* soft core unlimited2. 開一個新的 terminal,輸入 ulimit -c,此時因該還是0, 利用 ulimit -c unlimited,更改成 unlimited。
設定完 core file size 之後,我使用下面程式來測試 debgu 的效果
/*
* file name: wrong.c
* gcc -g wrong.c -o wrong
*/
#include
#include
void func3()
{
//go to dia;
char *x = 0x0;
*x = 1;
printf("%s", x);
strcpy(x, "This is wrong");
}
void func2(void)
{
func3();
}
void func1(void)
{
func2();
}
int main(void)
{
func1();
return 0;
}
執行結果為:
程式記憶體區段錯誤 (core dumped)如沒有意外的話,因該可以看到多出了一個 core 的檔案
$file core有了 core file 之後,我們就可以利用 gdb 來做 backtrace
core: ELF 32-bit LSB core file Intel 80386, version 1 (SYSV), SVR4-style, from './wrong'
$ gdb wrong core
Core was generated by `./wrong'.我們大概可以知道是停在 func3 裡,透過 print 可知道,發生了什麼事
Program terminated with signal 11, Segmentation fault.
#0 0x08048264 in func3 () at wrong.c:8
warning: Source file is more recent than executable.
8
(gdb) p x另外,最好用的當然是 backtrace
$1 = 0x0
(gdb) p *x
Cannot access memory at address 0x0
(gdb) wherewhere 指令,我們能很清楚的知道是從
#0 0x08048264 in func3 () at wrong.c:8
#1 0x080482a4 in func2 () at wrong.c:15
#2 0x080482b1 in func1 () at wrong.c:20
#3 0x080482be in main () at wrong.c:26
(gdb) help where
Print backtrace of all stack frames, or innermost COUNT frames.
With a negative argument, print outermost -COUNT frames.
Use of the 'full' qualifier also prints the values of the local variables.
main -> func1 -> func2 -> func3另外還有一種情況是,程式掉進 trap,而不會觸發 SIGEGV signal,此時可以利用 xiaosuo 寫的 dumper 讓你所想要的程式觸發 signal 產生 core file。
將 wrong.c 中的 func3 改成
void func3()
{
//go into loop;
while(1){
sleep(1);
}
}
compiler完之後,讓 wrong_loop 於背景執行
./wrong_loop &當然,我們都知道,它是不會中止的,此時可以利用 dumper 來中止 wrong_loop 且產生 core file
[1] 31908
$ ./dumper 31908 -k產生了 core 我們就可利用 GDB 來debug
Start injecting(31908)...OK
[1]+ 不合法的命令 (core dumped) ./wrong_loop
$
$ file core
core: ELF 32-bit LSB core file Intel 80386, version 1 (SYSV), SVR4-style, from './wrong_loop'
$ gdb wrong_loop core
.....
Program terminated with signal 4, Illegal instruction.
#0 0xbfe0f4dc in ?? ()
(gdb) where
#0 0xbfe0f4dc in ?? ()
#1 0x08048266 in func3 () at wrong_loop.c:8
#2 0x08048273 in func2 () at wrong_loop.c:14
#3 0x08048280 in func1 () at wrong_loop.c:19
#4 0x0804828d in main () at wrong_loop.c:25
(gdb)
Reference:
Dec 13, 2009
UNISON 無法備份目錄的問題
fails to set permissions的 error,不過可自行更改一下 sync 的設定檔,加入下面二行
owner=false
perms=0
Reference:
Dec 2, 2009
coding style
-nbad -bap -nbc -bbo -bl -bli2 -bls -ncdb -nce -cp1 -cs -di2 -ndj -nfc1 -nfca -hnl -i2 -ip5 -lp -pcs -nprs -psl -saf -sai -saw -nsc -nsob

-nbad -bap -bbo -nbc -br -brs -c33 -cd33 -ncdb -ce -ci4 -cli0 -cp33 -cs -d0 -di1 -nfc1 -nfca -hnl -i4 -ip0 -l75 -lp -npcs -nprs -npsl -saf -sai -saw -nsc -nsob -nss

3. The original Berkeley style: : -orig
-nbad -nbap -bbo -bc -br -brs -c33 -cd33 -cdb -ce -ci4 -cli0 -cp33 -di16 -fc1 -fca -hnl -i4 -ip4 -l75 -lp -npcs -nprs -psl -saf -sai -saw -sc -nsob -nss -ts8
Nov 29, 2009
Nov 25, 2009
利用 rsa 登入 SSH Server
Generating public/private rsa key pair.2. scp ~/.ssh/*.pub 你欲登入的主機:~/.ssh/.
Enter file in which to save the key (/home/username/.ssh/id_rsa): [按 Enter 使用預設值(建議)]
Enter passphrase: 輸入你的 Passphrase
Enter same passphrase again: 再一次輸入你的 Passphrase
Your identification has been saved in /home/username/.ssh/id_rsa.
Your public key has been saved in /home/username/.ssh/id_rsa.pub.
The key fingerprint is: cc:e8:a9:da:a3:41:c6:a9:97:52:59:ef:0c:cf:45:b6 username@abc.com
3. ssh 你欲登入的主機
4. cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
5. chmod 711 ~/.ssh
6. chmod 644 ~/.ssh/authorized_keys
發現,用 ubuntu 9.10 完成以上這些動作,就可以直接登入主機,不需在使用 ssh-agent
Reference:
Nov 23, 2009
Diff & Merge tool
sdiff <- 單純印出,每一行的內容
vimdiff <- 好像沒辨法對目錄下所有的檔案做比較,希望可以像 meld 那樣
meld <- 目前試了一下,還不錯
kdiff3 <- 我大多是用 Gnome,不太想多裝 KDE lib
DiffMerge <- non-opensource
Reference:
Visual Diff Tools in Linux
超棒的 Debian 小技巧
Debian 小技巧 #1: 您可以使用 reportbug 套件中的 'reportbug' 指令來回報問題,或者也可使用圖形化介面 'reportbug-ng'。
Debian 小技巧 #2: 您可以使用 'dpkg-reconfigure
Debian 小技巧 #3: 您可以使用 'apt-cache search <關鍵字>' 搜尋所有套件的描述的關鍵字。
Debian 小技巧 #4: 您可以使用 'apt-cache policy
Debian 小技巧 #5: 如果您需要編譯一個自定的核心,請使用 kernel-package 套件中的 'make-kpkg' 指令稿。
Debian 小技巧 #6: 第 #6 個提示不存在。今天就來生一個!
Debian 小技巧 #7: 您可以使用 cron-apt 套件每晚自動下載您更新套件。
Debian 小技巧 #8: 如果您在 Debian 中遇到的問題,無法透過閱讀手冊和文件解決,那麼請到 Debian 用戶郵遞論壇詢問 (簡: debian-chinese-gb@lists.debian.org,繁: debian-chinese-big5@lists.debian.org)。
Debian 小技巧 #9: 如果您需要知道目前正在使用的 Debian 是什麼版本,請查看 /etc/debian_version;如果您想知道那個版本的開發代號 (例如: 3.0 的開發代號是'Woody'),請參考此連結: http://www.debian.org/doc/FAQ/ch-ftparchives.html#s-codenames
Debian 小技巧 #10: Debian 郵遞論壇討論使用者問題或者 Debian 政策文件。瀏覽 http://www.debian.org/MailingLists/ 並訂閱您所感興趣的內容吧。
Debian 小技巧 #11: 關心新聞 - 閱讀 Debian Times。請於線上瀏覽 http://times.debian.net/
Debian 小技巧 #12: 有一個 grep-dctrl 套件提供了若干指令,它們可用來快速搜索各種套件的 control 檔 (像是套件中的檔案)。
Debian 小技巧 #13: 如果您不喜歡使用某個 Debian 套件的預設選項,您可以把它的源碼下載下來,按照您的偏好重新編譯一個版本。請參考 http://www.debian.org/doc/FAQ/ch-pkg_basics.html (第 6.13 和 6.14 節) 瞭解更多資訊。不過請記住,大部分軟體的多數選項都能夠在執行時進行設定,通常不必重新編譯套件。
Debian 小技巧 #14: 如果您想追蹤某個套件的發展 (比如說,如果您希望瞭解缺陷回報,發行通知以及其它類似資訊),請考慮在套件追蹤系統 (Package Tracking System)中訂閱。您可以於此找到有關套件跟蹤系統 (PTS) 的更多資訊:http://www.debian.org/doc/manuals/developers-reference/resources.html (第 4.10 節)
Debian 小技巧 #15: 一般而言套件的文件可以在 /usr/share/doc/
Debian 小技巧 #16: 如果您正在搜索一個不知道屬於那個套件的檔案,請試試 'apt-file',它為這類資訊提供了一個小型的資料庫。或者您也可以從 Debian 套件資料庫中搜索這些內容,也可以進行檔案搜尋:"http://www.debian.org/distrib/packages#search_contents
Debian 小技巧 #17: 想找一些人聊聊 Debian 嗎? 如果您習慣於 IRC (Intenret Relay Chat) 聊天,只要安裝您慣用的 IRC 軟體,然後加入 irc.debian.org 的 #debian 或 #dot 或 #debian-zh 頻道就可以了。
Debian 小技巧 #18: 在 http://packages.qa.debian.org/
Debian 小技巧 #19: 如果您對從封裝軟體套件感興趣,您應該考慮安裝 apt-src 這個套件。
Debian 小技巧 #20: 想要持續追蹤某個您已安裝的套件版本紀錄 (對那些混用 stable / testing / unstable 系統的人尤其有用)?請試試 apt-show-versions。
Debian 小技巧 #21: 如果您的 Debian 機器所使用的連線速度很慢,但是您可以使用另一個比較快的網路,那麼請試試 apt-zip 套件。
Debian 小技巧 #22: 正在猶豫使用哪個 Debian 鏡像站?請試試 apt-spy 和 netselect-apt 套件,它們可以為您測試不同網站的速度。
Debian 小技巧 #23: 若您的系統佔用了太多的硬碟空間,請試試 deborphan 套件。它能建議您哪些套件是無用的且可刪除的。當然,別忘了清除掉 APT 暫存 (使用 'apt-get clean'、'aptitude clean'、或者 aptitude 工具選單中的 '動作'->'清除套件暫存' 選項)。
Debian 小技巧 #24: 如果您想感謝某個維護者對於所處理的問題的辛勞,請試試reportbug --kudos。
Debian 小技巧 #25: 'debian-reference' 套件為 Debian 使用者和開發人員提供了非常廣泛的參考文件。其中大多數資訊都在這個連結:http://www.debian.org/doc/manuals/reference。
Debian 小技巧 #26: 如果一個套件沒有足夠的參考文件,那麼請查找名為
Debian 小技巧 #27: 請定期檢查您的備份。您*確定*備份無誤了,對吧? 對吧?(此技巧帶給您的當頭棒喝是 '徹' '底' '崩' '潰',以及「空」。)
Debian 小技巧 #28: 如果您的機器並非持續處於開機狀態 (例如一台筆記型電腦),請試試 'anacron' 套件。即使在機器並未開機,它能夠確保讓該定期執行的軟體依然被啟動。
Debian 小技巧 #29: 保持您系統時鐘的精確性 - 請安裝 'ntpdate' 套件並且設定為每次開機自動啟動。另外,經常開機的機器應該通過安裝 'ntp' 套件在每次開機時進校時。
Debian 小技巧 #30: 若安裝了 'doc-base' 和 'doc-central' 套件以及相依的套件後,就可以從 http://localhost/ 來瀏覽文件囉。
Debian 小技巧 #31: 停用一個特定 runlevel 的開機服務,應該是將 /etc/rc
Debian 小技巧 #34: 有一個 'doc-debian' 套件提供了一些有關 Debian 項目的通用文件。它還有西班牙語版本 (doc-debian-es)、法語版本 (doc-debian-fr) 和烏克蘭語版本 (doc-debian-uk)。
Debian 小技巧 #35: 'devscripts' 套件為那些希望改進 Debian 的使用者提供了一些有用的指令,如 wnpp-alert, rc-alert 以及 bts。
Debian 小技巧 #36: 如果您希望追蹤 Debian 開發版 (sid),但只有少量的下載權限或者一個頻寬很小的網路,請試試 debdelta 套件。
Debian 小技巧 #37: 搜尋遊戲嗎 ? 試試 'goplay' 吧,它提供了一個很棒的使用介面可瀏覽各種類型的遊戲。
Debian 小技巧 #38: 需要一些比 Debian 穩定版更新的套件,但又不願升級到 'testing' 或者 'unstable' 嗎? 有些更新套件擺在 volatile.debian.org,另一些套件可在 www.backports.org 找到。
Debian 小技巧 #39: 希望下載一個套件但卻不想安裝它?請用 'aptitude download
Debian 小技巧 #40: 想學會使用軟體的新技巧嗎? \"man\" 是你最佳好友! 在 shell 下打 \"man <程式名稱>\" 或者打 \"man -H <程式名稱>\" 在瀏覽器下閱讀操作手冊。
Debian 小技巧 #41: 安裝 bash-completion 軟體套件可增強 bash's 的 tab 補齊功能。
Debian 小技巧 #42: 如果你安裝了 command-not-found,當你鍵入系統未安裝之軟體時候,系統將會自動提醒你應該安裝那個套件。
Debian 小技巧 #3: 您可以使用 'apt-cache show <套件名稱>' 或 'aptitude show <套件名稱> 來取得套件的詳細描述。
Debian 小技巧 #44: 您可以使用 'apt-file list <套件名稱> 來查詢套件中所包含得檔案。這個指令很接近 dpkg -L,只是不需要安裝或先下載該套件。
Nov 22, 2009
dns timing issus when install ttf-mscorefonts
以下做簡單的筆記:
1. sudo vi /var/lib/
2. sudo dpkg --configure -a#!/bin/bash
#Version: 1.0
#Info: Bash script to install mscorefonts without using
#currently broken ttf-mscorefonts-installer (3.0) for
#Ubuntu 9.10 Karmic Koala (date: 03/11/09)#Author: Jonathan K.
#Website: http://www.friendlytec hninja. vndv.com
#Email:#License: This is free to use and distribute (for free only) as long as
#credit is given to original author.#Create temp and mscorefonts dir
sudo mkdir /usr/share/fonts/truetype/ mscorefonts
mkdir /tmp/mscorefonts
cd /tmp/mscorefonts#Download links
wget http://sourceforge. net/projects/ corefonts/ files/the% 20fonts/ final/andale32. exe/download? use_mirror= cdnetworks- kr-1
wget http://sourceforge. net/projects/ corefonts/ files/the% 20fonts/ final/arial32. exe/download? use_mirror= cdnetworks- kr-1
wget http://sourceforge. net/projects/ corefonts/ files/the% 20fonts/ final/arialb32. exe/download? use_mirror= cdnetworks- kr-1
wget http://sourceforge. net/projects/ corefonts/ files/the% 20fonts/ final/comic32. exe/download? use_mirror= cdnetworks- kr-1
wget http://sourceforge. net/projects/ corefonts/ files/the% 20fonts/ final/courie32. exe/download? use_mirror= cdnetworks- kr-1
wget http://sourceforge. net/projects/ corefonts/ files/the% 20fonts/ final/georgi32. exe/download? use_mirror= cdnetworks- kr-1
wget http://sourceforge. net/projects/ corefonts/ files/the% 20fonts/ final/impact32. exe/download? use_mirror= cdnetworks- kr-1
wget http://sourceforge. net/projects/ corefonts/ files/the% 20fonts/ final/times32. exe/download? use_mirror= cdnetworks- kr-1
wget http://sourceforge. net/projects/ corefonts/ files/the% 20fonts/ final/trebuc32. exe/download? use_mirror= cdnetworks- kr-1
wget http://sourceforge. net/projects/ corefonts/ files/the% 20fonts/ final/verdan32. exe/download? use_mirror= cdnetworks- kr-1
wget http://sourceforge. net/projects/ corefonts/ files/the% 20fonts/ final/webdin32. exe/download? use_mirror= cdnetworks- kr-1 #Extract all .tff files
cabextract *.exe -F*.ttf -L#Rename files and move files
sudo cp andalemo.ttf /usr/share/fonts/truetype/ mscorefonts/ Andale_ Mono.ttf
sudo cp ariali.ttf /usr/share/fonts/truetype/ mscorefonts/ Arial_Italic. ttf
sudo cp arialbd.ttf /usr/share/fonts/truetype/ mscorefonts/ Arial_Bold. ttf
sudo cp arialbi.ttf /usr/share/fonts/truetype/ mscorefonts/ Arial_Bold_ Italic. ttf
sudo cp arial.ttf /usr/share/fonts/truetype/ mscorefonts/ Arial.ttf
sudo cp ariblk.ttf /usr/share/fonts/truetype/ mscorefonts/ Arial_Black. ttf
sudo cp comicbd.ttf /usr/share/fonts/truetype/ mscorefonts/ Comic_Sans_ MS_Bold. ttf
sudo cp comic.ttf /usr/share/fonts/truetype/ mscorefonts/ Comic_Sans_ MS.ttf
sudo cp cour.ttf /usr/share/fonts/truetype/ mscorefonts/ Courier_ New.ttf
sudo cp courbd.ttf /usr/share/fonts/truetype/ mscorefonts/ Courier_ New_Bold. ttf
sudo cp courbi.ttf /usr/share/fonts/truetype/ mscorefonts/ Courier_ New_Bold_ Italic. ttf
sudo cp couri.ttf /usr/share/fonts/truetype/ mscorefonts/ Courier_ New_Italic. ttf
sudo cp georgiaz.ttf /usr/share/fonts/truetype/ mscorefonts/ Georgia_ Bold_Italic. ttf
sudo cp georgiab.ttf /usr/share/fonts/truetype/ mscorefonts/ Georgia_ Bold.ttf
sudo cp georgiai.ttf /usr/share/fonts/truetype/ mscorefonts/ Georgia_ Italic. ttf
sudo cp georgia.ttf /usr/share/fonts/truetype/ mscorefonts/ Georgia. ttf
sudo cp impact.ttf /usr/share/fonts/truetype/ mscorefonts/ Impact. ttf
sudo cp times.ttf /usr/share/fonts/truetype/ mscorefonts/ Times_New_ Roman.ttf
sudo cp timesbd.ttf /usr/share/fonts/truetype/ mscorefonts/ Times_New_ Roman_Bold. ttf
sudo cp timesbi.ttf /usr/share/fonts/truetype/ mscorefonts/ Times_New_ Roman_Bold_ Italic. ttf
sudo cp timesi.ttf /usr/share/fonts/truetype/ mscorefonts/ Times_New_ Roman_Italic. ttf
sudo cp trebuc.ttf /usr/share/fonts/truetype/ mscorefonts/ Trebuchet_ MS.ttf
sudo cp trebucbd.ttf /usr/share/fonts/truetype/ mscorefonts/ Trebuchet_ MS_Bold. ttf
sudo cp trebucbi.ttf /usr/share/fonts/truetype/ mscorefonts/ Trebuchet_ MS_Bold_ Italic. ttf
sudo cp trebucit.ttf /usr/share/fonts/truetype/ mscorefonts/ Trebuchet_ MS_Italic. ttf
sudo cp verdanab.ttf /usr/share/fonts/truetype/ mscorefonts/ Verdana_ Bold.ttf
sudo cp verdanai.ttf /usr/share/fonts/truetype/ mscorefonts/ Verdana_ Italic. ttf
sudo cp verdanaz.ttf /usr/share/fonts/truetype/ mscorefonts/ Verdana_ Bold_Italic. ttf
sudo cp verdana.ttf /usr/share/fonts/truetype/ mscorefonts/ Verdana. ttf
sudo cp webdings.ttf /usr/share/fonts/truetype/ mscorefonts/ Webdings. ttf #Clean up
cd ~
rm -r /tmp/mscorefonts
應該選那一個 File System 呢?
Reference:
我的舊筆電 M2N 裝 Ubuntu 9.10
之前M2N上一直是使用 ubuntu 8.04 一直沒有升級,這次等 9.10 一出,一口氣從新安裝新版的 ubuntu,中間出現蠻多相容性的問題。
1. ubuntu 9.10 安裝時,多增加
acpi=off and nolapic2. 安裝完之後,更改 grub 開機參數
/etc/default/grub3. xorg.conf 改使用 vesa
GRUB_CMDLINE_LINUX_DEFAULT 中加入 nolapic nomodeset
Section "Device"
Identifier "Configured Video Device"
Driver "vesa"
EndSection
Section "Monitor"
Identifier "Configured Monitor"
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
EndSection
Nov 16, 2009
dvtm || dynamic virtual terminal manager
Keyboard commands
Mod : 預設為 ^g, 更改於 config.h 或 -m 的方式
Mod-c : 新增一個 window.
Mod-x : 關閉目前 window.
Mod-l : 增加 5% 主視窗的寬度.
Mod-h : 減加 5% 主視窗的寬度.
Mod-j : 移到下一個視窗.
Mod-k : 移到上一個視窗.
Mod-[1..n] : 移到第 n 個視窗
Mod-. : Toggle minimization of current window.
Mod-u : Focus next non minimized window.
Mod-i : Focus prev non minimized window.
Mod-m : Maximize current window (change to fullscreen layout).
Mod-PageUp : Scroll up.
Mod-PageDown : Scroll down.
Mod-Space : Toggle between defined layouts (affects all windows).
Mod-Enter : Zooms/cycles current window to/from master area.
Mod-t : Change to vertical stack tiling layout.
Mod-b : Change to bottom stack tiling layout.
Mod-g : Change to grid layout.
Mod-s : Shows/hides the status bar.
Mod-r : Redraw whole screen.
Mod-G : Escape the next typed key.
Mod-X : Lock screen.
Mod-M : Toggle dvtm mouse grabbing. Mod-q Quit dvtm.
Mouse commands
Copy and Paste : 按 SHIFT 加左鍵反白要 Copy 的文字,SHIFT 加中鍵為貼上
Button1 click : Select window.
Button1 double click : Select window and toggle maximization.
Button2 click : Zooms/cycles current window to/from master area.
Button3 click : Toggle minimization of current window.
延申閱讀:
Apr 9, 2009
財報發佈時間
- [月報]:次月的10日之前,只需要提供營收不需要獲利
- [季報]:4月30日及10月31日前,需要提供獲利狀況
- [半年報]:8月31日前,除了提供獲利還需要提供合併報表
- [年報]:次年的4月30日日前,需提供最完整的財務資料


