All posts by ephestione

lighttpd cannot install because of libssl1.1, how to fix

My situation happened on a Raspberry with Raspbian Stretch installed, I had added PHP7.0 repository from sury.org quite a while back and when by chance today I went to open PiHole admin page from my laptop it simply wouldn’t load.

Google what’s up, I found out lighttpd was maybe the culprit, look around and noticed it wasn’t installed, and couldn’t be installed with the error:

lighttpd : Depends: libssl1.1 (>= 1.1.0) but it is not going to be installed

I then discovered that said libssl1.1 library off sury.org, coming together with the PHP distro, broke lighttpd.

I removed the repository source from /etc/apt/sources.list.d/php.list (your filename may vary) and issued a sudo apt-get update followed by a dist-upgrade but that didn’t solve anything.

I couldn’t find for the life of me a way to simply exchange the libssl1.1 package (which was kept from the sury.org repository even after removing its source) to the original repository version, and

sudo apt-get remove libsll1.1

wanted me to remove also ALL the packages that depended on this library. And they were a LOT.

Like hell I wanted to do that!

Or not?

Well I tried

sudo apt-get install --reinstall libssl1.1

hoping it would get rid of the messy libssl1.1 exchanging it with the official repository one, but that also gave an error:

Reinstallation of libssl1.1 is not possible, it cannot be downloaded.

Sooooo I was getting out of options and very annoyed.

I thought, why not letting the frigging apt remove all those packages? I can always install them later on… I hope…

EDIT: benosco down in the comments offered an easier solution, you might want to check it before going the hardcore way like I did.

So I copied the list of the packages that were to be removed off putty window and into notepad++, crossed my fingers and let apt remove everything.

After that was done during an extremely long and suffered delay, I had to do

sudo apt-get install <paste big-ass list of packages here>

In my case, it didn’t work out that simply at the first try, I got some CRC mismatch somewhere so they were not installed all together.

But I issued the command with less packages listed, beginning with apache2 php7.0 mysql-server transmission-cli samba python somethingIcannotreallyrecallnow, and then reissued the first command with all the list again to fill in the blanks.

It installed everything piece by piece, and lighttpd with it as well.

Since apt-get actually removes those packages without purging them (unless you ask it to purge libssl1.1 which isn’t a good idea) their settings are kept and reinstalling the packages will restore the system to the previous state.

At least it did for me, since the system came back to normal after a reboot.

Cura bug sets nozzle temperature to 0 instead of leaving control to printer

Straight to the chase: if you set the nozzle temperature to zero degrees in Cura, and the printer instead of immediately starting the print at the temperature YOU set on it, it sets the nozzle temperature to 0, then there is a workaround which is not straightforward at all.

As per this forum post:

  • Inside Cura, open Help menu and click on Show configuration folder
  • close Cura
  • open subfolder “definition_changes” inside the configuration folder explorer window that just popped up
  • open your printer’s *_settings.inst.cfg in notepad
  • identify [values] section and add
    machine_nozzle_temp_enabled = False
  • start Cura after having saved the modified file

Thank you Ultimaker for making this very intuitive for your users.

But seriously, thank you for the nice free software.

Lettura della fattura elettronica XML con PHP

Visualizzare e formattare in HTML una fattura elettronica con del codice PHP concettualmente è semplice, ma scrivere un apposito programma che fa un parsing del codice XML, e quindi disegnare un layout HTML in cui inserire i dati ottenuti, è uno spreco di tempo, se lo si fa solo per “guardare” la fattura senza doverla ulteriormente processare in modo automatizzato.

Per questo ringraziamo AssoSoftware che fornisce liberamente il suo foglio di stile XSL (in realtà ne esiste anche uno ufficiale rilasciato da Sogei, ma… vabè non devo aggiungere niente su Sogei e quindi se volete provatelo, e mi saprete dire nei commenti quale vi piace di più), il quale applicato all’XML originale seguendo questa guida restituisce una gradevole formattazione tabellare completa di annotazioni.

