A buddy was having trouble with Cufon not working in Internet Explorer (and, as usual, it was working in other browsers). His site was in Drupal, and we couldn't find any problems. It was also weird that IE didn't have the little error indicator in the bottom corner. The only thing that made me uncomfortable was the number of link and script tags in the document head. So with no real error apparent, we started a wide search in Google.
I quickly found, buried in a forum, that (as you may have known or guessed) IE only loads the first 31 CSS files and ignores the rest. So my friend turned on Drupal's CSS optimization option (which condenses the CSS files into a single file) and it instantly worked (the site had numerous modules installed -- and each brought its own CSS).

This is something worth remembering (hence this little post) because of the ambiguous nature of the problem. It may be something widely-known, but I've never come across it myself. ... since, you know, my sites don't have that many HTTP requests </backdoorBrag>

Let's say you want to output a sentence that varies slightly, depending on the number of users that are in your system. For example, you want it to say one of these variations (a common predicament in my experience):

There is 1 registered person.

There are 398 registered people.

To achieve this, you typically have to write something ugly like this (I'm using the Razor view engine for brevity… aspx would be even worse):

What Is Pluralizer?

Definition in English: Pluralizer is a small library to make simple string formatting easier. It allows you to use one string to express two variations of a sentence that are dependent on a numeric value.

Implementation

First, here is the most basic signature (note that there are a couple of overloads, but more on those next time):

public string Pluralize(string sentence, double number);

You provide the sentence (or, more accurately, the sentence template), and the number that will be used.

For the sentence (in over-simplified terms), follow these basic guidelines:

start by writing the sentence in its singular form.

wrap any words that you want "pluralized" in curly braces

nouns are handled automatically by the built-in PluralizationService class in Entity Framework for .NET 4

only the most simple verbs and pronouns are automatically handled. You'll probably have to handle those by yourself, separated by the pipe character.

the number itself is displayed using the special underscore placeholder (i.e. write this to get the number itself printed: {_})

manually define the singular and plural words by separating them with a pipe character (e.g. {singular|plural}).

Simple Examples

The following are using a simple, static (i.e. singleton) implementation. It is possible to instantiate a pluralizer and teach it, but we'll get into that next time. Also, for these examples to work, you'll have to include "using Pluralize;" at the top of your file.

That's a basic introduction. This alone should save you time and frustration when making friendly messages in your UI. For the next post, we'll into into some more things that you can do like define multiple numeric variables, format numbers, etc.

I am a huge fan of federated authentication technologies such as OpenID and OAuth. I've finally started diving into the DotNetOpenAuth library (more on this in the future, I'm sure). So I downloaded the MVC Relying Party sample project, F5'd it, authenticated using my Google account, and all was peachy. By the way, anyone with any Google account can use the following as an OpenID URL:

I ran into a little hiccup when I ran it a second time. I entered the URL above, and, since I had already authorized "localhost" access to my Google account, I was immediately logged in. All without getting the chance to say "Yes, Google, allow this site to authenticate me through my Google account." Of course, this is how OpenID is supposed to work (one of the things that makes it so wicked awesome), but as a developer I need to be able to go through all the steps sometimes.

I needed a way to revoke access to "localhost", and where/how to do this was not apparent. Google has a magic URL that allows you to manage which sites are allowed to authenticate you using your Google account. That URL is this:

Google Apps Users

Currently, Google is in the process of opening up Apps accounts to have all of the benefits of "regular" (i.e. Gmail) Google accounts (things like Reader, etc.). If you have opted into this when managing your domain, the link above should work for you.

I finally agreed to apply the iOS 4.0.2 update that iTunes was nagging me about. I'm a very security-conscious person, but I wasn't in a hurry to patch the PDF vulnerability because it was easily avoided (indeed, I avoid using the browser at all these days because it's abhorrently slow), and there are many reports of this update not going so smoothly. When I finally agreed to do it, iTunes backed up my phone and started the upgrade. Suddenly I saw a dialog box stating that it had failed. Crap. I tried disconnecting and reconnecting and it still didn't work. iTunes sent me to this page which was completely useless.
Everything was locked down on the phone. No fancy button combination could rescue me. I was starting to get scared that it had been bricked.

It was clear to me that my goal was to revert back to a previous version of iOS; but I couldn't get rid of the recovery mode screen. I tried removing the downloaded file and forcing iTunes to download a new one. That didn't work. So I thought I'd try and recover using a backup that iTunes takes every time I sync. Apparently recovering using a backup requires that the iPhone not be in Recovery Mode. Wow.

Then I thought: I'm stuck in this because of Apple's walled garden. Their bug has caused this. They don't play nice with anything open. Obviously their programmers have trouble with exceptional cases (heck, iTunes doesn't even seem to use a background process!!), so the answer is to remove them from the equation. Look elsewhere!

So I did. And it was solved.

The Recovery

I came across this post that referenced RecBoot, a utility that forcefully takes the phone out of recovery mode. I downloaded it (scanned the download), and ran it with my phone still displaying that Recovery Mode screen. My phone instantly started rebooting. Presto!

Eventually it finished booting and I could enter my password, as if the last hours of fighting with iTunes had never happened! Thank you RecBoot!! I was back in business, nothing changed, settings intact, apps installed, etc. Take Apple out of the solution, and it's solved in minutes!

Don't We Jump Through These Hoops With Other Devices?

Absolutely. From time to time this happens with any high-tech device.

My issue here is this: my phone was actually fine, it was just stuck in Recovery Mode (I think this qualifies as ironic). It was Apple's need for total control, their forcing me to use iTunes (worst. software. ever.), that couldn't seem to flick off the Recovery Mode switch that itself flicked on.

I can forgive other operating systems because they are faced with supporting literally millions of different configurations of hardware and software. iPhone OS has only had to support new 1 configuration per year. If Apple insists on employing a closed, vertically-controlled M.O., I expect my experience be next to perfect if I comply. I got my phone for Christmas 2008. I started having serious issues with it when it was 18 months old. It's damn-near unusable now (maybe I'll really rant later). It can't even recover from it's recovery mode. Seriously, Apple?

I very strongly doubt that, at 18 months old, my user experience would be this bad on another device. And, even if it were, I could forgive to a degree because no other company enforces this much control over its customers. If Apple is going to force me to use iTunes with their products, then it should work. If I had stuck to Apple's products, who knows how long it would've taken to simply disable Recovery Mode (if ever)?

I know I'm not forced to use this product. I chose to when it was the only real smart phone out there. Now it's not, but unfortunately I'm stuck with a terrible contract length (3 yrs) with a worse carrier (Rogers) and the worst selection of smartphones. I'm drooling at the new Android phones that have been coming out and putting even the iPhone4 to shame. I'm sure the iPhone 4 is a nice phone, but it already seems outdated. Will it be usable in 18 months, long before my new contract is up? Will it live through all of the inevitable patches? Do I have strength to endure three more years of iTunes?

I wanted to summarize a list of useful web applications I currently use in the development of web applications -- ones used throughout the entire software development life cycle. This is mostly a spot for me to record the gems (or at least the apps-that-have-possibilities).

This is in response to Dan Zambonini's article on the design of the excellent programming Q&A site, Stack Overflow. In it, Dan suggests some improvements that could be made to the user experience. By the time I typed out my thoughts, he had closed the comments. So, I thought I'd stick 'em up here.