Skip to main content
 

WordPress Canonical URLs for Category/PostName Permalinks

When the permalink format is set to %category%/%postname%/ then a post is available under category/postname links for all categories, as well as under all parent/child/postname links.

If you use Yoast SEO and have set a primary category, that  becomes the canonical URL that's used for SEO. If you don't then the postname for whatever category has a lower ID (was created first) becomes the canonical URL.

 

What is the meaning of a site's Last Updated property?

When running a WordPress multisite, in the site directory each site has a Last Updated property. I previously incorrectly assumed this reflected  when the site's metadata changed, for example the site's attributes. However, archiving and deactivating a site does not change the Last Updated value, so what does it do in WordPress 5.2.1?

As usual the best place to look is the WordPress codebase. It turns out that, on a multisite, this value is updated whenever a post is updated or deleted. It reflects the last content update, not the site's metadata.

By inspecting the html and looking up the property name, we find that the function that updates this is called wpmu_update_blogs_date and there is an action hook wpmu_blog_updated that receives the site_id variable. This function can be called whenever we want to update the value. It isn't used anywhere else.

If we're looking to update this date whenever the site's status changes, then via the same process it appears that he actions to hook into site attribute updates are in wp_maybe_transition_site_statuses_on_update so one could write a quick mu-plugin that updates the Last Updated property whenever these fire.

 

Where is the tin-foil-hat emoji?

 

I think I finally figured out how to use Apple News: subscribe to topics; unsubscribe from all publications. I use an RSS reader to follow sites.

 

The subjective safety of a place is expressed well by its reaction to people loitering.

 

Keyboard lag in SecondLife was caused by Popclip. Zapp!

 

Safari Web Content's high CPU usage was caused the Pocket extension.. Maybe downloading articles in the background? Zapp!

 

End of Lives

Really handy reference site for many products. Remember that system provided packages are supported with backported security fixes in most cases. 

 

Fix for Google Chrome Bouncing Forever in the macOS Dock

I had the issue where it was not possible to launch Google Chrome. It would bounce in the dock forever without actually starting. Trashing the application and associated files (with Hazel) did not work.

Other people had the same problem:

The following instructions will help get Chrome back up and running.

The Fix

The solution to this issue is to remove all application settings. Start a terminal:

cd "/Users/`whoami`/Library/Application Support/Google"
mv Chrome Chrome.old
mkdir Chrome
open "/Users/`whoami`/Library/Application Support/Google"

Now start Chrome. If it starts correctly, trash the Chrome.old folder. 

Restoring the folder

If the fix did not work in your case, use the following commands to restore the original folder.

rm -rf Chrome
mv Chrome.old Chrome

Good luck!

 

Short form content promotes more of an emotional response, long form content a nuanced response. People should write more long form content, so I will try to blog more going forward.

 

Currently reading "Rapid Development" by Steve McConnell.

 

Password reset forms where paste is disabled. Trying to keep the hackers in ye?

 

Falsehoods Programmers Believe About Names

So, as a public service, I’m going to list assumptions your systems probably make about names.  All of these assumptions are wrong.  Try to make less of them next time you write a system which touches names.

One of my favourite programming articles of all time.

 

Still thinking about how to solve the “posting a digest of interesting links today” problem.. In the meantime I'll post them on my website, not showing on the homepage but under https://vandragt.com/content/bookmarkedpages/

 

Opinion pieces used to be more insightful than the news. Now they’re just more ridiculous. Research the subject instead, you will be better informed than the people writing these articles.

 

Countdown - a bash countdown timer

I was looking for a tea timer countdown but quickly realised I might as well use a countdown script for this. I based my script on the linked script but added a customizable notification at the end

$ nano ~/bin/countdown
#!/bin/bash
# v2 - 2019-05-01
secs=$1
msg=${2:-$1 seconds passed.}
while [ $secs -gt 0 ]; do
echo -ne "$secs\033[0K\r"
sleep 1
: $((secs--))
done
notify-send 'Countdown Finished' "$msg"

$ chmod +x ~/bin/countdown
$ countdown 180 "Tea is ready."

 

Our society is sleep deprived

“Sleep loss will leak down into every nook and cranny of your physiology,” he said. “Sleep, unfortunately, is not an optional lifestyle luxury. Sleep is a nonnegotiable biological necessity. It is your life support system.”

I'm looking forward to reading Matthew Walker's book on the topic.

 

macOS doesn't use a swap file when running from an external SSD

So I was seeing graphical glitches, freezes and Activity Monitor indicated memory pressure. Turns out macOS doesn't mount a swap file, as I am running from an external SSD install.

This is easily fixed. I can't believe it is a problem though.

By the way I had to change the end of line 4 (because the command in the Ask Different answer returned multiple results) to:

VM_VOLUME=$(/usr/sbin/diskutil list | grep "VM" | awk 'NR==1{print $7;exit }')

It's easy to add the launch item using Lingon X and start it with sudo ./mountvm.sh for the current session.

 

DarwinMailApp gives us all a lesson in customer service in this thread: https://news.ycombinator.com/item?id=19705440 His tone is exactly right, and encourages more follow-ups as a result. Well done!

 

Stop OpenPGP passphrase prompting on login

As a security conscious person I setup my OpenPGP keys with a passphrase, however on OpenSUSE Leap 15 this causes a login prompt to appear that delays the network connection from initiating. The same issue also blocks software updates and means a browser restart due to DNS cache stopping connections to websites. This is fairly annoying.

It turns out that this can be fixed by sharing the network connection via Connections > open the connection > General Configuration > All users may connect to this network. This causes NetworkManager to cache the required  authorization tokens (this is my understanding).

Note that other software such as Kontact might set a daemon to startup by default, causing the same prompt. This can be unticked in its settings.

If everything else fails, then you could remove the passphrase for the PGP key but this is not recommended as this means someone can take on your identity should your key be exposed for any reason.