Creating complex shortcodes in WordPress

I occasionally dabble in custom WordPress themes on my wife’s behalf and in furtherance of her vast eBook empire. As part of her current theme, she wanted some shortcodes to do neat things like having a multi-column section of a blog post. That way, she can write:

[columns]
[column]First column here![/column]
[column]Second column here![/column]
[/columns]

instead of the actual mess of HTML and CSS required to make such magic happen. Plus, if we ever decide to change the markup we’re using to generate columns, we can just change the implementation of the shortcode instead of going and updating a whole bunch of blog posts. Cool feature!

Defining a shortcode

In your theme’s functions.php, you need to do (at minimum) two things:

  1. Create a function that replaces the shortcode with its actual content.
  2. Register your shortcode with WordPress.

This part is straightforward. Say we wanted to create a [contentbox] shortcode to automatically wrapped its contents into an <aside>. That could look something like:

We could use it this way:

[contentbox align="right"]Here's a nice right-aligned piece of content![/contentbox]

When included in a post, that would become:

<aside class='content-box right'>Here's a nice right-aligned piece of content!</aside>

(CSS to make it actually look like a box and aligned right is left as an exercise for the reader.)

The evil that lies within

There’s a problem. WordPress has an ancient, vile, and notorious function in place which is designed to make users’ lives easier and developers’ lives miserable. This function is called wpautop and I hate it passionately.

The idea behind wpautop is simple: convert all double linebreaks into paragraph elements, and tack on <br> tags to whatever’s left. This lets an average user type text into the editor and have it converted to HTML even without using WordPress’ visual editor. The problem is that wpautop doesn’t know anything about shortcodes, so if our user splits our shortcode into several lines (such as the [columns] example at the top of this post), wpautop comes through and sprays <br> tags everywhere. Incidentally, <br> stands for “break”, which is exactly what wpautop is designed to do to nice complex shortcodes.

This problem has been known for ages – it was reported at least 9 years ago as of this writing, was still allegedly being discussed by WordPress devs 7 months ago, and there is no fix. Ridiculous.

Rescuing the shortcodes

There are at least four ways to deal with the problem of wpautop murdering our shortcode content:

Option 1: Change do_shortcode filter priority

While loading a page, WordPress executes a long list of “filters”, which are just functions that operate on the post’s content. wpautop is one such filter, as is do_shortcode. The latter is what ends up calling our own custom shortcode functions, replacing the shortcodes with actual content in the post. In WordPress core, wpautop runs at priority 10 and do_shortcode runs after that, at 11. So one way to thwart wpautop is to change do_shortcode‘s priority to 9, meaning our shortcodes will be resolved first and hopefully wpautop won’t mangle the output too badly.

This isn’t a great solution because it can potentially break all kinds of other themes or plugins (which might rely on WordPress’ default filter order) in subtle ways. Until today, I was using this approach for my wife’s site theme, but then we started switching her shopping cart to WooCommerce and discovered that my hack broke the text on the “proceed to checkout” button (because wpautop vomited a <br> randomly into the button text).

So if you take this route, expect occasional oddities with other plugins. This is not a well-behaved solution.

Option 2: Disable wpautop entirely

I love this option because I hate wpautop. However, this will likely break even more themes/plugins than option 1, and also users may not get the expected results if they’re composing posts in the text editor without using a sensible text parser like Markdown. Still, if you want to do it, just put these two lines into functions.php:

remove_filter( ‘the_content’, ‘wpautop’ );
remove_filter( ‘the_excerpt’, ‘wpautop’ );

Option 3: Disable wpautop on a post-by-post basis

You can install a plugin to disable wpautop only on certain posts–in our case, the ones with shortcodes on it.

I like how the plugin description explains its existence by saying “Back in the day, when the wpautop filter was really sucky…” What, you mean like yesterday?

Option 4: Hide the shortcodes behind a false bookcase

Like squirreling away guns or hiding Jews from the Nazis, this approach pretends that shortcodes don’t exist until after wpautop runs. It’s the most complicated, but it’s probably also the best because it lets wpautop commit whatever debauchery it wants on the post and then puts our precious shortcodes back in place unmolested. There are two steps:

  1. Register a filter before wpautop to search the post content for any shortcodes and replace them with random strings.
  2. Register a filter after wpautop but before do_shortcode to switch out the random strings for the original shortcode text.

