Evert PotSwitching to Fedora from Ubuntu (30.3.2023, 16:00 UTC)

It seems like every 7-8 years I’m switching operating systems. In 2006 I first started using Apple, because it was just so damn cool to have a well working Unix-like system. (I’ll never forget you Snow Leopard).

In 2015 I switched to Ubuntu. Apple’s Software seemed to hit rock bottom at this point from a quality perspective, and hardware seemed to go obsolete at a rate I hadn’t seen before. Fed up paying a premium price for a sub-par product, it was time for a change.

Ubuntu's logo deterioated

Ubuntu’s fall

Ubuntu was the obvious choice. I want something that just works, and Dell’s XPS 13 Developer Edition ships with Ubuntu which means hardware support from Dell itself. Breath of fresh air and fast as hell. The experience was similar to what people have been saying about the new M1 chips. But it’s fast because of software, not hardware.

But something changed with Ubuntu in recent years. I think linux users have a thicker than usual skin when it comes to software issues and are willing to look past more things. But Ubuntu’s quality has been consistently falling. I was being worn down, and it seems to be a common sentiment in my bubble.

The best example is Ubuntu’s package manager Snap. A pretty good idea, I like the branding too but the execution hasn’t been there. Ubuntu users have been effectively beta-testing this for years. Just to give you an idea I made a giant list of bugs that I ran into when Ubuntu switched Firefox from apt to Snap.

To be honest I feel a bit bad ragging on Ubuntu, because without knowing anything about how the project and Canonical is run, my intuition is that the steam is just kind of running out for them. Ubuntu feels ‘depressed’, but maybe it’s all in my head.

Fedora logo

Installation

Installation was super smooth. I always forget to make a separate /home mount, so it took a while to move everything to an external disk and back.

The one thing I always forget to move is my MySQL databases, and today was no exception.

Non-free stuff

Fedora does not ship with things that aren’t open source. Nothing against that philosophy (awesome in fact), but personally I don’t mind adding some binaries for a better experience.

I miss Ubuntu’s Additional Drivers tool, because it told me what to install. I’m sure the drivers I need are available for Fedora, but I don’t know what to look for which makes me slightly worried my computer is not running optimally. Battery feels worse but that could also be my imagination.

Video in Firefox didn’t work at all in stock Fedora. I had to install ffmpeg to get it to barely function, but then I discovered RPM Fusion, where I got an even better ffmpeg, plus gstreamer and Intel drivers and I can now watch beautiful smooth 4K video, and confirmed with intel_gpu_top that I’m using hardware acceleration.

intel_gpu_top output

Gnome

Ubuntu used to have their own desktop environment called Unity. In 2018 they switched to Gnome, but they modified Gnome to keep their Unity look.

Ubuntu 22.10 look

This felt like a good move, because it let them kept their look while taking advantage of all the Gnome plumbing.

One drawback is that Ubuntu was usually a bit behind with Gnome features.

Fedora uses stock Gnome. As a result

Truncated by Planet PHP, read more at the original (another 2756 bytes)

Link
Evert Pot (30.3.2023, 04:29 UTC)

It seems like every 7-8 years I’m switching operating systems. In 2006 I first started using Apple, because it was just so damn cool to have a well working Unix-like system. (I’ll never forget you Snow Leopard).

In 2015 I switched to Ubuntu. Apple’s Software seemed to hit rock bottom at this point from a quality perspective, and hardware seemed to go obsolete at a rate I hadn’t seen before. Fed up paying a premium price for a sub-par product, it was time for a change.

Ubuntu's logo deterioated

Ubuntu’s fall

Ubuntu was the obvious choice. I want something that just works, and Dell’s XPS 13 Developer Edition ships with Ubuntu which means hardware support from Dell itself. Breath of fresh air and fast as hell. The experience was similar to what people have been saying about the new M1 chips. Fast as hell. But it’s fast because of software, not hardware.

But something changed with Ubuntu in recent years. I think linux users have a thicker than usual skin when it comes to software issues and are willing to look past more things. But Ubuntu’s quality has been consistently falling, and I was being worn down, and I’m not alone.

