Merry Christmas everyone!

Merry Christmas everyone!

Whether you’re excited about gifts, food, alcohol, friends, family or Doctor Who – I hope that your Christmas hero of choice; Santa Clause, Jesus, Scrooge or Doctor Who ensures that you all have the Christmas that you’re hoping for! 🙂

The Netherlands Photo Story

For the past week, I’ve been in The Netherlands. It was the first holiday for a very long time where I haven’t actively blogged along the way. So that might all come as a retrospective at some point.

In the meantime, I’ll sum it up extremely briefly as:

  • Coffee shops that actually sell coffee in Amsterdam, are referred to as Café‘s
  • Weed, ‘Shrooms, Prostitutes
  • The most racist of the festive holidays I’ve experienced so far
  • Singstar in Dutch- it’s the taking part that counts
  • Van Gogh, Andy Warhol and most importantly, Heringa/ Van Kalsbeek

These may form the subjects of some posts, at some point… For now, enjoy the usual photo story below. Or check out the full quality version. For Facebook users reading this – yes, you need to click through for the vid 🙂

The rest of the photos, including the ones in the video above are on Blakepics. Credit for some of these photos also goes to Chorna. The music, “Before it’s too late” by The Goo Goo Dolls.

Upgrading Fedora 7 to Fedora 8

Another Fedora upgrade later, and my system is back up and running. Hopefully this version will fix some of the problems from the previous Fedora 6 to 7 upgrade. When will I ever learn?

  1. System won’t boot. GRUB complains of Error 15: File not found when attempting to load kernel.
    • Something bizarre happened to the IDE / SATA ordering in this release? Boot the system from the DVD again, and select ‘rescue an install system’.
    • Open up ‘nano /boot/grub/grub.conf’
    • Change this line, ‘root (hd1,0)’ to root ‘(hd0,0)’
  2. Wireless card won’t start.
    • Plug in Ethernet cable.
    • Make sure livna repository is enabled.
    • Upgrade the kernel to the latest: ‘yum -y upgrade kernel’
    • Reboot into new kernel.
    • Install madwifi drivers. Why does this have to be done for EVERY upgrade? ‘yum install madwifi’
    • Restart the network ‘/etc/rc.d/init.d/network restart’
  3. Cyrus imapd won’t start. Complaining of libdb-4.5 library missing.
    • Upgrade Cyrus, and make sure it installs the db4-utils package, this time. ‘yum upgrade -y cyrus’

One of these days I’ll move to a real Linux distribution, rather than the current hobbyist affair provided by Fedora. One of these days.

Fixing wordpress RSS XML parsing errors

Wordpress RSS feeds can be annoying. Really annoying. If you install a bad plugin, theme, or even edit some of the existing php files you might find your RSS feeds start getting this parsing error.

XML Parsing Error: xml declaration not at start of external entity
Line Number 3, Column 1:<?xml version="1.0" encoding="UTF-8"?>

You might find that enabling output buffering for your RSS feeds might sort you out, as suggested by J Wynia. But unfortunately it didn’t do it for me.

So, go to the source and fix up the files causing you problems, with the following perl script. It will check each of your php files for any that have extra line feeds at the start, or end – and remove them. You’ll need SSH / command line access for this, as well as perl installed.

Use it at your own risk. It worked for me, but is otherwise untested – so, make a backup first 🙂

Instructions

  1. Backup your wordpress installation
  2. Download the script to the root directory of your wordpress installation.
  3. cd to your installation directory.
  4. Run the script: perl fix-rss-xml-spacing.txt.
  5. Fingers crossed, your RSS feeds will now work again (and hopefully, so will the rest of your blog).

Good luck!

Geonaming your Geotags – Automatic picture captions

This time last year, I wrote about how to Geotag your photos using a simple GPS device and oodles of free software. Not much has changed in that process since, except now there’s a lot more software to choose from and the clever folks over at Trackstick.com have made it a lot easier to export your GPX tracks.

The spatially-aware web is producing a lot more services for us to use, and now Geonames.org some excellent reverse geocoding functionality. That’s the process of taking geo-data (such as longitude and latitude) and getting place names back. Which is really cool for tagging, titling or adding descriptions to your geocoded pictures.

They provide an impressive array of web services in both JSON and XML ranging from postal code searches, to reverse geocoding based on the community-based Wikipedia entries. And if that’s not enough for you, you can download a copy of their huge database and manipulate it off-line however you want.

So me, I wrote some JavaScript to take advantage of the reverse geocoding and tied it into the Blakepics Gallery2 Tags module. I’ll take the Wikipedia entries as an example, because that returns the most landmarks for me. The example code at the bottom of the page actually makes use of two more web services in addition.


The URL to call the web service is pretty simple enough:

var url = "http://ws.geonames.org/findNearbyWikipediaJSON?lat=" + lat + "&lng=" + lon + "&radius=10";

I’ve kept everything in JavaScript rather than building any back-end code whatsoever, so you need to make sure to use the JSON web services and take advantage of the script tags to avoid any cross-domain security policies. The JSONScriptRequest library can be a powerful ally here. This leaves my server to do more important things, but it all depends on your needs for the app.

url += "&callback=showWikipediaNames";
bObj3 = new JSONscriptRequest(url);
// Build the dynamic script tag
bObj3.buildScriptTag();
// Add the script tag to the page
bObj3.addScriptTag();

Then on the callback
function showWikipediaNames(wikijsonData) {
var wikiobjects = wikijsonData.geonames;
if (wikijsonData.geonames) {
for (var i=0;i<wikiobjects.length;i++) {
addSuggestion(wikiobjects[i].title)
}
}
bObj3.removeScriptTag();
}

With me so far? The final step in the process is to add the call to the JavaScript into your Gallery2 templates.

<a href="#" onclick="return showGeoNameOptions(this, {$block.gpsinfo.LoadGPSInfo.lat}, {$block.gpsinfo.LoadGPSInfo.lon});">GeoNames</a>

And before you know it, you have suggestions from geonames on how to tag your photos. Now you can go away and make it suggest some titles and descriptions too. If anyone’s interested in packaging this up into a slightly better Gallery module (or any other application), drop me a line. If this is enough for you, download my example and use it as you see fit.

Download

Pre-requisites