Blog

Using Qdrant for Embeddings Search with C#

I recently wrote a .NET client for the Qdrant vector database and ended up contributing it to the official Qdrant .NET SDK. A question came up from a user asking how to adapt an OpenAI cookbook article written in Python using the qdrant python client, to C# using the .NET SDK. This is the topic of today's post.

Read more...

Generate X.509 certificates with C#

A short and sweet post for today. I've often had the need to generate X.509 certificates in code, in both PEM and PKCS#12 format. It's pretty straightforward to do so with the excellent BouncyCastle.Cryptography library.

Read more...

Deploying Statiq Web to GitHub Pages

I finally got around to porting this blog over to a static website. After several years running on Orchard, followed by many more on MiniBlog, I'd been looking for a simpler experience for some time, in the hope that a simpler experience would encourage me to blog more. I came across Wyam a while back, and followed its evolution into Statiq Web, and finally took the time to port things over.

Read more...

Querying values in an array field in Elasticsearch

Elasticsearch allows indexing multiple values into a field, and to query on that field to find documents with matching values. This post explores some different ways of querying values, including approaches for matching values in the last position.

Read more...

InternalsVisibleTo quirk with dotnet command line builds

MSBuild Log viewer

A short journey into fixing a build bug involving strongly named dynamic assemblies, InternalsVisibleTo, and building from the command line with dotnet CLI

Read more...

Monitoring processes on remote Windows machines with Procmon

Process Monitor capture

I do a fair bit of work with VMs somedays, using them for a variety of purposes, including integration tests for Windows installers and building components for different platforms. Much of this work runs headless without a GUI and without manual intervention.

Sometimes things can go awry with a process, such as not shutting down as expected and keeping a handle open to a file that should be deleted, or spawning other processes and threads unexpectedly. When this happens on a Windows VM, it's useful to run Process Monitor a.k.a. Procmon on the remote VM to capture process activity for further investigation. This is the topic of today's post.

I've put together a small PowerShell script module to make the process of running Procmon on a remote Windows VM easier, and will walkthrough how to use it.

Read more...

Favouring exact matches in Elasticsearch

Ice cream!

I recently came across a question on Stack Overflow asking about Boosting elasticsearch results with NEST when a secondary field is a specific value. I thought the question was interesting enough to warrant a blog post, the first I've written in a while!

Read more...

Beware mixing Tasks with async/await

I recently came across an issue within a pipeline of asynchronous method calls where an attempt to deserialize a response from json to a known type may throw an exception, usually when the response is not json. For example, this may be the case when using something like nginx as a proxy for authentication purposes and failed authentication returns a HTML page. A simple reproducible example would be

void Main()
{
    MainAsync().Wait();
}

async Task MainAsync()
{
    var result = await TryDeserializeAsync().ConfigureAwait(false);    
    Console.WriteLine(result);
}

Task<double?> TryDeserializeAsync()
{
    try { 
        return DeserializeAsync(); 
    }
    catch {
        // swallow any exceptions thrown.
    }
    return null;
}

async Task<double?> DeserializeAsync()
{
    await Task.Delay(100);
    throw new Exception("Serialization error");
}

Here we await TryDeserializeAsync() which in turn calls the actual DeserializeAsync() implementation, swallowing any exception that may occur in deserialization and simple returning null. That's the plan anyway.

Read more...

PSMA Geocoded National Address File made openly available

A few weeks ago, the Geocoded National Address File (a.k.a. G-NAF) was made openly available by PSMA, an unlisted public company formed by the nine governments of Australia to collate and standardise, format and aggregate location data from each of the jurisdictions into authoritative location based national datasets. The reason this is such great news is nicely summarised on data.gov.au

Read more...

Akka.NET with F# - Getting functional with Reactive systems

Early last month I had the pleasure of presenting on Akka.NET to the F# Sydney meetup user group. The presentation is largely an introduction to agent-based programming and the Actor model of computation with Akka.NET from a functional programming perspective, using the Akka.NET F# API.

The slides and code can be found up on Github

Read more...