A few thoughts on David Letterman’s final show

Last night was the end of an era, David Letterman’s final Late Show.

Late Night with David Letterman premiered on NBC when I was 9 years old. I remember quietly staying up well past my bedtime on many school nights in the 1980s to catch Letterman’s crazy antics. It turns out I had a penchant for absurdist humor of a kind that I may never have known existed until I saw David Letterman. Growing up in a rather socially conservative small town in the midwest, Letterman was one of a few key figures in opening my growing mind to the possibilities in a larger world. That sounds a bit overblown, but really, it isn’t. Letterman’s show on CBS has become such an institution over two decades — something that I’ve taken for granted, really, and not watched much in years — that it’s easy for me to forget just how huge David Letterman was to me in my formative years.

All of that came into sharp relief for me last night as I just barely managed to catch Dave’s final show. I knew he was retiring, and I had been reading enough about him lately to know that his final show was coming up sometime soon, but I didn’t know it was going to be last night until about 20 minutes before the show came on the air.

I found out about it because my college jazz band director mentioned it on Facebook.

I was lying in bed a little after 10 PM, idly checking Facebook on my iPhone, intending to set the phone down and settle into a crossword puzzle before going to sleep. Seeing that Letterman’s finale was imminent, however, I quickly changed my plans and turned on the TV. This was probably only the third time our bedroom TV has been turned on since we moved into the house last November.

There’s a lot packed into that last paragraph. The futurism of constant communication and instant access to the world of information via the ubiquitous pocket computers we call smartphones. How old I sound when I think of myself sitting in bed doing a friggin’ crossword puzzle. The shifting (and diminishing) cultural significance of broadcast television.

When Carson retired, it was a momentous event. It seems like from the ’60s to the ’80s, everyone watched — or at least had on the TV — The Tonight Show, on a nightly basis. As much as David Letterman revolutionized late night television and shepherded in a new era, he also came at a time of change he couldn’t control, and was both a victim and agent of a cultural shift that ensured his legacy would never be as great as that of his hero and mentor.

And yet, Letterman is the Carson of his generation, at least as much as anyone could have been. (Leno? Give me a break!)

Without a doubt my most vivid memory of Letterman, and honestly one of the most vivid memories of my youth, altogether, was Crispin Glover’s notorious, possibly drug-fueled, appearance in 1987 when he tried to kick Dave in the face.

I was delighted to see that moment in the rapid-fire montage of stills from 33 years of Dave’s show at the end of last night’s finale. It just wouldn’t have been complete without it.

That montage was a nearly perfect conclusion to a lifetime of late night TV. According to some reviews I’ve read this morning, it was the main portion of the show that Letterman had direct involvement in producing. And it was apparently Dave’s personal wish to have the Foo Fighters perform “Everlong” behind the slideshow, because that song touched him personally in his recovery from open heart surgery 15 years ago. (Fifteen years ago!) It occurred to me that this conclusion was almost like Dave’s life — his television life — flashing before his eyes. But not just Dave’s life, our lives, as his audience. Even though I haven’t watched his show regularly since I was in college in the mid-’90s, there were so many familiar sights in these final few moments that I realized that in a way, this was all of our lives. For 33 years millions of Americans have invited this weird guy into their homes on a nightly basis, and he has shared moments of absurd delight with all of us.

Thanks, Dave.

How to REALLY check if the content is empty in WordPress

Problem: You want to check if the content in a WordPress post is empty. Seems easy, but do a Google search on the topic and you’ll see the question asked and — incorrectly — answered several times.

The fact is, I know how to do this. I was just hoping there was a built-in function in WordPress that I didn’t know about. Apparently not, so I wrote my own.

Why isn’t it easy and obvious how to check for the content being empty? Well, you could do this:

if ($post->post_content == '') { ... }

That will work. If the content is really empty. That means a zero-length string. As in strlen($post->post_content) == 0. Which it might be. But probably not.

If you’ve worked with real world site content, or even someone else’s Word documents before, you know that blank space is invisible, and a lot of times there’s a lot of blank space in a document that is not truly “empty.” Spaces, line breaks, HTML paragraphs with nothing but a non-breaking space in them. It all takes up space, and makes the content look empty, even when it’s not.

