Monthly Archives: January 2017

January 2017 Round-up

January has decided to stop hanging around, so it must be time for the first monthly summary of the year.

Weight

OK, new year, new scale, new numbers which are much higher than those recorded last year. Which makes it more of a challenge, or something.

January 1: 237 pounds (16 stone 13 pounds, 107.5 kg)
January 31: 240.2 pounds (17 stone 2.2 pounds, 109 kg)

That’s a rise of 3.2 pounds (1.5kg), and I don’t think I can blame the scale, which has been showing quite believable daily variations, and not doing that weird thing of not settling down on a random number after a long bout of indecision.

Eating

Still doing that. And enjoying a bit of variety in my lunchtime sarnies.

Exercise

Singularly lacking in the motivation to get out and commit acts of photography at present, so not a lot of walking has happened.

Posting

The January total is a more or less average 40.

Stuff

Err, well, there’s some stuff, but I can’t really go into it yet…

Weight and Stuff Report – 31 January 2017

And it’s back up a bit today. Mutter, mutter, or something.

I’m a little disappointed that the Royal Mint didn’t use the historically preferred name of this chap. Actual diameter of coin is 38.61mm.

Bit of a Cnut

Bit of a Cnut

Camera: X-T2
Aperture: ƒ/2.4
Shutter speed: 1/25s
Focal length: 60mm
ISO: 1600
Taken: 31 January, 2017

Doctor Who: Good and bad news

