Tuesday, July 29, 2008

輸出eps檔案,以利用在插入latex檔案

關鍵字:設定PostScript printer,轉成eps檔案,latex

1. 安裝好Adobe PostScript Driver (PS印表機)
2. 列印的ppt或是任何文件檔成prn檔時,選擇Generic PostScript Printer,並勾選"列印至檔案"
3. 設定好Postscipt Printer,按下"內容",選擇"進階",展開"PostScript選項"
4. 選擇PostScript輸出選項為"壓縮式PostScript(EPS)"
5. 按下列印後,打開輸出好的XXX.prn,使用GSview打開。
6. Orientation選擇"Portrait",Media看輸出圖片大小可選擇"A4"或"A3"。
7. 打開"File",選擇"PS to EPS",選擇輸出檔案名稱和位置。
8. XXX.eps就可以用囉!
例如,
\begin{figure}
\centering
\includegraphics[width=0.3\textwidth]{XXX.eps}
\caption{This is test!}
\label{fig:test}
\end{figure}

Friday, July 25, 2008

安裝htk 3.4在cygwin上

網路上的說明大多是英文的,提供個翻譯的中文版本給大家。
參考自http://www.phon.ucl.ac.uk/resource/sfs/howto/htk.htm
參考自http://www.llaisdy.com/blog/2007/07/30/compiling-htk-34-on-windows-xp/

使用 cygwin(1.5.25-14)安裝htk 3.4
前置作業
1. 啟動"cygwin_setup.exe,可以從Cygwin首頁下載或是http://cygwin.com/setup.exe
2. 選擇安裝方式。
  • 選擇 "Install from Internet",表示從網路下載套件並安裝,確認電腦的網路是OK的話,就選擇使方式。
  • 另外也可以只下載套件,選擇"Download from Internet"。
  • 或是選擇"Install from Local Directory",只進行安裝已經下載好的套件。
3. 選擇安裝目錄(資料夾),建議選擇預設的"C:/cygwin",除非你是高手,如果你是高手應該也不用看翻譯了吧。
4. 選擇下載後的套件要放在哪個資料夾,例如 "C:/download/cygwin",下次要離線安裝的話,就可以選擇此目錄。
5. 選擇網路連線方式,不需要更改,直接下一步。
6. 選擇下載的網站,當然選自己國家的網站,下載速度會比較快,以台灣為例,有這些可以選擇
  • 台灣大學 ftp://ftp.ntu.edu.tw
  • 元智大學 ftp://ftp.cse.yzu.edu.tw或http://ftp.cse.yzu.edu.tw
7. 選擇下載套件,因為要能夠使用htk,所以需要以下套件
  • 所有在"Base"的套件,如果在NEW的那一欄顯示skip就用滑鼠點選最新的版本來下載。
  • 在Devel分類的BINUTILS: The GNU assembler, linker and binary utilities,點選後,會自動也點選有相依性的套件。
  • 在Devel分類的GCC: C Compiler。
  • 在Devel分類的GCC-G++: GCC C++ compiler。
  • 在Devel分類的MAKE: the GNU version of the 'make' utility 。
8. 等待下載和安裝。
9. 安裝完畢後,可以選擇要在桌面放啟動捷徑或是在程式集顯示Cygwin資料夾。

接下來安裝HTK 3.4

1. 下載HTK原始碼,到http://htk.eng.cam.ac.uk/的Download區下載,下載前要先註冊。
2. 下載HTK source code (tar+gzip archive) 和 HTK samples (tar+gzip archive) ,放到C:\cygwin\home\User_name\資料夾。
3. 啟動cygwin,正常來講起始位置是C:\cygwin\home\User_name\下,沒錯的話輸入ls,會看到剛剛移動過來的HTK-3.4.tar.gz。
4. 解壓縮HTK-3.4.tar.gz,輸入tar xvfz HTK-3.4.tar.gz,完畢後輸入ls,會看到home\User_name\下多了一個htk資料夾。
5. 接下來要修改htk\HTKTools下的Makefile.in文件內容,可以直接在windows下修改或是使用cygwin的編輯器。
6. 打開htk\HTKTools下的Makefile.in,將裡面的某一段程式碼的"-lX11"刪除,如下。

%: %.c $(HTKLIB)
if [ ! -d $(bindir) -a X_ = X_yes ] ; then mkdir -p $(bindir) ; fi
if [ x$@ = xHSLab ] ; then
$(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) -lX11 ;
else
$(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) ; fi

變成,

%: %.c $(HTKLIB)
if [ ! -d $(bindir) -a X_ = X_yes ] ; then mkdir -p $(bindir) ; fi
if [ x$@ = xHSLab ] ; then
$(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) ;
else
$(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS) ; fi

7. 複寫HGraf.c檔。在htk目錄下,輸入以下指令。

$ cd HTKLib \\進入HTKLib資料夾
$ cp HGraf.c HGraf.c.original \\將HGraf.c重新命名為HGraf.c.original
$ cp HGraf.null.c HGraf.c \\將HGraf.null.c重新命名為HGraf.c
$ cd ..\\回到htk資料夾

8. 接下來回到htk資料夾後,依照此目錄的README,依序輸入
$ ./configure
$ make
$ make install

9. 大功告成

如果是安裝3.3.以下的版本,請參考http://speech.ee.nthu.edu.tw/index.php?n=Lab.HtkCygwin

Tuesday, July 15, 2008

讓舊版office可以讀取office2007的相容套件

此套件可以讓Office 2000、Office XP 或 Office 2003可以讀取Office 2007的Word、Excel,或 PowerPoint 2003,下載頁面和注意事項在下面URL中。
http://www.microsoft.com/downloads/details.aspx?displaylang=zh-tw&FamilyID=941b3470-3ae9-4aee-8f43-c6bb74cd1466

Sunday, June 8, 2008

浮點數轉字串(float to string) 字串轉浮點數(string to float)

stdlib.h

strtod
Convert string to double (function)
atof
Convert string to double

Wednesday, April 16, 2008

compile problem of C program on linux

undefined reference to `sqrt' undefined reference to `pow'

add –lm, means to link the math library.
So the compile command is gcc -lm your_program.c –o your_program.

undefined reference to `strupr'
Because standard "string.h" doesn't have strupr function,
you have to write the function to be strupr.

Ex.
#include
void make_upper_case(char *s)
{
while (*s)
{
*s = toupper((unsigned char) *s);
s++;
}
}

Clicky

Clicky Web Analytics