Crayon Syntax Highlighter broken on WordPress on PHP 7.3

When I came to post the previous post on my blog, I found that my host’s recent upgrade to PHP 7.3 broke what seemed like everything. Turns out it’s just one plugin – Crayon Syntax Highlighter, which is really useful for styling code in posts.

Unfortunately, the developer hasn’t updated his plugin in three years or so, and it seems to be changes to how regex is used that has broken it. You may get the same error I did: “PHP Warning: preg_replace(): Compilation failed: invalid range in character class”.

The quick fix is bin the plugin, but obviously I’d still like to use it. Thankfully, some other people have taken it upon themselves to release a fixed version, which you can get from here: https://github.com/Crunchify/crayon-syntax-highlighter/releases

Deactivate the current Crayon plugin (don’t delete it as you’ll have to configure everything again!), install this one (manually – upload the zip from that link to your site), and enable it. Once confirmed working, you can delete the old version of the plugin.

Resizing a Linux partition running under Hyper-V

We’ve all been there. Setting up a new machine and giving it a 20GB hard drive because it’ll literally only need 4GB ever and then, two years later, it’s somehow full and won’t boot. Unlike Windows based guests on Hyper-V, which can have their drives resized easily by the Hyper-V tools, Linux guests are a little different.

You can certainly resize the disk image in the same way (turn the VM off, choose Edit Disk, and then Expand), but Linux doesn’t see the extra space. To make things worse, if – like me – you set the VM up originally as a Generation 2 machine (with all the UEFI bells and whistles) then some Linux tools and rescue images like gparted and fdisk don’t work properly (with boot errors like ” efi: EFI_MEMMAP is not enabled”). Plus my machine wouldn’t boot to install or run them because, as I said, it was full.

Anyway, here’s how I resized it. This all relates to a Debian 9 guest on Hyper-V on a Windows Server 2016 machine, but the process should be the same for most Linux variants.

Firstly, after turning the VM off, I resized the image in the Hyper-V Manager as above – using Edit Disk.

Then, I made a copy of the disk just in case. Turned out this wasn’t necessary, but better to be safe.

So, since I couldn’t use the current VM to fix my drive (Gen 2, tools don’t work, won’t boot), I set up a new temporary VM in Hyper-V, making sure I chose Gen 1 this time. I added the hard drive image from the real VM as the drive, and then set it to boot from an ISO of gparted. This allowed me to access the drive and resize the partitions. Before I did that, however, gparted had detected a change in drive size and asked if I wanted to fix it – I said yes.

Since I had three partitions (/dev/sda1 to sda3) but it was the second (sda2) that needed expanding, I had to move sda3 to the end of the drive first. It’s all pretty straightforward in gparted – just remember to actually apply your changes when you’re done as otherwise nothing happens!

This temporary VM was then turned off, the drive image was reattached to the original VM and… it didn’t work.

Hyper-V threw immediately threw up a permissions error, as it couldn’t access the disk image any more. ” An error occurred while attempting to start the selected virtual machine(s)”, and this:

Hyper-V Virtual Machine Management service Account does not have sufficient privilege to open attachment 'D:\PathToImage\DriveName.vhdx'. Error: 'General access denied error' (0x80070005). (Virtual machine ID xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).

Luckily, this is fixable. Make a note of the Virtual Machine ID in the error, and then run this command in an admin console substituting the ID for all the Xs and the actual full path to the image:

icacls "D:\PathToImage\DriveName.vhdx" /grant "NT VIRTUAL MACHINE\xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx":(F) 

With this done, I could finally boot my original virtual machine successfully. In my case, it did a quick disk check itself automatically, and then everything was working normally only I’ve a lot more disk space to play with!

Veeam VeeamZip “Failed to process [isFileExists]” error when backing up Hyper-V

When backing up to a Synology NAS using VeeamZIP via PowerShell, the job was failing with an “isFileExists” error. Here’s the solution.

