WordPress 3.0

WordPress Comments Off
Jun 172010

I upgraded this site to WordPress 3.0, which took less than a minute and was completely painless. I also upgraded the themes & plugins. Upgrading the Suffusion theme, which I’m using, messed up all of the options so things might have looked weird while I was fixing the theme options.

May 182010

I have a new photoblog at photos.mcohen.me, where I will be posting my future 365 Project photos, as well as other photos. Most of my Project 365 photos from this blog have been moved there.

May 042010

MarsEdit is one of my favorite applications and it just got even better with version 3.  I have been using MarsEdit for this blog almost since the beginning. I’ve looked at other blog editors, but I always came back to MarsEdit because it just seemed more comfortable and it just worked exactly the way I wanted.

Until now, MarsEdit only supported HTML editing, but version 3 also adds a new Rich Text editor. MarsEdit 3 also adds support for WordPress pages & custom fields and a new media browser that supports iPhoto, Aperture, and Lightroom.

The only thing MarsEdit is missing now is an iPad version.

Rich Text Editor

This is why I’m looking forward to WordPress 3.0:

It was announced at WordCamp San Francisco last year that WordPress and WordPress MU would be merging codebases. This has now happened in 3.0-alpha, and we’re working on smashing bugs and tidying up a few screens. If you’re currently using a single install of WordPress, when you upgrade to 3.0 you won’t see any of the extra screens associated with running a network of sites. If you’re currently running MU, when you upgrade you’ll notice a few labels changing, but upgrading should be as painless as usual. If you’re going to set up a new WordPress installation, you’ll be asked as part of the setup if you want one site or multiple sites, so that’s pretty simple. If you want to turn your single install into one that supports multiple sites, we’ll have a tool for you to use to do that, too.

Right now WPMU, which we use at Teens In Tech, always seems to lag behind WordPress for updates and many plugins don’t fully work in WPMU. I’m really interested in seeing how they manage this.

Server crash

Web, WordPress Comments Off
Feb 182010

As you’ve probably heard, wordpress.com was down today, which means ICanHasCheezburger, FailBlog and other related sites were down. Since my feed proxy script used for the iPhone app accesses those sites, it eventually ended up crashing my entire server.

A support person at Dreamhost explained:

Yeah, the issue was likely that your PHP scripts were hanging due to not
getting a response, which then caused the requests to build up and
overload the running PHP processes.

Nginx update

Web, WordPress Comments Off
Jan 292010

After running Nginx for a day everything seems stable. The memory usage is much lower – I was able to reduce my PS from 458M to 304M. The sites seem faster & more responsive, and memory usage remains pretty much constant rather than fluctuating based on the number of connections, as it did with Apache.

Screen shot 2010-01-29 at 9.18.15 PM.png

All of my sites are now running Nginx rather than Apache, which has several major advantages. Apache uses a separate process for each connection, so if you have a very busy site with lots of simultaneous connections it can use a huge amount of memory. Nginx, on the other hand, uses one worker process with a fixed number of CGI processes no matter how many connections it’s serving.

As you can see from my resource chart, the memory usage dropped dramatically when I switched over to Nginx.

Screen shot 2010-01-28 at 7.31.50 PM.png

Nginx has a few drawbacks, however. It doesn’t support Subversion or WebDAV, so I first had to move my Subversion repositories off my virtual private server. I ended up moving them to ProjectLocker. Most importantly, Nginx doesn’t use a .htaccess file. Instead, it uses its own configuration files, which DreamHost documents here.

Basically you need to create a nginx folder in your home directory, and make a subdirectory for each domain, for example ~/nginx/mcdevzone.com, and create a configuration file, which can be named anything. The syntax is different than .htaccess, although it has many of the same capabilities such as access control or rewriting URLs.

For a WordPress site, all you need is this:

#######################
# Permalinks

if (!-e $request_filename) {
  rewrite ^.*$ /index.php last;
}

DreamHost provides many more examples on their Wiki page, and you can find even more at the official Nginx site.

One important rule you should add to your config file, which DreamHost leaves out, is this one which will prevent users from viewing your .htaccess file, if you still have one.

