If you want to show decrypted secrets of your kubernetes (k8s) deployment with k9s try this:
First choose the namespace you want to check the secrets in by typing a colon and namespace
Continue reading “Show kubernetes secrets with k9s”…dev, tech problems and solutions.
If you want to show decrypted secrets of your kubernetes (k8s) deployment with k9s try this:
First choose the namespace you want to check the secrets in by typing a colon and namespace
Continue reading “Show kubernetes secrets with k9s”Are you annoyed of too many deprecation warnings in you logs of your symfony app?
Probably yes because it is really a lot of noise.
However deprecation logs are still useful to ensure future compatibility of your app.
So since version 5.1 symfony will log deprecations to a dedicated log channel when it exists and ships with this monolog config:
monolog:
channels:
- deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
Code language: PHP (php)
This is added already in the recipe and ships when installing symfony.
Ok, but the handler for this deprecation channel is not configured, so you have to do this yourself.
How? Add this to your monolog config:
There are multiple PHP native ways to convert umlaute and other special characters to ascii save formats, but most of them i experience insufficient in the one or other way.
Since i am using symfony anyway i can use the String component which has a handy slugger which converts any characters into safe ascii characters.
It is very flexible and can be customized with locales, custom replacements and closures.
$umlautString = "Müller Meier";
$slugger = new Symfony\Component\String\Slugger\AsciiSlugger('de');
$slugger->slug($umlautString, $seperator = ' ')->toString();
echo $umlautString; // mueller meier
Code language: PHP (php)
I guess this will become my go-to method resp. slugger to convert umlaute in any PHP application.
Continue reading “Converting umlaute with symfony String component”I released a new small Addon (or Module or Plugin) for SilverStripe CMS which adds a credits tab to the FileAdmin, so you can add f.e. the copyright holder of the image or any file.
Useful when you need to name credits, licence and source links for any asset used on your SilverStripe site.
https://github.com/ivoba/silverstripe-file-credits
https://packagist.org/packages/ivoba/silverstripe-file-credits
https://addons.silverstripe.org/add-ons/ivoba/silverstripe-file-credits
Since SilverStripe 4.10 is not yet fully ready for PHP8.1 you wil receive quite some deprecation warnings in dev mode when you are brave and run it nonetheless on PHP8.1.
Deprecated: SilverStripe\Config\Collections\MemoryConfigCollection implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary) in /var/www/html/vendor/silverstripe/config/src/Collections/MemoryConfigCollection.php on line 13
Unfortunatly we can’t control the error_reporting from SilverStripe since it is set in the kernel of the framework.
So we are forced to hack the Kernel which is rather unfortunate.
In the SilverStripe Slack channel someone proposed to use composer-patch which will apply a patch to a given vendor dependency during composer install.
This is quite cool because you don’t need to fork the dependency and take care of getting upstream changes.
So i went this path down and it looks like in this gist:
https://gist.github.com/ivoba/d8c4379236149a8c42e1922ae98a93e3
When testing deprecations with PHPUnit greater than 9.5.10 you might encounter this error:
Failed asserting that exception of type "PHPUnit\Framework\Error\Deprecated" is thrown.
The code in the test is as follows:
$this->expectDeprecation();
and the code that should be tested is like this:
\trigger_error('foo', \E_USER_DEPRECATED);
The psr/log package used to have not only the Interface for PSR-3 Logger, but also actual implementations of the interface like the TestLogger.
The TestLogger could be used as mock for any PSR-3 Logger in your test cases.
However from v3 the TestLogger was removed, so that the psr/log package would focus solely on the Interface.
If you used the TestLogger in your project and you or some of your dependencies upgraded psr/log to >= v3 you most likely saw this error:
Class "Psr\Log\Test\TestLogger" not found
So we have a CSV file with a member list and we want to filter all empty emails.
FirstName,LastName,Email Max,Mustermann,max@mustermann.de Maxi,Hasnoemail,
With nodejs streams this is almost a one liner.
We will use the csv package from the CSV project which has some sophisticated packages to parse and transform csv data with nodejs streams.
npm install csv
We will further use node as ESM (ECMAScript modules) to be shiningly modern and so lets create a file: index.mjs
Note the .mjs extension, which will tell node to interprete this as ESM. (Since nodejs v12.20.0 && v14.13.0)
We import the packages and create the filesystem streams to read the file, then built a pipeline with the streams and the single steps to process the data and write the results into a new file.
Ok let’s go:
I was about to integrate Github Actions to one of my pet projects but the tests failed with:
convert-im6.q16: unable to read font `helvetica' @ error/annotate.c/RenderFreetype/1338.
In the project i was using ImageMagick convert
command directly as sub process and obviously some fonts where missing.
Makes sense because i used convert to add text to an image.
When using bin/console make:entity
on Mysql and then later you switch your application to Postgres and you have a table called user
, which you most likely have when using security component of Symfony.
Then you will receive an error because user
is a reserved word in Postgres!
An exception occurred while executing 'INSERT INTO user (id, email, roles, password, is_verified) VALUES (?, ?, ?, ?, ?)' with params [3, "dev@dev.de", "[]", "your-encrypted-password", 0]:
SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "user"
LINE 1: INSERT INTO user (id, email, roles, password, is_verified) V...