That last example is the critical one here. A WordPress post may look like it has no content, but if someone pressed Enter while the cursor was in the content box and then saved the page, it most likely has at least one <p>&nbsp;</p> in it.

So what you need is a function that takes all of that invisible cruft into account. Since it doesn’t seem like WordPress has such a function built in, I wrote my own, which I have made as compact as possible:

function empty_content($str) {
    return trim(str_replace('&nbsp;','',strip_tags($str))) == '';
}

This function takes the string you pass into it, strips out all HTML tags, then removes any non-breaking space entities, and then trims all whitespace. If there’s nothing but that stuff, then it becomes an empty string. If there’s any “real” content, the string won’t be empty. Then it just compares whatever it has left against an actual empty string, and returns the boolean result.

So now if you want to check if the WordPress content is really empty, you can do this:

if (empty_content($post->post_content)) { ... }

This will return true if the content is empty; false if it’s not.

Update (8/31/2017): This post continues to be one of the most frequently viewed on my blog, and I’ve been meaning for ages to amend it with this important note. As written here, you’ll get an erroneous true returned if the only content is in HTML, for instance, an image. If you want the function to return false if there’s no text content, then leave it as-is. But you can add a second input parameter to the strip_tags() function to tell it to leave certain HTML tags alone. If you want to allow image tags, for instance, the modified code would read as such:

function empty_content($str) {
    return trim(str_replace('&nbsp;','',strip_tags($str,'<img>'))) == '';
}

How to really exclude the home page in the WordPress wp_page_menu() function

I’m posting this little tip for my future self as much as for anyone else.

The problem: It seems that in recent years WordPress has all-but-deprecated the wp_page_menu() function in favor of the wp_nav_menu() function, but the latter is primarily intended for Custom Menus, and there are some cases where Custom Menus aren’t what you want.

I’m working on a couple of sites right now that have a lot of pages, and I don’t want their editors to have to go over to Appearance > Menus every time they add or move a page. I’m relying on the CMS Tree Page View plugin on these sites to allow the clients to leverage the built in Parent / Order settings on pages to manage their primary navigation, rather than managing a separate Custom Menu.

Since I’m not using a Custom Menu, I don’t want to use wp_nav_menu() at all; I pretty much have to use wp_page_menu(). Which is fine. Except for the fact that the site designs do not call for having Home in the navigation.

No problem, right? After all, I can just add 'show_home' => false to the arguments passed to the function, and it will remove the home page.

But it doesn’t.

I’m not entirely sure what’s going on in the WordPress core here, but I suspect that show_home only works if you’re using the old school default configuration of WordPress that calls for the home page being the main “posts” page. And who does that anymore? If you’ve created a custom home page, even if you’ve configured WordPress properly to display it as the main page, this function doesn’t care. (Do functions “care” about anything? But I digress…)

Remember also that there’s an exclude argument, to which you can pass a comma-delimited string of post IDs to exclude. That works, but… ugh. You mean I really have to hardcode the post ID of the home page right into my header.php file?

Of course not. Use this: get_option('page_on_front') and it will automatically find the home page. This is great if you want to be able to reuse a theme or custom function on multiple sites or just not commit the transgression of hardcoding something that really doesn’t need to be hardcoded.

Here’s the complete code sample. Note there’s no need to bother with show_home at all.

wp_page_menu(array(
    'exclude' => get_option('page_on_front'),
));

Edge of what?

Let’s talk about Internet Explorer for a minute. Approaching two decades into a career as a web developer — cripes! how is that even possible? — I have spent a big chunk of my life hating Internet Explorer.

There was a time when I didn’t hate it. For several years, Internet Explorer was the best web browser for the Mac. (Yes, really!) But right around the time Apple released Safari and Microsoft decided to pull the plug on the Mac version of IE, everything started to go sour.

