Friday, 10 January 2020

Can't install Minecraft on Twitch

I had a weird problem where whenever I tried to Install Minecraft on Twitch the screen would flash quickly then it would return you back.

I fixed it by changing the install location from my user profile folder (my username had a dot in it) to C:\Temp and then it seemed to work. Even more strangely the folder seem to revert back to the user profile folder.

Saturday, 28 December 2019

Setting up a Ring doorbell Pro on existing wiring for a Friedland 214

This was the process I performed for setting up a Ring Doorbell Pro in conjunction with my existing Friedland 214 doorbell.

The Ring Pro is designed for the US market where their doorbells operate at higher AC voltages. In the UK the standard household operates with lower AC voltages (around 8V AC) and so the Ring Pro in the UK comes with a power converter kit. You get a transformer and a solenoid bypass kit (which is effectively a 50W resistor).

My house was installed with a Friedland 752 transformer and and Friedland 214 door chime. I had both a front door and a back door push button wired up.

The first thing I had to do was figure out the wiring. I isolated the transformer, took the cover off the door chime and compared the wiring to an old diagram I found on the Internet. Note that inside the door chime there is a label and an arrow pointing "Top". Use this to align the chime correctly (mine was installed upside down with Top pointing downwards!). The diagram isn't very clear, but there are actually 3 wires connected to terminal 0 (one half of the AC transformer source and then one connection out to each of the two buttons).

By disconnecting the wires in turn and using a multimeter I found that the front door bell made the connection between terminal 2 and one of the wires screwed into terminal 0.

0Multiple wires:
A. Common transformer connection,
B. To Front push button,
C. To Back push button
1Return from Back push button
2Return from Front push button
3Transformer connection

Thus the wires screwed into terminals 2 and 3 were disconnected and pushed into the bypass unit. This puts the resistor in series with the Ring Pro, across the AC output.

To house the transformer I purchased a Wylex ESE2 IP40 2-Module Unpopulated DIN Enclosure from Screwfix (it cost less than £5).

I removed the old Friedland transformer and installed the new Ring transformer inside the Wylex enclosure. I wired up the mains connection and the 24V output.

Monday, 25 November 2019

Tuning ASP.NET

Here are a range of articles for tuning and ASP.NET server:

Performing an await on an async operation does not use a new thread (unless the implementation explicitly starts one). It is possible to write an write to disk asynchronously without using a new worker thread. This article explains why in detail.

Task.Run, TaskFactory.StartNew and ThreadPool.QueueUserWorkItem will use a worker thread.

Contention, poor performance on ASP.NET
ASP.NET Core best practices
Tuning ASP.NET Core and avoiding large memory allocations
ASP.NET Thread usage
Tuning IIS 10
How the garbage collector causes random slowness


IO Completion Threads in more detail
IO Completion ports
Programming IOCP

Memory Management

Pooling memory buffers to avoid keep allocating memory on every request
Memory management and garbage collection
Using ArrayPool

Saturday, 23 November 2019

IO at a low level

This article describes the low level interactions that make up the async process when writing to disk.

Tuesday, 19 November 2019

Chaos testing Azure Service Bus with Toxiproxy


Toxiproxy runs as a docker container.

On Docker for Windows, run it in bridge networking (the default). In this the containers are isolated and so to access the port from the host it must be published. Run the container with:
docker run -it -p 8474:8474 -p 443:443 -p 5671:5671 -p 5672:5672 shopify/toxiproxy

This exposes port 8474 (the HTTP API), 443 for HTTPS and ports 5671 and 5672 for proxying Azure Service Bus on AMQP.

You can configure the proxy either by using the client SDK or by using the shell.
To attach the shell:
Docker exec -it <container ID> /bin/sh

To create a proxy for AMQP for ASB, first determine the IP address of the service.
NSLlookup <FQDN of ASB service>

In the shell type:
./toxiproxy-cli create amqp --listen --upstream <IP address of ASB service>:5671

To add upstream and downstream latency:
./toxiproxy-cli toxic add -n downlatency -t latency -a latency=8000 -d amqp

./toxiproxy-cli toxic add -n uplatency -t latency -a latency=8000 -u amqp


If you need to test any network connectivity you can use
docker run --rm -it praqma/network-multitool bash