Considering how regularly new versions of Firefox now come along, that's quite some bug fix list in version 10! http://t.co/K3I2vLpW 1 week ago


31st
Aug 11

UK2.net Hosting



While I was moving  something else happened – this site’s bandwidth limit was reached and the site went down. As you can imagine, I didn’t even notice.

My host is Memset who, I have to say, are superb. But you pay for that quality and I was already having to pay more than I was last year due to bandwidth increases (you pesky visitors keep coming here!). There’s only so much money you can throw at something though before you have to have a bit more of a radical re-think. So, I made the decision to move my hosting  to UK2 and one of their rather professional looking business packages. Bandwidth would no longer be an issue but, as is often the case with cheaper providers, the occasional downtime may be.

I pointed my domain (which is held at 1&1) to the UK2 servers and although my holding page was now appearing I couldn’t get FTP access. I raised a support request but didn’t hear anything until last night – it had taken some time for the IP changes to be propagated to their FTP server. This morning it was working so I uploaded the site but I was still getting the holding site. Another support request and they noticed that my site was pointing to the wrong IP. Now corrected, my site was live! Unfortunately I was getting server configuration errors – this was using an exact snapshot of the site as held by Memset.

Meantime, Memset had contacted me and I was in a position where I could double my bandwidth by paying just £1 extra a month.

By this time the decision was now easy. I have swapped my nameservers back to Memset and have cancelled my UK2 hosting – thankfully they have a 30 day money back guarantee.

Unfortunately, it comes with  a sting in its tail – they haven’t refunded me all my money. They have retained an administration fee for the free domain they provided me…

When you purchase the Business web hosting a free domain comes with it, because you are keeping the domain and cancelling the web hosting we have deducted the registration fee.

I’ve pointed out that they didn’t actually provide me with a new domain, I’d simply pointed my existing one to their nameservers at no cost to them. Eventually, they relented and paid me my full amount.

But, right now, I’m just happy to have the site working. Welcome back Memset!

Delicious Digg Facebook LinkedIn Read It Later reddit StumbleUpon Twitter SeparatorEmail Google Translate PDF Online Print Friendly



19th
Aug 11

Artiss YouTube Embed 2.1 released


I’m happy to announce the release of version 2.1 of my WordPress plugin Artiss YouTube Embed.

There are a number of new features, some of them cleaning up changes made recently to work around some issues that users were having. For example, you can now turn on and off options to use HTTPS instead of HTTP. I’ve also taken the opportunity to improve the error reporting as well.

Away from that, new features include more specific options for thumbnails – you now have 5 thumbnail types to choose from – and, most importantly, support for the latest API changes.

Recently, you may have noticed that the default YouTube player has changed from a light grey to a much darker scheme. At the same time YouTube updated their player API to allow users to switch between light and dark themes. They also took the opportunity to add a feature where you can change the colour of the progress bar from red to white. Both of these are now supported by my plugin, so if you want the old light colour back you can do.

However, whilst testing this I can across what looked like a bug with YouTube’s API. I couldn’t get the light theme to work with the white progress bar – the progress bar would always appear in red. I double checked my own code to ensure it wasn’t my issue but I don’t believe it is.

YouTube’s own blog entry suggest that this entry is valid…

I opened this up in their forum where another user of the API confirmed my find. However, over 24 hours later, I have yet to receive a response from YouTube.

I’m therefore releasing the plugin as-is but with mention of this issue in the instructions.

Update (19/8/11 @ 19:36): Google have provided an update on the bug…

This is a bug, and it is scheduled to be fixed next Wednesday
evening.

Cheers,
-Jeff Posnick, YouTube API Team

Delicious Digg Facebook LinkedIn Read It Later reddit StumbleUpon Twitter SeparatorEmail Google Translate PDF Online Print Friendly



28th
Jul 11

Using Google Analytics data to show popular posts


Google Analytics Dashboard is an excellent plugin for showing site analytics on your WordPress dashboard.

However, it also has an open API built-in allowing anybody to access statistics from their own code. As a result I’ve created a new of small functions for my own site. To get these to work, ensure you have Google Analytics Dashboard installed, active and you’ve authenticated yourself using the OAuth method!

The most useful is the one I use in the sidebar to display the most popular posts. I was using specific plugins which track visits independently. However, I found these to inconsistent and unreliable.

