Blogging refers to the writing online. I run several blogs, including the blog on this website.

Bulk HTML Validation

I’ve recently been working on a WordPress project in which I made the mistake of starting with a commercial theme that, while beautiful and feature-rich, was a complete mess in terms of code quality. HTML validation is always a requirement on my projects, but a poorly-written WordPress theme combined with WordPress’ own tendency to butcher code by inserting poorly nested <p>’s (more on that later) can make validation a real chore.

The W3C’s Validator is a great tool and the Web Developer Toolbar‘s quick access to it makes the process go even faster.  But with nearly 100 static pages to validate in addition to several hundred imported blog posts written by nontechnical authors, I needed something better.

Enter the Web Design Group’s HTML Validator. This validator isn’t that different from the W3C validator, but it provides an additional key feature: the “validate entire site” option.  By checking this box the validator will spider the URL you provide and validate the first 100 pages that it finds within the same domain.

How I Got Banned From Reddit

Important: I’m not posting this to complain about how I got banned from Reddit. In retrospect I can, albeit somewhat begrudgingly, admit that I probably had it coming.  But just as I always do I’m using my blog as a forum to help people solve IT problems. Only this time around, the problem happened to be one of my own.

Background

Lately I spend a lot of time on /r/techsupport posting solutions to IT problems asked by other users.  Sometimes I post my own problems, and when I think others will find them useful I’ve submitted links to posts on this blog.  Several days ago I got involved with an /r/techsupport question about editing PDF documents.  This is a problem that I’ve helped numerous people solve at work, so I did what I always do: I blogged about it so the next time the problem comes up I can point the user to the link.

The problem arose when I posted the link back to /r/techsupport.  It was immediately down-voted to oblivion, and soon after a few individuals wrote comments accusing me of posting blog spam.  Another individual posted that I had been banned from Reddit. The fact that my profile page is now a 404 error confirms this.

Why I Was Banned

If you’ve read my blog in the past then you know it’s far from blogspam in the commonly understood sense. I almost exclusively post original content and, on the few occasions when I do post links to another author’s information, it’s because I have something to add to it and I always attribute the original sources. Unfortunately for me, that’s completely irrelevant in this situation.

I was accused of blog spamming and subsequently banned from Reddit because I posted a link to my personal blog in /r/techsupport. This is against their rules, but the only way I would have known is by lurking long enough to infer this rule from the actions of other community members. I spent plenty of time as a reader in /r/techsupport.  But what I found out was that I wasn’t really listening.

By the definition of some redditors I am, indeed, a blog spammer.  Do I agree with their definition?  Not entirely; but if I want to play in their sandbox, I’m going to have to learn to play by their rules.

Advice for Surviving Reddit

I love Reddit and in some way I felt a little betrayed when it lashed out at me for reasons I couldn’t quite comprehend. So learn my mistakes, prospective redditors, and consider my suggestions for surviving and thriving on Reddit.

 

Read and Understand Reddiquette

I (sort of) broke one of these rules by posting links in the subreddit that I did, in the manner that I did. Specifically,”Feel free to post links to your own content (within reason). If that’s all you ever post, and it always seems to get voted down instantly, take a good hard look in the mirror — you just might be a spammer.”

Learn by Lurking.

This advice stems from back in the days of Usenet Newsgroups but still holds true today. Take the time to get familiar with the subreddit you plan to post to.  Get to know what sort of posts are acceptable to it’s users and the format in which they expect to see them. If you post something that’s off-topic or otherwise considered inappropriate to the venue, expect to be down-voted, ridiculed, verbally assaulted, or even banned.

Learn your Subreddit’s Code of Conduct

Just like the real world, many Reddit communities have completely different sets of social mores. Some reddits are obvious and even have pages dedicated to what and how to post. Others are not so obvious, so it’s important to follow the previous advice until you get to know the written as well as unwritten rules of your Reddit community.

