MySQL Workbench Syncronize Model: Table Mapping not saving?

Problem Renamed tables in MySQL model Need to rename their counterparts on the live server The model does not recoginse the live tables because of different names The standard solution would be to click the mismatched entry, then go to Table Mapping and there choose the right mapping. However, in my case the new mapping… Continue reading MySQL Workbench Syncronize Model: Table Mapping not saving?

Where to put an event listener in a plugin?

You’re creating an event listener that inserts a database record every time the matching event fires. And you need the listener to be in a plugin. Which folder do you put it in? Here it says: A good place for this might be Plugin/src/Controller/Event And @admad on CakeSF Slack says it can also be Plugin/src/Event/.… Continue reading Where to put an event listener in a plugin?

Undefined index: verifyTokenSource, samesite

Undefined index: verifyTokenSource Undefined index: samesite I started getting this error in src/Http/Middleware/CsrfProtectionMiddleware.php after running composer update. To fix, run bin/cake cache clear_all

Non-destructive duplicate removal from a MySQL table

Create a new table CREATE TABLE records_new LIKE records; Add composite UNIQUE constraint preventing duplicates in the future ALTER TABLE records_new ADD UNIQUE idx_composite_UNIQUE (site_id ASC, session_id ASC, query ASC, remote_addr ASC); Copy records over. INSERT INTO records_new SELECT * FROM records ORDER BY id ON DUPLICATE KEY UPDATE records_new.created=NOW(); The above updates created to… Continue reading Non-destructive duplicate removal from a MySQL table

Finding AWS region closest to your server with a shell script

For something more sophisticated and less manual, use ekalinin/awsping. The below script will ping every region (or a subset of regions) and output the latency. Here’s the full list of AWS regions as of November 2022: Africa (Cape Town): af-south-1 Asia Pacific (Hong Kong): ap-east-1 Asia Pacific (Tokyo): ap-northeast-1 Asia Pacific (Seoul): ap-northeast-2 Asia Pacific… Continue reading Finding AWS region closest to your server with a shell script

Reword a commit message without changing the commit date

If you want to rebase-edit the commit message in an old commit, and keep the original commit date, you can do that using the –committer-date-is-author-date flag. Here’s how: Find your old commit that you want to edit and copy its hash Run git rebase -i hash^ Find your commit in the list that shows up… Continue reading Reword a commit message without changing the commit date