In the early 2000s, when Windows XP was released, and Internet Explorer 6 along with it, Microsoft dominated the tech world. Especially the business tech world. And with the web standards movement in its infancy, Microsoft could pretty much do whatever they wanted with the browser. Internet Explorer 5, 5.5 and 6 each introduced new, Microsoft-only technologies (VBScript, ActiveX, .NET, etc.) that became deeply entrenched in the business world, where countless corporate developers created indispensable internal web applications that were not only dependent on Internet Explorer, but specifically on quirks of version 6 (or 7) of IE. It’s a big reason why there are still office computers running Windows XP and IE 6 or 7. Because even as bad as IE 8 is, it was the beginning of Microsoft’s acknowledgment of the changing times and reluctant move towards web standards.

Long story short, I don’t just hate IE because it’s from Microsoft, or because it’s fun to bash on. Contrary to the impression I sometimes give, I don’t hate Microsoft, and as much as I love to crank, I’d prefer a world where I didn’t have things to crank about. I hate Internet Explorer because it has made my job harder, for most of the time that I’ve been doing this work.

So, it probably goes without saying that I took the announcement of the death of Internet Explorer as good news. Of course, Microsoft has to make its own browser. Uh… just… ‘cuz. Of course. So with IE going away, Microsoft has announced “Edge”, their new browser.

Meet the new browser, same as the old browser

This morning Brand New posted the new logo/icon for Edge. At least, I think it’s a new logo. For a new browser.

edge
Source: Brand New

What is this? No, seriously. What. Is. This.

This logo fails for me on several levels. First, and most obviously, it evokes Internet Explorer. Why would Microsoft want to do that? They’re killing IE for good reason. Why create an immediate association between it and their new browser?

I think this new logo fails both conceptually and in its execution. It’s just plain ugly. But more than that, the slice/swoosh thing doesn’t work. In the old logo, it was part of the “ring” around the “planet” that the perfect circle “e” represented. A bit hackneyed conceptually, but at least it was a consistent concept. But by using the “e” from Microsoft’s new humanist corporate font (I think) — which, taken on its own, is kind of an ugly shape anyway — I think, you lose the “planet” concept. And the rest of the ring outside of the “e” is gone too. So all you have left is this weird “e” with a slice missing, which makes absolutely no sense. The only explanation for the slice is as a deliberate evocation of the old Internet Explorer logo, which again it seems they should want to distance themselves from.

I like the new blue color. That’s about the only good thing it has going for it.

So far I have not tried the preview release of Microsoft Edge. Frankly, as a web developer, I am not enthusiastic about having to support another new browser, and I’m not confident that Microsoft is going to make a very good new browser, even though IE 9 through 11 were pretty decent. All I have to go by, at this point, is this logo. And what it tells me is that Edge is just a crappy knockoff of an already crappy browser. No thanks.

Postscript: I just noticed that exactly 6 years ago today I wrote a blog post that also discusses Internet Explorer. Even then — SIX YEARS AGO — IE 8 was out and I was already cranking about IE 6 as an old and outdated browser.

Some thoughts on the target market for the Apple Watch Edition

Thoughts on the Apple Watch have been simmering on my mental back burner since it was announced in September, and I followed along with the announcement yesterday to see what new things we might learn about the product — most significantly, the prices for the higher-end models. All we knew up to this point was that they “start” at $349, and that’s for the lowest-end, anodized aluminum Apple Watch “Sport”, with a “fluoroelastomer” (a.k.a. rubber) band. (Side note: It seems Apple is taking great pains not to call the band “rubber” in their marketing, yet I noticed Christy Turlington Burns, in her appearance on stage yesterday, referred to it — quite dismissively, no less — as “rubber”, and I think I saw Tim Cook flinch just a bit.)

The stainless steel “regular” Apple Watch and the gold Apple Watch “Edition”, with fancier bands, would clearly cost more… much more. I was frankly surprised the starting price for the steel Apple Watch is only $200 more than the Sport, and I was not at all surprised that the Edition starts at $10,000. But the fact that it does start at $10,000 got me thinking more about why. I have some ideas, which I will explore here, but first some more general thoughts on the Apple Watch.

Not my taste

