Move to the End and Beginning of a Word in PHPStorm

Another Macintosh keyboard shortcut that will be second nature to most Mac users is using ⌥← to move to the beginning of a word and ⌥→ to move to the end of a word. This moves the cursor to the left of the first character or the right of the last character. Try it in Mail. In TextEdit. In another editor you have installed like Sublime Text. It works the same across any Mac application I can think of except for PHPStorm. It feels so… wrong.

There is no existing Keymap setting in PHPStorm to move to the beginning and end of a word. Instead, there are command for moving to the next and previous words:

Move to Next Word

To fix this abomination, and affront to Clarus the Dogcow, you will need to install a PHPStorm plug-in called “Missing in Actions.” “Missing in Actions” actually will add quite a bit of functionality but, really, the thing that I was really looking for was the proper handling for ⌥← and ⌥→. Read more about Missing in Actions at the plug-in’s Github repository.

Go to PHPStorm > Preferences > Plugins. From there, choose “Browse Repositories.” Search for “Missing in Actions” and click the Install button. The plug-in will download and then you will be prompted to restart PHPStorm for the changes to take effect.

After restart is complete (you may have time to refresh your coffee), you will see new options available in the Keymap settings of PHPStorm:

  • Move Caret to Next End of Word
  • Move Caret to Previous Start of Word

Set these to ⌥→ and ⌥← and all will be well again.

Move Cursor to the Top of the Page in PHPStorm

I have started using JetBrain’s PHPStorm editor at work on a Macintosh and one of the things that has irked me is that some of the standard Macintosh keyboard shortcuts don’t work out of the box. For example, if you’re a seasoned Macintosh user, you are most likely used to using ⌘↑ to go to the top of the document. By default, in PHPStorm, this brings up the breadcrumb navigation. To get the default Macintosh behavior, you’ll want to edit the Keymap Preferences.

Go to PHPStorm > Preferences > Keymap to bring up the Preferences dialog. On the right-hand side of the dialog, you’ll be able to search for the command that you want to set the keyboard shortcut for. It wasn’t obvious to me what the command was for scrolling and moving the cursor to the top in PHPStorm, but I finally found that it is “Move Caret to Page Top.”

Move Caret to Top

Double-click this entry and set it to ⌘↑. Since PHPStorm assigns this by default to the “Show Breadcrumbs” command, you will be given an option to remove this existing mapping.

In addition to setting this keyboard shortcut, you can also set “Move Caret to Page Top with Selection” to Shift-⌘↑ and the corresponding commands for moving the caret to the bottom of the page. In my mind, this makes PHPStorm act much more like you’d expect an editor on the Mac to work.

Troubleshooting the White Screen of Death in WordPress

One question that I see asked a lot in the WordPress Support Forums is what to do when their website simply displays a white screen. This most likely represents a PHP fatal error that stops the server from generating the HTML for the browser to display.

How to Find the Problem

When PHP has a fatal error, it is usually logged to an error log file. The location and name of this file can change depending on the hosting server’s settings, but often the log file will be in the root of your website (maybe public_html) and called something like error_log or php_errorlog. If you don’t know, you should be able to search at your hosting company’s Support area for this information.

When you find out where the error log file is, open it up in a text editor or the File Manager in CPanel. The newest entries will be at the bottom of the file. If you see a PHP Fatal Error, this is most likely the culprit. Here is an example:

[19-Sep-2017 02:55:44 UTC] PHP Fatal error:  Call to undefined function load_theme_textdomain2() in htdocs/wordpress/public_html/wp-content/themes/twentyfifteen/functions.php on line 62

This tells me that there is a problem in the theme I am using, Twenty Fifteen, trying to call a function that does not exist. Now that I know this, I can look into fixing it.

Does the admin load?

If you go to your site’s home page and get the dreaded white screen, try to access your site’s administration panel at http://<your domain>/wp-admin/. It is possible that the error is only manifesting itself on the front-end and that you will still be able to get into your admin panel.

If you were able to get useful information from the error log, you should be able to disable either the problem theme or plug-in and be back in business. If you were not able to get information from the error log, you can try changing the theme to one of the included WordPress themes to see if there is an issue with the active theme. Or, if that doesn’t work, you can disable plug-ins one at a time, loading the home page of your site in a different tab, between plug-in disables to try to track down the errant plug-in.

Does the admin not load?

If the administration does not load there are a couple of things you can do to disable plug-ins. You can rename the folder of your plug-ins. If WordPress cannot find the plug-in file, it will disable it:

Plug-in was disabled

Another option, if you have access to the database through a tool like phpMyAdmin.phpMyAdmin is often available in CPanel and other hosting control panels. Go to the wp_options table and look for the record with the option_name of “active_plugins.” The option_value of this record will contain a serialized list of active plug-ins for your site. Here is an example of a site with Akismet and Contact Form 7 active:


Delete the option_value completely and this should disable all plug-ins for your site.

Need to change your active theme? There are two rows for this, also in wp_options. You can look for the option_name values of “template” and “stylesheet.” Change these values to a different theme available on your site.

Why did my site break all of a sudden?

