2018年1月9日 星期二

[Debug] gdb


2018年1月8日 星期一

[ATSC3.0] DASH IF


2018年1月6日 星期六

[Toolchain] Portal


  • build
    • configure scripts
      • configure --prefix -android
      • configure --prefix -gnu-eabi
  • Compiler
    • naming convention
      • arch-vendor(or CPU)-kernel-system
        • e.g. arm-cortex_a8-linux-gnueabi
    • arch
      • arm, mips, x86_64, ppc(power pc), ...etc.
    • kernel
      • linux, bare-metal, ...etc.
    • system
      • glibc, eglibc, uclibc
      • oabi, eabi
      • gnueabi (glibc+eabi)
  • Binutilities
  • Reference

[Embedded System] Portal


[MulitProcess] portal


[Word] Mac 版 Microsoft Word 中文直書


  • Problem: Mac上的 Microsoft Word, 想排版成中文直書, 但直書只看得到連字也順時針轉 90度的選項
  • Solution:
    1. 關閉 Word
    2. 設定 Microsoft Language Register到 Traditional Chinese
      1. 應用程式 -> Microsoft Word 20xx -> Additional Tools -> Microsoft Language Register
    3. 重開 Word, Layout中看到 Layout中的直書選項即可
    4. Reference: [教學]如何在Office 2004 for Mac Word 中輸入直式中文

2017年12月28日 星期四

[Android] Autolock


  • 在 trace Android media player時, 常看到 function有些有加 _l suffix的, 有的沒有. e.g. prepare, prepare_l
    • 主要的差異在於是否有用 Mutex lock住
    • 但此時又看到神奇的 code
      • /frameworks/av/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp
      • status_t NuPlayerDriver::prepare() {
            ALOGV("prepare(%p)", this);
            Mutex::Autolock autoLock(mLock);
            return prepare_l();
        }
        
      • /frameworks/av/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp 因此會發出疑問, 這個 autoLock 是做什麼的? 定義卻沒有使用?
        • 簡單說, 就是利用 constructor跟 deconstructor 來呼叫 mutex lock 跟 mutex unlock
    • 而此處的 prepare_l 有 l結尾的應該就是指 lock後執行的程式碼

[C++] do...while(0)


  • 優點:
    • block 區塊, 可以在其內宣告變數, 在像 C89需要將變數定義在最上方這方面大有幫助
    • 以 do...while(0) 取代 goto, 將 goto 後的東西放 while外面, 裡面用 break來達到 goto的效果
    • 程式碼易讀且效能並沒損失
    • 避免 marco 沒有加 {}, 又接在 if() 單行執行內容有分號的 case
      • e.g. 
      • #define swap(x, y) int temp; temp = x; x = y; y = temp;
        if(x > y)
                   swap(x, y);
            
  • Reference:宏定义中使用do{}while(0)的好处