First the good news: the new season of Doctor Who starts on Saturday 15 April (same date in the US, other countries will no doubt be confirmed later, if they haven’t been already.

This will be Peter Capaldi’s third season, and it’ll be sooooo good to have him back after the echoing void of 2016, when all we had was one (rather good, it has to be admitted) Christmas special.

Now, we already knew that 2107 would be Steven Moffat’s last year running the show, and that Chris Chibnall will be taking over in 2018. What we didn’t know until it was revealed last night was whether Peter Capaldi would be staying on – it had been reported that he’d been told the choice was his. And now we know: he’s leaving. This year’s Christmas episode will be his last[1].

I’ll be sad to see him go – I’ve enjoyed having a Doctor who’s older than me for a change, and enjoyed a Doctor with a nicely darker edge to him. Not to mention the guitar and the late lamented sonic shades.

But. With Peter leaving at the same time as Steven, this can only mean one thing:

Absolutely, dementedly, massively over the top season end and insane Christmas special

Yes, I think we can safely predict that star and showrunner are going to go out with a very big bang indeed, which means lots of fun stuff to look forward to this year.

It also means that new showrunner Chris Chibnall gets to do a clean start in much the same way Steven Moffat did in err, wait – what? – 2010? can it really be that long ago? Well, apparently so.

More in the link:

Peter Capaldi announces he will stand down as Doctor Who at the end of the year

[1] Subject to returns in any future multi-doctor stories, of course

Poseidon’s Wake – Alastair Reynolds

This is the conclusion of the trilogy that began with Blue Remembered Earth and continued with On the Steel Breeze. And like those books, it took me a while to get around to reading it, and a while to get through it.

I don’t know what it is about this series, but somehow the books failed to engage me in the way previous Reynolds books did. There’s the usual multiple threads gradually coming together thing, threats from incomprehensible alien technology, some engaging characters, even sentient talking elephants, all of which should add up to something I’d really enjoy, but somehow, this felt more like a chore – not the kind of thing to keep me reading far too late into the night, more the kind of thing I struggled to keep reading at all.

It’s probably just me.

Post editing fun and games (a cautionary tale)

In my post about the Amazon WordPress plugin, I mentioned that I’d been editing loads of posts. At first, this seemed quite simple. Click on the inserted image, then click the big friendly X to delete it, and insert the new link using the plugin.

But this didn’t quite work – after doing that, some posts still showed up as not being entirely served up as HTTPS. A quick look in the WordPress text editor[1] showed the problem. In a lot of posts, there was a bit of lurking HTML:

<img style="border: none !important; margin: 0px !important;" 
src="http://www.assoc-amazon.co.uk/e/ir?t=lesbessant&amp;amp; 
l=as2&amp;amp;o=2&amp;amp;a=B005CW11AO" alt="" width="1" height="1" border="0">

Yes, it’s an invisible 1 pixel tracking image. I’m not sure if it was left behind by the images, or the old iframes I used to use, or indeed both, but they had to go, which made the editing job that little bit more entertaining.

To track down all the posts containing these things, I did a search of the MySQL database where all this stuff lives using PHPMyAdmin, which makes it nice and easy to download a CSV file listing what you need to fiddle with.

Now when you edit a post, WordPress helpfully creates a revision – this is effectively a copy of the post that you can revert to in the event of a major ooopsie. But I’d been editing literally hundreds of posts (sometimes more than once, as on occasion I’d missed a link the first time), the database starts getting stuffed with loads and loads of extra records that don’t really serve any purpose. The easiest way to get rid of these is with a quick bit of SQL:

DELETE FROM wp_posts WHERE post_type&nbsp;= "revision"

Now you do need to be careful with SQL – if you get the syntax wrong and accidentally tell it to delete a whole table, that’s exactly what it will do, and err, I do hope you’ve got a good backup, because there isn’t an easy undo option. But hey, if you read what you’ve typed, and always do a “select” before you do an undo (by which I mean do a query that just lists the affected records rather than doing something with them, you can check the output, then when you’re quite sure, you can edit the query and really delete the unwanted data.

Having done all that, I wanted to check for any remaining records containing raw links to Amazon, in case they were pulling in any non-secure items. So I carefully edited my last query to search for the text in question, and you can see where this is going, can’t you? Instead of running

SELECT * FROM wp_posts WHERE wp_content LIKE "%www.amazon.co.uk%"

 

I managed to run

DELETE FROM wp_posts WHERE wp_content LIKE "%www.amazon.co.uk%"

which resulted in a friendly response to the effect that six records had been deleted. Oh bother.

Now, given the enormous amount of rubbish on this site, you might think that the loss of six random posts wouldn’t be all that important, but I’m far too obsessive for that. I wanted my missing posts back. After a bit of muttering and experimenting, I came up with a solution. I created a new temporary database and restored the last backup of the live database to that. I did mention that having good backups is strongly advised, didn’t I?

Now, armed with a copy of my database, I did my search again (being very careful to make sure I was SELECTING and not DELETING this time. This returned rather more than the six records I was hoping for, as it also included all the posts I’d edited earlier in the day that included those annoying hidden images. But it was relatively easy to check each record, see if there was a post matching it on the actual site, then create new posts from the information in the database – pretty much a copy and paste, with minor edits for some characters that get stored with odd symbols.

And to make sure I’d caught them all, I did the same search (being very careful to SEARCH not DELETE) on the live database, which found the expected six records.

Now if it had been a lot more records, this wouldn’t have been a good plan. I’d probably have restored from backup and redone all the work I’d done that day, which would have been annoying.

So, once again, let me remind everyone (especially me):

Always SELECT before you DELETE. And check that. Twice.

[1] Funny – when I started blogging, this was the only kind of editor I’d use, but now I rarely visit it.

 

Weight and Stuff Report – 30 January 2017

Down a bit more today, which involved a fun-packed[1] trip to Leeds.

Here’s a bit of Gateshead public art:

Shiny!

Shiny!

Camera: X70
Aperture: ƒ/5.6
Shutter speed: 1/450s
Focal length: 18.5mm
ISO: 200
Taken: 1 January, 2017
Location: 54° 57.7563′ 0″ N 1° 36.1133′ 0″ W

[1] Well, not really

Weight and Stuff Report – 29 January 2017

Down again today, on what’s turned out to be another physically inactive Sunday. Though I have been very busy editing thingies.

Here’s another Tynemouth view

Tynemouth Priory

Tynemouth Priory

Camera: X-T2
Aperture: ƒ/5
Shutter speed: 1/1250s
Focal length: 52mm
ISO: 200
Taken: 14 January, 2017

Amazon Associates Link Builder WordPress Plugin

In the very nearly thirteen years I’ve been running this site, I’ve always included links to products on the Amazon UK site. In the very early days, when I was using Moveable Type, I used a plugin to insert things, and after moving to WordPress, I tried a few plugins, but none were really what I needed.

Amazon made it relatively easy to add links from their site, especially when they added the useful toolbar to their site when you’re logged in with an Amazon Associates account. For a while, I used their iframe thingies, but found that these were being eaten by AdBlock, so I reverted to the simpler “insert an image” version. This looked pretty good, but had the drawback of not actually drawing attention to the fact that these were, in fact, convenient links allowing visitors to buy things[1].  They also had the drawback of needing to insert a mind-boggling mess of code into my posts. Something like this:

<a href="http://www.amazon.co.uk/gp/product/B00550NYDU/ref=as_li_ss_il?ie=UTF8&amp;camp=1634&amp;
creative=19450&amp;creativeASIN=B00550NYDU&amp;linkCode=as2&amp;tag=lesbessant">
<img class="alignleft" style="border: 0px;" src="http://ws.assoc-amazon.co.uk/widgets/q?_encoding=UTF8&amp;
ASIN=B00550NYDU&amp;Format=_SL160_&amp;ID=AsinImage&amp;MarketPlace=GB&amp;ServiceVersion=20070822&amp;
WS=1&amp;tag=lesbessant" alt="" width="105" height="160" border="0" /></a>
<img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.co.uk/e/ir?t=lesbessant&amp;
l=as2&amp;o=2&amp;a=B00550NYDU" alt="" width="1" height="1" border="0" />

Another issue was that the older links were being served up as HTTP rather than HTTPS, meaning that after I secured the site, loads of pages were showing without that nice little padlock thingy.

So, I was quite happy to see Amazon’s official WordPress plugin when it was released a while ago. This adds a search box into the post editing page which lets you find the item you want to link to, then insert a shortcode, which is nicely legible, rather than a mess of HTML that had to be pasted into the Text editor.

There are a variety of links available, such as single product links, grids and a scrolling carousel style. Not only that, but you can create copies of the standard templates with your own adjustments. And to make it more friendly, you can set one of your personal templates as the default – I’ve done this so that if I don’t pick something else, my slightly tweaked version of the single product link will be used.

Over the last couple of weeks, I’ve had the fun job of going back through all the old posts with Amazon links and inserting new ones. Well, apart from those linking to products that don’t exist any more – I’ve removed those links.

There is a slight drawback – to use the plugin, you have to obtain an API key from Amazon. This is a process that is perhaps only mildly complicated for the software developers who are the usual users of such things, but a bit nasty for average users. It’s also important not to lose your secret key (though if you do, you can get another API key reasonably easily).

Good stuff, makes things easier.

Amazon Associates Link Builder — WordPress Plugins

[1] And earn me a few pennies in commission

Weight and Stuff Report – 28 January 2017

Hmmm, up a bit today.

I managed to get the shopping done early today, put the washing on early, and then had lunch with an old friend, which may have involved a drink or two. Back home by 4pm, though.

Here’s another view from Tynemouth:

Watch house

Watch house

Camera: X-T2
Aperture: ƒ/2.8
Shutter speed: 1/5000s
Focal length: 140mm
ISO: 200
Taken: 14 January, 2017