I have a Windows Server 2016 server with a number of Hyper-V virtual machines running on it, and Windows Server Backup wasn’t backing them up for reasons known only to Microsoft. Various forums and reports on Microsoft’s Technet suggest there’s a fix needed for Server 2016 which, two years after first complaints, still hasn’t been forthcoming. Everywhere seemed to suggest using something like Veeam Backup & Replication instead, so I installed that.

I only need a simple “backup the VM periodically” function, and Veeam B&R has this option in the free version in the form of VeeamZIP. This is all well and good, but it’s ad-hoc backup only – no scheduling unless you fork out for the paid versions. Luckily, Veeam themselves have a PowerShell script that you can schedule, which makes use of the Start-VBRZip command.

Sadly, it wouldn’t work for me, and it turns out it’s because I’m backing up to a Synology NAS.

If you look at the script, you’ll see this:

If I set $Directory to a location local to the server (e.g. “d:\”) then it works. Set it to the NAS (e.g. “\\synonas\share\backups”) and I get the error “Failed to process [isFileExists]”.

Looking on the NAS, the logs say the server connected – with working credentials – but no files are created. After the usual head-scratching and log searching, I realised something: The script is running with the correct credentials, but the Start-VBRZip command in it is not.

On the PowerShell command line itself, you can specify which credentials Start-VBRZip can use with the -NetworkCredentials parameter. You can read more about that here.  However, there are two steps needed to get that working:

  1. Create a set of stored credentials in the Veeam Backup & Replication GUI, using the “Manage Credentials” option.
  2. Retrieve that in the form of an array in PowerShell and pass it to Start-VBRZip.

The second step is necessary because the parameter expects an array not a string. If you have a set of credentials for (e.g.) “DOMAIN\Admin” stored in Veeam B&R, you can’t just pass -NetworkCredentials “DOMAIN\Admin”.

What you can do, however, is extract the array necessary with this command:

and then pass $cred to Start-VBRZip’s -NetworkCredentials parameter.

Only there’s another snag: the provided PowerShell script doesn’t do anything with credentials as the parameter is missing. We can fix that by adding it ourselves.

In the script, there’s a line that says “DO NOT MODIFY PAST THIS LINE”. To hell with that! Immediately after the “Ansp VeeamPSSnapin” line, add

then rewrite these lines:

to include the missing parameter:

Save the file, add it to Task Scheduler as per the Veeam instructions, and it should now work!

Was I ready to go Mac only?

Ten whole Earth years ago, on this very blog, I asked myself the question: Am I ready to go Mac only? Today, I finally answer it.

Back then, I was certainly ready to try a Mac-only lifestyle. I already owned two, but my main computer was still a PC. I looked at the things I used regularly on it that might cause an issue if I were to move over to the Apple Ecosystem completely, and eventually took the plunge and spent an absurd amount of money on a shiny new iMac.

A shiny new iMac which is still going strong today, albeit at someone else’s house as I bought a replacement a couple of years ago. Yep, I’m all Apple now.

Looking back at my original post, I thought it interesting to see how I solved the issues I predicted facing, so I’ve listed them:

Hardware

I had a Dell printer/scanner at the time, which wouldn’t work on a Mac. Or so I thought! It turned out there was a way of making it work using a Lexmark driver. Unfortunately (or fortuitously?) it actually died soon afterwards, and I bought a very similar but supported Canon device, which is still working now.

I also had a Samsung laser printer, which I gave away. It turns out I rarely needed to laser print after all, as I never replaced it. In fact, I don’t do much printing of any kind, and the Canon printer/scanner is mainly for scanning.

At the time, my phone was a T-Mobile Vario II, running Windows Mobile or CE or something which I managed to get working with the Mac (to sync various things) with some cheap third-party software. I replaced it with a Vario III, which synced in the same way, but ultimately moved to an iPhone 3GS and I’ve been iPhone’d up since. So that inconvenience went away.

The last concerns I have were with my Game Boy and Game Boy Advance homebrew devices, which used parallel connectors not usable on Macs. I replaced the latter with a USB version, and have never actually needed the former again.

