tail -f thoughts.txt

Jacob Windle

Blazor WASM: Setting up Firebase Auth

While developing my big C# project for a local company, I found a hurdle I had to get over when developing authentication. The company already uses Firebase for auth of existing customers. This was a problem for me because I am using Blazor standalone WASM as my application platform of choice. C# has a few packages that do Firebase authentication, but all of them are based on the Admin SDK rather than the client.

Observable Pattern: C#/JS Interop

In working with the current project, I’ve developed my own little observable pattern from JS to C# with DotNetObjectReference First, setup your module to do something that requires a stream. For me, this is a Firebase auth module. onAuthStateChanged(auth, (user) => { if (user) { console.log("got user", user) uid = user.uid; } else { uid = null; } // ... }); I want this module to be call back to C# with each auth state change.

Developing With SignalR

I’ve been working for a while now on a real-time eyetracking application for a startup in Johnson City. Previous posts I’ve written have gone over some of the initial technology choices that I made. WebSocketSharp as a server served me well, and it abstracted away annoying things about writing a websocket server in C#. On the client side I went with ClientWebSocket. My ClientWebSocket code was written directly into the Razor component I was building, and would receive messages from the server, parse those messages, and execute some kind of behavior on the client.

The Project Continues: Using Blazor

The websocket server that I’ve been writing about in past posts will now need an integration point to continue testing. I’ve developed the protocol for this websocket communication, and it consists only of a server state, a timestamp, then additional data. Protocol Example message below: { "state": "Ready", "timestamp": "2023-08-20T13:56:45.5106278-05:00", "data": { "arbitrary": "object" } } I saw two alternatives when it came to designing this protocol, making the protocol stateless or stateful.

Cancellable ThreadPools and Work

Today I learned about how .NET wants you to manage cancellable work. I only found out because I tried to use Thread.Abort () and everything blew up on me :). .NET wants you to manage work through this concept of “Cancellable Tokens,” where any asynchronous task represents one cancellable unit of work that you can then stop once cancellation is desired. How did I end up needing this type of work?

WebsocketSharp Deep Dive

To implement the Websocket server from my last post, I’ll use WebsocketSharp https://github.com/sta/websocket-sharp. I’d like to know before I design the remainder of my server though, what actually happens when I call .Start () on my server. I have a snipped of code that looks like this: protected override async Task ExecuteAsync(CancellationToken stoppingToken) { _logger.Log (LogLevel.Warning, "Starting Server"); var server = new WebSocketServer (4546); server.AddWebSocketService<Service>("/service"); server.Start (); await Task.Delay (Timeout.InfiniteTimeSpan, stoppingToken); server.

Code Reading List

For the first time in my 10 year career, I’d like to get into code reading. Here is my list of repositories that are on the shortlist: https://github.com/ggerganov/llama.cpp - C++ https://github.com/clojure/clojure - Clojure https://github.com/sta/websocket-sharp - C#, related to my current project

Websocket Server C#/.NET: Part 1

I’m creating a background service that does some low-level stuff, and will be responsible for connecting with a client program. That background service is written in C#/.NET. The cross-platform story is great for the C# ecosystem, and the vendor of a particular eyetracker provides .NET bindings for their SDK. If I can write a cross-platform long-running service, that hooks into Windows and Systemd properly, that’s all that I really care about as an engineer on this project.

Junit5: Parameterized Testing with MethodSource

Today I had to write some test cases for permutations of configuration-driven code. There are currently only 2 configuration values, so the test only had 4 possible configurations. In my case, I wanted to drive these tests through paramterization. This allows me to have simple test code, while putting all the complexity in the test arguments. While working with JUnit5 at my unspecified big company, I learned today about ~@MethodSource~ annotation in Java, and precisely how it works.

TIL - Structured Clone

Too many times have I been bitten by modifying references to an object rather than a clone of the object. This isn’t a problem in languages like Clojure where everything is immutable by default, but when working with Python or JS, it certainly is. For a client here in my hometown, I wrote some Python code that read values from some JSON in a file into a list. Those values were then scaled in each loop iteration to match a “scale factor” that the code expected.