2012年11月11日 星期日

[Aadroid] Android版本控制工具---Repo(轉)

Android 原始碼下載及版本控制 - 使用git與repo

要取得Android的原始碼,會需要用到GitRepo還有Gerrit。 以下解釋一些工具,太冗長,可直接拉到最下方看如何取得Android原始碼。

什麼是Git?

Git is an open-source version-control system designed to handle very large projects that are distributed over multiple repositories.

那Git for Android是?

In the context of Android, we use Git for local operations such as local branching, commits, diffs, and edits. One of the challenges in setting up the Android project was figuring out how to best support the outside community–from the hobbiest community to large OEMs building mass-market consumer devices. We wanted components to be replaceable, and we wanted interesting components to be able to grow a life of their own outside of Android. We first chose a distributed revision control system, then further narrowed it down to Git.

2012年11月1日 星期四

[Tool] Source Insight常用的快捷鍵

@Source Insight常用的快捷鍵:

  • Ctrl+= :Jump to definition
  • Alt+/ :Look up reference
  • Alt+分頁標題首字字母 : 切換至該標題的頁面
  • F3 : search backward
  • F4 : search forward
  • F5: go to Line
  • F7 :Look up symbols
  • F8 :Look up local symbols
  • F9 :Ident left
  • F10 :Ident right
  • Alt+, :Jump backword
  • Alt+. : Jump forward
  • Shift+F3 : search the word under cusor backward
  • Shift+F4 : search the word under cusor forward
  • F12 : incremental search
  • Shift+Ctrl+f: search in project
  • shift+F8 : hilight word

2012年10月27日 星期六

[Vim]常用的技巧記錄

@VIM外掛安裝方式

透過github
(1)使用git submodule add  "要安裝plugin的路徑"   bundle/plugin-name
frank@frank:~/.vim$ git submodule add https://github.com/vim-scripts/taglist.vim.git bundle/Taglist  ./bundle/Taglist

(2)輸入指令初始化外掛
frank@frank:~/.vim$ git submodule init

2012年10月13日 星期六

[C++]必須傳回物件時,別妄想傳回其reference

函數的回傳值使用上要非常的小心,雖然程式寫久了,這算是比較基礎的概念,但有時一疏忽,往往就會造成系統Crash,簡單來說,函式產生新物件的路徑有二,在Stack空間或是在Heap空間裡,以底下例子來說。

const Rational& operator* (const Rational& lhs,
                                        const Rational& lhs)
{
    Rational result(lhs.n * rhs.n, lhs.d* rhs.d)
    return result;
}

2012年9月21日 星期五

[C++]寧以pass-by-reference-to-const取代pass-by-value

在C++裡函式參數使用pass-by-value的話,會造成參數的傳遞成本增加,所以在C++應用程式或是component開發上比較少使用pass-by-value。

Google C++ Style Guide裡有提到Google內部使用C++ coding的規則,從裡面也可以看到Google的rule為所有函式的參數必須是pass-by-reference,並且加上cosnt,表示傳入的參數是不可以變動的,這時你可能會有個疑問,如果函式的實作需要修改到傳入的參數怎麼辦,當然這應該是很常見的case,所以他們對於需要更改操作的arguments,可以使用pass-by-point的方式。

2012年9月15日 星期六

[Android] 常用的adb指令


身處在開發Android的公司,adb指令可以說是跟mobile device有非常密切的關係,舉凡push, pull data到devices上,甚至debug除錯等,都會需要使用到adb工具,所以了解並熟悉adb的一些指令對於開發上具有非常大之幫助。


◎這裡列出官網上提到,以及比較常使用到的指令

1.adb devices (顯示目前有多少個模擬器正在執行) 

2.adb -s (指定模擬器來操作)  
    Ex:adb -s emulator-5554 install camera.apk

2012年8月25日 星期六

如何使用gsr偵測Memory Leakage

GSR是我們Project裡用來反覆執行相同動作的tool,主要可以用在系統開發階段後期,對於開發好的AP或是component進行壓力測試,順便也可以偵測記憶體使用情況,例如Lauhch與Exit某支AP,當這個動作運行5000次後,計算Memory的使用情況,藉此某個AP或是component 是否有Memory Leakage。