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?
Category: Development
Cheapest .se domains (January 2023)
Tip: you can start by registering your .se with one.com, as they often have heavily discounted prices for the first year (for example, I recently got my .se for ~€3). Use the first year to try your idea and if you still want the domain once the year is over, transfer it elsewhere. Just make… Continue reading Cheapest .se domains (January 2023)
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
Environment variable undefined in GatsbyJS?
If you’re trying to use an environment variable in your GatsbyJS HTML code and it keeps being undefined once you build, this could be because most environment variables are prevented from being rendered e.g. so that your private API key is not revealed by accident. If your variable does have to end up in the… Continue reading Environment variable undefined in GatsbyJS?
Git diff skip to next file?
If you need to do a git diff, but the first file it shows is a huge file, e.g. a Javascript library that got replaced, you can skip it in two steps: Type /^diff – to enter search mode with a slash and then search for diff – at the beginning of a line -… Continue reading Git diff skip to next file?
Changing git settings to clear the diff output
If you’d like to have the output of git diff, git diff –staged etc. cleaned up after showing, instead of cluttering the terminal window, change the pager config as follows: git config –global core.pager 'less -+X -+F' As a result, each call to the above commands will be listed in a separate "window", which does… Continue reading Changing git settings to clear the diff output
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