Recent Updates Page 2 Toggle Comment Threads | Keyboard Shortcuts

  • Jay Versluis 11:31 am on September 20, 2014 Permalink | Reply

    P2 Header Ad – Version 1.5 released 

    Screen Shot 2014-09-20 at 11.15.53

    I’ve just updated my P2 Header Ad plugin with some new options:

    • you can now display the same ad again after the post content (before the comments)
    • you can do this on single posts, and additionally on the front page if you like

    These options are not enabled by default and work best if you have longer posts on your site – the look a bit naff if you use your P2 site mainly for short status updates.

    I’ve also spruced up the graphic assets that are used on while I was at it. Check out the new options in the Admin Interface (it’s still under Appearance – P2 Header Ad):


    Note on Google Adsense ads

    If you’re using both options above with Google Adsense ads, please note that those can only be shown up to 5 times on a single page. If your front page shows 5 posts or more, then the ad can no longer be displayed in the header (which is called last for performance reasons).

    If you want to use the after-content-front-page-ad feature, and you want the header to show first, you can tweak line 293 of the main plugin file (p2-header-ad.php) from this

    add_action ('get_footer', 'p2DisplayAdvert');


    add_action ('get_header', 'p2DisplayAdvert');

    I may make this an option in the admin interface in a future update. Let me know if you have any questions. Enjoy the plugin, you can download it from within WordPress, on on GitHub:

  • Jay Versluis 10:16 am on September 19, 2014 Permalink | Reply  

    How to use the File Manager in Plesk 12 

    In this screencast I’ll show you how to use the File Manager in Plesk 12. It’s a very convenient tool that has largely replaced the need for an external FTP client.

    The File Manager allows you to change files directly on the server via your web browser. I’m explaining the following things:

    • how to upload and download files
    • how to edit them via the integrated text and HTML editors
    • how to make files accessible to others via URLs
    • how to create and extract ZIP files directly on the server
    • and how to change file permissions


  • Jay Versluis 7:23 pm on September 18, 2014 Permalink | Reply
    Tags: ,   

    How to create a Plesk Backup from the command line in CentOS 

    Plesk-LogoEven in Plesk 12 we can only schedule a single backup, and we must decide where said backup should be saved: either on the local server, or on an off-site FTP server. Sadly we can’t have it both ways.

    Many of us – me included – find this very limiting.

    Both local and remote backups have their advantages though, and greedy as I am I want the best of both worlds:

    • an FTP backup is stored off-site, which is great for disaster recovery.
    • but a local backup can be create and to restore much faster, which is great for development
    • a local server wide backup creates individual domain backups automatically, whereas an FTP backup does not – great for convenience

    The good news is that Plesk has a set of command line tools which we can use to create a backup manually. In this scenario you can schedule a local backup in the Plesk web interface, and create another one using a cron job.

    The tool I’m talking about is called pleskbackup and it lives in the Plesk utilities directory. On CentOS this is in /usr/local/psa/bin.

    If called without parameters you’ll see a long list of options you can pass to this command:

    Usage: pleskbackup  <command></command> [] 
      server         Backs up whole Plesk.
      resellers-name Backs up selected resellers. Reseller's logins are read from command line,
                     space-separated. If no resellers provided, backs up all resellers
                     on the host.
      resellers-id   Backs up selected resellers. Reseller's identificators are read from command line,
                     space-separated. If no resellers provided, backs up all resellers
                     on the host.
      clients-name   Backs up selected clients. Client's logins are read from command line,
                     space-separated. If no clients provided, backs up all clients
                     on the host.
      clients-id     Backs up selected clients. Client's identificators are read from command line,
                     space-separated. If no clients provided, backs up all clients
                     on the host.
      domains-name   Backs up selected domains. Domain's names are read from command line,
                     space-separated. If no domains provided, backs up all domains
                     on the host.
      domains-id     Backs up selected domains. Domain's identificators are read from command line,
                     space-separated. If no domains provided, backs up all domains
                     on the host.
                     Use Exclude options to exclude some resellers/clients/domains.
      help           Shows this help page
    Output file option:
            /fullpath/filename      - regular file,
            -                       - use stdout for output,
            [ftp|ftps]://[[:]@]/fullpath/filename - storing the backup to ftp server.
                           FTP_PASSWORD environment variable can be used for setting password.
                           FTP option '--ftp-login' can be used for setting login.
                           FTP option '--ftp-password' (with '--ftp-login') can be used for setting password.
                           If your password contains slash, you have to use '--ftp-password' option or
                           FTP_PASSWORD environment variable.
                           'ftps' protocol can be specified to use FTP over SSL, instead of plain FTP.
                           With ftps specify 990 port to use implicit FTPS, otherwise explicit mode will be used.
            Used to import dump from repository into the single file.

    Usage Example: Local Backups

    To create a local server-wide backup, all we have to do is this:

    pleskbackup server

    This will create a backup just like the Backup Manager would in the Plesk web interface. Those are stored in a variety of files in /var/lib/psa/dumps and also in the respective domains/resellers/customers directories.

    To create a single domain backup, simply replace “server” with “domains-name” like this:

    pleskbackup domains-name your

    Add more domains on the same line, separated by spaces.

    Usage Example: FTP Backups

    FTP backups are slightly more complex to create. We must pass all our credentials as part of the –output-file parameter, which requires us to specify a file name. Since the tool will create a .tar file, make sure you add this as part of your file name. Let’s look at a full example.

    Imagine we’d like to create a server wide backup, and our FTP credentials are

    – server (FTP Host)
    – user (FTP User Name)
    – password (FTP Password)
    – filename.tar (our backup file name)

    then we can call the command like this:

    pleskbackup server --output-file=ftp://user:password@server/filename.tar

    If all goes well you’ll receive no feedback. This is a synchronous task which on larger installations can take several hours – but it should be done within seconds on systems with dummy domains.

    First the tool creates a local backup, then ZIPs up the tarball and sends it to the FTP server. Once finished, the tool comes back to the command line.

    Automatically deleting older backups from FTP

    I love how the Plesk Backup Manager takes care of older backups and deletes them automatically. The pleskbackup command line tool on the other hand isn’t so friendly and instead is a low-level command that only does one thing. If we’d like to see automatic deletions we’ll have to employ a script that will do this for us.

    I’ve written such a script in PHP and put it on GitHub – feel free to examine it, test it, use it, redistribute it:

    To use the script, take a look at the top of the file and amend your details accordingly:

    // add your FTP credentials here
    $ftp_server = "ftpserver";
    $ftp_user = "ftpuser";
    $ftp_password = "password";
    // maximum number of backup files to keep on FTP
    $maxbackups = 30;
    // add a prefix for your backup
    $prefix = 'BACKUP-'; 
    // PLESK utilities directory
    $pleskbin = "/usr/local/psa/bin/";

    Save your changes and make sure you add execute permissions to the file:

    chmod +x ./backup.php

    Now you can call the file from the command line or via a Cron Job (Scheduled Tasks in Plesk). Execute the script as root and make as many backups as you like – in addition to what Backup Manager is doing from the web interface.

    The one caveat I found is that the pleskbackup tool does not maintain the correct timestamp when it copies the tarball over to the FTP server. It’s an issue with pleskbackup rather than my script – I don’t understand how Backup Manager can do this fine in the web interface, which presumably relies on the same tool.

    As a workaround I’m saving the date as part of the filename, i.e. BACKUP-YYYYMMDD-HHMMSS.tar. For the auto-deletion to work, make sure to use a dedicated directory for your FTP backups with no other files – otherwise the latest backup may be deleted.

    To save your backups in a subfolder, amend the prefix like this:

    // add a prefix for your backup
    $prefix = 'subfolder/BACKUP-'; 

    And that’s how we can create Plesk backups from the command line!

  • Jay Versluis 10:18 am on September 18, 2014 Permalink | Reply
    Tags: ,   

    What are the credentials to your AirPort Time Capsule 

    AIrPort Time Capsule

    There is something I keep forgetting time and time again: the credentials to my AirPort Time Capsule. It serves as my router, Time Machine Backup disk and even as shared storage for internal use, thanks to an attached USB drive.

    All our Macs connect to both drives automatically and without fail – but every once in a while we want to access something on the shared drive, either via Windows or another app like GoodReader. And every time I forget what those credentials are – particularly the user name.

    Because there just isn’t a dialogue to set it up.

    The password is fairly obvious because it’s something you’ve added when you set the device up. Chances are you can remember it. You can even reset it by pressing the reset button at the back of the device for one second – but not longer, or it’ll reset to factory settings). AirPort Utility will help guide you through this.

    But the user name? What is it? Something generic maybe? The name of the attached drive? Steve Job’s daughter?

    Turns out there isn’t one. Put anything you like. Seriously. I know it’s weird, and it’s just not how a computer brain works. The user name can’t just be arbitrary – but on Time Capsule it is. So use any user name you like.

    It doesn’t matter what as long as you put something into that field. Your uncle’s boyfriend’s pet name, or the day of the week. Anything. Just for heaven’s sake don’t leave it blank or the universe as we know it will seize to exist in a moment’s notice.

    But I guess nobody tells you this in the shiny brochure.

    And in case I forget how to connect those drives in Windows, here’s a quick reminder for completion:


    Connecting to the Time Capsule drives (Windows)

    Technically you can connect to the Time Capsule drives via two protocols: Samba and AFP. The latter however is only used on Apple computers. So with Windows and Linux, Samba it is.

    In Windows we can map a network drive by heading over to the

    • Windows Explorer
    • find My Computer (Windows 7)
    • or This PC (Windows 8.1)
    • select Map Network drive at the top of the window

    This will bring up a dialogue that shows a drive letter drop down and asks for a server path:

    Screen Shot 2014-09-16 at 20.27.51

    The browse option won’t find your Time Capsule – instead find the IP address on your network (usually it’s, but AirPort Utility will verify this for you in the “LAN IP” field). Add it into the path/folder field like this:




    Two backslashes, followed by your IP address, followed by your drive name. If you don’t specify a drive name the operation will fail. If your drive name has spaces (like “Shared Data”) then just write them out – no need to escape them. CapItaLisAtiON is important here though.

    Hit finish and your drive should be accessible.

    To find your drive names, consult your friend the AirPort Utility. GoodReader on iOS will find those names automatically – but Windows does not.

    And that’s that: another puzzle solved. There is no user name when accessing a Time Capsule drive.

  • Jay Versluis 4:21 pm on September 16, 2014 Permalink | Reply  

    How to use File Sharing in Plesk 12 

    In this screencast I’ll show you how to use the File Sharing features in Plesk 12. File Sharing allows you to upload files and give links to others, or let others upload files to the server. You can do this with or without password protection and you can even map folders from your server to your desktop computer – so file sharing can be as easy as drag and drop.

    I’ll show you how to share files via email, how to map folders from Plesk on Mac and on Windows, and how to setup additional users so that you can allow others to upload files and access protected content. I’ll also show you how to share files without protection so they can be embedded easily into newsletters, emails or websites.

    With the right setup you can transform your Plesk server into an unlimited cloud storage system (much like DropBox, Google Drive, One Drive and the plethora of other services out there).

    Plesk uses the WebDAV protocol for file sharing and you can use the principles I’m showing here on any device that supports WebDAV. If you’re interested to do this on iOS, look into Good Reader.

    Let me know if you have any questions.

  • Jay Versluis 12:30 pm on September 8, 2014 Permalink | Reply

    How to add Icons and Banners for your Plugins hosted on 


    Screen Shot 2014-09-08 at 12.29.32

    WordPress 4.0 introduced a new way to browse Plugins in the admin interface: beautiful icons show up that make Plugins looks like Mini-Apps. When a user clicks on one they get a description right there and then without the need to browse to the WordPress site in a different tab. This gives easy and instant access to important info without disrupting the user experience. Simply put: it’s beautiful!

    It’s very simple to add your own icons and banners to this experience and stand out from the crowd. Let me show you how.

    Plugin Icons

    Create a square icon, much like you would for iOS and Android Apps. Avoid text and keep it simple. Icons can be either jpg or png (transparency is recognised in the latter format). You can upload two sizes with the following file names:

    • icon-128×128.jpg (or icon-128×128.png) for standard displays
    • icon-256×256.jpg (or icon-256×256.png) for retina/hi-res displays

    The second file is optional and will show up if a suer browses on an iPad or Retina Laptop. Both files need to reside in the plugin’s assets folder. This is something that is not download when a plugin is installed and only lives on the WordPress repo.

    Assets is the same folder that houses your screenshots you may have added which show up in the plugin descriptions. If yours live in the main plugin folder, perhaps now is a good time to move them into assets and keep downloads smaller.

    If you don’t already have an assets folder, create one in your root directory of your svn repo (as provided by the WordPress Plugin Master), on the same level as trunks, tags and branches:

    your-plugin-folder (root)

    Commit your files using your favourite SVN Tool and now they’ll show up in the WordPress admin interface as seen in the screenshot above. It’s that simple.

    Plugin Banners

    Banners were introduced to plugin authors sometime in July 2012. Back then they were only displayed on the site as part of your plugin URL, like this:

    Screen Shot 2014-09-08 at 11.48.04

    The new feature in WordPress 4.0 is that those banners now show up when a user clicks your plugin to get more information.

    And just like with icons, those banners live in the same assets directory and follow the same pattern for standard and retina displays. Banner sizes are 772×250 and 1544×500 respectively. Again both jpg and png formats are accepted:

    your-plugin-folder (root)

    Here’s what a banner looks like in the WordPress admin interface:

    Screen Shot 2014-09-08 at 11.50.08

  • Jay Versluis 8:46 am on September 8, 2014 Permalink | Reply  

    Installing legacy versions of WordPress in Plesk 12 

    In this screencast I will show you how to install an older version of WordPress in Plesk 12. This is useful if you’d like to test drive the WordPress Toolkit on a spare server before going live with its many new features. You can’t use the APS installer for this as it will always install the latest version of WordPress.

    I will explain where to download an older version of WordPress from and how to install it manually by creating a database first and then running the WordPress installer manually. In total I’m installing three WordPress instances in preparation for the WordPress Toolkit (I’ve explained how to use it in the previous video – you can check it out here:


    You can find all previous releases of WordPress in the Release Archive:


  • Jay Versluis 7:49 pm on September 2, 2014 Permalink | Reply

    Commodore Plus/4 Screen Memory Map (Display RAM) 


    The Commodore Plus/4 – like his other brothers – has memory areas in which screen characters and colour values are stored independently from each other. Because it uses the TED chip these memory addresses are different from the C64 and C128.

    Each character from the top left corner to the bottom right corner occupies one byte of memory, 40 columns across in 25 rows.

    Screen Memory

    • starts at 3072 (decimal) or $0C00 (hex)
    • ends at 4071 (decimal) or $0FE7 (hex)

    You can POKE screen display codes into each position using this formula:

    POKE 3072 + X + 40 * Y, Z
    // where 
    // X = current column
    // Y = current row
    // Z = screen display code
    // write the letter X into the top left corner of the screen
    POKE 3072, 24

    Note that there’s a difference between screen display codes (A = 1, B = 2…) and ASCII/PETSCII codes (A = 65, B = 66…). The latter are used when printing single charters via CHR$ or returning their values via ASC.


    Plus/4 Screen Memory

    Colour Memory

    • starts at 2048 (decimal) or $0800 (hex)
    • ends at 3047 (decimal) or $0BE7 (hex)

    You can POKE colour values into each cursor position using the following formula:

    POKE 2048 + X + 40 * Y, C + L * 16
    // where 
    // X = current column
    // Y = current row
    // C = colour value (0 to 15)
    // L = luminance value (0 to 7)
    // turn the character in the top left corner of the screen light red
    POKE (2048+0+0), 2 + 7 * 16
    // or
    POKE 2048, 114

    Luminance is a TED feature. It was an attempt to increase the colour palette which still only consisted of 16 colours (like on the C64) by adding brightness to each value. When compared to the “pure” 16 colours of its brothers, the Plus/4 palette looks a little weird (for example, the standard BASIC background is white according to its colour value, even though it appears to be some shade of “dirty grey”).

    You can add 128 to each value to make the character flash at the same frequency as the cursor.

    Contrary to the Plus/4 user guide, the colour values are as follows (values in brackets show the luminance variations):

    0  (16 32 48 64 80 96 112) = black
    1  (17 33 49 65 81 97 113) = white
    2  (18 34 50 66 82 98 114) = red
    3  (19 35 51 67 83 99 115) = cyan
    4  (20 36 52 68 84 100 116) = purple
    5  (21 37 53 69 85 101 117) = green
    6  (22 38 54 70 86 102 118) = blue
    7  (23 39 55 71 87 103 119) = yellow
    8  (24 40 56 72 88 104 120) = orange
    9  (25 41 57 73 89 105 121) = brown
    10 (26 42 58 74 90 106 122) = yellow-green
    11 (27 43 59 75 91 107 123) = pink
    12 (28 44 60 76 92 108 124) = blue green
    13 (29 45 61 77 93 109 125) = light blue
    14 (30 46 62 78 94 110 126) = dark blue
    15 (31 47 63 79 95 111 127) = light green

    Plus/4 Colour Memory

  • Jay Versluis 4:27 pm on September 1, 2014 Permalink | Reply
    Tags: , ,   

    The evolution of Flow Control in Commodore BASIC 

    Commodore-Logo-PaddedWhen I had a C64 back in the days, the only IF/THEN statement we could create in BASIC v2 was just that: IF and THEN.

    There was no ELSE, and everything had to be on a single line. It was the only flow control we had back in those days, and it was a severe limitation compared to what we can do with higher level languages today.

    Here’s an example:

    10 input x
    20 if x=1 then print"x is one" : goto 100

    Such constructs weren’t very convenient when you wanted to react to anything other than the tested value. Instead you had to write an IF statement for every possible other outcome which could make the code very cluttered with several GOTO statements.

    When the Plus/4 came out Commodore added the ELSE statement. It still had to be on the same line as the IF and THEN, but at least we had ELSE as an option:

    10 input x
    20 if x=1 then print "x is one" : else print "x is not one"

    ELSE needs to be on the same line as the IF/THEN statement and separated by a colon.

    ELSE was a very handy addition to the BASIC arsenal, but it still didn’t solve the problem that your evaluation had to be cramped into a single line. This was improved on the C128 with the introduction of BEGIN/BEND.

    BEGIN and BEND allowed you to execute as many lines of code as you wanted between those statements when a condition was true (or false). Used together with IF, THEN and ELSE it was a very useful thing to have:

    10 input x
    20 if x=1 then begin
    30 print "x is one"
    40 print "which is like totally awesome"
    50 rem more code here
    60 bend : else begin
    70 print "x was obviously not one"
    80 print "which is a shame"
    90 print "but that's life"
    100 bend

    BEGIN means that everything starting from now until BEND is met will be executed as part of the IF/THEN statement – as many lines of code you like.

    When BEND is met the code continues as normal – but we can also use ELSE after a colon on the same line, indicating that this is still part of the first IF/THEN statement. Here we can use BEGIN again for as many lines as we like, until we finish with BEND again.

    It was very very cool!



    sys 32800,123,45,6 to show these credits (thanks, team!)

  • Jay Versluis 3:54 pm on September 1, 2014 Permalink | Reply

    How to map your Commodore Keyboard in VICE 2.4 

    Commodore-Logo-PaddedVICE on the Mac isn’t without it’s vices (har har) – and one of them is the way the keyboard is mapped.

    There are two approaches to choose from: positional and symbolic. Positional means that the Commodore keyboard is mapped into the physical positions of your “contemporary” keyboard. So no matter what language keyboard you are typing on, the key next to the L will be a colon, the key next to that will be a semicolon, and so forth.

    Symbolic attempts to map your current keyboard’s characters to the ones you expect to appear on screen. Both approaches are of course approximations and you may need to tweak either layout to get the desired results.

    You can switch which between the positional and symbolic approach under Settings – Keyboard:

    Screen Shot 2014-09-01 at 15.25.56

    Creating your own layout

    You can also create your own keyboard layout by dumping the current keyset into a file (.vkm) and then selecting this file in either symbolic or positional. When you do, and every time you make a change to this file you need to reset VICE for the changes to take effect.

    If you examine the file you’ll see a list of seemingly random numbers that don’t make sense at first. The top part of the file is made of comments (starting with #) and attempt to explain what’s happening here. I must admit it didn’t help me much.

    The second part of the file shows you a bunch of numbers like these:

    0 1 2 8   # R
    1 1 5 8   # P
    2 2 2 8   # D
    3 2 5 8   # F
    4 3 5 8   # H
    5 3 2 8   # G
    6 1 4 8   # Z
    7 2 7 8   # X
    8 2 4 8   # C
    9 3 7 8   # V

    I’ve added the comments, so you may only have four numbers per row. Here’s what they mean:

    • the first number is the actual key on the Commodore keyboard
    • the second number is the COLUMN of the Commodore Keyboard Matrix
    • the third number is the ROW on the Commodore Keyboard Matrix
    • the fourth number is still a total mystery to me

    This mysterious Commodore Keyboard Matrix I was referring to can be found at Joe Forster’s page: (thanks, Joe!)

    In case the above link ever goes down, here’s a screenshot I’ve taken as a reference:

    Screen Shot 2014-09-01 at 15.34.50

    Both columns and rows start at zero, so if you’f like to change what is printed when you hit key number 5, change the two following numbers to the key you’d like to see.

    For example, on my VICE Plus/4 emulator the backspace/delete key wasn’t working. Turns out it wasn’t mapped in either file. Looking at both the C64 and C128 keyboard mapping files I found that the key in question is number 51. I’d like the INST/DELETE key to be printed when I press my backspace/delete key, so I’ve added the following line to my custom file:

    51 0 0 8   # Insert/Delete

    After saving, selecting and resetting the virtual machine, I was able to use the delete key as I hoped. Result!

    Note that the Mac mappings aren’t as good as the Windows ones. For example, the C128 Mac mapping always defaults to the positional layout, even when you select symbolic. It’s a bug and I’m sure it’ll be fixed at some point. International keyboards are another issue (I’m using a UK keyboard which makes things even more awkward).

    But with the aforementioned tweaks it’s easy to personalise every VICE emulator just the way you like it.

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