星期六, 1月 19, 2013

MUST/REQUIRED/SHALL/SHOULD/RECOMMEND/MAY/OPTIONAL的強制性

MUST/REQUIRED/SHALL
MUST NOT/SHALL NOT

SHOULD/RECOMMEND
SHOULD NOT RECOMMEND

MAY

Reference:
http://www.ietf.org/rfc/rfc2119.txt

星期日, 11月 18, 2012

在Ubuntu上安裝JDK


底下介紹使用apt-get的方式安裝JDK:

add-apt-repository ppa:sun-java-community-team/sun-java6
sudo apt-get update
sudo apt-get install sun-java6-jdk

星期六, 11月 17, 2012

git-svn 斷線處理方法

git可以拿來checkout svn server上的source code,步驟如下: 

mkdir source_code_dir
cd source_code_dir
git svn clone protocol://svn_server/path_to_project

如果過程中遇到問題導致checkout還未完成就停止checkout動作,不需要重新再checkout一次,這狀況尤其容易發生在下載大型專案的時候,只要

git svn fetch

就可以從斷線的地方開始繼續下載了。

更新git版本

如果checkout Android source code的時候出現

error: Exited sync due to gc errors

這代表你機器上安裝的git工具版本需要更新了。
如果嘗試以下命命更新git

sudo apt-get install git-core

可是系統卻說已經是最新版,這時候可以執行以下命令加入新的APT repositoty並安裝新版本的git-core

sudo apt-add-repository ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git-core


星期五, 1月 20, 2012

Disable plugin in Chrome temporarily

chrome://plugins/

Start chrome as ipad user agent in Ubuntu

/opt/google/chrome/google-chrome %U --user-agent="Mozilla/5.0(iPad; U; CPU iPhone OS 3_2 like Mac OS X; en-us) AppleWebKit/531.21.10 (KHTML, like Gecko) Version/4.0.4 Mobile/7B314 Safari/531.21.10"

星期四, 4月 21, 2011

Ubuntu 10.04環境設定

sudo ln -s /usr/bin/fromdos /usr/bin/dos2unix
sudo ln -s /usr/bin/todos /usr/bin/unix2dos

星期四, 3月 17, 2011

讓vim支援actionscript的語法

最近因為工作的關係需要用到actionscript,平常使用vim看code寫code慣了,所以當然也想要繼續使用vim來看actionscript的code囉。
由於vim預設並沒有支援actionscript的syntax,所以必須自己額外安裝syntax檔。其實方法也很簡單,首先先下載vim的actionscript syntax file並將其放置在~/.vim/syntax/目錄中。接著把下面兩行加到~/.vim/filetype.vim,建立.as與actionscript的對應關係就完成了。
"actionscript
au BufNewFile,BufRead *.as          setf actionscript

