I (U+1F494, BROKEN HEART) UTF-8

Something has gone very wrong with the database encoding on this blog after a recent update, so all my lovely UTF-8 characters have gone mojibake.

Trying to find ways to fix it. It may have to be manual. Remember, kids: have backups before letting WordPress upgrade!

Here’s the Python equivalent of what I think the database has done:

bytes("I ???? UTF-8", encoding='utf-8').decode(encoding='cp1252')
'I 💔 UTF-8'

Quite why my hosting thought a character encoding from last century was appropriate, I’ll never know.

Update, November 2023: kinda-sort fixed the backend, but the encoding is still weird — can we…?

Fixed WordPress memory problems on 1and1

A ½-cup of Pasta
A ½-cup of Pasta

Well … sorta. I can’t upload any size of image, but previously I was limited to about 0.3MP (640×480). Now I can upload up to about 1.5MP without the dreaded Memory error. I can also use WordPress’s Auto Upgrade feature again.

Daddy Hogwash’s “WordPress 3.0 Upgrade Complete after Solving Fatal Error: Out of Memory Issue” is what fixed it. His suggested number of 40M fixed the auto upgrade problem, while I upped it to 64M to get larger images to work with my host, 1and1.com.

 

Update: There is no fix for this. Memory limit on my kind of hosting is ~34M. Any higher is not allowed. This seemed to work for a while, now doesn’t.

<sup>ping trouble with a long spoon

I like Rob Goodlatte‘s Flow Theme for WordPress. But it makes me look like a shambling moron in some of my equations, viz.:

What’s ‘d2 v3’ supposed to mean? I certainly didn’t type that.

Digging (not very deeply) into Rob’s CSS, I found this section

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
 margin: 0;
 padding: 0;
 border: 0;
 outline: 0;
 font-size: 100%;
 vertical-align: baseline;
 background: transparent;
}

That forces pretty much all text to be aligned with the baseline, including <sup> and <sub>. While it may be all pretty like, it also destroys the sense of my markup.

Deleting the references to sub and sup in line 5 fixes the problem. Let’s have that equation again:

Laaaahrvely.

image rollover in wordpress, no plugins required

I’m seeing quite a bit of traffic to this post. I suppose I should explain that this was a quick hack to see if I could get image rollover to work on a friend’s wordpress.com hosted blog (and no, I couldn’t). This little example doesn’t do preloading, either, and I really don’t have any intention to develop this further. Sorry …

<img title="this" onmouseover="this.src='http://scruss.com/wordpress/wp-content/uploads/2010/01/that.png';" onmouseout="this.src='http://scruss.com/wordpress/wp-content/uploads/2010/01/this.png';" src="http://scruss.com/wordpress/wp-content/uploads/2010/01/this.png" alt="" width="192" height="116" />

This does not work on wordpress.com hosted blogs; it gets stripped out.

Update: You probably want to install the plugin Ultimate TinyMCE, which does the job rather well.

i want my svg

Look, SVG has been the cool graphics format since 2001. And while WordPress now supports a bunch more embed formats, you’d think it’d work. Nope.

Even to upload an SVG file, I have to bypass WordPress’s built in whitelist using PJW Mime Config, and manually add support for image/svg+xml. Otherwise, it’s refused as an insecure file. (All my files are quite well adjusted, I’ll have you know.)

Say if I want to embed this SVG image. I’d probably want to do something like:

<embed type="image/svg+xml" width="100" title="ford_script_fnord-plain" src="http://scruss.com/wordpress/wp-content/uploads/2009/12/ford_script_fnord-plain.svg" />

But this doesn’t end up being what the final code says:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="100" height="100" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://scruss.com/wordpress/wp-content/uploads/2009/12/ford_script_fnord-plain.svg" /><embed type="application/x-shockwave-flash" width="100" height="100" src="http://scruss.com/wordpress/wp-content/uploads/2009/12/ford_script_fnord-plain.svg"></embed></object>

If I’d wanted Flash, I’d have asked for it. Do What I Mean, Little Computer!

Update (after the comment below): Okay, last try:

<object type="image/svg+xml" width="220" height="72" title="ford_script_fnord-plain" data="http://scruss.com/wordpress/wp-content/uploads/2009/12/ford_script_fnord-plain.svg" />

Yay, that sorta works – but it doesn’t scale the image. You know what the S in SVG stands for? That’s right – Scalable. Doesn’t seem to allow scaling. Kinda defeats the purpose, doesn’t it?

the subtle image editor in WordPress 2.9

While I still like 1&1, they have a fairly modest hard-coded PHP memory limit. This means that some WordPress plugins will exhaust memory, and fail.
I’d been wanting to set up Scissors for Catherine‘s blog so she could more easily edit images without having to learn GIMP. But it wouldn’t work, running out of memory at every turn, and trying to set PHP’s memory limit locally cause WordPress to fail completely.
So I was pleased to see that WordPress 2.9 had an editor built in. The upgrade went smoothly (I don’t miss the days of rm -i *.php and making sure you didn’t vape your config file), but I couldn’t seem to find the editor. (It’s early, I’m old.)

