Daily Archives: Monday, 29th March 2010

And While I’m Editing…

Monday 29 March 2010 19:52

I really should pay more attention to improvements in WordPress’s core code, you know. For quite a while, I’ve been using the rather nifty, flexible and generally clever Viper’s Video Quicktags to embed YouTube videos in my posts. Now the plugin is Clever Stuff, and works for all manner of other embeddable videos, but as I never have cause to embed any of those, I only use it for YouTube.

But since WordPress 2.9, there is native code for putting videos into posts. No tags, no buttons, just paste the URL on a line on its own, or use the embed shortcode if you prefer. The feature also works for a load of other video sites, and so it seems I don’t need to use the plugin any more.

Well, I wouldn’t need the plugin if it wasn’t for the little matter of the existing posts that have Viper’s shortcodes in them. So, you guessed it, I’m editing those, too. While I’m fixing up video posts, I’ve found a few where embedding has been disabled, so I’ll be replacing the embeds with links. And if I find any where the video has gone altogether, I’ll fix those, too.

Once I’ve done that, I’ll disable and delete the plugin. Though it’s not a goodbye to Viper’s clever work – I believe the WordPress embedding feature uses his code!

WordPress Codex: Embeds

Weight and Stuff Report – 29 March 2010

Monday 29 March 2010 18:50
Weight: 226.2 pounds (16 stone 2.2 pounds, 102.6 kg)

Down again today, all quite random, I’m sure.

It’s been a dull, damp, grey day today, so I decided it was a good time to stay in and get on with some website work. I’ve made a good start on moving images from Gallery 2 into WordPress, but there’s still a lot to do. Quite apart from not using Gallery to provide the pictures on the website, I’ve decided not to link to copies on Flickr either. I’ll still be using Flickr to show off a few images, but I want to make this site the main focus for all my stuff – which means that the new photo site will have a different purpose now. Rather than being a replacement for the general albums in Gallery, it’ll be a portfolio site, where I’ll show off at larger size some pictures that I’m particularly pleased with.

Anyway, here’s today’s picture, which comes from a recent lunchtime walk:

A different angle on the bridges

Another Reason to Love WordPress

Monday 29 March 2010 15:07

As I mentioned earlier, I’ve started on the fun job of editing the 300 or so posts that include links to Gallery 2. Some of these have single pictures embedded, some are links to galleries containing anything from five to lots of pictures, and all need to be changed. I started by downloading the images from Gallery’s store folder on the web server, which brought them down in a tidy folder hierarchy nicely matching the structure of the albums in Gallery, which at least makes it easy to find most of the images.[1]

The next stage is uploading the images into WordPress, which works very well these days. One thing it likes to do is to save images into a folder structure under the uploads folder based on year and month. Now what I was expecting to happen was that the numerous images I’ll be uploading over the next few days would all end up filed under 2010/03. But no! It’s smarter than that. When I add images to an existing post, it quite sensibly puts the pictures into the folder corresponding to the date the post was originally published, which will keep things a lot tidier.

Just a small thing, but a sign of the thought that’s gone into the image handling features in WordPress, and which go a long way to confirming that I really don’t need Gallery 2 any more.

[1] Some are in different folders – this will be from when I’ve rearranged the albums in Gallery a bit. The original files stay where they were.

Software Inanity and Insanity

Monday 29 March 2010 13:30

OK, getting back to that matter of editing a load of posts to change from Gallery 2 to WordPress galleries[1]. To find all the posts that might have a bit of WPG2 linkage in them, I used phpMyAdmin to give me a list:

SELECT `ID` , `post_title`
FROM `wp_posts`
WHERE `post_content` LIKE "%wpg2%"

I then saved this as a CSV file so I could open it in Excel. Excel happily opened it, and let me save a copy on my desktop. A little later, I tried to open it, and got this friendly message:

Err, what?

Thinking that I might have inadvertently done something weird, I went back to the original downloaded file, which opened as expected. I saved that again, and tried to open the saved copy, and again got the same result. Hmmm. Time to search. I popped the error message into Google[2], and found a Microsoft support article which confirmed that this was a problem with Excel. It even had a link to an Excel for Mac version of the article. Both date back to the last century[3]. It seems that even if Excel itself happily saves a file in CSV format, if it has ID as the first characters in the file[4], it will decide that it’s a SYLK[5] file, which is a format used for data interchange, and which I’d never heard of before. And as the bit after the ID isn’t consistent with it being an actual SYLK file, it refuses to open it. The article suggests a work around: if those first two characters are id, Excel won’t get confused. Sure enough, opening the file with TextWrangler and making that small change was all it took.

All of which made me wonder why the original file worked. Opening that with TextWrangler confirmed my suspicion. Unlike the version Excel saved, it was a properly formatted CSV file with quotes delimiting the fields. So the first two characters were “I rather than ID, and Excel was happy to open it.

Oh, and the Microsoft article tells me:

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the “Applies to” section.

So, it’s been a problem since Excel 97 at least. Any chance of, you know, fixing it? It’s still here in the current version of Excel for Mac, and while the article only confirms it up to Excel 2003 on Windows, it may well be around in more recent versions there, as well.

[1] This will take a while, so I’m taking advantage of the naff weather to stay in and get on with it.
[2] Other search engines are available, etc
[3] Excel 97 is explicitly named…
[4] Which my file did, as the first row contains the names of the exported fields – “id” and “post_title”, which are what I need to identify the posts I need to edit.
[5] Putting “SYLK” into your choice of search engine may not find that as one of the first few hits.

Another quick change

Monday 29 March 2010 12:48

First of all, apologies to anyone who’s been attempting to view this site over the last hour or so, and is probably wondering what I’m up to. I’ve started work on changing the old posts that are pointing to albums based on Gallery 2 to new native WordPress galleries. This involves a bit of work:

  • Uploading the pictures into WordPress, and for those that don’t already have suitable metadata, adding titles, descriptions and captions
  • Editing the post to remove the old WPG2 code
  • Making sure it all works

Anyway, the theme I’d been using made a bit of a mess of displaying pictures, so I decided to try a temporary one[1]. I tried a few before settling on this one, which is called Svelt, and appears to do what I need for now.

[1] The TwentyTen theme I intend to use when WordPress 3.0 is ready doesn’t appear to work with WordPress 2.9.2, so I can’t go there yet