Author Archives: Patrick McGoohan

Using MySQL DATE_SUB to SELECT rows relative to a date range

DATE_SUB can be very handy if you’re trying to return rows from a database table relative to a date range. As the name suggests, it SUBtracts a time value from a DATE. It expects a date, as well as an INTERVAL argument consisting of a unit (such as DAY, WEEK, or YEAR) and quantity, like […]

Solving the “Two packages cannot share the same directory!” Composer error

If you use Composer to manage dependencies on your WordPress site, you probably know the name John P. Bloch. He maintains a regularly-updated fork of WordPress that’s tailored for use with Composer. It turns up a lot in WordPress boilerplate. Recently he made some changes to his fork, moving some of the core WordPress components […]

Simplifying SSH connections using SSH config

Using SSH to connect to a remote server is as simple as remembering the details: username, host, and password, plus any connection-specific quirks, like non-standard port. That said, the more remote servers to which you need to connect on a regular basis—each with its own access configuration—the more complicated a task it can become to […]

Configuring SSH to use a public / private key pair instead of a password

Sick of passwords? Simplify your life by configuring your SSH connection to use a public / private key pair instead. Before you get started, confirm you have SSH access to the remote server, as you’ll need it shortly. Generate the public / private key pair via the command-line: ssh-keygen -t rsa -b 4096 The -t […]

What to do when the keyboard stops showing up in Simulator

Has your keyboard disappeared from iOS Simulator? Don’t worry, there’s nothing wrong with your text fields or becomeFirstResponder. [Well, maybe there is but it’s not the problem here.] What’s happening is that Simulator thinks that you want to use your hardware keyboard (the one physically wired to the computer running Simulator) to manage text field […]

Fixing garbled htmlentities output by using the proper charset

If you’re running user-provided text through htmlentities and it’s coming out garbled, it’s likely that the page’s charset doesn’t match the one you used to encode the text. First, we confirm the encoding charset. Starting with PHP 5.4, the default charset is UTF-8, so assuming you’re running a reasonably modern version of PHP and you […]

Configuring a php.ini file for AddOn Domains hosted on GoDaddy

UPDATE It appears GoDaddy no longer supports multi-domain php.ini files. Instead, one has to put an ini file at the root level of each hosted domain. For the primary domain, the ini file would go in ~/public_html/. For AddOn Domains, the ini file would go in ~/public_html/[AddOn Domain]/. For instance, if the domain for the […]

Adding mobile-specific styles to a custom MailChimp email template

MailChimp‘s “code your own” custom email template doesn’t, by default, make any provisions for mobile-specific styles. As a result the email text is usually too small to read on a mobile device without the user manually zooming in. Conveniently, MailChimp’s css processor does support the max-width conditional. Put this at the end of your declared […]

Preventing direct access to hidden files and folders

Hidden files and folders usually contain configuration data and other goodies not intended for public consumption. Git, for example, saves all sorts of useful information in a root-level directory named .git. By default these files and folders don’t appear in a directory listing, but depending on server setup and where they live relative to the […]

Freeing a site stuck in maintenance mode

HELP — IT’S HAPPENED TO ME. TELL ME WHAT TO DO! The WordPress “update” function is one of its strongest features, downloading and swapping in updated Themes, Plugins, even components of WordPress itself, all with a single click. When it works, that is. In order to perform this update, the function temporarily puts the site […]