2010年11月25日

simple trunc implement

uClibc的libm沒有trunc function的實作, 如果一定要用到的話, 可以加入簡單的實作:

2010年11月10日

Centos安裝mplayer等第三方套件

Centos除了原本跟RHEL相同的套件之外, 也可以透過第三方的repository來提供.
  1. RPMforge
  2. EPEL 
在安裝完成後,就可以用yum安裝一些centos原本沒有的套件了, 如:
htop
meld

2010年11月4日

改變pidgin的佈景主題

最近在XP上安裝了pidgin 2.7.5, 可是外觀是標準的gtk windows theme. 想換換外觀, 在網路上找了一些資料. 這一篇是我在網路上看到最完整的. 簡單來說, pidgin是跟著gtk來換theme的, gtk用什麼, pidgin就用什麼. 結果我用gtk theme selector上換了theme, selector上的theme是換了, 但 pidgin上沒換.

2010年10月29日

Install MSYS

就如同官網上所講的, MSYS可以讓Windows有基本的Linux Shell的指令.
MSYS is a collection of GNU utilities such as bash, make, gawk and grep to allow building of applications and programs which depend on traditionally UNIX tools to be present. It is intended to supplement MinGW and the deficiencies of the cmd shell.

但由於mingw-get-inst自動安裝程式下載msys的套件安裝還有問題, 所以我改用手動安裝.
官網的安裝說明: http://www.mingw.org/wiki/msys

2010年10月28日

Add vi keys to eclipse editor

Vrapper is an eclipse plugin which acts as a wrapper for eclipse text editors to provide a Vim-like input scheme for moving around and editing text.
To install Vrapper, add the remote site http://vrapper.sourceforge.net/update-site/stable to your Eclipse Update Manager.


2010年10月26日

MinGW installation

It seems the MinGw main site is broken currently. (2010 Oct 26)
The automated MinGW Installer (mingw-get, mingw-get-inst) still can't find some of the packages.
I do some googling and find another maintainer of MinGW -- TDM-GCC which has a better installer.

用remserial來建立一個serial port I/O

首先, 需建立一個輸入端:
# nc -l -p 2000 -t
再用remserial 連線到這個port
#  remserial -r localhost -p 2000 -l /dev/remserial /dev/ptmx
如此在netcat下輸入的資料, 都會被導向到/dev/remserial這個pseudo serial port去

2010年9月24日

sendmail使用hibox寄信


在台灣使用sendmail寄信到外部郵件信箱(如gmail, pchome, hinet...), 大概都會遇到smtp需要認證的問題(SMTP AUTH). 為了解決這個問題, 必需要把sendmail的SMART_HOST, confAUTH及MASQUERADE功能打開. 

2010年9月22日

Office 2003, 2007共存的問題

若您在安裝office時跟我一樣選擇留下舊版的office2003的話,
在使用完2003後再開啓2007, 或者是用完2007再開2003, 可能都會再進入安裝的畫面.

2010年9月18日

手動複製ubuntu Linux

複製硬碟由小到大簡單, 由大到小比較難, 我就遇到這種問題.
兩家2G的卡片, 就有不同的大小.

這是第一個CF的大小
Disk /dev/sda: 2079 MB, 2079866880 bytes
這是第二個的
Disk /dev/sdb: 2029 MB, 2029805568 bytes

這是partition的layout
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 3756031 1876992 83 Linux
/dev/sda2 3758078 4061183 151553 5 Extended
/dev/sda5 3758080 4061183 151552 82 Linux swap / Solaris

在較小的CF卡上, 我決定將後面的swap放棄掉. Linux的partition不變.


1. 我先備份bootloader(Grub)
$dd if=/dev/sda of=MBR-backup bs=446 count=1
我不備份到512bytes的原因, 是因為不想備份到partition table.
參考這篇文章: http://embraceubuntu.com/2005/10/20/backing-up-the-mbr/

2. 按照之前sda所得到的partition table, 用fdisk設定到sdb上, 只有swap的partition變小.
並將之格式化.
# mkfs.ext2 /dev/sdb1
swap 因為要設定UUID, 所以待會再做
再把bootloader 還原回去
$ dd if=MBR-backup of=/dev/sdb

3. 將/dev/sdb1 mount 到/mnt上, 用rsync備份根目錄下的資料到/mnt下

# mount /dev/sdb1 /mnt
# cd /
因為mnt, proc, sys的目錄都是虛擬的檔案系統, 所以不用copy
# rsync -a --exclude=mnt --exclude=proc --exclude=sys * /mnt/
# sync

4. 最後, 需要修改硬碟磁區的UUID及udev網卡的rule
因為ubuntu 用UUID來區別partition, 因此需要根據原本的/etc/fstab所記載的UUID來修改.
# tune2fs -U b39b9f26-ebfa-470b-a68a-30dbcc0e7a13 /dev/sdb1
參考網址如下:
http://wiki.linux.org.hk/w/Manage_filesystem_with_UUID
swap的UUID需在mkswap就指定
# mkswap -U 592b51dd-5e1e-440f-9017-f200e7bf078c /dev/sdb5

