A motto for programming

Yesterday, while walking down the street, I saw some words written in Latin on a terrace: “Primum non nocere”. I looked them up on Google and found that they mean “First, do no harm”. It’s a motto for health-related professions that emphasizes their main objective: the well-being of the patient and avoiding any harm.

I liked the idea, and after doing some research, I found that there’s nothing similar for programmers. So I started thinking and came up with a possible motto for our profession: “Tuere usorem, data, veritatem”.

Tuere: protect
usorem: the user
data: the data
veritatem: the truth

The user: as programmers, our main objective should be the user, making their experience as pleasant as possible and ensuring our program makes their life easier or more comfortable. In the case of open-source code, it can also help them learn.

The data: after the user, data is the most important thing because it’s almost always irreplaceable. It’s our responsibility to do everything possible to keep it safe and accessible.

The truth: today’s technology can be used to falsify information and spread lies, and the pace of change only makes this worse. As creators of much of this technology, we have a moral commitment to the truth.

What do you think? Does it make sense? Is there already a similar slogan that I haven’t found? I’d love to hear your thoughts!

PS: I don’t know any Latin, ChatGPT did the translation for me, so there may be some mistakes.

Algo a probar cuando PHPmailer no funciona

Intentando configurar el envío de correos mediante PHPmailer la conexión se establecía pero no hacía nada más, fallando un tiempo después.

Al cambiar el tipo de seguridad de tls por ssl ha funcionado perfectamente.

No tengo ni idea de por qué, supongo que debe ser algo propio de cada servidor de correo, pero si alguna vez te encuentras con un error y ya has verificado que todos los datos de puertos, contraseñas, etc. están bien prueba, a ver si te lo resuelve.

Solucionar error “the input device is not a TTY” al ejecutar comandos desde PHP

Al ejecutar desde PHP un comando que requiere una terminal nos encontraremos este error. Una forma de solucionarlo (¡gracias ChatGPT!) es utilizar el comando script:

script -q -c 'comando_a_ejecutar' /dev/null

-q es el modo silencioso y para evitar que se redirija la salida a un fichero usamos el /dev/null final.

Error en orden de carga de extensiones al usar OpenSwoole en PHP

Si al instalar la extensión de PECL OpenSwoole nos aparece este error:

PHP Warning: PHP Startup: Unable to load dynamic library 'openswoole.so' (tried: /usr/lib/php/20230831/openswoole.so (/usr/lib/php/20230831/openswoole.so: undefined symbol: socket_ce)) in Unknown on line 0

es porque hemos añadido la línea extension=openswoole.so en el fichero php.ini, y esto hace que intente cargar la extensión de OpenSwoole antes de tener cargadas otras de las que depende (como sockets o curl, dependiendo de las opciones que hayamos indicado al instalar OpenSwoole).

La solución es quitar esa línea del fichero php.ini, y llevárnosla como un fichero a la carpeta conf.d, por ejemplo /etc/php/8.3/cli/conf.d/30-openswoole.ini.

Aquí la clave es que ese número inicial (30 en este ejemplo) sea superior al que tienen los ficheros que cargan las extensiones necesarias (en mi caso eran 20-curl.ini y 20-sockets.ini).

Axios: Quitar cabecera “Content-Type” en subidas multipart a S3

Cuando tenemos que subir ficheros grandes a S3 en varias partes las peticiones PUT no deben llevar la cabecera “Content-Type”, pero Axios la pone por defecto y esto genera un error 403.

Para que Axios no añada esta cabecera hay que indicarlo expresamente usando el valor false:

headers: { "Content-Type": false }