Showing posts with label Ubuntu筆記. Show all posts
Showing posts with label Ubuntu筆記. Show all posts

2011-05-08

profile & 版本控管

Profile:

1.安装valgrind 跟kcachegrind
$ sudo apt-get install valgrind
$ sudo apt-get install kcachegrind

2.跑profile跟读result
$ valgrind --tools=callgrind ./yourExe
$ kcachegrind callgrind.out.xxx

2010-05-03

iBus上裝嘸蝦米

Update到 10.04了,基本上是很順的,但是在輸入法上讓我很不滿意 Orz.
在9.10的時候,輸入法就已經從scim跳到iBus了,因為習慣用嘸蝦米,我一直都是用gcin,就算9.04用iBus,gcin還是可以很順利的在上面跑。到了10.04,不知道為什麼gcin執行後完全沒辨法打字跟切換輸入法><,看來還是要找用iBus跑嘸蝦米的方法,這安裝過程實在是有點不friendly,一場災難…… 參考下面幾個網站,才終於把嘸蝦米搞定,不過就算如此還是沒有很滿意,因為我很討厭浮動的語言列,我想要像gcin那樣,只在panel上有個小圖示,然後可以直接看到正在使用中輸入法是哪一個的這種模式Orz. Anyway,不論如何總算又可以打字了Orz 感謝以下幾個很有用的網站: [教 學] 如何使用 Windows 正版嘸蝦米製作超強版嘸蝦米 CIN 檔 (用於 GCIN 、OpenVanilla 或 Yahoo! 輸入法) //步驟1~9,用來產生CIN檔

[Ubuntu] 在 IBus 輸入法中,嘸蝦米的安裝心得 //步驟 10, 如何設定header (ibus-head.txt)


ubuntu9.10 嘸蝦米 for ibus


超級嘸蝦米7可盲打版本for ubuntu9.10 ibus
//步驟 9,11,12,支援可盲打與其它後序設定

下面是步驟:
1. 安裝正版的Windows嘸蝦米,取得表格檔。
liu-uni.tab
liu-uni2.tab
liu-uni3.tab
liu-uni4.tab

2.取得uni2txt.exe,對以上四個.tab檔執行,得到4個.txt檔。 (在windows下用command line執行,不然就要另外安裝wine)
uni2txt.exe liu-uni.tab liu-uni.txt
uni2txt.exe liu-uni2.tab liu-uni2.txt
uni2txt.exe liu-uni3.tab liu-uni3.txt
uni2txt.exe liu-uni4.tab liu-uni4.txt

3.將4個產生的.txt檔前面的空白去掉。
liu-uni.txt
liu-uni2.txt
liu-uni3.txt
以上三個檔各有一行
liu-uni4.txt 有很多很多行 (到 " dr 酖 *+" 跟"a 對 *+"之間)

4.抓以下5個檔
uni2txt.sh
liu-uni.tab 的 vrsf 選字
liu-uni2.tab 的 vrsf 選字
liu-uni3.tab 的 vrsf 選字
liu-uni4.tab 的 vrsf 選字

