Articles

A Look At Benford's Law

Benford's Law is an interesting heuristic in data analysis. It states that in any large collection of numbers that are created naturally, you should expect to see numbers starting with the number 1 about 30% of the time. The frequency distribution of numbers states that 2 should appear about 17% of the time, down to 9 being seen just 5% of the time.

It's important to understand the term "naturally created" here. Essentially, Benford's Law looks at the tendency of created numbers to span orders of magnitude. This means that numbers from company accounts, invoices, bills, or any other financial record will follow Benford's Law. These systems have numbers that are very small along side numbers that are very large and so comparing them using a logarithmic scale shows that they clump together.

Protecting A Page From Being Directly Accessed With PHP

I was thinking recently about the number of ways in which I could restrict access to a page using PHP.

The obvious option is to create a user authentication system, but in some situations that is overkill for what is required. If you just want to prevent users from going directly to a certain page then there are a few options open to you.

In this article we will look at how to protect a page from being directly accessed without using a user authentication system. I will address any pros and cons of each method so if you are looking for a way to protect a page then one of these might be useful to you.

Installing G-Mouse GPS Receiver And Reading GPS Data On A Raspberry PI

I was looking to add GPS to my Raspberry Pi (specifically the Clockwork uConsole) and found this USB GPS Receiver with 2m Extension Cable on the PiHut website.

The unit has a USB interface, a 2 meter long cable, and the GPS receiver itself is magnetic and so can attach to lots of different surfaces. Plus, since it was sold on the PiHut website I was quite confident that it would be easy to get working with the Raspberry Pi. As it happens, it was easy to get working, I just needed to install a couple of extra tools to make sure it was producing the correct data.

In this article we'll look at what happens when you plug in the GPS receiver, and then look at a couple of packages you can use to verify that the GPS receiver is working correctly. This assumes that you are running the latest version of Raspberry Pi OS.

Clockwork Pi uConsole CM4: A Review

I was doing some research into the Raspberry Pi a while ago and I happened to come across a neat little enclosure for the Raspberry Pi Compute Module 4 (CM4) called the uConsole.

The CM4 is essentially a normal Raspberry Pi 4, but it comes without the normal USB/HDMI interfaces that the Pi 4 comes with. This means that in order to use the CM4 you need to plug it into a separate PCB, which then provides the interfaces needed to attach monitors and peripherals.

This is where the ClockworkPi uConsole comes in. The uConsole (or micro console) is an enclosure for the CM4 that features a built in screen and keyboard, a track ball, small speakers, a battery pack, and an optional mobile network card.

Weikav Lucky65 V2 Wireless Mechanical Keyboard: A Review

Somewhat recently, I was introduced to the concept of customisable mechanical keyboards. I do a lot of typing, mainly writing/story work, so the tool I use is quite important, I’ve just never given it much thought before.

My old keyboard was a Topmate K22, which is a pretty basic keyboard. I’ve recently been gifted a mechanical one that uses a Weikav Lucky65 V2 as a frame.

It turns out mechanical keyboards are pretty neat. Though they’re better than normal keyboards in almost every way, they also have their own, rather unique, problems.

In this article I will look at the Weikav Lucky65 V2 keyboard, the switch and keycaps selection used and a look at using VIA to configure the keyboard.

DrupalCamp England 2025

The first DrupalCamp in England was held this weekend (1st March 2025) in Cambridge. I drove down on the Friday with Chris Maiden to attend (and speak!) at the event.

We arrived early at the event and and started the day with a much needed coffee (or two) and started chatting with the other attendees.

The opening session was a keynote from Baddý Sonja Breidert, who talked about AI, the success of Drupal and the Drupal CMS system, and about the success of the Drupal community. 

An Introduction To Mechanical Keyboards

I got into mechanical keyboards a few years ago, around the same time that I started to work from home. Since then I have collected a number of different keyboards of different sizes and orientations, mostly in a drive to have a nice feeling keyboard, increase productivity and reduce my RSI.

Whilst keyboards look similar to the uninitiated there are quite a lot of different factors that go into the mechanical keyboard. In fact, there are so many different terms used in the mechanical keyboard world that might need some explaining before you get into things.

In this article I will look into some of the different types of keyboards available by breaking down some of the terms used. I'll then give some recommendations on where to get started, and what to avoid.

This is an introduction and is by no means a complete picture of every sort of keyboard available.

Programming Using AI

I've been thinking about this article for a while but it is only recently that I have been able to sit down and really have a think about it properly. Or at least collate all of my thoughts into a single article.

Over the last couple of years the term "AI" has become a sort of marketing term that is banded about (and abused) by all sorts of companies with the intent of trying to make life easier.

In this article we will define the term AI in the context of programming, look at some services that you can use to produce code, and go through some pros and cons of using AI systems to code.

Drupal 11: Creating Custom Queues

Creating queues using the core queue classes in Drupal is fairly straightforward. You just need a mechanism of adding data to the queue and a worker to process that data.

As the data you add to the queue is serialised you can add pretty much any data you want to the queue, so the only limitation is rebuilding the data once you pull it out of the queue.

There are some situations where the core Drupal queue system needs to be altered in some way. You might want to separate the data into different tables, or have a different logic for creating or storing the queue items, or even integrate with a third party queue system for manage the queues.

Drupal 11: Using Data Transfer Objects With The Queue API

When writing data to the queue database system Drupal will convert the information to a string using the PHP serialize() function. When the information is pulled out of the database the queue system will unserialize() the data to convert it back into the original information.

When you first start using the queue system you will probably use an array or the PHP stdClass object to store the information on your queue. Whilst this works, the information they contain is pretty free form and makes testing or working with the data a little cumbersome.

A much better way of storing data is by creating an object of a known type and using that as the storage medium for the queue.