2016年10月8日 星期六

C#敏感資料遮蔽

參考資料:
http://stackoverflow.com/questions/5015593/how-to-replace-part-of-string-by-position

COMException 未處理:擷取元件 (CLSID為....) 的COM Class Factory 失敗,因為發生下列錯誤...類別未登錄

電腦Visual Studio新專案預設的.NET Framewrok是4.6.1
把專案的.NET Framewrok改成3.5就可以執行了
沒注意到廠商的SampleCode也是用3.5

2016年10月4日 星期二

Apache CXF 3.X已經移掉XMLUtils

http://cxf.apache.org/docs/30-migration-guide.html
Move ALL XML parsing and writing to StaxUtils and DOM based utilities to DOMUtils. The XMLUtils class that used SAX based parsing and Transformer based writing has been eliminated. This simplifies the code as well as increases security as we can provide better limits and have more control with the StAX based IO.

XMLUtils (Apache CXF Bundle Jar 2.7.0 API)
https://cxf.apache.org/javadoc/latest-2.7.x/org/apache/cxf/helpers/XMLUtils.html

2016年9月25日 星期日

利用R語言分析期交所歷史年度行情近月合約資料

在RStudio的執行結果如下:
第三個星期三已經結算,所以結算日之後會沒有資料,我沒有特別再處理這部分


2016年9月8日 星期四

2016年9月3日 星期六

使用非同步的方式執行SQL命令

連線字串加上Asynchronous Processing=True啟動非同步模式

比如:
            String strConnectionString = "Data Source=localhost;" +
                                         "Integrated Security=True;" +
                                         "Initial Catalog=AdventureWorks;" +
                                         "Asynchronous Processing=True";

用途:同步模式是單執行緒,如果查詢結果要等待很久,程式會發生無法回應的狀態,就必須改用非同步

備註:
IAsyncResult result = cmd.BeginExecuteReader();

                    while (!result.IsCompleted)
                    {
                        System.Threading.Thread.Sleep(100);
                        textBox1.Text = "執行中!";
                    }


REF:
Visual C# 2012資料庫程式設計暨進銷存系統實作
第5-43頁
程式5-8-1

LINQ的降冪和升冪排序

降冪:descending
升冪:ascending

預設值是descending