from the album Machinarium Soundtrack
from the album Machinarium Soundtrack
Found a weird WordPress bug today. I exported ALL from my old WP hosted blog and imported everything here. It all went fine except all the Post counts for imported Tags in the Tags screen were zero. I found this old post with a similar problem but no solution.
I figured it just needed a nudge to force it to recount the Tags, so simply did a Bulk Edit and added a dummy tag to all my Posts. Checked the Tags and bingo! Then I just deleted the dummy tag.
Recently, I have been thinking about website accessibility (a11y) even more than usual. I always have accessibility in mind but I only occasionally focus on it specifically. For example, a few months ago I reviewed our use of icon images on the website and hid them from screen readers.
On 23rd September 2020 all public websites in the UK will need to meet certain accessibility requirements and provide an accessibility statement. Over the next 6 months I’ll be focusing on a few specific areas of accessibility. My main concerns with our site, as it currently stands, are URL formatting and colour contrast.
Our site runs on WordPress and I am huge opponent of plugin bloat. The more plugins you have, the more potential attack vectors there are. I see countless 404 errors from malware scripts looking for (presumably) compromised plugin files. On that basis, anything I can do myself, I want to do myself. Therefore, I am definitely not a fan of these huge accessibility plugins that promise everything and the kitchen sink.
It’s also important to be aware that web browsers will take accessibility hints from the operating system. Remember that ,before a user with a visual impairment arrives at your website, they must already have their OS and browser configured in a way that facilitates that. The first step is to respect your users’ existing configurations.
One of the lowest hanging fruit, in this regard, is dark mode. Until recently, dark mode was only found in some mobile apps, usually those for reading. When everyone started freaking out about “blue light,” night mode – warmer, less blue colorisation – was introduced at the OS level. Now dark mode is also readily available at the OS level too. I personally prefer dark mode on my portable devices and dark mode is an easy win for users with light sensitivity.
I’ve just completed a fairly length “feature sprint” where I added a whole bunch of new functionality to the site. While testing it on my iOS device I decided to switch on Dark Mode in Firefox OS. I was pleasantly surprised! Overall, it looked OK.
The immediate and obvious problem was our logo. Obviously our logo was designed with print in mind (we didn’t design it) so it looks best on a light background. In dark mode I could barely see it on the page.
Fortunately we have been supplied with “rev” versions that work on dark backgrounds too. With that hurdle cleared, how to find out when we’re in dark mode? Fortunately, “the internet” is way ahead of me, and
prefers-color-scheme already exists.
prefers-color-scheme is a CSS media feature, so pretty easy to implement. @media/prefers-color-scheme">This is a good introduction.
So, I added an “alternate logo” to our WordPress theme, added a new
div containing the new brand image (our theme is bootstrap based), and set up the CSS media queries to alter the
display property (this is not usually good practice).
I work with Firefox, and (to my knowledge) there is no dark mode on desktop without a plugin, so I went to my iOS device. I opened the page in Firefox and switched to dark mode and “boom,” there was my alt logo. Awesome. I turned off dark mode and… the “normal” logo didn’t come back. Huh. Obviously I started checking the code. It looked fine.
I decide to try and check it in Windows 10. Windows has had a “proper” dark mode since 2018. It worked fine. As I turned dark mode on and off in the Settings, Firefox swapped the logo back and forth. Perfect. So, why wasn’t it working on iOS?
Well, all the evidence was right in front of me.
prefers-color-scheme gets the color-scheme from the OS. On my iOS device, I had the OS itself in dark mode already when I tested the new logo. This is what actually caused the alternate logo to appear. Dark mode in Firefox itself can’t “toggle”
prefers-color-scheme. Toggling the iOS dark mode on an off worked exactly as in Windows 10.
This leaves a horribly fractured landscape. The Firefox iOS browser, has a dark mode that swaps out the pallette of the page for darker colours, but respects (as it should) the iOS color scheme preference. A user that has dark mode enabled in one place but not the other is going to have a poor experience.
This makes Firefox’s built-in dark mode next to useless. I’ll need to code up alternate CSS rules that respect
Dark mode, not such a low hanging fruit after all.
You’ve probably all seen this joke before. This tweet is the earliest mention I can find but please do correct me in the comments if you have an original source!
He’s making a list
And checking it twice
Gonna find out who’s naughty & nice
Santa Claus is… in breach of the Data Protection Act (1998)
— Larry the Cat (@Number10cat) December 22, 2016
There have been a few “take downs” of this joke but @joelgsamuel/santa-claus-the-general-data-protection-regulation-gdpr-57f1571e7de8" target="_blank" rel="noopener">this one is probably the most thorough.
My take is that whether you are naughty or nice might be considered special category data and he needs specific consent to process that. He’s presumably collecting the naughty/nice data from elsewhere too, and doesn’t appear to notify anyone that he has obtained it. And I am sure he is making decisions using automated processing to which you haven’t been able to object.
But that is not why I am here today.
I am not a data protection “expert” but I reckon I know more than most. In the UK, the Information Commissioners Office (ICO) is responsible for enforcing the data protection rules. However, there must be thousands of insignificant breaches of the DPA everyday that the ICO will never hear about, let alone touch.
Personally, it makes me VERY cross when people misuse my data. I can’t take any legal action against them but I can name and shame them. So I am going to.
We have a lot of side responsibilities at the small NFP I work for. You know when you’re the only person that is good at doing something so you do it even if it’s not technically your job? That kind of thing.
I do a lot of the maintenance and “fiddling” with our WordPress website. I quite like it. Recently I have hit upon an extremely therapeutic activity: managed 404s.
We have a plugin to manage redirections for missing pages. I don’t exactly want to get to zero 404s but I do want to catch and redirect those I can to meaningful places. Even if it is a 410 response.
The really fun part is the plugin supports regular expressions. When I first started working with the plugin my efforts were limited to basic wildcard matches. Now I have even started with optional groups and substitutions. I’m by no means an expert but it is a great learning enviroment.
Today I have come up with a solution I am quite proud of. For some reason, our developer set the versions on our CSS and JS files to randomise occasionally. I assume this is for some sort of caching purposes. Anyway, this can generate some harmless 404s that I don’t want to be logged.
Using the regular expression 101 website I created this solution. Not much point explaining it here as the site does that very well. Any 404 that matches this pattern is excluded from the 404 logs, which helps me spot meaningful 404s much quicker.
Today I wrote my first PHP code for deployment. I’m super proud! I need to caveat that, though.
When I say “wrote” I mean I found some code online that did half of what I wanted to do. Then I found some code that did the other half of what I wanted to do. Then I put them together. Then I looked at existing code to see how my code needed to work. Once that was working, I adapted it to include a feature that no-one else seemed to have thought of. And, of course, I tested it all in production.
What is it? Just a few lines to add images to an RSS feed generated by WordPress. Already implemented by many a plugin but I like do some things my own way.
I discovered Linux in about 2001. Weirdly, I was in Tanzania at the time and didn’t have a PC of my own to install it on. That had to wait until 2003, when, as a postgrad on a tight budget, I bought a cheap, ex-corporate Dell Latitude laptop. It had one USB 1.0 port and no built-in ethernet. Yes, it was a longtime ago.
A truly amazing range of laptops, they had a modular drive system, which meant I was able to get a zip drive relatively easily. And that was important because at the time you needed a SCSI card on a desktop to connect to most Zip drives. And I needed Zip for my GIS course. Big files.
Laptops, at that time, also relied heavily on PCMCIA cards for commuincations, be that 56k fax/modems, ethernet or, gasp, wireless.
I imagine most people have their “hardware geek” phase a little earlier than I did. Over the course of 2003/4 I had a fantastic time shopping on eBay for bargain laptop drive modules and various comms cards. They all had to be Linux compatible so lots of careful research was required.
Fast forward to today. Well, I still have loads of this stuff, including the PCMCIA cards shown. I haven’t had a laptop that would support them for about two years. Why have a kept them?
Mainly, I convinced myself that they had some value to someone. Until recently, I had no idea why. Then I started thinking about why I was finding it so hard to get rid of them.
I realised that I felt that, somewhere, there was someone that would get as much pleasure from fiddling with this tech as I did in 2003. At the very least I thought by keeping them I might at some time recapture that “golden” time in my life.
In reality, these things are technologically worthless and ten a penny on eBay and my personal circumstances have changed beyond recognition. I barely have time to write this blog, let alone tinker with ancient technology for hours on end. Also, even if I had the time and the hardware to fettle with, I don’t know if I’d even enjoy it! I have moved on in so many ways.
So, now I know why they were important to me, I do need to let them go. They’re a physical reminder of time that can’t be recaptured and shouldn’t be. It’s better to remember that time fondly, than imagine it might some day come back.
And, besides, if such hazy days did return, in say, 25 years, they’ll be way better things to tinker with!
My wife and I have been working hard to de-clutter our house. In lay-person’s terms, that means “getting rid of stuff we don’t need.” A very large part of this process has been inspired by The Minimalists and their podcast. It was my wife that first stumbled across these guys and I genuinely think they have changed both of our attitudes to “stuff”.
When we moved to our current home we bought a whole load of stuff that, when we came to unpacking, we just didn’t know what to do with. It all just sat in the largest spare bedroom. There was a lot of it. This is surprising considering we came from a 1.5 bed flat in London. To this day I have no idea where we kept it all.
The majority of my stuff falls into two clear categories. One is stuff I kept “just in case.” The second is sentimental knickknacks. So, things that I might one day need or things that I might one day want to look back at. Will that one day ever come?
On the first category, The Minimalists have a simple rule. If it can be replaced for less than $20 in less than 20 minutes, get rid of it. This might seem like a horrible path to disposable consumerism but really it’s the opposite. Once you have this maxim fixed in mind, it stops you buying things “just in case” too.
By far the biggest volume of “just in case” stuff I have is PC hardware and equipment. Some of the stuff is at least 15 years old and so completely obsolete but I’m having hard time letting go of it. This has been really frustrating. I look at it, I know it’s basically junk, but I just can’t bring myself to do it.
So, rather than set myself the goal of getting rid of it I’ve instead decided to focus on WHY I don’t want to get rid. I’ll use this blog to look at just a few of the items I find it hard to let go of and try to capture why it’s important to me. With that done, I hope I’ll then take the next step.
I’ve never done much work with groups in PivotTables but I have used PivotTables a lot. One thing I like do is make a simple PivotTable and chart and copy this sheet multiple times, editing as appropriate. I then link charts in Word to the data in Excel. This makes it easy to go back and make modifications
I’ve been working on a sheet this morning and, to my horror, have discovered that my previous efforts are being altered as I update subsequent efforts. It’s a bit like that scene in Labyrinth where Sarah discovers her lipstick marks have been changed. Of course, when you are working on lots of charts your memory plays tricks on you so I had to actually CHECK that this was really happening.
It really was.
A quick Google reveals that:
To help improve performance and reduce the size of your workbook, Excel automatically shares the PivotTable data cache between two or more PivotTable reports that are based on the same cell range or data connection
Usually this isn’t a problem unless you use, for example, grouping. In that case it does the grouping in the shared cache, thereby updating all your previous tables and charts. “Your mother is a fragging aardvark,” indeed!
This article explains how to unshare the cache but I don’t want a separate cache for each chart so I’ll settle for unlinking and embedding the charts in Word instead.