D’accordo lo ammetto questo articolo dai risultati di ricerca sembra essere fuorviante, perché io stesso cercando una routine che leggesse l’XML per restituire delle variabili in PHP, ho trovato il mio articolo pensando “vuoi vedere che l’ho già scritta io questa routine e me ne sono dimenticato?” ed invece no… quindi non essendoci altre risorse realmente utilizzabili per il PHP, credo proprio che ora mi ci metterò io a scrivere la routine…

Ho rimediato e l’ho appena scritta.

Questo è uno snippet del mio reale codice, per chi bazzica di PHP è comprensibile. E’ incompleto siccome mi serviva solo a recepire i dati che vanno inseriti nel registro acquisti, ma la logica dietro è abbastanza chiara per poterlo estendere a vostro piacimento.

$xml = simplexml_load_string($source);

$supplier = $xml->FatturaElettronicaHeader->CedentePrestatore->DatiAnagrafici->Anagrafica->Denominazione;
if (!$supplier) {
	$supplier = $xml->FatturaElettronicaHeader->CedentePrestatore->DatiAnagrafici->Anagrafica->Nome . " " . $xml->FatturaElettronicaHeader->CedentePrestatore->DatiAnagrafici->Anagrafica->Cognome;
}
$supplierpiva = $xml->FatturaElettronicaHeader->CedentePrestatore->DatiAnagrafici->IdFiscaleIVA->IdCodice;
$suppliervia = $xml->FatturaElettronicaHeader->CedentePrestatore->Sede->Indirizzo;
$suppliercivico = $xml->FatturaElettronicaHeader->CedentePrestatore->Sede->NumeroCivico;
$suppliercap = $xml->FatturaElettronicaHeader->CedentePrestatore->Sede->CAP;
$suppliercomune = $xml->FatturaElettronicaHeader->CedentePrestatore->Sede->Comune;
$supplierprovincia = $xml->FatturaElettronicaHeader->CedentePrestatore->Sede->Provincia;

$invoicedate = $xml->FatturaElettronicaBody->DatiGenerali->DatiGeneraliDocumento->Data;
$invoiceno = $xml->FatturaElettronicaBody->DatiGenerali->DatiGeneraliDocumento->Numero;
$invoicewhat = $xml->FatturaElettronicaBody->DatiGenerali->DatiGeneraliDocumento->Causale[0];
if (!$invoicewhat) $invoicewhat=$xml->FatturaElettronicaBody->DatiBeniServizi->DettaglioLinee[0]->Descrizione;


foreach ($xml->FatturaElettronicaBody->DatiBeniServizi->DatiRiepilogo as $riepilogo) {
	switch ($riepilogo->AliquotaIVA) {
		case "22.00":
			$imponibileord = $riepilogo->ImponibileImporto;
			$impostaord = $riepilogo->Imposta;
			break;
		case "10.00":
			$imponibilerid = $riepilogo->ImponibileImporto;
			$impostarid = $riepilogo->Imposta;
			break;
		case "4.00":
			$imponibilemin = $riepilogo->ImponibileImporto;
			$impostamin = $riepilogo->Imposta;
			break;
		case "0.00":
			$esente = $riepilogo->ImponibileImporto;
			break;
	}
}

Hide disable exclude specific mail account in thunderbird global inbox

I use Thunderbird’s unified inbox as it is a very convenient way to manage multiple accounts. Yet there was a management account where the inbox was a huge pile of messages that needed to stay there but that I didn’t want to show in there unless I specifically clicked on that account.

No other guide on the first page of google results gave info on it, but here’s how you do it.

Right-click on the Inbox master node under which all the accounts’ inboxes are listed, then click on Properties, then Choose the selected folders to search, and un-check the Inbox of the account you want to hide. Then click on Update.

There you go.

Cannot downgrade Xiaomi Router 3 firmware to development version

I bought a Mi Router 3 for the express purpose of installing Padavan firmware on it, but lo and behold, I could not for the life of me install the BIN file for the 2.11.20 development version of the firmware (see here and here) as, when choosing the BIN file from the browse file dialog of the router web interface, the popup just went numb, no action, no buttons, no upload activity. Tried many times it with Firefox Chrome and even Internet Explorer AND Edge, NOTHING!

