Toggen Technology Blog
This is a collection of posts starting in 2006. Focusing mainly on Linux, Open Source Software and technical tips collected over several decades in IT
ZPL SBPL
Zebra Printer Language http://labelary.com/viewer.html The above website has a page where you can enter ZPL and it will render a sample. Very handy for development Sato Barcode Printer Language QZ Tray is a really cool web service you install on Windows, Linux and...
PHP Iterators
Just came across a Youtube talk "Iterators in PHP" by Jake Smith published in 2014 that steps through the many different Iterators and some practical examples. I have reproduced many of the examples Jake used below, running them with PHP 8.1.5 and published the code...
PHP array_map Multiple Arrays
array_map can take multiple arrays. I like how it starts mapping through them starting at the first element of each array all together and then keeps mapping until it completes the largest array. Each argument to the callback function is the current element of the...
CakePHP 4 – Formatting Validation Errors for use with Flash Messages
I've posted about this before but I think this approach is entirely less complicated Validation errors in CakePHP come in an array similar to the following: $errors = [ 'asn_number' => [ '_empty' => 'ASN cannot be blank', ], 'their_po' => [ '_empty' => 'Their PO...
CakePHP 4 – Rendering an XML view to a variable
Rendering XML to a variable using CakePHP's XmlView class Learnings Instantiating and using ViewBuilderYou don't need ->set() if you pass the data to ->build()You can move XML creation into its own class to clean your controller action up and use it elsewhere in...
Build Complex LIKE Query with CakePHP Query Builder
How to create this MySQL query with CakePHP 4? SET @search = '9233' COLLATE utf8mb4_general_ci; SELECT * FROM 100pbc_new.addresses WHERE trading_partner LIKE CONCAT('%', @search, '%') OR dc_code LIKE CONCAT('%', @search, '%') OR dc_name LIKE CONCAT('%', @search, '%')...