Hello, World. This site is still static HTML but now built with 11ty and hosted on Cloudflare Pages, rather than being handwritten HTML on GitHub Pages. This means it's easier for me to add content and will hopefully res…
Here's how to deploy a static HTML site on Cloudflare Pages and secure it with Basic Authentication using middleware. This is simple to set up and means that people or bots can't access your site without a password. Note…
Note: these were created primarily with ChatGPT, Claude and Gemini, with a bit of back and forth prompting, pasting in AWS docs and correcting things. AWS main topology and infrastructure options Feature AWS Regions AWS …
It turns out that ChatGPT (and other large language models) are great at generating diagrams as well as text. If you ask ChatGPT to make a diagram then it might try to use Dall-e and draw one from scratch. Dall-e and oth…
I recently started work on a new project and started transitioning the JavaScript into TypeScript, so thought I'd write some notes. TypeScript is made by Microsoft and basically enhances JavaScript by adding a whole load…
I was talking to my kids about large numbers like a googol (10^100) and a googolplex. I knew bits and pieces about bigger number but not enough to confidently explain it until now. Addition, multiplication, iteration and…
While working on a JavaScript project using the chalk library to stylize terminal output, I found an interesting thing about handling JavaScript files as both importable modules and executable scripts, much like Python's…
When managing Linux servers, it's crucial to ensure they're free from vulnerabilities. I recently explored various package vulnerability scanners and stumbled upon Vuls, an open-source tool that impressed me with its pow…
This is an overview of how to get a server set up running Dokku, with wildcard domains. Out the box Dokku image from DigitalOcean: https://marketplace.digitalocean.com/apps/dokku Locally Git setup: DOKKU_HOST=ssh.example…
In 2016, DeepMind's AlphaGo program achieved a historical milestone by defeating Lee Sedol, one of the world's top Go players. While the raw skill of AlphaGo was impressive, one particularly interesting aspect was its un…
Docker Volumes The standard way to keep files in sync between a Docker container and your host is using volumes. These use (normally) use bind mounts under the hood. You can do this on the command line: docker run -v /pa…
I ran through Packaging Python Projects today to get Clipea installable with pip install clipea-cli. (I originally wrote Clipea in PHP to get it working quickly but someone kindly ported it to Python.) pip packages are h…
First thing's first: GPT stands for Generative Pre-trained Transformer but for some reason OpenAI have reused the name for one of their products. What's a Generative Pre-trained Transformer really? These are artifical ne…
The site is a basic Eleventy site. You can install with npm install and build with npm run build. Use npm run serve for development. Most of the code that turns the repo of markdown files into a website is in .eleventy.j…
I work with APIs most days and occasionally come across one without an accurate API specification. This happened recently and I thought it would be worth creating a spec before starting to use the API: that way I could m…
We encountered a challenge recently with a security vulnerability in a transitive dependency. This was where our project depended on a library (let's call it acme-corp/foo), which then depended on another library (let's …
Today, I was setting up an Amazon Lex chatbot and came across a couple of challenges. In simple terms, Amazon Lex is like a more structred version of ChatGPT. It uses advanced natural language understanding (NLU) and aut…
Revisiting CSS: A Pleasant Surprise I don't often write CSS. To my surprise, I discovered that modern CSS now has its own native variables, known as Custom Properties. These are now widely supported across all major brow…
Your remote tracking branches This cleans up the big origin list you get when you do git branch --remote git remote prune origin Local branches that have been merged This removes your local branches that have been merged…
OpenAI recently made their GPT-4-backed vision capabilities available to API developers. Here's OpenAI's Vision API Guide. After seeing this demo on Twitter and examining the code here, I decided to experiment with it my…
I was trying to get a copy of an Android app APK file today. This can be really handy if you need to back up an app that's not on the Play Store anymore, or if you're trying to debug a problem and you don't have the orig…
I was having a look around at vector databases to have a play with document search and realised that suddenly there's support all over the place for them, even from the big players. ELI5: geo databases query 2 dimensiona…
This means they can do the same calculation twice and get different answers. Be careful if you use GPUs for security related things. This is because of how floating point arithmetic works in CPUs/GPUs - the same thing th…
A couple of weeks ago Chris and I went on a TDD course from Codemanship. This post is an expansion of some of my notes from the course. As always, suggestions and corrects are welcome (especially as pull requests). Schoo…
Last week I gave a talk at BCS Dorset about technical debt: Balancing technical debt and getting things done is one of the hardest problems we have. When should we write beautiful, elegant, clean code and when should we …
This is a quick update to my original blog post criticizing mutability in PSR-7. The original blog post got a fair few tweets and traction on Reddit. More importantly, Matthew Weier O'Phinney, the lead author of PSR-7, r…
In PHP, Traits can't implement interfaces. They can, however, include abstract methods. These methods then need to be implemented by the concrete class that implements the trait. This allows a trait to provide some boile…
Singletons The Singleton pattern is when you can only instantiate 1 instance of a class. Realistically the only way to do this in PHP is by controlling object lifetime inside the object itself globally. This is bad as it…
PSR-7 contains interfaces for HTTP messages. These are like Symfony Kernel's Request and Response interfaces. Having these new interfaces would be great for the PHP community but there's a couple of issues with their cur…
Someone posted a question about using global variables on r/php, which I answered. Copied here for posterity. Using global state is technical debt. This means you're trading off short term wins (mostly writing less boile…
My notes on Everzet's talk "Design how your objects talk through mocking" at PHPNW14 Everzet's Original slide deck Code sample here are using Prophecy to create test doubles Different test doubles: Mocks, stubs…
Quick strace command that I use all the time to see what files a process is opening: strace -f <command> 2>&1 | grep ^open Really useful to see what config files something is reading (and the order) or to see what…
I haven’t done much with Canvas, so I thought I’d experiment by making Conway’s Game of Life with a little JavaScript. Conway’s Game of Life is based on a grid of cells, which are either alive or dead. It has 4 simple ru…
Bitcoin is a digital currency without any central control. It was introduced 4 years ago today (3rd January 2009). 1 Bitcoin (BTC) is currently worth around $13. Last year Bitcoin grew considerably in market cap (now abo…
As the first alpha of PHP 5.5 has been released, now is a great time to play with its new features. The first new feature is generators. Generators are like very simple iterators. PDO’s PDOStatement class implements Trav…
Every now and then I need to batch resize or change the quality in some images. Photoshop and the GIMP let you do this, which is fine if you’re happy using your mouse or lots of RAM. The most efficient way of processing …
In JavaScript A common patten in JavaScript is immediately-invoked function expressions, also known as self-executing anonymous functions. These allow you to create a private scope that won’t pollute the global namespace…
The PHP Framework Interoperability Group (PHP-FIG) are a group representing most of the big names in the PHP world such as Zend and Symfony. The group has formed to encourage PHP frameworks to be more interoperable. They…
Responsive design today is great: different layouts can be served to different screen sizes. In the future, extra media queries could be available to web developers and designers to allow the content of a page respond to…
Mobile browsers delay browser clicks (or, more accurately, taps) by 300ms so they can detect double taps. This can be great but if you want to speed up clicks in your mobile site or app, you can use my plugin: jQuery Fas…
We all love using Dependency Injection but often Laravel’s facades and IoC container are used more like a static service locator, which (despite being testable) can easily lead to violations of the Dependency Inversion P…