Recent Updates Toggle Comment Threads | Keyboard Shortcuts

  • Jay Versluis 10:01 am on April 13, 2015 Permalink | Reply  
    Categories: Announcements, Linux ( 7 )

    LAMP Stack for Humans – now available on Amazon 

    Lampstack-SoftcoverMy book LAMP Stack for Humans is now available on Amazon. It this 284 page guide I’ll walk you through the process of turning an old laptop into an always-on server. You can use it to run web applications in the comfort of your own home or office – no “cloud” required.

    Together we will configure the entire server: you will learn how to install CentOS, Apache, PHP and MySQL (or MariaDB) and WordPress. I will show you how you can reach your server from other computers on the network and how to create regular backups.

    Perfect for the Linux newbie and those who want to get started with web applications without spending money “in the cloud” (in my opinion THE WORST expression for describing remote computers).

    If you’re an avid reader of this site and have always wished that some instructions would be presented in a more cohesive form rather than in snippets, then LAMP Stack for Humans is perfect for you.


    Grab your free sample today, or read the entire book for free via Kindle Unlimited!


    • Falkon 2:28 am on October 21, 2015 Permalink | Reply

      Hi Jay
      I have a question regarding WP adding a Landing page for an existing site, meaning to add a new page which only displays a big logo in the start and be able to make that logo a roleover logo, and then the click would navigate a user to the main ( index page) if you will. i am new to WP and PHP wise I am still learning so I would not know how to add an extra page as the index page and the first index page turns say into a home.html. How would you do that? I trying to learn PHP and WP to what I work with in HTML & CSS and front end designs.
      Beforehand allow me to thank you for you time, help and assistance,

      Best Regards

      • Jay Versluis 2:55 pm on October 21, 2015 Permalink | Reply

        Hi Falkon, that’s a VERY off-topic question for this post…

        WordPress does have a way to display a static page as front page, instead of the default blog posts. You can change it like this:

        • for the blog, create a new page with a title (no content is necessary)
        • head over to Settings – Reading
        • under Front Page Displays, select your pages
        • hit Save and refresh the front page

        As for the roll-over image: insert an image into your static front page, then link that image to wherever you want (you can do that with Add Media from the page creation dialogue).

        Hope this helps!

  • Jay Versluis 4:29 pm on August 23, 2016 Permalink | Reply  
    Categories: Mac OS X ( 28 )

    How to kill a Mac App via the Command Line 

    Sometimes it’s’ necessary for us to force-close an app on our Mac if it’s no longer responding to our commands. Usually we’d do that by pressing CMD+OPT+ESCAPE, which brings up a handy window from which we can choose a troublesome app.

    Screen Shot 2016-08-23 at 16.10.14

    But sometimes, this keyboard combination won’t work – for example, if we’re dealing with a remote Mac to which no physical keyboard is attached. In such cases, we can choose to force-close an app via the command line. Let me show you how to do that.

    Connect to your Mac via SSH using a Terminal Session and find out what apps are currently running. We’ll so that with the top command:

    top -u

    Using the -u switch tells top to list the app with the highest CPU usage over time first. The command will display a list of running processes, much like this:

    Screen Shot 2016-08-23 at 16.15.04

    Take a look at the list and make a note of the troublesome app. In my case it’s Carrara, using 165% of my CPUs resources. By definition impossible, but let’s not worry about that. The important thing is this app’s PID (Process ID). Write it down or take a screenshot, we’ll need it in amount to kill the app (mine is 5964).

    Press CTRL+C to stop top and return to the command line. Now issue the following command, replacing 5964 with your own PID:

    kill -9 5964

    And that’s it: the troublesome app has been force-closed and should vacate your system sharpishly. For more information on both top and kill, check out their respective man pages on your Mac.

  • Jay Versluis 5:43 pm on August 7, 2016 Permalink | Reply

    Categories: iOS, Mac OS X ( 222 )

    How to make Notes App sync properly on iOS 

    ios9-notes-app-iconHave you ever wondered why some notes seemingly sync just fine between your iOS devices, but others do not? Wether a note is not fully updated, or you find a duplicate entry in the list, it can be an exercise in frustration.

    But fret not, it doesn’t have to be! This is not a bug in the Notes app; it’s the way we’re using it.

    Let me show yo what you can do to avoid such problems, and how they can happen in the first place.

    Why do we sometimes get random duplicate notes?

    This has to do with the way the app stores data in the cloud. Notes saves your content only when you close the note, or when you switch away from it. Your note is not saved while you’re typing it.

    Likewise, iOS can only “save over” the current note if you’re not actively editing it. Leaving it open, even if you’re only looking at it, means your note is locked for edits from other devices.

    When you make a change on device A, and the same note is opened and edited on device B, then iCloud cannot save your changes to the current note. Hence it creates a duplicate entry. This is a safety mechanism so that your changes are saved rather than lost, and you can decide which copy you’d like to keep when you’re done.

    How to avoid sync trouble on iPhone

    So on iPhone, the solution is simple: always return to the list view of all your notes. Do not leave a note open. That way, another device can edit its contents without trouble.

    How to avoid sync trouble on iPad and Mac?

    On the iPad as well as your Mac, things are a little different due to the nature of the Split View Controller. It displays both the list of your notes, as well as a note next to it. Even when you hold your iPad in portrait mode and cannot see the list view, one note is ALWAYS open and displayed, and therefore cannot be edited by another device. That’s usually when and why iOS (or macOS) saves a duplicate.

    To avoid this situation, make sure you switch to a note that you’re unlikely to edit from another device. Perhaps create a “dummy note” without content and switch to it when you’re finished with the Notes app.

    Remember you can look at a note even if it’s open on another device – it’s just that when editing an open note, trouble keeps in.

    Hope this helps 🙂

    • juliav305 8:26 pm on August 7, 2016 Permalink | Reply

      Another great article thank you – another part of the system that made me think I was going slightly crazy with duplicate notes of the same thing or not syncing up at all. Mystery solved 🙂

      • Jay Versluis 8:33 pm on August 7, 2016 Permalink | Reply

        Thanks Julia 🙂

      • Jay Versluis 8:34 pm on August 7, 2016 Permalink | Reply

        Thank you, Julia 🙂

  • Jay Versluis 4:45 pm on August 7, 2016 Permalink | Reply

    Categories: iOS ( 222 )

    How to sync past events in the Apple Calendar App on iOS 

    Apple-Calendar-Official-iconHave you ever been shocked to find out that a new iOS device does not show your old calendar entries, even though future events sync fine across your other devices?

    We’ve all been there! Turns out there’s a default setting in the Calendar App that only synchronises the last 1 month of entries. As if your life before that point didn’t matter. Kind of like Apple’s policy of not supporting hardware older than 4 weeks. But I digress…

    To fix this problem, open the Settings App on your iOS device, then head over to Mail, Contacts, Calendars and scroll all the way to the bottom. Find the Calendars section. There’s a section here called Sync, and by default it says “Events 1 Month Back”.

    Change this to All Events, and magically, past events are now synchronised on this device as well.

    Photo Aug 07, 16 38 37

    You must make this change on ALL your iOS devices so that all past calendar entries can be pushed to every device. Note that there is no such setting on the Calendar App for OS X.

    Another mystery solved!

  • Jay Versluis 12:11 pm on June 11, 2016 Permalink | Reply  
    Categories: PHP, WordPress ( 25 )

    How to set WordPress Categories depending on the Post Title 

    I was working on a project the other day that required to determine which category a new post would go into, depending on the post title. This was important because posts were automatically acquired without the web interface, and in this workflow there was no way to pick a category other than the default.

    In our case we wanted to use a post fix in the title to determine which category was to be picked: for example, if a post title would end with “_ONE”, it should end up in Category 1, and if it ends up with “_TWO” it would end up in Category 2.

    Thankfully there’s a hook called save_post that is called every time a post is updated. At this point we can check what the post title is, determine the post fix, and set the correct category. Here’s a function that does just that:

    function set_my_categories($post_ID) {
    	// grab the current title
    	$title = get_the_title($post_ID);
    	// set the category depending on the last four characters of the title
    	// _ONE = Category 1
    	// _TWO = Category 2
    	$postfix = substr($title, -4);
    	if ($postfix == '_ONE') {
    		wp_set_post_categories($post_ID, array(1));
    	if ($postfix == '_TWO') {
    		wp_set_post_categories($post_ID, array(2));
    add_action('save_post', 'set_my_categories');

    If a post fix is not present, the categories will not be changed.

    For this example I’m assuming that my categories are actually 1 and 2 on the system, something that’s not really the case. To determine the correct value set under wp_set_post_categories, I usually head over to Posts – Categories, select the category I want to use and check the URL of what WordPress gives me. Say the URL looks like this:

    then the tag_ID parameter hints that my category has an ID of 366, and that’s the value we need to use.

    And if a post needs to go into two categories, separate the category IDs with a comma like so:

    wp_set_post_categories($post_ID, array(2,3));

    Removing the post fix before the title is displayed

    Since our post fix is for internal purposes only, we may not want it to appear as part of the actual post title on the front page. But we also don’t want to remove it from every post once the category has been set and still have a reference in the admin interface. So the way to do it is to simply suppress it before out theme prints it out.

    The following code will do just that: if a post fix is present, curb the title. If not, leave the title unchanged.

    // curb title if we have a post fix
    $title = get_the_title();
    $postfix = substr($title, -4);
    if ($postfix == '_ONE' || $postfix == '_TWO') {
    	$title = substr($title, 0, -4);
    // use echo $title to print the post title in your theme

    And there we have it. The same principle can be used if your title contains a certain keyword and you want to use it to add the post to a particular category automatically.

  • Jay Versluis 10:01 pm on April 2, 2016 Permalink | Reply

    Categories: WordPress ( 133 )

    P2 Header Ad – Version 1.6 released 

    P2 Header Ad IconI’ve just released a new version of my P2 Header Ad plugin! It fixes a few issues I’ve come across in debug mode:

    • styles are now loaded via wp_enqueue_scripts hook
    • fixed a debug warning that assumed a constant rather than a value
    • verified compatibility with WordPress 4.5

    There’s still a lone warning that appears in WordPress 4.5 Debug Mode. It reads something like “get_currentuserinfo is deprecated since version 4.5! Use wp_get_current_user() instead”.

    This isn’t actually triggered by my plugin, but rather by the current version of P2 (1.5.8 and earlier). I’m sure the team will fix it very soon.

    As always, you can download the plugin from

  • Jay Versluis 12:57 pm on March 27, 2016 Permalink | Reply
    Tags: ,   

    Categories: Linux, Plesk ( 76 )

    How to fix “MLSD unable to build data connection” in ProFTP 

    Filezilla IconI’ve come across an odd problem today on a server that’s been working fine for all kinds of FTP traffic for many years. Turns out that today, FileZilla started complaining about explicit TLS connections (when available) and gave the following error message:

    425 MLSD unable to build data connection: operation not permitted

    Clients could still connect, but no directory content was displayed, nor was uploading new files possible. Rats, I thought. This was on a CentOS 6 server with Plesk 12 running without a hitch otherwise.

    Turns out that by default, ProFTP is configured to re-use TLS sessions – but it appears that this behaviour freaks out FileZilla, which in turn doesn’t like it and throws an error instead. This did not affect plain (non-secure) sessions.

    Thankfully, Adam Stohl knows the answer to this problem: tell ProFTP not to re-use TLS sessions. Open /etc/proftp.conf and add the following line to the bottom of the file:

    TLSOptions NoSessionReuseRequired

    The ProFTP service in Plesk is part of xinetd, so for those changes to take effect, simply restart it with this:

    service xinetd restart

    And voila, TLS connections can happen again. Thanks, Adam – you’re a life saver!


  • Jay Versluis 11:41 am on March 14, 2016 Permalink | Reply
    Tags: , Beta   

    Categories: Mac OS X ( 28 )

    How to switch off Developer Beta Downloads on Mac OS X 

    A while ago I thought it would be fun to run the OS X Developer Betas on my MacBook Pro. That was before El Captain was released. Once the buzz had died down I grew a little tired of the bi-weekly point release downloads that took about an hour to install.

    So how can we tell a Developer Beta Mac to become a “normal” non-beta Mac again?

    While forum posts suggest that it’s an impossible feat, it’s actually no trouble at all. Simply head over to System Preferences – App Store and find a button that reads “your computer is set to receive pre-release Software Update seeds”.


    Click it and an overlay window is shown, allowing you to “not show pre-release updates” anymore. Be warned however that when you do this, the option to bring up this dialogue disappears – so once switched off, there’s no going back easily (unless you install another beta from scratch, like you did when you first obtained yours).

    Note that when you switch this feature off, your Mac will remain on the beta you have currently installed, until a new release comes out and replaces it. This option will not remove beta files from your machine, nor will it turn your beta system into a non-beta system instantly: you’ll have to wait for the next release and use the regular update option for that.

    You can always check what’s currently installed by heading over to the Apple Icon and select About This Mac.

  • Jay Versluis 2:05 pm on January 16, 2016 Permalink | Reply
    Tags: Dolphin, Gamecube, Xbox Controller   

    Categories: Mac OS X ( 28 )

    How to connect your Xbox 360 Controller to Dolphin for Mac 

    DolphinI’ve been experimenting with the marvellous Dolphin Emulator recently. It’s an open source project that allows us to play Nintendo Gamecube and Wii games on modern hardware. Dolphin is available for Windows, OS X and Linux.

    I have a wireless Xbox 360 controller for Windows at my disposal, but the only Windows hardware I have is the first generation Surface Pro. While the controller connects without issues, the Surface sadly just isn’t fast enough to run Dolphin.

    My more powerful hardware is Mac based, and Dolphin runs great on my Mac Mini. But I had no idea how to connect my Xbox controller to it.

    Turns out it’s actually a breeze to setup: let me show you how it worked for me on OS X El Capitan.

    (More …)

  • Jay Versluis 5:16 pm on January 13, 2016 Permalink | Reply
    Tags: , ,   

    Categories: Commodore ( 24 )

    How to use direct block access commands in Commodore DOS 

    Commodore-Logo-PaddedWe can access each sector’s raw data on Commodore disk drives with direct block access commands. Supported drives include the 1541, 1571, the VICE emulator as well as the SD2IEC card reader (for the most part).

    Each single sided floppy contains 35 sectors, while a double sided 1571 formatted disk contains 70 sectors. Each track contains between 17 and 21 sectors depending on how far inside or outside they are. Each sector contains 255 bytes we can read or write.

    Sectors are the same as blocks: only the directory refers to them as “blocks” and shows us how many we have available.

    We’ll need to open two channels to our disk drives: a command channel and a data channel. Here’s how to do it:
    (More …)

  • Jay Versluis 9:17 am on January 2, 2016 Permalink | Reply

    Categories: Commodore ( 24 )

    How to save data to your C128 RAM Expansion Unit (REU) 

    Commodore-Logo-PaddedWith a RAM Expansion Unit (REU), the Commodore 128 could address up to 512k of data. That was huge in the late eighties! All you needed was one of those REUs, plug it into your cartridge port, and so much more super fast memory was at your fingertips.

    But even with such a cartridge at hand, how do we actually make use of it from CBM BASIC 7.0? With three funky commands called STASH, FETCH and SWAP. Here’s how we can use them.

    The REUs cannot be addressed directly, like other memory in your computer. Instead, data has to be either copied from the C128 to the REU, or vice versa, or swapped out. All three commands take the same four parameters:

    • number of bytes to transfer
    • location in the C128 memory to start
    • REU bank (0-7, depending on the size of the REU)
    • location in the REU bank memory

    This sounds more cryptic than it actually is: the largest REU split 512k over 8 banks of 64k, so that the 8bit operating system could address it.

    So to store 200 bytes of C128 memory, starting at location 5000, saving it inside the REU’s bank 0, location 0, we can use the STASH command like so:

    STASH 200,3000,0,0

    To retrieve our data later and bring it back to the same C128 location as before, we can use FETCH with the same parameters:

    FETCH 200,3000,0,0

    Rather than copying, we can also exchange data in two places by literally swapping it over. Again the parameters are the same:

    SWAP 200,3000,0,0

    Enabling REUs in VICE

    Although I have a physical C128, I do not have a real REU. Maybe one day I’ll find one on eBay, but until then there’s an easy way to emulate an REU using VICE.

    To enable one, head over to Settings – Resource Inspector – Cartridges – REU. Pick the size you like, and even a hard disk location to make the contents of your REU survive restarts.

    Screen Shot 2016-01-02 at 09.08.35

    Screen Shot 2016-01-02 at 09.09.19

    Demo Listing

    Here’s a quick test that allows us to store an arbitrary message in memory, then stash or retrieve it from an attached REU.

    100 print "1 store message in internal memory"
    110 print "2 print message"
    120 print "3 stash message in reu"
    130 print "4 retrieve message from reu"
    140 print "5 clear internal memory"
    141 print "6 quit"
    150 input "your choice";m
    160 on m gosub 1010,1090,1210,1410,1310,2000
    170 run
    1000 :
    1010 rem input and save
    1020 input "what shall we store";a$
    1030 for i=1 to len(a$)
    1040 c$=mid$(a$,i,1)
    1050 poke 3000+i,asc(c$)
    1060 next
    1070 return
    1080 :
    1090 rem retrieve message
    1100 print:print "retrieving..."
    1110 for i=1 to 100
    1120 c=peek(3000+i)
    1130 b$=b$+chr$(c)
    1140 next
    1150 print b$
    1160 return
    1200 :
    1210 rem stash to reu
    1220 stash 200,3000,0,0
    1230 return
    1300 :
    1310 rem clear internal memory
    1320 for i=1 to 200
    1330 poke 3000+i,0
    1340 next
    1350 return
    1400 :
    1410 rem retrieve from reu
    1420 fetch 200,3000,0,0
    1430 return
    2000 :
    2010 rem the end
    2020 end

    We don’t see many BASIC listings these days anymore. Enjoy!

compose new post
next post/next comment
previous post/previous comment
show/hide comments
go to top
go to login
show/hide help
shift + esc