A quick tip for understanding CSS Flexbox

Quite a few people have difficulty understanding the CSS Flexible Box Model, especially the flex-shrink property. Even brainboxes like Remington Sharp find it tricky:

As a quick tip, I find a helpful way of coming to grips with it is by likening Flexbox to String Theory. Thus, flex-basis is analogous to a Calabi–Yau manifold or similar higher-dimensional analogues of K3 surfaces, and think of flex-shrink as behaving like the 7 compactified dimensions propagating from one point to another by summing probability amplitudes.

Hope this helps.

Reading List

Thursday meh: disruption-worship

(Being part of an occasional series in which I grumpily fulminate against something that’s annoyed me.)

I’m fed up with tech-neocon wankery about “disrupting” industries.

You turned the public into taxi drivers? You simplify the process by which millionaires find a San Francisco parking space? Your iPhone app makes it easy to swipe a face away if you don’t want to fuck its owner? Woo, have a fucking Nobel Prize, Mr Disruptor.

In return for your clever oh-so-useful tech, you perpetuate a culture of all-nighters, working for stock, a lads-only pseudo-meritocracy. You whimper about government regulation that exists to protect consumers and workers. You claim a right derived straight from God (or Adam Smith, at least) to do what you want, when you want, to whom you want and you justify this by saying you’re shaking up (“disrupting”) inefficiencies. So noble! Reforming economics while relentlessly focussed on selling your company to a tech giant so you can repeat the process and enrich yourself.

Disrupt your own grasping, me-first mindset. And then show me your tech.

On HTML5 vs Living Standard, W3C vs WHATWG

That nice Stephen Shankland just published a news report HTML5 is done, but two groups still wrestle over Web’s future on CNET, quoting me a couple of times.

As I’m occasionally asked questions about how I see the two different organisations working together (or not), here are the full questions that Steve asked me, and my responses (as approved unchanged by my bosses at Opera). I’m grateful to Steve for giving me his permission to reproduce them.

SS: How big a problem is it that WHATWG and W3C both are sorta kinda in charge?

BL: It’s not an especially big problem for the vast majority of developers who aren’t developing sites using still-fluid features that are only available in the latest nightlies. Where they differ, the W3C spec is a better guide to the stable features as implemented already in browsers – for example, it has dropped the <hgroup> element, warns about the lack of implementations of the outlining algorithm and has much better advice on using the <main> element today to make websites more accessible to people with disabilities.

SS: Which do you think has more power in charting the future of the standard?

BL: Neither. The power is with browser makers. As Ian Hickson of WHATWG said, it doesn’t matter what the specs say if browsers don’t implement them.

SS: It seems kind of like we have two horses pulling the same cart, with no coordination between the horses. Is this a bad use of resources? Or is that a bad metaphor?

BL: The web is the biggest platform we’ve ever had. Therefore, it has more constituencies and competing interests than we’ve ever seen. It’s absolutely right that those different interest groups slug it out. At least it’s (mostly) done openly, unlike the decisions made behind closed doors by proprietary organisations answerable to no-one.

SS: We can’t rewrite history to excise XHTML 2.0, but should the two communities work to converge into one somehow? Is that even possible?

BL: I’d like to see one community , but suspect the cultural clashes are too large. So we have to get along, working together mostly and fighting occasionally, just like a family – albeit sometimes most like the Addams Family.

SS: How much actual real-world confusion is there among developers? Where should they go to see what the “true” spec says?

BL: If you want to see what’s already implemented in browsers now, look at W3C spec. If you want to see what might be coming (or how things may change) look at WHATWG spec.

Opera implements following the WHATWG spec, because that’s where nitty-gritty of the leading-edge stuff is discussed. But we also actively support and participate in the W3C as we see the value in having stable snapshots that developers can refer to, and it’s also the forum for many other vital spec discussions about Web Manifest, Device APIs etc. It’s possible to love both and, as we’re Norwegian, our hearts are full of love for all.

In praise of community conferences

As part of my usual Autumn tour of European capitals (this year, Berlin, Bucharest, Amsterdam, London, Paris, Madrid, Oslo) I’ve been lucky enough to speak at three community conferences, which are always my favourite.

SmartWeb, Bucharest

The first was SmartWeb conference in Bucharest, Romania. This was started last year by Gabi Schiopu who was frustrated by the lack of front-end conferences in his country, but the cost of international travel and hotels is prohibitive, so decided to start his own. So he got an event organising partner (thank you, Evensys!) and invited speakers. It proved so successful that he ran it for a second year. As I’m paid to do international jetsetting by Opera, I asked that my speaker fee be converted into free tickets for deserving local university/ school students. We’re all pictured below with McCartney-esque cheesy grins and thumbs up. By an almost incredible co-incidence, we were all wearing matching Opera t-shirts.

students

I had great fun presenting and MCing the event, and Bucharest is a delightful city.

Fronteers, Amsterdam

The second was Fronteers in Amsterdam. This year is the seventh conference; I’ve been to four (and spoken at three, if you don’t count this year’s lightning talk the night before). Fronteers is a conference I like to attend because it’s deeply technical, which makes it pretty scary as a speaker but very useful for the audience – there’s no “How I get inspiration from, like, nature and moleskines” or “Iterate often and dare to fail, you’re awesome” stocking-filler on this stage. (And, what a stage it is! A giant cinema screen in the beautiful Pathé Tuschinski cinema. They could probably easily fill a bigger venue, but part of the Fronteers charm is this venue.)

