RSSAmplifier

Blog

Brian Douglas

I write about programming, thing's I've learned whilst programming, and hopefully, some useful code snippets.

briandouglas.ieRSS feed ↗110 posts

Latest posts

MariaDB Typescript enum fix

Recently I was looking through the github issues for the MariaDB nodejs connector project for some low hanging fruit. I came across [issue 347](https://github.com/mariadb-corporation/mariadb-connector-nodejs/issues/347). This is something that is common in projects written in Javascript that are consumed via a Typescript project. The crux of the problem is the difference between a `const…

Adapt, improvise, and overcome

On social media and YouTube I've been seeing a lot of influential developers complain about how LLM usage in programming has left them feeling. Mostly these complaints are along the lines of "I feel like my skillset is no longer important", "I feel no satisfaction when an LLM successfully writes a bunch of code for me", or "I feel like my career is over, the LLM will replace me". What a bunch…

Command pattern for canvas games

Despite popular opinion, I still belive in the use of design patterns where applicable. I've been reading through Bob Nystroms [Game Programming Patterns](https://gameprogrammingpatterns.com/command.html) from 2014. The great thing about these sort of programming books is that they hold up really well. The patterns present are just as relevant today as they were in 2014.

Install Temurin from tar

This is a quick helper for future Brian. Here are the commands to install a JDK from a tar file on Debian.

RSS Feed Added

By popular demand (one email) an RSS feed has been added to this blog.

Front page of the Orange Site

For the third time, one of my posts has ended up on the front page of Hacker news.

Tailwind and slop apps

Tailwind is great. It's a quick way to style a webpage and offers incredible flexibility. The problem is, despite Tailwind being incredibly customisable I can instantly tell when a site is using Tailwind. It has a certain look and feel that is hard to shake. A few years ago this "look and feel" was fresh and classy. Now thanks to LLMs prefering to use Tailwind to style a page rather than…

AI and The Redmonk rankings

Every year I look forward to seeing the Redmonk language rankings. They are the only language rankings I pay any attention too, cough Tiobe. In recent years there has been very little movement in their top 20. It features all the usual candidates. Java, Javascript, Python, C# etc... the languages you may possibly get a job in. My interest lies in the outliers, seeing random languages fly up the…

Ignore what everyone else is doing

I check Hacker News and Lobsters all the time. It's sort of like an addiction, or maybe just a bad habit. It started about three years ago when I would post blog links on the two platforms. Which Lobsters banned me for. Apparently self promotion is wrong. Well I have no friends or colleagues to post for me, so it's self promotion or no promotion. Anyway, there was a time when I would…

1 Bit Jam #11

I've spent the last 5 days writing a Tiny Tank shooter in C with Raylib.

Pong in C with Raylib

The sheep have finished lambing and I finally have some spare time. I've been AFK for a few weeks and during that time I've been reflecting on life as a programmer. Upon this reflection I have made a decision. I want to write C. Writing C feels like proper programming and I wish to be a proper programmer.

I'm a "Software Engineer"

I've been working as a "Software Engineer" since 2014. Before that I studied a Master's Degree in Computer Science. Where I learned about C, C++, and how computers worked. This was all in preparation for a wonderous career in the software industry.

Featured in GameDev Weekly Again!

It's been two whole weeks since I was featured in the GameDevJS weekly newsletter. And guess what, I'm in it again!

Degrees to Radians

The html5 canvas api uses radians for rotation and drawing circles. But I, as an ape, use degrees. Because of this I find myself constantly writing the following methods to convert degrees to radians and vice versa.

Featured in GameDev Weekly

Last week I ranted about the AI slop app "gamebot.studio". The rant resonated with some it's readers and has been included in the GameDev.js weekly newsletter.

gamebot.studio

Today we are going to look at an AI slop app. The type of app that a junior dev prompts into existence and tries to flog as a "platform". The case study today is gamebot.studio. Which I haven't linked to as I find the whole thing malicious.

GameDev in JS "The Canvas"

Let's take a deep dive into GameDev in JS. I've been making games in javascript since 2014. It's super fun as you can build something and share the demo straight away. No need to compile or build for certain platforms. Just write the code and see it work in a web browser.

Bye bye Github

Well any link to my Github account from this blog is now broke. After years of steady decline and selling it's soul to the devil. I have decided I don't want to be a member of Github any longer.

Use it or lose it

"A man could use his back or use this brain..." that is a line from one of my favorite Eagles songs, Doolin Dalton. It springs to mind as the current rhetoric from AI pushers is that as machinery made the human back redundant, AI makes the brain so. Obviously that is complete bollox.

Binary Search

Back to comp-sci 101, as I'm currently re-exploring the fundamentals of programming. As others choose to hand over their hard earned programming skills to the LLM I've decided to double down. So let's take a look at the binary search algorithm.

Using git hooks locally

Git comes with the concept of "hooks" which are scripts that get executed when and event occurs. A common use case for git hooks is to run a test suite before a commit (pre-commit) is made. If the script that is executed exits with a non-zero value (error) then the commit is prevented.

Use an index when sorting

When working with a database it is a very common task to retrieve a sorted list of entities. What you might not realize is that this can be a very expensive operation.

http_status_codes table

I've been doing a lot of web scraping for various AI tools. This includes model training, and search functionality. One thing I find myself doing is generating lots of prototypes. Each prototype requires me to write a new db schema and one thing they share in common is the need for a `http_status_codes` table to record the final status response of a web page. You could store the…

Add generics to MariaDB Node Connector

When working with an instance of a MariaDB database I noticed that the [npm package](https://www.npmjs.com/package/mariadb) used to connect did not support Typescript generics. This was something I felt I could fix, so I sent in a PR.

Modeling Tags in a Postgres schema

When working on a db schema to model the [OpenGraph protocol](https://ogp.me) I made an initial mistake with how I modelled tags within the database.

Some useful rsync tips

I've been using rsync to deploy this blog. Because I live on the edge and don't need any deploy pipeline headaches. And tbh, this is blog is not critical software it's a static site hosted by a caddy server on UpCloud. Anyway here are some quick tips from my experience deploying on the edge.

Install Temurin JDK on Fedora

Quick note on how to install the Temurin JDK on Fedora, as the AIs get this wrong.

The future of videcoding

This one made me laugh. One of my favourite "AI" predictions to far. ![Your future self as a vide coder](/images/vibecoder.jpeg)

2026 new year's resolutions

2025 was a super busy year for me. Some of the highlights being, my wife is now pregnant (due date 02/01/2026), moving house (now on a 300 acre farm), becoming a part time farmer (150 sheep, inherited from my father in law). And on the tech side, as my techy life is the focus of this blog, an awful lot of wheel spin.

Please don't write code

Please, whatever you do, do not write any code.

Card deck in C

I'm working on a Raylib game in C. It's a Scoundrel clone, which is a card based dungeon crawler. Anyway, I thought I'd share a code snippet of how I am generating the deck of cards using C.

Hosting this blog

"Every developer should host their own blog". Is a statement repeated regularly across socials. I agree, they should. But I didn't untill now, so don't beat yourself up over it. Here is a quick run down of how this blog is hosted.

Advent of code d6

Phase one for day 6 only. Phase 2 beat me. Spent over an hour on it, but the left vs right justifying of numbers got me. I may come back to it, but I've spent all the time I want to on it tonight.

Advent of code d5

This is the first one where I've had to change a solution for performance. The logic here was fairly straight forward. The challenge was getting the program to complete before new years eve.

Advent of code d4

I enjoyed this one.

Advent of code d3

Only showing the phase 2 solution here. Becuase it is so far removed from the phase 1 solution, that I'd have to re-implement phase 1.

Advent of code d2

Hackety hack...

Advent of code d1

I never manage to finish advent of code. Here is my C solution to day 1.

A year of experiments

2025 has been a strange year for me in regards to programming. Throughout my career I have worked on many differents "stacks". I started off in dotnet in 2012, then php at now defunct "digital agencies", then into java and C++ at the dreaded fintechs. My last role involved using python, to integrate "ai" into an insurance company's website. So I'd like to think I have a broad range of…

Neovim 0.12 adds vim.pack

It's a pain having to use external plugin managers for vim. It's always ircked me, and now I'm glad to see the neovim has added a builtin plugin manager as of 0.12.

Part-time sheep farmer

"Part-time sheep farmer", that is my new job title.

Go install script

I'm currently writing an extension for the Caddy web server which is written in Go. Becuase of this I needed to install go on my wsl Ubuntu instance. For future Brian, I have created a bash script to install other versions of Go.

Managers, managers, managers

Today was my last day at work. I work as a short term contractor, although sometimes it's not short term. I onced worked a rolling 6 month contract for 4 years. It paid for my house and wedding, those were the days. Often I am happy to accept extensions. But sometimes I don't. When I don't it's always been down to the same cause. Managers or mismanagement.

mise-en-place

Everything should be rewritten in rust. Or so I'm told by all the vibe coders. `mise` is a _dev tool manager_ that is super handy. I currently use it to manage my dev projects. So the context of this article is my wsl ubuntu 24.04 instance.

Generate SQLite table types for Typescript

Bun has an sqlite interface built in. It make for some great dev-ex. One thing that ircks me when dealing with sql and Typescript however, is that when I run queries I often have to model the db table that I am querying in Typescript. This usually involves a manual effort, but not anymore. I have written a short script to auto generate Typescript types for table definitions.

Literal templates

I introduce to you "literal-templates", a lightweight, flexible template engine for Node.js. Offering dynamic registration and rendering of template views, includes, and helpers.

Template strings as a view engine - Part 2

I've been thinking some more about using template strings as a view engine. This blog for example now uses the template engine shown below. It's quite simple to implement and it's usage in html files is super intuitive. You just need to remember that the html you are writing will be intepretted as a template string, and you already know how to use template strings, so there is no…

Template strings as a view engine

Template strings in JS can be used to create a view engine without adding any extra libraries. So if you are creating a server side js app, think before you reach for handlebars, ejs, or god forbid pug. Not becuase those are bad, pug is, but becuase it's so easy to leverage template strings as a view engine.

Object field validators in Typescript

Before you pull in the next hot new validation library. Ask yourself this question. Do I need it? The answer is no, field validation is quite easy. Let me show you how to create an extensible object field validator.

Feature flags db schema

Feature flags are simple _on_ / _off_ flags that can be used to toggle application features without needing a production release.