WordPress – 10 Tips and Recommendations

Blogging August 30th, 2008

Since my recent move to WordPress I’ve been crawling the web looking for useful WordPress tips and ticks. Below are my essentials for anyone using WordPress:

Security

Protect Your Login Page from Bots

The LoginBlock will prevent bots from continuously trying different combinations to crack your account. This is very similar to how Windows works if you’re in a domain environment.

Every failed login attempt is recorded, along with the timestamp of the attempt and the IP address of the user. If a user tries (and fails) to log in too many times within a certain time period, the system then blocks any login requests coming from that IP range until the lock-out is released. The lock-out period defaults to 1 hour, although that can be changed within the admin panel. The number of retires and the time period that they occur within in order to trigger a lock-out are also configurable from the admin section, and admins do have the ability to release an IP block manually (assuming of course that they haven’t locked themselves out :D ).

Secure WordPress’s Folders
Prevent readers from browsing your WordPress files and folders by adding the following line to the .htaccess file on the main WordPress installation folder:

Options All -Indexes

Storage

Save Space – Turn off WordPress 2.6 Post Revision
WordPress 2.6 introduces post revisions allowing to save and access all the previous versions of a document.
This feature is mainly useful for blogs with multiple authors who work on the same blog post (editor corrections etc.) but its pretty useless to most blogs out there and unnecessarily increases the databases size.

To disable post revisions add the following line to wp-config.php:

add_filter( 'pre_comment_content', 'wp_specialchars' );

Change the Default Image Upload Folder
The default installation settings store your uploaded files under the wp-content/uploads folder.

image

As you can see in the picture above, you can change the uploads folder to any folder, and even use a subdomain to serve files.
This has several advantages:

  • File URLs become relatively smaller
  • When using a subdomain, the files URL is independent to their actual location on the server. You can easily move them or even host them on a service like Amazon’s S3 (if your traffic will grow) without changing the URLs in your posts.
  • The WordPress installation folder becomes small and manageable.

Promote Your Blog\Be Sticky

Conversation is what makes a blog interesting, it also gives readers a reason to come back to your blog.
The following tips will help you make your blog a little bit more sticky to the readers:

Allow Readers to Subscribe to Comments 

When an occasional reader makes a comment on your blog, chances are he’ll never remember to go back and check for responses. If he does, it will only be through a short period of time.
Subscribing to comments helps the conversation flow, which is what blogging is all about. People are genuinely interested in knowing what others think of their comment and this feature saves them time having to manually check for new responses.

Subscribe to Comments is probably the most important plugin you can install on your WordPress. It adds a check-box below the comment form on each post, and when checked by a commenter, they then receive an email update as soon as someone adds a new comment after theirs.

Support Social Bookmarking

Help your readers promote and share your posts by using ShareThis or Sociable to provide quick links for posting into sites such as Facebook, Digg, etc.

image

Promote OpenID

OpenID is a win-win for blog comments.For the comment author, it means less information to type. For the blog owner it means that comments have a real identity behind them. Simply install the WP-OpenID plugin and you’ll get support both for OpenID comments and for OpenID WordPress login.
image

Be Mobile Friendly

With the introduction of SmartPhone, and especially the iPhone, more people are now browsing for content using their mobile devices.
When browsing from a mobile device users expect a simple listing of blog posts in a reverse chronological order. If they’d like to read a post, they can click on the title and get a mobile friendly version of the post.

The easiest way to support mobile devices is to use Google Reader.
Google Reader generates an excellent mobile view of your RSS feed without any effort. All you have to do is append your feed address to the following URL and your mobile blog is ready:

http://www.google.com/reader/m/view/feed/<feed_address>

For example here’s how it renders DeveloperZen’s feed (http://www.google.com/reader/m/view/feed/http%3A%2F%2Ffeeds.feedburner.com%2Ferankampf):
image

You can call this link “Mobile View” and place it at the top of your blog design so mobile phone users will notice it instantly and switch to the mobile view. Alternatively you can map it to a subdomain like m.yourblog.com and points mobile users there.

I’m using WpTouch to support iPhone devices (its good for most mobile devices, not just the iPhone). Its easy to install and configure and looks absolutely great..

 phone-rev133

Optimize for Search Engines

The SEO All in One plugin lets you easily optimize your your titles, meta tags and headers rather than being limited to WordPress’s defaults.

Stats

Tracking your blog’s statistics lies at the core of any well thought out marketing campaign for your blog. Why jump back and forth between Google Analytics, FeedBurner and various other tools when you can simply put the summary data in your WordPress administration dashboard?

  • WordPress Reports – This plugin gathers and displays data from Google Analytics and Feedburner to display a comprehensive report of what’s been happening on your blog for the last 7 days. It also comes with a Most Active Content allowing you to display your top content on the sidebar. Since it gathers information from Google Analytics and FeedBurner it doesn’t add tracking codes to your client code and increase server load.
  • StatPress is a real-time plugin dedicated to the management of statistics about blog visits. It collects information about visitors, spiders, search keywords, feeds, browsers etc. and displays live and up-to-date information in the administration dashboard. It also comes with a StatPress Top Posts widget.

Sneak Preview – Nuconomy Blog Stats

We’ve been working very hard here at Nuconomy on a plugin for WordPress and WordPress MU. It’ll soon be public but for now here’s a sneak preview:

image

image

Tags:

Is Amazon’s Kindle The New iPod?

Technology August 13th, 2008

Amazon’s shares jumped by more than 9% following Citigroup analysts Mark Mahaney predicting its Kindle to become the “iPod of books”:

In a report to clients, analyst Mark Mahaney said Amazon could be on track to sell as many as 380,000 units of the Kindle this year. This would match the number of sales for the iPod digital music player in its first year on the market, leading the analyst to predict that the Kindle “is becoming the iPod of the book world.”

Mahaney predicted that the Kindle will likely top the lists of holiday “gadget gifts” this year. He warned that his projections do not account for a possible launch of an updated version of the device.

Personally, I want one! I just can’t wait for Amazon to release a Wifi version that’ll work world wide and will save me delivery costs and time when ordering my books.

I’m exactly the kind of person the Kindle appeals to – a techie who reads lots of books (mostly tech too) via Amazon.
I don’t think its a very large niche…  at least, not as large as the iPod’s target market…

I find it ridiculous comparing Kindle success to the iPod simply because of one people fact: People don’t read anymore!

Apparently, I’m not the only one holding this opinion:

Today he had a wide range of observations on the industry, including the Amazon Kindle book reader, which he said would go nowhere largely because Americans have stopped reading.

“It doesn’t matter how good or bad the product is, the fact is that people don’t read anymore,” he said. “Forty percent of the people in the U.S. read one book or less last year. The whole conception is flawed at the top because people don’t read anymore.”

By the way, the US is ranked 18 in literacy rate…  Just a fact worth mentioning…

Tags:

Scaling Web Application – Recommended Readings

Programming August 13th, 2008

Designing for scale is one of the greatest challenges when building when building web applications for the Internet. The huge scale of the Internet and the amount of potentials users requires applications to be able to handle huge amounts of data and traffic.

Today’s Internet applications has to be design with large scale in mind:

  • It has to be able to accommodate increased usage
  • It has to be able to accommodate increased data volumes.
  • It has to be maintainable

While the need seems obvious, implementing a working solution seems is not trivial, and so we see a lot of new companies that fail to handle the load (Cuil, Twitter, ….)

Joining Nuconomy‘s ranks recently has opened me to the world of web scalability. And so, I’ve had to do quite a lot of reading the past couple of weeks.

I’ve compiled a list of the best resources I came across:

  • The following presentation by Cal Henderson provides a detailed overview of common patterns and approaches when building application for high availability and scale (you might also want to check out his book his book) :

SlideShare Link
(removed their player embed as it was throwing internal exceptions. So much for SlideShare’s QA…)

We describe our experience building a fault-tolerant data-base using the Paxos consensus algorithm.
Despite the existing literature in the field, building such a database proved to be non-trivial. We describe
selected algorithmic and engineering problems encountered, and the solutions we found for them. Our
measurements indicate that we have built a competitive system.

We used the Paxos algorithm (“Paxos”) as the base for a framework that implements a fault-tolerant
log. We then relied on that framework to build a fault-tolerant database. Despite the existing literature on
the subject, building a production system turned out to be a non-trivial task for a variety of reasons:
While Paxos can be described with a page of pseudo-code, our complete implementation contains several
thousand lines of C++ code. The blow-up is not due simply to the fact that we used C++ instead
of pseudo notation, nor because our code style may have been verbose. Converting the algorithm into
a practical, production-ready system involved implementing many features and optimizations – some
published in the literature and some not.

Got some more interesting scalability resources to share?  feel free to leave a comment…

Tags: , , , ,

The Dark Side of LINQ

.NET August 5th, 2008

I’ve been having mixed feeling for quite some time now regarding LINQ.
Sure it can make working with data sources a lot easier and it can definately save a lot of code…
But, what happens with the following C# foreach statement

List<KeyValuePair<string, string>> resultList = new List<KeyValuePair<string, string>>();
string[] paramsArray = parameters.Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries);
foreach (string p in paramsArray)
{
    int index = p.IndexOf('=');
    if (index > 0)
    {
        string key = p.Substring(0, index);
        string value = p.Substring(index + 1);
        resultList.Add(new KeyValuePair<string, string>(key, value));
    }
}