It is impossible to give one answer for all the possibilities, of course, but I have found that one of the common causes of this issue would be an upgrade to the version of PHP running on your site. If a plug-in is using a deprecated function from PHP 5, and the host switches your account to use PHP 7, this could cause a problem. Do a Google search for the error you found in your error log to try to find out more. If you suspect the issue is a PHP upgrade and you have access to CPanel, there is often a way to change the version of PHP for your site. Look for an icon like this in CPanel:

PHP Version Manager

If you have that, try reverting to an older version of PHP.

This article just scratches the surface of troubleshooting problems with a WordPress site being down but hopefully it will help get you started on the right track for figuring out your issue.

Fun Atari 2600 Games

I was recently listening to Michael J. Nelson and Conor Lastowka’s podcast, 372 Pages We’ll Never Get Back which discusses the book, Ready Player One. Check it out. They are two of the hilarious people behind Rifftrax. However, I did call them out for the claim that there are no good Atari 2600 games. While many of my childhood classics haven’t held up too well, there are still quite a few games that I legitimately like on the Atari. Many of them are arcade conversions so, yeah, there are probably better versions on other systems (or one could play in MAME), but I still find them to be a lot of fun. So, off the top of my head, here I go:

  • Ms. Pac Man
  • Moon Patrol
  • Pitfall 2 (I must confess I find the original to be boring now and one of the games that has not stood the test of time)
  • River Raid
  • Jr. Pac Man
  • Dig Dug
  • Centipede and Millipede
  • Asteroids
  • Video Pinball
  • Berzerk
  • Keystone Kapers
  • Galaxian
  • Phoenix
  • Circus Atari
  • Dodge ‘Em
  • Save Mary
  • Defender
  • Joust
  • Gravitar
  • Frogger
  • Space Invaders
  • Ikari Warriors
  • Crystal Castles
  • H.E.R.O.
  • Tutankahman
  • Kaboom
  • Montezuma’s Revenge
  • Pengo
  • QBert
  • Solar Fox
  • Solaris
  • Tapper

And this isn’t even mentioning the great homebrews still coming out for the system today. I am a pretty nostalgic person so there is no doubt that my fondness for these games is wrapped up in childhood memories. And I am not one who would play these for hours on end but, for a quick de-stressor, I think the titles above are still good fun.

Setting up Mac navigation shortcuts in iTerm 2

If you’re a Macintosh user, it is probably second nature to use ⌥← to go back one word and ⌥→ to forward a word. Similarly, ⌘← will bring you to the beginning of a line while ⌘→ will jump you to the end. However, by default, iTerm 2, a great replacement for macOS’s included Terminal application, is not set up to work this way. Fortunately, it is possible to map your keys in a way to get this functionality.

In iTerm, go to your Preferences and then the Profiles tab. Click on the Profile you are using and choose the “Keys” tab.Keys preference

From there, you can click on the + button below the existing Key Mappings and use the following settings to emulate the default Macintosh behavior.

Back One Word

Back one word

Forward One Word

Forward one word

Go to Beginning of Line

Beginning of line

Go to End of Line

End of line


Searching your shell command history

Recently I was working with a colleague through Zoom and sharing my screen. As he watched me furiously tapping my up arrow key like I was playing a Mario Party mini game to cycle through my history of Unix commands, he gave me a great tip. To search through the history of previous commands you can pipe the history through grep:

history | grep "search term"

Essentially, this command says, “take all my history, send it to grep, and give me results for my search.” The results of the search will then be displayed to your terminal window. I found this tip to be incredibly useful and it has saved some wear and tear on my up arrow.

AppleScript for playing Rifftrax

Anyone that knows me, knows that I am a huge fan of Mystery Science Theater 3000 and, an off-shoot of that, Rifftrax. One of the great things about Rifftrax is that they sell some MP3-only commentaries. Since they don’t need to license the movie, they can target summer blockbusters like Star Wars: Rogue One, Twilight, and Harry Potter. The only downside to this is that you have to sync up the audio of the MP3 to the movie’s audio. This isn’t too big a deal, especially with Rifftrax’s new auto-syncing application for your phone. That said, sometimes I prefer to watch Rifftrax on my computer for the convenience of the audio coming from the single source (my laptop speakers).

At the beginning of a Rifftrax commentary, instructions are given for when to pause the MP3 and at what point in the movie to un-pause the MP3. That way, the jokes will line up with the movie audio. I will watch movies using VLC and listen to the commentary using QuickTime. Easy, right? But what happens when you need to pause the movie? You have two separate applications playing and, no matter how fast you are, you will not be able to hit the pause buttons of both applications at the same time.

To deal with this issue, I wrote up an AppleScript to hit pause on both applications when running the script. Compiling this script to an application, I can place it in the Dock of my Macintosh when playing a Rifftrax and click to stop and resume at any time. It is a really simple little script to handle this:

tell application "QuickTime Player"
    if document 1 is playing then
        pause document 1
        play document 1
    end if
end tell
tell application "VLC"
end tell

I think the code is pretty readable. QuickTime needs to be told to play or pause the audio if the file is actually being played or not. VLC will just toggle between the two so we don’t need to bother checking. To use this script, simply paste the code into Script Editor, which should have come with your Macintosh, and Export the script as an Application.

