Today I decided to create a run-time compiled Csv generator and compare it to a compile-time version of the same code. It works a treat with little noticeable difference in performance over 10000 runs (of a very small table) These are the compile time definitions: public class Client { public long id { get; set; } public string forenames {… Read more →
Convert Html to Tiff
using System; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Linq; using System.Text; using System.Windows; using System.Windows.Forms; using System.Windows.Media.Imaging; class Program { private static WebBrowser InitialiseBrowser(string source) { // create a hidden web browser, which will navigate to the page WebBrowser browser = new WebBrowser(); browser.ScrollBarsEnabled = false; // we don’t want scrollbars on our image browser.ScriptErrorsSuppressed… Read more →
google-code-prettify themes
http://jmblog.github.io/color-themes-for-google-code-prettify/ http://demo.stanleyhlng.com/prettify-js/?id=google-code-light Read more →
markdown in BlogEngine.NET
BlogEngine.NET has half baked support for markdown. You can install MarkdownFormatterExtension but this doesn’t do anything unless you enter raw text into the HTML editor view. There is an additional problem that the posts are saved as Xml and as such all the white space is removed during the save process. You can get around this by tweaking the Post… Read more →
Migrate from wordpress to blogengine.net
http://weblogs.asp.net/aghausman/archive/2009/07/20/migrate-from-wordpress-to-blogengine-net.aspx http://www.machinadei.com/cms/dev/importing-your-old-wordpress-posts-into-orchard-cms#.Uk7Kt9K-qfY http://wpblogml.codeplex.com/ use google prettify insert option from comments with defer in the header https://code.google.com/p/google-code-prettify/wiki/GettingStarted Read more →
Installing FxCop On Windows 8
Installing FxCop On Windows 8 I was trying to install FxCop on my Windows 8 machine today, but the online documentation asks you to install Windows SDK 7.1, and that errors out. I was finally able to figure out a way to install it. 1.Download the SDK ISO for your CPU architecture. 2.Open the ISO file in Windows Explorer and… Read more →
NOT using repository pattern, use the ORM as is (EF)
This was originally posted as an answer to a question on stackoverflow here IMO both the Repository abstraction and the UnitOfWork abstraction have a very valuable place in any meaningful development. People will argue about implementation details, but just as there are many ways to skin a cat, there are many ways to implement an abstraction. Your question is specifically… Read more →
The simplest form of configurable Dependency Injection
public class MyClass { public static Func<string, string> GetConfigValue = s => ConfigurationManager.AppSettings[s]; //… Normal use: string connectionString = MyClass.GetConfigValue(“myConfigValue”); Custom (e.g. Unit Testing) use: MyClass.GetConfigValue = s => s == “myConfigValue” ? “Hi”, “string.Empty”; The simplest form of configurable Dependency Injection Read more →
String to byte[]
public static byte[] ToByteArray(this string str) { UTF8Encoding encoding = new UTF8Encoding(); return encoding.GetBytes(str); } Read more →
VSTemplate
Template Parameters codeproject What a palaver you have to go through to get nested items from a VSTemplate. Read more →