Archive for April, 2013

Amazon Web Services
30 April, 2013 — Development, Hosting, Reviews, Tech

Amazon S3 Review 2013

Below is my Amazon S3 Review for 2013.

What is Amazon S3

S3 stands for Simple Storage Service and is exactly that. S3 is storage that is located in Amazons large data centres across the world, designed to make web-scale computing easier for developers. Amazon S3 provides a simple web services interface that can be used to store and retrieve any amount of data, at any time, from anywhere on the web.

I was sceptical when I first started looking into S3 as I didn’t believe it was as cheap as people said it was. After using it for the past 4 months I know now why people love it! The clue really is in the name “Simple”. The user interface is easy to use and is clean, the pricing again is simple and easy to understand. Keep on reading below, where I will go into more detail about why I love S3.

Amazon S3 Dashboard

Amazon S3 Dashboard

S3 Pricing

S3 operates on a basis of paying only for what you use, with separate fees for storage and data requests. The fees break down as follows:

Storage

5GB FREE (for the first year), then $0.095/GB per month (100GB = $9.50)

Data Transfer (Upload)

$0.00/GB Yes FREE for the first 1TB of data

Data Transfer (Download)

$0.00/GB Yes FREE for the first 1TB of data

PUT, COPY, POST, or LIST Requests

$0.005/1000 Requests

Find out more about the prices here.

No-one can really argue with these prices, and yet Amazon keeps dropping there prices! Only a few years ago S3 storage was priced at $0.15/GB and people thought that was cheap, now with it at an all time low of $0.095/GB people are wondering just how cheaper it can go.

Glacier

I know this is an S3 review but I wanted to bring your attention to a similar service as part of Amazons Web Services and almost a brother to S3 – Glacier.

Glacier is one of Amazons other 25 web service products that is designed to be used for large amounts of data you want to archive away and not touch very often. This is known as Cold Storage. This is because the data is stored deep inside Amazon’s servers where you know its safe but unlike S3 you have less of a need to keep dipping into your data. If you suddenly have the need to access your data you can, however it takes anywhere between 3 to 5 hours to retrieve your data from the Glacier servers. Almost think of Glacier like storing something in a freezer for years until that one day when you need it and you have to wait for it to defrost before using it.

Amazons Glacier’s pricing is as little as $0.01 per GB / month!

Conclusion

Its very hard to find something wrong to write about Amazon S3 because its just so easy and simple to use. You know how much your bill will be at the end of each month and you know the bill will be lower than you think it will be (I know I did). I even managed to not pay a penny for 3 of the 4 months I have been using S3.

Give Amazon S3 a go, I think you will be surprised.
If you already use S3 or any other often Amazon’s web services I’d love to hear your experience.

27 April, 2013 — Snippets, WordPress

Add Custom Class to last Post in WordPress Loop

Just sometimes you might need to add a custom class to the last post in a loop. This might be used to remove a css margin-bottom to a less deep value.

Show me the code

First you will need to add a small function to your functions.php file in your theme directory.

function my_post_class($classes){
    global $wp_query;
    if(($wp_query->current_post+1) == $wp_query->post_count) $classes[] = 'last';
    return $classes;
}
add_filter('post_class', 'my_post_class');

This function will run every time WordPress loads a new post and when it gets to the total number for that page it will add the class of last to the class array.

Next you will need to make sure you have the following code in your post loop. If you don’t have this your classes will not appear in your post.

<div id="blog-post-<?php the_ID(); ?>" <?php post_class(); ?>>

If you need to add more classes to every post you can do so by adding the following line between the if statement and the return function.

$classes[] = 'rounded';

So your code would become…

function my_post_class($classes){
    global $wp_query;
    if(($wp_query->current_post+1) == $wp_query->post_count) $classes[] = 'last';
    $classes[] = 'rounded';
    return $classes;
}
add_filter('post_class', 'my_post_class');

This will then add “rounded” to every post class and last to ONLY the last post in the loop.

I hope this helps someone out there. If you have any snippets of your own please post them in the comments below.

Photo Credit: Daveynin

Tool Rack
26 April, 2013 — WordPress

Memory Size of 33554432 Bytes Exhausted

All servers are different and sometimes you can get the following message when trying to upgrade to the latest version of WordPress or activating a new theme / plugin through the dashboard:

Fatal error: Allowed memory size of 33554432 bytes exhausted – (Error messages may very)

