2016年12月27日 星期二

【StackOverflow】StackOverflow 一些入門技巧

profile for Circle Hsiao at Stack Overflow, Q&A for professional and enthusiast programmers
因為突然很想要 upvote 跟 comment 的權限,所以這個月花了點時間衝 SO 的 reputation,發現還真是沒有想像中的容易,今天終於達成低標,心情好寫篇最近學習到的技巧紀錄下,內文為初學知識跟個人看法,歡迎留言分享討論。

2016年9月28日 星期三

2016年8月18日 星期四

【C#】DotNetZip total progress

To Report total progress of extracting instead of each entry's progress.
在解壓縮時回報總進度而不是個別檔案(entry)的進度。

2016年8月8日 星期一

【C#】SelectNodes(...) return empty list at specific xml file

跑某個 .config 檔時 SelectNodes(...) 完全讀不到節點,但輸入路徑正確且 ChildNodes 也有值。

2016年8月2日 星期二

2016年7月20日 星期三

【C#】The calling thread must be STA, because many UI components require this

在某 Timer 重試過程中會改到 UI (精確的說是會叫一個 MsgBox)結果碰到
發出呼叫的執行緒必須是 STA,因為許多 UI 元件都這樣要求
的錯誤。

2016年7月6日 星期三

【Youtube】多使用者共用 Youtube 頻道

這個東西超乎我想像的難找要怎麼做,而且目前的做法也不是我心目中最理想的做法,因為上傳者是共用 Google+ 帳號去上傳,而不是真的不同的使用者上傳到同一個頻道,well,但總之先 PO 這個堪用的方法。

2016年7月1日 星期五

【ADO.NET】Using SqlCommand with parameters for T-SQL IN(...) Statement

在 ADO.NET 用 Parameters 串含有 IN(...) 的 SQL 命令時沒有發生效果,類似下面
cmd.CommandText = "DELETE FROM Member WHERE Name IN (@names)";
cmd.Parameters.Clear();
cmd.Parameters.AddWithValue("names", "'Allen','Bill','Carl'");
int ret = cmd.ExecuteNonQuery();

2016年6月16日 星期四

【ADO.NET】Get progress rate(percentage) when using T-SQL and ADO.NET to backup and restore DB

接續【ADO.NET】Make full backup by ADO.NET and T-SQL cmd 這篇,在備份或還原時要偵測進度。

【ADO.NET】Make full backup by ADO.NET and T-SQL cmd

工作上需要用到程式自動備份與還原資料庫,一開始查到的大部分是教要用 SMO 工具可是這樣要額外裝東西,感覺蠻麻煩的,直覺可以直接跑 T-SQL 命令做掉,花了一點時間查,以下是做法

2016年6月13日 星期一

【C#】Unable to cast object of type 'System.Xml.XmlText' to type 'System.Xml.XmlElement'.

在跑
elem.ChildNodes.Cast<XmlElement>()
時發生,無法將類型 'System.Xml.XmlText' 的物件轉換為類型 'System.Xml.XmlElement'。
的錯誤。

2016年5月13日 星期五

【Visual Studio】Could not load file or assembly or one of its dependencies


在把 Lab 專案搬進公司 Solu,並改用其 dll(砍掉本來的參考,改引用它)之後噴的錯。

無法載入檔案或組件 'XXX.YYY.ZZZ, Version=1.2.3.4, Culture=neutral, PublicKeyToken=????????????????' 或其相依性的其中之一。 系統找不到指定的檔案。 

2016年5月12日 星期四

【Quartz.net】Using Autofac to build IJob implement class

這篇起源於我裝好 Quartz 實作 IJob 到一批服務之後,卻有一大半沒被驅動起來,卻又不是全部,而且 IJobListener 也看不到沒跑起來的那些服務。

2016年5月9日 星期一

2016年5月4日 星期三

【Quartz.net】Set Muliti trigger to single job

如果硬用 sched.ScheduleJob(job, trigger); 把不同的 trigger 塞給同一個 job 到 IScheduler instance 會噴
Unable to store Job: 'Group.Job', because one already exists with this identification.

2016年4月30日 星期六

【C#】印 * 星號金字塔


老弟上大學了,回家考我這個,重點是要兩個迴圈解決,還真是差點燒了我這個除了 Google 什麼都不會的猴子腦筋。

2016年4月12日 星期二

【SignalR】SignalR Invoke not working

Client 有連線上,但 Invoke 無反應,若 Wait() 則會出現 500 內部伺服器的錯誤等訊息。
Client is connected but Invoke doesn't seem to work.  Also 500 Internal Server Error show up when I use Wait() to check if the method done.

2016年4月6日 星期三

【Visual Studio】Microsoft Visual Studio has detected mismatched installed versions of language resouces

因為新專案需求裝了 VS2015,一如以往的去抓了英文包,結果一裝完就
Microsoft Visual Studio 偵測到不相符的語言資源安裝版本。針對不同語言安裝不同版本的產品(搶鮮版(Beta、RC、RTM)時就可盟發生這種狀況。請解除安裝所有舊版本和語言套件,或全部升級成最新版本。除非解決這個問題,否則microsoft visual studio無法啟動正常運作。
從此再也打不開VS,移除語言包內容也無效。


2016年3月25日 星期五

【WCF】The 'await' operator can only be used within an async method.

在嘗試用 WCF 內建的 Async 方法時卡在
The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task<?>'.
'await' 運算子只能在非同步方法使用。請考慮以 'async' 修飾詞標記此方法...

2016年2月4日 星期四

【Entity Framework】The mapping of CLR type to EDM type is ambiguous

在把 Domain 的 Class 轉入 EF 的同名 Class 時出的錯

The mapping of CLR type to EDM type is ambiguous because multiple CLR types match the EDM type 'ClassA'. Previously found CLR type 'Domain.ClassA', newly found CLR type 'EDMX.ClassA'.

指定的結構描述無效。錯誤: 
將 CLR 型別對應至 EDM 型別模稜兩可,因為有多個 CLR 型別符合 EDM 型別 'ClassA'。先前找到的 CLR 型別為 'Domain.ClassA',新找到的 CLR 型別為 'EDMX.ClassA'。

2016年2月1日 星期一

【MS-SQL】An attempt to attach an auto-named database for file ... failed.

EF 嘗試存直接附屬於專案的 mdf 時發生的 inner exception

An attempt to attach an auto-named database for file
D:\\...\\xxx.mdf failed.
A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

2016年1月30日 星期六

2016年1月21日 星期四

【Entity Framework】The specified type member 'Date' is not supported in LINQ to Entities.

在 Linq 中要做僅日期(不含時間)的比較,但取用 DateTime 中的 Date prop 時,出現
LINQ to Entities 中不支援所指定的型別成員 'Date'。

2016年1月8日 星期五

【Visual Studio】The breakpoint will not currently be hit. The source code is different from the original version


The breakpoint will not currently be hit. The source code is different from the original version.
目前無法叫用中斷點。 原始程式碼不同於原始版本。

2016年1月7日 星期四

【ASP.NET MVC】Internal Server Error when JQuery Ajax post

用 JQuery Ajax post 時候發現沒 cue 到後端,Console 出
POST http://localhost:XXXX/Controller/Action 500 (Internal Server Error)