Terence Eden. He has a beard and is smiling.

Terence Eden’s Blog

Theme Switcher:

Should the WordPress scheduler use datetime-local?

· 9 comments · 600 words


The Logo for WordPress.

There's a brilliant post by WordPress about how they've optimised some of the backend code to make it more efficient. So here's a suggestion for something else which can be optimised. If you want to schedule a blog post to be published later, you have to use this WordPress control: I find it mildly annoying. I don't get why part of it is a dropdown. And the number fields don't pop up my…

Build your own "On This Day" page for WordPress

· 1 comment · 350 words


A graphic of a calendar showing the date "February 25 Sunday"

I blog. A lot. Too much really. One of the things I like to do is see what I was rambling on about this time last year. And the year before that. And so on. So, here's my On This Day page and here's how I built it. WARNING Extremely quick and dirty code ahead! This allows you to add a shortcode like [ edent_on_this_day ] to a page and have it auto generate a list of posts you published on this …

Rewriting OpenBenches in Symfony

· 2 comments · 350 words


The Open Benches logo.

I once described my ideal coding environment to a colleague as "telneting directly into prod and damn the consequences!" I jest. But only a little. When I build for myself I treat best practices and coding styles as harmful. Chaotic evil but, hey, it's only myself I'm hurting. Anyway, my wife and I run a hobby site - OpenBenches.org - which was coded in a long alcopop fueled weekend. It's fair…

Getting Auth0 user information on non-firewall Symfony pages

· 250 words


Logo of the Symfony project.

I am using Auth0's Symfony library to allow users to log in with their social network providers. It works really well. Using this firewall configuration, a user who visits /private is successfully taken through the login flow and I can then use $this->getUser() to see their details. security: password_hashers: Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface: …

Doctrine - difference between bindValue() and setParameter() on prepared statements

· 1 comment · 400 words · Viewed ~1,242 times


Doctrine project logo.

This pissed me off and I couldn't figure out what I was doing wrong. So I'm blogging about my ignorance. Imagine you're using Symfony and Doctrine to access a database. You are using prepared statements to prevent any SQL injection problems. There are two main ways of doing this - and they disagree about how positional variables should be specified. Data Retrieval And Manipulation Here's a…

Symfony - multiple paths to the same route within a controller

· 1 comment · 100 words · Viewed ~1,942 times


Logo of the Symfony project.

I couldn't work out how to use Route Aliasing within my controller. I couldn't find anything in the documentation about it. But, thanks to a StackOverflow comment it is possible. Suppose you want users to be able to access a page using /users/123 and /people/123 - with both routes displaying the same data? Normally you'd write something like #[Route('/user/{id}', name: 'show_user')] - as it…

Fixing a weird issue with Symfony's Cache

· 150 words


Logo of the Symfony project.

I'm just getting started with Symfony, so I'm blogging some of the weird things I'm finding. Symfony has a concept of Cache Contracts. You can call an expensive / slow / intensive operation and immediately cache the result for a specific time period. Next time you call the operation, the results are served from the cache until the expiry time has been hit. Nifty! But I couldn't get it to work. …

Doctrine - how to use LIKE with dbal prepared statements

· 1 comment · 150 words · Viewed ~418 times


Logo of the Symfony project.

I'm just getting started with Symfony, so I'm blogging some of the weird things I'm finding. I want to use Doctrine dbal to search a database for a partial match. For example searching for "smith" should find "blacksmith" and "smithy". I have a prepared statement like this: $queryBuilder = $conn->createQueryBuilder(); $queryBuilder ->select("whatever") ->from("table") ->where("name …

Help Wanted! Testing Better Markdown Footnotes

· 4 comments · 1,000 words · Viewed ~352 times


A very long footnote.

I've been thinking a lot about footnotes in Markdown. I've contributed a patch to make them slightly better in WordPress. Now I'm wondering how to make them more useful by enhancing their pop-up title text. To that end, I'm writing a patch for PHP Markdown which will display the first ~200 characters of a footnote in the pop-up title text. Hover over the superscript number and you'll get a…

Better sharing of WordPress posts to Mastodon

· 3 comments · 300 words · Viewed ~799 times


The Mastodon logo. It sort of looks like a smiling elephant.

WordPress's Jetpack plugin allows you to easily syndicate your blog to Twitter, LinkedIn, Tumblr, Email, and a few other services. But there's no native way to publish directly to your Mastodon feed. This is a guide to how I got my blog to publish every new post to Mastodon with a nicely formatted preview. This uses Jan's "Share on Mastodon" plugin which you'll need to install and configure. …

A quick (and silly) way to create generative avatars

· 2 comments · 700 words · Viewed ~316 times


I was asked to help create some pseudo-NFT style avatars for Cambridge Digital Humanities' Faust Shop project. Something with vaguely the same æsthetic as those daft "Crypto Punks". You can see it in action partway through this TikTok video. @cambridgeuniversity Visit the #Faust Shop and see what happens when you make a deal with your digital double. #Devil #EduTok #Cambridge #Performance …

Turning an eInk screen into a monochrome art gallery

· 7 comments · 1,350 words · Viewed ~6,839 times


Previously on Terence Eden's Blog: I turned an old eReader into an Information Screen. This time, I'm taking a different Nook, and turning it into a magic gallery. Here's what it looks like in action: Terence Eden is on Mastodon@edentUpcycled an old eReader into an art frame.Displays a new black & white piece of art from Flickr every few minutes.Full write-up this weekend, but pretty…