2016年6月18日 星期六

[Study] SCRUM 用一半的時間,做兩倍的事

『反應速度最快的人就能存活』,本書作者Jeff SUTHERLAND所給出的建議,我會在心裡好好的記住這句話。

2016年6月8日 星期三

好碼共享

這裡會收集一些實用的程式寫法。

1. hex2bin: 將字串 "F9" 轉成數值 0xF9 (取自 rtmpdump)
#define HEX2BIN(a)      (((a)&0x40) ? ((a)&0xf) + 9:  ((a)&0xf)) //這個轉換方式超棒
int hex2bin(char *str, char **hex)
{
  char *ptr;
  int i, l = strlen(str);
  if (l & 1)
  return 0;
  *hex = malloc(l/2);
  ptr = *hex;
  if (!ptr)
    return 0;
  for (i=0; i    *ptr++ = (HEX2BIN(str[i]) << 4) | HEX2BIN(str[i+1]);
  return l/2;
}

2. linker script 內的 ALIGN 作法
#define ALIGN(exp)   (. + exp - 1) & ~(exp - 1)
// Return the result of the current location counter (.) aligned to the next exp boundary. exp must be an expression whose value is a power of two. 
3. linux kernel.h 內的幾個 Macro
#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
#define container_of(ptr, type, member) ({    \
const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
(type *)( (char *)__mptr - offsetof(type,member) );})
#define min(x, y) ({    \
typeof(x) _min1 = (x);    \
typeof(y) _min2 = (y);    \
(void) (&_min1 == &_min2);    \ /* type check*/
_min1 < _min2 ? _min1 : _min2; }) 
此處可參考 http://stackoverflow.com/questions/5595593/min-macro-in-kernel-h

4. 建議配置記憶體的方法 p = kmalloc(sizeof(*p), ...); ,此作法好處是好處是萬一pointer p的型別改變時,不會因為忘記同步更該型別的名稱而出錯。

5. TBD

2016年6月6日 星期一

RTMP Spec 心得整理

本篇是讀完RTMP Specification 1.0 後的心得整理。會以 spec為主並搭配 wireshark  rtmp_sample 封包為例,介紹一個基本的 RTMP 播放流程。

2016年6月3日 星期五

[Embedded] 檢視 message queue 資訊

Linux 下的 IPC 運作若使用 message queue,有兩種 message queue 可用,分別是 SYSTEM V MESSAGE QUEUE 與 POSSIX MESSAGE QUEUE,本篇將介紹如何確認 message queue 中的資訊。

2016年6月1日 星期三

使用 wireshark 的 lua script

Wireshark 支援 lua script ,可以讓我們自行撰寫需要的 disector,簡單的說就是可以讓我自行定義封包要怎麼切割以及顯示。這是個非常有用的功能。

本次練習的環境為
  • OS X EI  Capitan v10.11.3 64bit
  • wireshark 2.0.2 64bit

[Study] Google必修的圖表簡報術

本書作者 Cole Nussbaumer Knaflic 曾任Google人力分析團隊總監,她從心理學的角度介紹設計簡報的一些技巧。推薦大家應該看一下。摘要閱讀心得如下: