This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestClass] | |
public class UnitTest1 | |
{ | |
[TestMethod] | |
public void TestMethod1() | |
{ | |
var f = new EventFactory(); | |
f.Raised += (o, e) => { Thread.Sleep(100); Trace.WriteLine(1, Thread.CurrentThread.Name); }; | |
f.Raised += (o, e) => { Thread.Sleep(200); Trace.WriteLine(2, Thread.CurrentThread.Name); }; | |
f.Raised += (o, e) => { Thread.Sleep(300); Trace.WriteLine(3, Thread.CurrentThread.Name); }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public virtual object Create(CreationContext context, Burden burden) | |
{ | |
var configuration = Model.ExtendedProperties[Constants.SessionFactoryConfiguration] as Configuration; | |
var f= configuration.BuildSessionFactory(); | |
burden.SetRootInstance(f);//new for 3.x | |
//onCreation(model, instance); | |
return f; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var header = context.Request.Headers["X-Requested-With"]; | |
if (!string.IsNullOrEmpty(header) && header.ToLower().IndexOf("xmlhttp") >= 0) | |
{ | |
Server.ClearError(); | |
Response.StatusCode = 400; | |
Response.Clear(); | |
Response.Write(exception.Message); | |
Response.End(); | |
return; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/Kunena/Kunena-2.0/wiki/Create-a-new-branch-with-git-and-manage-branches | |
git branch net20 | |
git push origin net20 | |
git checkout net20 | |
git branch -d [branch] | |
git push origin --delete [branch] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<item key="connection.driver_class">NHibernate.Driver.SqlServerCeDriver</item> | |
<item key="dialect">NHibernate.Dialect.MsSqlCeDialect</item> | |
<!--create|create-drop--> | |
<item key="hbm2ddl.auto">create-drop</item> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//解决部分服务器证书问题 | |
ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(delegate { return true; }); | |
//以下可选,强制协议 | |
ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3; | |
ServicePointManager.Expect100Continue = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static bool IsXmlHttpRequest(this HttpRequestBase request) | |
{ | |
var header = request.Headers["X-Requested-With"]; | |
return !string.IsNullOrEmpty(header) && header.ToLower().IndexOf("xmlhttp") >= 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Regex isMobileRegex = new Regex( | |
@"(iemobile|iphone|ipod|android|nokia|sonyericsson|blackberry|samsung|sec\-|windows ce|motorola|mot\-|up.b|midp\-)" | |
,RegexOptions.IgnoreCase | RegexOptions.Compiled); | |
bool isMobileDevice = !string.IsNullOrEmpty(Request.UserAgent) && isMobileRegex.IsMatch(Request.UserAgent); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using (var md5 = new MD5CryptoServiceProvider()) | |
{ | |
var retVal = md5.ComputeHash(file); | |
var sb = new StringBuilder(); | |
for (int i = 0; i < retVal.Length; i++) | |
sb.Append(retVal[i].ToString("x2")); | |
return Json(sb.ToString()); | |
} |
OlderNewer