The best example is Ubuntu’s package manager Snap. A pretty good idea, I like the branding too but the execution hasn’t been there. Ubuntu users have been effectively beta-testing this for years. Just to give you an idea I made a giant list of bugs that I ran into when Ubuntu switched Firefox from apt to Snap.

To be honest I feel a bit bad ragging on Ubuntu, because without knowning anything about how the project and Canconical is run, my intuition is that the steam is just kind of running out for them. Ubuntu feels ‘depressed’, but maybe it’s all in my head.

Fedora logo

Installation

Installation was super smooth. I always forget to make a separate /home mount, so it took a while to move everything to an external disk and back.

The one thing I always forget to move is my MySQL databases, and today was no exception.

Non-free stuff

Fedora does not ship with things that aren’t open source. Nothing against that philosphy (awesome in fact), but personally I don’t mind adding some binaries for a better experience.

I miss Ubuntu’s Additional Drivers tool, because it told me what to install. I’m sure the drivers I need are available for Fedora, but I don’t know what to look for which makes me slightly worried my computer is not running optimally. Battery feels worse but that could also be my imagination.

Video in Firefox didn’t work at all in stock firefox. I had to install ffmpeg to get it to barely function, but then I discovered RPM Fusion, where I got an even better ffmpeg, plus gstreamer and Intel drivers and I can now watch beautiful smooth 4K video, and confirmed with intel_gpu_top that I’m using hardware acceleration.

intel_gpu_top output

Gnome

Ubuntu used to have their own desktop environment called Unity. In 2018 they switched to Gnome, but they modified Gnome to keep their Unity look.

Ubuntu 22.10 look

This felt like a good move, because it let them kept their look while taking advantage of all the Gnome plumbing.

One drawback is that Ubuntu was usually a bit behind with Gnome featur

Truncated by Planet PHP, read more at the original (another 2813 bytes)

Link
Evert PotSupporting CommonJS and ESM with Typescript and Node (21.3.2023, 17:11 UTC)

I maintain a few dozen Javascript libraries, and recently updated many of them to support CommonJS and Ecmascript modules at the same time.

The first half of this article describes why and how I did it, and then all the hoops I had to jump through to make things work.

Hopefully it’s a helpful document for the next challenger.

A quick refresher, CommonJS code typically looks like this:

const MyApp = require('./my-app');
module.exports = {foo: 5};

And ESM like this:

import MyApp from './my-app.js';
export default {foo: 5};

Except if you use Typescript! Most Typescript uses ESM syntax, but actually builds to CommonJS. So if your Typescript code looks like the second and think ‘I’m good’, make sure you also take a look at the built Javascript code to see what you actually use.

Why support ESM

The general vibe is that ESM is going to be the future of Javascript code. Even though I don’t think the developer experience is quite there yet, but more people will start trying ESM.

If you decided to plunge in with ESM, I want my libraries to feel first-class.

For example, I’d want you to be able to default-import:

import Controller from '@curveball/controller';

At the same time most people are still on CommonJS, and I want to continue to support this without breaking backwards compatibility for the forseeable future.

The general approach

My goal is for my packages to ‘default’ to ESM. From the perspective of a library maintainer you will be dealing with ESM.

During the build phase steps are being made to generate a secondary CommonJS build. As a maintainer you might run into CommonJS-specific issues, but I suspect people will only see those if the CI system reports an issue.

Our published NPM packages will have a directory structure roughly like this:

- package.json
- tsconfig.json

- src/     # Typescript source
- cjs/     # CommonJS
- esm/     # ESM
- test/

We include the original typescript sources to make step-through debugging work well, and have a seperate directory for the ESM and CommonJS builds.

If you just want to skip to the end and see an example of a package that has all this work done, check out my @curveball/core package:

Typescript features we don’t use

esModuleInterop

We don’t use the esModuleInterop setting in tsconfig.json. This flag lets you default-import non-ESM packages like this:

import path from 'node:path';