由於要使用新的CF卡的是另一台相同硬體的電腦, 因此網卡的mac是不同的, 而ubuntu的網卡命名方式又是由mac address來決定
網卡的名稱是由udev的70-persistent-net.rules
修改 /etc/udev/rules.d/70-persistent-net.rules
將mac address改為新硬體網卡的 mac就可以了

註: 我不直接改新CF卡上的/etc/fstab裡的UUID是有原因的; 如果直接將新CF卡裡的/etc/fstab內的根目錄及swap改成新卡上的UUID, 開機時仍會找不到舊的UUID, 我猜想initrd裡是不是也有記錄同樣的fstab. 為了怕麻煩, 直接將新CF卡上的UUID改成跟以前一樣比較快.

2010年9月6日

Cisco也有GPL code可以下載

Cisco也有GPL code可以下載喔...
http://homesupport.cisco.com/en-us/gplcodecenter?referrer=www.linksysbycisco.com


原因在這篇文章中
http://www.openfoundry.org/en/worldwide-news/1930


YAML

我覺得YAML可以用在比較複雜的設定檔上, 它有提供各種語言的parser, 也比XML來得簡單. Google App engine也用這種語言來做設定檔的語法. 
下載網站: http://www.yaml.org/


以下為wikipidia的介紹:
YAML(IPA: /ˈjæməl/,尾音類似camel駱駝)是一個可讀性高,用來表達資料序列的程式語言。 YAML參考了其他多種語言,包括:XMLC語言PythonPerl以及電子郵件格式 RFC2822。Clark Evans在2001年在 首次發表了這種語言[1] ,另外Ingy döt Net與Oren Ben-Kiki也是這語言的共同設計者。目前已經有數種程式語言或腳本語言支援(或著說解析)這種語言。
YAML是"YAML Ain't a Markup Language"(YAML不是一種置標語言)的遞歸縮寫在開發的這種語言時,YAML 的意思其實是:"Yet Another Markup Language"(仍是一種置標語言),但為了強調這種語言以數據做為中心,而不是以置標語言為重點,而用返璞詞重新命名。

http://zh.wikipedia.org/zh-tw/YAML

CVS指令找改過的檔案

CVS版本管理系統雖然古老但是還是很多人在用, 至少我之前的公司就是
cvs status雖然可以找到變更的檔案有時卻又太多
這兩個指令可以找到有變更的檔名, 出處我已經忘了.
# Show new files in current project
"cvs status | grep ?"
# Show status of all *not* Up-to-date files
"cvs status | grep Status | grep -v Up"

2010年9月3日

你的Editor用什麼字型呢??

我開始用Bitstream Vera Sans Mono 是因為我發現Gnome的字型很好看,
後來研究後發現這種字型很像Linux上用的 ...
看了下面這篇文章後發現原來大家的感覺差不多 ...
另外一個字型Consolas 是Vista才有的(但可以下載), 看起來也很不錯喔 ...
唯一缺點是從MS下載回來的安裝程式, 會檢查你有沒有安裝 Visual Stdio

http://www.sitepoint.com/blogs/2009/05/01/top-10-programming-fonts/

2010年8月24日

xming 改變字型大小

Xming 是一個在 Microsoft Windows 作業系統上運行 X Window System  自 由軟件
安裝方式可參考 http://www.cs.nctu.edu.tw/help/xming.html
使用Xming開啓gnome-terminal時, dpi 100時字會太小, 可以用Ctrl Shift + 來放大,
或者可以修改啓動檔.xlaunch來指定解析度.
RemoteUser="jim" Display="5" Clipboard="true" ExtraParams="-dpi 95"/>

2010年5月5日

Use mutt receive email

如果要用mutt內建的pop/imap收信功能, 首先要檢查是否compile時有enable
# mutt -v
+USE_POP  +USE_IMAP
1. 執行mutt
2. 假設要連線到pop3 server:www.hibox.hinet.net
3. 按c 改變mail box 路徑
4. 輸入: pop://email-account@www.hibox.hinet.net 
5. 若要使用imap, 則改變pop成imap即可imap://email-account@www.hibox.hinet.net

2010年4月29日

Install mplayer on Fedora 9

Fedora 9 所帶的yum repository 是不包含mplayer的, 所以要透過安裝第三方的repository才可以找到. 但是2010年還在maintainFC9的server也不多了, Google了一陣子終於找到可以用的.

2010年4月27日

Xming裡使用中文輸入法

使用Xming來遠端執行Linux程式已經很久了, 但是一直沒有方式可以輸入中文,
後來看了這篇文章後才成功的.

首先輸入法應該改用gcin, 因為其它輸入法不支援遠端client.
還要改變輸入視窗開啟的方式, 以免與Windows Ctrl+Space相沖, 以及選擇遠端client支援.

