Playing a dirty game

I joined the Labour Party on the Monday after the European Union referendum vote and the start of the MPs’ revolt against Jeremy Corbyn, so perhaps it’s unwise for me to write this.

No-one is safe, it seems. But I’ve already voted in the leadership election so if the Compliance Unit wants to take issue then let it.

The actions of a small fringe in the Labour Party are horrifying and hypocritical. This group includes not a few MPs, party officials and other figures on the right of the party.

What’s most exasperating for me is the stunning mendacity, although perhaps it shouldn’t be given the period when these people were at the height of their power.

New scandals are dreamt up, exploited with theatrical abandon and forgotten about when people see through them or the wheels fall off because of their internal contradictions (“Corbyn is sexist because most of his shadow cabinet are women”).

Meanwhile entirely different standards are applied to figures on the left and right. Post a couple of tweets critical of certain party rightwingers and you’re out, but donate £2,125,000 to an opposing party and you’re golden.

Sometimes I wonder whether they truly believe what they’re saying. This nonsense about a hundred thousand Trotskyists “twisting arms”, for example. Given Watson’s record it’s liable to just be cynical rubbish, mud thrown in aid of a broader goal, but some people have comprehensively lost the plot.

Then there’s obvious cynicism, like everyone suddenly forgetting what a fringe meeting is. When Momentum plans a fringe it’s a “conference-within-a-conference,” according to the director of right-wing Labour faction Progress.

But when Progress plans 10 events at Labour conference? No problem. Not even when it’s backed by venture capital sharks, who handily have previously given £39,630 to Progress.

Not only that, but Momentum’s event is somehow “in association with the Communist Party of Britain” because our paper is involved!

Two of the Star’s three most senior editors are Labour Party members. We have seven Labour-affiliated trade unions on our management committee.

But our use of the Communist Party’s sensible programme, Britain’s Road to Socialism, whose call for the election of a left government seems to chime with my Labour Party card’s declaration that it is “a democratic socialist party”, is clearly too much.

But the fact that Progress — in the words of supportive MP Tristram Hunt, an “unaccountable faction dominated by a secretive billionaire” — gets £260,000 a year from Lord Sainsbury is naturally not problematic. Any accusation that a group funded by a Lib Dem donor is holding a rival to the Labour Party conference is baseless, obviously.

I’m currently reading Chris Mullin’s A Very British Coup, having just finished Seumas Milne’s The Enemy Within — about the attempts to crush the 1984–85 miners’ strike and its leaders. There are uncomfortable echoes of these books in the actions of the Labour right. The lies. The smears. The theatrics. The hypocrisy. It’s horrid. And these people are meant to be our comrades?

Status update

Earlier today I switched the site off Tumblr and to my own server, hosted by Linode. So if you can see this, that’s a good sign! If you’re reading the RSS feed you might see some duplicate entries but that should settle down.

It’s now being served as a bunch of static HTML files created with a Python site generator I wrote. It’s not going to replace any of the established ones for anybody, but it was interesting to write and is fairly easy to understand. I’ll write about it when I’ve cleaned up the project.

The site isn’t missing anything, so it’s done in that regard, but there’s still some things left over on my end. For a start, a BBEdit preview template and a makefile to automate the last bits.

Re: Unresponsive

Dr Drang posted recently about his trouble getting his site to work with the new responsive design mode in Safari 9 (which is very similar to the Firefox feature of the same name). He also detailed the complicated setup he has for providing his current mobile layout to small, portrait screens (ie phones) — media queries in HTML link tags and separate stylesheet files.