My friend Shwetank Dixit spoke on WebRTC – A Front-end perspective and, as he’d come all the way from India, the rest of the Opera Devrel crew descended on Amsterdam to give moral support and drink Dutch beer (the best is called “jenever” – no more than 4 pints, though). As usual, lots to learn and lovely to meet the great and the good of Europe’s web developers there.

Fronteers is organised by a group of volunteers, and its charitable status means that they don’t turn a profit at the end of the year – all money made is reinvested back into other events and initiatives for the Dutch web development community. Yay. Thanks, Fronteers crew, for putting on the conference and looking after me so well (even though I wasn’t actually speaking).

ParisWeb, Mauritius

Only joking- Paris, duh. For its ninth year, I decided to ruin its reputation and give a talk on “Web Components- The Right Way” with Karl Groves of The Paciello Group. Here’s the video, and here are our slides:

What’s jolly nice about ParisWeb is that English talks are simultaneously translated into French, all talks are translated into sign language and transcribed live. The latter was useful to me as I find it easier to read French than to follow the spoken language (French people spell much better than they pronounce), especially technical French for hours. I was especially proud when the signing interpreter sought me out after my unscheduled lightning talk (video, starts at 18 mins) to thank me for giving her the opportunity to sign “rectal prolapse” and “ejaculate my own liquified spleen” which, inexplicably, she seldom gets to do.

Again, ParisWeb is run by a group of volunteers who do it for love of the web.

Vive les volunteers! Please do all you can to support these conferences and, if you’re invited to speak, accept – it’s part of contributing back.

CSS {all: initial} to prevent widgets inheriting CSS from a host page

Imagine you have some sort of widget – an ad box, a sign-up form, some execrable collection of social buttons, whetevs – that you’re injecting into arbitrary pages using JavaScript. You don’t want your widget to get weirdly styled by the host page’s CSS. This is when you want to undo the CSS.

Enter all: initial. This resets all CSS properties to their initial value, and undoes browser stylesheets – in this example, the blockquote is no longer indented or display:block; as you’d expect.

Other values for the property are inherit, which changes all the properties applying to the element or the element’s parent to their parent value, and unset which changes all the properties applying to the element or the element’s parent to their parent value if they are inheritable or to their initial value if not.

They’re supported in Opera, Firefox and Chrome. The Mozilla Developer Network page has good examples of these.

What’s curious, though, is that the value that would be the most useful isn’t there at all. I wouldn’t want to completely strip away User Agent styles and then have to reset elements to display block-level and then indent them in CSS. I wonder why there’s no all: ua-default (or somesuch) to reset them to the User Agent style sheet default?

Update: Saperlipopette! There’s a very good French-language post La cascade CSS avancée: all, initial et unset for those who speak Oohlala.

Reading List

Pointer Events

Microsoft wrote a spec called Pointer Events API that unifies touch, stylus and mouse inputs, and implemented it in IE11 (partially in IE10). Firefox are implementing it too. After initial enthusiasm from Google, Chrome announced that it won’t support it, after all.

Other standards ‘n’ shiz

Shine to me

Here’s a spooky little picked riff, a pretty tune (in my opinion) and some melancholic words about yearning and missed opportunities. It could have had loads of harmonies and coutermelodies but I chose to keep it relatively sparse. The guitar solo displeases many, but it best expresses the feeling behind the song.

It’s recorded using Audacity (I found the iPad apps I’d been trying were too cumbersome for editing the tracks after recording, perhaps because I don’t know their intricate UIs well enough).

If you come to me I promise we will
Stay here in the silence, lie very still.
messages sing through the cables and the air:
ceaseless secrets spinning from nowhere to nowhere.
There are too many secrets to share.

If you come to me I promise we’ll go
to the places where the faces are beautiful unknowns -
where the past is expired
so no masks are required.
A place where we can escape from our facts.
There are too many questions to ask.

If you look down I fear you might fall,
or lose your grip on something delicate and small.
You ignite the bright light that was dimmed inside me.
When the blood in your breasts throbs violently
come to me, come with me. Now. Shine to me.

Words and music © Bruce Lawson, 2014. All rights reserved.

Reading List

Shake your Brucie!

Once in a generation, there is a perfect combination of circumstances that leads to the creation of something truly extraordinary. Today is that day – the flawless union of programming, content, beauty and functionality.

This week at the Future of Web Apps conference, the Stella McCartney of geek crochet, Ruth John, gifted me with a hand-made, individually-designed crocheted mankini. A photo of me wearing it is available on my fashion blog What’s Bruce Wearing Today (caution advised).

At the same conference, Syd Lawrence demonstrated his accelerometer-driven app Shake Her Booty which allows you to control J Lo’s bottom (“booty”) by shaking your phone.

Claudia Snell asked “when can we expect the @brucel version?” so Syd mashed up some video he’d made of me dancing in the mankini at the FOWA after-party, and today has released Shake Your Brucie.

Just tap my booty to begin.

Enjoy.