Software

Outlook 2003 was my mail client of choice back in 2008, but I moved over to Mail on the Mac reasonably easily. I even managed to bring all my mail over, albeit via an import into Thunderbird first. Calendars moved to iCal, contacts to Address Book.

I coded webpages in PHP using RapidPHP on the PC, but soon moved to Dreamweaver and now, mostly, it’s WordPress anyway so I’ve managed this changeover without hassle. Dreamweaver also negated the suspected need for a SitePublisher alternative, as it does that site upload/syncing job of that too.

I used Agent!, an ancient piece of software (and I was about 3 versions old at the time!) for Usenet access back on my PC. I’d intended to move to Thunderbird on the Mac, and did for a while, but then I discovered MacPorts and got the *nix mail and news client pine working. I’d used pine ten years prior to that at university, so understood it. Sure, it’s like a trip back to the Dark Ages even compared to Agent!, but it suited me fine. More recently, however, I discovered I could actually get Agent! running on a Mac under wine, so I do that now instead.

I survived!

However, I did cheat a little. On my original iMac, I actually managed to get a complete working replica of my old PC running in Parallels. For the few times I really needed Windows, I could pop into that. In reality, I rarely did so. A few times to run some games, the odd tool, to do some coding in VB for work, or to run Access, but that was it. Over the years the frequency of using it dropped too.

On my new iMac, I installed Windows 10 in Bootcamp, and I have to admit I’ve used that more than I did Parallels previously, but in reality only to play games in Steam. There’s Steam on the Mac of course, but half my Steam games are Windows only. Again though, booting into Windows is still a pretty rare occurrence. Not least because every time I do there’s hours of updates to install.

To answer my ten year old question then: yes. I was ready.

Addendum:

In the comments on my original post, I also discovered I’d lose Corel Draw and PhotoPaint – now replaced with InDesign and Photoshop – and PictureShark (which I used to watermark images), now replaced with Star Watermark.

The Apps That Apple Killed

Gone, and mostly forgotten.

Today is the day that Apple went 64bit only on both iOS and macOS (well, OK – that’s in a few days), meaning all those 32bit only apps that haven’t been updated are dead to you should you decide to upgrade your operating system.

Thankfully, in a way, I won’t be moving to iOS 11 any time soon. Not because of this, but because I have a large number of devices and cables that iOS 10.3.3 have rendered “unsupported” because Apple didn’t licence them or something. I’m not ditching all them, so 10.3.2 is where I’m staying for the foreseeable future. Unless iOS 11 is more accepting? I doubt it.

I was interested, however, to see what apps I have on my phone that would no longer be available to me.

To be honest, very few of these ever get used. Some, such as WiFinder and Distant Suns stopped working properly ages ago anyway so I should probably have deleted them already. Bookworm crashes when I try to load it.

Flight Control and Harbour Master were some of the first games I ever got for my iPhone, way back when I purchased a shiny new 3GS all them years ago, so I’ve some nostalgic attachment to them even if I haven’t played them in almost as many years.

Touch Mouse was useful when I used to connect my laptop to my telly to play PC games, but I do that via Steam Link now. Various media players and connectors are no longer of use to me.

In fact, the only apps there I regularly use are Night Clock, Adobe Ideas (although I forget which of the two with that name is the good one) and Recordium. I can imagine I can easily replace those. Oh, and Peggle Classic (actually, my daughter rather than me), which can’t be replicated.

It’s a shame they’re going, although as I said – it won’t really affect me. Yet at least.

Will we ever see the ZXVega+?

Or MBison+ as we know him over here.

The sorry story of delays, legal wranglings, complaints and more delays regarding the ZXVega+ has begun to appear in mainstream media in the last couple of weeks. No longer just nerds arguing in forums and people shouting into the black hole of Twitter, even the BBC have reported on it (even if they did have to remove the article due to legal threats).

So what happened?

