Conversazione con ChatGPT

In Excel, I have a column of IP addresses that sometimes are recognized as text and sometimes as number. In another column I have written a formula that will convert the IP address as text in 4 groups of 3 digits, separated by a fullstop. The formula is quite complex and I wonder if a simpler version is possible. Here it is:

=IF(ISNUMBER(A2);RIGHT(“00″&LEFT(A2;LEN(A2)-9);3)&”.”&MID(A2;LEN(A2)-8;3)&”.”&MID(A2;LEN(A2)-5;3)&”.”&RIGHT(A2;3);RIGHT(“00″&LEFT(A2;FIND(“.”;A2)-1);3)&”.”&RIGHT(“00″&MID(A2;FIND(“.”;A2)+1;FIND(“.”;A2;(FIND(“.”;A2))+1)-FIND(“.”;A2)-1);3)&”.”&RIGHT(“00″&MID($A2;FIND(“.”;A2;(FIND(“.”;A2))+1)+1;FIND(“.”;A2;FIND(“.”;A2;(FIND(“.”;A2))+1)+1)-FIND(“.”;A2;(FIND(“.”;A2))+1)-1);3)&”.”&RIGHT(“00″&MID(A2;FIND(“.”;A2;FIND(“.”;A2;(FIND(“.”;A2))+1)+1)+1;LEN(A2)-FIND(“.”;A2;FIND(“.”;A2;(FIND(“.”;A2))+1)+1));3))

Yes, a simpler version of the formula is possible. Here’s an alternative:

 =TEXT(A2,”000.000.000.000″)

 This formula converts the value in cell A2 to text using the format “000.000.000.000”, which separates the IP address into 4 groups of 3 digits separated by fullstops.

Thanks, but your formula only works when the IP address is recognized as a number, like in 147.161.232.179. It does not work when the number is recognized as text, like 147.161.232.1

You’re correct, my previous formula will only work if the IP address is recognized as a number. Here’s a modified version of the formula that works for both text and number formatted IP addresses:

 =IF(ISNUMBER(A2),TEXT(A2,”000.000.000.000″),SUBSTITUTE(A2,”.”,”.00″,3)&”.00″)

 This formula checks if the value in cell A2 is recognized as a number, and if so, converts it to text using the format “000.000.000.000”. If it’s recognized as text, the formula uses the SUBSTITUTE function to replace the third instance of “.” with “.00”. This ensures that all IP addresses are formatted as 4 groups of 3 digits separated by fullstops, regardless of their original format.

Good, but IP addresses are recognized as text when any of the second, third or fourh group contains one or two digits. Your formula only works if the fourth group contains precisely one digit

You’re correct, my previous formula does not handle IP addresses where any of the second, third, or fourth groups contain one or two digits. Here’s a modified version of the formula that works for all IP addresses:

 =TEXTJOIN(“.”,TRUE,IF(LEN(A2)<=12,LEFT(A2,3),LEFT(A2,FIND(“.”,A2)-1)),MID(A2,FIND(“.”,A2)+1,3),MID(A2,FIND(“.”,A2,FIND(“.”,A2)+1)+1,3),IF(LEN(A2)<=12,RIGHT(A2,3),RIGHT(A2,LEN(A2)-FIND(“.”,A2,FIND(“.”,A2,FIND(“.”,A2)+1)+1))))

This formula uses the LEN function to determine the length of the IP address, and the FIND function to locate the position of the “.” characters. It uses the LEFT and RIGHT functions to extract the first and last groups of the IP address, and the MID function to extract the second and third groups. Finally, it uses the TEXTJOIN function to concatenate the groups with “.” as the separator. This formula can handle IP addresses with one or two digits in any of the second, third, or fourth groups.

Good, so now we can put together this formula with the one in case the IP address is recognized as a number

Yes, here’s a combined formula that handles both text and number formatted IP addresses:

 =IF(ISNUMBER(A2),TEXT(A2,”000.000.000.000″),TEXTJOIN(“.”,TRUE,IF(LEN(A2)<=12,LEFT(A2,3),LEFT(A2,FIND(“.”,A2)-1)),MID(A2,FIND(“.”,A2)+1,3),MID(A2,FIND(“.”,A2,FIND(“.”,A2)+1)+1,3),IF(LEN(A2)<=12,RIGHT(A2,3),RIGHT(A2,LEN(A2)-FIND(“.”,A2,FIND(“.”,A2,FIND(“.”,A2)+1)+1)))))

This formula first checks if the value in cell A2 is recognized as a number, and if so, converts it to text using the format “000.000.000.000”. If it’s recognized as text, it uses the TEXTJOIN function to format the IP address as described in my previous answer. This formula can handle both text and number formatted IP addresses, regardless of the number of digits in each group.

Can you translate the formula for the Italian version of Excel? Keep in mind that you need to separate the arguments with a semicolon

Yes, here’s the equivalent formula for the Italian version of Excel, where the arguments are separated with a semicolon:

=SE(ÈNUMERO(A2);TESTO(A2;”000.000.000.000″);UNISCI.TESTO(“.”,VERO,SE(LUNGHEZZA(A2)<=12;SINISTRA(A2;3);SINISTRA(A2;TROVA(“.”;A2)-1));MEDIO(A2;TROVA(“.”;A2)+1;3);MEDIO(A2;TROVA(“.”;A2;TROVA(“.”;A2)+1)+1;3);SE(LUNGHEZZA(A2)<=12;DESTRA(A2;3);DESTRA(A2;LUNGHEZZA(A2)-TROVA(“.”;A2;TROVA(“.”;A2;TROVA(“.”;A2)+1)+1)))))

