All new code must have a complete set of unit tests. The majority of the following standards stem from the work of Roy Osherove and his book The Art of Unit Testing When is a test not a unit test? A test is not a unit test if: It talks to the database It communicates across the network It touches… Read more →
Category: unpublished
Reinstall Windows Store
Found here Navigate to https://store.rg-adguard.net/ Paste https://www.microsoft.com/en-us/p/microsoft-store/9wzdncrfjbmp into the box and click the tick scroll to the bottom and download Microsoft.WindowsStore_12107.1001.15.0_neutral_~_8wekyb3d8bbwe.appxbundle rename the file to Microsoft.WindowsStore_12107.1001.15.0_neutral_~_8wekyb3d8bbwe.appxbundle (it downloaded with a different name for me) double click and install Read more →
Enumerable Debugger
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Bw.Sipp { public static class EnumerableDebugger { public static IEnumerable<T> Dump<T>(this IEnumerable<T> input) { return Dump( input, item => item != null ? Newtonsoft.Json.JsonConvert.SerializeObject(item) : “(null)”); } public static IEnumerable<T> Dump<T>( this IEnumerable<T> input, Func<T, string> toString) { foreach (var item in input) { Debug.WriteLine(toString(item)); yield return… Read more →
Which w3wp.exe belongs to which Application Pool
%windir%/system32/inetsrv/appcmd list wp Read more →
PresentationFeb2021
I saw a request a while ago asking for advice on some kind diagnostic logging (I can’t recall the details other than the person who asked). Worded another way the question is: how do apply a cross-cutting concern? When we: design our solutions around the ideas of queues, messages, events and streams & services (aka queries & commands) write code… Read more →
TextTemplate reference local assembly
<#@ assembly name=”$(TargetDir)<name>.dll” #> Read more →
CMD Find in Files
Simple search, all subfolders findstr /s /i <text> Regular Expression all subfolders findstr /s /r /c:”<text to search for>” Read more →
dynamic code generation in c#
Copied directly from ayende.com Given a Dictionary<string, string>, convert that dictionary into a type in as performant a manner as possible. The conversion will happen many time, and first time costs are acceptable. public static Func<Dictionary<string, string>, T> Generate<T>() where T : new() { var dic = Expression.Parameter(typeof (Dictionary<string, string>), “dic”); var tmpVal = Expression.Parameter(typeof (string), “tmp”); var args =… Read more →
Python decorators (from http://stackoverflow.com/a/1594484/1515209)
If you are not into long explanations, see Paolo Bergantino’s answer. Decorator Basics Python’s functions are objects To understand decorators, you must first understand that functions are objects in Python. This has important consequences. Let’s see why with a simple example : def shout(word=”yes”): return word.capitalize()+”!” print shout() # outputs : ‘Yes!’ # As an object, you can assign the… Read more →
Aside
SOLID
Law of Demeter
Postels Law