2010年4月26日

在firefox中完全移除ask.com toolbar

在灌KMPlyaer時不小心灌了ask.com的toolbar, 導至在firefox及ie6預設的search engine都被改了. 刪除的方法, 在 firefox中, 除了用工具->附加元件 去移除之外, 另外還得要在網址列打"about:config" 進入偏好設定去刪除其它的部份
參考下圖

2010年2月9日

連線到Samba整個桌面hang住

最近不知道灌了什麼軟體, 在連線到Samba時, 檔案列表出現後,
整個系統就hang住不動, 調整過Samba的設定值也沒用,
問過同事後發現別人並沒有我的狀況, 應該是我的Windows XP的問題.
Google了一下發現WebClient這個Service最有可能, 把它停用後就正常了.

2010年1月26日

Extract file from Tarball

下載下來的kernel source tarball不想整個解開,
只要解開某個目錄時, 可以用下面的指令
tar -xvf tarball.tar.gz {path/to/dir}
For example, only usb driver directory:

# tar -xf linux-2.6.24.tar.gz linux-2.6.24/drivers/usb/

2010年1月22日

將Bing翻譯加到Microsoft office中

微軟出的線上翻譯 Bing翻譯
http://www.microsofttranslator.com/Default.aspx

原本Microsoft Office 2003 & 2007 的翻譯為WorldLingo
下載 Microsoft Translator installer for Microsoft Office
安裝好後就會改用Bing翻譯了

Listen to online radio

First, install mplayer, gnome-mplayer
http://www.ubuntugeek.com/install-mplayer-and-multimedia-codecs-libdvdcss2w32codecsw64codecs-in-ubuntu-904-jaunty.html

gecko-mediaplayer. A Mozilla browser plug-in to handle media on websites, using gnome-mplayer
sudo apt-get install gecko-mediaplayer
Open firefox->Tools->Manage Content Plug-ins, Change Windows Media video content handler to Gecko Media Player

Setup Viewvc on Fedora9


  1. yum install viewvc
  2. Edit /etc/viewvc/viewvc.conf, modify cvs_roots to your current CVSROOT
  3. Edit /etc/httpd/conf.d/viewvc.conf

2010年1月21日

blogger舊帳號轉google帳號的問題

我有一個舊的blogger帳號及網址很久沒用了,在轉換成google帳號之後,
發現在blogger資訊主頁上並不會出現,  在討論區爬了一些文之後, 找到了解決方式
http://groups.google.com/group/blogger-help-troubleshoot/browse_thread/thread/b6d0944608e0def3/7c335565e95a3355?lnk=gst&q=old+blogger#7c335565e95a3355

只要到下面的網址
http://blogger.com/forgot.g
登入之後會再收到一封含有登入指示的電子郵件,
再照指示去做, 舊的網址就會出現了

2010年1月16日

a small and nice ini parser -- iniParser

Today I finished cross-compiling wvdial package. After I cross-compiling it, I found that it has some problem to load the wvdial.conf. And I also know that passing arguments to the wvdial is still working. Finally, I decide to modify the wvdial program to load the wvdial.conf by my own. I load the config file with iniParser and pass it to the cfg object. Now it works perfectly !!

wvdial -- a utility that helps in making modem-based connections to the Internet
wvdial site
wvdial wiki
iniParser home
wvdial introduction 

2010年1月11日

compiling wvstreams lib on Ubuntu

Install pre-requests:
sudo apt-get install build-essential libssl-dev libreadline5-dev zlib1g-dev

wget http://wvstreams.googlecode.com/files/wvstreams-4.6.1.tar.gz
tar zxvf wvstreams-4.6.1.tar.gz
./configure
make

2010年1月5日

cvsync: 好用的cvs同步工具

cvsync 網址
http://www.cvsync.org/

預設設定檔位址
/usr/local/etc/
設定檔範例在samples目錄
cvsync.conf是給client用
cvsyncd.conf是給server用

如果在compile的時候出現下面訊息, 則是沒有指定HASH_TYPE

WARNING! Please specify the HASH_TYPE.
  libgcrypt
  mhash
  native (default)
  openssl
make[1]: *** [hash-error] Error 1
直接在make後面指定就可以了
make HASH_TYPE=openssl

2010年1月3日

ubuntu上mount lvm partition

ubuntu 9.10灌好後, 最先就是把之前灌fedora那個硬碟的資料copy回來.
由於fedora 9預設是用lvm的partition, 因此要安裝lvm2套件,
剩下的, 就是把lvm mount起來
# sudo apt-get install lvm2
# sudo vgscan
# sudo vgchange -ay VolGroup00
# sudo lvs
# sudo mount /dev/VolGroup00/LogVol00 /mnt
Reference: http://www.linux-sxs.org/storage/fedora2ubuntu.html

coap-client 4.3.0 Windows build

coap-client  is a  wget -like tool to generate simple requests for retrieval and modification of resources on a remote server.  Got the sour...