Welcome to My Blog
IT related tech tips since 2006CakePHP 3 Changes To Date/Time Formatting
The new date objects have different formatting strings http://www.icu-project.org/apiref/icu4c/classSimpleDateFormat.html#details $this->Time->format($assigned_part->start_time, 'h:mm') $this->Time->format($mtg->date, 'eeee MMMM d') The old ones here...
I have no idea what the problem is PHP CLI
Trying to do some PHP tutorials using vim and running php from the command line and I get.... nothing back. If it's a syntax error (e.g. a missing line ending ; ) then no reply at all. If the syntax is correct and it's something else then the error isn't displayed...
CakePHP POST Failing
I was just trying to submit about 10 x 15 records... and found that cakephp was failing with a validation error. Found out it was due to the following in the php error log. [09-Jun-2016 19:16:22 Australia/Melbourne] PHP Warning: Unknown: Input variables exceeded...
Adding new fonts to TCPDF
Less agony way of doing it. Download your fonts and then run the following cd /Users/jmcd/Sites/clam/vendor/tecnickcom/tcpdf tools/tcpdf_addfont.php -i /Users/jmcd/Downloads/liberation-sans/LiberationSans-BoldItalic.ttf cd fonts/ Bulk Load Multiple TTF's for i in ls...
CakePHP – Call to a member function format() on array!
// failing validator rule $validator ->date('date') ->add('date', 'unique', [ 'rule' => 'validateUnique', 'provider' => 'table', 'message' => "One of the dates you submitted already exists!" ]); // working buildRules public function buildRules(...){...
CakePHP “public $paginate =” overwritten by action “$this->paginate =” Gotcha
If you have a the following code class PartsController extends AppController { /** * Index method * * @return \Cake\Network\Response|null */ public function index() { $this->paginate = [ 'contain' => ['Sections'] ]; $parts = $this->paginate($this->Parts);...
CakePHP 3 – TCPDF Install and Usage
In your CakePHP top level folder (the one that has composer.json, src/, vendors/, config/, webroot/) run: composer require tecnickcom/tcpdf You should now have vendor/tecnickcom/tcpdf Now in a controller src/Controller/<ControllerName>Controller.php create an...
CakePHP 3 – Escape to the Global Namespace
This code in CakePHP 3: <?php $date = '31/01/1973'; $ymd = DateTime::createFromFormat('!d/m/Y', $date)->format('Y-m-d'); Causes this error Error: Class 'App\Controller\DateTime' not found This code fixes it: <?php $date = '31/01/1973'; $ymd =...
Checking for port errors on Cisco Switches
Recently had a macbook pro which had a network dongle that was very hot and the network connection stopped working. Found that the dongle was sending garbled signal down the wire and the Cisco switch shutdown the port. # all status show interfaces status # port...