Yearly Archives: 2020

How to add the path to PHP in Visual Studio Code

I’ve recently started using Microsoft’s Visual Studio Code on my Mac. It works great, and I really like its simple useful features. The installation and most of the configuration worked flawlessly on my Mac and I was up and running very quickly. I had assumed it would be the same on Windows, but of course that wasn’t the case. Nothing is ever easy in Windows, is it?

The error I got was with two PHP extensions: PHP Executable not found. Install PHP 7 and add it to your PATH or set the php.executablePath setting.

Hey sure, I get that. The extension needs the location of my local PHP installation. No problem, I can provide that… but how??? You click on Open Settings and expect to just navigate there – but that would be too easy. All we get is this:

Then you think, ah OK, it must be in that mysterious settings.json file, but all that does is to open a new coding window, with two curly braces. How the hell is anyone going to know what the syntax is? It surprises me that the rest of Visual Studio Code is so good, and something as simple as am option to browse to (or even find itself) what some component is looking for isn’t there? Oh Microsoft, you haven’t changed a bit in 30 years!

Well here’s what to put in that settings.json file:

I know. Crazy. Not a syntax I would have dreamt up in 100 years. This can be written on the same line, and it looks like it’s a key value pair to me. The second parameter points to my local XAMPP installation, so feel free to point it to your own PHP location.

Bizzarely, instead of regular backslashes, make sure to use double-backslashes. Because… you know, reasons. Escaping things or whatnot, I have no idea. All I can tell you is that it works.

This tip comes courtesy of Mohamed Elrashid on StackExchange. Thank you, Mohamed!

Note to self: I believe had PHP been set as an environment variable to PHP been set in System Properties, there is a chance that Visual Studio Code would have found it upon first run. That’s what happened on my Mac, so I’m assuming it’s possible on Windows as well. It’s also what that mysterious error message at the beginning alludes to.

How to create Custom Post Types in WordPress

I’ve been working on a game database that’s powered by a vanilla WordPress instance. For the project it made sense to create a new post type (game), as well as a custom taxonomy (platform). I didn’t want to use a plugin and instead opted to create the new post type as part of the child theme’s function.php file.

Here’s how I did it.

Continue reading How to create Custom Post Types in WordPress

How to use Sidechain Compression in OBS

OBS has a super neat feature that works great if you’re narrating over an existing audio track. It’s called Sidechain/Ducking, and it will automatically lower the audio of one source if an audio level is detected on another source. For example, when you’re playing a game, the audio would be lowered when you speak, and when you’re quiet the game audio could be played higher. It’s like MAGIC!

In this article I’ll show you how to set it up, and the values that I’m using for some of my streams.

Adding the Sidechain/Ducking Compression Filter

On the audio source in question, apply a filter. You can either right-click on the source in question, or use the little cog icon in the Audio Mixer for that. Add a Compressor filter and call it “Sidechain Compression”, or another identifiable name.

The default values work OK, but I’m using these as I find them more pleasing:

  • Ratio: 32:1
  • Threshold: -40dB
  • Attack: 250ms
  • Release: 500ms
  • Output Gain: 0dB (default)

The important bit is set at the bottom, which which we can pick a Sidechain/Ducking Source. Set this to your microphone source from the drop-down menu. That way the Compressor knows which other source to listen to and apply the effect. When a level above a certain threshold is detected, the filter kicks in. Anything below that will not trigger the filter.

It’s worth doing some test recordings to see which exact values suit your needs. To figure out the threshold, take a look at the audio meter while you’re not speaking into your mic. You’ll see some low level noise on the left, know as the noise floor. Make sure to set the sidechain threshold to somewhere above that level so that it won’t trigger accidentally.

Have fun!

SVN Command Line Basics

I keep forgetting SubVersion basics from the command line, and thought this quick little cheat sheet might come in handy. I’ll cover the basics:

  • checking out
  • updating your local copy
  • checking current file status
  • committing a change
  • adding a file
  • removing a file

Checkout Out

To make an initial copy of an online repository, we use the checkout command. It’ll create a new folder with the name of the online repo in the current directory and copy all its contents into it. Checkout can be abbreviated with co:

Updating your Local Copy

If you’ve already checkout out a repository, and you’re not sure if changes have been made on the remote, you can update your local copy using the update command. It can be abbreviated with up:

A list of updated files will be displayed, as well as the revision of the current commit. If no files are displayed, your local copy is up to date. Check svn help update for details.

Checking the status of current files

SVN let’s you display a status of all current files. This lets us decide what has been changed locally before a commit has been made. We use the status command for this, or its abbreviation stat:

A list of files and their status appears, or nothing if all files in your local copy match the online repository. Check svn help status for details.

Committing a change

When one or more files have been changed, it’s time to submit this change to the online repository. We do that with the commit command, abbreviated with ci (short for checkin). It’s customary to leave a small comment as to what this change does, using the -m switch:

Commit will store changes across multiple files. There’s no need to submit each file individually. The commit command is designed to make all changes final, such as updates, additions and deletions. It’s usually used at the end of all changes that have been make, as a final synchronisation step.

Adding a file

Add will add a new file to the repository. It’s necessary to add files to put them under version control, otherwise they’ll be designated with the ? parameter (as unknown state). The same goes for directories.

Removing a file

If you delete a file from the local directory, we must tell SVN about it. Otherwise it will assume the file still in the online repo is out of sync and should be downloaded to your local copy first (being obviously missing and all). Delete will remove a file for us. The command can be abbreviated with del, remove or rm:

Further Reading

Running Stardew Valley without Steam (and the caveats it brings)

