Showing articles 1 - 10 (147 total)
Posted on 09/10/2023 at 07:01 am | Viewed 3,969 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...
Read More | Comments
Posted on 12/26/2018 at 02:48 pm | Viewed 11,562 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...
Read More | Comments
Posted on 09/14/2018 at 09:33 am | Viewed 6,236 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...
Read More | Comments
Posted on 05/29/2018 at 09:20 am | Viewed 6,656 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...
Read More | Comments
Posted on 05/23/2018 at 09:29 pm | Viewed 21,196 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...
Read More | Comments
Posted on 11/08/2017 at 12:21 pm | Viewed 8,427 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...
Read More | Comments
Posted on 10/13/2017 at 01:49 pm | Viewed 8,576 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
Read More | Comments
Posted on 11/14/2016 at 12:18 pm | Viewed 8,360 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>";
Read More | Comments
Posted on 10/11/2016 at 09:44 pm | Viewed 9,218 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...
Read More | Comments
Posted on 06/12/2016 at 01:27 pm | Viewed 7,039 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...
Read More | Comments