String Formatting on Commodore Computers
Commodore BASIC has some interesting and simple string functions built in. Two of them are self explanatory: LEFT$ and RIGHT$. But the mysterious MID$ function is a little tricker, and I can never remember how it works. So here’s a quick recap on how three of these work. LEFT$ (A$,X) The LEFT$ function takes the x left characters from a given string. Here’s an example: a$="one-two-three" print left$(a$,3) one We get “one”, because those are the 3 leftmost characters in our string a$. RIGHT$ (A$,X) Likewise,...
read moreHow to play sounds and music on the Commodore Plus/4
The Plus/4 has a total of two voices thanks to its integrated TED chip, which is also responsible for rendering text and graphics on screen. The first voice can play square waves, while the second one can generate either square wave sounds or white noise. Let’s see how we can make him play a tune. We can use some BASIC keywords to make the Plus/4 be all musical. First we need to turn up the volume by using the VOL command. We can set this to anything between 0 and 8. VOL 8 Next we can use the SOUND command to make each channel play a...
read moreHow to turn off PayPal Notifications in the Facebook Messenger App on iOS
In this video I’ll show you how to switch off those super annoying PayPal notifications in the Facebook Messenger App in iOS on my iPhone 6s Plus. I’ve recorded this video on iOS 11 in March 2018.
read moreHow to add code to the header in WordPress
WordPress has a hook that lets us add arbitrary HTML code to the <header> tag of a website. Several plugins can be found that accomplish this, but it’s so easy to do that a plugin is often overkill. Here’s how you can execute an arbitrary PHP function using the wp_head hook: // write some text as part of the header function writeSomeText () { echo 'Hello from my new header function.'; } add_action('wp_head', 'writeSomeText'); This example inserts some text into the <header> portion of the...
read moreHow to show a list of all articles in WordPress
There’s a handy function in WordPress called wp_get_archives(). With it we can create a lot of useful output with just a few lines of code. To list all articles ever published on a site, we can do this: Here we setup a list of arguments and then give it to the function, which in turn gives us a nicely formatted list of every published article. If we set the show_post_count argument to true, and replace the type argument to something like “yearly” or “monthly”, we’ll get clickable a list similar to this:...
read moreHow to fix the “Occasional White Screen of Death” Error in WordPress
In this video I’ll show you how to fix an odd phenomenon I’d like to call “The Occasional White Screen of Death”. Here’s what happened: Google have notified me that some of my posts were not showing up, even though most of them are working fine. This didn’t make much sense, because traditionally, “white screen of death” in WordPress means either a site works fine, or a site has an issue. But only some posts having issues was a new one to me. So I made tweaks, investigated the whole stack and...
read moreHow to disable JetPack nag messages in the WordPress Admin interface
I really like WordPress, and I really like JetPack. I use the plugin on many client websites, who usually have their own WordPress.com account, which is necessary to enable the plugin successfully. Most of them however choose not to sign up for a payment plan, which as of 2017 leads to (now rather annoyingly frequent) JetPack upsell messages at the top of the admin screen. So I as the administrator, am constantly exposed to such messages, and I was wondering how to suppress them – not being the target audience here. Thanks to a super...
read moreHow to find out which version of GNOME you’re using
In the GNOME desktop, there is no obvious way to tell which version you’re running by way of the GUI. Instead, we need to consult the command line and try out a couple of commands to find out more. Here’s how. Let’s open a Terminal session and do some hacking. GNOME 2.x If you’re running GNOME 2.x (under CentOS 6 for example), you need to run the following command: gnome-session --version gnome-session 2.28.0 You may need to prefix this command with sudo, otherwise it will tell you that you’re alrady running a...
read moreHow to fix the Visual Editor or Text Editor in WordPress when it’s not working
I had a weird phenomenon on a Multisite installation the other day. I can’t tell you with which update exactly it happened, as I only write a post on that site once every couple of months, but it must have been around the 4.7 or 4.8 upgrade. Here’s what was happening: I could log into the site fine, I could display all posts in the backend fine, but editing them, or creating a new post (or page) resulted in an unresponsive editor window. Neither the Visual Editor nor the standard Text Editor wanted to accept any keyboard input....
read moreHow to use Xcode for C and C++ development
Not only is Xcode an excellent IDE for iOS and macOS apps in both Swift and Objective-C; it does just as fine a job for regular C and C++ code. This includes all the features we know and love, such as code completion, version control, and all the rest of it. Let’s see how to use Xcode 8.3 for C and C++ development. Starting a new C Project Even the shortest programmes you’ll ever write with Xcode are a project. Everything’s a project in Xcode. Start a new one under File – New Project. Under the macOS tab, find the...
read more