Archive for Site Updates

Top Links

I’ve added a thin navigation bar to the top of my site. This is partly because it was suggested by a couple of people at WordCamp who thought it would make certain parts of my site more prominent but also because I soon intend to cut down on side bar clutter and in the process develop a more dynamic homepage with more of my latest updates right there at your fingertips.

Twitter, Facebook and other social networking mediums are becoming more widely used than ever so I hope to integrate more of my content out there with what I post here; there are a lot of disjointed updates from me at the moment. Photos too are a big part of my updates here and I’d like to make them much more visible, in addition I want to emphasise that I value input from forum users about my open source software so I will look into making some of those posts more available too. Watch this space!

Comments    

And we’re back

After a brief hiatus concerned with moving this site onto a new server and the excitement that brings (lost files, configuration issues, corrupted databases etc.), I’m back on the blog.

Regulars will notice some missing posts, about 2 weeks worth. This was due to an rsync accident prior to migration which resulted in my having to fall back on one of my full weekly backups, which just so happened not to have run last week.

Still, I should be thankful - I’ve seen bloggers lose their entire site with no backups and have had to start from day one. By comparison 2 weeks of data is nothing.

I would however still like to apologise to those who have lost forum posts and article comments. If you were waiting for a reply I advise you re-post as I have no record of ever having received your query. Users who registered on the forums in the last 2 weeks will have to re-register too.

Here’s hoping this site will see many good years of trouble free service in it’s new home!

Comments    

Photo Blogging

Readers probably wouldn’t have taken much notice of the recent photo posts here and here on my site. The thing is though, these are a result of a bit of ingenious behind the scenes code that allows me to snap a picture with my BlackBerry camera and blog it in seconds thus allowing me to start a photo blog category that comprises of quick snippets with a photo for when a picture is more appropriate and I’m no where near a computer.

The real power behind this is Flickr but as those who know me will testify, I don’t like to use external services that take people away from my site, so I devised a way to bring the convenience of mobile Flickr uploads to my blog rather than to Flickr.

To begin with, the easy bit. I registered a Flickr account and installed the Flickr application on my BlackBerry. Now I can take a photo with the BlackBerry and send it to my Flickr photo stream with a title and a caption in a few seconds. Now comes the hard bit. Getting the stream on my blog and removing any Flickr artifacts along the way.

The saving grace here is that Flickr provides an RSS2 feed of any users photostream (so long as it’s set to public). In addition to this, there is a popular WordPress plugin called Feed WordPress that allows the syndication of RSS feeds onto your blog. I installed this plugin and subscribed to my Flickr feed with it. Now I was getting all photos posted to Flickr on my blog, I just had some cleaning up to do, and annoyingly, this is what took the time and effort.

Firstly Feed WordPress is designed to list all feeds coming into a blog as contributors so you can give appropriate credit. In my case though it was my own Flickr feed so I wanted to avoid this link category being shown on my site. To fix this I specifically excluded the category Feed WordPress had earmarked for contributors by specifying it in the arguments of the theme function that displays the links list. Users who are using a theme with widgets or who haven’t customised their site as much as I have might be able to use widgets to do this.

Secondly I had to change some Feed WordPress settings to get perfect operation. Mainly forcing all “posts” from Flickr to go into my Photo Blog category and also to ensure that all these would be attributed to my username. I also entered the default Flickr e-mail address, nobody@flickr.com, as an allowed user such that my Flickr entries would be syndicated without going through moderation. This would be a security risk if I wasn’t the only person who could add feeds to my syndication list or post to feeds already earmarked for syndication but as neither of these situations are true its ok.

Finally I needed to ensure that the actual body of the post appearing on my site showed the proper content. By proper content I mean a good sized image, linked to the original and showing nothing else alongside it but the caption and no reference to Flickr.

To do this I used a custom code modification to Feed WordPress which would extract the true location of the picture in the Flickr feed and store it as an attribute of the post. For those wishing to replicate what I have done here, the code below needs to be entered inside the SyndicatedPost class, at around line 1100 in the feedwordpress.php file of the Feed WordPress plugin.

if (isset($this->item['http://search.yahoo.com/mrss/']['content@url'])) :
$this->post['meta']['flickr_original_image'] = $this->item['http://search.yahoo.com/mrss/']['content@url'];
endif;

In addition to the Feed WordPress modification I also added a plugin hook that would parse the content of all posts in the Photo Blog category in order to retrieve the image location stored with the above code, correctly display it and to parse the remaining text for the caption thus remove references to Flickr. In the code below the number 36 refers to the id of my Photo Blog category.

/*
Plugin Name: Fix Flickr Posts
Plugin URI: http://www.kieranoshea.com/
Description: This plugin removes cruft from the posts imported from flickr
Author: Kieran O'Shea
Author URI: http://www.kieranoshea.com
Version: 1.0
*/

// Apply function to remove content from posts in the correct category
function fixFlickr($content) {
global $post;

$first_cat_id = get_the_category($post->ID);
$first_cat_id = $first_cat_id[0];
$first_cat_id = $first_cat_id->cat_ID;

$flickr_image = get_post_custom($post->ID);
$flickr_image = $flickr_image['flickr_original_image'][0];

if ($first_cat_id == 36)
{
$photo_bit = '<a href="'.$flickr_image.'"><img src="'.$flickr_image.'" width="450" alt="'.$post->post_title.'" border="0" /></a>';
$pwned = explode('<p>',$content);
$pwned = $pwned[3];
$text_bit = '<p>'.$pwned;
$content = $text_bit.'<div style="text-align:center;border:0;">'.$photo_bit.'</div>';
}
return $content;
}

// Add filter to the_content
add_filter('the_content', 'fixFlickr');
add_filter('the_excerpt', 'fixFlickr');
add_filter('the_content_rss', 'fixFlickr');
add_filter('the_excerpt_rss', 'fixFlickr');

And there we have it, my own photo blog that leverages power from the Flickr system but which displays in my own way on my own site. If you want to try this by all means test out the above method and code but I must stress that this method is unsupported by me or anyone else. If you try it and get it to work, please comment below. It is worth noting that any phone with a camera and a Flickr upload program designed for it will work in place of a BlackBerry. To all that succeed with this method, happy photo blogging!

Comments (2)    

404 Fixed

There has been a long standing Heisenbug on my site which would send users 404 headers, even when there was valid content to return. This wasn’t a significant problem for users who’s browsers would simply render the returned content anyway, but for those that wouldn’t (such as IE) this presented a significant problem in using several areas of my site.

The fix I have put in place simply assesses the link accessed by the user and if the link is in the database as being valid, it forces a 200 Ok status to be sent to the user, thus ensuring valid content will display in all browsers and the correct header will be returned with it.

If you have recently received a 404 error when trying to access a part of my site (particularly the contacts database) then I encourage you to try again.

Comments    

100,000 Spam Comments

My blog reached a frightening milestone today - I’ve received 100,000 spam comments since I started the site. Thankfully all of these comments never reached the public gaze as they were blocked by Akismet, however its worrying to think that such a high proportion of my comments were spam.

As it stands I have round about 1,000 comments on my blog, this means that a mere 1% of the comments I have received so far have been legitimate. Scary really isn’t it.

Comments (1)    

| « Previous entries