Hosting a WordPress blog on Digital Ocean

I’ve been running Kenst.com since 2009. While the content has changed over time, the site has remained a blog. Kenst.com has gone from self-hosted on a Windows Home Server in my living room, to Blogger, and ultimately to WordPress. It’s been migrated to and from so many different hosting providers over time that I’ve lost count.

For a time all my sites were hosted on a single “shared” plan. This meant all the sites shared the quasi-dedicated resources of the plan. The problem came when Kenst.com would take the full allocation of memory and crash everything. Even with Cloudflare caching the top pages the traffic was too much. It was time to get a little more serious about hosting.

(more…)

How to debug problems on Mobile Safari

When you are developing and/or testing a web app on iOS, having the ability to inspect and understand what is happening in the browser is incredibly useful. For just this reason Mobile Safari can use the same developer tools that are built into Safari on macOS.

To start debugging you’ll need your iOS device, a mac and a lightning cable. Then start by making sure both devices are configured to allow this.

Configure devices:

  1. Launch Safari on your mac; open preferences and within the advanced tab click the checkbox for “Show Develop menu in menu bar”.
    1. Confirm, you should now see a menu called Develop in the top bar
  2. On your iOS device (iPhone or iPad) go to Settings > Safari > Advanced and slide the toggle on for Web Inspector.

Debug a site in Mobile Safari:

  1. Connect your iOS device (iPhone or iPad) to your mac
  2. On the device browse to your site in Mobile Safari
  3. On your mac’s Safari, under the Develop menu you should see an option for your iOS device (either called iPhone or iPad).
  4. In that sub-menu you should see the url of the website you want to debug. Click that url and it will open a new Safari window with the full Safari Dev Tools.
  5. Start your investigation!

Safari Dev Tools

A few weeks back I was testing changes to review submissions (buy a product, leave a review) and on Chrome desktop everything worked fine (including Chrome’s mobile emulator). However after testing on a real device, Safari didn’t behave the same way. Luckily we were able to debug using this same method and fix those remaining issues before any customers saw problems.

It just goes to show real device testing matters!

Oh and if this article worked for you please consider sharing it or buying me coffee!

Installing ChromeDriver on Windows

Installing on Windows 7 & 10:

The following are the best ways to install ChromeDriver on Windows so you can run Selenium:

  • The easiest way to install ChromeDriver is to use a package manager such as Chocolatey. You should really have a package manager if you don’t now:
    1. Install Chocolatey. I used the cmd.exe method and it worked really quickly.
    2. Install ChromeDriver choco install chromedriver
    3. Confirm it was installed by typing chromedriver —version into your command line and seeing that it returns a version number. If it errors, ChromeDriver wasn’t installed.
  • Or run Chrome & ChromeDriver in a container such as Docker. Simply download the combined container, start it and point your code at the right address. Here’s an example.

Which methods have you found the easiest or most success with? Which methods didn’t work for you? Please leave a comment below. 

Oh and if this article worked for you please consider sharing it or buying me coffee!

How to set up Apple Pay on Mac (non TouchID)

According to Bailey, Apple Pay availability was limited to about 3 percent of stores in the U.S. when it launched in 2014, but is now accepted in 50 percent of stores. – Courtesy of AppleInsider.

At Laurel & Wolf we use Stripe to handle monies we collect from our customers. It’s a great service that takes care of many things including allowing us to accept Apple Pay. Although accepting Apple Pay means we need to test it, which I’ve been doing mostly from my iPhone. However I’ve been wanting to test it on my laptop and that means enabling it on macOS for Safari.

These instructions are for non TouchID macs. If you have a Mac with TouchID you can go to Apple’s website for easy set up.

Apple Pay Logo

Steps to enabling Apple Pay on non TouchID Macs

  1. On your iPhone confirm Apple Pay is active. If not set it up here.
  2. On your Mac sign-in to iCloud using your Apple ID. Without this you won’t have access to your Wallet’s cards.
  3. Allow websites to check if Apple Pay is set up on Safari.
    1. In Safari go to the menu called Safari > Preferences > Privacy > look for the Apple Pay section. 
    2. Note: It can take about 5-10 minutes to propagate after you sign-in to iCloud.
  4. Done! Any website or app with Apple Pay enabled for checkouts will render an Apple Pay button as a checkout option. To test this you can go to Stripe’s Apple Pay website and test it out. (Don’t worry purchases happen in their test environment.)
  5. There are a few caveats:
    1. This only works in Safari
    2. You can only complete the purchase if your iPhone is connected to your Mac. Apple Pay requires TouchID to authorize the purchase.

