7 May 2023... The following, including the references, was generated by ChatGPT during a conversation I had with it about management. I started with a simple prompt and refined it until I was happy with the output. I then asked it to provide references for its response. It is not intended to be advice for current or future managers and I am in no way trying to pass it off as my own work. Read more »
11 Feb 2023... In this series of posts I am describing the infrastructure that hosts all of my websites and development projects. Part 1: Hosting and Configuration Part 2: Nomad Configuration Part 3: Nomad Jobs Part 4: Continuous Delivery Part 5: Eliminating the Downtime Summary In the Outstanding Issues section of part 4 I noted that the update mechanism results in a few seconds of downtime for a site when it’s updated. This is clearly unacceptable. Read more »
4 Jan 2023... In this series of posts I am describing the infrastructure that hosts all of my websites and development projects. Part 1: Hosting and Configuration Part 2: Nomad Configuration Part 3: Nomad Jobs Part 4: Continuous Delivery Part 5: Eliminating the Downtime Summary All services exist in their own GitHub repository. Each repository contains a Dockerfile in the root that will build the Docker image. Each one has a GitHub action that’s triggered by merges to master and will tag the repo with the current date and time. Read more »
3 Jan 2023... In this series of posts I am describing the infrastructure that hosts all of my websites and development projects. Part 1: Hosting and Configuration Part 2: Nomad Configuration Part 3: Nomad Jobs Part 4: Continuous Delivery Part 5: Eliminating the Downtime Summary All services I currently run are deployed as Docker containers. Various static HTTP sites based on plain HTML, Jekyll, Hugo, and custom Python generators. A number of development projects running everything from Go to PHP to Python. Read more »
2 Jan 2023... In this series of posts I am describing the infrastructure that hosts all of my websites and development projects. Part 1: Hosting and Configuration Part 2: Nomad Configuration Part 3: Nomad Jobs Part 4: Continuous Delivery Part 5: Eliminating the Downtime Summary Each server runs Nomad in both client and server modes. Each server also runs instances of Consul and Vault. Fabiolb is used for external proxying and load balancing. A custom, open-sourced tool called Aleff is used to automatically obtain and renew certificates from Let’s Encrypt. Read more »
1 Jan 2023... In this series of posts I will describe the infrastructure that hosts all of my websites and development projects. Part 1: Hosting and Configuration Part 2: Nomad Configuration Part 3: Nomad Jobs Part 4: Continuous Delivery Part 5: Eliminating the Downtime Summary Hosted at Scaleway. 3 cheap development-grade virtual servers. Running Ubuntu 22.04.1 LTS, Nomad, Consul, and Vault. Server-to-server communication over a host-provided private network. Server configuration managed with Ansible. Nomad job configuration is managed with Terraform. Read more »
3 Dec 2012... I own nearly 100 domain names, which is a pretty modest number against some people and organisations I know. Most of them are currently registered with Gandi.net and I’ve always found their service to be good value for money and that’s still true today. Most of the DNS for those domain names is also hosted with Gandi. Why? Because it’s included in the registration cost. However, their zone management tool, while it had a major overhaul in the last year which has made it a lot better, it’s still a major pain to use. Read more »
11 Nov 2012... HTTP authentication is the easiest way to make a page or area of a website secure. It’s very easy to accomplish with pure PHP, so no web server configuration is required making it a lot more portable. This function implements a very simple HTTP Basic Auth authentication system. Simply call it before you do anything else in your script, pass it an array of valid users (username => password), an optional description of what’s being secured and it will do the rest. Read more »
12 Nov 2011... Twitter sends notifications of new followers and direct messages by email. While you can use the API to keep track of those things it wastes hits and it’s incredibly inefficient especially for accounts with minimal activity. I run several Twitter-based services but they all share the same email address. This allowed me to use the same email handling setup to process all email coming in from Twitter. So far it’s working really well but it means this script is a bit more involved than it needs to be. Read more »
16 Aug 2011... When I get bored while working I choose something from a list of things I want to have a go at someday. Some things are “read this blog post”, or “learn about this technology”, but most are along the lines of “make this”. Today I picked a “make this” item… to implement the game Fortune’s Tower. I came across this game in the Fable® II Pub Games on my Xbox. I have never actually played Fable® II, and I’ve barely touched the other pub games in the Xbox Live Arcade Pub Games, err, game, but I keep returning to Fortune’s Tower. Read more »
12 Apr 2011... A common logic pattern that’s seen when dealing with GET and POST parameters in PHP is to check whether the array element exists, then set another variable to that or a default. It usually looks something like this… $var = (isset($_GET['var']) ? $_GET['var']) : ''); If you don’t develop with notices turned on (WHICH YOU SHOULD!) you probably haven’t seen the problem that this code gets around. Simply referring to $_GET['var']will produce a notice if it does not exist. Read more »
13 Mar 2011... A couple of days ago, Ryan Sarver of Twitter sent an email to the API developers mailing list notifying us of changes to their terms of service. As per usual the community have exaggerated the implications of these changes to the point where it’s now pure comedy. As has happened every time Twitter make any changes that may affect developers, developers are panicking, and for no good reason that I can find. Read more »
24 Jan 2011... My thoughts on ISPs and how they’re whiney little kids who like to throw their toys out of the pram have been previously documented on this site. Apparently the advertising industry is set to get involved, and, according to NMA, is poised to ask the public for their thoughts on how broadband suppliers advertise their services. Here are my thoughts on this prospect. That article states that… Concerns centre on claims made by suppliers about the maximum speed customers can expect to receive from their broadband service against the speeds actually experienced. Read more »
19 Feb 2010... The other day I was continuing my long-term quest to sort through all the flotsam and jetsam of accumulated crap on my hard drive when I came across the following video (click through if you don’t see the video below). Recorded in April 2009, it shows the first version of the TweetMeme Live functionality without any rate or minimum retweet restrictions. As you can see it moved pretty quickly. Bear in mind that these are unique URLs, not simply repeats of URLs already seen. Read more »
29 May 2009... One of the pillars of a scalable website is ensuring that only activity which is required to build a page should be performed during the processing of a page request. Activities that fall under this category commonly include sending emails, recording statistics and general housekeeping such as removing temporary files. Back when I started working on sites big enough for these activities to cause a problem I went down the obvious route of making a PHP CLI script for each job that needed doing and getting it to run using cron. Read more »
31 Jan 2009... A couple of days ago I released a new TwitApps tool called Follows. I know I haven’t talked about TwitApps on this blog yet – that post is coming – but if you follow me on Twitter you should be aware of it. The Follows service monitors your followers on Twitter and sends you a daily, weekly or monthly email telling you who’s followed and who’s unfollowed you since your last email. Read more »
24 Jan 2009... Twitter promised OAuth support a l-o-o-ong time ago, and it would appear to finally be here. Alex Payne sent a “Call for OAuth beta participants” to the developers list yesterday and had an overwhelming response. This predictably triggered a deluge of tweets and blog posts, but the one that caught my eye was on ReadWriteWeb titled “Why Twitter’s New Security Solution Could Pave the Way to a Future Web of Mashups”. Read more »
17 Dec 2008... My latest project went live on Monday this week. It’s another Twitter-based toy along the same lines as hotornot but it uses your Twitter account and profile picture. Since launch it’s proved very successful and has spread quickly due to its viral nature. Screenshot lost :( The site is called Twitorfit and was the brainchild of a Twitter-based conversation between Nick Halstead of fav.or.it and Andy McLoughlin and Zuzanna Pasierbinska from Huddle. Read more »
28 Oct 2008... Several templating systems exist for PHP, but since PHP was originally created as a templating language I’ve never understood why more developers don’t use pure PHP in their view layer. The following snippet is a small function that facilitates precisely that. The only setup required is to simply define TPL_DIR to point to the root directory of your templates. You can then call the function, passing it the relative path to a template file in that directory, an array of variables to be used by the template and you can optionally have it return the results rather than sending them to the browser. Read more »
23 Oct 2008... Really short snippet today – a password generator. Not much to say about this one since it’s pretty simple. Pass it the length of password you want and optionally a string of valid characters it can use and it’ll give you a random string back. function GeneratePassword($len, $allowedchars = false) { if ($allowedchars === false) { $allowedchars = 'abcdefghijklmnopqrstuvwxyz01234567890'; } $retval = ''; $maxidx = strlen($allowedchars) - 1; for ($i = 0; $i < $len; $i++) { $retval . Read more »
20 Oct 2008... Today’s snippet describes the singleton pattern. The singleton pattern is a method of creating a class that statically maintains an instance of itself and ensures that no other instances can be created. This is useful for classes that implement app-wide services such as logging, DB access and other shared resources. The basic requirements for a singleton class are as follows… The constructor is private. This ensures that nothing outside the class can create instances. Read more »
17 Oct 2008... Pretty boring snippet today, but I find it immensely useful. My time class provides representations of periods from OneMinute to OneYear. It only has one method which will calculate an absolute time by adding a given time period to the current time. You can optionally provide a format intended for use by the date function to return a formatted string rather than a timestamp. Hope you find it useful too. Read more »
16 Oct 2008... Today’s snippet is a complete class for normalising cookie usage. In addition to providing methods to set and get cookies you can also check to see if a cookie exists, is empty and delete them without needing to concern yourself with more detail than necessary. Features include… Cookies Set during a request are immediately available via the Get method. Deleted cookies immediately cease to exist within the current request. Pre defined time spans allow for simple cookie management. Read more »
15 Oct 2008... This is the first of what I hope will be a series of posts showing snippets of code from my personal library. My intention is to highlight useful techniques I’ve developed or picked up over the years. Comments, questions, suggestions and requests are welcomed. This first snippet is a simple function to set appropriate expiry headers. Simply pass it a time period in seconds or a unix timestamp to set the expiry to some time in the future, or 0 to expire the page immediately. Read more »
26 Jul 2008... Ok, so the title is a little misleading, but hopefully only until I explain what I mean. The first session refers to PHP sessions, and the second refers to the concept of sessions. Maybe it needs a little more explanation than that. Do what? There aren’t many PHP applications (or indeed web applications) out there that don’t need to maintain some form of user state between page requests. This functionality is commonly known as sessions, and most web development languages provide a built-in mechanism for managing them, and PHP is no exception. Read more »
18 Jun 2008... TLDR: If you’re using PHP you want PHPMailer. If you’re using something else there’s probably an equivalent library (Google is your friend). However, regardless of how you do it you should always consider the impact of your email activities on your users. Unwanted email is one of the biggest problems on the Internet today and the more you can do to present your website as a responsible sender of email the better. Read more »
13 Apr 2008... While catching up on Twitter this morning I came across a blog post by David Cushman on the simplicity of riding a bicycle compared to using ebay or iTunes. I kinda see what he’s saying, but as he points out I think it has more to do with what people are used to. His daughter has almost certainly seen people riding bikes so I would suggest she picked up the general idea through observation rather than it being particularly intuitive. Read more »
9 Apr 2008... This is really daft. It’s been widely covered recently that the BBC iPlayer service is taking off in a big way which is great news for the future of TV. Unfortunately some ISPs are throwing their toys out of the pram and complaining that the increased bandwidth usage is costing them a lot of money and that the BBC should help cover the cost. This strikes me as an extension of the equally stupid claim that it’s ok to have fair usage limits on unlimited broadband packages. Read more »
11 Nov 2007... It is with great regret that I must inform you that SharedServer.net will cease trading at the end of this year. This has been a difficult decision to make, but for various reasons it is not practical to continue. Me, In An Email To My Customers, Early November 2007 I wrote this in an email to my customers last weekend. After 10 years of running a web hosting service as “a hobby” I’ve decided that it’s no longer practical to continue with it. Read more »
10 Oct 2007... One thought keeps spinning round my head and has been for a while now. There are too many social networks for global participation to be practical. The core problem is that each site has their own list of your friends. This list is usually referred to as the social map and for the idea of social networking to really become a permanent part of the Web this aspect needs to be extracted and standardised. Read more »
9 Oct 2007... Amazon have announced an SLA for their S3 service which is, you know, good news. But like every other company on the planet they place responsibility for monitoring whether they meet it on the customer. By definition an SLA is a company committing to a level of service. If they then expect you to monitor their availability they are essentially saying they’ll only get punished for breaching it if you notice that they’ve breached it, and even then only if you “apply” for compensation. Read more »