First off, I personally am not really in the market for an Apple Watch at all. I find it interesting, but a) I don’t really want to wear something on my wrist, and b) I’m not interested in this until the second or third iteration. But if I were to buy an Apple Watch, there is absolutely no question that I would get the Sport. I wouldn’t even consider either other option, and price is only a small factor in that. I just don’t like shiny objects. Perhaps it’s my stubborn proletarianism lashing out, but I find wearing shiny items like a highly polished watch (in either stainless steel or gold) to be an ostentatious display of… something. Not my personality.

I especially dislike gold. I can tolerate the mild “champagne” gold color Apple has introduced on the iPhone, iPad and now MacBook, though I don’t personally want them. But pure, shiny gold is something I associate closely with Donald Trump’s raging ego. (Sorry… very specific and most probably unfair, but it is what it is. Again, just my personal taste.)

Clearly I am not the kind of person who desires high-end luxury goods. I appreciate high quality. That’s why I like Apple’s products in the first place. But there is definitely a level of luxury to which I cannot, and emphatically do not, aspire. So be it. Despite my own tastes, I do think I have some idea why Apple has created the Edition version of its watch, to whom it’s targeted, and why it costs so much.

So whose taste is it?

Most people who can’t afford it think $10,000 is an insane price to pay for a watch, and they especially cannot comprehend how someone would want to spend that much on a high-tech watch that will become obsolete in a few years. I’ve read many comparisons with Rolex and other high-end mechanical watches that are priced in that range, which are typically bought to last a lifetime, if not to become a family heirloom passed down through the generations.

This cannot be exactly the audience Apple is targeting, either. Because there’s a range of wealth where someone can afford a $10,000 watch, but it’s still a substantial investment for them — the kind of thing you buy once, ever. And then there’s the range of wealth where someone can easily drop $10,000 on a whim and not think twice about having to do so again in a few years.

This is the target market for the Apple Watch Edition. It’s extremely small. But it exists.

So the question then becomes, why is Apple targeting this market at all?

Watches are different from phones and other gadgets in a significant way that Tim Cook touched on yesterday. But he didn’t fully probe that difference and why it might make sense for Apple to create a “disposable” product with a 5-figure price tag. Watches are something you wear, a fashion accessory in a way that other objects that you merely hold or carry in your pocket are not. They are an extension of who you are, at least for some people, and quite likely for this exact small niche market I’m talking about.

In short, I believe the subset of people for whom the Apple Watch Edition is made are, in general, willing to carry the same smartphone as “the masses”… but they are not willing to wear a similarly proletarian watch.

These people are important customers to Apple. Not just because they spend a lot of money on Apple’s products, but also because they tend to be high profile people whom Apple wants the public to see carrying, using, and now wearing Apple’s products. And the only way to get them to wear an Apple Watch is to make one that is as pretentious “discriminating” as their other tastes.

But why so exclusive?

Now there is one point Tim Cook mentioned that I interpreted in a different way from other analyses I’ve seen of yesterday’s announcement. Tim Cook said something to the effect that Apple Watch Edition will be available only in extremely limited supplies, and only in “select retail stores”. Most of what I’ve read suggests this means that only some of the Apple Stores will be carrying Apple Watch Edition. Personally, I don’t think any Apple Stores will be carrying it. I think it will only be sold in exclusive luxury jewelry and watch stores. Rodeo Drive kind of places. (I guess… what the hell do I know? I’m sure there’s some ultra-luxury shopping venue I’ve never even heard of, and the people who shop there look down their noses at lowly Rodeo Drive.)

The point is, I think Apple is going out of their way to make Apple Watch Edition so absurdly ultra-exclusive because there’s a very small, very wealthy, and very important niche market for a product this extreme, but for whom it needs to be this extreme, solely as a differentiator. For everybody else who might even consider such a product — everybody — they will be satisfied by either the Apple Watch Sport or the Apple Watch.

The only difference between the regular Apple Watch and the Edition is the metal and the strap. The electronics are identical. The amount of extra R&D Apple had to put into creating the Edition can probably pay for itself, even if the Edition sells just a few hundred units. So, from that perspective, why not create it? But if you do, the only way to make it worthwhile is to go all out, if not completely overboard, with the exclusivity and perceived “luxury” of the object.

I think that’s exactly what Apple has done.