Thoughts

Topics
Years

Getting MapLibre working for both native and web in Expo

I've been dabbling of late in building a mobile app with React Native + Expo. One of the things that attracted me most to Expo, is that – on top of the "write once, run on iOS and Android" claim of React Native – Expo claims to also let an app run seamlessly on the web. Anyway, as it turns out (surprise surprise – not!), neither of those claims are particularly aligned with reality. I found this out – with the claim of "run on native and web" – as soon as I wanted to add a simple map to my app.

Behold, a MapLibre map, working both for native and for web, in Expo.
Behold, a MapLibre map, working both for native and for web, in Expo.

Below is my humble lil' guide to getting MapLibre working for both native and web in Expo. Note: if you want to skip the step-by-step shpiel, and you just want a working example with all the code, feel free to head straight to the Expo MapLibre native + web demo on GitHub.

Sea level rise is gonna get a whole lot realer

I was alarmed to recently learn that plenty of folks out there on the interwebz don't believe that the seas have risen, at all, for several centuries. Although, in hindsight, I shouldn't be surprised: after all, there's no shortage of climate change deniers out there, and sea level rise is very (although not completely) interconnected with climate change.

To be fair to those folks, it's true that – as they claim – the water level of various landmarks around the world, such as the Statue of Liberty, Plymouth Rock, and (in my own stomping ground of Sydney Harbour) Fort Denison, has not "visibly" risen since they were erected.

The fact, per the consensus of reputable scientists, is that the global average sea level has risen by 15-25cm (6-10") since 1900. Now, I'm willing to entertain the notion that, alright, for all practical purposes, that's not much. And that's just the average. So I consider it not unreasonable to concede that there are numerous places in the world today, where the sea level has barely, if at all, risen.

But.

Wait, there's more.
Wait, there's more.
Image source: PxHere.

The thing is, sea level rise lags behind global warming by several decades. So (if you'll excuse my hitting-rather-close-to-home choice of pun), what we've seen so far is just the tip of the iceberg. We've already locked in another 10-25cm (4-10") of sea level rise between now and 2050. And we're currently looking at a minimum 28-61cm (11-24") of sea level rise between now and 2100, and a minimum 40-95cm (16-38") of sea level rise between now and 2200. And those are the best-case scenarios, based: on the most conservative of scientists' conclusions; and on the world taking drastic action to reduce greenhouse gas emissions starting right now (a depressingly unlikely occurrence).

So, ok, perhaps sea level rise ain't gotten real yet for most people (although it sure has for some people). But I got news for y'all: it's gonna get a whole lot realer.

On FastAPI

Over the past year or two, I've been heavily using FastAPI in my day job. I've been around the Python web framework block, and I gotta say, FastAPI really succeeds in its mission of building on the strengths of its predecessors (particularly Django and Flask), while feeling more modern and adhering to certain opinionated principles. In my opinion, it's pretty much exactly what the best-in-breed of the next logical generation of web frameworks should look like.

¡Ándale, ándale, arriba!
¡Ándale, ándale, arriba!
Image source: The Guardian

What (I think) the Voice is all about

A few weeks ago, I had my first and only conversation with an ardent "No" campaigner for the upcoming Australian referendum on the Voice to Parliament. (I guess we really do all live in our own little echo chambers, because all my close friends and family are in the "Yes" camp just like me, and I was genuinely surprised and caught off guard to have bumped into a No guy, especially smack-bang in my home territory of affluent upper-middle-class North Shore Sydney.) When I asked why he'll be voting No, he replied: "Because I'm not racist". Which struck me, ironically, as one of the more racist remarks I've heard in my entire life.

Now that's what I call getting your voice heard.
Now that's what I call getting your voice heard.
Image source: Fandom

I seldom write purely political pieces. I'm averse to walking into the ring and picking a fight with anyone. And honestly I find not-particularly-political writing on other topics (such as history and tech) to be more fun. Nor do I consider myself to be all that passionate about indigenous affairs – at least, not compared with other progressive causes such as the environment or refugees (maybe because I'm a racist privileged white guy myself!). However, with only five days to go until Australia votes (and with the forecast for said vote looking quite dismal), I thought I'd share my two cents on what, in my humble opinion, the Voice is all about.

Ozersk: the city on the edge of plutonium

Ozersk (also spelled Ozyorsk) – originally known only by the codename Chelyabinsk-40 – is the site of the third-worst nuclear disaster in world history, as well as the birthplace of the Soviet Union's nuclear weapons arsenal. But I'll forgive you if you've never heard of it (I hadn't, until now). Unlike numbers one (Chernobyl) and two (Fukushima), the USSR managed to keep both the 1957 incident, and the place's very existence, secret for over 30 years.

Ozersk being so secret that few photos of it are available, is a good enough excuse, in my opinion, for illustrating this article with mildly amusing memes instead.
Ozersk being so secret that few photos of it are available, is a good enough excuse, in my opinion, for illustrating this article with mildly amusing memes instead.
Image source: Legends Revealed

Amazingly, to this day – more than three decades after the fall of communism – this city of about 100,000 residents (and its surrounds, including the Mayak nuclear facility, which is ground zero) remains a "closed city", with entry forbidden to all non-authorised personnel.

And, apart from being enclosed by barbed wire, it appears to also be enclosed in a time bubble, with the locals still routinely parroting the Soviet propaganda that labelled them "the nuclear shield and saviours of the world"; and with the Soviet-era pact still effectively in place that, in exchange for their loyalty, their silence, and a not-un-unhealthy dose of radiation, their basic needs (and some relative luxuries to boot) are taken care of for life.

GDPR-compliant Google reCAPTCHA

Per the EU's GDPR and ePrivacy Directive, you must ask visitors to a website for their consent before setting any cookies, and/or before collecting any user tracking data. And because the GDPR applies to all EU citizens (who are residing within the EU), regardless of where in the world a website or its owner is based, in order to fully comply, in practice you should seek consent for all visitors to all websites globally.

In order to be GDPR-compliant, and in order to just be a good netizen, I made sure, when building GreenAsh v5 earlier this year, to not use services that set cookies at all, wherever possible. In previous iterations of GreenAsh, I used Google Analytics, which (like basically all Google services) is a notorious GDPR offender; this time around, I instead used Cloudflare Web Analytics, which is a good enough replacement for my modest needs, and which ticks all the privacy boxes.

However, on pages with forms at least, I still need Google reCAPTCHA. I'd like to instead use the privacy-conscious hCaptcha, but Netlify Forms only supports reCAPTCHA, so I'm stuck with it for now. Here's how I seek the user's consent before loading reCAPTCHA.

Scott Morrison is not keen on ABC interviews

Scott Morrison surprised the fine folks over at the national broadcaster recently, by turning down their invitation for a pre-election debate with Anthony Albanese, instead choosing to have all three of his televised debates take place on commercial channels.

I have also made the casual observation, over the last three years, that Morrison makes few appearances on Aunty in general, compared with the commercial alternatives, particularly Sky News (which I personally have never watched directly, and have no plans to, but I've seen plenty of clips of Morrison on Sky repeated on the ABC and elsewhere).

This led me to do some research, to find out: how often has Morrison taken part in ABC interviews, during his tenure so far as Prime Minister, compared with his predecessors? I compiled my findings, and this is what they show:

Morrison's ABC interview frequency compared to his forebears
Morrison's ABC interview frequency compared to his forebears

It's official: Morrison has, on average, taken part in fewer ABC TV and Radio interviews, than any other Prime Minister in recent Australian history.