Structuring CakePHP models in subfolders

Say you want to organise your CakePHP models (tables) into subfolders. If you simply move the class into a subfolder, it won’t be picked up automatically. For example, here’s how you can tell the TableLocator to look for OrderStatuses in a specific subfolder Orders under Model/Table. In your controller: First, prepare the shorthand variables. $tableRegistry… Continue reading Structuring CakePHP models in subfolders

Do emojis in email subject cause complaints? Sometimes.

We’re sending out transactional e-mails. Order confirmations, delivery notifications, the boring stuff. And while these are supposed to be complaint-proof, we were still getting complaints regularly, and our AWS Historical Complaing Rate was climbing up. When it started approaching the warning levels, we sat down to think it all through and realised that it may… Continue reading Do emojis in email subject cause complaints? Sometimes.

Tar complaining about “You must specify one of the options”

If you’re trying to create a backup using tar but you’re getting this error tar: You must specify one of the ‘-Acdtrux’, ‘–delete’ or ‘–test-label’ options Try ‘tar –help’ or ‘tar –usage’ for more information. … check your options order. In my case, I was using –exclude. It turns out, if the paths you provide… Continue reading Tar complaining about “You must specify one of the options”

Setting up CakePHP CRUD plugin to use tables from another plugin

In the controller where you initialise Crud: $this->loadComponent(‘Crud.Crud’, [ // … ]); $this->Crud->useModel(sprintf( ‘%s.%s’, ‘MyPlugin’, $this->Crud->getController()->defaultTable )); Prevent linking to the plugin where your tables are: /** * Before render callback. * * @param \Cake\Event\Event $event The beforeRender event. * @return void */ public function beforeRender(\Cake\Event\EventInterface $event) { // prevent linking to the table plugin:… Continue reading Setting up CakePHP CRUD plugin to use tables from another plugin

Sending SES complaints and bounces to SQS via SNS

Debugging Amazon SQS not receiving SES bounce and complaint notifications? I hear you. Navigating and figuring out tons of seemingly identical documentation articles written in the wordiest way feels impossible. In short, I got it to work by following this basic scenario: setting up an SNS topic; selecting that topic in Feedback notifications for a… Continue reading Sending SES complaints and bounces to SQS via SNS

The pains of being an internationalised domain name

Checklist. Using Danish as an example. Make sure to clearly set the domain in UTF8 in the source code: <base href="https://æøå.example.com/"/> <link href="https://æøå.example.com/" rel="canonical"/> <link rel="alternate" href="https://æøå.example.com/" hreflang="da-DK"/> Explicitly set the language: <html lang="da-DK"> Provide the readable site name for the search engines and sharing snippets: <meta property="og:site_name" content="AE OE AA Example"/>

Take control of your cookies: clear them often, while keeping the convenience

Nearly every website wants to place a cookie on your computer. But some websites you return to often, and some other websites you visit once and forget about them. If you don’t take control of your cookies, you can easily end up with thousands of them taking gigs of your disk space. And then there’s… Continue reading Take control of your cookies: clear them often, while keeping the convenience

Untitled

As you get older, you stop using LEFT JOINs in your queries and eventually find yourself using RIGHT JOINs

Cleaning PDF metadata

If you want to remove PDF metadata, there doesn’t seem to be a good native tool neither on Mac, nor or Windows. ExifTool is being recommended fairly often, but if you run exiftool -all= "/tmp/example.pdf", you will get a warning: ExifTool PDF edits are reversible. Deleted tags may be recovered! There is a tool called… Continue reading Cleaning PDF metadata

Published
Categorised as Tools Tagged