I found this out the hard way.  Self-congratulatory and self-promoting links are completely acceptable in certain Reddit communities such as /r/diy provided they serve some function other than stroking one’s own ego, and even those are accepted under the right circumstances.  /r/techsupport frowns upon them in a big way. However a moderator told me it’s completely acceptable to post a link to one’s own content, provided it’s a relevant part of a longer post that either asks or answers a question, like this. Get to know these sorts of rules before you post and if you’re unsure, you may consider asking a moderator.

Don’t Take Yourself Too Seriously

Do not post to Reddit hoping for a future filled with pats on the back and “atta boys.”  If you post to Reddit (or just about anywhere else on the Internet), you’re begging for criticism.

I recently saw an individual cross-post a home-brew garden watering system between /r/diy and /r/gardening.  On /r/diy the post was met with mostly respectful criticism and advice on how to correct a couple of beginner mistakes. On /r/gardening, however, the post and author were violently ripped apart. As far as I can tell, it was because /r/gardening expects a higher-than-amateur quality in the gardening content that’s posted there.There also were clearly some community bullies there, just waiting for someone to berate. The user user who posted it handle the criticism with a grace that was not afforded him by his critics.

The point is, Reddit is as nuanced as the people who use it. Most users are courteous individuals, but there is a rotten banana in every bunch, and they are waiting to rip your post apart.  Don’t take it too seriously. Take the high ground in dealing with these people, and don’t be afraid to use the “report” button when they go too far.

 

Summary

I love Reddit and I love blogging.  Right now I’m still trying to strike a balance between these two fascinations and understanding how they can compliment each other.  I’m far from having it figured out, but this experience has taught me a lot.  Are you a Redditor with a personal experience or some advice to share?  I’d love to hear what you have to say on the subject.

Moving Posts Between Categories in WordPress

At some point or another, you may want to adjust the structure of categories in your WordPress blog.  I just ran into such a situation when a client who was previously managing two blogs (one for “News” and one for industry “Ramblings”) wanted to merge their two blogs into a single blog.  Using WordPress and a little bit of SQL, I’m going to teach you how to move posts in bulk to a new category. This tutorial assumes that you are using the default “wp_” table prefix, so make adjustments as neccessary; and as always, create a backup of your database before trying any of the steps below.

Step 1: Create the New Category

This step is easy.  Simply create the new category as you normally would from within WordPress.  After the category has been created, issue the following SQL against your WordPress database to determine the ID of the new category:

SELECT * FROM WP_Terms WHERE category_name = "New Category";

For me, this command told me that the id of my new category was 46, so I’ll remember that and continue to the next step.

Step 2: Find the ID of the Old Category

Now we need to do the same thing, but for the old category.  In my case I am moving all Uncategorized posts to the category I just created, so I need to find the unique ID of the “Uncategorized” category:

SELECT * FROM WP_TERMS WHERE CATEGORY_NAME = "Uncategorized";

This command tells me that “Uncategorized” has a unique id of “1”, so I’ll remember this value and continue.

Step 3: Update the Post/Category Relationship

In this step we’re finally modifying our database, so make sure you have a backup of your WordPress database before you continue.  We’re now going to update the relationship between the posts and the category.  The WP_TERM_RELATIONSHIPS table contains a list of post-to-category relationships.  The OBJECT_ID field specifies the unique id of the posts, the TERM_TAXONOMY_ID field specifies the unique ID of the category. So what we need to do is update any record with TERM_TAXONOMY_ID equal to the value from Step 2 to the ID of the table we created in Step 1:

UPDATE WP_TERM_RELATIONSHIPS SET TERM_TAXONOMY_ID = 46 WHERE TERM_TAXONOMY_ID = 1;

And voila! Your posts will now be treated as members of the new category.

Resetting Your WordPress Password

Bloggers: have you ever forgotten the password for one of your WordPress blogs?  Or attempted to take over or maintain a blog setup by someone else who doesn’t know the admin password?  This is your lucky day!

Assuming you have access to the database containing the WordPress blog’s data, resetting the password is easy. Assuming that the blog is using the default “wp_” table prefix, the user account is named “admin,” and the new password is being reset to “password”:

UPDATE wp_users SET user_pass = MD5("password") WHERE user_login = "admin";

For more information about resetting a lost WordPress password, see the official page on the subject at the WordPress Codex.