Oct 102019
 

(Or, as it's commonly known, yak shaving.)

In this case, to be able to use a Docker image, the easy way to install software (I'm told). But, of course, technology has a habit of throwing curve balls. Or, as here, demanding items that you may not have.

Step One: Checking the requirements for Docker reveals that, if you're using Windows, you need a Windows 10 Pro installation, not Windows 10 Home. There is, however, a Docker Toolbox option for Windows 10 Home. The requirement for Docker Toolbox includes virtualization being enabled. (There's a link to a tool to check this.) My Windows PC, a couple of years old, has that virtualization, but it's disabled.

The wording on the Docker Toolbox page makes it sound like using the full Docker Desktop would be preferable, so I decided to check out that option. Microsoft does make it easy to spend the money to upgrade to Windows 10 Pro (there's a link in the Settings app under About with the word "Upgrade"), but the requirements for Docker Desktop include support for something called "Second Level Address Translation (SLAT)", which seems to be called something different anywhere you might want to check it. In the Windows system information (systeminfo) it's called Hyper-V, for example, and checking it reveals that in my system it's supported, but not enabled.

Step two: Enable virtualization; this requires a reboot and change to the system BIOS settings. This page on how to access the BIOS on Windows 10 was useful. Once enabled, everything seems good to go, and from there I decided to try out the toolbox first, and think about the larger upgrade later. I'm not crazy about potentially breaking working systems if I can avoid it, and past Windows upgrades have made me cautious.

Step three: Install Docker Toolbox, which went smoothly enough. But the program I was trying to run had issues with port mapping. A possible cause is something in the Docker system not talking to the Windows system in the expected way, so it looks like I will need the full Docker Desktop after all. Which means upgrading Windows.

Step four: Delete Docker Toolbox from the system to make sure there are no weird interactions.

Step five: Sign up for a Microsoft account, so that I can buy Windows 10 Pro.

Step six: Install Windows 10 Pro as an upgrade to Windows 10 Home. This went much faster than I expected and apparently didn't break anything either.

Step seven: Install Docker Desktop and repeat all the software-dependent installation steps.

Success! The port mapping works, and the required software installed.

Technology is great, except when it isn't. But Windows 10 is much better than previous versions of Windows.

Feb 042018
 

Posted in case it helps someone else.

One of my website clients asked for help with one of their Mac OS X laptops, which had suddenly stopped connecting to their wifi network. The wifi connection seemed to be demanding a WPA enterprise username and password, despite being set up as WPA2 personal, which only needs a password.

In the end, the cause was a combination of a new modem/router from the cable company, and an old version of Mac OS X (10.7.5). I had to go to the app store to download El Capitan, since you can’t update from 10.7.5 to High Sierra directly, but after installing it the laptop could connect to the WPA2 personal wifi network on the new modem/router. It’s now been updated to High Sierra, and the company reminded to install the updates they get a little more regularly…

Jul 232017
 

For a while there XML.com didn’t handle tags on submitted news items very well. If a tag was included that was in a different case to an existing tag, the preview and publish would result in a 500 server error. Fortunately this was something that wasn’t visible to the outside world, but annoying nonetheless.

Wagtail allows case-insensitive tags, and I had already turned that on (it would be confusing to have searches for the tags “XSLT” and “xslt” return different results, for example). Articles and news items submitted using the standard interface behaved properly, it was just the news items submitted by people without logins on the system that didn’t.

It turns out that the problem lay in the way I called the get_or_create() method, which is used to look up the tags in the database and then create them if they don’t exist. In my code, that looked like this:

tag, create = Tag.objects.get_or_create(name=tag_name)

By default, this is a case-sensitive method (as it should be, for the general case). To make the lookup case-insensitive, you use name__iexact instead of name. The next problem I found was that no tags were being created if the tag didn’t already exist in the database. To create the tag, if you’re using name__iexact instead of name for the tag lookup, you also need to give the get_or_create() method a defaults parameter to use when creating the tag. Now that line looks like this:

tag, create = Tag.objects.get_or_create(defaults={'name': tag_name},
                                        name__iexact=tag_name)

and it all works the way it’s meant to.

Jul 032017
 

My now 11-year-old daughter loves books and reading so I asked her to write a book review for a couple of her favourites. This one is for The Wild Robot, by Peter Brown. She gave this book ★★★★★ out of 5.

“The Wild Robot” is a book about a single robot surviving in the wild with lots of animals. She adopted her own baby animal, learned to speak the animals’ languages, and so much more! I like this book because the author describes everything in a new way. It’s one of those happy but sad books, and I had tears in my eyes at the end. Highly recommended!

Jul 032017
 

In Canada, where I live, the voting system for the parliaments is the easy to understand, but blunt, first past the post (FPTP) system (also called plurality voting). The person who wins the most votes (a plurality) wins the seat, whether they get over 50% or under 30%. I believe that it’s time we had a system that gives more people a more nuanced say in the government they get; tactical voting of various forms in a FPTP system only goes so far. For my own benefit I’ve written up the voting systems of 3 other countries in which I’ve lived. I don’t have a firm opinion on which one I prefer (yet).

Germany

At the Federal level in Germany, the voting system is a version of a mixed-member proportional system: voters get two votes. One is for a direct candidate (approximately half the seats), and works by the plurality (FPTP) system. The other is where the voter votes for a party. Each party has a list, and the appropriate number from each party list is deemed elected, depending on the number of votes the party got. There is a threshold for the list votes; parties have to get over 5% of the vote to get any seats via the second (list) vote, unless more than three direct candidates from that party are elected.

This system was set up to balance many aims. Among them are the principle of equal votes (each vote must have equal weight), discourage small parties while allowing them, and encourage balance between various political views. It tends to lead to coalition governments, and is good for finding consensus.

Australia

Australia uses preferential, or ranked, voting systems. The voter ranks the candidates in order of preference. If one candidate gets 50% + 1 (or more) first preference votes, they are elected. If not, the candidate who received the fewest first preference votes is eliminated from the list, and their second preferences are distributed. This process continues until one candidate does have 50% + 1 or more votes. There’s a variation for the Senate that I’m not going into.

Ranked voting gives people a chance to vote for a candidate they know won’t win, and give the second preference to a mainstream candidate, which makes it better than FPTP tactical voting. One downside is that you have to rank all candidates in order, and it is quite possible to miss a number, or make some other mistake. There are some people who number from 1 down the page, so the ballot has to be designed to take that ‘donkey vote’ into account.

New Zealand

New Zealand uses a different version of mixed-member proportional representation to Germany. (No, I’m not going into detail on the precise differences.) Each voter has two votes: one for a direct candidate, and one for a party. The party vote determines the overall number of seats each party is entitled to. There is a threshold, as for Germany, of 5% for the party vote, or one direct candidate elected.

There are also a certain number of seats reserved for the Māori electorate; those use the same voting system.

Personally, I think any of these systems would be better than the current FPTP system we have.

Apr 082017
 

If you have MathML on your WordPress site, using the Mathjax system to show it, then you need to know that Mathjax is shutting down the CDN as of April 30, 2017. If, like me, you use the MathJax-LaTeX plugin, the solution is easy.

Go to the Plugins – Settings – MathJax-LaTeX page. Uncheck the “Use MathJax CDN Service?” checkbox, and add https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js to the “Custom MathJax location?” text field. You can, of course, also download the MathJax scripts and install locally, but I prefer to use a CDN.

Save the changes, and you’re all set! Unfortunately there isn’t an equivalent of the MathJax ‘latest’ for the scripts, so every now and then you’ll need to update the location, but other than that there should be no differences.

/* ]]> */