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 →

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 →

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 →

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 →