instead of the more awkward:


       

Truncated by Planet PHP, read more at the original (another 29675 bytes)

Link
Christian WeiskeImagickException: unable to open file '/tmp/magick-...' (27.2.2023, 20:52 UTC)

I'm moving to a new server, and my avatar image generation script did not work anymore:

$ php surrogator.php
processing mm.svg
PHP Fatal error:  Uncaught ImagickException:
  unable to open file `/tmp/magick-bcfNKPgxfBoOcZ5_de_xB9LzxZLhN2Dq':
  No such file or directory @ error/constitute.c/ReadImage/614
  in /home/cweiske/www/avatar.cweiske.de/surrogator.php:236
Stack trace:
#0 /home/cweiske/www/avatar.cweiske.de/surrogator.php(236): Imagick->readImage()
#1 /home/cweiske/www/avatar.cweiske.de/surrogator.php(155): surrogator\createSquare()
#2 {main}
  thrown in /home/cweiske/www/avatar.cweiske.de/surrogator.php on line 236

The mm.svg file clearly exists, and my user is able to create files in /tmp/ - which I tested with touch /tmp/foo.

Using strace helped me to find the issue:

$ strace php surrogator.php
[...]
lstat("/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.11/modules-Q16/coders/svg.la", 0x7ffd264c61c0) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
stat("/usr/lib/x86_64-linux-gnu/ImageMagick-6.9.11//modules-Q16/coders/svg.la", 0x7ffd264c61f0) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
stat("/tmp/magick-Uoh--TjgMhCveOq8LHbHQyVLXA87cpvx", 0x7ffd264ca2b0) = -1 ENOENT (Datei oder Verzeichnis nicht gefunden)
stat("/home/cweiske/www/avatar.cweiske.de/raw/mm.svg", {st_mode=S_IFREG|0644, st_size=3013, ...}) = 0
write(2, "PHP Fatal error:  Uncaught Imagi"..., 497PHP Fatal error:  Uncaught ImagickException: unable to open file `/tmp/magick-Uoh--TjgMhCveOq8LHbHQyVLXA87cpvx': No such file or directory @ error/constitute.c/ReadImage/614 in /home/cweiske/www/avatar.cweiske.de/surrogator.php:236
[...]

PHP's Imagick extension wants to load the svg.la module that is responsible for loading .svg images, and that fails.

It turned out that I had to install the imagemagick package - php-imagick alone was not enough.

Link
Larry GarfieldUsing PSR-3 placeholders properly (26.2.2023, 16:26 UTC)

Using PSR-3 placeholders properly

Submitted by Larry on 26 February 2023 - 10:26am

In the last 2 years or so, I've run into a number of projects that claim to use the PSR-3 logging standard as published by the PHP Framework Interoperability Group (PHP-FIG, or just FIG). Unfortunately, it's quite clear that those responsible for the project have not understood PSR-3 and how it is intended to work. This frustrates me greatly, as PSR-3's design addresses a number of issues that these projects are not benefiting from, and it reduces interoperability between projects (which was the whole point in the first place).