(I should also point out, if Dr Drang is reading, that his mobile.css file is missing the rule for #content iframe. I’m not sure if this is deliberate.)

Since I’ve fought with responsive design a couple of times, and seemingly have a need to stick my nose into other people’s business, I wondered how difficult it would be to combine the two separate CSS files and get responsive design mode to work.

To give some context to what’s discussed, I’ve put up a gist containing the combined CSS file and required HTML changes. In the CSS file you’ll want to look at the end part, from line 809. That part contains two media queries, which split out:

  1. Rules only for small portrait screens (ie phones).
  2. Rules for everyone else (but not small portrait screens).

The two diffs at the top show the changes from Dr Drang’s mobile.css and style.css. The combined file is based on the main stylesheet, which is why there are more changes in the mobile diff.

Most of the changes that make up the Doc’s mobile style sheet are font-size declarations to boost the text size — and these don’t appear in the combined file, which points to the most interesting aspect of this and something that had me confused for not a short while.

Basically, Dr Drang’s mobile style sheet increases the text size to compensate for the mobile browser rendering at “full size” (980px in Safari on iOS). (This is how the New York Times website looked normal in the first iPhone demo in 2007.) The usual technique is to tell the browser to render at “device size” through the use of a meta HTML tag:

xml:
<meta name="viewport" content="width=device-width, initial-scale=1">

It took me a while to work out that this combined with Dr Drang’s larger text to make everything appear massive:

My CSS changes to the And Now It's All This mobile css file caused the text to become huge.

So those rules went, and some new ones to fix the size of the header came in. But otherwise there are no changes to the styles.

The change in approach means that the result isn’t an exact match for the real site:

A portrait comparison of my CSS changes to the real And Now It's All This site.

And in landscape the fixed sizes in the CSS file combine with the use of “device size” to produce a layout that’s larger than the screen width, forcing Safari to resize the viewport until it just fits:

A landscape comparison of my CSS changes to the real And Now It's All This site.

The changes mean that responsive design mode in Safari works for portrait mode:

My CSS changes to And Now It's All This in Safari's responsive design mode in portrait.

But landscape mode is not accurate, as there isn’t the viewport-resizing that squeezes the too-large layout to fit on the phone itself:

My CSS changes to And Now It's All This in Safari's responsive design mode in portrait.

Lastly, I’m going to close with my tips for not going completely mad when trying to make a responsive layout:

  • Have the main part of the CSS file — before any media queries — produce a usable single-column layout (ie for phones).
  • Try to have media queries build on previous rules instead of trying to undo them.
  • Use as few media queries, and as few rules within them, as possible.

I’ve recently rewritten this site’s CSS to prepare for a behind-the-scenes change. Compared to the current stylesheet, first written in 2013, it’s much saner — specifically with regards to media queries but also in general.

Here’s the current stylesheet and the new one if you want to take a look. In the new file the main part, before any media queries, creates a small layout, which is finessed by a mid-sized media query, then finally adjusted for larger screens.

Cameron & Ashcroft

Today’s allegations in the Mail are completely tedious in almost all aspects yet are interesting in one.

Frankly if you’ve gone this long thinking that David Cameron had any shred of humanity there’s no helping you. The 2010–15 Con-Dem coalition was plenty vicious and immediately after winning a majority in May the first thing the Tories did was to screw over deaf and blind people starting work. The day after the vote. These people have no shame and are solely concerned with the interests of their class.

Which is what makes this interesting. Billionaire tax-dodger Michael Ashcroft, the Tories’ former top donor, and the class-warriors at the Mail know full well that their interests are best served by a Tory government. Ashcroft may well feel snubbed at not getting a cabinet job but with £1 billion in the bank there’s plenty he could to do keep himself occupied.

I think this attack on Cameron is meant to make his replacement as Tory leader more palatable. None of the top Tories seem human and they must know it. Boris “three jobs” Johnson, for instance, is known to have been a member of the Bullingdon Club and has admitted taking drugs. (He’s also quite a vicious rightwinger with a tendency to get nasty when challenged, but let’s stick to perceptions.) By painting Cameron as a complete degenerate — a drug-addled ultra-posh pervert who hates ordinary folk — suddenly Johnson (or whichever pretender) seems a lot more acceptable.

Ashcroft’s co-author Isabel Oakeshott made clear to the BBC that publishing the book after the election was done to protect the party. Again: this tax-dodging billionaire knows exactly who his mates are and wants them to stay in charge. It’s just that Cameron’s through and the Tories are suddenly faced with a Labour Party led by a decent human being with decent policies.

Bumping off Cameron and replacing him with someone who’s not seen to be a disgusting pervert who despises the working class (the bigger challenge) is — along with the continuing barrage of media lies against Jeremy Corbyn — the only way to challenge that.

Python’s Counter class, again

I made a mistake in my recent post about Python’s Counter class by using numbers in the example rather than strings. It meant it wasn’t clear what I actually wanted out of the counter. (While I was writing it, I was getting confused between the keys and their counts myself. I should have taken the hint.) That post’s now been updated.

I had a lovely email from Jacob Söndergaard that prompted me into clarifying things, and also started me thinking about ways you can still use max on the counter to get the most common item. Here’s what I’ve got:

python:
from collections import Counter
c = Counter('abracadabra')
most_common = max(c.items(), key=lambda t: t[1])[0]

Here max gets a sequence of tuples (key, count) from c.items() and the custom key function tells it to choose the greatest element based on the count. The [0] index at the end ensures you just get the key, not the count.

But should you do this? No. Please don’t. At this point you’re effectively duplicating the way that Counter implements .most_common() internally. (Here’s the Python source for the method.) That’s at best too — the implementation does something more complicated if you only want the top n most-common elements.

Also: Abracadabra.