location ~ /\.ht {
    deny  all;
}

I ran into a few gotchas, but once I figured them out I was able to get everything running smoothly. According to DreamHost’s documentation, the site-wide Nginx configuration file is at /dh/nginx/servers/httpd-psXXXXXX/nginx.conf, but I found that it didn’t exist, at least on my server. Instead it was named nginx.conf.pushing, so as a result Nginx refused to start. Once I renamed it, I was able to start nginx. You WILL need to have an admin user on your private server in order to access that file and restart nginx.

UPDATE: The problem I ran into with the missing config file was because the update didn’t finish properly for some reason.

DreamHost’s older virtual private servers don’t support Nginx, so if you want to use it, you may have to request to have your PS moved to a newer system.

If you have a very busy site, Nginx can help you deal with the load, so it’s worth checking out. Several major sites including WordPress.com, Hulu, and Github are using Nginx, so it’s definitely production quality.

WordPress 2.9

WordPress Comments Off
Dec 182009

I upgraded this site and MacMegasite to WordPress 2.9. Both upgrades took about 20 seconds each using automatic upgrade, one of the fastest & most painless upgrades I’ve ever seen. Of course I backed up both sites before upgrading.

New blog theme

WordPress Comments Off
Dec 132009

If you’ve visited my blog in the last few days, you’ll notice that I changed the theme. After trying out a few themes, I’ve settled on Suffision, which is very customizable with over 20 pages of options. I’ll continue to fine-tune it. I also made my software page the default home page, to emphasize my iPhone applications.

A lot of developers don’t like having their sites loaded into a frame with Digg’s new DiggBar, inspiring several scripts to get rid of the bar. John Gruber came up with a short PHP script that prevents the page from loading with a nasty message if it detects that it’s being loaded in DiggBar’s frame. Gruber’s script inspired Phil Nelson’s WordPress plugin, which adds that script to any WordPress site.

I decided on a different route, using JavaScript instead of PHP and reloading the page outside the frame instead of displaying a message. The result is my Undigg WordPress plugin, which you can download here.

My plugin simply adds the following bit of JavaScript code to the page:

<script type="text/javascript">if ((top !== self) && ((document.referrer+"").substring(7,11) == "digg")) top.location.href = self.location.href;</script>

This is very similar to a standard frame killer, except it only affects the Digg bar while letting other frames load your page.

To install it, unzip the archive, drop ‘undigg.php’ in /wp-content/plugins, and enable it in the plugins screen.

I’ve found the perfect WordPress theme, Atahualpa from BytesForAll, which I’m now using at MacMegasite. Every aspect of the theme is completely customizable with 25 pages of options. I highly recommend this theme. With all of those options, you can easily make it your own.

WP-O-Matic FAIL

WordPress Comments Off
Feb 222009

If you follow me on twitter, you probably saw about 32 tweets spew from my blog, thanks to WP-O-Matic blowing chunks all over my blog, which Twitter Tools dutifully reported as new posts.

I’m attempting to set up automatic photo blogging from my Flickr photo stream. Flickr produces RSS feeds for each tag, so I’m using the tag photoblog to have those images posted here automatically by subscribing to the resulting feed. Unfortunately, Flickr’s tag feed URL has several characters such as ‘?’ or ‘&’ that WP-O-Matic choke on. As a result, instead of seeing my tag feed, WP-O-Matic saw my entire photo stream. Furthermore, although I limited it to post only 5 items, it decided to post each item multiple times.

A work-around for the URL problem is to use a URL shortener such as tinyurl to generate a clean URL for WP-O-Matic. I’ve made it create new items as drafts instead of publishing immediately, so it shouldn’t happen again.

Dec 092008

Blogo is a very intriguing new blog editor with some very unique features, including a built-in Twitter client. It has a very nice rich text editing mode as well as a HTML mode.

Unfortunately the user interface is a lot more cluttered than MarsEdit and, at least for a long-time MarsEdit user, a lot less intuitive.

Blogo
Uploaded with plasq‘s Skitch!