Then, I found in a forum (can’t remember for the life of me where) that there is an alternative method do to it:

  1. Put the BIN file in an empty USB pendrive
  2. Turn off the router (unplug the power)
  3. Place the USB stick in the router
  4. Press the reset button on the back of the router, and while keeping it pressed plug in the power, and STILL keep the reset switch pressed
  5. Stay there like this for a while contemplating on the meaning of existence
  6. In my case I noticed that after a while (10-15 secconds maybe?) the front led was flashing in a different way than when it just booted up, so I figured I could finally leave the reset switch be
  7. I connected to 192.168.31.1 after a while when the front led became static blue and, go figure, the firmware had downgraded

lftp and source: Is a directory error

I was running lftp with the -f switch to launch the usual mirror command, working fine with a few ftp servers at first, but when I added another sync with a pure-ftpd server something stopped working as intended: the message

source: Is a directory

appeared and nothing more happened, only after I pressed Enter the script went on with the execution.

What helped me was this discussion.

so I changed my script, and instead of having

open host
user username password
mirror blahblah

I used

open -u username,password host
mirror blahblah

and everything was magically fine!

Why? NO IDEA. Who cares. Works now.

Windows 10 bluetooth not working on Asus UX51VZ and Centrino Advanced-N 6235

Long story short, my bluetooth mouse, a Logitech Mx Master 2S, disconnected out of the blue, first times I just had to turn off and on bluetooth on windows, once the bluetooth device was automatically disabled because “it caused problems” and I had to restart, finally it stopped working altogether, always telling me “try connecting your device again”. I tested it with every other bluetooth device I had handy, to no avail.

Wasted maybe half an hour, on my almost nonexisting free time schedule (AAARGH)

So finally I had the nice thought of checking, from device manager, if there were updated drivers for the chipset responsible for wireless (WiFI and Bluetooth), a Centrino Advanced-N 6235. I updated it since it automatically downloaded new drivers, restarted as I was asked, and even if wifi kept being shitty, the bluetooth mouse finally connected, as did my android phone.

Change user of transmission-daemon under Debian and Raspbian

UPDATE: Cristian commented adding a nice solution (which I didn’t personally test though, so it’s on you):

  1.  run chmod 775 on the download folder, with -R option (recursive on subfolders):
    sudo chmod -R ug+rw folderName
  2.  add your own user (the one you need to be able to access the downloaded files) to debian-transmission group, or any other group that the transmission daemon belongs to:
    sudo usermod -a -G groupName userName

And that would be all.

Though, after some tinkering that occurred as of june 2019, I found that my original, following, solution has a -probably- nicer “feature” for someone: the config folder of transmission is saved in your own home under the .config/transmission-daemon/ folder, instead of /var/lib/transmission-daemon/, in my case this saved some waste of time because I had the home folder backed up, while the rest of the system was installed from scratch.

This is the original article with the original solution.

I have a raspi3 running transmission daemon downloading to an external USB drive shared via Samba. I don’t want to keep using debian-transmission user with the daemon since just switching to my user account having the access rights to the external USB is much simpler.

I had it already nice and running before, but updating the daemon with apt-get messed everything (and lost all the running torrents as well) so I had to rediscover the procedure once again, and for posterity (and myself for future occasions) I’m writing it down here.

All the missing torrents appeared again after I solved the issue.

Periodically I myself come back here, since at every update of transmission, the service username is restored to the default value, and my Web UI doesn’t work anymore. That’s my cue to open my own tutorial and follow it.

So, here are the things you need to do:

  1. run sudo service transmission-daemon stop just in case
  2. edit /etc/init.d/transmission-daemon to have USER=username
  3. edit /lib/systemd/system/transmission-daemon.service to the same effect
  4. run sudo chown -R user:user /etc/transmission-daemon/
  5. run sudo chown -R user:user /var/lib/transmission-daemon/
  6. restart the service with sudo service transmission-daemon start

Done.

According to a comment of this article, this might not work for you, so instead you might want to follow this guide instead:

https://askubuntu.com/questions/261252/how-do-i-change-the-user-transmission-runs-under/544185#544185

Il Mio Pos di Setefi, Move & Pay Business che non se ne può più

Nel 2014 mi sono arreso al regalo alle banche all’obbligo di legge di attivare un POS per le attività commerciali, e l’allora offerta di Banca Intesa / Intesa Sanpaolo era la più conveniente, a 0.7% di commissioni bancomat, e 1.4% per carta di credito, con canone mensile di 2€, contro alternative “free” come SumUp e compagnia bella, che ricaricano una strepitosa percentuale del 2.8% su tutte le transazioni (veramente folle, ma non che le prime non siano comunque un latrocinio tutto considerato).

Da allora l’applicazione Android che si collega via Bluetooth al dispositivo iCMP Ingenico è stata aggiornata diverse volte ed è diventata esteticamente più gradevole, ma anche io ho aggiornato più volte i miei telefoni, e soprattutto di recente le mancanze dell’applicazione sono diventate debilitanti.

L’accoppiamento via bluetooth spesso diventa impossibile: se non funziona subito dopo la procedura di inserimento credenziali e pairing da Ingenico, allora è inutile premere RETRY/RIPROVA, disinstallare, cancellare i dati dell’applicazione, riavviare telefono e dispositivo… non andrà mai più.

Unica soluzione: Full Wipe/Hard reset/Rpristino impostazioni di fabbrica come lo si vuol chiamare.

Ma anche qui, attenzione! Appena configurato l’account google sul telefono così resettato, non si può mettere mano a titanium backup per ripristinare le applicazioni mancanti, perché così facendo Move&Pay riprenderà a dare l’errore di connessione fallita in fase di configurazione, e sarà tutto da ripetere. Bisogna per prima cosa scaricare e installare dal Play Store l’applicazione Il Mio POS (MAI ripristinarla da Titanium) e forse si sarà fortunati. Ma non basta, perché l’ultima volta che ho fatto questa tiritera (ORE per ripristinare tutto a puntino come voglio) comunque dopo alcuni giorni ha smesso misteriosamente di accoppiarsi via bluetooth, e tentando di riconfigurare l’applicazione è tornato l’errore.

A suo tempo, ingenuamente, pensavo fosse una defaillance del dispositivo Ingenico, e chiamai il servizio clienti per farmelo sostituire. Dopo tutte le domande di rito, mi venne detto “il suo telefono non è tra quelli supportati”, ma mi volete prendere in giro? Il bluetooth del mio telefono è diverso da quello dei modelli supportati e dal protocollo bluetooth standard universalmente riconosciuto? O è il vostro software che è una ciofeca?

Stesso destino evidentemente lo condividono le altre applicazioni simili: curiosando sul Play Store non ce ne è una tra quelle che si associano a POS bluetooth che abbia valutazione media superiore a 4 stelle. Addirittura il destino peggiore tocca alla versione per iPhone, che ha una media di votazioni sull’AppStore se ricordo bene di 2 stelle o meno. Ed ho potuto sperimentare io stesso: accoppiato e configurata l’applicazione, è andata a buon fine solo la prima transazione di prova verso me stesso, di 1€, perché alle successive, IMPOSSIBILE ripristinare la connessione. Stesso errore riferito dagli altri utenti.
….forse il mio muletto su iPhone 5 è uno dei modelli non supportati?

fix Android gallery timestamp from video image filename

If you copied the files from another phone, you will notice the new gallery will have all files to the same date of the copy operation.

Install BusyBox, and from terminal or better yet JuiceSSH onto local device, go to /sdcard/DCIM/Camera and do

for i in VID*.mp4; do busybox touch -t ${i:4:8}${i:13:4}.${i:17:2} $i; done;

for i in IMG*.jpg; do busybox touch -t ${i:4:8}${i:13:4}.${i:17:2} $i; done;

Supposing the filename is in the format

IMG_YYYYMMDD_HHMMSS.jpg VID_YYYYMMDD_HHMMSS.mp4