If you see this error, don’t worry! There is an easy fix. Simply added the following line to the wp-config.php file:

define('WP_MEMORY_LIMIT', '64M');

If this doesn’t fix it on your site, you may also have to adjust the php.ini files. If you find that you need to do this, contact your host who will be able to help.

Photo Credit: L. Marie

25 April, 2013 — WordPress

WordPress White Screen of Death – The Fix

What is the White Screen of Death?

As the name suggests, a White Screen of Death means when you access your website, you see nothing but a blank page. This happens both with the website and the admin or I have had it just happen to the admin before.

White Screen of Death

White Screen of Death

Why does it happen?

There can be multiple reasons that cause a WSOD, the most common being a compatibility issue with a plugin or a theme. The “incompatibility” maybe a plugin conflicting with another plugin, or a plugin may not be compatible with the latest version of WP. Similarly, a theme may also experience compatibility issues with WordPress after an update.

Up until 3 days ago I had never had the WSOD then had it twice in one day! Both caused by some bad coding in a plugin.

Tell me the fix!

Plugins and Themes Folders in WP Install Directory

The easiest solution is to first isolate your plugins’ directory.

You can do this by navigating to the root of your WP installation via FTP, and then head to /wp-content. Locate the folder named “plugins” and rename it to something like “plugins_old”. Create a new folder called “plugins”.
This will isolate all your plugins, reload your website and if your website works fine again (maybe with some errors), then one of your plugins is at fault. It is important that you do not open your plugins page in the WordPress admin at this point, else you may end up deactivating all your plugins.

Once you have verified that one of the plugins is behind the WSOD, you can copy individual plugins from “plugins_old” to “plugins”. Reload your website after you copy each plugin back to your “plugins” folder. Once you know the plugin behind the WCOD you can begin to look into why.

Still doesn’t work? Maybe its a Theme?

For themes, the procedure is even simpler. Navigate to /wp-content/themes via FTP. Then rename the folder of the active theme. Next, open up your WP admin panel, and head to the Themes page. This will cause WP to fall-back to the default theme.

I did all of that and it still doesn’t work?

If you have done all the steps above and you are still getting the WCOD then please leave a comment below and I will be sure to help you where I can. Why not take a look at my WordPress Management Services. Get a WCOD – I will fix it!

23 April, 2013 — Snippets, WordPress

Check WordPress Version

You can’t assume everyone is running the latest version of WordPress. According to WordPress stats there are currently 6 different versions of WordPress people are using most, and I’m sure there will be many more they don’t know about!

WordPress Version from WordPress.org

WordPress Version from WordPress.org

Using version_compare

If you want your code to be backwards compatible, you can do the following code with conditionals by using:

if(!function_exists('is_version')){
    function is_version($version = '3.5', $compare = '>=') {
        global $wp_version;

        if(version_compare($wp_version, $version, $compare)){
            return false;
        }
        return true;
    }
}

The code above will check that the current version of WordPress is compatible with the code you are trying to run. You can call the above function as follows:

if(is_version("3.4", ">="){
    // Code run here will only run on WordPress 3.4 and above.
}

You can read about version compare at php.net.

Use function_exists

Another easy way to find the version is to check for a function that was introduced after a certain release. For instance, post formats were introduced in 3.1. So to see if the installation is 3.1 or higher you could use something like:

if(function_exists('has_post_format')){
    // 3.1 specific code
}

Photo Credit: WordPress

20 April, 2013 — Development, Tech, WordPress

WordPress Management Service

WordPress powers 17.6% of the world’s websites? If your website is powered by WordPress then this is the post for you!

What it’s all about?

Something has gone wrong...WordPress is used not only for personal bloggers but is increasingly been used by large companies to power their website. Whatever you use WordPress for your website is probably something that is close to you, but what happens if your website one day disappears? You don’t have a backup or the backup you do have is 2 weeks old!

This is where I am looking to help you! I have decided to offer a service to you where I will manage your website all for £9.99 per month!

I know what your thinking now… what will I get for £9.99 well here goes…

What you get for £9.99 / month

  • Daily Offsite Backups of your WordPress website
  • Updates of WordPress, Themes, and Plugins.
  • Monthly Website Security Audits
  • Monthly Website Optimisation
  • Uptime Monitor
  • Monthly Reports

Find out more about my Management services here.