I came into the story quite late. Almost as late as the ZXVega+ devs, it seems (ho ho!). I heard about the ZXVega+, a handheld computer reimagining of the ZX Spectrum home computer from the 80s, when it was first announced as an Indiegogo campaign. It followed the ZXVega, a “computer in a controller”, which was also crowdfunded and successfully released. This original device was not without its problems, and I never wanted one despite my love for the Speccy because of them. Mainly, no keyboard.

The ZXVega+, initially at least, looked more interesting. A sleek handheld with a screen this time, and the ability to plug a keyboard in. Still, £100 was a lot for something my Nintendo DS already did, but it was nice.

ZXVega+ render
See? Looks good, yes?

That was over a year ago, and… things have not gone well since. I won’t begin to understand all the details, who was lying, who was telling the truth and what was and wasn’t promised, but the situation now is a shambles.

RCL, who are responsible for the device and the campaign, keep announcing delay after delay. Partners in the company have changed. There have been production issues. The rights to some of the 1000 games lined up for the ZXVega+ have been denied.

Their campaign promises refunds if backers are not happy, and boy are some backers not happy. Very few people who have requested refunds appear to have received them too. Why are people wanting refunds? Because RCL have very little to show for over half a million pounds worth of funding, and because they’ve not been successfully updating backers with progress.

In the last couple of weeks, they’ve finally managed to take some photos of the devices, and even edit together a couple of videos of them supposedly in action. I say supposedly, because as some people have pointed out, the videos appear to be just showing videos running – not the actual games or user interface. Key presses don’t correspond with on-screen action, and both videos show the same content albeit edited differently. Make your own mind up:

Then there’s the fact at no point, ever it would seem, have they managed to show more than three devices working at the same time. Some comments on the Indiegogo page suggest that they’ve only got three working prototypes.

Now there’s suggestions that the “group shot” published a little while back shows cardboard boxes that are actually hand-modified versions of the original ZXVega box.

ZXVega+ Group Shot
Look at the rough cuttings, making the”hole” in the insert larger.

What RCL need is transparency. They have nothing to lose, and everything to gain, by just telling everyone what’s actually going on. Stop threatening everyone with legal action. Actually show pictures of what you have. If there are delays, that can be tangibly explained away, most people will accept that.

“We don’t have any boxes so we mocked some up” – this is fine.
Boxes shoddily modified – this is not.

“We only have three working prototypes” – this is fine.
“Look at all these ZXVega+s! Oh but only three are ever turned on” – this is not.

“Everything is delayed. It might be months. We’re working hard. It’s harder than we thought. Here’s what we’ve done so far and here’s what we’re doing to make it happen” – this is fine.
“Stop complaining about us. We’ll get our lawyers onto you!” – this is not.

RCL are spending their time getting riled up about what people are saying and not getting on with it. If they want people back on side, they need to be open. Come clean. Explain who at the company actually does what and – much as I hate to single him out – explain exactly what Lee Fogarty’s role is. For someone who supposedly “just does their website”, he seems to know an awful lot more than that position would suggest. Show the people some proper proof – not shakey-hand iPhone videos (that were delayed so they could be “Hollywood quality” – they’re clearly not), or explain why you can’t. Be humble, be clear, be open.

And maybe file their finance report? That’d help.

On the other side, the angry backers (who have every right to be angry, sure) need to simmer down a bit. There have been some very nasty, personal and slanderous things from that corner and it’s not helping. All you’re doing, guys, is giving RCL more excuses to delay things and spend your money.

As for my question at the start: Will we ever see the ZXVega+? I hope so. I really do. I don’t think I’d buy one, but I want the project to succeed because of what it represents and what it may inspire in the future. Unfortunately at this point, even if they’re not (and I’d like to think they’re just naïve), they’re coming across as shysters.

My gut feeling at this point is, perhaps a year from now, a device called the ZXVega+ which resembles what we’re expecting but isn’t quite there, finally comes out. Not as polished. Not as slick. Missing features or altered specs. But something. And I don’t think anyone will be pleased.