如果想要使用vim的Tlist功能,則還需要下面兩個步驟:
1. 在~/.ctags加入
--langdef=actionscript
--langmap=actionscript:.as
--regex-actionscript=/^[ \t]*[(private| public|static) ( \t)]*function[ \t]+([A-Za-z0-9_]+)[ \t]*\(/\1/f, function, functions/
--regex-actionscript=/^[ \t]*[(public) ( \t)]*function[ \t]+(set|get) [ \t]+([A-Za-z0-9_]+)[ \t]*\(/\1 \2/p,property, properties/
--regex-actionscript=/^[ \t]*[(private| public|static) ( \t)]*var[ \t]+([A-Za-z0-9_]+)[ \t]*/\1/v,variable, variables/
--regex-actionscript=/.*\.prototype \.([A-Za-z0-9 ]+)=([ \t]?)function( [ \t]?)*\(/\1/ f,function, functions/
--regex-actionscript=/^[ \t]*class[ \t]+([A-Za-z0-9_]+)[ \t]*/\1/c,class, classes/

2. 在~/.vimrc加入
" actionscript language
let tlist_actionscript_settings = 'actionscript;c:class;f:method;p:property;v:variable'

參考資料:
http://vim-taglist.sourceforge.net/extend.html

星期二, 3月 15, 2011

在MacOS上安裝git-svn

在MacOS上可以透過MacPorts project將許多好用的open source projects安裝上去,使用方法也很簡單,安裝MacPorts套件後,就可以使用port search XXX找尋可用的套件,port install XXX安裝想要使用的套件。另外,MacPorts還可以安裝套件的variants,可以說是套件的額外附加功能。例如:port install git-core安裝git。
但是如果想要使用git-svn,則是透過port install git-core +svn來達成,其中+svn部份就是MacPorts所謂的variants。想要看套件有哪些variants可以用是透過port variants XXX來達成,例如:port variants git-core就會顯示出git-core有哪些variants可以安裝。

星期二, 3月 01, 2011

Chmox - CHM viewer for Mac OS

Chmox是一套讓你可以在MacOS上讀取CHM檔案的opensource軟體

參考資料:
http://chmox.sourceforge.net/

星期一, 2月 28, 2011

iphone explorer

iphone explorer讓你可以輕鬆瀏覽iphone上的檔案資料, 支援Mac及Windows, 而且是免費的喔.

參考資料:
http://www.macroplant.com/iphoneexplorer/

星期四, 12月 30, 2010

只有sata光碟機也可以用舊的autoxp執行ghost

比較早期的autoxp光碟片不支援sata光碟機開機, 但是現在新的電腦都漸漸改成用sata光碟機了, 那autoxp光碟片開機後便無法讀取到光碟片的ghost了, 也就只能當飛盤了.
要解決這個問題, 當然最根本的就是換比較新的autoxp光碟片, 但是這要有source阿, 不是每個人都有這種管道的. 在網路上找了一些方法, 覺得方法都很麻煩, 沒有一個連電腦白痴都會用的方法, 最後我想出了一個非常簡單的方法, 就是

拿一個usb disk把ghost copy到那上面去, 然後用autoxp光碟片重新開機, 這時候就可以輕鬆地切換到usb disk中去執行ghost了, 哈哈.

奇怪的skype IE plugin竟然與windows update功能相衝

拿到公司的新電腦後, 想說來執行一下windows update安裝一些patch, 結果竟然究一直卡在windows update首頁畫面不會動. 重開電腦再執行也是一樣, 在網路上找了半天也沒找到答案. 結果問題竟然是出在skype的IE plugin, 只要把它disable就好了. 真是奇怪.

星期五, 12月 24, 2010

在colinux使用pcap-bridge網路模式

如果在coLinux中要使用pcap-bridge網路模式, 最簡單的最法就是在colinux.conf檔中加入
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開發環境設定

在~/.bash_profile中加入下列設定:

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程式開發環境

cscope 熱鍵
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'\"" | endif

set 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

例如在samba source tree中, 執行下列命令

doxygen source/Doxygen

就可以看到dox/ 產生出API document

星期一, 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.

android.process.acore_crash

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

While typing on the keyboard, the home screen disappears shortly and logcat shows the following error messages:

This bug is resulted from failing to read /system/usr/keychars/qwerty.kcm.bin for wrong access permission. It can be fixed by adding the read access permission to this file by

chmod 644 /system/usr/keychars/qwerty.kcm.bin

E/KeyCharacterMap( 633): Can't find any keycharmaps (also tried /system/usr/keychars/qwerty.kcm.bin)
I/DEBUG ( 510): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/DEBUG ( 510): Build fingerprint: 'generic/generic/generic/:1.5/CUPCAKE/eng.jack_zhuang.20091119.140022:eng/test-keys'
I/DEBUG ( 510): pid: 633, tid: 633 >>> android.process.acore <<<
I/DEBUG ( 510): signal 11 (SIGSEGV), fault addr 00000000
I/DEBUG ( 510): r0 0000a9d0 r1 4001b588 r2 00000000 r3 41049c54
I/DEBUG ( 510): r4 be812550 r5 00000004 r6 ad32ea71 r7 41049c30
I/DEBUG ( 510): r8 be812530 r9 41049c28 10 41049c18 fp 00000000
I/DEBUG ( 510): ip ad32ea71 sp be812530 lr ad00e3b8 pc ad32ea70 cpsr a0000030
I/DEBUG ( 510): #00 pc 0002ea70 /system/lib/libandroid_runtime.so
I/DEBUG ( 510): #01 lr ad00e3b8 /system/lib/libdvm.so
I/DEBUG ( 510): stack:
I/DEBUG ( 510): be8124f0 00000001
I/DEBUG ( 510): be8124f4 41f84710 /data/dalvik-cache/system@framework@framework.jar@classes.dex
I/DEBUG ( 510): be8124f8 00000001
I/DEBUG ( 510): be8124fc ad048977 /system/lib/libdvm.so
I/DEBUG ( 510): be812500 00000328
I/DEBUG ( 510): be812504 4108a368 /dev/ashmem/dalvik-LinearAlloc (deleted)
I/DEBUG ( 510): be812508 be812560 [stack]
I/DEBUG ( 510): be81250c 0000000a
I/DEBUG ( 510): be812510 0000000f
I/DEBUG ( 510): be812514 ad063ba3 /system/lib/libdvm.so
I/DEBUG ( 510): be812518 00000004
I/DEBUG ( 510): be81251c ad05a705 /system/lib/libdvm.so
I/DEBUG ( 510): be812520 00000018
I/DEBUG ( 510): be812524 4108a368 /dev/ashmem/dalvik-LinearAlloc (deleted)
I/DEBUG ( 510): be812528 df002777
I/DEBUG ( 510): be81252c e3a070ad
I/DEBUG ( 510): #00 be812530 4108a368 /dev/ashmem/dalvik-LinearAlloc (deleted)
I/DEBUG ( 510): be812534 0000bc60 [heap]
I/DEBUG ( 510): be812538 ad32ea71 /system/lib/libandroid_runtime.so
I/DEBUG ( 510): be81253c 4001b588 /dev/ashmem/mspace/dalvik-heap/zygote/0 (deleted)
I/DEBUG ( 510): be812540 00001071
I/DEBUG ( 510): be812544 0000bc60 [heap]
I/DEBUG ( 510): be812548 be812550 [stack]
I/DEBUG ( 510): be81254c ad040a8d /system/lib/libdvm.so
I/DEBUG ( 510): be812550 41049c28
I/DEBUG ( 510): be812554 41fb2789 /data/dalvik-cache/system@framework@framework.jar@classes.dex
I/DEBUG ( 510): be812558 ad32ea71 /system/lib/libandroid_runtime.so
I/DEBUG ( 510): be81255c be8125c8 [stack]
I/DEBUG ( 510): be812560 be8125c8 [stack]
I/DEBUG ( 510): be812564 00000001
I/DEBUG ( 510): be812568 ad00e540 /system/lib/libdvm.so
I/DEBUG ( 510): be81256c 41ea7bdc /data/dalvik-cache/system@framework@framework.jar@classes.dex
I/DEBUG ( 510): be812570 41049c3c
I/DEBUG ( 510): be812574 be8125c0 [stack]
D/Zygote ( 512): Process 633 terminated by signal (11)