IEnumerable<KeyValuePair<string, string>> result = 
    resultList.Distinct((p1, p2) => p1.Key == p2.Key);

Turns to this query:

var distinctPairs = (from keyValuePair in parameters.Split(new char[] { '&' }, StringSplitOptions.RemoveEmptyEntries)
                     let index = keyValuePair.IndexOf('=')
                     where index != -1
                     let key = keyValuePair.Substring(0, index)
                     where !string.IsNullOrEmpty(key)
                     let valueText = keyValuePair.Substring(index + 1)
                     select new { Key = key, ValueText = valueText })
                             .Distinct( (p1, p2) => (p1.Key == p2.Key) )
                             .ToArray();

I don’t know about you but I find the first version a lot more approachable, readable and quicker to understand. The same code in LINQ is not shorter and looks simply looks Evil.

LINQ is like the force… It can be used to wonderful code that is simple and functional, but it also has the potential of producing cryptic code that’s hard to maintain.

Use it wisely and don’t be tempted for its dark side…

Tags:

Migrating from dasBlog to WordPress

Blogging August 5th, 2008

I’ve recently decided to move my blog from dasBlog to WordPress. The reason for this move is mainly because dasBlog really lacked several features that were important for me and I found WordPress to be much more mature platform with a wide community support.

Moving the blog to WordPress turns out to be not as complex as I thought it would. However there are some pitfalls that are important to avoid in order for the process to really be as quick and simple as possible.

When moving our blog we have two main tasks: migrate all the blog’s data (post’s etc.) and ensure that the old blog redirects all calls to the new blog so that we don’t loose search engine links\ranking and confuse readers.

Migrating Blog Data