It’s called up by that quiet little button under the image details:

Works just fine. It probably zaps all the image metadata (Scissors did), but we’ll see how it goes.

wordpress visual editor not working?

If it always doesn’t work, go to Users -> Edit Profile, then check ‘Disable the visual editor when writing’, then update profile. Now go back and uncheck ‘Disable the visual editor when writing’, and resave your settings.

This worked for Catherine under 2.8.5. I’ve never had this problem myself.

no no related posts

I’d tried, and failed, several times to install the Yet Another Related Posts Plugin for WordPress. This time, I actually dug around the forums a bit to see why it wasn’t working, and now it’s fixed.

YARPP requires MySQL version 4.1 or later. Partly due to the age of my blog, I still had my WordPress database at 1&1 at MySQL 4.0. They now offer MySQL 5, and any new databases are created under the newer version. As I’ve used less than 5% of my database allocation, it was a simple job to create a new database, backup the old one, restore it to the new database, then point my wp-config.php to the new DB.

(If it still doesn’t work, view the  source to your Settings→YARPP configuration page. Error messages are helpfully, if cryptically, embedded in HTML comments.)

I’ll probably still get a few “No Related Posts” appearing until the cache fills, but that should go away soon.

wordpress can’t count: my 2000th blog posting

I was all exited about my 2000th post, because the dashboard is showing:

wordpress can\'t count

So I decided to tabulate my entries by number, and discovered that I really have 2261 (well, 2262 now) blog entries. This is the real story:

Post # Title Date
1 is this thing on, eh? (2003/06/04)
2 Happy Birthday (2003/06/04)
3 mmm (2003/06/05)
4 A century later, worse economy (2003/06/05)
5 Christian Anderson Smith, where were you in our hour of need? (2003/06/06)
6 fishepiphany (2003/06/07)
7 “What a Life!” lives! (2003/06/08)
8 pinholes (2003/06/09)
9 they don’t make ‘em like they used to (2003/06/12)
10 what’s this ear? (2003/06/19)
16 the wisdom of chairman ralph (2003/07/08)
20 Phew … (2003/07/29)
30 Canada supporting copy-controlled CDs (2003/10/09)
32 so long, emusic (2003/11/05)
40 how the blog got its name (2003/11/24)
50 do me a favour (2003/12/01)
60 malicious deomnibusation of maternal relative’s maternal relative strictly forbidden (2003/12/09)
64 DNX-1000 Hardware /dev/null Accelerator (2003/12/10)
70 Enoch, the Money Mart ad guy (2003/12/15)
80 Mozilla Mail Went Nuts (2003/12/21)
90 A helpful error message (2003/12/31)
100 very small, but not cheap (2004/01/06)
128 Attack of the Dodgy Duracells (2004/02/03)
200 first groundhog (2004/04/03)
250 freecache doesn’t (2004/06/13)
256 Getting (Not Very) Political (2004/06/23)
300 UofT Solar Car (2004/08/13)
400 let’s get confused (2004/10/13)
500 Good Activism Guide, from an unexpected source (2004/12/07)
512 and this makes news in Scotland: Krankie hurt in beanstalk tumble (2004/12/15)
600 The Passing of The Grammarian (2005/02/22)
700 get yer fives on! (2005/05/05)
750 Lego, ergo sum (2005/06/05)
800 StimpyFest: the time is now (2005/07/14)
900 no cheers for VIA Rail (2005/09/27)
1000 Meet Mr Random (2005/12/26)
1024 my letter to etymotic (2006/01/24)
1100 1656 days from PR application to Canadian Citizenship (2006/03/25)
1200 View from the nacelle of a 2.3MW wind turbine (2006/05/22)
1250 old taters (2006/06/18)
1300 when chitin isn’t enough (2006/07/20)
1400 confused (2006/10/03)
1500 alan_walsh-carter_arter_blues.mp3 (2006/12/21)
1600 all atwitter (2007/03/06)
1700 messing with cars makes you bad at spelling (2007/04/26)
1750 curious_orange-roncesvalles.jpg (2007/06/01)
1800 take your … (2007/07/21)
1900 serene detachment (2007/09/20)
2000 not very walkable here (2007/12/13)
2048 recursive headline (2008/01/22)
2100 glacial (2008/02/25)
2200 the most hateful coining in the language (2008/05/05)
2250 outlook_gone_all_big (2008/06/02)
2261 wind turbine data – we are generating! (2008/06/13)

The numbering seems to have gone sideways in the last 1000 entries; entry #1000 is, as they say, what it is.

more on WordPress dates

I got sick of the annoying date display bug, and so dug through the default theme files looking for specific references to date formats. And there were many …

I found that, instead of using the WordPress the_date() function, there were many calls to the_time('l, F jS, Y'), which forces a specific date format. If you replace instances of the_time('l, F jS, Y') with the_date(), your date and time format set in the Options panel will work as expected.

How hard was that? Not very. How easy would it be to be modified in the default template?

no false positives

There was some low-level kvetching on a WordPress blog that Akismet was marking too many false positive comments as spam. Concerned, I trolled through all 11 pages of spam – and didn’t find one real comment.