Fully Baking this Blog

Brent makes a plea for “fully baking your blog.” Another way to put it in the Mac community is to make sure your website can stand up to being “Fireballed” (verb) – when John Gruber links to your post and brings a deluge of traffic onto your website, bringing it crashing down like a house of dynamically generated cards.

I used to use Movable Type – which was nice but made me endure long generation times.  Hopefully that has improved since then.

Now I’ve installed WP-SuperCache on this blog as well as my company Happy Apps Blog (which are both powered by self-hosted WordPress). I think that’s probably the best compromise for self-hosted blogs without rolling your own blog software. It also allows you to continue using native clients like MarsEdit.

For some other sites that I host, like NSCoderNightDC, iPad DC and iPhoneDevCampDC that don’t change often, I think static files are indeed the best.

Blog Reboot

Twitter – that’s one word for where a lot of my writing energy has gone.  It’s such an easy way to get out a few words and there’s no pressure to be perfect.

Then again the pressure to be perfect really comes from myself.  But lately I’ve been feeling more of a pressure to write down more of my thoughts and that’s overriding that perfectionism.  So here I am again, this time armed with the latest and greatest MarsEdit 3.0.4.

Of course, every good story has some conflict.  Tonight I realized that my blog had been hacked.  It seems like there were some spam links that were hidden in the page. The only things I did notice was that:

1. Sometimes my theme would get reset.  Not a huge deal but annoying.

2. Every once in a while a new WordPress user would register for no reason.

3. MarsEdit couldn’t my recent posts, instead offering up a -32700 error.

Fortunately that last error got me to Daniel Jalkut’s helpful support forum which helped me find the answer: the wordpress.net.in spam injection hack.

So a quick backup, removal of the old site, and installation of WordPress 3.0.1 and this blog is back in business, now spam link-free.  It’s kind of like encountering the Blue Screen Of Death and hitting Control-Alt-Delete.  A Blog Reboot.

Now I remember why I use Apple products.  So is there a more hack-proof blogging engine out there that will preserve old WordPress entries?

Lessons Learned: Blank page of death after upgrading to WordPress 2.7.1.

I had the blank page of death problem when logging in to my blog after upgrading to 2.7.1. What this means is that after I logged in, I would just get a blank white page with no page source.

To workaround this, I was tediously moving the akismet directory or the plugins directory to login and then moving it back afterwards.

I finally fixed it by looking in the plugins/akismet/ directory and found an akismet_mmddyyyy.cache file and deleted it.

Lesson learned: Delete *.cache files in your plugins/akismet/ directory whenever you upgrade your WordPress blog.

UPDATE (2009-06-18): This problem happened again and I solved it by deleting any .* files in the plugins/akismet/ directory. Specifically, I found .akismet.bak.php and .readme.cache.php.

Lessons Learned: WordPress Comments Disappearing and Spam

Today I emailed my favorite coffee company Beanetics to ask them to have a repeating order of coffee and to remind them that I have the #11 Google hit for “beanetics.” OK its not #1 like it used to be, but it still good. While I was checking the permalink for the post, I noticed that all the comments were missing even though it said that there were 2 comments on the post.

I went to login and it didn’t let me in. I had this problem before so I renamed my wp-content/plugins directory. I logged in and there were 0 comments in the system! Yikes! All my WordPress comments had disappeared!

I went into the wordpress MySQL database and when I typed in “select * from wp_comments;” it replied back with the ominous but helpful: “table wp_comments marked as crashed.” Alright, I think we can fix that. I typed in “repair table wp_comments;” and it reported that all was well again.

I went back into my Comments admin and found that there were 10,445 spam comments! 10,445 – spam is bad but I didn’t realize it could crash your WordPress comments bad.

Alright so after verifying that all my approved comments were back, I had lunch. I came back two hours later and found I had 100 emails – all for pending spam comments. Oops – I had disabled the Akismet spam filter when I renamed my plugins directory earlier.

OK so to make sure this doesn’t happen again in the future:

1. I went to Plugins / Akismet Configuration and checked the box “Automatically discard spam comments on posts older than a month.”

2. I went to Comments / Spam and pressed the button “Delete All Spam”. That should tidy up the wp_comments table and the entire WordPress database quite a bit.

How to fix a corrupted WordPress comments table

I logged into my WordPress admin panel and saw these ominous warnings:

'./your_wordpress_database/wp_comments' is marked as crashed and should be repaired.

Uh oh. That doesn’t seem good. I went to one of my blog posts and it said the same thing. OK no need to panic. I run my own WordPress on a virtual private server and also administer my own MySQL databases.

The solution is remarkably simple:

  1. Run the mysql client. mysql -u your_wordpress_user -p
  2. Switch to your WordPress database. use your_wordpress_database
  3. Issue the command repair table wp_comments

If your WordPress 2.1 is slow…

I just debugged a strange issue with this WordPress 2.1 blog. It’s running 2.1.2 to be exact, but I think the problem manifests itself with all 2.1.x versions. My site was running really slow – 40-50 seconds per page load. I had just moved it to this new host which is also running a few Rails apps. The Rails apps were running *fast*, so it wasn’t the box.

I checked top and it showed the box was fine. I bounced Apache and MySQL. Still slow. I tried static pages – those were fine. I tried a phpinfo page – that was fine.

I googled and googled and finally found this WordPress thread: [resolved] Update a post and blam.. every pageload is 20 seconds. The solution? I had to add www.luisdelarosa.com to the /etc/hosts file. I guess WP 2.1 has some sort of reverse DNS code in it.

So – if your WordPress 2.1 site is slow, add your blog’s hostname to the /etc/hosts file. You could also backtrack to WordPress 2.0.1. I’ll have to look into moving over to Mephisto sometime.

Poor Man’s FeedBurner

I wanted to get an idea of how many subscribers I had to my new blog MacHappy. It’s a blog I started to talk about Mac stuff and also the Mac apps I’m writing which I call Happy Apps.

I thought about using FeedBurner, but I really like hosting my own feeds. Plus I haven’t had the need for their wide array of services yet…except for the readership count.

So back to figuring out how many subscribers / readers for a blog. MacHappy is on WordPress and its feed is at http://www.happyapps.com/blog/feed/, which means that the feeds all have “/blog/feed” in the URL. If you’re got a WordPress blog, you’ll have the same sort of setup. This blog is hosted on Movable Type, which is a bit different since usually you have atom.xml or whatever you call your feed template (usually ending in .xml). I’ve actually got two feeds here: a feed for everything and a feed just for Eclipse.

Then you download your log file from your ISP.

Then run this nice series of piped commands (for WordPress): grep /blog/feed yourLogFile | awk ‘{print $1}’ | sort | uniq | wc -l

(for Movable Type): grep .xml yourLogFile | awk ‘{print $1}’ | sort | uniq | wc -l

And for my eclipse.rss feed, something like grep .rss yourLogFile | awk ‘{print $1}’ | sort | uniq | wc -l

You should get a nice integer back, hopefully a nice big one. :)

It’s not exact since the same person could be checking from multiple locations throughout the day, but I think I’ll be using this to keep track of the trend.