5. 將 uni2txt.sh 的以下四行註解掉 (前面加#)

# wine ./uni2txt.exe liu-uni.tab liu-uni.txt
# wine ./uni2txt.exe liu-uni2.tab liu-uni2.txt
# wine ./uni2txt.exe liu-uni3.tab liu-uni3.txt
# wine ./uni2txt.exe liu-uni4.tab liu-uni4.txt

6.執行
$ sh uni2txt.sh
這個動作會產生四行錯誤 (因為之前把四行註解掉了),可以不理這些錯誤
uni2txt.sh: line 18: gcin2tab: command not found
uni2txt.sh: line 29: gcin2tab: command not found
uni2txt.sh: line 40: gcin2tab: command not found
uni2txt.sh: line 51: gcin2tab: command not found
執行完之後會多出8個檔案,4個 .unix跟4個 .cin

7.把Ext-A跟Ext-B的漢字加進來:
下戴 Ext-A/Ext-B的加字加詞檔案(liu.box) 並執行以下的命令
iconv -f UTF-16 -t UTF-8 liu.box | tail -n +23 | sed -e 's/; / /' > liu-utf8.box

8.跟gcin table的表格檔merge,這樣完整的表格檔就已經產生了
cat noseeing.cin liu-uni2.unix liu-uni3.unix liu-uni4.unix liu-utf8.box | perl -nle '(print,$hash{$_}=1) unless defined $hash{$_}' > boshiamy-hyper.cin

9.convert 原本的scim跟gcin table
awk '/%chardef begin/{f=1;next}/%chardef end/{exit}f' boshiamy-hyper.cin | grep -v '^%' | awk '{counter[$1]++} END {} {print $1"\t"$2"\t"101-counter[$1]}' > liu.tmp

10.建立一個ibus-head.txt檔,裡面放下面的內容並用utf-8格式儲存
裡面可以自定要顯示在語言列的圖示 (可自己修改liu7.png成喜歡的圖檔)

### File header must not be modified
### This file must be encoded into UTF-8.
### This table under LGPL
### comments start with ### not single #
### Derive from the format of SCIM Table, so you can modify the table from
### scim-tables' table
SCIM_Generic_Table_Phrase_Library_TEXT
VERSION_1_0

### Begin Table definition.
BEGIN_DEFINITION
LICENSE = LGPL
UUID = 702d9641-a51b-4688-b4a2-8e8b8fe579cf
SERIAL_NUMBER = 20090709

ICON = liu7.png
NAME = liu5
NAME.zh_TW = 嘸蝦米
DESCRIPTION = Boshiamy Input Method
LANGUAGES = zh_TW
AUTHOR = Boshiamy Corp. Reic Wang
STATUS_PROMPT = TW
VALID_INPUT_CHARS = ,.'abcdefghijklmnopqrstuvwxyz[]
LAYOUT = us
MAX_KEY_LENGTH = 5
AUTO_COMMIT = FALSE

DEF_FULL_WIDTH_PUNCT = FALSE
DEF_FULL_WIDTH_LETTER = FALSE

USER_CAN_DEFINE_PHRASE = TRUE

PINYIN_MODE = TRUE

# 2009/11/26 更新,建議將此選項關閉,否則會動態調整 frequency ,會讓打字變的很不習慣
DYNAMIC_ADJUST = FALSE

END_DEFINITION

### Begin Table data.
### Format of every line whose formated in "input_keys\tphrase\tfreq\n" is an
### entry.
### From left to right, the 1st column are the input key combination that you
### entered via keyboard; the 2nd column are presented character or phrase of
### the key combination you want; the 3rd column are frequency of the character
### or phrase.



11.建立可以用來真正產生db的 liu7utf8ibus.txt檔
$ cat liu7ibusHead.txt> liu7utf8ibus.txt
$ echo 'BEGIN_TABLE'>> liu7utf8ibus.txt
$ cat liu.tmp >> liu7utf8ibus.txt
$ echo 'END_TABLE' >> liu7utf8ibus.txt
$ ibus-table-createdb -s liu7utf8ibus.txt -n liu7.db

12.後續小處理
把表格檔放到 /usr/share/ibus-table/tables 之中
把圖示放到 /usr/share/ibus-table/icons 之中
$ sudo cp liu7.db /usr/share/ibus-table/tables/
$ sudo cp liu7.png /usr/share/ibus-table/icons/
$ exit 100;
最後重啟ibus,就可以加入嘸蝦米到輸入法中,然後使用了。

2009-12-16

Ubuntu常用功能

開機自動mount

查出各磁區的UUID

$ ls -l /dev/disk/by-uuid

編輯/etc/fstab, 加入要mount的磁碟
UUID=[UUID] [要mount的點] [file system] [檔案系統參數] [能否被 dump 備份指令作用] [是否以 fsck 檢驗磁區]
基本上後面的三個參數不需要動,只要用 defaults 0 0就行了。
如: 要將uuid 為148EC9465619F2C6且檔案系統為ntfs 的磁碟mount到/media/Data, 只要加入下面一行就行:
UUID=148EC9465619F2C6 /media/Data ntfs defaults 0 0
更詳細的說明可以到鳥哥的Linux私房菜這邊看。



掛載iso檔

直接用mount指令
$ sudo mount -t iso9660 -o loop [iso檔路徑] [掛載點]



安裝嘸蝦米

安裝gcin輸入法
$ sudo apt-get install gcin

將支援gcin 的嘸蝦米表格檔安裝上去
sudo /usr/share/gcin/script/noseeing-inst

8.10後的版本應該不需要此行指令,不過多加也不會有影響
im-switch -s gcin

最後重新登入一次,就可以用了



將應用程式新增到menu中

在 /usr/share/applications 下新增一個 .desktop 的檔案
內容如下
[Desktop Entry]
Name=[程式名]
Comment=[程式說明]
Exec=[執行指令]
Terminal=0
Icon=[圖檔所在路徑]
Type=Application
Encoding=UTF-8
Categories=Application;[所在分類];

2009-12-15

ubuntu下安裝Texlive2009 & TeXwork

1.安裝pert-tk
sudo apt-get install perl-tk

2.進入TexLive資料夾,執行安裝程式
sudo perl install-tl -repository http://ftp.ctex.org/mirrors/CTAN/systems/texlive/tlnet/ -gui

3.安裝完成,在 ~/.profile 中加入

PATH=/usr/local/texlive/2009/bin/x86_64-linux:$PATH; export PATH

MANPATH=/usr/local/texlive/2009/texmf/doc/man:$MANPATH; export MANPATH

INFOPATH=/usr/local/texlive/2009/texmf/doc/info:$INFOPATH; export INFOPATH

4. /etc/environment 中加入
MANPATH_MAP /usr/local/texlive/2009/bin/x86_64-linux /usr/local/texlive/2009/texmf/doc/man

5. /etc/environment 中加入
/usr/local/texlive/2009/bin/x86_64-linux

6.在 /usr/local/texlive/2009/texmf.cnf 中加入放字型的檔案,例如
OSFONTDIR = ~/.fonts

7.更新与安装管理
$ sudo chown -hR [local user name] /usr/local/texlive/2009
$ tlmgr -gui //呼叫GUI
或是直接更新
$ tlmgr update -all

8.安裝TeXworks:
先下載到texworks-read-only資料夾下,再進行編譯
$ sudo aptitude install build-essential subversion libpoppler-qt4-dev libhunspell-dev libdbus-1-dev
$ svn checkout http://texworks.googlecode.com/svn/trunk/ texworks-read-only
$ cd texworks-read-only
$ qmake-qt4
$ make

compile成功,會在 texworks-read-only 資料夾中生成執行檔,複製到 /usr/bin 或 /usr/local/bin 下就可以使用了。