Code

  1. Getting VueJS 3 to work nicely with Django

    Most of the tutorials for using Django and VueJS assume that you want to completely remove Django views and instead just use VueJS to serve the entire frontend. My usecase are usually different - I mainly find that I want to use VueJS sparingly to provide some enhancement to a particular …
  2. Using Django's GeneratedField

    Django (the python web framework) version 5.0, released in December 2023, introduced a new field type for models - the GeneratedField. This is potentially a very handy tool - it allows you to define fields that are based on other fields, but gives you the flexibility and speed that comes with …
  3. Blocking bots by UserAgent in dokku using nginx

    The problem A website I ran was being aggresively scraped by someone using a particular UserAgent string. It wasn't a normal search engine or similar bot (e.g. GoogleBot) so adding something to robots.txt wasn't going to work. This site is using dokku to serve the web app, dokku …
  4. Better horizontal bar charts with plotly

    I often find that horizontal bar charts are a great way of visualising comparisons between different categories. They're easy to understand and make, and provide a really simple way of displaying data. But I've found the default way of labelling them often doesn't make sense. Labels for the bars are …
  5. A map of World Cup stadia using wikidata

    Wikidata is an amazing project that aims to turn the unstructured text of Wikipedia into a database of facts and figures that allows you to go beyond just presenting a page about something to using data about it. I've been wanting to try out using it, and "SPARQL", the language …
  6. Acrostic football league tables

    Following from a question to the Guardian's "The Knowledge" column I've tried to find a longer acrostic than "TABLE". “Has there ever been a longer acrostic spelled out in a table than the oft-recurring ‘TABLE’ from the Premier League this season – or ‘LAWNS’ from League Two?” asks Marco Jackson. To …
  7. Development version of WordPress on Windows 10

    The problem: I need a local development version of WordPress to help test problems with the live site and also test updates. Previously I’ve used WAMP but that tends to get a bit messy, particularly on Windows 10. The solution: use docker to create a container with all the …