Saturday, 28 May 2022

Setting a background colour to transparent in GIMP

 Sometimes you have an image with antialising against a background colour, such as white.


If you paste it over a coloured box you get this:


To make the background colour transparent, use Gimp's Color to Alpha (Layer > Transparency > Color to Alpha).


It will remove the background.

Allowing you to paste it in the box:





Saturday, 30 April 2022

Correlation ID vs Causation ID

causation or correlation id? - EventStoreDB - Event Store Discuss Forum

From Greg Young:

The are both really simple patterns I have never quite understood why

they end up so misunderstood.

Let's say every message has 3 ids. 1 is its id. Another is correlation
the last it causation.

The rules are quite simple. If you are responding to a message, you
copy its correlation id as your correlation id, its message id is your
causation id.

This allows you to see an entire conversation (correlation id) or to
see what causes what (causation id).

Wednesday, 6 April 2022

Client hangs connecting to the Cosmos DB emulator running as a Linux container

 I had created a docker-compose file for building a full environment which included a Cosmos DB emulator. However I found the client code - running locally on Visual Studio could not connect to the emulator. It would hang indefinitely (even with HTTP request timeouts overriden in the Client Factory).

I ran the emulator as a local service (not containerised) and this worked, indicating a problem specific to the container.

I found the error was the missing environment variable

AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE

This is required otherwise the emulator returns an IP address the client cannot connect to.

My docker-compose file now included the following variables:

environment:
      - AZURE_COSMOS_EMULATOR_PARTITION_COUNT=3
      - AZURE_COSMOS_EMULATOR_ENABLE_DATA_PERSISTENCE=true
      - AZURE_COSMOS_EMULATOR_IP_ADDRESS_OVERRIDE=${COSMOS_ADDRESS_OVERRIDE:?IPAddress}



Thursday, 31 March 2022

Project Templates

SmartHomeFunctions -  Azure Functions that run a GitHub workflow to publish to Azure


Monday, 14 March 2022

GitHub actions deployed failing Function

I had provisioned an App Service Plan and Linux Consumption Function using terraform.

Then connected Visual Studio to perform CI/CD with Github actions.

However when it completed it deployed a Function App with no functions.

When the timer ran it also said:



I ended up creating a new one from scratch using Visual Studio to see what was going wrong.

The first thing I noticed was that the failing Function App had a "Deployment Credentials" blade whereas the working one didn't.

This made me suspect that the App Service Plan was different.

Indeed, I then compared the working one to the terraform definition that provisioned the broken one.

Immediately it was obvious that there were substantial differences, including:


The App Service Plan must be set to "FunctionApp", not "Linux".

Setting the Function app kind and os_type probably help too.


Summary

So, the old rules apply for building terraform files. Actually build a working resource first using the Wizards and Visual Studio, then create a Terraform file, import the resource, plan it, and compare the differences until there are none. Then you know you have a working Terraform file.

Sunday, 13 March 2022

Useful kuso queries

Get the latest row for each of the Azure Functions

requests 

| summarize arg_max(timestamp, name) by name, success

| project timestamp, name, success