最近再試,發現 Math.round() 又正確了….奇了! 116.55出來是116 ========== 一般的說法是Math.round() 但實際上跑 decimal num = 116.55 Math.round(num) 結果是 117 這是錯的!! 所以 參考這個 https://windperson.wordpress.com/2013/02/21/c-%E5%B0%87%E5%B0%8F%E6%95%B8%E9%BB%9E%E5%BE%8C%E6%8C%87%E5%AE%9A%E4%BD%8D%E6%95%B8%E7%9A%84%E6%95%B8%E5%80%BC%E5%8E%BB%E6%8E%89%E7%9A%84%E6%96%B9%E6%B3%95/ 改成 decimal GetFrag1(decimal input,int digit) //這個四捨六入五成雙才正確 { if (digit < 0) { return Math.Floor(input); } double pow = Math.Pow(10, digit); decimal sign = input >= 0 ? 1 : -1; return sign * Math.Floor(sign * input * (decimal)pow) / (decimal)pow; } GetFrag1(num, 0).ToString() 結果 116

繼續閱讀

[轉]vm安全性

http://www.mobile01.com/topicdetail.php?f=494&t=4790863 EluSiOn 請看 https://www.openssl.org/news/secadv/20160503.txt Severity: High. 2016/05/03 嚴重的 bug. 但是到了今天我伺服器上所有的 patch 都已經更新完畢了. 但是 Q & S 的 nas 的 patch 連影子都沒有. 所有的 debian/ubuntu/centos/freebsd 基本上都會在 5個工作天內完成 patch 提供更新, 但是不管是 Q牌或是S牌的更新是絕對超過 30天以上的. 再來就是 VM 有自己獨立的 file system. 其 file system 損會是不會傷害到 host 的資料. 但是 LXC/Docker 是允許跟 NAS host 共用資料夾, 這個時候, 就有機會讓針對於 host 共享的資料夾的資料造成毀損. 防火牆是使用 PFSense, 你的安全係數可以拉很高! 不管是 Deep packet inspection (DPI), Intrusion Detection System IDS 以及 Intrusion Prevention System 都有. 但是就要看你防火牆的 cpu 是否夠力了

繼續閱讀

作者的圖片

Sue boy

Sueboy Can support You

CIO

Taiwan