Terence Eden

https://shkspr.mobi/blog

69 posts · 152 Votes · 13 Followers

Tech 48% · Writing 20% · Culture 13% · Film & TV 4% · Life 4% · Music 4%

Subscribe via RSS

  1. PHP - simple way to send HTTP headers before a script ends

    Suppose you want PHP to keep processing after it has sent back an HTTP response. Normally, this doesn't work: <?php header( "Location: https://example.com/" ); // Long operation. sleep(10); die(); Try it yourself. You'll have to wait 10 seconds before you get back < HTTP/2 302 < location: https://example.com/ There are some complex ways to fix this - they usually involve spawning sub-processes or having a cron job run something. But there's a simpler way! Most servers do some form of output…

    0
  2. Which age-gates should be skill-gates and vice-versa?

    In the UK, it is illegal to buy alcohol if you are under 18. Similarly, in most countries, you cannot vote until you have reached a specific age. These are age-gates. You do not need to prove your competence to drink, vote, smoke, or get married; you just need to be old enough. Some things have skill-gates. If you want an amateur radio licence in the UK, you need to pass an exam. You can be any age0. Similarly, most jurisdictions allow you to get a medical licence once you have passed the…

    1
  3. Whale Fall

    Somewhere, in the endless blue ocean, a gigantic mammal shudders as it takes its last breath. Thanks to science, we know that all dogs go to heaven, but all whales descend through the murky depths until their carcasses litter the seabed. Imagine a giant dying. You can't. They are huge and endless. A towering presence which, so it seems, has always been part of our world. They dominate and are indomitable. It is simply unfathomable that they can ever end. Yet end they must. As the whale dies, we…

    0
  4. Book Review: Terrible Worlds: Destinations by Adrian Tchaikovsky ★★★★★

    What's better than one Adrian Tchaikovsky novella? Three Adrian Tchaikovsky novellæ! Or is it "novellii"? Either way, a delightful triptych of stories on a common theme. On the surface, they're about travelling to a new destination (Space! The Future! For-Copyright-Reasons Not Narnia!) Except, deep down, they're about loneliness. No matter how far or fast we run, no matter where or when we go, we can't outrun ourselves. When you enter the void, sometimes the void enters you. There's also the…

    0
  5. GDS weighs in on the NHS's decision to retreat from Open Source

    Within the UK's Civil Service you occasionally hear the expression "being invited to a meeting without biscuits". It implies a rather frosty discussion without any of the polite niceties of a normal meeting0. In general though, even when people have severe disagreements, it is rare for tempers to fray. It is even rarer for those internal disagreements to spill over into public. Which is what makes GDS's latest guidance so surprising. At the start of the month, NHS England made the bizarre and…

    0
  6. UK Government Kicks Out Palantir

    The UK Government, for all its faults, is pretty good at publishing contracts it has awarded. That's why I get depressed when I see rage-bait nonsense about how companies have been award "Top Secret" deals. Right now you can go to https://www.contractsfinder.service.gov.uk and search for whichever bête noire has you riled up. You might want to argue that the company is corrupt, incompetent, or overpriced - but you can't argue that its contract is secret. There's no conspiracy. There's no…

    0
  7. Stupidly Simple SVG Sparklines

    A sparkline is a little line-graph with no axes or other unnecessary details. They're useful for getting quick understanding of what the data is showing. They're also really easy to create programmatically. This uses the SVG "polyline" which takes a list of x,y co-ordinate pairs. But can you spot the small problem? <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1024 124"> <polyline fill="none" stroke="#0074D955" stroke-width="3" points="12,48 83,84 154,79 226,90 297,79 369,65 440,78…

    1
  8. Find blog posts with missing featured images - and missing alt text - without a plugin

    WordPress has the concept of "Featured Images". They are the images which show up when you share a blog post on social media or, on some themes, as the "hero" image. How can you quickly and easily find any posts which don't have a featured image? For this, I use WP CLI - it allows you to run complex WordPress actions and queries using the command line. After you have installed WP CLI you can get started. Missing Images On the command line, run: wp eval…

    0
  9. Book Review: The Names by Florence Knapp ★★⯪☆☆

    This has an excellent narrative structure, some beautiful prose, and I just didn't enjoy it. The story is Sliding Doors meets Same Time Next Year mixed with a distressing amount of domestic violence. A mother faces a difficult choice. Should she name her child after her abusive and violent husband? In one strand she does, in another she doesn't, and in the third she makes a compromise. We rejoin the story every few years to see how our protagonists are progressing. It mostly works and pushes us…

    0
  10. I've found just the right paper for my Bottom Hole problem

    A few weeks ago, I went on a mad quest to find the newspaper used in 1995's Bottom Hole TV show. During the episode, Eddie starts reading this newspaper: Obviously, the "Hammersmith Bugle" is not a real paper and they never ran a headline "No News Shocker". But judging from all the other shots, the prop is based on a real newspaper. So I decided to rip off Dirty Feed's shtick and find out what was used to create the fake newspaper. The quest took me o'er hill and dale. Through the rough…

    0
  11. RSS Feeds Send Me More Traffic Than Google

    Yeah yeah, I know, data-point of 1. I recently read Susam's blog post where they said that "most of the traffic to my personal website still comes from web feeds" - I wondered if that was true for my site. I've been writing this blog for a while. I've never much bothered with "aggressive" SEO - I have a fairly semantic layout, all my reviews have metadata, and stuff like that - but I'm not cramming in keywords, using AMP, or whatever other chickens Google requires to be sacrificed for a higher…

    22
  12. Vertically Aligning Roman Numerals in Code

    I have a PHP function which uses Roman Numerals. It looks like this: $romanNumerals = [ "Ⅿ" => 1000, "ⅭⅯ" => 900, "Ⅾ" => 500, "ⅭⅮ" => 400, "Ⅽ" => 100, "ⅩC" => 90, "Ⅼ" => 50, "ⅩⅬ" => 40, "Ⅹ" => 10, "Ⅸ" => 9, "Ⅷ" => 8, "Ⅶ" => 7, "Ⅵ" => 6, "Ⅴ" => 5, "Ⅳ" => 4, "Ⅲ" => 3, "Ⅱ" => 2, "Ⅰ" => 1 ]; The problem is, the operators don't line up and the whole thing looks messy. Why? Because the Unicode Roman Numerals are not monospaced! ⅭⅯ is a different width to ⅩC and Ⅷ is only a single character! Copy the…

    0
  13. NHS Goes To War Against Open Source

    The NHS is preparing to close nearly all of its Open Source repositories. Throughout my time working for the UK Government - in GDS, NHSX, i.AI, and others - I championed Open Source. I spoke to dozens of departments about it, wrote guidance still in use today, and briefed Ministers on why it was so important. That's why I'm beyond disappointed at recent moves from NHS England to backtrack on all the previous commitments they've made about the value of open source to the UK's health service.…

    16
  14. Let's Get Digging!

    As part of my quest to try new things I decided to dig for treasure in my local park. The wonderful folks at DigVentures allow members of the public to assist with archaeology projects in their local area. We arrived on a sunny Thursday to find a couple of areas of Lesnes Abbey cordoned off, with the turf taken up, and a set of tools waiting for us. After a suitable health-and-safety briefing and some instruction on the tools, we got cracking. I was slightly sceptical that we'd find anything…

    1
  15. Theatre Review: Hadestown ★★★★★

    Anaïs Mitchell has created something magical. I felt like giving a standing ovation after every song. Just pure theatrical joy delivered by a cast who know how to squeeze every drop of emotion from an audience. Perhaps it was sitting right at the front of the stalls, but the opening of Hadestown feels like dinner theatre; almost cosy in its intimacy. The first act is so busy - there are a hundred-and-one things happening on stage that it occasionally becomes overwhelming. The second act is…

    0
  16. You can parse an .env file as an .ini with PHP - but there's a catch

    The humble .env file is a useful and low-tech way of storing persistent environment variables. Drop the file on your server and let your PHP scripts consume it with glee. But consume it how? There are lots of excellent parsing libraries for PHP. But isn't there a simpler way? Yes! You can use PHP's parse_ini_file() function and it works. But… .env and .ini have subtly different behaviour which might cause you to swear at your computer. Let's take this example: # This is a comment…

    1
  17. Does Mythos mean you need to shut down your Open Source repositories?

    Much Sturm und Drang in the world of Open Source with the announcement that the "Mythos" AI is now the ultimate hacker and is poised to unleash havoc on every code base. So should you close all your Open Source projects to make them safe? No. Firstly, all your Open Source code has already been slurped up. It was all ingested for "training purposes" years ago. If it was moderately interesting then it was backed-up by a digital hoarder. It has been archived by various digital libraries. Anyone…

    1
  18. Sneaky spam in conversational replies to blog posts

    I'm grateful that my blog posts attract lots of engaged, funny, and challenging comments. But any popular post also attracts spammers. I use Antispam Bee to automatically eradicate a couple of hundred crappy comments per day. Nevertheless, some get through. Here's a particularly pernicious one - it appeared as three comments ostensibly in reply to each other. At first glance these look like normal comments. They each address the content of the blog post albeit somewhat superficially. The first…

    0
  19. Better TTS on Linux

    The venerable eSpeak is a mainstay of Linux distributions. It is a clever Text-To-Speech (TTS) program which will read aloud the written word using a phenomenally wide variety of languages and accents. The only problem is that it sounds robotic. It has the same vocal fidelity as a 1980s Speak 'n' Spell toy. Monotonous, clipped, and painful to listen to. For some people, this is a feature, not a bug. I have blind friends who are so used to eSpeak that they can crank it up to hundreds of words…

    4
  20. Book Review: Up - A scientist's guide to the magic above us by Dr Lucy Rogers ★★★★★

    My mate Dr Lucy Rogers has written a book! This is a charming and thought provoking exploration of everything that goes on above our heads. This isn't an impersonal and imperious manuscript, it's a deeply personal and joyful book filled with science, anecdotes, and the thrill of discovery. It's spectacularly accessible. Written in a relaxed and casual tone, it encourages domestic science. I don't mean bakery, I mean the sorts of observations you can do at home without access to a multi-million…

    3
  21. Reprojecting Dual Fisheye Videos to Equirectangular (LG 360)

    I still use my obsolete LG 360 Camera. When copying MP4 videos from its SD card, they come out in "Dual Fisheye" format - which looks like this: VLC and YouTube will only play "Equirectangular" videos in spherical mode. So, how to convert a dual fisheye to equirectangualr? The Simple Way ffmpeg \ -i original.mp4 \ -vf "v360=input=dfisheye:output=equirect:ih_fov=189:iv_fov=189" \ 360.mp4 However, this has some "quirks". The first part of the video filter is v360=input=dfisheye:output=equirect -…

    0
  22. Book Review: How To Kill A Witch - A Guide For The Patriarchy by Claire Mitchell and Zoe Venditozzi ★★★⯪☆

    After reading The Wicked of the Earth, I wanted to understand some of the history behind the stories. Why were women accused of being witches? What really happened in those trials? What are the modern consequences of those events? This is the story of the Scottish Witch Trials - with brief forays into England and abroad. It examines the central tension of whether witchcraft was real to the…

    0
  23. Why is it so hard to passively stalk my friends' locations?

    I feel terribly guilty when I visit a new city, post photos of my travels, only to have a friend say "Hey! Why didn't you let me know you were in my neck of the woods?" Similarly, if I bump into an old acquaintance at a conference, we both tend to say "If only I'd known you were here, we could have had dinner together last night!" I do enjoy the serendipity of events like FOSDEM - randomly…

    2
  24. Android now stops you sharing your location in photos

    My wife and I run OpenBenches. It's a niche little site which lets people share photos of memorial benches and their locations. Most modern phones embed a geolocation within the photo's metadata, so we use that information to put the photos on a map. Google's Android has now broken that. On the web, we used to use: <input type="file" accept="image/jpeg"> That opened the phone's photo picker…

    1
  25. Cheapest way to keep a UK mobile number using an eSIM

    I have an old mobile phone number that I'd like to keep. I think it is registered with a bunch of services for 2FA by SMS, but I can't be sure. So I want to keep it for a couple of years just in case I need it to log on to something. I don't want to faff around with physical SIMs, so I went looking for the cheapest way to keep my number for the longest time. There are a whole bunch of providers…

    1
  26. Book Review: Small Comfort by Ia Genberg ★★☆☆☆

    I was left somewhat unconvinced by this book. I liked the concept - a series of interrelated stories all told in different styles. Much like the film "Lola RenntRun Lola Run" there's a briefcase full of cash, a cast of morally ambiguous characters, and a meandering philosophical discussion about the nature of economic salvation. It slams together the naïve and the cynical into a bunch of …

    1
  27. Theatre Review: Avenue Q ★★★★★

    I'll admit, I was a little sceptical about returning to Avenue Q. I saw it on its original West End run back in… OH MY GOD I AM SO OLD! FUCK! Where did the time go? It's always hard to know how much to update a show. Does it need constant reinvention to stay in the zeitgeist or can it be pickled forever as a classic? "I wish I had taken more pictures" was something that utterly resonated with …

    1
  28. Did WordPress VIP leak my phone number?

    As discussed in my last blog post, the scumsuckers at Apollo.io have been giving out my personal details. Not only did they have my email address, they also had a copy of one of my phone numbers. I asked them where they got it from and they said: Your phone number came from Parsely, Inc (wpvip.com) one of our customers who participates in our customer contributor network by sharing their…

    1
  29. Someone at BrowserStack is Leaking Users' Email Address

    Like all good nerds, I generate a unique email address for every service I sign up to. This has several advantages - it allows me to see if a message is legitimately from a service, if a service is hacked the hackers can't go credential stuffing, and I instantly know who leaked my address. A few weeks ago I signed up for BrowserStack as I wanted to join their Open Source programme. I had a few…

    2
  30. Book Review: Superintelligence - Paths, Dangers, Strategies by Nick Bostrom ★★★★⯪

    When I finally invent time-travel, the first thing I'll do is go back in time and give everyone a copy of this book. Published in 2014, it clearly sets out the likely problems with true Artificial Intelligence (not the LLM crap we have now) and what measures need to be put in place before it is created. It opens with The Unfinished Fable of the Sparrows: Which, frankly, should be the end of …

    0