星期四, 12月 30, 2010
只有sata光碟機也可以用舊的autoxp執行ghost
奇怪的skype IE plugin竟然與windows update功能相衝
星期五, 12月 24, 2010
在colinux使用pcap-bridge網路模式
eth0=pcap-bride
但是, 如果需要設定網路卡的mac address, 則記得要把實體對應的網路卡名稱也加入, 否則網路不會通, 例如:
eth0=pcap-bridge,"區域連線",00:FF:67:4F:30:00
不過, colinux.conf似乎對中文的支援不是很好, 有時候會抓不到區域連線.
所以如果可以的話, 還是把區域連線改成英文, 例如: LAN
所以colinux.conf的設定就要改成
eth0=pcap-bridge,"LAN",00:FF:67:4F:30:00
星期二, 12月 14, 2010
常用Linux開發環境設定
alias grep='/bin/grep -n --color --exclude="*\.svn*" --exclude=tags --exclude="*\.ccache*"'
alias screen='/usr/bin/screen -e^Pp -h 10000'
#export LANG=C
在~/.screenrc中加入下列設定:
shell -$SHELL # run the login shell
設定git環境
git config --global user.name 使用者名稱
git config --global user.email 電子郵件
git config --global color.diff auto
git config --global color.status auto
git config --global color.branch auto
git config --global color.ui auto
在Linux建立vim程式開發環境
curl http://cscope.sourceforge.net/cscope_maps.vim > ~/.vim/plugin/cscope_maps.vim
啟動vim的 :Tlist功能
下載taglist_45.zip
cd ~/.vim
unzip taglist_45.zip
其他設定
將下列設定加到~/.vimrc檔案中
if has("autocmd")
filetype plugin indent on
endif
if has("syntax")
syntax on
endif
set viminfo='10,\"100,:20,%,n~/.viminfo
autocmd BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endifset cursorline
set showmatch
set incsearch
set hlsearch
set number
set tabstop=4
set shiftwidth=4
另外,有關vim的熱鍵可以參考下列網址,還蠻詳細的喔!
http://www.lslnet.com/linux/f/docs1/i43/big5303074.htm
自己用doxygen產生API document
星期六, 6月 05, 2010
星期一, 1月 04, 2010
Keystoke causes android.process.acore to crash
After replacing the touchscreen device with a LCD and keyboard, I find android.process.acore will crash while trying to type with the keyboard. This bug also occurs when executing Contacts and dialer applications. According to the messages shown by logcat, this bug is resulted from failing to load resource required by Android.
According to this description, Android system cannot find the required resources for notouch device. So, we can fix this bug by copying each folder ending with -finger to the one ending with -notouch.
D/AndroidRuntime( 760): Shutting down VM
W/dalvikvm( 760): threadid=3: thread exiting with uncaught exception (group=0x4000fe70)
E/AndroidRuntime( 760): Uncaught handler: thread main exiting due to uncaught exception
E/AndroidRuntime( 760): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android.contacts/com.android.contacts.DialtactsActivity}: android.content.res.Resources$NotFoundException: Resource ID #0x7f030005
E/AndroidRuntime( 760): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2268)
E/AndroidRuntime( 760): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2284)
E/AndroidRuntime( 760): at android.app.ActivityThread.access$1800(ActivityThread.java:112)
E/AndroidRuntime( 760): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1692)
E/AndroidRuntime( 760): at android.os.Handler.dispatchMessage(Handler.java:99)
E/AndroidRuntime( 760): at android.os.Looper.loop(Looper.java:123)
E/AndroidRuntime( 760): at android.app.ActivityThread.main(ActivityThread.java:3948)
E/AndroidRuntime( 760): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime( 760): at java.lang.reflect.Method.invoke(Method.java:521)
E/AndroidRuntime( 760): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:782)
E/AndroidRuntime( 760): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:540)
E/AndroidRuntime( 760): at dalvik.system.NativeStart.main(Native Method)
E/AndroidRuntime( 760): Caused by: android.content.res.Resources$NotFoundException: Resource ID #0x7f030005
E/AndroidRuntime( 760): at android.content.res.Resources.getValue(Resources.java:846)
E/AndroidRuntime( 760): at android.content.res.Resources.loadXmlResourceParser(Resources.java:1796)
E/AndroidRuntime( 760): at android.content.res.Resources.getLayout(Resources.java:685)
E/AndroidRuntime( 760): at android.view.LayoutInflater.inflate(LayoutInflater.java:318)
E/AndroidRuntime( 760): at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
E/AndroidRuntime( 760): at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:309)
E/AndroidRuntime( 760): at android.app.Activity.setContentView(Activity.java:1626)
E/AndroidRuntime( 760): at com.android.contacts.DialtactsActivity.onCreate(DialtactsActivity.java:73)
E/AndroidRuntime( 760): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
E/AndroidRuntime( 760): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2231)
E/AndroidRuntime( 760): ... 11 more
I/Process ( 556): Sending signal. PID: 760 SIG: 3
I/dalvikvm( 760): threadid=7: reacting to signal 3
References:
http://d.android.com/guide/topics/resources/index.html
Error in loading /system/usr/keychars/qwerty.kcm.bin
星期二, 9月 01, 2009
指定Java Application使用的語言
開發Java程式時, 可以利用resource的方式, 將程式的訊息以及ui等設計成支援多國語言, 然後執行時加上-Duser.language=locale_name或-Duser.country=country_name就可以切換不同的語言介面.
完整的指令為
顯示英文介面:
java -Duser.language=en -jar test.jar或
java -Duser.country=us -jar test.jar
顯示中文介面:
java -Duser.language=zh -jar test.jar或
java -Duser.country=TW -jar test.jar
星期日, 8月 23, 2009
在Linux中檢視目前cpu的運作頻率
$ cat /proc/cpuinfo
不僅可以在cpu MHz看到目前的運作頻率, 還可以看到許多其他cpu的資訊.
如果不想看到那麼多雜七雜八的資訊, 可以搭配grep將所要檢查的資訊過慮出來, 例如:
$ grep -E 'GHz|MHz' /proc/cpuinfo
這樣就只會顯示cpu的最高工作頻率以及目前的工作頻率而已.
星期四, 8月 20, 2009
星期三, 8月 19, 2009
系統自動掛載ntfs partition
首先, 找出ntfs partition的UUID, 方法可以參考取得partition的UUID
再來就是編輯/etc/fstab這個檔案, 在檔案中加上
UUID=ntfs_partition_uuid mount_point ntfs-3g defaults 0 2
這樣就可以了.
例如: 我們的ntfs partition的uuid如果是4C54A5A254A58EF0, 並且要將該partition掛載到/media/VAIO目錄中
$ sudo mkdir /media/VAIO
$ sudo echo "UUID=4C54A5A254A58EF0 /media/VAIO ntfs-3g defaults 0 2" >> /etc/fstab
$ sudo mount -a
取得partition的uuid
1. 最簡單的方式是直接執行blkid, 會列出目前連接到系統上所有磁碟的partition UUID, 檔案系統以及label, 例如:
$ blkid
/dev/loop0: TYPE="squashfs"
/dev/sda1: UUID="4C54A5A254A58EF0" LABEL="VAIO" TYPE="ntfs"
/dev/sda5: UUID="4CFCC181FCC165B4" TYPE="ntfs"
/dev/sda6: UUID="a5050769-1c80-4e7c-8b7c-da810624d910" TYPE="ext3"
/dev/sda7: UUID="8c28803c-3390-46d7-bb90-fd9a83c0bff3" TYPE="swap"
/dev/sda8: UUID="95206ddf-7ffd-4ddb-8ced-631b5df70b26" TYPE="ext3"
2. 另外也可以執行sudo vol_id
$ sudo vol_id /dev/sda1
ID_FS_USAGE=filesystem
ID_FS_TYPE=ntfs
ID_FS_VERSION=3.1
ID_FS_UUID=4CFCC181FCC165B4
ID_FS_UUID_ENC=4CFCC181FCC165B4
ID_FS_LABEL=
ID_FS_LABEL_ENC=
星期日, 8月 09, 2009
struct成員的記憶體位址alignmentt
struct data {
char num;
int size;
void *ptr;
};
如果因為特殊需要, 需要節省記憶體, 則可以在程式碼中需要進行pack memory的struct前後, 採用#pragma pack來告訴compiler是否要進行pack memory的動作, 例如下列的struct packed_data的記憶體大小則為9, 不是12.
#pragma pack(1)
struct packed_data {
char num;
int size;
void *ptr;
};
#pragma pack()
星期六, 8月 08, 2009
星期六, 7月 25, 2009
星期三, 7月 22, 2009
用gstreamer下載mms檔案
gstreamer真是個好東西阿
如果執行時出現ERROR: pipeline could not be constructed: no element "mmssrc", 那是因為預設mmssrc並沒有安裝mms相關的plugin, mmssrc在Gstreamer Bad Plugins中, 所以只要將它安裝起來就可以了. 安裝方式如下:
sudo apt-get install gstreamer0.10-plugins-bad



