Updates from December, 2014 Toggle Comment Threads | Keyboard Shortcuts

  • Jay Versluis 12:06 pm on December 30, 2014 Permalink | Reply
    Tags: Stack Overflow   

    Categories: How To ( 36 )   

    How to find your starred questions (favourites) in Stack Overflow 

    Stack-Favourites

    You can mark questions in the Stack Exchange network simply by clicking the little star icon. A yellow star means you’ve marked it as a favourite, a grey one means you haven’t. It’s a convenient bookmarking system.

    But where can you see a list of what you’ve starred? It’s not exactly obvious, so let me show you how to access your favourited questions and up voted answers. I’m using Stack Overflow as an example, but the principle is the same on all Stack Exchange sites.

    • head over to your Stack Overflow profile (click on your badge at the top)
    • find favorites at the bottom
    • now select added to see your starred/favourited questions
    • or select votes to see which answers you’ve up-voted

    Hope this helps!





     
  • Jay Versluis 3:21 pm on December 29, 2014 Permalink | Reply
    Tags: ,   

    Categories: Windows ( 22 )   

    How to change your DNS Servers in Windows 

    DNS is a service that translates a domain name into a numeric IP so that one computer can talk to another. We deal with it all the time, but most mere mortals are not aware of their importance. In this article I’d like to show you how to change your computer’s DNS entries in Windows.

     

    Why change DNS Servers?

    In a nutshell, if all works well on your system, perhaps you don’t need to tweak those settings. However, if you can consistently see some websites but not others, or you get weird intermittent connection problems, then your DNS entires may be querying servers that are not as “hot” as others.

    Faster DNS Servers can provide quicker answers, resulting in faster results when browsing.

    When the IP address of a domain changes, it takes a while for this change to propagate through the world. Some servers know changes quicker than others. Some servers may not see new data at all for several days.

    ISPs and corporate networks usually provide their own DNS Servers, but it’s never clear how good they are. Google and OpenDNS provide very fast and free services which usually outperform those provided by your ISP or corporate network.

     

    Change DNS Servers in Windows 7, Windows 8.1 and Windows 10

    It’s not easy to find this hidden option, but the good news is this works on all flavours of Windows.

    Search for “Network and Sharing Center” which will bring up a window that lets you choose the option “Change adaptor settings”. This will bring up the list of networks, one of which is likely connected to the internet.

    Screen Shot 2014-12-29 at 15.15.01

     

    In my case it’s a LAN connection, but it could also be a WiFi connection. Right-click the appropriate one and choose Properties.

    The next window looks rather scary and isn’t very intuitive for humans. Scour the list for something that relates to Internet Protocol Version 4 (TCP/IPv4) as highlighted here:

    Screen Shot 2014-12-29 at 14.10.08

    Select this item and click Properties. Another scary window opens. This one has two parts on the General Tab, and it’s the lower one about DNS that we’re interested in (the top part is for obtaining an IP address – let’s leave it alone).

    The default is “Obtain DNS Server automatically” which means we have no idea who is being queried. Instead, select “Use the following DNS server addresses” and add both DNS Servers of your choice. In this screenshot I’m using Google’s DNS:

    Screen Shot 2014-12-29 at 14.11.25

    As soon as you hit OK the changes will be in effect. You can close all other windows we opened during the course of this setup.

     

    Popular DNS Servers

    Google’s DNS Servers are:

    • 8.8.8.8
    • 8.8.4.4

    The OpenDNS Servers are:

    • 208.67.220.220
    • 208.67.222.222

    There are many other free and premium DNS Servers you can use. Search for “free dns servers” and see lists like these: http://pcsupport.about.com/od/tipstricks/a/free-public-dns-servers.htm

    Have fun 😉





     
  • Jay Versluis 1:02 pm on December 29, 2014 Permalink | Reply
    Tags: , GMX,   

    Categories: iOS ( 222 )   

    How to override auto-detected Email Settings in iOS 

    IMG_5845.PNG

    The nature of any automation is that sometimes it just doesn’t work. Apple’s iOS is no exception.

    When you add a new email account on your iOS device, several mail providers’ settings can be auto detected. It’s there to make our lives easier so that we don’t have to add details for mail servers and ports manually. Yahoo Mail and Gmail.com are detected perfectly, but other services – for example GMX – are not.

    This is no problem if iOS simply says that you need to add details manually (as with Plesk mail), but it is an issue if iOS has detected the correct POP settings and you’d much rather use IMAP. iOS offers no way to change these settings when auto detection was successful.

    There’s a trick which will let you specify your own settings by bodging your password. Do the following:

    • under Settings – Mail, Contacts, Calendars – add a new account
    • choose other, then select Add Mail Account
    • This will show you a dialogue similar to the one in the screenshot above. Fill out your details but deliberately choose the wrong password. A single letter of your choice will do.
    • Hit Next and the auto-detection goes to work, telling you the password was wrong.
    • Now configure the settings to your liking, including a choice of POP and IMAP, incoming and outgoing mail servers, encryption options and ports.

    I found this out by helping my friend Oliver leave POP behind for good on his new iPhone 6. In case you need the GMX IMAP details, they can be found here:





     
  • Jay Versluis 10:04 pm on December 24, 2014 Permalink | Reply  
    Categories: Linux ( 101 ), Plesk ( 76 ), WordPress ( 145 )   

    FIXED: The wp-content folder does not show itself via FTP in Plesk 12 and CentOS 7 

    Screen Shot 2014-12-24 at 21.49.49

    I’ve noticed a weird bug in Plesk 12 on CentOS 7: when you connect via FTP, the wp-content folder does not show up – all other folders can be seen as usual. It’s a rather crucial folder for WordPress users.

    At first I had suspected a problem with the ProFTP service which is not the stock version, but a specially compiled version for use with Plesk, and Plesk takes care of this system services (it’s called psa-proftpd in case you’re interested). But ProFTP is not the problem.

    Thanks to the amazing Sergey Lystsev from Parallels for letting me know that the issue is instead with SELinux: when it’s used in Enforcing mode (which is the default), wp-content does not show itself via FTP. Switching it to Permissive mode or disabling SELinux altogether solves the problem.

    The entire issue will be fixed in the next release of Plesk, and it’s already working in the latest update to the Plesk Preview 12.1.13. CentOS 5 and 6 are not affected.

    How do we fix it, Cap’m?

    To disable SELinux on CentOS 7 we can use this:

    setenforce 0
    

    Or, to switch to permissive mode, use this:

    setenforce permissive
    

    Now we’ll need to restart the xinetd service as well as Plesk for the changes to take effect:

    systemctl restart xinetd.service
    service psa stopall
    service psa restart
    

    Connect to your site via FTP and see if the wp-content folder shows itself.

    To permanently change the SELinux configuration so that it survives a server restart, check out my other article here:





     
    • Ronald 7:56 am on January 20, 2015 Permalink | Reply

      Thanks a lot for this post! I was experiencing the exact same problem and this solved it. Thanks.

      • Jay Versluis 9:16 am on January 20, 2015 Permalink | Reply

        You’re very welcome, Ronald!

  • Jay Versluis 6:36 pm on December 18, 2014 Permalink | Reply
    Tags:   

    Categories: Plesk ( 76 )   

    How to allow Passive FTP Connections in Plesk 

    Plesk-LogoA little while ago I’ve written an article about opening Passive FTP Ports specifically for using Plesk on Amazon AWS. Here’s a slightly more condensed version about how to do this on any server if you need it.

    Passive FTP ports are not open by default when you install Plesk. To make it happen we need to patch the ProFTP configuration with a range of ports (anything between 49152 and 65534) and open the same range in our firewall.

    You’ll find the ProFTP config file in /etc/proftpd.conf. There’s no need to open the whole available range, I’ll settle for 99 possible ports here. Add the following somewhere at the top of the file, outside any global declarations:

    # adding passive ports and public IP address
    PassivePorts 50001 50100
    

    For the changes to become effective we’ll need to restart the xinetd service which ProFTP is part of in Plesk:

    service xinetd restart
    

    This will allow passive connections – but you also need to open those in your firewall. The easiest way to do this is via the Firewall Extension in Plesk:

    Screen Shot 2014-12-18 at 18.20.48

    Select Modify Firewall Rules, then Add Custom Rule. Give it a title, then add your port rage and click OK. Your changes are not effective yet because Plesk needs to restart the firewall service. To do this hit “Apply Changes”, followed by “Activate”. Wait a moment and Plesk will have taken care of it.

    If you don’t want to use the extension, here’s how you can open those ports manually. On CentOS 6 you can manually add that port range on the command line like this:

    iptables –I INPUT –p tcp --dport 50001:50100 –j ACCEPT
    service iptables restart
    

    On CentOS 7 you can do it like this:

    firewall-cmd --zone=public --add-port=50001-50100/tcp --permanent
    firewall-cmd --reload
    

    Testing testing… this thing on?

    To make sure everything is working, simply use your favourite FTP client and try to make a passive connection. If you get timeout errors something isn’t right.

    You can also use a great web based tool to check if passive connections are working thanks to Tim Kosse: https://ftptest.net

    Enjoy!

    Further Reading





     
  • Jay Versluis 8:03 pm on December 8, 2014 Permalink | Reply
    Tags:   

    Categories: Linux ( 101 )   

    How to quit vi without saving your changes 

    It just occurred to me that even though I know my way around vi fairly well, I never had to quit it without saving my changes. Usually I just go back in and overwrite my mistakes.

    Today I did something though that wasn’t as easy to eliminate: instead of pasting an IP address, I accidentally pasted a 4000+ character stylesheet. Dang!

    So how do we leave vi and NOT save our changes? Here’s how:

    • press ESC to exit editing mode (insert/append/whatever)
    • press : (the colon character)
    • enter q!

    Now you’re back on the command line without any saved changes.

    Remind me: how do we SAVE changes again?

    There are several ways of doing this, but my personal favourite is this:

    • press ESC to exit editing mode (insert/append/whatever)
    • press SHIFT + Z twice

    This will put you back on the command line and your changes are saved.





     
  • Jay Versluis 2:07 pm on December 8, 2014 Permalink | Reply
    Tags: ,   

    Categories: Linux ( 101 )   

    How to control SELinux in CentOS 7 

    SELinux – when installed – can take on one of three modes:

    • Enforcing
    • Permissive
    • Disabled

    To check which mode SELinux is running on, we can use either sestatus for a more detailed output, or simply getenforce for a one liner:

    sestatus
    
    SELinux status:                 enabled
    SELinuxfs mount:                /sys/fs/selinux
    SELinux root directory:         /etc/selinux
    Loaded policy name:             targeted
    Current mode:                   enforcing
    Mode from config file:          enforcing
    Policy MLS status:              enabled
    Policy deny_unknown status:     allowed
    Max kernel policy version:      28
    

    getenforce on the other hand will literally just say a single word, like “Enforcing”.

    To change this mode, edit /etc/selinux/config:

    vi /etc/selinux/config
    
    # This file controls the state of SELinux on the system.
    # SELINUX= can take one of these three values:
    #     enforcing - SELinux security policy is enforced.
    #     permissive - SELinux prints warnings instead of enforcing.
    #     disabled - No SELinux policy is loaded.
    SELINUX=enforcing
    # SELINUXTYPE= can take one of these two values:
    #     targeted - Targeted processes are protected,
    #     minimum - Modification of targeted policy. Only selected processes are protected. 
    #     mls - Multi Level Security protection.
    SELINUXTYPE=targeted
    

    Change the file according to the comments and restart the system for the changes to take effect.

    setenforce command

    If SELinux is running and either set to Enforcing or Permissive, you can change its mode on the fly without restarting the server using the setenforce command like so:

    // switch to permissive
    setenforce permissive
    
    // switch to enforcing
    setenforce enforcing
    
    // disable SELinux
    setenforce 0
    

    You won’t get any feedback if all goes well. Note that if SELinux is disabled, the setenforce command won’t work.

    setenforce is practical if you’d like to change the SELinux policy only temporary and your settings will not be retained. So the next time you restart the server, SELinux will come back with whatever is set in /etc/selinux/config.

    Find out more about SELinux and what it’s good for here:





     
  • Jay Versluis 3:58 pm on December 5, 2014 Permalink | Reply
    Tags:   

    Categories: MySQL ( 19 ), WordPress ( 145 )   

    How to find and replace in MySQL with phpMyAdmin 

    mysqlSometimes you need to replace a string in your database with another string, and it can be rather tedious to plough through a large table manually. Thankfully MySQL can execute raw queries such as find and replace.

    This comes in handy if you’ve moved a WordPress installation to another URL: you only need to tweak two values in the options table, but there may be countless image references and links in the posts and options table too. That’s where find and replace can come in handy.

    You can execute the following statement either on the MySQL command line, or use phpMyAdmin’s Raw SQL option:

    Screen Shot 2014-12-05 at 15.42.10

    That big text field is where we’ll use the following code. Before we do however, make a backup of your database because there is NO UNDO FUNCTION in MySQL. A cute typo can break things beyond repair!

    Here’s what the find and replace statement looks like in principle:

    update table_name set field_name = replace(
    field_name, 'original text',
    'replacement text');
    

    For WordPress specifically, if you’d like to replace text strings inside posts and pages, then wp_posts would be your table, and field_name is the column of that table. So for wp_posts this will be post_content. You can see the field labels at the top of each column when you select a table.

    To replace a URL in all posts and pages the statement would look like this:

    update wp_posts set post_content = replace(
    post_content, 'http://oldurl.com/',
    'http://newdomain.com/subfolder/');
    

    As soon as you hit GO, MySQL will go to work and show you a success or failure message. The above would replace all image references and links from your old domain to the new one, where WordPress is installed in a subfolder.

    Make a note of your table prefix and replace it accordingly. wp_ is the default, but this can easily be changed into something else for security reasons. Be cautious of trailing slashes when you’re replacing URLs.

    Also note that a small letter “l” and a capital “I” look surprisingly similar in the phpMyAdmin! If you keep getting errors like “this table does not exist”, it’s something to watch out for before questioning your sanity again 😉

     

    Replacing URL strings in WordPress

    I use this technique when I need to replace URLs across an entire WordPress installation. Those can hide not only in posts, but also in widgets and menus. Here’s a list of places to hunt for them:

    • wp_posts table, in the posts_content field (links inside posts and pages)
    • wp_links table, in the link_url field (the old Link Manager)
    • wp_postmeta table, in the meta_value field (URLs of Custom Menu items)
    • wp_options table, in the option_value field (anything saved by themes and plugins)
    • wp_comments table, in the comment_content field (URLs inside comments)

    And while we’re talking about replacing URLs: if you need to change the root URL of a WordPress installation, this is done in wp_options too. Look for two values called siteurl and home.

     

    Further Reading





     
    • Vincent 11:46 am on August 30, 2015 Permalink | Reply

      This works perfectly. You just saved me a very long Sunday having to manually adjust every image URL after a mass migration of a blog with over 12 posts within it. As you say – one should be cautious in regards to the trailing slashes. Thanks

      • Vincent 5:29 am on August 31, 2015 Permalink | Reply

        Correction – should read: ‘over 1200 posts’

    • Ramón Carmona 2:23 pm on October 26, 2015 Permalink | Reply

      Really this is the most complete and concise guide that will help anyone trying to change their wordpress site from one url to another. I think not even wordpress explains this topic in a detail. Thanks for the post Jays Versluis

      • Jay Versluis 11:38 am on October 27, 2015 Permalink | Reply

        Thank you 🙂

    • Jerry 3:53 pm on January 1, 2016 Permalink | Reply

      Thanks! Exactly what I needed. What I thought was going to take me hours took less than a minute (needed to update image URLs in all posts.)

    • Md. Ariful Islam (@cpncb) 12:38 pm on October 9, 2016 Permalink | Reply

      Thanks .

    • Estudio 27 Asturias 4:12 am on August 3, 2017 Permalink | Reply

      Me ha parecido de gran ayuda.
      gracias

    • BabyUnicornTeeth 4:55 pm on December 13, 2017 Permalink | Reply

      Thanks so much for this super helpful post! I was able to update my http image urls to https in no time at all

    • Zach Hayter 8:33 am on May 20, 2018 Permalink | Reply

      Little template I made for those looking to do a SITE WIDE SEARCH AND REPLACE ALL (May 2018) :::

      update wp_posts set post_content = replace(
      post_content, '',
      '');
      
      update wp_links set link_url = replace(
      link_url, '',
      '');
      
      update wp_postmeta set meta_value = replace(
      meta_value, '',
      '');
      
      update wp_options set option_value = replace(
      option_value, '',
      '');
      
      update wp_comments set comment_content = replace(
      comment_content, '',
      '');
      

      (AND ONLY IF YOU USE YOAST) :::

      update yoast_seo_links set url = replace(
      url, '',
      '');
      
      • Jay Versluis 8:45 am on May 20, 2018 Permalink | Reply

        Zach!! Thank you so much for sharing – that’s a great solution in PHP.

  • Jay Versluis 4:17 pm on December 4, 2014 Permalink | Reply  
    Categories: Windows ( 22 )   

    How to boot Windows into Desktop Mode, bypassing the Metro Start Screen 

    I’ve just installed the Windows 10 Technical Preview on my Samsung NC10. During the installation I was offered to transfer my settings from another PC, so I chose my Surface Pro running Windows 8.1.

    All settings were copied truthfully, including the fact that Windows boots up with the Metro Start Screen. It’s not what I had expected, mainly because my other Windows 10 installations don’t do this. So how do we change this behaviour?

    It’s very simple, let me show you how. This works on both Windows 8.1 and the Windows 10 Tech Preview.

    Enter Desktop Mode, then right-click the Task Bar at the bottom of the screen. Anywhere will do, as long as it’s not over an icon. Select Properties, then choose the Navigation tab at the top. You’ll see something like this:

    Screenshot (85)

    Tick the box that says “When I sign in, go to the Desktop instead of the Start Screen”. Windows may sign you out on this occasion, and when you’re signed in you’ll boot straight into Desktop mode.

    Windows 10 Start Menu

    New in Windows 10 is the Start Menu, as seen from Windows 95 to Windows 7. Microsoft have brought it back in Windows 10, but its use is optional. The Start Menu is enabled on new installations by default, but since I had copied all settings from a Windows 8.1 it was disabled.

    To bring it back, choose the Start Menu tab and tick the top box that reads “Use the Start Menu instead of the Start Screen”.

    Screen Shot 2014-12-04 at 16.13.05

    Don’t look for this option in Windows 8 – it’s only available in Windows 10.





     
    • Larry Swiger 2:23 pm on August 26, 2015 Permalink | Reply

      why do I have to log into my hotmail Account before the start screen? can i turn this off? My family would like to use the computer also!

      • Jay Versluis 6:26 pm on August 26, 2015 Permalink | Reply

        Hi Larry, you can indeed: search for ‘accounts’ and you’ll find a section called ‘Your Account Settings’. Select it and you’ll find several options, one of which is ‘Sign-in Options’. You can enable logging on with a PIN number or an image instead of your Hotmail password.

        Under the ‘Your Account’ section you can disconnect your Hotmail (Microsoft Account) if you wish.

    • Mark 12:03 am on August 28, 2015 Permalink | Reply

      I did a clean Windows 10 Pro install and my taskbar and start menu properties do not have the options you have shown. Navigation only has “Corner Navigation” replace command prompt choice. No Start Menu tab.

      • Jay Versluis 5:22 pm on August 28, 2015 Permalink | Reply

        Maybe this option only existed in the Preview, perhaps they’ve moved it elsewhere in the release. I’m still waiting for mine to come through.

    • Santiago (@SantiagoWrds) 10:34 pm on January 8, 2016 Permalink | Reply

      System > Tablet Mode > When I Sign In > Go To The Desktop…

    • Dennis 2:42 am on July 29, 2017 Permalink | Reply

      I do not have “properties” when i right click the task bar. I want to boot to the desktop not the start screen. I have ver, 1703 os build 15063.483. My laptop boots to desk top. My new desktop does not. both have the same build and version. This is driving me crazy!!

      • Jay Versluis 9:26 am on July 29, 2017 Permalink | Reply

        Hi Dennis, I believe the way this works has changed dramatically since I wrote this post in 2014. In the current version of Windows 10 (Creator’s Update), search for Start Settings. There’s an option called “Use Start full screen”. Turn that off and Windows should show your Desktop upon start, and you’ll only see the Metro tiles on the left, when you actually select the Start button.

        Another possibility is that you have Tablet Mode active. Turn it off by sliding in from the right, or search for Tablet Mode Settings. There’s an option called “When I sign in”, choose “Use Desktop Mode”.

        Good luck!

  • Jay Versluis 11:54 am on December 4, 2014 Permalink | Reply  
    Categories: MySQL ( 19 ), Plesk ( 76 )   

    How to move databases between subscriptions in Plesk 

    You can move databases and database users between subscriptions in Plesk. There’s no web interface for this, but with a bit of manual database tweaking you’ll soon get the hang of it.

    I recently split a subscription into two for a client and this trick came in handy.

    Before we begin, make sure you backup the psa database – that’s what Plesk uses to keep track of internal values, anything from user names, passwords, and which service is associated with what. If you ruin psa you’ll ruin your Plesk installation. Use caution!

    Editing psa

    You can use phpMyAdmin from Plesk to edit the psa database. Head over to Tools and Settings (or the Server Tab), Database Servers and click the little wrench icon. This will open phpMyAdmin in a new window.

    Screen Shot 2014-12-04 at 11.34.02

    Find the psa database and click on the little disclosure plus icon. This will show you all its tables, similar to this:

    Screen Shot 2014-12-04 at 11.37.24

    Scroll down to find data_bases and db_users. Open either of them (with the little disclose icon again) and you’ll find a list of databases and users respectively. Note the column dom_id. This is how Plesk knows which subscription (or domain) this database belongs to. MySQL takes care of the actual database, the value here is for visual representations in Plesk only.

    The difficult bit is to find out which numeric dom_id translates into which domain. There’s not an easy way to extract that info from Plesk, so we’ll use a quick workaround: create a new identifiable database (and user) in the subscription we’d like to move to and simply look at which dom_id it gets.

    Creating a Dummy Database

    Back in Plesk, head over to the subscription you’d like to move your database to and create a memorable user/database combo. Anything will do, we’ll delete this later. Call it “aaaaaaaaa” or “comehere” – up to you.

    Once done, head back over to psa database in phpMyAdmin, refresh and look at the data_bases (and db_users) again. You’ll see something like this:

    Screen Shot 2014-12-04 at 11.50.55

    Now we know that our important_database (and important_user) need a dom_id value of 2 instead of 1. Change it in both tables – and you’re done!

    Head back into Plesk and check your subscriptions: the database and user will have disappeared from subscription 1 and will now appear in subscription 2.

    Thanks to Matt Nelson for this tip!





     
    • Paul Martin 5:04 pm on July 9, 2015 Permalink | Reply

      Thanks for help been looking for this since upgrading 11 to 12. BUT when I did above I could not access the copied database via phpMyadmin on the domain I copied database. I got a loop error. When I tried to simply copy the new database I got error that I couldn’t. I wondered if it was due to permissions in the database still linking to the domain it was copied from?

      • Jay Versluis 10:03 am on July 10, 2015 Permalink | Reply

        Hi Paul, I’m afraid I’ve never encountered this problem before – I’m not sure what to make of it. If Plesk gives you any trouble, you can simply read out the database and recreate it manually under a different subscription. It’s more work, but at least that way Plesk does not complain.

c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel