Categories
Blogging Guidance TITGIG

Possible WordPress date formatting bug

As you have noticed, I do not display the time on my posts – just the date. However, anything published between midnight and 5am gets the words “in the small hours” appended to the datestamp, to indicate that even though it was technically posted on date D according to some atomic clock in a large city in Europe, it was posted on D-1 according to my internal daily rhythms.

To implement this, I use the function `get_the_time(‘G’)`. This should return a number between 0 and 23 which indicates the hour of the post’s timestamp. However, this stopped working, and it would actually return a very large number (of the order of about 1.1 billion) so the test failed. I don’t know whether this was caused by the upgrade to WordPress 2.5, or my recent move to a different server.

I managed to “fix” the problem by commenting out the following few lines near the top of `mysql2date` (defined in `wp-includes/functions.php`)

if( ‘G’ == $dateformatstring ) {
return gmmktime(
(int) substr( $m, 11, 2 ), (int) substr( $m, 14, 2 ), (int) substr( $m, 17, 2 ),
(int) substr( $m, 5, 2 ), (int) substr( $m, 8, 2 ), (int) substr( $m, 0, 4 )
);
}

However, this is not the ideal solution. Firstly, it’s hard to know if this change is causing a breakage elsewhere in the system (where the code relies upon this apparent bug). Secondly, when I upgrade to a new version of WordPress, I have to remember to fix the new `functions.php`

I discovered a better solution to the problem. I put `functions.php` back to its original state, and then replaced my calls to `get_the_time(‘G’)` with `get_the_time(‘G ‘)` – note the added space. `$dateformatstring != ‘G’` but the function returns the desired result. Get in.

I would report this on the WordPress support forums but I can’t be bothered to create an account.

*Update: I’ve discovered that the offending block of code was added for WordPress 2.5 to address this issue.*

Categories
Computing Displeasure

Bankers

If my bank were to check the access logs of their online banking site, they’d discover a few requests every day with the following user agent:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11 (actually 3.0b5 but a certain banking site won't let me in unless I lie about it)

Someone should tell them that trying to block people using user agent sniffing is about as futile as trying to reduce the teenage pregnancy rate by means of abstinence-only education.

Categories
Computing Music Stunt 2007

What I want for Christmas

*This is a companion piece to a similarly-themed article on Karen’s site which, all things being equal, should be published at roughly the same time.*

I’d quite like a new hard drive for my computer. It currently contains a 40GB drive and an 80GB drive, and what with photographs and MP3s and occasional TV shows, I often find myself running out of space.

*UPDATE: Didn’t get a hard drive, so I ordered myself one on the 27th. I decided to go for a 250GB Seagate Barracuda.*

I also need some new slippers. I have made frequent announcements to this end, and I think I can be pretty certain that someone will have heard my call. My current pair were from the market, and within weeks the seams had given way and my toes were pointing out the front. I tried to patch them up, but it was only a temporary fix. I’ll miss the ventilated slippers, in a way. I enjoyed those moments when I was making coffee in the kitchen, minding my own business, only to be startled by small fingers tickling my toes. I’d look down, and there would be Bernard, seemingly unperturbed by the aroma. Perhaps there wasn’t even an aroma to be perturbed by. Another perk of ventilated slippers.

*UPDATE: Yeah, I got slippers. Two pairs.*

I want to rediscover my love of music. Over the last few years I’ve found myself listening to music less and less, and songs that once filled me with emotion are now leaving me cold. My CD collection is dull and uninspiring, and for the most part, I can’t be bothered to go to the effort of picking out something to listen to. My finger traverses the spines, every case that my finger bumps over seems to contain something pointless and unappealing. I reach the end of the row, and repeat the exercise on the shelf below. Once upon a time, music was a core part of who I was. Now, it’s just a neglected category on a blog.

*UPDATE: I’m enjoying Norfolk & Western and Of Montreal. I’ve also managed to get the radio in the car working again.*

I also wouldn’t feel too violated if aliens came down and fixed the leaky gutter outside the front door.

*Next week’s stunt post will be on the subject of New Years Resolutions – look out for it on Monday.*

Categories
Blogging Computing TITGIG

Wouldn’t it be cool if…

For a while, I’ve been thinking “wouldn’t it be cool if Google Reader could automatically generate a blogroll from my subscription list?” Obviously, I’d want to be able to choose whether each individual subscription appears on the list or not.

Well, it seems like Steve Lacey, a developer at Google, has also wanted this. And so he did it.

It’s currently only available as a JavaScript include, which goes against my usual stance of avoiding using JavaScript for core functionality, but I’m making an exception in this case. Because, for the first time in years (at least four, by my reckoning), I have a public blogroll on my site! And it requires very little additional maintenance on my part ((all I need to remember to do is add the label “blogroll” to new subscriptions that I wish to share)).

Categories
About Me Blogging Music

Resolution Conclusions 2007

*Hey, I did this last year too! Maybe it’s turning into a “thing”?!*

1: Blitz “to do” and “to buy” lists

Karen and I have a big “todo” list. It used to be a handwritten sheet of paper, pinned to the notice board, divided up into “things to do” and “things to buy”. Nowadays, it’s on a wiki, and it is basically divided up into “tasks for Karen” and “tasks for Pete”. The principle is the same.

Anyway, over the course of the year we’ve really kept on top of this list. Sure, lots of things have been added to it, but we’ve managed to keep it at roughly the same size, and there are very few items on there that have been on since the start of the year. I’m quite pleased with this.

2: Less computer time, more films

The most crucial point here was to spend less time surfing the Internet, pretending that absorbing all this data is good for me. Instead, I wanted to spend more time watching films, basking in the unashamed brainlessness of it all. I think I’ve succeeded, more or less. I’m sure that next year’s resolution will be something along the lines of “Less films, more blah”. Maybe computer games. If Rockstar released a “GTA San Andreas Stories” for the PS2 I’d be in heaven.

3: Quality, not quantity. Less reading and writing blogs

I’ve certainly managed to write less, and I feel like the quality is higher. However, I’m still reading more blogs than I need to. But it’s hard to stop myself, when there’s so many well-written sites out there.

4: Make more music

My actual resolution set a much more specific target, which I am not going to print here, for reasons of my own. Suffice to say, I have failed to meet this target in the most magnificent manner possible, despite having revised it downwards twice during the year. Some things just aren’t meant to be.

5: Stop being afraid of strangers

Who are you? Get away from me! Argh!

6: Keep writing with my pen held properly

Back story here. Towards the end of last year, I started making an effort to improve my grip. Basically, this resolution has been an unquestionable success. I now hold a pen like a normal human being. This is so fucking awesome.

7: Less nostalgia

Another success. I used to dwell on the past, thinking about all those good times that passed me by in the blink of an eye. But now I realise that one day, I’ll look back on today (or hereabouts) and wish that I hadn’t wasted so much time being nostalgic. There was the threat of a vicious cycle there, but I’ve managed to break it, and now I am able to appreciate every moment as it happens.

8: Be a leader, not a follower

Hahahahahah.

9: Stop worrying about other peoples’ blogs. Their spam comments, botched templates and missing alt-tags are their own problems

Tick.

10: When someone sends you a link saying “Click this, it’s really funny/cute” then don’t, because it’s just that sneezing panda yet again.

As mentioned here. Haven’t seen the sneezing panda since.

11: Get some exercise

Sorted.

12: Get a project

Had one, but it went away again. I’m not sure whether that counts as a success or not. I should have been more explicit in my statement of the resolution (ie, “Get, and keep, a project”).

13: Improve posture

*Straightens back.*

Uhm… yes.

14: Don’t be so crap at making new friends. Actually, just see #5

Marginally better. But I’m still very bad at this whole “small talk” thing. Maybe I should see this as a strength, rather than a weakness.

15: Learn a bit of Polish

When we were contemplating a short weekend away in Warsaw, this seemed like a very worthwhile resolution. But then we changed our plan and decided to go to Center Parcs instead, so the resolution seemed less important. Still, I’d like to learn some Polish one day (I’m a quarter Polish, by the way) so it’s still something that I’d like to do.

16: Don’t keep getting up from the table in the middle of meals

On Karen’s request (though I added it to the resolutions list voluntarily). I am getting better at this, but I’m not yet perfect.

17: Take time in conversation

By which I mean, don’t just blurt out any old nonsense. Stop, think, come up with an intelligent response. This doesn’t really sit well with #14, as small talk needs to be relatively rapid-fire, so I don’t think that I’ll be able to do both. If you take too much time coming up with a carefully-executed reply, you tend to find that your audience has walked away. Meh, their loss.

18: When on the phone at work, replace “Cheers” with “Goodbye” and “No problem” with “You’re Welcome”

A bit more formality is probably appropriate in this environment. This one was quite a recent addition to the list, so will probably be carried over to next year.

Categories
Blogging Parenting

> Are we too creating worlds of words that will one day cause more heartache than the joy we now feel? By putting our children on a stage viewed by an endless audience are we providing the fodder of therapy sessions and acts of rebellion?

Thoughts on blogging about your offspring, from Dadcentric – “The House At Blog Corner

Categories
Blogging Computing Stunt 2007

A stunt

Karen and I were inspired by a comments thread on her site to perform a stunt.

Next week, from Monday to Friday, we will each write a post on the same topic, and we will publish them simultaneously without knowing what the other has written. So we need to think of five topics.

We already have one (if you inspect the linked comments thread, you may be able to work out what it is. Have you figured out what it is? Congratulations! You get a gold star!) but we need four more.

Please suggest topics here. If you can think of things that we will have differing opinions on, then that will make this stunt *so much more fun*, so I recommend that.

Categories
Computing Photos

Filing digital photos

What filing system do you use for storing digital photos?

My current system is basically date-based (so I’d have a subdirectory called something like “2007-08-21 Photos of my arse”) which makes it quite easy to find what I’m looking for. However, I then keep photos of Bernard in a separate subdirectory entirely, with a subdirectory in there for each month (so that I don’t end up with an unbearable number of files in one directory). The exception to this is where I have a bunch of photos from a holiday or something, where it makes more sense (to me) to keep the photos of Bernard and the rest of the holiday photos together.

Anyway, I’ve been wondering if this is really a smart solution. So tell me all about your system.

Categories
Computing TITGIG

Spam-proofing my contact form with Akismet

For a while, I’ve used a contact form (written in PHP) instead of publishing my email address on this site, to thwart spammers. However, recently I’ve noticed an increasing number of spam messages being submitted through the contact form.

My first thought was to add a drop-down box where the user can select what their query is regarding – the default selected option is “My desire to sell you discount pharmaceuticals” and any messages submitted with this option would not be sent. However, the spammers (or the scripts that they use) would generally submit the form with a random selection from this box, so the majority of spam was still coming through.

I didn’t want to make the contact form difficult to use, so I looked into ways of filtering out spam using Akismet, the same application that protects the comments forms on this site (and a very good job it does, I might add).

You will need to download akismet.class.php and upload it to your web server. Rather than rewrite all the instructions here, I’ll point you to the perfectly adequate documentation that already exists.

Categories
Computing

How rude!

Are you running a recent version of Firefox? ((where recent is defined as “has built-in spellchecker”)) Yes? Then try this…

1. Go to the comments form for this entry.
2. Type buckinghamshire into the text field (with a space at the end)
3. Note the red squiggly line – this means that the word is not in Firefox’s internal dictionary.
4. Right-click on “buckinghamshire” to see what words *are* in Firefox’s internal dictionary.
5. How rude!