星期三, 2月 28, 2007
Test Double
在Martin Fowler的網站上看到一篇文章,題中提到一些人對於Mock或Stub之類的物件有著各式各樣的說明。Gerard Meszaros試圖替這些相關的用詞訂出明確的定義,Gerard將這些類似用途的物件統稱為Double,然後又分成以下四類:
- Dummy objects are passed around but never actually used. Usually they are just used to fill parameter lists.
- Fake objects actually have working implementations, but usually take some shortcut which makes them not suitable for production (an InMemoryDatabase is a good example).
- Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what's programmed in for the test. Stubs may also record information about calls, such as an email gateway stub that remembers the messages it 'sent', or maybe only how many messages it 'sent'.
- Mocks are pre-programmed with expectations which form a specification of the calls they are expected to receive. They can throw an exception if they receive a call they don't expect and are checked during verification to ensure they got all the calls they were expecting.
星期一, 2月 26, 2007
沒有NULL Iterator
參考資料:
- http://www.mip.ups-tlse.fr/~grundman/stl-tutorial/tutorial.html
Why doesn't STL have null iterator values? STL iterators are supposed to be generalized pointers, right? That phrase has been bandied about a great deal, but it is very misleading. STL iterators are generalizations of array pointers, that is, a pointer set to point into an array, and then incremented or decremented. It does not make sense to talk about such a pointer having a null value.
In C and C++, null pointers are used to indicate errors, or abnormal conditions. When you have a C++ iterator type, there is normally only one kind of error value it will return: one indicating "I fell off the end of the list". It is natural, therefore, for most iterator classes to use null as the "past-the-end" value. If you find yourself wanting a null STL iterator, you probably want the past-the-end value.
星期二, 2月 20, 2007
Agile之後是什麼
- What comes after usability: http://headrush.typepad.com/creating_passionate_users/2007/01/what_comes_afte.html
- Flow theory: http://www.jenovachen.com/flowingames/flowtheory.htm
Google, 微軟, Yahoo的人才培養
某人在這三大龍頭的工讀經驗: http://tastyresearch.wordpress.com/work-stories/
Google Summer of Code: http://code.google.com/soc/
- Google預計於今年(2007)舉辦第三屆GSoC。由一堆公司擔任指導者來指導加入GSoC的學生。指導者與學生都必須要提出相關計畫報告。GSoC為期約三個月,若每個評鑑點都通過評鑑,則指導者與學生都能獲得完整的薪資,否則就只能得到部分薪資。
星期一, 2月 19, 2007
Selenium Remote Control初體驗
- 問題一: 連不上Selenium Server
原本以為是被防火牆擋住了,弄了半天都沒辦法解決。後來才發現是VPN搞的鬼,關掉VPN就可以正常連線了。 - 問題二: 無法下達type指令
一直無法成功鍵入"cmd=type&1=question&2=This is a test&sessionId=1234"指令,總是回傳exception。開啟Selenium在瀏覽器端的log視窗也看不出什麼端倪。最後才發現原來是我耍白爛,在我所測試的網頁中,id question的控制項其實是個combo box,而我想測試的text box的id其實是txtquestion。因此只要將指令改成"cmd=type&1=txtquestion&2=This is a test&sessionId=1234"即可正常執行。 - 問題三: 無法利用type指令送出中文
直接送入中文, 如"cmd=type&1=txtquestion&2=馬英九", 會在瀏覽器端看到亂碼。如果將"馬英九"在utf8下編碼成url的%編碼 (%e9%a6%ac%e8%8b%b1%e4%b9%9d),就能在瀏覽器端正常收到"馬英九"三個字
星期日, 2月 18, 2007
Fusion
- Fusion簡介: http://en.wikipedia.org/wiki/.NET_assembly#Fusion
- 安裝與刪除Assembly到GAC: http://blogs.msdn.com/junfeng/archive/2005/10/24/484063.aspx
- Fusion uses the DEVPATH environment variable to search for assemblies in every path that is specified in the DEVPATH environment variable.
星期一, 2月 12, 2007
星期日, 2月 11, 2007
JavaScript的Memory Leak
- http://isaacschlueter.com/2006/10/msie-memory-leaks/
- 據說Yahoo! User Interface Library採用輪詢(polling)的方式來偵測http request物件的readystate,避免因為指定function給onreadystate而造成循環參照。
- http://keelypavan.blogspot.com/2006/03/reusing-xmlhttprequest-object-in-ie.html
- 另一種可能是重複使用同一個物件。不過這種方法似乎用在IE的http request物件上會有一些問題,上述page有提供解決方案:
req_fail_IE.open("GET", url, true);
req_fail_IE.onreadystatechange = processReqChange_fail_IE; //open後再設handler
req_fail_IE.send("");
星期六, 2月 10, 2007
AJAX除錯
- JSLog: http://earthcode.com/blog/tools/contents.html
- 整個site取消log:
在jslog.js中找到config_enabled,將之設定成false - 單頁啟用logger:
在該頁的url中加入「&enablejslog」如 http://localhost/mypage.do?foo=bar&enablejslog - log4javascript: http://www.timdown.co.uk/log4javascript
如果要將log資訊回傳伺服器,可以考慮使用log4javascript
瀏覽器端除錯工具
- DebugBar: http://www.debugbar.com/
可用來在IE上檢視dom資訊