Easier said than done, because finding complex shortcodes is no walk in the park. Fortunately, I’ve done the hard work for you!

When included in your functions.php file, the above code will:

  1. Search for any shortcodes in your post/page content.
  2. Once a shortcode opening tag is found, attempt to locate its corresponding closing tag.
  3. Replace the entire shortcode contents in the post with a random string.
  4. After wpautop has run, replace the random strings with the original shortcode markup.

After that, do_shortcode should run and evaluate your shortcodes normally.

Review: Kingdom Builder

Time for a Kingdom Builder review! I bought this game several years ago after playing a friend’s copy. It’s a fairly lightweight game in the “area control” category, in that you place settlements onto the board to take control of

Rules

The rules of Kingdom Builder are very simple. Set up the game by selecting four interlocking board sections, each having a hexagon-based map with various terrain types on it. Then draw three public “objective” cards from a special deck and place them face-up near the board. These objectives define how points will be earned during the game – some objectives give you points for having settlements adjacent to water, or having the most settlements on a board, or having the biggest group of contiguous settlements, etc. Each player is then dealt a single terrain card (which just shows a terrain type), and you’re ready to go.

On a player’s turn, he reveals his terrain card and places 3 of his settlements onto the board, on terrain which matches his card. The catch is that the player must play adjacent to one of his existing settlements if possible. (If he has no settlements adjacent to his terrain type, then he can play settlements onto that terrain anywhere on the board.) The player then draws a replacement card and his turn is over.

There are certain special spaces on the board which provide an action tile to players with settlements adjacent to the space. These action tiles can be used one per turn before or after a player places settlements, and they let the player do things like move an existing settlement on the board or placing a new settlement with some restriction (e.g. only on the edge of the board, or only on grassland, etc.).

Opinion: Positives

  • The game is simple without being silly. The rules are quick to teach and easy to pick up, but there are strategic nuances which only become clear after several plays. Due to the rule which forces you to play adjacent to your existing settlements, the game is often as much about where not to place your settlement as where to place it (thereby keeping options open for later turns).
  • It doesn’t overstay its welcome. Playing time is typically under half an hour, which feels about right for the game.
  • Replayability is great. You can swap out boards to change the map each time, and each board has different special action tiles on it. Additionally, the victory conditions themselves (that is, how to score points) change with every game, preventing players from falling into a single “optimal” strategy rut.
  • It’s kid-friendly in a Carcassonne-style fashion. Having just one card in your hand, similar to Carcassonne’s single tile, limits analysis paralysis and helps move the game along.

Opinion: Negatives

  • Randomness can be frustrating. Apart from the special action tiles, you can only play settlements onto the terrain type of the card you drew…so if you don’t draw the right terrain type for several turns in a row, your plan can be held up or even ruined by other players who play onto your desired spaces first. This can certainly be mitigated by careful play and the special action tiles do help, but there are times when you’ll be frustrated at the single card draw.
  • It’s easy to accidentally cheat. As the game progresses, it’s sometimes easy to miss the fact that a player is adjacent to a terrain type somewhere on the board. Plus, with special action tiles to account for, this game demands player attention in surprising ways – especially when playing with children.

Conclusion

I consider Kingdom Builder to be comparable to Carcassonne, even though the core gameplay is very different. Both games have a single-draw-defines-your-turn mechanic, and both are comparable in approachability, complexity, and the luck-of-the-draw aspect. Carcassonne has the potential to be much more cutthroat (depending on your game group), and Kingdom Builder has simpler rules (no complicated farmer scoring to deal with) as well as more variety of play thanks to its changing victory conditions. Both games can sometimes have brain-burning turns as you try to figure out where the “optimal” play is and decide how much you want to push your luck in terms of future draws.

I enjoy Kingdom Builder and I think it’s a solid game design, but it probably wouldn’t stay in my collection if I didn’t have younger kids to play with. I like pulling it out with kids or as an easy-to-teach game with dinner guests, but it doesn’t have enough depth to really stand out among the other games in the closet. I would rarely if ever suggest it with experienced strategy gamers.

The verdict: a qualified thumbs-up!

Review: 7 Wonders

7 Wonders is an approachable, mid- to light-weight card-drafting game. What does this mean? Read on!

Rules

The game is played over the course of three “ages”. In each age, players are dealt a hand of 7 cards. The players then simultaneously choose a card from their hand, reveals the selected card at the same time as everyone else, pays the costs (if any), and plays the card on their personal tableau in front of them. Players then pass their hand of cards to a neighbor and repeat the process until there are no more cards.

Many cards have resource requirements a player must meet in order to play them. These resources can be generated from the player’s civilization (consisting of cards he has already played in front of him), or players can buy resources from their immediate neighbors (players to the left and right) – provided those neighbors actually produced the desired resources. Some cards, thematically represented as trading posts, reduce the cost of buying such resources from neighbors.

Some cards can be played for free if the player has already played the necessary prerequisite card in a previous age. (For example, playing an Altar in the first age would let you play the Temple in the second age for free instead of paying its resource cost, and the Temple in turn would let you play the Pantheon in the third age for free – each of these being worth progressively more points.) In this way, the game rewards players for following a long-term strategy.

There are also cards which provide military strength. At the end of each age, players compare their military strength with that of their immediate neighbors. The winner gains a number of points (1 point in the first age, 3 in the second, and 5 in the third), whereas the loser loses just 1 point regardless of the age.

Instead of playing a card face-up for its benefits, players can also choose to draft a card and play it face-down as a stage of their wonder. In doing so, the player ignores the cost on the card and instead pays the cost shown on his player board. Each civilization’s board is different, and each stage of a wonder provides some benefit to the player. Most offer victory points at the end of the game, but many also provide other benefits during the game, such as resources, military strength, the ability to play a card for free, and so on.

Opinion: The Positives

There are a number of things we like about 7 Wonders:

  • The game is easily taught to new players yet also has strategic depth for experienced players. This is a game that even “non-gamers” can pick up and enjoy on the first playthrough.
  • There are a good number of decisions for the short playtime. Typical games in our group take 30-45 minutes, and while this is by no means a brain-burner, there are a lot of opportunities for meaningful decisions. To excel at 7 Wonders requires both tactical thinking (reacting to which cards are available in your hand to draft) as well as strategic direction, because certain paths to victory reward long-term commitment. For instance, science cards (of which there are three types) are scored in two ways: the number of science cards of the same type squared (so 4 “gear icon” science cards gets you 16 points) as well as 7 points for each set of all three science icons you have. This can add up to the bulk of your score, so it pays to be thinking and planning ahead even from the beginning of the game.
  • Player interaction is balanced. The three main ways to interact with other players in 7 Wonders are buying resources, fighting militarily, and of course the card drafting itself. The nice twist to this game is that the negative side effects of interaction are minimized. In the case of trading, buying a resource from another player does not prevent him from using that same resource in the same turn. (Thematically, this makes no sense, but it works very well in the game.) For military defeats, the losing player does lose a point but that’s usually a fairly minor setback over the course of the game. This is by no means a “take-that” kind of game, but it’s also very important to pay attention to your neighbors and which cards you’re passing along for them to draft.
  • The game is friendly to parents of young kids. That is to say, 7 Wonders is easy to momentarily pause and resume if a child needs attention, because the game state is always clear and it doesn’t require a lot of mental immersion.
  • Most games end up fairly close, and it’s not always obvious who will win. Ocassionally we do see a runaway victory with one player winning by 20 points, but that is rare. On more than one occasion, our 4 players have had a total point spread of only 5 or less.
  • The game scales well to multiple player counts. I don’t recommend it as a 2-player game (though a variant exists), but for all other players it scales well – you add or remove cards from the age decks based on the number of players.

Opinion: The Negatives

  • A few of the wonders’ special ability icons are obtuse. There are two or three icons on certain wonders which we virtually always have to look up in the rulebook. Once we look up the rule to find out what the ability is, we can look at the icon and say “oh, yeah…I see why they came up with that picture”, but it’s not intuitive. (I’m looking at you, play-from-the-discard-pile and play-a-card-for-free abilities!) However, most of the iconography is excellent and this is a minor flaw.

I have a hard time coming up with negatives for 7 Wonders based on what it is. If you don’t enjoy card drafting, you won’t like this game. If you want direct take-that player interaction, this isn’t the game for you. If you want a heavy, meaty, strategic game, look elsewhere.

Conclusion

This game neatly fills a niche of having a game that’s teachable in a single play yet has enough depth to keep strategic gamers interested and involved. Thanks to the short playtime, it’s also rare this one gets only a single play once we pull it out of the closet.

7 Wonders gets a solid thumbs-up from the Winckler household!

Review: Dominion: Intrigue

Dominion is a widely popular “deckbuilding” card game, so named because the fundamental game mechanic is choosing cards to put into your deck and then playing them. It captures a taste of the deckbuilding of “trading card games” (TCGs) or “collectible card games” (CCGs) such as Magic: The Gathering while being self-contained in a single box, playable in 30 minutes flat, and affordable without a second mortgage. (Dominion involves no booster packs or anything of the sort; it’s a self-contained box game albeit with expansions available.)

The premise is simple: in each game of Dominion, there are 10 (randomized) actions available to put into your deck, three kinds of “treasure” (used for buying other cards), and three kinds of victory point cards (which are the only cards that matter when figuring out who won the game at the end, but until the end of the game they are dead weight in your deck). On your turn, you can play one action card and then spend treasure cards to buy one new card. As the game progresses, your deck becomes larger with (hopefully) better cards and you are able to buy more expensive actions, treasure, or victory cards.

I’ve played Dominion probably a couple dozen times, but it was only just recently that I discovered I’ve been playing it wrong all along. My wife and I would usually buy a bunch of actions, trying to get synergy between them and neat combos. Sometimes my wife would cycle through practically her whole deck, drawing cards and getting more actions and chaining things together. Then recently we had some friends over to play Dominion and one of them, ostensibly because she couldn’t choose from all the many actions available, bought nothing but treasure and then bought the expensive “Province” victory cards which gain the most points whenever she could afford it. In this way, she utterly destroyed the rest of us – the game wasn’t even close.

After that startling experience, I wondered if it was just a freak occurrence or if there was something to this strategy so I decided to try it out against my wife. I even told her ahead of time exactly what I was going to do so that she could effectively counter it. So for four games straight, I bought nothing but treasure (and maybe one action card), bought a Province whenever I could afford it, and won handily every single time. These massacres took maybe 15 to 20 minutes compared to our 45-minute average before the epiphany.

At that point we both wondered whether there was something broken about the game, and I went hunting for tips online. That’s when I discovered that apparently only noobs play Dominion the way we previously did. Supposedly there are three stages to Dominion players:

  1. Look at all the shiny action cards! Buy them all!
  2. Wait…buying nothing but money, provinces, and the occasional duchy always beats the action cards! (Also known as “big money” strategy.)
  3. “Big money” plus one good action card beats “big money”!

We never progressed beyond stage 1, and Dominion was certainly not on my list of favorite games. I was always willing to play it, but I’d virtually never suggest it because games just dragged on – I thought the 30 minute playing time on the box was a joke (like most playtime estimates on board game boxes).

I was afraid that “big money” might ruin Dominion for us, but I actually like the game better now. Shiny-action mode simply takes too long to play and the game outstays its welcome. Big money is snappy and makes you think hard about which actions you’re going to add, also reacting tightly to what your opponent does. I almost wish the rulebook would include guidance, something along the lines of “hey, I know all these actions look great and fun and all, but really you should completely ignore them and just buy money and provinces until you know what you’re doing. Trust me.”

Dominion: Intrigue is a standalone expansion which you can play with the base game or by itself. I like Intrigue better than the original because it has more interesting possibilities for player interaction, but with that said, I haven’t yet replayed the original since having the big money epiphany.

All flavors of Dominion remain in good standing among our household.

Verdict: Thumbs up!

The 10×10 Hardcore Challenge

On January 2d of this year I committed myself (and, incidentally, those who are unfortunate enough to play board games with me) to a “10×10 hardcore challenge”. This was an idea I saw on BoardGameGeek, and as our gaming had waned somewhat, I thought it would be a good way to motivate us to make it more of a priority again. This proved true, and I successfully completed the challenge last Saturday on November 19th.

As a side note, gaming is like many other enjoyable things in that the more you do it, the more you want to do it. Once you are in the habit of doing a thing, it becomes much easier to continue doing it. There are likely useful life lessons to be drawn from this, but I will refrain from doing so here.

The games we played were:

One of the interesting things arising from the challenge is that prior to this, we would rarely play a game more than a few times in a row. Nothing about the challenge technically compelled us to play the same game all in a row, but in several cases (notably Wiz-War, Eclipse, XCOM, and Quantum) we did just that (over the course of weeks/months). This had the effect of revealing strategies in gameplay or even virtues of the game which would not otherwise have been apparent. In particular, I was not originally a fan of Quantum, but I recognized it had enough merit to make it worth trying out. It wasn’t until the sixth or seventh play that I discovered some additional strategic depth beyond that which was immediately apparent (to me, at least). I don’t think this means I’ll be inclined to give every game almost a dozen plays before passing judgement, but I certainly will be more open to diving into repeated plays of a game rather than sampling one of everything from the game closet buffet.

As the challenge progressed, we discussed whether each game was good enough to remain in the collection. A couple of games we had never (or hardly) played before the challenge – XCOM and Mage Knight. Quantum also only had a couple of plays before the challenge. Some I feared might fall apart after repeated play – such as Kingdom Builder.

Ultimately, only one board game definitely got booted from the collection following the challenge, and although I was firm enough in my resolve that I didn’t need any confirmation from my gaming colleagues, I think the decision was unanimous. But rather than simply spoil the surprise right here, I decided to take the effort to write a review of each of these games individually. Look for them in the coming posts!

As for whether I’ll do another challenge – I doubt it. Or at least, I won’t do another hardcore challenge where I pick all the games of the year ahead of time. I still think there’s some value to picking a game and saying “we’re going to commit to playing this X number of times unless we end up completely hating it”. Some games take some time to shine, and you may be surprised at the depth (or occasionally lack of depth) you discover if you play a game repeatedly within a short period of time.

Re-employed

If this blog is a record of my grand exploits, then it seems appropriate to note, in the interest of continuity, that about a month ago I accepted a job offer and am once more gainfully employed as a professional software developer. Assorted experiences of the past have taught me the prudence of maintaining the separation of work and blog, so that’s about all I shall express upon the topic, aside from praising God and rejoicing that I am again in a position to earn my keep from the comfort of my home office.

As I observed at the time, unemployment would be practically an ideal state of affairs if only one wasn’t continually feeling the pesky pangs of material want. After all, such a condition leaves one with plenty of time for the important pursuits, such as writing blog posts. However, life and sustenance being what they are, I am (on the whole) glad to once more have my daylight hours occupied in more fruitful pursuits.

That said, there are a few projects I have underway, and as the saying goes, though they proceedeth slowly, they are exceedingly fine.

The first such endeavor is a new WordPress theme for my wife’s blogs. This theme, which I believe the gracious call “minimalist”, is now live on her various and divers sites. She says she likes it and that it’s better than her previous themes (which I also authored). I’m not sure I agree, but if you do, it’s free for the taking.

The next project on the docket is an effort to sanitize the computer game World in Conflict of profanity so that my younger boys can play it. Happily, the developers were very mod-friendly and made a mod kit available in the day. Unhappily, that day was quite a while ago and it’s been a struggle just scraping together the tools from various corners of the Internet to make modding possible. However, I’ve now reached the point where I’m able to edit everything except cutscene movies, and it’s just a matter of doing the grunt work of finding the particular files which need editing and doing the editing itself. (By the way, I am here intentionally ignoring the debate about whether such “censorship” as this is worthwhile or a total waste of time. Assuming I get anywhere with the project, I’ll eventually be writing my thoughts on the matter in more detail.)

Third on the list is the construction of dice towers. Some years ago I invested in a number of Hirst Arts molds. Shortly after purchasing them, I cast a whole bunch of little plaster bricks and built a few neat things. And then they (along with a number of the bricks and some 70 pounds of Hydrostone) sat in my garage collecting dust. This really is quite inexcusable, but unfortunately it is the truth. I am now doing my best to atone for this neglect by pulling the various pieces out of storage and designing dice towers. Dice towers (of which I presently have an embarrassing shortage) are important to me right now because of the next project, which is…

Fourth: playing 100 board games over the course of 2016. I’ve signed up for a 10×10 challenge on BoardGameGeek, meaning that I intend to play 10 particular games 10 times each during the year. We didn’t play nearly enough board games in 2015, and I think this kind of challenge is just the sort of thing to change that. At a mere two games per week it doesn’t sound like much, but it’ll be a good deal more than before. Plus, although some of the games I chose (Dominion, Kingdom Builder) can easily be played a couple times in an evening, others (Eclipse, Mage Knight) are rather involved.

Of course, the final project on the list is blogging itself. I’m out of practice, and writing is a thing that wants continual exercise.

Speaking of continual exercise, I suppose that’s a sixth project. But I mean to say, really, you know, one wouldn’t want to be overwhelmed with projects.

Plex: Rename a TV Show Season

I’ve recently been working on digitizing our media collection using Plex. For the most part, the system works amazingly smoothly, provided you closely follow the naming conventions Plex expects, thus enabling it to find metadata about each file from the various online sources.

Problems arise when you want to add your own home media, or in my case, adding school media such as Math-U-See video lessons. Plex treats these as “TV shows” and it names TV show seasons using just the number, e.g. “Season 1”, “Season 2”, etc. This is not very helpful for identifying Math-U-See lessons, since they are named “Alpha”, “Beta”, etc.

Plex has a built-in editor for renaming the show itself, but inexplicably it does not provide an editor to change the name of a season. However, there is a way to do this. By adding an HTML input to the screen while editing a season, it turns out Plex saves the value and renames the season. Hooray! Just copy the following JavaScript and save it as a bookmarklet in your browser (in Chrome, go to the Bookmark Manager, Organize, Add Page, name it whatever you want, and paste the below code into the location box):

Then, in Plex, navigate to the season you want to rename, click the edit button, and click the bookmarklet. It will prompt you for a name. Enter whatever you like, click OK, then click Save Changes, and you’re done!

plex_rename_tv_show_season

Back to GMail

A little over a year ago Google announced Inbox, touting it as some kind of new way to revolutionize email. (Never heard that one before!) Some of my coworkers gave it a try and said they liked it, so I went to sign up. I was promptly rebuffed by a page which insisted that in order to use the web application, I’d need to first activate Inbox on my smartphone. Problem is, I didn’t have a smartphone, because I was secure and happy in my position as a dumbphone-equipped living anachronism. Yet, in an instant, I had become a victim of smartphone bigotry by this prejudiced and opinionated web application refusing to serve me just because I didn’t own a smartphone. I had become the Rosa Parks of the tech world.

So I told them (that is to say, I told myself in a passive-aggressively belligerent fashion) they could keep their lousy bus; I’d walk. And I stuck to GMail.

Then, earlier this year, to the shock and amazement of all who knew me, I bought a smartphone and signed up for Ting (FYI, that’s a filthy capitalist pig referral link, and you’ll get $25 credit for signing up with it). This was prompted in part because my dumbphone had an encounter with the Columbia River (it having the misfortune to be sitting in my pocket as I jumped into the water to shove my sailboat off the muddy shores of Bateman Island following a particularly heavy grounding). The phone did actually recover from the incident, but afterward the battery would only hold a charge for about a day. And I mean to say, if I’m going to be plugging in my phone to charge it every single day like some smartphone peasant, then I might as well be deriving some smartphone benefits instead of being stuck with only the drawbacks.

So anyway, after selling out all my principles to the smartphone, I promptly signed up for the Inbox bus. (I pulled my hat low over my eyes so they wouldn’t recognize me.) The mobile app turned out to be pretty great; I still have it installed. The web app also seemed great…at first. But here are the things wrong with it.

Nowhere is Safe (to Click)

I don’t know how most people set focus on their windows (like if they switched to a different program and now want to switch back), but I pick a blank space on the page and click on it. This doesn’t work in Inbox, because if you have an open conversation, clicking anywhere in the grey area outside the email will cause the whole conversation to collapse. This is especially annoying when the conversation has multiple emails in it and you were reading one in the middle, because by default Inbox will just open the first and last message with the rest collapsed in the middle. (Same as GMail, but GMail doesn’t throw its hands up and close everything whenever you click on some whitespace on the page.)

Drag-and-drop Attachments Don’t Work (as Well)

GMail had this workflow mastered: drag and drop a file from your computer onto the email and it provides a nice interface to automatically upload and attach it. Smooth and easy! Inbox is supposed to do the same thing, I think, but it doesn’t. Dragging a file onto the email you’re composing flat out does not work unless you have “popped out” the email (i.e., you’re not composing a reply inline). Even when “popped out”, when dragging the file over the message, Inbox does not present a nice UI the way GMail does – the only feedback I get is the operating system “Move” cursor. Dropping it sometimes does attach it to the message, and sometimes it just opens the file in the browser (navigating away from Inbox entirely).

(Some) Keyboard Shortcuts Don’t Work

I love keyboard shortcuts. Why use a mouse when you don’t have to? And shortcuts in GMail are great. you can do all sorts of things without ever touching the mouse. You can also do most of these things in Inbox, but not all – Ctrl+Shift+C and Ctrl+Shift+B to focus the Cc: and Bcc: lines on a message you’re composing do not work in Inbox. This annoys me to a surprising degree. Likewise, labeling: l should offer to label the current conversation. This does not work in Inbox. Speaking of labels…

Labels? What Labels?

Labels exist in Inbox, but they are not the same. They’re treated more like folders, where you “move message to…” whatever label you want. In GMail, you can apply multiple labels to a conversation and they all show up on the message itself in whatever view you’re using. This is helpful for keeping track of which conversations need a reply, which want a followup later on, and so on, while still allowing you to organize mail by project, client, or any other desired metric. (Inbox partially solves the “needs a reply, but not right now” problem with the concept of “snoozing” a mail – making it disappear from the inbox until a specified time. I really like this concept, but it’s not enough by itself.)

Which Message are You Replying to?

If you’re using keyboard shortcuts (and you should be), then you will find immediate annoyance in how Inbox handles replies in a multi-email conversation. Sometimes, when multiple people are involved in a conversation, it is useful to reply to a particular message in the middle of the thread rather than the most recent message. Often, if a particular thread is long and I’m just catching up on it, I may read through all the messages and then go back and reply to one in the middle. This is one case where I admit to using the mouse; I find it quicker to click on the particular message I’m interested in rather than repeatedly pressing p or n and then o to highlight and open the message I care about. So I’ll click on an email and then hit r. In GMail, this opens a reply to that particular email; in Inbox the clicking does not focus the message in the middle of the thread so r generates a reply to the latest email. It’s annoying when you catch it and confusing to others when you don’t (since your reply no longer makes any sense).

Where is My Favicon?!

GMail favicon It seems to inconsequential, yet it is so important. The number of important unread messages displays in the GMail favicon, so I can see whether I’ve got new mail at a glance. Not so with the Inbox favicon, which remains its same-old hip blue envelope-with-a-checkmark regardless of whether you have no unread emails or 44,000 unread emails.

The End of the Matter

Sadly, Inbox is overall a nicer app to deal with – the web application is more responsive and I like many of the user interface changes. Unfortunately, Google took several steps backward in the user experience department, and until they address these things I’ll be sticking with GMail on the web. I do still use the Inbox app on my smartphone, so I guess they got me there.

Force MFC-8890DW to Keep Printing

Today we will be learning how to use a Magical Toner-Generating Device (MTGD) to enable your Brother black-and-white laser printer (specifically, model MFC-8890DW) to print even when it is out of toner! We’ll use this Weird Trick Invented by a Random Guy on the Internet! Printer Manufacturers Hate Him! But that’s okay, because The Feeling is Mutual!

(Full disclosure: I did not invent this trick. But I like to pretend that I did, because it makes me feel smarter and more nefarious.)

My Brother MFC-8890DW has been complaining of low toner for a while now, but I have been ignoring it because there is no appreciable difference in the documents it is printing. Then last week, right after printing a perfectly crisp page of text, the printer announced that I needed to Replace Toner and petulantly refused to print me more documents until I met its extortionate demands. However, based on my past experience with laser printers, I am under no illusions that they suddenly go from “prints just fine” to “completely out of toner”, and based on my experience with printer manufacturers, I am completely willing to believe that they will disable your printer and hold it hostage as a sort of scheme to force you into buying more printer supplies.

The general approach here is going to be to install a Magical Toner-Generating Device (MTGD). It works by absorbing the lies spewed forth by printer manufacturers and condensing them into a black powdery substances which can then be applied to paper the same as regular toner. Quality may vary, but so far I have found the results to be satisfactory. The device itself looks like this:

electrical_tape