Export as Application

That is all there is to it. “It’s time for Rifftrax.”

Tab Modifier Plus Chrome Extension

As a web developer, I often find myself with local, staging, and live versions of the same website. Obviously, one can tell which environment one they are on by viewing the address in the browser bar. I find it handy to have an additional visual cue, though, to make it even clearer. I have found a neat little extension for Chrome or Opera called Tab Modifier Plus that allows you to set custom favicons for tabs based on the URL.

When adding a new tab rule, you can match the URL by text matching or with regular expressions.

Add New Rule

In my case, my local sites all begin with “http://stirrell.” so I can use that with a “Starts with” rule. Once you have set up the URL match, you can then choose a number of options for the tab:

  1. Choose a favicon.
  2. Pin the tab.
  3. Prevent the tab from being duplicated.
  4. Ask for confirmation before closing the tab.
  5. Mute sounds on the tab.

In my case, I will choose an included favicon available in Tab Modifier Plus, a green circle, to let me know I am on a “safe” site:

Custom favicon

Then, of course, I can use a red circle for live web sites.

Although I use Tab Modifier Plus as a visual clue for “safe” and “dangerous” sites, I can see many other uses for this nicely-made extension. I appreciate that the options page uses Google’s Material look-and-feel. I have also tested in Opera and it seems to work just fine. I definitely recommend this extension.

“Indie Game” – Movie Review

It has been a while since I saw the first installment of “Indie Game,” a documentary that showcases independent game developers and their creations. Included in “Indie Game” are Super Meat BoyFezand Braid, which have been recent stand-out games. I noticed on Netflix that a “follow-up” documentary was available for viewing, “Indie Game: After Life.” I really enjoyed the first movie, so I dove right in and was not disappointed.

As a retro gamer, I have a yearning for earlier generations of game creation where a small team, or even a single person, could have inspiration and drive and create an entire game. Obviously the game industry is a lot different now with teams and budgets rivaling those of Hollywood films and while modern blockbuster games are great, there is something special about a single programmer’s vision. It feels much more like a person’s artistic expression. Part of the mystique, of course, was the thought… “maybe I could do that.”

One thing that “Indie Game” makes clear is that creating a game is not a simple endeavor. They are suffering for their art – grueling hours in front of their computers. The persistence and overwhelming amount of work that these creators put into their games is nothing short of amazing. You cannot help but root for their success. It is inspiring to see people so creative and passionate. And it is gratifying to see that there is a market for unconventional entertainment. There are no focus groups here – just a blind faith that what they are making will find an audience.

Watching a movie like this always inspires me. I think that our society has gotten to be incredibly cynical, something touched on in “Life After,” and seeing the passion of the developers is heartwarming. It is easy to be hypercritical without considering the energy put into these projects – years of hard work where the chance of success is slim – and putting a face to the people behind the product is a refreshing change of pace.

“Man vs. Snake” – Movie Review

I just caught “Man vs. Snake – The Long and Twisted Tale of Nibbler” on Netflix and this is the kind of retro and nostalgia that I love. I think that “Man vs. Snake” could almost be a spiritual sequel to the popular video game movie, “King of Kong.” You have some of the same cast of characters – Billy Mitchell and Walter Day are both present as well as a historical rundown of the Twin Galaxies Arcade. For viewers of “King of Kong,” much of this material will be very familiar. That said, the story is very well presented with some fun animation.

Like “King of Kong,” there is competition between multiple players trying to attain the high score for an arcade game, in this case Nibbler. If you’ve played a variation of the game “Snake” on a cellphone or old computer, you have an idea of the gameplay. On this journey, there is some question regarding possible chicanery in the quest for a high score. But, mostly, it is the story of a person challenging himself to try to attain a goal that few people could imagine. Unlike Donkey Kong, Nibbler is a game that people “marathon” for a high score, or play for extremely long periods of time. The players build up a cache of extra lives to allow themselves breaks and play up to and beyond 40 hours in a single high score attempt.

I actually never ran into a Nibbler game when I was growing up – or, if I did, I don’t remember ever seeing it. And there is a humorous part of the movie talking about Nibbler’s dubious claim to fame in video game history. It normally is not thought of when talking about the classics we all remember like PacMan and Asteroids. However, the long play sessions possible in Nibbler allowed for players, for the first time ever, to possibly achieve a billion points on a game. No kill screen here. So, it isn’t fond memories of pumping tokens into Nibbler as a child that makes the story so compelling for me. Instead, it is the general nostalgia for these arcade games and a person’s quest to try to persevere and achieve arcade glory.

I really loved “Man vs. Snake.” It is the story of someone ordinary attempting to accomplish something extraordinary. It is so refreshing to see a celebration of someone “normal” – in so much as someone who can play an arcade game for 40 hours is normal. If you enjoyed “King of Kong” or “Chasing Ghosts” then I think you’ll really enjoy “Man vs. Snake.” And as much as I liked “King of Kong,” this movie didn’t have as much of a “soap opera” feel to it which I appreciated.