2/02/2010

skype codec policy

最近想要去驗證skype的一個機制, 通常如果要驗證, 就會想要自己製造出同樣的環境來模擬skype的環境, 理想上要製造出一模一樣的環境, 這樣結果當然會是最正確, 但是既然是模擬, 就不可能一模一樣, 因為一模一樣就不叫模擬了, 叫做實現.
現在問題就是, 我到底可以做到多像, 多接近skype本身的codec policy. 首先, 我要先研究skype的機制, 目前已經初步判定他可能的機制, 接下來要製造出和實驗一模一樣的設定值, 然後套用在模擬的環境中, 在各方面設定都相同的情況下, 做出的結果理論上也應該要相似.
目前所遇到的難點在於, 不是非常確定skype codec的環境設置, 如此一來, 模擬跟實驗的結果就理當會有差異了. 我們先假設skype有按照codec的標準走, 而我們的模擬也要確定有按照codec標準走, 先做到這樣, 再看看結果,

1/31/2010

some ways to recover loss packet

o. FEC (forward error correction)
o. Interleaving
o. Packet Repetition
o. Interpolation

1/28/2010

memset 問題

Function: void * memset ( void * ptr, int value, size_t num );

Today, when I use memset function to initialize a buffer to "0" , I found that the number of byte must to the actually byte of the buffer+1..

However, The third variable of memset is Number of bytes to be set to the value.

Still don't know the reason of this

1/17/2010

如何在codeblocks設定連結winsock library

exec codeblocks

Settings > Compiler and Debugger > Linker Settings > Add >

Go to CodeBlocks Folder (normally C:\Program Files\CodeBlocks)

then MingW then libs and find libws2_32.a and add it.

1/10/2010

what is analysis exactly?

Analysis is the process of breaking a complex topic or substance into smaller parts to gain a better understanding of it.
(from wikipedia)

1/08/2010

製作強制關機捷徑 on windows

1. 在桌面按右鍵->新增->捷徑
2. 在輸入項目的位置處 輸入 shutdown -s -t 50 -c "shutdown message"意思是系統會在50秒內強制關機
3. 按下一步完成
4. 點選剛剛新增好的捷徑測試

warning: 請先存檔尚未儲存的檔案

1/07/2010

very humorous R example code

fun <- function() {
ANSWER <- readline("Are you a satisfied R user? ")
if (substr(ANSWER, 1, 1) == "n")
cat("This is impossible. YOU LIED!\n")
else
cat("I knew it.\n")
}
fun()

1/06/2010

[LOOP] loop problem

問題:
mac address 衝突 產生 loop message - loop(1) xx.xx.xx.xx.xx.xx to ex1 from ex0. (active)

解決過程:
先看到錯誤訊息, 把訊息中ip mac 傳送的source and destination 畫出來.

發現從不同網卡傳送的封包具有相同的mac address. 結果發現ap 與我的電腦的mac address竟然一樣.

就發現當初在設定ap的時候有個功能是複製你的PC的mac address. 這個功能可能是為了方便填寫mac.

然後你自己要在修改mac address. 不知道為什麼ap 沒有自己預設的mac address而要自己設置.

12/31/2009

如何檢視Linux系統distribution版本

cat /etc/*release
cat /etc/issue

12/30/2009

[Ruby] string format

"%.3f" % (1.0/7) # "0.143"
"%5.1f" % 345.6789 # "345.7"

"%05d" % 123 # "00123"
"%-5s" % "ID" # "ID "
"%04x" % 0xfc14 # "fc14"

"%6.2f, %05d" % [345.6789,123] # "345.68, 00123"
"%-5s: %04x" % ["ID", 0xfc14] # "ID : fc14"

12/28/2009

vi 復原跟做

in command mode, use u key to undo and Ctr-r key to redo.

[FUN]chrome 可以開幾個tab 呢?



a lot of tabs.

12/18/2009

[指令] WC - 印出文件 行數 字數 byte數

指令: wc
參數:
-c, --bytes               印出位元數
-m, --chars              印出字數 印出該文件有幾個字
-l, --lines                 印出該文件有幾行   
-L, --max-line-length 印出該文件最長的那行有幾字
-w, --words              印出單字數目
This is just a note to prevent me forgot it. :P

12/14/2009

[問題] switch 裡面放switch 時 default: 的問題

error: ‘default’ label in scope of identifier with variably modified type not containing enclosing switch statement

to be solved...

12/07/2009

解決在OS X 使用terminal遠端使用screen無法backspace的情況

In terminal program, choose preferences -> advanced;
select "Delete sends Ctrl+H"
done!

12/05/2009

About unistd.h

在unix-like的系統內, unistd.h所定義的介面大多由一些system call的函式所組成, 像是fork, pipe 以及一需 基本IO
(read, write, open, close) 等等

11/29/2009

malloc vs new

Difference between uses of new/malloc & delete/free:

(a) Operator new constructs an object (calls constructor of object), malloc does not.
(b) Operator new is an operator, malloc is a function.
© Operator new can be overloaded, malloc cannot be overloaded.
(d) Operator new throws an exception if there is not enough memory, malloc returns a NULL.
(e) Operator new[] requires to specify the number of objects to allocate, malloc requires to specify the total number of bytes to allocate.
(f) malloc() returns void *, which has to be explicitly cast to the desired type but new returns the proper type.
(g) Operator new/new[] must be matched with operator delete/delete[] to deallocate memory, malloc() must be matched with free() to deallocate memory.
(h) The new/delete couple does not have a realloc alternative that is available when malloc/free pair is used. realloc is used to resize the length of an array or a memory block dynamically.

reference:http://c.ittoolbox.com/groups/technical-functional/cpp-l/malloc-vs-new-1255507

11/14/2009

codeploy? It's hard to use it

Recently, I tried to use codeploy to upload my program to many planetlab nodes.
But seeing the setting instruction, it's too inconvenient.
There are too many parameter to set.
So I write a simple ruby script to implement this multiple upload function.

usage: ./multi-upload directly_you_want_to_upload

script:

#! /usr/bin/ruby

arr = IO.readlines("node_list")
arr.each { |x|
puts "node name:#{x.chomp}"
cmd = "scp -r #{ARGV[0]} ACCOUNT@#{x.chomp}:/home/ACCOUNT"
puts `#{cmd}`
}

See, 9 lines code can do the same thing.
Why don't use it?