2011年12月18日 星期日

TWM T3 Fantastic

下午1點35分,一隻黑貓叼了個箱子來按門鈴...

2011年12月8日 星期四

暗黑魚人寶寶

暗黑破壞神和魚人寶寶的合體
2011年BlizzCon贈品
偶然在暴風城看到的
會跳起來噴火

2011年12月7日 星期三

迅捷白色陸行鷹

刷到了~YA~

2011年6月5日 星期日

大小冬泉豹

大隻是坐騎,小隻是觀賞寵 (廢話!

2011年5月17日 星期二

巫毒刻像

4.1考古新增老兄類小寵物
不太有特色的感覺... = =

2011年5月16日 星期一

古老的琥珀

4.1考古新增玩具
使用後變這樣
是個BUFF(orz) 持續5分鐘,物品CD30分鐘

2011年5月11日 星期三

設定/取得/移除DOM物件的style屬性

有兩種方法...
方法1: 適用IE9及其他非IE瀏覽器
obj.style.setProperty("background-color", "green");
obj.style.getPropertyValue("background-color");
obj.style.removeProperty("background-color");

方法2: 適用IE系列
obj.style.setAttribute("backgroundColor", "green");
obj.style.getAttribute("backgroundColor");
obj.style.removeAttribute("backgroundColor");

加上判斷瀏覽器類別,就一次搞定了
<html>
<head> 
<script type="text/javascript"> 
    function testMethod() {
        var browser=navigator.userAgent;
        var myDiv=document.getElementById("myDiv");
        if(browser.search("MSIE")>-1){
            alert(myDiv.style.getAttribute("backgroundColor"));
            myDiv.style.removeAttribute("backgroundColor");
            myDiv.style.setAttribute("backgroundColor", "green");
            alert(myDiv.style.getAttribute("backgroundColor"));
        }else{
            alert(myDiv.style.getPropertyValue("background-color"));
            myDiv.style.removeProperty("background-color");
            myDiv.style.setProperty("background-color", "green");
            alert(myDiv.style.getPropertyValue("background-color"));
        }
    }
</script> 
</head> 
<body> 
<div id="myDiv" style="background-color: red; height: 50px; width: 50px"></div><br /> 
<input type="button" value="T E S T" onclick="testMethod()" /> 
</body> 
</html> 

參考資料:Style handling methods in JavaScript

2011年5月10日 星期二

羅技 M705 馬拉松滑鼠


舊的去了新的就來了

2011年3月29日 星期二

羅技 K340


好優惠,不買嗎?

2011年2月28日 星期一

幸運女神 2011 OAD Vol.1

嘖...再高一點阿.....

2011年2月23日 星期三

選狼還是選獅子

前幾天隔壁部門主管轉寄了這篇文章給大家看
據說是美國暢銷書的選文

2011年2月18日 星期五

Oracle OCI-22053 錯誤

早上測試的時候程式噴了個錯誤給我

沒看過的error,只好來去拜Google神

原來是Oracle裡算出的數字長度過長,回傳到DataTable時發生溢位
比如說 1/3=0.333333333.....

解決的方法就是在查詢時 TO_CHAR 或 ROUND 就好了

參考資料
http://www.dotblogs.com.tw/puma/archive/2009/05/23/8536.aspx


筆記一下~

2011年1月6日 星期四

using 筆記

using 很好用,用using陳述式包起來的物件,在using陳述式結束時,會自動釋放資源,programmer就不用去煩惱記憶體管理的問題

不過用了這麼久,忽然對一些地方有點疑惑,於是google了一下,把找到的結果memo在這邊


  1. 物件必須實作 IDisposable 介面,這樣在結束時才能自動呼叫 Dispose()
  2. 物件最好在using子句內宣告,而不要在using外宣告,避免using後的程式碼存取到該物件而造成例外。(因為物件已被Dispose)
  3. 因為 using 的特性是會呼叫 Dispose(),這會呼叫到 Close(),所以在 using 區塊中不要呼叫 Close(),避免因二次呼叫 Close() 而造成例外
  4. using裡只有try final,而沒有catch區塊,因此using不會捕捉及處理例外狀況,如果怕出現預期外的錯誤的話,要自己寫catch



資料來源