All posts by Jay Versluis

About Jay Versluis

Jay is the CEO and founder of WP Hosting, a boutique style managed WordPress hosting and support service. He has been working with Plesk since version 9 and is a qualified Parallels Automation Professional. In his spare time he likes to develop iOS apps and WordPress plugins, or draw on tablet devices. He blogs about his coding journey at http://wpguru.co.uk and http://pinkstone.co.uk.

How to build an Amazon link efficiently

When you want to share a product on Amazon with someone else, the easiest thing to do is to copy whatever is in the browser bar at the time and paste that elsewhere. While this works, it’s not an efficient way to link to a product.

The URL is often extremely long and contains additional parameters that tell Amazon’s systems either how the product was found or referred, or what else to display on the current product page. Most of that additional information makes the URL longer than it needs to be.

In this article I’ll show you how to build a short and efficient link without additional parameters, such as tracking information.

All we really need is the regional Amazon domain and the ASIN of the product and add these two together, separated by the letters “dp”.

Continue reading How to build an Amazon link efficiently

How to create a YouTube Subscription Prompt Link

Ever wondered how you can send a link to someone with an immediate prompt to subscribe to your YouTube channel?

It works by appending a parameter to the channel link you’d like people to subscribe to. It doesn’t have to be your own channel either.

Here’s how to do it.

Find the YouTube Channel URL

There are plenty of ways to do this, I won’t go into detail here. Check out my article on how to find your YouTube channel URL instead.

Let’s take my own YouTube channel’s URL for this example. It’s https://youtube.com/user/wphosting (if I remember correctly).

Append the sub_confirmation parameter

Ordinarily, if I would share this link with someone else, all that happens is that they land on my YouTube channel, and my channel trailer starts playing. The end.

But if we append the following parameter, the user is asked if they’d like to subscribe to that channel.

So in my case, the full subscribe URL would be https://youtube.com/user/wphosting?sub_confirmation=1. Try it out and see how it works!

When the other party receives the link, all they have to do is click on a SUBSCRIBE or CANCEL button.

If a user is already subscribed to the channel, no message appears. If a user is not logged into YouTube, they will be prompted to do so after the above dialogue (and then they’ll subscribe to the channel).

Credits

Thanks to David “The 8-Bit Guy” Murray for this insight! He’s been using such links successfully in one of his latest collaborative videos, the ThinkDifferentChallenge.

After it went live, Jan Beta noted in a Pattern post that his subscriber count went through the roof.

WordPress 5.0 and Gutenberg: What does this mean for you

In this episode I’m explaining the implications of the new default text editor in WordPress 5.0. It’s called Gutenberg, named after the man who invented the printing press (and hence revolutionised how printed books were duplicated and distributed at the time).

I’ll also show you how to test drive the Gutenberg editor in WordPress 4.9 and earlier, and how to bring back the Classic Editor if Gutenberg is not for you.

I’m not going into details on how to use the new editor, this is just an explanation what Gutenberg means, where the change will happen and how to remedy your WordPress instance if you feel lost with it (like I did when I first tested it last week).

Catch this episode on my WP Guru Podcast:

How to take pictures with Photo Booth on macOS

In this episode I’ll show you how to take pictures with built-in and external USB cameras using Photo Booth on macOS. Photo Booth is the equivalent of the Camera application in iOS.

I will also explain how to export your images, where they are stored on the hard disk, and what you can do if the built-in camera gives you an error message.

For Ivy-Jo.

Troubleshooting

As I’ve explained in the screencast, if Photo Booth or any other app is giving you grief about there camera “not being available”, you can try to reset the VDCAssistant process on macOS.

To do this, open the Terminal app, then type the following:

Provide your administrator password when prompted, and without a reboot, Photo Booth should be working as it should. Thanks to Turn It Off And On Again for this tip!

Catch this episode on my WP Guru Podcast:

How to turn text into an audio file on macOS

Ever since Lion, Mac OS X 10.7, there has been a great and very underrated feature built-in to every Mac: the ability to highlight some text and have macOS turn it into an audio file.

This is a wonderful way to listen to written text while you’re on the go, or if you want to skim through text you or others have written while you’re occupied with another activity, such as walking or driving. I love this feature!

I’ve seen the option in the context menu many times, but I’ve never dared to use it until today. Perhaps I held off for so long because the option reads “add to iTunes as Spoken Track” – and I’m just not a big fan of iTunes.

Turns out, this text-to-audio option bypasses iTunes altogether. It doesn’t open automatically and we won’t need it to transfer tracks to our iPhones either. What a relief!

Let me show you how to do it in this article. Continue reading How to turn text into an audio file on macOS

How to find the URL for your own YouTube Playlist (2018)

I’ve seen a lot of web interfaces in my time. YouTube’s has got to be one of the worst ever. Fact! I am frequently shocked how unintuitive the simplest of things are, and how cumbersome and ugly the whole design is.

Take something as simple as sharing your own Playlist. There’s this unbelievably unhelpful Google article that apparently explains how it works.

Which it doesn’t. At least not at the time of writing.

Here’s how to find and share your own YouTube Playlist’s URL (with screenshots, as of August 2018). Continue reading How to find the URL for your own YouTube Playlist (2018)

How to transcode an AFIC file with macOS Finder