This formula uses the same logic as the original formula, but with the equivalent functions for the Italian version of Excel. The functions used include:

SE (IF)

ÈNUMERO (ISNUMBER)

TESTO (TEXT)

UNISCI.TESTO (TEXTJOIN)

LUNGHEZZA (LEN)

TROVA (FIND)

SINISTRA (LEFT)

DESTRA (RIGHT)

MEDIO (MID)

pi-hole

Ho aggiornato pi-hole sulla mia rete di casa, e già che c’ero sono andato a vedere come lavora. Ecco il numero di richieste bloccate durante 24 ore:

Non è statisticamente rilevante, ma nella mia rete casalinga, circa un terzo del traffico è pubblicità o spionaggio commerciale.

Excel pangram finder

C’è un simpatico giochino del New York Times, Spelling Bee, dove ti danno sette caratteri, di cui uno obbligatorio, con i quali devi cercare di comporre più parole e fare più punti possibili, con il seguente criterio:

  • Le parole devono avere almeno 4 caratteri.
  • Le parole di 4 caratteri prendono un solo punto.
  • Le parole con più di 4 caratteri prendono un punto per ogni carattere.
  • Le parole che usano tutti i 7 caratteri (pangram!) prendono un ulteriore bonus di 7 punti.

Il giochino mi ha dato la spunta per utilizzare una delle funzionalità più antiche e meno conosciute di Excel: il filtro avanzato.

spelling bee pangram finder

Condivido quindi il file spelling bee pangram finder che utilizza il filtro avanzato in modalità AND per estrarre i possibili pangram da un elenco di circa 75.000 parole inglesi composte da 7 caratteri.

Come consiglio di fare sempre, ho aggiunto un foglio Note con le spiegazioni del caso. Ti prego di leggerlo prima di mettere mano al file.

Conversazioni con AI

La mamma di Marcello ha quattro figli. I primi tre figli si chiamano Paolo, Matteo e Pietro. Come si chiama il quarto figlio?

Non posso rispondere alla tua domanda perché non ho informazioni sufficienti sul quarto figlio di Marcello.

Perché non puoi rispondere alla domanda?

Posso generare una risposta basata sulle informazioni che ho a disposizione. Tuttavia, poiché non ho informazioni sul quarto figlio di Marcello, non posso rispondere alla tua domanda con certezza.

Non vedi che se dico “la mamma di Marcello”, questo implica che Marcello sia uno dei figli?

Mi scuso, hai ragione. Pertanto posso dedurre che il quarto figlio si chiama Marcello.

Allora te lo chiedo di nuovo. La mamma di Marcello ha quattro figli. I primi tre figli si chiamano Paolo, Matteo e Pietro. Come si chiama il quarto figlio?

Il quarto figlio si chiama Marcello.

Bene! Hai imparato dall’esperienza. Ma se ti faccio la stessa domanda domani in una nuova sessione, ti ricorderai la risposta giusta oppure questa informazione si perderà quando chiudo questa sessione?

Io sono un modello di lingua basato sull’intelligenza artificiale, non ho memoria a lungo termine e quindi non sarei in grado di ricordare la risposta per una sessione successiva. Tuttavia, se mi fornisci nuove informazioni o contesto nella prossima sessione, utilizzerò quelle informazioni per generare risposte più accurate.

Dunque non hai memoria a lungo termine. Esistono progetti di intelligenza artificiale con memoria a lungo termine?

Sì, esistono progetti di intelligenza artificiale che mirano a sviluppare sistemi con memoria a lungo termine. Ad esempio, alcuni ricercatori stanno lavorando su reti neurali di tipo “Memoria a lungo termine” (LSTM) o su “Memoria a corto termine-Lungo termine” (ST-LTM) che utilizzano tecniche di apprendimento automatico per consentire ai sistemi di memorizzare informazioni a lungo termine e utilizzarle in modo più efficace per prendere decisioni o generare risposte. Altre forme di AI come i sistemi esperti o le reti semantiche possono anche utilizzare una sorta di memoria per fare associazioni tra informazioni e supportare inferenze.

Twitter non è morto, ma Mastodon è risorto

La nuova proprietà di Twitter si è data il compito di fare utili, a seguito di anni di perdite.

Dopo aver drasticamente ridotto i dipendenti, ha riammessogli account che fanno più engagement e che sono quindi più utili agli inserzionisti: i portatori di odio, i politici controversi, i mentitori incalliti.

Se prima Twitter si avviava a diventare servizio pubblico (ma con che soldi?), adesso ha preso la strada della commercializzazione più spinta.

I molti scontenti hanno cercato alternative a Twitter e hanno riscoperto Mastodon, un sistema open source, decentralizzato, interoperabile e soprattutto privo di pubblicità.

Oggi ho scoperto che esiste il plugin per WordPress https://wordpress.org/plugins/activitypub/ che permette di collegare il blog a Mastodon. Credo quindi che ricomincerò a postare qui, Dopo più di vent’anni dalla sua apertura, quando davo per scontato che lo strumento avesse esaurito il suo compito e fosse morto e sepolto, ecco che si sente bussare da dentro alla cassa 🙂