Rather than just rant angrily online (fun as it is, it doesn't actually accomplish anything), many of my PHP community colleagues encouraged me to blog about using PSR-3 properly. So, here we are.

Link
Rob AllenPHPUK 2023 (21.2.2023, 11:00 UTC)

I have just returned from the 2023 edition of PHPUK and, as always, found it a valuable conference to catch up with the PHP community and find out what’s happening in the ecosystem.

This year, I was accepted to speak on the differences between RPC, REST and GraphQL APIs and was surprised and gratified that the room was at full capacity. Thank you to everyone that attended; I hope that you learnt something useful. I think that good APIs matter and am fairly pragmatic about implementations. In general, I would far rather that you wrote a really good RPC API than a bad GraphQL one for example.

The developer experience of an API matters, which is why it’s important that your API follows best practices for the architecture that you choose. For instance, follow the Relay pagination specification if you are writing a GraphQL API, or follow HTTP semantics and use status codes properly if you are writing a RESTful API. This stuff is key as developer word-of-mouth about how good your API is to use is valuable marketing.

The conference had many good talks. For instance Ian’s talk on PHP on Lambda provided valuable information and Pauline reprised her excellent talk on Git to fill the slot after a speaker pulled out. Pauline also spoke about the decentralised web, a talk I recommend that you seek out when the videos are published. All in all, the standard of talks was very high and I heard a good buzz about lots of them.

In our world of remote work, in an industry where interruptions are disruptive to the flow state that we get into when working, I can’t emphasise enough how useful the connections we make at in-person conferences can be. It’s a fantastic way to connect and talk about issues directly relevant to your work life and get other people’s thoughts with more context than is usually possible in other mediums.

The people I have met at conferences have materially affected my career for the better and I encourage everyone to try to attend a conference that’s relevant for their work at least per year.

Link
Evert PotWinding down Bad Gateway (20.2.2023, 19:18 UTC)

In 2019 I started Bad Gateway as a software development agency. Last year we grew all the way to 7 people. It was crazy challenging, especially with Covid in the mix; but ultimately could not get the company into a good financial state to be able to carry on.

Big thanks to my co-workers and partners Ju, Becky, Phil, Michael, Siep, Richard and Syed. I’m incredibly grateful you came on this journey with me. We shared some tears, exchanged some words but mostly had lots of laughs. Despite the challenges I feel my relationship with you has only strengthened and I wish you well in the next steps of your career.

Also thank you to our customers and especially Underknown who’ve stuck with us since the start.

Despite this outcome, I have a hard time seeing the last few years as a failure. It’s been hella fun, and I feel we stuck to our values even in times of crisis. Off to the next adventure.

Image of person standing in front of a gateway.

Link
Evert PotBuilding a simple CLI tool with modern Node.js (13.2.2023, 19:05 UTC)

I’m a maintainer of several dozen open source libraries. One thing I’ve always done is maintain a hand-written changelog.

Here’s an example from a12n-server

0.22.0 (2022-09-27)
-------------------

Warning note for upgraders. This release has a database migration on the
`oauth2_tokens` table. For most users this is the largest table, some
downtime may be expected while the server runs its migrations.

* #425: Using a `client_secret` is now supported with `authorization_code`,
  and it's read from either the request body or HTTP Basic Authorization
  header.
* The service now keeps track when issuing access tokens, whether those tokens
  have used a `client_secret` or not, which `grant_type` was used to issue them
  and what scopes were requested. This work is done to better support OAuth2
  scopes in the future, and eventually OpenID Connect.
* Fixed broken 'principal uri' in introspection endpoint response.
* OAuth2 service is almost entirely rewritten.
* The number of tokens issued is now displayed on the home page.
* Large numbers are now abbreviated with `K` and `M`.
* #426: Updated to Curveball 0.20.
* #427: Typescript types for the database schema are now auto-generated with
  `mysql-types-generator`.

These are all written in Markdown. You might think: isn’t Git also a log? Why bother hand-writing these?

The reason is that the audience for these is a bit different. I want to bring attention to the things that are the most important for the end-user, and focus on the impact of the change to the user.

I thought it would be handy to write a CLI tool that makes it a bit easier to maintain these. So, I did!. If you are curious what kind of technology choices went into this, read on.

Goals and features

The tool should be able to do the following:

  • Reformat changelogs (a bit like prettify) (changelog format)
  • Add an entry via the command line (changelog add --minor -m "New feature").
  • Automatically set the release date (changelog release)
  • Pipe a log of a specific version to STDOUT, so it can be used by other tools (like integrating with github releases).

I also had a bunch of a non-functional requirements:

  • Use the latest Node features.
  • Use up to date Javascript standards and features (ESM).
  • Avoid dependendencies unless it’s unreasonable to do so.
  • Make it low maintanance.

Want to find the finished tool right now? It’s open source so just go to Github.

The implementation

ESM & Typescript

Ecmascripts modules worked really well here. It’s a small change of habits, but the general recommendation I would have is to just save your files as .mjs and start using it.

Here’s the first few lines of parse.mjs:

// @ts-check
import { Changelog, VersionLog } from "./changelog.mjs";
import { readFile } from 'node:fs/promises';

/**
 * @param {string} filename
 * @returns {Promise<Changelog>}
 */
export async function parseFile(

Truncated by Planet PHP, read more at the original (another 27805 bytes)

Link
Derick RethansXdebug Update: January 2023 (7.2.2023, 09:52 UTC)

Xdebug Update: January 2023

In this monthly update I explain what happened with Xdebug development in this past month. These are normally published on the first Tuesday on or after the 5th of each month.

Patreon and GitHub supporters will get it earlier, around the first of each month.

You can become a patron or support me through GitHub Sponsors. I am currently 41% (4% less than last month) towards my $2,500 per month goal. If you are leading a team or company, then it is also possible to support Xdebug through a subscription.

In the last month, I spend 18 hours on Xdebug, with 26 hours funded. Sponsorships, especially through Patreon, are continuing to decline, which makes it harder for me to dedicate time for maintenance and development.

Xdebug 3.2

I have continued to triage new bug reports in Xdebug 3.2, and most notably trying to find the bug that people reported with regards to the xdebug.mode setting not sticking, or being wrong. So far I have not managed to reproduce this in a reliable environment. If you run into this bug, please get in contact so that I can figure out what the cause is, by being able to reproduce this.

During a support call with one of my supporters, we discussed an issue that prevented correct breakpoints from being set through the PHP Debug Adapter for Visual Studio Code for virtual file systems, such as with the SSH FS plug-in. The debug adaptor did not know how to use a path mapping with this specific schema to work. There is now a new release (1.13.0) of the plug-in (https://marketplace.visualstudio.com/items/xdebug.php-debug/changelog) to make the following work:

"pathMappings": {
    "/home/derick/dev": "ssh://singlemalt/home/derick/dev"
},

Which maps the server path /home/derick/dev/ to the virtual file path ssh:://singlemalt/home/derick/dev, which I have added to my workspace.

Xdebug Cloud

Xdebug Cloud is the Proxy As A Service platform to allow for debugging in more scenarios, where it is hard, or impossible, to have Xdebug make a connection to the IDE. It is continuing to operate as Beta release.

Packages start at £49/month, and I have recently introduced a package for larger companies. This has a larger initial set of tokens, and discounted extra tokens.

If you want to be kept up to date with Xdebug Cloud, please sign up to the mailinglist, which I will use to send out an update not more than once a month.

Xdebug Videos

I have published no new videos this month.

I have continued writing scripts for videos about Xdebug 3.2's features, and am also intending to make a video about "Running Xdebug in Production", the updated "xdebug.client_discovery_header" feature (from Xdebug 3.1), and the new SSH FS path mapping functionality in the PHP Debug Adaptor for VS Code.

You can find all previous videos on my YouTube channel.

Business Supporter Scheme and Funding

In January, no new business supporters signed up.

If you, or your company, would also like to support Xdebug, head over to the support page!

Besides business support, I also maintain a Patreon page, a profile on GitHub sponsors, as well as an OpenCollective organisation.

Become a Patron!
Link
Larry GarfieldMastobot: For your Fediverse PHP posting needs (24.1.2023, 04:13 UTC)

Mastobot: For your Fediverse PHP posting needs

Submitted by Larry on 23 January 2023 - 10:13pm

Like much of the world I've been working to migrate off of Twitter to Mastodon and the rest of the Fediverse. Along with a new network is the need for new automation tools, and I've taken this opportunity to scratch my own itch and finally build an auto-posting bot for my own needs. And it is, of course, available as Free Software.

Announcing Mastobot! Your PHP-based Mastodon auto-poster.

Continue reading this post on PeakD.

Link
LinksRSS 0.92   RDF 1.
Atom Feed   100% Popoon
PHP5 powered   PEAR
ButtonsPlanet PHP   Planet PHP
Planet PHP