I’ve been playing Stardew Valley for a few days, and I’m enjoying it a lot. I have the Steam version, and as I often do, I’ve asked Steam to not create a Desktop shortcut for my game. Shortly after I thought that might have been a good idea and created one by myself and pinned to to my Start Menu. All works well: Stardew Valley starts and I can play.

However, I’ve just LOST two days worth of progress because the Steam Client wasn’t running in the background. I have it disabled, because I genuinely dislike the idea of daily updates to a service I barely use, and because I’d like to run as little “background crap” on my system as possible (yes Adobe, I’m looking at you).

The Steam Client not running does not stop Stardew Valley from starting, or from running, or from saving. It all works rather swimmingly… until I started the Steam Client, at which point the automated cloud save implementation wiped out my Stardew Save – and hence I lost two seasons worth of progress. YIKES!

Continue reading Running Stardew Valley without Steam (and the caveats it brings)

Avoiding weird characters on Twitch Exports

Twitch allows for very convenient exports of past broadcasts and highlights to your connected YouTube channel: In the Video Producer, click on the little three-dot icon next to a video, the select Export. Moments later the video, including its title and description should be on YouTube. It’s rad!

Sadly though, doing this will introduce rather strange characters caused by Twitch’s use of Markdown. Links for example are converted into Markdown, and extraneous hashes and such things are littered around the description as a result. The same goes for apostrophes and other special characters, they’re all destroyed with ampersands and semicolons. YouTube at its end sees this as plain text and leaves things as they are – much to my dismay.

The good news is, I’ve found a way to avoid this issue:

Instead of using this export dialogue, choose to Edit your video instead. This will bring up a different context dialogue, letting you change the thumbnail, description and title. As you would expect, you can edit the description without Markdown conversion, so no schlnoz characters will show up. That’s nice!

Now select the Export option from there, and your video will show up on YouTube WITHOUT those characters. Catastrophe averted 🙂

Prevent Steam on Mac from starting automatically

I’ve recently installed Steam on my Mac for the first time. I made sure to disable the auto startup option from the menu as I hardly use it on this underpowered machine (under Steam – Preferences – Interface). There’s no tick box there!

Imagine my surprise when I restarted my Mac a couple of days later, only to be greeted by the familiar window showing “Updating Steam”. Bad software design at its best: do the opposite of what the user has selected. Good job, Steam!

This being a Mac issue, there’s about 0 threads on the web on how to tackle this issue. It took me a moment to remember that there’s built-in Mac option under Preferences – Users – Login Items. That’s where Steam was hiding, and as such, it is started no matter what. Untick that box, and Steam will no longer start on your Mac when you boot the system.

How to add allow ZIP files as uploads in WordPress

Years ago I added an additional MIME type to one of my websites so that I could allow a strange proprietary file type to upload directly. Back in those days, only a handful were allowed, and it included the ZIP format. I never had issues uploading those.

As the world gradually becomes a shitter place, security is tightened and I guess sometime recently ZIP files were no longer allowed in WordPress by default. Thankfully I remember how I did it, and I thought I’ll share it with you.

Add the following snippet to your functions.php file. I have it as part of my theme:

This will add both ZIP and GZIP type archives to your upload allowances.

Fixed: macOS reports incorrect disk space usage

I had a weird issue on y MacBook today: after being low on space for what felt like months, I bit the bullet and deleted 50% of stuff from hard disk. I freed up about 250GB of files, emptied the trash, and checked under About this Mac – Storage. Sure enough, I finally had space again.

But when I tried to install something, which instantly told me I only had 14GB available, and that’s just not enough. I thought, “pardon?” 🤔

I double-checked on the command line with df -h, and the output corroborated the statement of the application I wanted to install: 98% disk space used. I thought perhaps Disk Utility would bring clarification, perhaps via a First Aid run. But sadly it only confirmed what the df command saw: my disk was nearly full, and whatever 250GB I had deleted were somehow still lurking around. How? Why? What was going on here?

Thankfully I found this StackExchange thread discussing the same issue. Apparently this weirdness is caused by local Time Machine backups that have not been relayed to an external disk. I do recall that my MacBook has been telling me that no backups could be made for some time. Either way, the magic command looks like this:

No administrator privileges are necessary. It takes a moment to run, but apparently this radically clears up local backups. I had this problem with macOS 10.13.6 High Sierra. Maybe this helps anyone with similar issues.

Thanks to Tetsujin for making this excellent suggestion.

How to add custom emotes on Twitch

So I’ve made affiliate on Twitch last month (YEY!!!), and one of the perks is that I can upload my own custom emote. Which is super exciting! It takes a while for those little icons to get approved, but once they’re online they add a very personal touch to a stream.

My first iteration wasn’t great, so I took another crack at it and wanted to upload the new design – having forgotten where in the deep and dark Twitch interface that setting was. I thought I’d make a not for next time, and anyone struggling with the same thing.

We head over to our Twitch Dashboard (, which is accessible from the front page from our icon at the top right, under Creator Dashboard.

At the top left corner there’s a menu, click that and navigate to Preferences – Affiliate.

Under the Subscriptions section, there’s an item called Emotes. That’s where we need to be.

You need to upload three sizes of your emote to make the little icon look handsome on all kinds of screen resolutions and circumstances:

  • 28×28
  • 56×56
  • 112×112

You also need to give it a unique name, made up of your channel name and a postfix of your choice. It’ll take some time for it get approved, and/or made live. Twitch will send you an email when you can use it.

Swapping emotes is possible, but it requires deleting and re-submitting them. Each subscription tier has one emote when you get started, but the more subscribers you get, the more “emote slots” you unlock. This handy article has all the juicy details: