Things With Pixels

Bryan is a web developer who spends a lot of time surfing the internet. Sometimes he writes about it.

Keep track of your character limits with WriteLimit

With Twitter being all the rage these days, you may find yourself wanting a visual indicator on text boxes so that users can keep track of how much they’re typing.

I’ve developed WriteLimit to do just that.

It’s a very simple jQuery plugin that does the following:

  • Tracks character count or word count in a text field or text area
  • Updates a counter element, either counting up or down
  • Will apply a special CSS class to the counter when it’s over limit
  • Can optionally specify any characters or words to be ignored in the counting

Usage is straightforward:

<script type='text/javascript'>
   $(document).ready(function() {    
          max: 250,
          unit: 'words',
          counter: $('#counter span')        
<textarea id='write-limit'></textarea>
<p id='counter'><span>250</span> words left</p>

Head on over to the GitHub page for the source, and more configuration options.

Taming phpThumb URLs with mod_rewrite

I recently started using the popular phpThumb library to handle resizing and caching of images. It’s a great, dirt-simple way to auto-generate images at different sizes without having to manage an army of image files. However, I found the default convention for thumbnail urls to be a bit unwieldly:

Frankly, I didn’t like having to reference the entire file path as a query parameter. It feels obtuse and inelegant. Not to mention, I didn’t really want my server’s filesystem paths to be public knowledge. I would much rather point to the original file, and pass query paramaters on top of that, like so:

There are a number of examples out there that suggest using phpThumb() class directly in your web application. This is fine if you have specific needs, but it does mean you’d need to write your own cache implementation. The default phpThumb() cache works pretty well, as it auto-optimizes directories and checks for filesystem changes. Why reinvent the wheel?

Using a mod_rewrite rule, we can vastly improve the interface for using phpThumb out of the box.

First, install phpThumb in a ‘thumbs’ folder at the base of your image directory:

mysite \
  -- images \
   |--  thumbs

Then, create an .htaccess file in the images directory to specify the following rewrite rules:

<IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /images/
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{QUERY_STRING} ^[wh]
    RewriteRule ([^\s]+(\.(?i)(jpg|png|gif|bmp))$) /images/thumbs/phpThumb.php?src=../$1 [L,QSA]

If you’re not terribly familiar with Apache’s URL rewriting, the idea here is to filter any urls that:

  • Point to the images directory
  • End in an image extension
  • Have a first query parameter of ‘w’ or ‘h’

It will then transform that URL into a proper phpThumb() call:


Simple, and neat.

One more note: In our regex that filters the query string, we’re being strict, and only catching query strings that start with width or height parameters. If you like, you can expand that filter for other phpThumb commands. Or if you want to allow any query string to work, just use ^.+ as your regex.

In the end, simplicity for its own sake should not be the goal. Balancing the amount of complexity that we engage with is something that UX people deal with on a daily basis.

The Dirtiest Word in UX: Complexity, UX Magazine

I often find myself at either end of this extreme, either developing a complex UI with little to no thought put into experience, or propping up a feature-starved interface for the sake of keeping things ‘simple’. This article reflects my own feelings on the topic quite well. It’s important that we don’t confuse ‘simple’ or ‘clean’ with anemic and absent.

Food for thought: if we can break down UI elements to being adjacent in space or adjacent in time, where does the command line fall?

AP Gets Cranky Over Double Standard

Probably the most obvious sign of wrong-headedness in the ongoing old vs. new media dramatic arc is how large media companies think that they can’t be held to their own standards. And their indignation that anyone would even think to expect fair play.

Also, they still don’t get that when they send stupid, angry emails to people, those people will publish them for everyone to see.

No more troll trolls

From the ‘what-do-I-care?’ department comes news that Blizzard will now be forcing users on their official forum to use their real life names when they post. The World of Warcraft forums have long been a cesspit of petty arguments, flame wars, and personal attacks. Obviously, reaction to this news is mixed.

It’s a pretty minor footnote, especially compared with the privacy concerns of a site like Facebook, but considering the number of WoW subscribers, it means that a lot of people will soon be forced to attach their actual name to what they write.

I feel there are two big things we can take away from this:

  1. It is no longer okay to expect anonymity by default on the internet. Years ago, the ability to communicate anonymously over the internet was an asset. It is now a huge liability for any online community.

  2. There’s a fine line between an improvement and a breach of privacy. Forcing people to sign their name to a post is not the same as airing their dirty laundry to the internet at large. An official discussion forum that serves over 10 million subscribes is not the place to expect a right to anonymity.

I side with Blizzard. If any discussion community wants to survive, they have to take measures to battle trolls. Using real names is a fairly easy, innocuous step. It won’t solve the problem, but at least it will prevent people from hiding behind anonymity.

If I Ran the Windows App Store

Miguel de Icaza shares his thoughts on how Microsoft can compete directly with Apple in terms of user experience by adopting a sandboxed execution model through an App store.

It’s really intriguing because it sounds exactly what Windows has needed for years. Of course, I reserve skepiticism of this ever happening, but an app store cum package manager would take a lot of the pain out of running third party apps on Windows.

Apple Should Acquire Dropbox

I think Apple should stay the hell away from Dropbox. Apple’s previous attempts at cloud-based or networked applications have been less than impressve. I don’t want them messing up a good thing.

Also, I’m a happy purchaser of Apple’s hardware, but I would have serious second thoughts about letting them manage my personal data.

[…] saying there’s only going to be one way to do this. But the problem is that then you become only as smart as you can be.

Gabe Newell on Dan Benjamin’s The Conversation

This interview with the founder of Valve paints a picture of the future where companies that embrace exclusion and tightly controller platforms will fail. Newell’s view seem almost the antithesis to the strategy Apple is adapting with the iPad and iPhone. His message is to embrace outside innovation, competition and a ‘wild west’ approach to platform development.

Really? My Top 10 PC Games

PC Gamer recently released their list of top PC games of all time. I was quite a bit disappointed to see what made it into the Top 10. Modern Warfare 2? Oblivion? Great games in their own right, but this is a list of all time, not of the past 8 years.

So I said ‘Feh!’ to that list, and made my own. My criteria is of course, not objective, but rather based on the total number of hours I spent playing these games growing up, and how the memories of them have stayed so sweet in my mind. They come to you in no particular order.

Quest for Glory: So You Want To Be a Hero?

If you’ve never played any Sierra adventure games, you probably won’t get it. If you did, you know what I’m talking about. But the Quest for Glory games were a breed by themselves. They were funny, challenging, and heart-warming. I wish there were more games these days that shared the same sense of humor and adventure.


Yea, yea, so the gravity gun in HL2 was really sweet. But frankly, no game has required that my jaw be picked up off the floor nearly as much as the original Half-Life did when it came out. It made shooters feel smart for the first time.

Wing Commander: Privateer

Lest we forget that Mass Effect was not the first game to put you in the boots of an interstellar bad-ass jetting across the galaxy. Privateer took the awesome gameplay and presentation of the Wing Commander series, and let you be a total hard-ass by doing stuff like smuggling contraband and assassinating space pirates. And the more you did this, the more pimpin’ your spaceship got.

Civilization 2

There’s nothing to say about Civ that hasn’t already been said. I picked Civ 2 because of all the versions I’ve played, it was the one that had me suddenly realizing it was three in the morning most often.

World of Warcraft

Yes, I’m sure there are all days we wished we’d never heard of it. But we’ve got to face up the facts: at times we all want to go questing in a fantasy game world with our friends. Let’s just be thankful we have a good game to do it in, as opposed to WoW’s predecessors which were either boring, sadistic, or required a telnet client.

Age of Empires II: Age of Kings

I’ve played my fair share of RTS games, but none have ever quite given me the same sense of satisfaction in building an expansive network of bases to form a veritable city as Age of Empires II did. On the flip side, nothing ever quite put me in such a bad mood as seeing it turned to dust by a small army of trebuchets (usually led by my college roommate).

Duke Nukem 3d

Doom? Yea, it was cool. Quake? Fantastic. But both games lacked one important aspect: boobs. Seriously. If you had your pick of three awesome first person shooters, wouldn’t you pick the one with boobs? I know my 13-year-old self did. But to be honest, it was a great game, too. Open level designs, interactive environments, creative weapons and great multiplayer (when it worked).

Diablo 2

I ate, drank and dreamt Diablo I for the first few months after it was released. It was that good. But the second one was better in (almost) every way. I actually like to think of Diablo 2 as the predecessor to World of Warcraft, since so many of the now industry standard game mechanics first showed up in the Diablo series.

Baldur’s Gate II

In my mind, Bioware still has yet to out-do Baldur’s Gate 2. It did so many things so right. It struck the perfect balance between story and gameplay. It took full advantage of the D&D license and wove a very rich tapestry. It was challenging and rewarding. It was a game that made me feel proud and accomplished when I beat it.


Most of the games are on this list because they represent the best of breed within their genre, but Portal stands out because it has no peers to compare it to. I remember when games made the transition from 2d to 3d, both players and developers took quite a while to adjust to the new way of thinking. Portal screws it up even further. It is a game that forces you to bend your thinking about physics. Oh, and did I mention it’s funny, too?

Today Valve released their new Steam client for Mac. This is the best gaming news the Mac community has gotten in years.

I remember when Steam launched for the PC in 2004. It was a mess. It would crash, freeze your systems, and the servers were constantly bogged down. Of course, it got better, and now it&#8217;s the only way I buy PC games. Kudos to Valve for doing for games what Apple did for music.

Oh, and all copies of Portal are free until May 24th. If you haven&#8217;t played Portal, go do it. Now.

Today Valve released their new Steam client for Mac. This is the best gaming news the Mac community has gotten in years.

I remember when Steam launched for the PC in 2004. It was a mess. It would crash, freeze your systems, and the servers were constantly bogged down. Of course, it got better, and now it’s the only way I buy PC games. Kudos to Valve for doing for games what Apple did for music.

Oh, and all copies of Portal are free until May 24th. If you haven’t played Portal, go do it. Now.