Yesterday I had to transcode some audio files recorded with Quicktime on macOS. Quicktime works great for that, but it only stores files in its native AIFC file format. That’s the Audio Interchange File Format, a format developed by Apple in 1988, storing audio data as uncompressed PCM data.

Sadly though, AIFC is not commonly readable by many applications, and as such the data needs to be transcoded to be used successfully elsewhere. And Quicktime offers that option too, simply by choosing File – Export – Audio Only. This will create an MPEG 4 audio file with the M4A extension.

While that file sounds fine, and its size is only a fraction of what the original AIFC file was, this transcoding process does not allow us to choose which compression algorithm to use upon export. As it turns out, Quicktime introduces a very good, albeit lossy compression when it exports files in this manner.

I wondered if there was a way to extract uncompressed lossless data from the AIFC file, and how to do it. If Quicktime didn’t let me, perhaps there was another way, maybe using some kind of free software tool.

I was glad to find out that I didn’t have to look far: my good friend the Finder has such an option built in! Thanks go to Jim Tanous for sharing his knowledge with us.

All we have to do is open a Finder window, right-click the AIFC file in question, and select Encode Selected Files at the bottom of the context menu. We can even select multiple files and transcode them all at once.

When we do that, a dialogue window comes up. This may take a moment or two, so don’t get nervous if your Mac doesn’t respond instantly to this request (like I did).

Now we get options! We can pick  destination for our new files, and we even get the choice to delete the original AIFC file if we so desire (and if we’re confident enough about this workflow’s capabilities).

The best option we get though is that we can pick how the file(s) are to be transcoded though. While we do not get these options during the Quicktime export process, which appears to use the “High Quality” setting (and probably the same tool under the hood), with Finder we can choose the Apple Lossless codec.

From what I understand, all three options apply a lossy AAC compression in varying degrees, resulting in different file sizes, data rates and of course different levels of quality. The only one that stands out is the Apple Lossless setting, which creates a file still smaller than the AIFC file, but with lossless compression, in M4A format.

The resulting M4A output is readable by a wide range of applications.

Thanks, Finder! I didn’t know you did Audio Encoding so well 🙂

How to share ebooks with WordPress (EPUB and MOBI files)

If you’ve ever tried to upload an ebook in .MOBI or .EPUB format with the WordPress Media Uploader, you will have noticed an error message appear. Something along the lines of “Sorry, this file type is not permitted for security reasons”.

The only way then appears to be to ZIP the file and share it. That’s not a great experience for mobile users, who would simply like to click on a file and open it in an application such as iBooks or Kindle.

The solution to this puzzle lies in adding the required mime types to WordPress, so that these file types are allowed.

Let me show you how to do it in this article.

Continue reading How to share ebooks with WordPress (EPUB and MOBI files)

How to declare Classes in PHP

Since PHP 5 we can use object oriented features in PHP. This allows us to not only use functions and variables, but also write classes and create instances of them in our code.

Here’s quick rundown on how to do it.

Writing and instantiating a Class

Creating classes is very similar to writing functions. Here’s an example of a class with one method and one variable:

Once declared, we can instantiate our class like this:

Accessing variables and methods

Now we can access any variables in our instance using the -> operator like this:

The same principle is true for calling methods in our instance.

Constructor Methods

A method is nothing other than a function really, but when a function is part of a class, we call it method. I guess that’s done to differentiate it from a “classic” function that’s declared outside of a class.

There’s a special method we can declare inside our classes called a constructor method. It works just like a regular method, with the only difference that the constructor is called automatically when the class is instantiated. This is useful if we want something to happen as soon as our class is used the first time.

Constructors have a special name (__construct); here’s an example:

Extending a Class

Classes can inherit functionality from other classes. When we do that we create an exact duplicate of an existing class. This is useful if we want to change the behaviour of a class, for example by overwriting existing methods or values.

Here’s how we can extend a class:

Overwriting methods and variables is as easy as simply re-declaring them using their original names. Extended classes can be extended again, but a class can only ever inherit from another single class.

Notice the use of the parent:: keyword in our constructor method. When our extended class is instantiated, our constructor method is called. If our parent class also has a constructor method (which is optional), we must call this before doing anything else to make sure that any functionality that is setup is being kicked off.

In essence, anything prefixed with the parent:: keyword will call the related function “one level up”.

Now we can create an instance of our extended class as described above:

How to switch off emails from Anacron in Plesk Onyx

In 2011 I wrote an article about how to avoid emails from Dr. Web. In it I was discussing how to switch off these notifications, which are generated when the Dr. Web service updates itself.

Here’s an example:

Sadly, as of 2018, there is still no way to switch these emails off via a tick box from inside Plesk. It was relatively simple though to redirect the output to /dev/null in Linux, thereby avoiding yet another email in our already overflowing inbox.

In the latest version of Plesk, the earlier approach is no longer working.

Instead, we can tweak the Dr. Web configuration file at /etc/drweb/drweb32.ini. In the Updater section, find the following block of code:

Now change the CronSummary value to no and restart the Dr. Web service. On CentOS it’s called drwebd:

This will ask Dr. Web to not send us an email when he updates himself. The great thing about this solution is that we can still get command line output if we want to run the service manually.

However, if the service is updated in the future, those emails may re-appear because it’s likely that our configuration file may be overwritten. Only time will tell I guess!

  • https://support.plesk.com/hc/en-us/articles/213916725-How-to-disable-E-mail-notifications-about-Dr-Web-updates-