Template replacement engine
Regex.Replace with a match evaluator plus a case-insensitive dictionary makes a tidy single-pass template engine — faster and more flexible than chaining string.Replace calls.
The journal
149 articles on building software and understanding how it works.
Regex.Replace with a match evaluator plus a case-insensitive dictionary makes a tidy single-pass template engine — faster and more flexible than chaining string.Replace calls.
C# code to validate Norwegian national ID numbers (fødselsnummer), following the 2013 standards — including D-, H- and FH-numbers, gender and birthdate extraction. Available as the Tedd.Fodselsnummer NuGet package.
Unity hanging on the second Play press is a classic symptom with many causes — usually background threads. A walkthrough of my debugging process so you can diagnose your own hang.
The famous emailregex.com example is horrible, so I made my own C# email regex — loosely based on it, compiled, and good enough for most use cases.
Bulk-importing users through Identity Framework 3 kept failing with disposed-object and modified-collection errors. The culprit: async void. Change to async Task and await properly — code included.
Visual Studio 2015 has no GUI support for Areas in ASP.Net 5 yet. The workaround is simple: create the folder structure manually and add an area route in Startup.cs — shown here.
Game loops check timers constantly, so how cheap is reading time? Environment.TickCount: 7ms for a million reads. DateTime.Now.Ticks: 1392ms. The numbers, and when each is the right choice.
Console.MoveBufferArea turned out to be dead slow under heavy logging output. So I went to the Win32 console API and built a faster text console for C# — with source and benchmarks.
A revisit of my 2011 RDP guide, updated for RDP 8.x: what to tweak on client and server for less bandwidth, higher throughput and adaptive transfers — the short story and the dirty details.
A small jQuery drop-in that turns tagged links into browser prefetch/prerender hints, so the next page loads instantly. Written as a quick fix for my increasingly slow blog — with warnings about what not to tag.
Recovered from old tapes: a network chat program I wrote in Quick Basic 4.5 in 1996, at age 16, chatting over a shared file on a network drive. Recompiled with QB64 to run on modern Windows — executable and source included. Good times.
Forgetting to swap config files at deployment can be disastrous. This approach keeps all environment configs in one file, selects the right one automatically, and uses ACLs so developers can't read production secrets.
The default MVC folder layout scatters one feature across Controllers, Views and Scripts. As the project grows, grouping by feature instead keeps related files together — here is how to bend ASP.Net MVC to that layout.
After reinstalling Windows Server 2012 R2 your Storage Spaces don't show up — not even in Computer Management. The fix: authorize the server for read-write and re-attach the virtual disks, via GUI or PowerShell.
OwnCloud is a free personal Dropbox alternative where your server sets the storage limit. It didn't work perfectly out of the box on Windows, so here is the full setup guide with the fixes I needed.