WordPress does not support importing from dasBlog out of the box and there’s no available plugin that does that. The best way I could find to migrate the data to WordPress is to use RSS import. The only downside here is that comments will not get imported :(

In order to migrate dasBlog posts to WordPress using RSS perform the following:

  1. Setup dasBlog’s RSS to contain all your data. On dasBlog’s configurations page, under Syndication Settings, increase the number of items in your RSS feed to cover all posts.
    image

    Also, turn off FeedBurner support so that when trying to access dasBlog’s RSS feed it will not redirect you to FeedBurner.

  2. Disable Aggregator Bugging. dasBlog can add an image to your RSS item that is used to gather feed usage statistics. You don’t want those images to be part of your WordPress posts.
    To disable feed bugging simply go to the dasBlog configuration screen and uncheck the Enable Webbugs for RSS checkbox in the Service Settings section:
    image 
  3. Save the RSS as a file. Load the RSS into your browser by clicking on the RSS icon on your blog’s home page or by navigating to http://<blog url>/SyndicationService.asmx/GetRss.
    Save the displayed XML to a text file on your local drive.
  4. Fix content formatting in the RSS. You have to remove end-of-line characters from the file, otherwise they will be transformed by WordPress during import to line breaks that will mess up your posts layout:
    1. Open the file in Microsoft Word, press CTRL+H to open the Find and Replace dialog.
      Click on More->Special Characters->Paragraph Character. Replace it with nothing (an empty string).
    2. Replace all double spaces with one space character.
  5. Import the file to WordPress. In the WordPress Admin Dashboard go to Manage->Import (or navigate directly to http://<blog url>/wp-admin/import.php). Click the RSS link and browse for the RSS file you just edited. Click Upload file and import button to import your content to WordPress.

Redirect Requests from dasBlog to WordPress

If you’ve been using your blog post title for your post’s permalink than you’re going to have a relatively easy job redirecting all the requests made directly to a post on your dasBlog blog to their new location on WordPress (some coding is required though). Handling the other pages – archive, date and category pages – is a bit more complicated.

First, configure WordPress’s permalinks to use the post’s title like dasBlog. In the WordPress Admin Dashboard go to Settings->Permalinks and choose the Day and name option so that your permalinks will look as follows : http:// <blog domain> /2008/08/04/sample-post/

Now we have to redirect the requests from the old blog to WordPress. I couldn’t find a way to perform this without editing dasBlog’s source code. To be honest, I’ve been running my own customized version of dasBlog for a while now so I’ve had the code ready for use and I didn’t invest much time in looking for alternatives.
In the newtelligence.DasBlog.Web.Core project, open SharedBasePage.cs and add the following code snippet at the end of the SetupPage method:

// *** Redirect to WordPress
string redirectUrl = "http://<blog homepage>.com/";
if (!this.IsAggregatedView)
{
    // We're looking at an indevidual post so we can redirect directly to 
    // that post's new location
    Entry entry = DataService.GetEntry(weblogEntryId);

    redirectUrl = string.Format("http://<your blog>/{0}/{1}/{2}/{3}/",
        entry.CreatedUtc.Year,
        entry.CreatedUtc.Month,
        entry.CreatedUtc.Day,
        entry.CompressedTitleUnique.Replace('+', '-'));
}
else
{
    if (Request.QueryString["category"] != null)
    {
        // We're in a category page
        redirectUrl = string.Format("http://<your blog>/redirectFromDasBlog/category/{0}", this.CategoryName);
    }
    if (Request.QueryString["date"] != null)
    {
        redirectUrl = string.Format("http://<your blog>/{0}/{1}/{2}/", 
            DayUtc.Year.ToString(), 
            DayUtc.Month.ToString("d2"),
            DayUtc.Day.ToString("d2"));
    }
    else if (Request.QueryString["month"] != null)
    {
        redirectUrl = string.Format("http://<your blog>/{0}/{1}/",
            Month.Year.ToString(),
            Month.Month.ToString("d2"));
    }
}
this.Response.StatusCode = 301;
this.Response.Status = "301 Moved Permanently";
this.Response.RedirectLocation = redirectUrl;
this.Response.End();

Compile dasBlog and then replace newtelligence.DasBlog.Web.Core on your dasBlog’s bin folder with the modified version.

The snippets redirects requests to blog posts and archive pages (day pages and month pages) to their new destination on WordPress using permanent redirect status code (301).
Category pages cannot be handles automatically as, when moving to WordPress, you will probably play around with the category hierarchies, names and slug.
Therefore, the code builds a category URL that points to the WordPress blog and guaranteed to get a 404 error. We can track 404 hits on WordPress and manually configure where to direct them…

Track and redirect 404 requests on WordPress. A WordPress plugin, called Redirection, allows you to track 404 errors and manage their permanent (301) redirections:

Redirection is a WordPress plugin to manage 301 redirections, keep track of 404 errors, and generally tidy up any loose ends your site may have. This is particularly useful if you are migrating pages from an old website, or are changing the directory of your WordPress installation.

Install the plugin and then you can go to Manage->Redirection on the WordPress Admin Dashboard and manage redirections from the fake URLs created by the code we added to dasBlog to real destinations on your new WordPress blog.

That’s it! If you’ve reached this far you’re covered…
All the posts have moved to their new WordPress location and all links are correctly forworded to the new location. As mentioned earlier, unfortunately, the only thing left out are the blog comments.
If you know of a way to get the comments migrated to WordPress too please do tell…

Technorati Tags: ,

Tags: ,

My Blog Moved, You Don’t Have To

Blogging August 4th, 2008

At least if everything goes as planned, your RSS reader should keep on getting regular updates without any work on your part (thanks FeedBurner :-))

I just retired the good old dasBlog on ekampf.com for a branch new WordPress 2.6 blog on www.DeveloperZen.com.
The ekampf.com is still up and running, forwarding all traffic to the new blog (even old blog permalinks are redirected to the correct post under DeveloperZen.com) so you can still use it if you’ve got existing bookmarks, subscriptions, or if just feel it’s easier to remember.

The move to DeveloperZen.com brings along a brand new design (still in the works) and a renewed commitment to blogging – I’ll be working a lot harder on the DeveloperZen brand from now on.

Please let me know if you have any problems moving over subscriptions, finding stuff or getting old links to work. I’ll also be happy to heard comments or suggestions regarding the new site.