發表文章

目前顯示的是 2013的文章

UT on Mac

筆記:在Mac Console上直接執行xcode UT xcode 的UT 基本上是去執行"otest"這個執行檔(otest 在 /Developer/Tools/下),要執行需要兩個參數 1. -SenTest <para>      <para>: Self, All, <testClassName/testModuleName>      Self 跟 All 不太清楚有什麼差異,在我的case兩個都是全跑      <testClassName/testModuleName> 也可以只給 testClassName 2. <path of your UT bundle>     簡單來說,就是你的UT build出來的那個.octest 檔案的路徑 在順帶一提,如果想在xcode上 step by step debug你的UT 1. Add a "Custom Executable" on your project 2. Set "Executable Path" to "Developer/Tools/otest" 3. Finish 4. 對你剛產生出來的Executable按右鍵,選" Get Info ",修改下列資訊     on the [General] tab         a. Set the working dir to: Product directory     on the [Arguments] tab , add the followings in Argument field          a. -SenTest Self         b.  $(BUILT_PRODUCTS_DIR)/xxx.octest     add the following in the Environment Variable filed         a. OBJC_DISABLE_GC  to <YES>          -->   disable GC,

notes - Java on Mac

筆記:記錄在Mac上如何check Java version 指令 : /usr/libexec/java_home 輸出 :/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home 不帶參數會列出現在執行的java的路徑 指令 : /usr/libexec/java_home -V 輸出 : Matching Java Virtual Machines (2):     1.6.0_37-b06-434, x86_64: "Java SE 6"     /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home     1.6.0_37-b06-434, i386: "Java SE 6"     /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home -V 會列出目前這台Mac有的java版本及路徑 指令 : java -version 輸出 : java version "1.6.0_37" Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909) Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode) 只列出第一順位的java 在我們project的應用,java_home比java -version好用,可以得知所有的java版本

IPv6 notes

筆記:記錄一些之前有用到的IPv6 prefix所代表的意義 前情提要: 1. IPv6 有128bits,8個segments(就是有7個冒號) 2.溝通方式有三種     -  Multicast : 顧名思義就是廣播,一個封包送給多個端點     -  Unicast : 就是一對一囉     -  Anycast : 我不是很懂,類似Multicast是一對多,不過只有端點是屬於Anycast的群組才收得到,封包好像又只送到最近的端點。可參考: http://computernetworkingnotes.com/ipv6-features-concepts-and-configurations/ipv6-address-types-and-formats.html 3. 位址的區域或範圍,主要也是三種     -  Global : 就global 嘛     -  Site-Local : 區域網路,像是192.168 一樣     -  Link-Local : 不懂... 重點: 開始之前... * FF00::/8 ==> /8  代表開頭前8個bits是固定的 Multicast: FF00::/8 Link-Local: FF02:: Site-Local: FF05:: Organization Scope: FF08:: Global: FF0E:: Node-Local / Interface-Local: FF01:: UniCast: Link-Local: FE80::/10 Site-Local: FEC0::/10 Global: 2000:/3 常見的一些表示: ::1 or 0:0:0:0:0:0:0:1  ==> local address / loopback address, like 127.0.0.1 2000:/3 ==> Global address :: or  0:0:0:0:0:0:0:0  ==> unspecified, like 0.0.0.0 FE80::/10 ==> private address, like 192.168 or 10.x ref:

路過proxy的socket

主題 :用socket在做網路的溝通,中間想透過proxy server該怎麼辦??? 簡單來說就下面這幾步,其中跟一般建connection不同的就只有第二步,要先做handshaking 0.建socket 1.跟proxy建立connection 2.丟Sock4/Sock5的protocol給proxy 3.之後丟message都透過這個socket 簡單的code來解釋 0. int Socket = socket ( AF_INET, SOCK_STREAM, 0 ); 1. connect ( Socket , <struct sockaddr with proxy info>, sizeof(struct sockaddr)); 2 . a. send ( Socket , <protocol packet>, <packet size>, 0);     b. recv ( Socket , <reply packet>, <reply packet size>);     c. // check the 2nd byte of the reply packet 3. send ( Socket , <a buffer with your message>, <message length>, 0); 重點就是在第2步啦! 接下來,看看Sock4/Sock5所需準備的packet format SOCK4 : Request Format:          +----+----+----+----+----+----+----+----+----+----+....+----+     | VN | CD | DSTPORT |      DSTIP        | USERID       |NULL|     +----+----+----+----+----+----+----+----+----+----+....+----+ # of bytes:  1    1      2              4           variable        1 packet[0] = 4;