==Basic==
using System.IO;
static FileInfo[] GetXls()
{
List<string> l = new List<string>();
DirectoryInfo di = new DirectoryInfo("info");
return di.GetFiles("*.xls");//.ToList().ForEach(x => l.Add(x));
//return l;
}
using System.Reflection;
public static string StartupPath
{
get
{
string AssemblyLocation = Assembly.GetEntryAssembly().Location;
string startupPath = System.IO.Path.GetDirectoryName(AssemblyLocation) + "\\";
return startupPath;
}
}
==Regex==
" "/"-"+"中文":Regex.Match(name, "(?<=[ -])[\u0800-\u9fa5]+").Value;
==Office Interop==
Microsoft.Office.Interop.Excel.Application app_xls = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Word.Application app_doc = new Microsoft.Office.Interop.Word.Application();
Microsoft.Office.Interop.Excel.Workbook wb_result = app_xls.Workbooks.Open(StartupPath + "201109.xlsx", Editable: true);
Worksheet ws_result = wb_result.Sheets["auto"];
int ws_result_StartEditingRow = ws_result.UsedRange.Rows.Count + 1;
Console.WriteLine("wb_result Start writing from Row " + ws_result_StartEditingRow);
Microsoft.Office.Interop.Excel.Range xls_names = ws_result.UsedRange.Columns[1];
object[,] xls_names_value = null;
if (ws_result.UsedRange.Rows.Count > 1)
xls_names_value = (object[,])xls_names.get_Value();
((Microsoft.Office.Interop.Excel.Range)ws_result.Cells[ws_result_StartEditingRow, 1]).set_Value(Missing.Value, wb_single.Name.ToString());
Document document = app_doc.Documents.Open(doc, ReadOnly: true);
int count = document.FormFields.Count; //FormFields is for restrict editing
wb_result.Save();
wb_result.Close(SaveChanges: true);
app_doc.Quit();
app_xls.Quit();
==LINQ==
var mc_group = from Match m in mc
let m_labor = m.Groups["labor"].ToString()
group m_labor by m_labor into mg
orderby mg.Count ()
select mg;
foreach (var m in mc_group)
m.Key
==Debug==
.NET Debugging Demos - Information and setup instructions: http://blogs.msdn.com/b/tess/archive/2008/02/04/net-debugging-demos-information-and-setup-instructions.aspx
[2010-11-17T22:22:01+08:00] netmon filter: property.SoapAction.contains("Tree")
==Samples==
Symptom: Cross-thread operation not valid: Control " " accessed from a thread other than the thread it was created on.
Workaround: Control.CheckForIllegalCrossThreadCalls = false;
[2010-10-27t23:30:42+08:00] datetime.now.tostring("yyyymmdd_hhmmss");
[2010-11-03T19:50:00+08:00] match non-English :
[^u0000-u0080]+
[^\x00-\x80]+
[2011-03-23T22:14:00+08:00] Managed Windows API http://mwinapi.sourceforge.net/
==ASP.Net==
[2010-10-26t20:05:18+08:00] asp.net page_load if (!ispostback)
[2010-10-29T23:19:43+08:00] IIS HTTP Error 500.19 - Internal Server Error - 0x80070021 : http://learn.iis.net/page.aspx/145/how-to-use-locking-in-iis-70-configuration
[2010-11-09T19:12:41+08:00] IIS error - Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list - %windir%\Microsoft.NET\Framework\v4.0.xxxx\aspnet_regiis.exe -i
[2010-11-09T19:17:59+08:00] IIS ApplicationPoolIdentity http://www.codetoday.net/default.aspx?g=posts&t=1595
[2010-11-17T22:50:14+08:00] DebugDiag for IIS
[2010-12-16T13:36:19+08:00] Sudden Error: Could not load type System.ServiceModel.Activation.HttpModule C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis.exe -iru
==Problems to solve==
[2010-11-12T09:52:49+08:00] [p to solve] ( () () ) | \2 \1
==C++==
[2011-01-06T16:12:38+08:00] http://www.codeproject.com/KB/cpp/PtrToPtr.aspx