Making audio work on a Steam Link and a Mac

I could just turn the volume up really high and listen through the ceiling.

Yes, it’s another Steam Link post. You see, having had some success with streaming Windows to the Steam Link, I thought I’d have a proper go and making Mac streaming work. And I’ve managed it! Eventually. Apple: “It just works!”. Pff.

Firstly, and not related to the audio issue mentioned in title of this post, I found a small utility to stop my iMac from deciding to go to sleep while playing. As it did. And that was annoying. It’s called Owly, and is free. It sits in the menu bar, and you can click it to disable all sleeping, and click again to enable sleeping. There’s options to prevent sleeping for a certain number of hours or minutes too, in case you’re likely to forget to turn it back on.

Anyway, that was an aside. To the matter at hand!

After setting the Steam Link up to talk to my Mac, and configured for my controller, TV, and so on, I discovered that sound wasn’t being streamed. It’d play in the Steam Link menus and startup screen, but not in Steam itself. Only it was – on the Mac.

I trawled the Steam forums, where the issue comes up a lot, but the solution is always the same: use the Steam Beta and it’ll force some drivers to install on the Mac. Thing is, that was the issue back in 2015 and I’ve done that already.

Turns out, after much fiddling, very easy to fix. If the Steam Link itself is set to use 5.1 audio, or “auto detect”, then sound plays through the Mac. Set it to stereo, and it works. OK, in stereo, but at least that’s something. Mini Metro doesn’t need surround sound anyway.

Still, it means I don’t need to boot into Windows quite so much to play Steam games now.

Windows 10 on an iMac and Steam Link Woes

Weakest Link

No technical help here, I’m afraid, just a rant.

Here is how using a Steam Link, connected to Steam on Windows 10 in Boot Camp on an iMac works: Badly.

In the past, a frequent occurrence is for the Steam Link on my TV downstairs to just disconnect from my iMac upstairs. I’ll go up to find out why. “Installing Windows Updates, 33% Completed”. And that’ll be it for the evening.

Also, random popups from Cortana (now disabled), the virus killer (now disabled), Windows itself (sadly not disabled) and so on draw focus from Steam Big Picture but of course, don’t show on the TV. I’ll go upstairs and find “Would you like to check out One Drive?” or something equally annoying has pulled me out of the game.

But last night’s episode took the biscuit. In fact, it took the entire box of biscuits then complained online about Just Eat not accepting orders for more biscuits.

I loaded Dangerous Golf (which, as an aside, is Excellent). After a few levels, the first scenario above took place. Even though I’d manually checked for Windows Updates before triggering Steam Link because I thought that might happen. After the updates, I logged into Windows again, fired up the Link, and played Dangerous Golf a bit more.

After some more levels, the screen froze. I pressed the Home button on my pad (a Xbox 360 wired one, if that matters) and nothing happened. As I sighed and stood up to investigate upstairs, a massive, screen-filling message appeared on the TV: “An error occurred [OK]”. Of course, I couldn’t click OK until I was at the computer.

In the time it took to get upstairs, another message had appeared over the top explaining the graphics driver had crashed, and Windows was now hilariously set to 640×480. I clicked OK, and the desktop flicked to another resolution and before the screen had a chance to redraw, the computer rebooted.

And rebooted.

And rebooted.

And rebooted.

Each time, it tried to install updates. Each time, it got to 87% complete before restarting. Each time, I got more and more annoyed.

Eventually, I had to repair Windows completely, which kept my settings but removed everything else. Or rather, moved it into a folder from which I could recover Steam games but the rest needed to be reinstalled. All this has taken a day.

I don’t know where the problem is – Steam, Steam Link, Windows, iMac hardware, or what and frankly I don’t care: It Should Just Work (And Not Break The Entire OS).

And why don’t I just use the Steam Link directly with OS X? Because:

  1. 80% of my Steam games are PC only
  2. Oh god have you even tried?