Thus, we come to the nefarious directions for circumventing the printer’s extortion scheme. I like to think of this as the hostage (that’s me) escaping from the extortionist (that’s the printer), subduing it (after a brief scuffle), blindfolding it, putting it on the edge of a cliff, and holding a cattle prod to its back while shouting “Print, curse you! PRINT!” This process may violate the DMCA and/or other local laws, it may void your warranty, and it may result in an immense sensation of personal satisfaction. Use at your own risk.

  1. Open the front cover.
  2. Pull out the toner cartridge.
  3. On the right side of the cartridge, locate the little clear, round “observation window”.
  4. Apply the MTGD. That is to say, cover this window with black electrical tape.
  5. Put the cartridge back in and close the cover.

Here are two helpful illustrations of this complex technical procedure:

Toner cartridge: Before!

Toner cartridge: After!

In my case, this operation convinced the printer to merrily continue on its way, printing completely acceptable pages. (Since the printer claimed the toner was empty, and since we know a printer would never lie about its toner levels, I like to think it’s now using magic toner.)

I need to go do something else now, as I just heard a strange noise and the printer seems to have shifted position overnight, inching a little closer to my office chair. This won’t take long.

On Usability and Folding Laundry

The importance of feeling the consequences of your own work can scarcely be overestimated.

I sometimes fold laundry in our household. Well, okay, I occasionally fold laundry in our household. That is to say, at least twice I have folded laundry in our household. And on one of these occasions, my long-suffering wife asked me a seemingly random question.

Wife:
How do you hang hand towels?
Me:
What?
Wife:
Hand towels. Like if you’re hanging a towel on the rack, how do you do it?
Me:
(picking up a towel I’d just folded) The normal way, threading the narrow end through the towel holder. I’d just unfold the towel once and…oh.

Turns out I was completely incompetent at folding hand towels, because I’d been folding them in the wrong direction. Thus, anytime someone wanted to use one of the towels I’d folded, they had to first unfold it all the way and then re-fold it.

Apart from making me feel like an imbecile, this little experience reminded me of a lesson I’ve seen in action many times. Had I been the one hanging hand towels in addition to the one folding them, the problem would have been immediately obvious. But unless we actually use the end result we’re producing (or have excellent user feedback mechanisms in place), we’re flying blind.

This is especially true in the software world. If you’re not using your own software, then I’ll take long odds that it’s got significant usability problems. I have worked with developers who blame everything on the user, vindicating their own blinkered view of their software product. “gah, these users. If they’d only use the software correctly then we wouldn’t have to make these silly changes.” I cringe every time this happens, and I’ve heard variations on it more than once in my career. If you’re blaming your users for problems they find in your software, it’s time to find another career. The whole point of software development is solving people’s problems. If you’re not interested in doing that, then what are you doing here?

The need for real-world feedback on software is one of the reasons “hallway usability testing” is so valuable. The idea is that it doesn’t take a special kind of user to find usability problems in your application. You can grab just about any random human being who is not the guy who wrote the program, sit him down in front of the computer, ask him to perform a task using your software, and immediately start discovering usability problems. This kind of usability testing is embarrassingly easy to perform, and the majority of development shops (and developers) don’t do it.

The fact that this is true makes it all the more embarrassing that such vast quantities of software are so difficult to use. Take time tracking software, for instance. I have never worked for a company whose time tracking software was a pleasure to use. In all cases, it would have been easier to just enter time in an Excel spreadsheet. (Come to think of it, I believe the first company I worked for actually did track time this way.) I can think of no reason why this should be true, that all time tracking software stinks. There is nothing inherently difficult about writing software to record how much time you’ve worked. But developers, by and large, do not put a premium on software that’s eminently usable, so long as it can be made to work. “Does the software allow users to enter time and generate a report for managers? Great. Meets the requirements. Done.” In fairness, the blame does not land solely at developers’ feet; often companies are unwilling or unable to pay for the time required to really polish software. But although the law of diminishing returns is definitely in effect here, it does not take a huge investment to make some big gains in software usability.

As a developer, start by forcing yourself to use what you’re writing (and use it in unexpected or unusual ways). Also, put it in front of a disinterested party and make them use it. Watch (or record) – but don’t give them any hints. It will be painful, but it’s pain you need to feel. Take the results, pick the top three worst problems the user ran into, fix them, and do it again. Iterate.

As a user, start being willing to pay for software that’s elegant and easy to use. These attributes are admirable goals in and of themselves; we should be encouraging them to the extent we are able.