I really like the built-in Twitter client, but the editor looks un-Mac-like. I also find that switching between rich text & HTML modes inserts some extraneous tags. At least for now, I’m sticking with MarsEdit because it looks a lot more Mac-like and feels a lot smoother.

MarsEdit
Uploaded with plasq‘s Skitch!

I started this post in Blogo but ended up using MarsEdit after it messed up the embedded images.

Dec 042008

One of the new features in WordPress 2.7 is “sticky” posts, which will always appear at the top of the home page. The option is pretty well hidden, so unless you know where to look for it, you probably won’t find it.

In the edit or create post screen, there’s a publish options box which lets you specify the visibility for that post, with an ‘edit’ link next to it.

publish options.jpg

Click the edit link and it will expand the box to show the options, including a ‘sticky’ checkbox.

Publish Options Expanded.jpg

You can test for sticky posts in your theme using is_sticky() and change the appearance to highlight those posts.

In the theme’s index.php, alter the class of sticky posts with code similar to this:


    <?php while (have_posts()) : the_post(); ?>
       <div class="post <?php  if (is_sticky($post_id)) { echo 'sticky'; } ?>" id="post-<?php the_ID(); ?>">
 ...

Finally, add a ‘sticky’ style to the theme’s style.css, for example:


.sticky {
	background: #dde;
	padding: 5px;
}

I’ve upgraded MacMegasite to WordPress 2.7. As always, the upgrade was quick and painless: I simply uploaded the files (after backing up the old version) and updated the database through the admin screen. In less than 10 minutes it was back up.

WordPress 2.7

WordPress Comments Off
Nov 162008

I’ve upgraded this blog to WordPress 2.7b3. As always, the upgrade was quick & painless. The only plugin that broke is Leopard Admin, which isn’t really that important any more with the new admin dashboard. I’ll probably upgrade MacMegasite in a few days after more testing to make sure it doesn’t break the forums & other plugins.

Nov 082008

Lorelle warns about a malicious fake WordPress site that looks like the real one, but isn’t. There is no WordPress 2.6.4. The latest version is 2.6.3. If you “upgraded” to “2.6.4″, then you have installed a fake trojan version (more details here and here). If you’ve “upgraded” to 2.6.4, delete your wp-admin and wp-includes folders and replace them with fresh copies from wordpress.org. More detailed instructions for cleaning up are available here.

I upgraded a local copy of MacMegasite to WordPress 2.7 beta 1, which took less than a minute and didn’t break anything. A major Drupal upgrade like that would result in hours or even days of pain trying to fix everything it broke.

I probably won’t upgrade the live site to WordPress 2.7 until at least the release candidate is available, but I’m sure it will go just as smoothly.

This illustrates the big difference between Drupal and WordPress. Drupal makes no attempt to preserve backward compatibility with themes & modules. They even consider it a virtue, making bigger advances possible. Unfortunately this causes lots of pain for people running Drupal-based sites and makes it very difficult to update.

WordPress, on the other hand, manages to maintain full compatibility between releases, yet they still manage to make a big advance in capabilities.

It looks like I’m about to have my first GPU usage overage charge since I switched to MediaTemple due to a large usage spike during my switch from Drupal to WordPress.

Most of the heavy usage occurred during the actual switch and soon after the switch. Although WordPress has a reputation as a CPU hog, I was able to get the usage down to where it was before I switched.

As you can see in the usage chart below, enabling Zend optimizer helped, but enabling WP Super Cache really got it back down to where it was before the switch. Unfortunately WP Super Cache disables the WPTouch plugin, which reformats the page for an iPhone or iPod Touch.

One interesting thing I noticed is that 404 error pages use almost twice as much CPU as successful page requests, so I added static pages for a few invalid incoming links, which also made a big difference.

GPU Usage Report
Uploaded with plasq‘s Skitch!

Oct 132008

I now have a test version of MacMegasite running WordPress at test.macmegasite.com. Try it and let me know if you find any problems.

© 2010 /dev/random Suffusion WordPress theme by Sayontan Sinha

/dev/random is Digg proof thanks to caching by WP Super Cache