This file contains 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
Testing cached delegate wireup Event Handler Performance with 1,000,000 iterations | |
Time to build handler cache 3 ms or 6,548 ticks | |
Completed 1,000,000 iterations in 7,434 ms | |
Average Time is 0 ms or 14 ticks | |
Press enter to exit |
This file contains 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 void SkipObject(Stream stream) | |
{ | |
var reader = new BinaryReader(stream); | |
stream.Position += reader.ReadInt32(); | |
} |
This file contains 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
// This could just as easily be a command handler in a view model | |
private void AcceptButton_Clicked(object sender, EventArgs e) | |
{ | |
if (CurrentNetWeight <= 0) | |
throw new Exception("Can not accept weights that <= 0"); | |
Load.GrossWeight = GrossWeight; | |
Load.TareWeight = TareWeight; | |
Load.NetWeight = CurrentNetWeight; | |
Load.WeightAcceptedTime = DateTime.Now; |
This file contains 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
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" > | |
<session-factory name="YourAppName"> | |
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property> | |
<property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property> | |
<property name="connection.connection_string"> | |
Server=(local);initial catalog=nhibernate;Integrated Security=SSPI | |
</property> | |
<property name="proxyfactory.factory_class"> YouProjectNameSpace.FixDataBindingProxyFactoryFactory, YourProjectAssembly</property> | |
</session-factory> | |
</hibernate-configuration> |
This file contains 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
// debug block | |
try | |
{ | |
compiledTransform.Load(doc); | |
} | |
catch (Exception ex) | |
{ | |
string msg = ex.Message | |
} |
This file contains 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
First 2 male names | |
Steve Ashcraft | |
Christopher Timothy Bischoff | |
First 2 female names | |
Denise Jan Dellinger | |
Brigida Carpenter | |
First 2 all names | |
Ivan Brent Duffey |
This file contains 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 void YourMethod() | |
{ | |
SPSecurity.RunWithElevatedPrivileges(() => | |
{ | |
using (var site = new SPSite(Request.Url.ToString())) | |
{ | |
// Your work goes here... | |
} | |
}); | |
} |
This file contains 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
protected readonly List<SubSite> SubSites = new List<SubSite>(); | |
protected void Page_PreRender(object sender, EventArgs e) | |
{ | |
var siteMap = PortalSiteMapProvider.GlobalNavSiteMapProvider; | |
var rootNode = siteMap.TryGetRootNode; | |
SubSites.Add(new SubSite() | |
{ |
This file contains 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 IDisposable SubscribeToK2WorkflowUpdatesFor<T>( | |
IEnumerable<T> data, | |
Action<T, K2Activity> activitySetter, | |
Func<T, string> k2ProcessIdSelector, | |
int interval) | |
{ | |
var itemsToRefresh = Observable | |
.Interval(TimeSpan.FromSeconds(interval), Scheduler.ThreadPool) | |
.SelectMany(l => data) | |
.Synchronize() |
This file contains 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 array = new [] | |
{ | |
"Hello", | |
+ "World", | |
}; |
OlderNewer