Oh and if this article worked for you please consider sharing it or buying me coffee!

Installing GeckoDriver on macOS

Overview of naming conventions

  • GeckoDriver is the library you need to download to be able to use Selenium WebDriver with Firefox. These are the Selenium Bindings.
  • Marionette is the protocol which Firefox uses to communicate with GeckoDriver. Installed by default with Firefox.
  • FirefoxDriver is the former name of GeckoDriver.

Ways to install GeckoDriver:

  1. The easiest way to install GeckoDriver is to use a package manager like brew or npm such as npm install geckodriver. This method requires you some package manager installed but you probably should anyways.
  2. Run Firefox and GeckoDriver in a container using Docker. Simply download the combined container, start it and point your code at the right address. I’ve written about how to do this using Chrome, should be very similar to do Firefox.
  3. Specify it in your Selenium setup code. If you go this route, you can include ChromeDriver as well.
  4. Download the driver and add its location to your System PATH. These instructions are for Chrome but should work for GeckoDriver as well.

Once this is done, it should work like nothing has changed. The big advantage is you’ll now be able to use Firefox browsers newer than 46!

Installing ChromeDriver on macOS

The ChromeDriver getting started guide isn’t super helpful if you are unfamiliar with including the ChromeDriver location in your PATH environment variable. (The PATH variable helps Chrome find the downloaded ChromeDriver exe). Also it’s a lot of work for something so common. Never fear, here is a better way:

Installing on macOS:

Listed in order of easiest to hardest install, these are the best ways to install ChromeDriver on a Mac:

  • The easiest way to install ChromeDriver is to use your package manager such as brew or npm to install the driver.
    • In your terminal window with the Homebrew package manager:
      • Install ChromeDriver with brew cask install chromedriver
      • Confirm it was installed using chromedriver --version and seeing it returns a version. If it errors it wasn’t installed
    • Other package managers like npm have similar commands npm install chromedriver
  • Run Chrome & ChromeDriver in a container using Docker. Simply download the combined container, start it and point your code at the right address.
  • Specify it in your Selenium setup code and check it into source control like any other configuration detail. If you go this route, you can include additional drivers like GeckoDriver (aka Firefox) as well.
  • Download the driver and add its location to your System PATH.

Which methods have you found the easiest or most success with? Which methods didn’t work for you? Please leave a comment below. 

Additional Resources

Oh and if this article worked for you please consider sharing it or buying me coffee to say thanks.

Including the ChromeDriver location in MacOS System PATH

The ChromeDriver getting started guide isn’t super helpful if you are unfamiliar with including the ChromeDriver location in your PATH environment variable. The PATH variable helps Chrome find the downloaded ChromeDriver exe. Don’t get me wrong, I’ve updated PATH variables on Windows for years but never on a Mac, until now:

System PATH Setup

The following instructions will help you create your own PATH to a unique folder on your Mac or copy the file to an existing PATH directory for ChromeDriver.

  1. Download the ChromeDriver executable.
  2. Now we need to tell Selenium where it is and for that we have a few choices.To do this:
    1. Open up Terminal
    2. Run sudo nano /etc/paths
    3. Enter your password
    4. Go to the bottom of the file and enter the path you wish to add
    5. My PATH looks like: /Users/myname/Documents/WebDriver
    6. Control-x to quit
    7. Y to save
    8. Press enter to confirm
  3. To double check, quit Terminal and relaunch it. Run echo $PATH. You should see your newly added path in the stream of other paths already there.
  4. Finally, update your tests to run using Chrome and run your tests!

After running your tests, if your PATH isn’t set up correctly you get this helpful message:

Selenium::WebDriver::Error::WebDriverError: Unable to find the chromedriver executable. Please download the server from http://chromedriver.storage.googleapis.com/index.html and place it somewhere on your PATH. More info at http://code.google.com/p/selenium/wiki/ChromeDriver.

Did this work for you? Did it solve your problem? Please leave a comment below. 

Additional Resources:

Oh and if this article worked for you please consider sharing it:

Or buying me coffee.

Set VLAN ID on a Network Adapter in Windows 7

Here are the steps to set a VLAN (Virtual LAN) ID on a network adapter in Windows 7:

 

    1. Right click on Computer > Click Properties
    2. Click Device Manager
    3. Expand Network Adapters
    4. Right click on the adapter you want to set the VLAN for > Click Properties
  1. Click on the Advanced Tab
  2. Under the Property window select VLAN ID
  3. In the Value window set your VLAN ID
  4. Click OK.

Your VLAN ID is now set. This same procedure should work in other versions of Windows with a slight variation.