Analysis is the process of breaking a complex topic or substance into smaller parts to gain a better understanding of it.
(from wikipedia)
All hardware and software things including network, system, UI, maintaining tools and the information security field
1/10/2010
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而要自己設置.
1/03/2010
1/01/2010
12/31/2009
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"
"%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
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. :P12/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
(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?
10/25/2009
vim window tips
#define c-w Control + key W
對目前編輯檔案分割視窗:分割垂直視窗: c-w
分割水平視窗: c-w
關閉視窗: c-w
留下目前視窗並且關閉其他視窗: c-w
於分割視窗開新檔案: c-w
切換:
切換到下方視窗: c-w
切換到上方視窗: c-w
切換到左方視窗: c-w
切換到右方視窗: c-w
切換到下一個視窗:
調整大小
調整視窗垂直大小: c-w
調整視窗水平大小: c-w
10/23/2009
10/21/2009
10/16/2009
simulation vs experiment
這幾天研究遇到一個問題: 實驗和模擬跑出來的結果有個差別, 於是我就先畫出圖來比較, 重點就是我發現我跑decoder的程式是模擬用的程式, 而模擬的程式就是會故意把幾個voice frame拿掉, 於是我decode的時候, 拿實驗收到的frame file餵給他, 他可能就把它當成原始的voice frame, 然後在decode出可以聽的音效wav檔. 主要會發現的原因是我已經知道模擬的時候是把一些frame label起來 指定那些就是要loss的, 但是沒有想到這件事是在decode的時候做. 而我又把decoder模擬程式當成單純decode功能的程式, 如何證明說decoder參數設定會影響輸出wav的結果呢, 第一 看到模擬跑的script裡面只有出現decoder才會用的參數, 第二 實際用同樣的bit檔 去測試但是使用不同的模擬參數, 果然跑出來的wav效果不一樣. 目前先不管模擬loss, burst有沒有算對, 先把decode程式改成單純decode不吃任何參數. 在比較模擬與實驗的結果差異.
訂閱:
文章 (Atom)




