Updates from April, 2014 Toggle Comment Threads | Keyboard Shortcuts

  • Jay Versluis 12:16 pm on April 16, 2014 Permalink | Reply  
    Categories: Plesk ( 76 )   

    How to find out which user ID belongs to which domain in Plesk 

    Plesk-LogoThe other day I found that one of the domains on a busy server was sending unsolicited spam mail thousands of times a day. It happens: the nature of open source scripts is that they will get hacked if they’re not updated regularly.

    The clue was a full-up mail queue and Gmail no longer accepting mails from the IP in question.

    When I examined one of the spam mails I found a line like this:

    X-PHP-Originating-Script: 10040:listr3b.php

    Good to know the spam was sent from a PHP script… but from which domain? All we have here is the user ID of the domain in question (10040) but that doesn’t mean much to the average human administrator.

    Here’s how to translate that Plesk User ID into the domain it’s coming from:

    grep 10040 /etc/passwd

    Replace the user ID with your own, and the result is the user name, as well as the domain path in question.

  • Jay Versluis 2:17 pm on April 14, 2014 Permalink | Reply  
    Categories: iOS ( 222 ), Screencast ( 87 )   

    Creating a Searchable Table View in iOS 

    Xcode_iconIn this 6-part series I’ll show you how to create a searchable UITableView in an iOS App. We’ll start with a standard single view application template in Xcode, create a table view with dummy data, and finally make it searchable.

    This course demonstrates how to do this with Xcode 5.1 and iOS 7.1. We’ll also make the app compatible to for in iOS 6.

    These are the first two parts which are available for free. The rest of the course is only viewable by members of my iOS Dev Diary at pinkstone.co.uk.

    You can get the source code and follow along here:



  • Jay Versluis 11:02 am on April 14, 2014 Permalink | Reply
    Tags: ,   

    Categories: WordPress ( 145 )   

    How to style captions in Twentythirteen 

    I love the Twentythirteen theme – except for the captions that appear underneath images. If you’ve ever seen them they look so out of place as if someone forgot to style them altogether. Here’s what they look like by default:

    Screen Shot 2014-04-14 at 10.47.48

    Notice how the captions are actually larger than the post text. I wanted to drop this size a bit, but at the same time integrate the text better with images I post over at http://www.versluis.com, adding a bit of padding, some rounded corners and perhaps tint the background colour ever so slightly.

    Here’s what I came up with:

    Screen Shot 2014-04-14 at 10.47.08

    And here’s how I did it:

     /* make captions smaller */
     .wp-caption .wp-caption-text {
    	 font-size: 1.0em;
    	 padding: 10px;
    	 -webkit-border-bottom-right-radius: 10px;
    	 -webkit-border-bottom-left-radius: 10px;
    	 -moz-border-radius-bottomright: 10px;
    	 -moz-border-radius-bottomleft: 10px;
    	 border-bottom-right-radius: 10px;
    	 border-bottom-left-radius: 10px;

    Add this to your theme’s style.css file or override your stylesheet with an appropriate option. Here’s what this code does:

    First we’ll reduce the 18 point caption size and bring it in line with the rest of the post text (1em). Then we’ll tint the background colour to a very light hint of grey. We’ll also add a bit of padding around all edges of the text, it looked a bit cramped in there before.

    The second larger block is creating rounded corners at the bottom of the caption, but not at the top so it looks like an attachment. There’s a remarkable tool that lets you visually set this and return some code at http://border-radius.com – go check it out and have a play.

  • Jay Versluis 5:56 am on April 9, 2014 Permalink | Reply  
    Categories: Plesk ( 76 ), Screencast ( 87 )   

    Moving WordPress with Plesk 11.5 

    Plesk-LogoIn this screencast I will show you how to move a WordPress website from one Plesk server to another without the Migration Manager.

    We’ll extract the files on the source server and export the database. Then we’ll create a new WordPress instance on the destination server and upload the files and import the database. All that remains is to point the domain to the new IP.

    I’m doing this without the Migration Manager because the source server is an Amazon EC2 instance and does not allow root access with a password (which the Migration Manager needs – and Plesk doesn’t yet have a feature that allows me to use a keyfile instead).

    The workflow is entirely web-based and you won’t need anything other than your favourite web browser.



  • Jay Versluis 4:27 pm on April 8, 2014 Permalink | Reply  
    Categories: WordPress ( 145 )   

    How to remove buttons from Distraction Free Writing Mode (Full Screen Editor) in WordPress 

    wordpress-iconNow that we’ve learnt how to add buttons to the Full Screen Writing Mode in WordPress, let’s see how we can remove them too.

    Just in case Zen Mode isn’t zen enough for you.

    Imagine that you have never in your life blockquoted anything, and rather not start anytime soon, there’s how to remove the block quote button.

    function removeFullscreenButtons($buttons) {
    	unset ($buttons['blockquote']);
    add_action ('wp_fullscreen_buttons', 'removeFullscreenButtons');

    Just like before, we’re taking an array of buttons and remove the objects we don’t want. Since they were addressed with an index title (blockquote in our case), you must unset them in the same way. Once gone we return the array, and WordPress does not display said button anymore.

    To figure out what that index text is, refer to this table and try to figure it out: http://www.tinymce.com/wiki.php/TinyMCE3x:Buttons/controls

    Kudos to Renji from Sumtips for his helpful article on this topic: http://sumtips.com/2013/01/remove-or-add-buttons-in-wordpress-distraction-free-writing.html

  • Jay Versluis 4:03 pm on April 8, 2014 Permalink | Reply  
    Categories: WordPress ( 145 )   

    How to add buttons to Distraction Free Writing Mode (Full Screen Editor) in WordPress 

    wordpress-iconI really like the Distraction Free Writing Mode that WordPress offers. I mean the one you can access when you write a new post, then hit that big X and go into full screen mode.

    It’s Zen at large.

    But just in case there’s a single function you’d like to see up there as a button, because you’re using it all the time, there is a way to do it.

    Bear with me. These are the buttons I mean:

    Default Buttons in Full Screen Mode

    Default Buttons in Full Screen Mode

    Just in case you didn’t know: there are A LOT OF OTHER FUNCTIONS you get in this mode, much of which are hidden by the power of keyboard shortcuts. See that little question mark up there? Press it and see what else you can access at the speed of thought:


    Seriously, this is dynamite stuff! Chances are that if you’re looking for something, it’s already there – and at the ready with a keystroke.

    Anyway, let’s get back to that toolbar and see how we can tweak it.

    Adding Buttons in DFW Mode

    All that beautiful functionality is provided by an open source library called TinyMCE, a JavaScript WYSIWYG editor. That’s the tool that lets you see a word become bold while you’re typing it in your web browser. It’s powerful stuff, and WordPress relies on it a great deal.

    So really, all those buttons and their respective functionality is not coming from WordPress. Here’s a list of other functions that could potentially be up there as buttons:

    In this example I’m adding the three justifications to the editor: left, centre and right. Add this code to your theme’s functions.php file, or if you’re writing a plugin add it to your main plugin file:

    function yourFullscreenButtons($buttons) {
    	$buttons[] = 'separator';
    	$buttons['justifyleft'] = array(
    		'title' => __('Left'),
    		'onclick' => "tinyMCE.execCommand('justifyleft');",
    		'both' => false 
    	$buttons['justifycenter'] = array(
    		'title' => __('Center'), 
    		'onclick' => "tinyMCE.execCommand('justifycenter');", 
    		'both' => false 
    	$buttons['justifyright'] = array(
    		'title' => __('Right'), 
    		'onclick' => "tinyMCE.execCommand('justifyright');",
    		'both' => false 
    	return $buttons;
    add_action ('wp_fullscreen_buttons', 'yourFullscreenButtons');

    I know it looks a lot, but it’s relatively simple. Let’s go through this:

    1. First we’re adding a function that gets called via the wp_fullscreen_buttons action. As you may imagine, this is called when the entire toolbar is displayed in fullscreen mode.
    2. Our function takes a parameter ($buttons), which is an array of button objects that will show up there. We take it and add to the array with our own buttons.
    3. The first item we’re adding to the array is a separator, just so that our own buttons appear with a little distance. Take it out of you don’t like it.
    4. Next up are three button objects. We’ll talk about those more in a moment
    5. Finally we return the amended array and WordPress can display it.

    Each Button is made up of three ingredients: a Title (Left, Right, Center) which is displayed on hover. It also needs a TinyMCE function, which is the JavaScript onClick function that will make the selected text do what it does (i.e. justify it to the right). You’ll find the possible values in the link I mentioned earlier. And there’s a boolean TRUE/FALSE type value. This determines if the button shows up in the visual editor only, or if it also shows in the code editor.

    The result looks like this:


    Not only does it look swish, it also works out of the box! Is that cool or what?

    Thanks to the following links for helping me figure this out:

    • Steven Spungin 9:44 am on August 23, 2014 Permalink | Reply

      Nice, but you are missing a comma before the last ‘both’ => false

      • Jay Versluis 12:43 pm on August 23, 2014 Permalink | Reply

        Thanks for catching that Steven, much appreciated! I’ve just added the comma where it was sorely missed 😉

  • Jay Versluis 12:08 pm on April 8, 2014 Permalink | Reply
    Tags: ,   

    Categories: Linux ( 101 )   

    How to use FTP from the Linux Command Line 

    folder_downloadsYou can use the ftp command to talk to an FTP server from the Linux Command Line. Type ftp to see if the tool is installed. If you get a “command not found” message then go ahead and type yum install ftp to make it available on your system.

    Using it is very straightforward – but I keep forgetting how because I only do it once in a blue moon. So here’s a handy cheat sheet:

    Logging in to your FTP Server

    Assuming our site is example.com, simply type this:

    ftp example.com
    Connected to example (
    220 FTP-Example

    This will connect you, but the system wants to know the username and password at the prompt. Provide those and if your login was successful you’ll see something like this:

    230 User tester logged in
    Remote system type is UNIX.
    Using binary mode to transfer files.

    Note that you’re now at the FTP command line and no longer on the Linux command line (you can tell by the ftp> in front of the cursor). Therefore only FTP commands are now accepted, until you type “exit” or “bye” to go back to Linux.

    To see a list of available commands type help and you’ll see a list much like this:

    Commands may be abbreviated.  Commands are:
    !		debug		mdir		sendport	site
    $		dir		mget		put		size
    account		disconnect	mkdir		pwd		status
    append		exit		mls		quit		struct
    ascii		form		mode		quote		system
    bell		get		modtime		recv		sunique
    binary		glob		mput		reget		tenex
    bye		hash		newer		rstatus		tick
    case		help		nmap		rhelp		trace
    cd		idle		nlist		rename		type
    cdup		image		ntrans		reset		user
    chmod		lcd		open		restart		umask
    close		ls		prompt		rmdir		verbose
    cr		macdef		passive		runique		?
    delete		mdelete		proxy		send

    No need to panic: The good news is that we don’t really use a plethora of new commands, and some (like ls and mkdir) are working the same way, just the output may look a bit different.

    Let’s go through a few common scenarios now: listing and creating directories, uploading, downloading, and deleting files. Classic CRUD – FTP Style.

    If you ever need to come out of a running command, CMD-D (or CTRL-D) will do the trick.

    Listing and Switching Directories

    Your usual Linux favourites will work fine to list and switch directories:

    ls (list directory, same as dir)
    cd (change into directory, for example “cd mydir”)
    cd .. (move one directory up in the tree)

    Excellent: nothing new to learn here. Result!

    Creating and Deleting Directories

    Another nice thing is that mkdir is still working to create a directory. Here’s how we create a directory called test:

    mkdir test
    257 "/test" - Directory successfully created

    Likewise, rmdir does a good job at deleting (empty) directories:

    rmdir test
    250 RMD command successful

    To delete a directory that contains files you must first remove all files (see below under Deleting Files) and then use this command.

    Downloading Files

    To download a single file we can use the get command (or recv if you can remember it better). You must type out the entire file name for this to work, and you won’t get a progress report while your file downloads:

    get testfile.tar
    local: testfile.tar remote: testfile.tar
    227 Entering Passive Mode (81,169,163,229,179,131)
    150 Opening BINARY mode data connection for testfile.tar (86365356 bytes)
    226 Transfer complete
    86365356 bytes received in 11 secs (7865.17 Kbytes/sec)

    This will save testfile.tar in the Linux directory that you were before you initiated the FTP session.

    To save files in a directory other than the current one, I’m afraid you’re going to have to log out, cd into the directory you want those files to go, then re-connect. I know, ultra lame – but if there is another way then it’s kept so secret that no Google search will ever unveil it.

    Sadly wildcards are no working in this operation, so you’ll always have to type out the exact file name. Lucky for us you CAN use wildcards to download multiple files with mget, like this:

    mget test*

    Now all files starting with “test” are downloaded and you’ll be prompted one by one. This will work for single files too and saves you having to type out cryptic long names. Human 1 – FTP 0. Ha!

    Uploading Files

    put and mput work just like get, but they upload local files to the current FTP directory. You can specify a local Linux path when doing this, but put and mput expect a local path to also exist on the FTP remote (and fail if they don’t). Read: messy. There probably is a way to deal with this, but life’s just too short.

    Just like get, put also needs the whole file name and cannot deal with wildcards – but mput does:

    mput test*
    mput testfile.tar? y
    227 Entering Passive Mode (81,169,163,229,218,225)
    150 Opening BINARY mode data connection for testfile.tar
    226 Transfer complete
    236716 bytes sent in 0.0141 secs (16825.36 Kbytes/sec)

    Deleting Files

    There’s also a delete and mdelete command which – you guessed it – removes unwanted files from the server. Same as before: no wildcards on delete, but they work fine on mdelete:

    mdelete test*
    mdelete testfile.tar? y
    250 DELE command successful


    FTP transfers all files and passwords “in the clear” and does not work with encryption. Checkout the sftp command which will do all of this and more while using encryption on all transfers.

    Note that there is a difference between SFTP and FTPS: the latter (FTPS) is the same as FTP but with encryption added to it. SFTP isn’t really FTP at all, it’s an SSH connection that works much like rsync and scp, and uses similar syntax.

    Further Reading

    • Bhavani 7:55 am on April 6, 2015 Permalink | Reply

      I installed RHEL 6.1 on virtual box and now when i am trying to run ftp command it says command not found
      tried to install it by using yum and get command,it says no such directory/file
      please advise

      Thank you.

      • Jay Versluis 3:46 pm on April 6, 2015 Permalink | Reply

        Hi Bhavani,

        try using ‘yum install ftp’ – if it’s already installed you’ll see a message like ‘nothing to do’. If the ftp command isn’t called, perhaps your path variable doesn’t include /usr/bin (that’s where the command lives). In which case, try calling it with its full path:

    • Miriam English 3:39 am on October 10, 2015 Permalink | Reply

      Hi Jay, you can change the local directory without logging out and back in to the ftp session. Use the command “lcd” (for local current directory). It is a bit inconsistent with the other local commands which are accessed by prefacing with “!” such as “!ls” to list the current local directory’s contents, or “!pwd” to print the name of the current working directory. The exclamation mark bypasses the ftp program.

      A short description of any of the commands may be displayed from inside the ftp program by typing help followed by the command you want to know about, for instance “help newer”. I’ve been looking for a full list of them so I don’t have to go through typing all of them in turn. (That’s how I found your page.) I finally found one at:

      Incidentally, I hate having to worry about security, but I believe all the commands that work with ftp also work exactly the same with sftp, which has the advantage of using a secure connection so that username and password and other sensitive material can’t be (easily) snooped.

      By the way, I spent a few tries attempting to post a reply here until I realised I had to click on the link to “change” my login, which is counter-intuitive. WordPress already knows who I am, yet I need to nevertheless enter my details? This probably explains why you have few replies to an interesting article.

      • Jay Versluis 8:29 am on October 10, 2015 Permalink | Reply

        Hi Miriam, thank you so much for sharing those tips, I really appreciate it! I don’t often use FTP (or SFTP) from the command line, so I always forget how to do it when I have to 😉

        Not sure what’s going on with the WordPress login, but I’m glad you persevered and could post your comment.

        All the best,


        • Miriam English 5:07 am on October 11, 2015 Permalink | Reply

          No worries. 🙂

          Looking through the list at the link I posted I realised it is far from complete and it includes some commands that are not part of a standard commandline FTP program. So I edited it pretty extensively and uploaded the result to my website at:

          I hope it is of some use to you.

          • Jay Versluis 2:26 pm on October 15, 2015 Permalink

            Great list, and a great link – thank you, Miriam!

  • Jay Versluis 8:51 am on April 7, 2014 Permalink | Reply

    Categories: Screencast ( 87 ), WordPress ( 145 )   

    How to use P2 (screencast) 

    Apple_Podcast_logoIn this video I will show you how to get the most out of the revolutionary P2 WordPress theme. It allows front-page posting and is an ideal solution for jotting down notes or communicating with others.

    I will explain how to create lists with simple shortcuts, add links, how to embed YouTube videos by simply pasting the URL and some simple customisation options.


  • Jay Versluis 11:08 pm on April 5, 2014 Permalink | Reply
    Tags: ,   

    Categories: WordPress ( 145 )   

    How to add your own widget to the WordPress Dashboard 

    wordpress-iconNow that we’ve removed a few widgets, perhaps it’s time we add our own simple info box to the WordPress Dashboard.

    For example, we could provide a direct link to our support services. It’s handy for clients to know help is just a click away.

    Here’s how to add a simple box like that:

    //Add a new widget to the Dashboard
    function contact_help(){
         echo 'If you have questions about working with WordPress system, contact Jay at noreply@wphosting.tv or call 305-555-1234';
    function register_widgets(){
         wp_add_dashboard_widget( 'contact_help_widget', 'Need help?', 'contact_help');
    add_action('wp_dashboard_setup', 'register_widgets' );

    Add this code to your theme’s functions.php file. Note that if you (or your client) activates a different theme the widget will disappear.

    Here’s what the code does: first we create a function that simply writes out the text that’s displayed inside our widget (contact_help). Next in register_widgets we register our widget in the WordPress Dashboard. This won’t do anything yet, as the register_widgets function is not called. We do that in the next step when we hook it into the wp_dashboard_setup action.

    Remember this is sample code – you probably want to prefix your own functions with something unique.

    You can find out more in the WordPress Widget API.

  • Jay Versluis 10:49 pm on April 5, 2014 Permalink | Reply  
    Categories: Plesk ( 76 ), Screencast ( 87 )   

    Best Practices to Extend Plesk using the SDK 

    Apple_Podcast_logoThis is a presentation Andrey Kugaevskiy and I gave at Parallels Summit 2014 in New Orleans. We’ll show you what the SDK is and what it can do for you.

    If you would like to change the way Plesk behaves, or you want to integrate your application or service deep into the Plesk interface, then this session is for you. We’ll discuss the best practices for creating extensions that can be used to differentiate your services from everyone else or to promote your service to all Plesk instances online today.

    Links from the video:

    You can also check out my previous article on how to create an Extension in Plesk.



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