MainelyDesign.com Blog

Showing articles 1 - 10 (147 total)

Fixing Warning: the ECDSA host key for 'github.com' differs from the key for the IP address

Posted on 09/10/2023 at 07:01 am | Viewed 1,610 times | 0 comments

Host Key Differs Warning from Github When you run git fetch and you get this warning: Warning: the ECDSA host key for 'github.com' differs from the key for the IP address '140.82.114.3' Offending key for IP in /username/.ssh/known_hosts:7 Matching host key in /username/.ssh/known_hosts:9 This is a pretty simple fix: ssh-keygen -R github.com...

CakePHP 3 - Getting List of Column Definitions from a Table (like schema())

Posted on 12/26/2018 at 02:48 pm | Viewed 9,652 times | 0 comments

You may come from a time when using $this->ModelName->schema() would give you the details of a table's column defintions.  Not in CakePHP 3.  I found this manual way of achieving the same thing: // insert into begin of the controller file use Cake\Datasource\ConnectionManager; $db = ConnectionManager::get('default'); // Create a schema...

Change Order of Loaded Behaviors in CakePHP 3

Posted on 09/14/2018 at 09:33 am | Viewed 5,308 times | 0 comments

Turns out it's really easy to change the order of how behaviors are loaded in CakePHP 3.  Wait, I'm actually sort of lying.  You can't change the order of loaded behaviors. (BOO!).  In previous versions of Cake this was a problem... however, with the fully implemented Events subsystem in Cake3, all you need to do is change the priority of the...

CakePHP 3 - Accept JSON Header Only Working When Debug False

Posted on 05/29/2018 at 09:20 am | Viewed 5,687 times | 0 comments

Strange thing... when you have debug disabled you may find that your application works fine when dealing with json routes without the extension.  Instead of accessing /posts.json, you would access /posts and send an Accept: application/json header and the same thing is achieved. Debug On - Json View Templates Don't Load - Same Accept Header I...

Remove All Events from Google Calendar (Reset Calendar)

Posted on 05/23/2018 at 09:29 pm | Viewed 19,925 times | 0 comments

I've been doing a lot of programming with the Google Calendar API lately and ran into an issue when I was ready to "go live" with the site.  The Google Calendar was loaded with tons of test data!  I searched around and found plenty of sites giving the same answer.  The problem with the answer- it was incomplete.  If you want to reset a calendar...

Google Tag Manager (GTM) Not Firing Default PageView Event

Posted on 11/08/2017 at 12:21 pm | Viewed 7,476 times | 0 comments

We had an interesting issue here today regarding Google Tag Manager not firing the default PageView event.  Instead it was firing the /gtm.js event.  WTF?! Turns out, the system we were using was reading event: 'gtm.js'  in the GTM container snippet as a link to a javascript resource.  So, it was turning the "url" into an absolute path, like...

In PHP, how do you get __toString() Magic Method Result without calling echo?

Posted on 10/13/2017 at 01:49 pm | Viewed 7,608 times | 0 comments

I knew this answer at one point, then forgot it.  So, here it is for memory's sake... How can you get __toString() Magic Method Output WITHOUT using echo statement? $echoed = strval($object->property); Cheers, - Kevin Wentworth

Getting output from shell_exec() at all times

Posted on 11/14/2016 at 12:18 pm | Viewed 7,488 times | 0 comments

Sometimes shell_exec() won't output anything.  This might be because of an error or a silent success.  If you want to see the output, you can always do this: $output = shell_exec('$HOME/aaa/command 2>&1'); echo "<pre>$output</pre>";

CORS Middleware in Cakephp 3

Posted on 10/11/2016 at 09:44 pm | Viewed 8,689 times | 0 comments

I didn't end up needing this (yet) but wanted to post here for future reference.  This is CorsMiddleware for CakePHP 3: // Plugin\src\Middleware\CorsMiddleware.php namespace Plugin\Middleware; class CorsMiddleware { public function __invoke($request, $response, $next) { // Calling $next() delegates control to the *next* middleware // In your...

View Layer - Getting count of Entities in View in Cakephp 3

Posted on 06/12/2016 at 01:27 pm | Viewed 6,452 times | 0 comments

In my views I'm usually executing code depending on if a variable is empty or not.  For example, I'll fetch all the images in a gallery and only want to output the containing divs when the gallery has images.  You can't do a simple !empty() or if($img) because it will always be "true" because it will be a non-empty object (like Cake\ORM\Query...

<< newer    1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9   

Meet Site Avenger - Hosted Content Management System

Powered By: Site Avenger | Site Production: Saco Design