Archives page

Posts Tagged ‘wordpress’

Travel map – countries visited

I’ve been looking for a good countries visited map for quite some time. There’s something satisfying about painting the world red (or in this case, orange), and something humbling about seeing massive chunks of the planet untouched. So since we’re approaching April and I’m getting the inevitable itchy feet again, I’ve gone hunting.

Up until now, World66 had seemed my only option. But in the Age of Google, posting images for this sort of thing seems a bit of a letdown. Fortunately 29travels have just the thing with their Google Map version.

Pretty cool but it’s a shame there doesn’t seem to be an option to edit the map. But, a quick look at the iframe source, and you can see it’s pretty easy to hack in any new countries as you visit. Providing you know the right country codes of course.

http://www.29travels.com/getmap.php?j=ALATBACYCZDEESFRGBHRISITMKMTMENLPLSITRUSVAVN&c=cc41c9f2&w=575&h=300

That query string is a long list of 2-digit country codes. So, if you know the code for the country you want to add, just adding it to the string will provide all the highlighting you need. For example Australia = AU

http://www.29travels.com/getmap.php?j=ALATBACYCZDEESFRGBHRISITMKMTMENLPLSITRUSVAVNAU&c=cc41c9f2&w=575&h=300

Who wants to package this up into a WordPress plugin for me? 🙂

Code highlighting, and the magic of LINQ

I’ve had a small block of code in my drafts folder for quite some time now, just looking for an excuse to publish it.  I’ve been using LINQ a lot in the past 6 months, and it’s one of the recent additions to the language that’s made me think twice before using PHP or Perl for my own projects (despite the existence of PHPLinq).

HIM: LINQ’s like pringles
ME: only makes sense after drugs?
HIM: once you pop you can’t stop

But I didn’t really want to write a full post on LINQ.  It seemed dull.  It’d been done before.  It’s old news.

So I picked up the WP-SynHighlight extension for WordPress.  Which gives some rather cool code-highlighting through GeSHi.

So here’s some highlighted stylised C# LINQ demonstrating how simple it is to combine LINQ to SQL with LINQ to XML data sources.
[codesyntax lang=”csharp”]var answers = (from a in poll.Descendants(“AnswerSet”).Descendants(“Answer”)
join aCount in dbVotes
on a.Attribute(“id”).Value equals aCount.AnswerId.ToString() into aJoined
from o in aJoined.DefaultIfEmpty()
select new {
id = a.Attribute(“id”).Value,
percentage = ((o == null ? 0 : o.VotesCount) / dbVotes.Sum(b => b.VotesCount.GetValueOrDefault()) * 100),
count = o == null ? 0 : o.VotesCount, text = a.Value
});
[/codesyntax]

Now if only Microsoft would release LINQ to XSD out of preview.

Using SVN to manage your WordPress install

I use SVN to manage both this blog and the Blakepics Gallery2 installation.  Using the version control software as a means of keeping my own sites’ shared components up to date is horribly convenient once you get through the initial attempts of “shit, I’ve broken it again”.

Wordpress have full instructions for setting up your blog with SVN.  I’d recommend sticking to the ‘Tracking Stable Version’ section and controlling your upgrades rather than checking out the trunk and risking an unstable install.  This basically comes down to a single command to be run within your wwwroot.

svn co http://svn.automattic.com/wordpress/tags/2.6.2 .

When a new version is released, you can switch to that with:

svn sw http://svn.automattic.com/wordpress/tags/2.6.3

What they don’t mention, is you can do exactly the same with your plugins using the repository here…

For example, find the plugin you want, and checkout to your plugin folder:

svn co http://plugins.svn.wordpress.org/share-this/tags/2.3/ share-this

As before, you can switch to new releases (make sure you’re in that plugin directory first) with:

svn sw http://plugins.svn.wordpress.org/share-this/tags/2.3/

And should you forget the URL you’ve got it from (like when you see there’s an upgrade available, running ‘svn status’ in that directory should help you out.

Once you get the hang of it, it really saves so much more time than that slow download, unzip, copy process you’re probably all used to, and you stand a much better chance at maintaining your own modifications without rewriting them all the time 🙂

Twitter – Now the machines are syndicating us

RSS recursion is not a toy

… that was syndication for the sake of it.

That’s what I said, word for word. Then a colleague pointed out that I could have twitter automatically update from my blog or Blakepics. And all hell broke loose.

I didn’t like Twitter as another way of updating my blog, or having it throw up all over my Facebook status every time I opened up my Twitter-enabled fridge. But reaching out to new audiences, and the potential to bombard mobile phone networks every time I bounce from one country to the next… Well suddenly it’s become quite cool.

And yes, I admit – I was tempted to install the application to syndicate my Xbox 360 status as well. But I’m not sure I’m ready to spam everyone that much. Yet.

“Kevin has just been killed by a bunny rabbit on Halo 3. Again”