This isn’t the version I use, as I’ve had to make specific modifications to only display posts and to tidy up the page titles. However, this is the same base code just with my very specific changes removed.

function latest_posts_list( $days, $showposts, $cache_hours ) {
   $cache_key = 'ga_posts_' . $days . $showposts;
  $output = get_transient( $cache_key );
  if ( !$output ) {
     $output = '';
    if ( $days == 0 ) {
       $start = '2006-09-01';
     } else {
         $start = date( 'Y-m-d', ( time() - ( 60 * 60 * 24 * $days ) ) );
     }
    $end = date( 'Y-m-d' );
    $thispost = 1;
     $login = new GADWidgetData( get_option( 'gad_auth_token' ), get_option( 'gad_account_id' ) );
    $ga = new GALib( 'oauth', NULL, $login -> oauth_token, $login -> oauth_secret, $login -> account_id );
      $pages = $ga -> pages_for_date_period( $start, $end );
    foreach( $pages as $page ) {
       $url = $page[ 'value' ];
         $title = $page[ 'children' ][ 'value' ];
         $output .= '<li><a href="' . $url . '" rel="nofollow">' . $title . '</a&gtl';
        if ( current_user_can( 'edit_posts' ) ) { $output .= ' (' . $page[ 'children' ][ 'children' ][ 'ga:pageviews' ] . ' views)'; }
        $output .= '</li>';
        $thispost ++;
       if ( $thispost > $showposts ) break;
     }
    set_transient( $cache_key, $output, 3600 * $cache_hours );
 }
 echo $output;
}

Add this code to functions.php and then edit the line $start = '2006-09-01'; to reflect the date on which your blog statistics started. Then call latest_posts_list  with 3 parameters, all of which are required…

  1. The number of days across which to gather statistics. If you specify 0 then it will be for all time.
  2. The number of posts to display in the list.
  3. The number of hours to cache the results.

A sidebar example, with checks for function availability, would be…

<?php if ( function_exists( 'latest_posts_list' ) ) : ?>
    <li>
        <h2>Recent Popular Posts</h2>
        <ul>
            <?php latest_posts_list( 30, 5, 24 ); ?>
        </ul>
    </li>
<?php endif; ?>

This will display the 5 most popular posts within the last 30 days and will update this list every 24 hours.

Two further functions that I use elsewhere add live statistics data to a posts content. The code can also be added to your functions.php file…

function ga_visits_shortcode( $paras = '', $content = '' ) {
 extract( shortcode_atts( array( 'days' => '' ), $paras ) );
  if ( $days == '') { $days = 30; }
   $start_date = date( 'Y-m-d', ( time() - ( 60 * 60 * 24 * $days ) ) );
   $end_date = date( 'Y-m-d' );
 $login = new GADWidgetData( get_option( 'gad_auth_token' ), get_option('gad_account_id') );
   $ga = new GALib( 'oauth', NULL, $login -> oauth_token, $login -> oauth_secret, $login -> account_id );
   $visit_data = $ga -> total_visits_for_date_period( $start_date, $end_date );
 return number_format( $visit_data[ 'value' ] );
}
add_shortcode( 'ga_visits', 'ga_visits_shortcode' );
function ga_pageviews_shortcode( $paras = '', $content = '' ) {
 extract( shortcode_atts( array( 'days' =>'' ), $paras ) );
   if ( $days == '') { $days = 30; }
   $start_date = date( 'Y-m-d', ( time() - ( 60 * 60 * 24 * $days ) ) );
   $end_date = date( 'Y-m-d' );
 $login = new GADWidgetData( get_option( 'gad_auth_token' ), get_option( 'gad_account_id' ) );
 $ga = new GALib( 'oauth', NULL, $login -> oauth_token, $login -> oauth_secret, $login -> account_id );
   $visit_data = $ga -> total_pageviews_for_date_period( $start_date, $end_date );
 return number_format( $visit_data[ 'value' ] );
}
add_shortcode( 'ga_pageviews', 'ga_pageviews_shortcode' );

Now, all you have to do is call either shortcodes – [ga_visits] or [ga_pageviews] to output the number of visitors of pageviews that your site has had. Useful for promoting your site. There is one parameter, days, which allows you specify the time range this is for. If you don’t specify this parameter then 30 is assumed.

Delicious Digg Facebook LinkedIn Read It Later reddit StumbleUpon Twitter SeparatorEmail Google Translate PDF Online Print Friendly