Very useful WordPress tip for editing systemwide options

In the process of searching for a solution to a very specific WordPress problem (getting the “Add Media” overlay to default to “none” for the link — no one I know ever wants it to default to inserting a link), I came upon a very useful general tip for WordPress.

WordPress stores a ton of settings in the wp_options data table. But a lot of those settings are not directly accessible for editing in WordPress admin. Or so I thought.

Turns out, it’s not linked anywhere in the admin interface, but if you have the Administrator role, you can access an All Settings page that allows you to edit any record in that table (except serialized data) by going to this URL:

http://YOUR_URL/wp-admin/options.php

Watch out… you have the potential to really mess things up here, which is why it’s not easier to get to. But it’s a handy way to easily update an option, if you know what you’re doing, without having to log into the database directly.

Oh… and if you want to fix the specific problem I was trying to solve at the beginning of this post, look for image_default_link_type and set it to “none”.

The (highly biased) case against CSS preprocessors

Everybody who’s anybody is using CSS preprocessors!

Or so it feels. I’m an old-school vanilla CSS curmudgeon, and the more I’ve dipped my toes into working with CSS preprocessors (specifically, SCSS with Compass), the less I like them.

As I see it, there are three main problems with vanilla CSS:

No variables. Honestly this is probably the only problem I really have with CSS. I’d like to be able to set variables for things like colors that I use throughout a site. To a lesser extent, I see the benefit of “mixins” — reusable chunks of CSS.

Redundant code. It really depends on how you conceptualize your CSS structures, but it is very easy to fall into a habit of writing the same CSS code over and over again, resulting in bloated, hard to maintain files. While I am guilty of this just like anyone else, I find that if you format your CSS code properly you can combine properties efficiently to avoid redundancy without needing any external solutions.

Lack of programmatic logic. Here I’m thinking about things like conditional statements, and also math operations. This is probably as much of a strength as a weakness. CSS is a stylesheet, not a program. It’s a set of rules to be applied to formatting a document. There’s nothing programmatic about it. But still, as CSS selectors become more complicated and convoluted, it is clear that in some cases light programming logic would be helpful.

The real question is, do CSS preprocessors actually solve these problems? Or, more specifically, do they solve them without introducing new problems that are at least as bad as the ones they’re trying to fix?

For me the answer has been, and continues to be, no, they don’t. But I’m trying to get a more tangible explanation for why that is, rather than the simple gut feeling that’s been driving me away from using them up to this point.

What are other people saying?

My first stop in trying to answer this question of why I dislike CSS preprocessors was Google. I wanted to see what other people were saying, pro and con. Here are some interesting blog posts I found, going back a few years to the early (or at least earlier) days of CSS preprocessors:

The problem with CSS pre-processors
This article by Miller Medeiros was the first one I came across a few months ago when I initially pondered this question, and at the time it was all I needed to satisfy myself that I was not crazy for wanting to avoid CSS preprocessors.

So, assuming preprocessors do solve the problems with vanilla CSS, what are the problems they introduce? And how bad are they, really?

I need to get specific to my own situation for a minute here. I have a former coworker who is a firm believer in SCSS, and now that he’s gone, I’m left to maintain and extend the code he was writing. This experience casts my aversion to CSS preprocessors into stark relief.

Maintenance can be a challenge

The most obvious issue with using a preprocessor is that the output CSS is not exactly easy to hand edit, and worse, you shouldn’t hand edit it, because your changes don’t end up back in the original SCSS (or whatever format you’re using) files. If someone else goes back in later and edits the original SCSS and generates new CSS, your changes will get lost.

But let’s set that matter aside for a minute. In a broader sense, one of the key challenges for any web developer is to build code that is easy to maintain. Not just for you to maintain, but for whoever comes after you to maintain. Face it, you’re not going to be working on this project forever. At some point, someone else is either going to need to take it over, or throw away what you did and start fresh.

If you’ve ever jumped into an existing project midstream, or been handed the task of maintaining something someone else built — especially if it’s something built by someone who is no longer around to answer your questions — you know that it’s rarely an ideal situation. Even if the previous developer left copious documentation, it can take hours of picking apart their code to really get a firm understanding of how it all works. This is true with plain CSS too, but at least with plain CSS it’s a lot less work to track down a particular piece of troublesome code.

