The Stupidest CSS

Yesterday, I wrote the stupidest bit of CSS of my entire career.

Screenshot of the WooCommerce Extensions Marketplace, with two sponsored products annotated to show (a) a pretty stripe at the top, (b) adding the word "Sponsored", and (c) a strange green blob alongside each.
Two new visual elements and one textual one will make it clear where a product’s placement in the marketplace is sponsored.

Owners of online shops powered by WooCommerce can optionally “connect” their stores back to Woo.com. This enables them to manage their subscriptions to any extensions they use to enhance their store1. They can also browse a marketplace of additional extensions they might like to consider, which is somewhat-tailored to them based on e.g. their geographical location2

In the future, we’ll be adding sponsored products to the marketplace listing, but we want to be transparent about it so yesterday I was working on some code that would determine from the appropriate API whether an extension was sponsored and then style it differently to make this clear. I took a look at the proposal from the designer attached to the project, which called for

  1. the word “Sponsored” to appear alongside the name of the extension’s developer,
  2. a stripe at the top in the brand colour of the extension, and
  3. a strange green blob alongside it

That third thing seemed like an odd choice, but I figured that probably I just didn’t have the design or marketing expertise to understand it, and I diligently wrote some appropriate code.3

I even attached to my PR a video demonstrating how my code reviewers could test it without spoofing actual sponsored extensions.

After some minor tweaks, my change was approved. The designer even swung by and gave it a thumbs-up. All I needed to do was wait for the automated end-to-end tests to complete, and I’d be able to add it to WooCommerce ready to be included in the next-but-one release. Nice.

In the meantime, I got started on my next bit of work. This one also included some design work by the same designer, and wouldn’t you know it… this one also had a little green blob on it?

A design for a completely different part of the WooCommerce Extensions Management tool, again with a little green blob. Dan's floating head looks thoughtful above it, with a thought-bubble reading "wow, we're really going all-in on these little blobs, aren't we?"
I’m almost embarrassed to admit that my first thought was that this must be part of some wider design strategy to put little green blobs everywhere.

Then it hit me. The blobs weren’t part of the design at all, but the designer’s way of saying “look at this bit, it’s important!”. Whoops!

So I got to rush over to my (already-approved, somehow!) changeset and rip out the offending CSS: the stupidest bit of CSS of my entire career. Not bad code per se, but reasonable code resulting from a damn-stupid misinterpretation of a designer’s wishes. Brilliant.

Footnotes

1 WooCommerce extensions serve loads of different purposes, like handling bookings and reservations and integrating with parcel tracking services.

2 There’s no point us suggesting an extension that helps you calculate Royal Mail shipping rates if you’re not shipping from the UK, for example!

3 A fun side-effect of working on open-source software is that my silly mistake gets immortalised somewhere where you can go and see it any time you like!

× ×

My New Pet Hate, part II

A few years ago, I talked about a pet hate of mine that still seems to be prevalent: that is – that when people send me a screenshot, they’ll sometimes send me it in a Word document, for no apparent reason. They could just send me the picture, but instead they send me a Word document containing the picture, thereby increasing the file size, requiring that I have a program capable of viewing Word documents, and making it more-complex for me to extract the picture if I need to use it somewhere. And on top of all of that, it takes longer for them to do it this way: everybody loses!

Today, I saw somebody take the abuse of screenshots to a whole new level. My first clue that something was amiss was when the email arrived in my Inbox with a 300K TIFF file in it. “Well, at least it’s not a Word document,” I thought. And I was right. It was something more convoluted than that.

My only explanation for the contents of the file is as follows:

  1. Print Screen. The user took the screenshot using their Print Screen key. So far, so good. They captured their whole screen, rather than just what they were trying to show me, but we’ll let that pass.
  2. Open Paint. The user opened Paint. At this point, they could have pasted, saved, and emailed the file to me, and still been doing perfectly well. But they didn’t.
  3. Resize canvas. The user expanded the canvas to an enormous size. Perhaps they didn’t know that this would be done automatically, if required. Or maybe they thought that I could do with a lot of white space in which to make notes on their screengrab.
  4. Paste and reposition. The user pasted the screenshot into the Paint document, and positioned it near the centre, making sure to leave as much whitespace as possible. Y’know, in case I was running out of it on my computer. They could still at this point have just saved the file and emailed it to me, and I wouldn’t have complained.
  5. Print Screen again. For some reason, the user pressed Print Screen again at this point, thereby taking a screenshot of themselves manipulating a screenshot that they’d already taken. Maybe the user has recently watched Inception, and decided that “a screenshot within a screenshot” was more likely to make an impact on me. We need to go deeper!
  6. Open Photoshop. Paint obviously wasn’t going to cut it: it was time for a bigger graphics program. The user opened up Photoshop (waiting for a few minutes while this beast of a program warmed up).
  7. Create a new document and paste again. Now the user had Photoshop open, containing a picture of Paint being used to display an (oversized) screenshot of what they wanted to show me.
  8. Crop. This was a good idea. If the user had cropped the image all the way back down to the screenshot, I might not even have worked out what they were doing. Sadly, they didn’t. They cropped off Paint’s title bar and half of its toolbar. Then they added another few layers of whitespace to the bottom and right, just to be really sure.
  9. Save as a TIFF. They could have saved as a PNG. Or a GIF. Even a JPEG. They could have saved as a PSD. But no, for some reason, an uncompressed TIFF was the way forwards.
I N C E P T I O N. A screenshot of a screenshot within a screenshot.

Back in 2009, I predicted that Windows Vista/7’s new “Snipping Tool”, which finally brought screen captures to the level of more-competent operating systems, would see the end of this kind of nonsense. Unfortunately, Windows XP remains the standard at my workplace, so I doubt that this’ll be the last time that I see “matryoshka screenshots”.

×

Idiocy Repeats Itself

Two years and one month ago to this day, I made an idiot out of myself by injuring myself while chasing cake. Back then, of course, I was working on the top floor of the Technium in Aberystwyth, and I was racing down the stairs of the fire escape in an attempt to get to left-over cake supplies before they were picked clean by the other scavengers in the office building. I tripped and fell, and sprained by ankle quite badly (I ended up on crutches for a few days).

Last week, history almost repeated itself, and I’m not even talking about my recent head injury. Again, I’m on the top floor of a building, and again, there’s a meeting room on the bottom floor (technically in the basement, but that only means there’s further to go). When I got the email, I rushed out of the door and down the stairwell, skipping over the stairs in threes and fours. Most of the Bodleian’s stairwells are uncarpeted wood, and the worn-down soles of my shoes skidded across them.

The prize! Baskets of fresh sandwiches (fruit, but not cakes, are off-camera: around here, cakes go very quickly...)

You’d think I’d have learned by now, but apparently I’m a little slow. Slow, except at running down stairs. As I rounded the corner of the last stairwell, my body turned to follow the route but my feet kept going in the same direction. They took flight, and for a moment I was suspended in the air, like a cartoon character before they realise their predicament and gravity takes hold. With a thud, I hit the ground.

Perhaps I’d learned something, though, because at least this time around I rolled. Back on my feet, I was still able to get to the meeting room and scoff the best of the fruit and sandwiches before anybody else arrived.

Is this really worthy of a blog post? Dan doesn’t have an accident is hardly remarkable (although perhaps a little more noteworthy than I’d like to admit, based on recent experience). Well, I thought so. And I’ve got a free lunch. And I didn’t have to hurt myself to do so. Which is probably for the best: based on the number of forms I had to fill out to get root access on the systems I administer, I don’t want to think how complicated the accident book must be…

×

Anonymity For Beginners

Somebody obviously didn’t understand the idea of the BBC’s story on annoying work colleagues when they posted the following comment: see how they signed it off –

Why are there so many ‘Anonymous’ comments above? If people are so concerned about their colleagues, then say so with the courage of your convictions rather than snipe about them anonymously!
Anonymous, UK

Raised a laugh among my work colleagues, anyway.

The Return From Lancashire

Spent the last four days in Lancashire and elsewhere in the North of England, visiting my folks (among other things). Details follow…

Sunday 29th June 2003
Dan’s Mum’s House, Preston
Helped fix my mum’s fence, and enjoyed the challenge of removing a pigeon from her gutter. This stupid bird, it seems, on a collision course for the house (shitting on the window as it came), struck the roof with sufficient force to kill itself, and then rolled gracefully into the gutter, where it became lodged.

Using a clever combination of metal rods and string, Claire and I were able to lasso it’s foot from one of the upstairs windows and, a few pokes later, lob it’s rotting corpse down to my sister, waiting below.

My dad kindly let me take one of his bikes – Silver Machine – back to Aber with me, which’ll make getting to and from work a lot nicer. Must buy a lock for it.

Got back at about midnight. Claire spent most of the night tied to the bed, which was fun. Enough said.

Makes You Feel Stupid

Don’t you feel really stupid when you plan to go via somewhere on the way to somewhere else, and completely forget about it. I managed that this morning: I’d put some keys in to get cut at the hardware shop around the corner from where I live, gone and bought my lunch from Somerfield, then returned home. When I went to work, past the shop, I forgot entirely to pick up the keys, until I got about a third of the way to the office and had to turn back. D’oh!

One of Claire’s birthday presents – being delivered by post – hasn’t arrived yet, and her birthday’s on Monday. Must remember to phone the company today and find out what’s happened to it. Can’t say what it is, here, ‘cos she reads this page, too.

Keep having to give my work colleague PHP tips so that he stands a chance of writing the website of Borth Surf Club. Looking at the web site so far, I can’t help but feel that it’s not PHP tips I should be giving him, but basic design pointers! Like not putting the title of the page as “Untitled Document”, for one. Here’s a chunk of code I just lifted out of the web site:

<p align="justify">&nbsp;</p>
<p align="justify">&nbsp;</p>
<p align="justify">&nbsp;</p>
<p align="justify">&nbsp;</p>
<p align="justify">&nbsp;</p>
<p align="justify">&nbsp;</p>
<p align="justify">&nbsp;</p>

For the non-techies out there, I’ll explain what this bit of code does. It prints seven empty paragraphs. Exciting, eh?

I’ll resist strangling him with my keyboard cable on account of the fact that I believe that there is some hope for him, yet. We’ll see.

Anyway, better get some work done…

How To Fix A Flat Car Battery For Beginners

Unfortunatley my plans for a nice relaxed evening over a pint were delayed somewhat by having to help to fix Claire’s car, first. In a fantastic display of sense she’d left the headlights on on Sunday night, and all through Monday, and so by Tuesday the battery was very, very dead.

So she, Bryn, Kit and I stood in a cold and rainy car park, trying to remove Bryn’s car battery to get Claire’s car going, then switch back to her battery while it’s running so we could charge it with a nice long drive. But no such luck: the considerate engineers at Vauxhall decided that to remove the battery you must either (a) own a spanner with a neck width about the size of a human hair or (b) remove the engine first.

Thankfully I was able to persuade a taxi driver at the nearby rank to drive around with some jump leads and get her going. Suddenly this made things a lot easier.

In brighter news, Bryn got offered a year in industry placement with the National Library of Wales, which means that he, too, will be living in Aberystwyth for the summer.

April Fools Day

April Fools Day has always been an oppertunity for me to get back at the ineffective dickheads that are the management of Penbryn Hall at the University of Wales, Aberystwyth. This year was no exception. Building upon the success of my last big prank, Penbryn-Hall.co.uk, a spoof ‘official’ site which almost got me expelled from the hall, this year I worked with Kit, Bryn and Claire in order to cause yet more chaos.

We had a plan in mind already, but when Penbryn sent out the following message on the internal e-mail system, we couldn’t help but pounce on an oppertunity:

From: Eiryls Evans <eee@aber.ac.uk>
Date: 28/03/2003 13:46
To: hall-penb-4@aber.ac.uk
Subject: Re: Maintenance Checks

Dear Student

On Tuesday 1st and Wednesday 2nd April, Mark and I will be doing a maintenance inspection in student rooms.

This will involve checking for repairs and lights which are not working.
We will be starting in Block 1 at 10.30 am

If you have any problems e.g. desk lamp not working and would like a new bulb, please call at Reception.

Margaret Woodliff
Deputy Manager

A few things immediatley stand out in this e-mail. One is that the name at the bottom is not the same name as the person it appears to come from. A second is that it is not provided in Welsh, and is therefore in contravention of the University’s billingual policy…

…the third, and stupidest of the lot, is that they arranged to do room inspections on the first of April.

So, we thought… all we have to do is spread some more convincing (not difficult, considering) counter-publicity, stating that this e-mail was actually a student prank, and that there will not be any room inspections after all. We could even go so far as to state that we suspect that this e-mail may be the prelude to an attempt to gain unauthorised access to student’s study bedrooms. Mayhem in the making.

We came up with a poster that expressed pretty much this, and stuck copies up all over the hall. And it worked! People were absolutely convinced that our posters were real and the real e-mail was the hoax. In the end, the management had to spend their Sunday walking round from room-to-room knocking on student’s doors and assuring them that the e-mail was the genuine article. Oh; how I laughed.

The poster is available to download as an Adobe Acrobat file, below.

Download The Poster
Adobe Acrobat (PDF); 22KB.
The actual poster which was put up around Penbryn Hall for April Fools Day 2003.

Cool Thing Of The Day

Cool And Interesting Thing Of The Day To Do At The University Of Wales, Aberystwyth, #23:

Leave a club, and, in a drunken stupor, decide that it’s a sound and logical idea to take £120 out ot a cash machine, because it’ll save you from having to do it later. Realise this tommorow morning, and replace the money. Decide that taking your card out when you’re going to get pissed isn’t such a smart idea, after all.

The ‘cool and interesting things’ were originally published to a location at which my “friends back home” could read them, during the first few months of my time at the University of Wales, Aberystwyth, which I started in September 1999. It proved to be particularly popular, and so now it is immortalised through the medium of my weblog.