RSSAmplifier

Blog

danrh

(λ () 'danrh)

danrh.netRSS feed ↗41 posts

Latest posts

A blog won't give you an edge anymore

"Update blog" has been on my to-do list for the last couple of years.I have had five jobs since starting work in 2018, the first I got through a careers fair at my university, but all of the others - in some way or another - I got through my blog. It has been over two years since I was looking for a new job, and even longer since I interviewed candidates. In that time, I have relentlessly…

PostgreSQL: `is not null` and `is null` may be inconsistent

I recently discovered that, in PostgreSQL, a row may simultaneously not satisfy is null and is not null, if it contains some null and non-null values.Example:

CGI Scripts in Common Lisp

I've been playing around with CGI (Common Gateway Interface) scripts recently, and reading a bit about Lisp. Having written some Clojure, Racket, and Chicken Scheme, but never any Common Lisp, I thought it would be fun to make a little CGI script in Common Lisp - specifically Steel Bank Common Lisp (SBCL).A CGI script is a program that a web server calls to handle a request. The program takes the…

Powered by Cryogen & Clojure

This blog was built using Cryogen Static Site Generator, which is written in Clojure. Cryogen is extended and configured using Clojure and Clojure's EDN (Extensible Data Notation).Check out Clojure and Cryogen, if you haven't already!

Pairus

Pairus is a new Matchmaking App founded by Anthony Lacavera and Emily Lyons, with a technical team lead by Govind Mohan. I advised them, as a Software Architecture Consultant, on how to setup the software system in a way that keeps unnecessary complexity low and delivers the product within a reasonable budget and timeframe.

stdout is only for a program's main output

Only for the main output.

The biggest reason I never use classes in JavaScript

JavaScript methods that use this in reference to the class they belong to will break if the method is assigned to another value or passed into another function as a function object.This is because the value of this is dependent on the object that the method is a member of at the time of calling.

Writing Production Ready Code

Is your code too clear and simple? Is it too obvious what it does? Did you write it in a way that is too easy to understand?If so, you need to make it Production Ready. If you aren't using Factories, Generic Higher Order Functions, or DependencyInversionDeinverterWrapperBeanSingletonProducers, you really need to up your game.

Disproportionately Satisfying Programs

I find some little programs/scripts/snippets disproportionately satisfying to write/use. The best programs are ones that I never intend to share with anyone else.The following program is one I wrote recently that falls into this category. All it does is convert lines of CSS into React inline styles, and it took only a few minutes to write.

What does your FizzBuzz say about you?

A classic problemAt the interview for my first job, I was asked to write a FizzBuzz. A FizzBuzz is a program that prints a series of numbers, unless a number is divisible by 3, in which case it prints Fizz, or divisible by 5, in which case it prints Buzz. For any numbers divisible by both, it should print FizzBuzz.

Knowd

Development of an AI-powered browser-based application for knowledge extraction and organisationAn early peek:

Little Red Flags

Obvious issues can betray the presence of subtler onesRecently, I stayed in an Airbnb. At this Airbnb, the shower's hot and cold were reversed. Initially confusing, but once I realised this I could use the shower with no issues.

A sh HTTP Server, using Netcat

This kind of thing should not be used in any serious production application. For a start, there is a risk of shell injection attacks.But I would bet that multiple S&P 500 companies use something like this, somewhere deep in the bowels of their systems.

Adventures in Forth/Stack Languages, part 1

Over the last week I have been playing with a Forth-like language that I have implemented (separately) in JavaScript and C.I have embedded the JavaScript version below, and both versions are available on Codeberg: https://codeberg.org/DanielRHolland/forth-style-stack-lang.

Throwback Thursday: Haskell Game of Life

Almost two years ago now, at a Mycs company party, I was chatting with some other devs when I confessed to having never implemented a "Game of Life". To remedy this, I wrote one in Haskell (iirc I actually started this at the party itself).

Programming Languages that changed how I think

This is, in some sense, a part 2 to Software Engineering Books and Resources that I have found interesting. In fact, this list was originally going to be included with that one, but it got too long (especially with the notes), and so I split it out. Some of the notes may get trimmed/edited/fleshed-out at a later date, and I might add more languages.I have intentionally excluded from this list some…

Creating Objects using Closures

You don't need Java (or C++, or an "OOP" language) to create objects and classes!What are objects and classes?For this post, consider objects to be instances of encapsulated state with associated methods, and classes to be the general definitions of a type of object.

Software Engineering Books and Resources that I have found interesting

I'm not really sure this is really "blog post" kind of content, as I intend to come back later and amend/add to it. When I have met people looking to get into Software Engineering, or students of Computer Science, I have been asked for recommendations for things to do/read/watch. This post lists some of the things that I have found interesting, and that I have recommended to others. This list is…

459 times

If you have a 99% chance of failure, for a given task, then if you attempt it 459 times, your chance of success will be over 99%.It gets better than this - after only 69 attempts, your chance of success is already greater than 50%.

Building a Mini Social Network in one file of Scheme - Part 1

I have been messing about with Chicken Scheme, building a little microblogging-style app, with a twist: users can vote for a purge of the whole site's content! I thought it would be fun to see how far I can get with one file of Scheme and without any JavaScript. I have put a favicon and some css in separate files, but really these could both be embedded in the Scheme file aswell - but that would…

Software Engineers don't have a tech stack - their projects do

I would rather discuss solving problems than just talk about "Stacks" in isolationIt's great to have favourites, and to be enthusiastic about specific tools - I do too, this is an important part of being a tech-nerd/hacker/programmer. But "Tech Stack" isn't an attribute of the person, it's an attribute of the project.

Calling a C Library for QR Generation from Chicken Scheme

I wanted to create a QR code from within Chicken Scheme, but I couldn't find an existing Scheme library or chicken Scheme egg online that would let me do this. Fortunately, Chicken Scheme is pretty easy to integrate with existing C code.The first thing I did was I wrote a Hello World in Scheme and another Hello World in C, and checked that I could get both of these to run (using the chicken…

Generating New Email Addresses for new services

I wrote a little script recently to generate new email addresses using the CloudFlare API.By doing this, I can create loads of email addresses really quickly and set up disposable ones for new services or categories of services. The script either randomly generates an identifier, or will use a value provided as input.

A very simple way to use NVM without sourcing it in your rc (+ works with fish)

I mainly use fish, and NVM does not work with fish out-of-the-box.Even if I happen to be using zsh/sh/ksh/bash, I don't want to be loading NVM when I start a new shell, when I am only using it on occasion.

Unix Shell Scripting

While building a simple HTTP Server in Racket, I wanted to automatically restart the server when I changed the source file.To achieve this, I wrote a simple shell script.

Racket HTTP Server 2 - Reading the Path

Previously, I wrote a simple HTTP server in Racket. The next step I will take with this project is to figure out how to extract the HTTP method and path from the request.The handle method's first argument, in, is an input port, from which the request can be read. We can read the first line from the request using the read-line function:

Adding TLS/SSL to a web service with Nginx

As I previously mentioned, it is almost always better to use a battle-hardened old favourite for security software, rather than to roll your own.With Nginx, you can add SSL/TLS support in front of your web server, using tried and tested software.

Using Template Haskell to bundle data into an executable at compile time

Often, a program will rely on static data - lookup tables, files to serve, initial values for internal data structures, and so on. Template Haskell can be used to load files, and execute code, at compile time.This is a very gentle introduction to the otherwise often intimidating world of Template Haskell. For the sake of simplicity, I am keeping a narrow focus: loading a file, and then…

Racket HTTP Server

When I start playing with a new language, I like to have a look at how I could build a simple HTTP server in that language.Racket's racket/tcp library provides us with functions for managing TCP connections. Using this, we can implement a server.

Mycs - Logistics Optimisation - Declarative Constraint Programming

Using Constraint Programming / MiniZinc for Manufacturing OptimisationUsed Declarative Constraint Programming (with MiniZinc) to optimise the assignment of Purchase Orders to Manufacturers, increasing Supply Chain cost-efficiency while also introducing checks and safeguards. Built a RESTful API wrapper in Go to allow the constraint solver to be accessed over the network.

Implementing a Feistel Cipher in Haskell

I was reading about Feistel Ciphers, and thought it would be fun to implement a toy one. I have shared it below.Wikipedia Feistel Cipher ArticleGithub Gist: Haskell Feistel Cipher

Mycs - New Refunds Processing System

Development of a New Refunds Processing SystemBuilt a new Refunds Tracking and Processing System for Mycs GmbH, a major European Retailer of Custom Furniture.

Erlang-Style Actor Model in Haskell

An Erlang-Style Actor Model implemented in Haskell Example Usage

Manipulate Spreadsheets in Python using openpyxl

PrerequisitesIf you don't have pip, install that first. Then install openpyxl using pip: run pip install openpyxl

Remove unwanted pre-installed android apps without root

Note: Unfortunately, this does not remove absolutely all traces of the software (/malware!). But, it does remove them completely from view, and reduces the amount of disk space they consume. I am not aware of any better solution without rooting the device. If you are aware of a better solution, please get in touch!

Advanced Software Engineering - Functional Test-Driven Development with Haskell

The following report was originally submitted as coursework for the Advanced Software Engineering module of my Bachelor's Degree in Computer Science.

Service-Centric and Cloud Computing - Shares Web Service Project - Scala/Go/Angular

The following is taken from a report I wrote for the Service-Centric and Cloud Computing module of my Bachelor's Degree. It describes a system built for the coursework of that module. The system's purpose was to simulate the trading of shares, and to log the shares owned by different users. The software was written to a specification which detailed the purpose of the system, but not specifics of…

BSc Final Year Project - Producing Accurate Questions by both Generating and Assessing Questions using Neural Networks

The following is a trimmed-down re-edit of the report I wrote for my Final Year Project, completed for my Bachelor's Degree in Computer Science from Nottingham Trent University.

Group Project - Advanced Analysis and Design

I worked with five other students to develop a storage management system for the NTU stores. First we had to figure out the requirements and specify the system. To better understand the problem, we had a site visit to the stores and carried out field research. This was followed by brainstorming, role playing, and process analysis. We wrote a Requirements Specification. In this we stated the…

Exel Computer Systems Plc - Eagle Field Service Enhancements

Mobile Field Service Application ExtensionThe Eagle Field Service System

Exel Computer Systems Plc - Advanced Product Configurator

Product Configurator for the EFACS E/8 ERP suite