It’s non-standard

What happens when certain features of your favorite preprocessor get rolled into a future version of vanilla CSS? What happens if similar (but incompatible) features of a different preprocessor become the standard? In short, what if everything you’re doing right now becomes obsolete? How long are you going to hang on to doing things your old way with your no-longer-relevant preprocessor, before you have to scrap it and start over, or at least rewrite big chunks of your code to fit the new way everyone is doing things?

Call me a curmudgeon, but having been a professional web developer for over 18 years I’ve seen a lot of technologies and design trends come and go. I’ve always been skeptical of anything non-standard. I never used VBScript or ActiveX, I never embraced Flash, and in general I’ve done everything I could to both champion and adhere to open standards as much as possible throughout my career.

Suffice to say, resisting CSS preprocessors is just in my blood. They just don’t feel right to me. I’d rather do without features I want, if they’re not part of the standard, than resort to a non-standard workaround to make them happen… especially if it looks like there’s a reasonable chance they’ll be added to the standard at some point in the not-too-distant future.

Newsweek: Brains are back!

And not a moment too soon. A Newsweek article explores the return of intellect and reason to the White House after the shallow anti-intellectualism that has plagued our nation for (at least) eight years.

This may be the number-one reason I supported Obama as vigorously as I did. He is a thinker. He’s curious. He wants to know the truth, and he’s not afraid to question and challenge — or to be questioned and challenged himself. It’s about time!

And now… please… let’s put a few anti-intellectual ideas to bed:

1. Earth is not 6000 years old. We can be reasonably certain through carbon dating and other scientifically validated methods that it is approximately 4.5 billion years old.

2. Evolution is a fact. We can observe it — and we have — at the microscopic level (i.e. antibiotic-resistant bacteria) and in other species with short lifespans (like some insects), and it is a logically consistent explanation for the diversity of life we see on Earth today. Why can’t we witness it happening at the macro level, like in humans? See point number 1. The slice of Earth’s lifespan that your own represents is smaller than the division between Al Franken and Norm Coleman in this year’s Senate race. It’s the same reason we don’t see stalactites grow.

3. Global warming is caused by human activity. Sure, the overall temperature of the planet has fluctuated over the millennia, but the rate of increase in the last 150 years (coinciding with industrialization) is unprecedented.

4. Science is the quest for knowledge and understanding. It is a good thing that everyone should study. It does not preclude religious belief; the two are not mutually exclusive. You do not need to reject science to have faith, and you do not have to reject faith to believe in science. But faith, by definition, cannot be proven, and science can — in fact, that’s what makes it science, and it’s given us just about everything we have in the modern world.

Ahh… it feels good! Brains are back! Now, let’s stop arguing the validity of things we know to be true, and start doing something about them!

After a typo fix, the Coleman-Franken split is now just 236 votes

Yes, according to the Huffington Post, the vote totals between Norm Coleman and Al Franken are now separated by only 236 (although for some reason the StarTribune says 238), out of 2,860,224 votes cast. That’s a difference of 0.0083%. It’s not razor-thin, it’s atom-thin. I was going to draw a graph representing that slice of the pie, but if the “slice” were only one pixel wide, the chart would have a diameter of 53 inches. You’d need one of the largest commercially available plasma TVs just to look at it (and the top and bottom would still be cut off), and the “slice” would still be only about the thickness of your fingernail.

State law would require a recount even if the difference were as large as 14,301 votes, yet Coleman is still declaring himself the victor and calling on Franken to concede.

No way! I absolutely do not want a protracted 2000-style legal battle, but this is simply too close and it’s not even up to Franken whether or not the recount happens. Cool it, Norm!

This is even better than the manualist!

Yes, the manualist from my previous post also played the Super Mario Bros. theme, but I think this is even better: the SMB theme is here being performed by a pair of Tesla coils!

Of course, a quick search on YouTube reveals a ton of creative arrangements of this timeless piece of music. I have to give credit to even some of the less-than-stellar performances, like the one on a ruler. But for sheer audacity, the award has to go to this kid who played it on a church pipe organat a service!