11 maggio, 2019

List comprehension - 2


La list comprehension, ho iniziato a parlarne qui, sembra un argomento che fa discutere. Forse per via della sintassi diversa da quella solita cui siamo abituati.

Cosa meglio allora di un altro esempio, un classico rivisto in chiave list comprehension. Poi, in futuro, credo occorrerà tirare le fila ma intanto questo script che può indurre perplimazioni.

#!/usr/bin/python3

def fb(num):
    string = ''
    if num % 3 == 0:
        string = 'Fizz'
    if num % 5 == 0:
        string += 'Buzz'
    if num % 3 != 0 and num % 5 != 0:
        string = str(num)
    return string

# usando map()
result = list(map(fb, range(1, 21)))
print(result)
print()

#usando l.c.
resultlc = [fb(num) for num in range(1, 21)]
print(resultlc)
print()

st = ' | '.join(str(ele) for ele in result)
print(st)


È il classico tormentone fizz-buzz, consistente nel contare fino a 20 ma se il numero è multiplo di 3 sostituirlo con Fizz, se multiplo di 5 sostituirlo con Buzz e, di conseguenza, se multiplo di 3 * 5...

Lo script è ridondante, calcola due volte la lista dei numeri con sostituzioni. Il calcolo usando map() ci è sembrato più facile da costruire anche se poi la versione l.c. (mica devo continuare a dire tutta la spell? (come si traduce spell?)) risulta più semplice.

map() applica una funzione a un'iterable, nel nostro caso una lista. Per noi la funzione è fb() e la lista i numeri in [1..20].

Da notare che map() restituisce on oggetto:

$ py3
>>> def fb(num):
...     string = ''
...     if num % 3 == 0:
...         string = 'Fizz'
...     if num % 5 == 0:
...         string += 'Buzz'
...     if num % 3 != 0 and num % 5 != 0:
...         string = str(num)
...     return string

...
>>> map(fb, range(1, 21))
<map object at 0x7f4235236e10>


per cui lo esplicito con list().

>>> list(map(fb, range(1, 21)))
['1', '2', 'Fizz', '4', 'Buzz', 'Fizz', '7', '8', 'Fizz', 'Buzz', '11', 'Fizz', '13', '14', 'FizzBuzz', '16', '17', 'Fizz', '19', 'Buzz']
>>>


Passare dalla versione con map() a quella l.c. è (quasi) immediato. Almeno facilitato secondo i miei nerd chaps e me che tanto nerd non sono (ma ci aspiro).

Eseguendo si ottiene, come previsto, questo:

$ py3 fblc
['1', '2', 'Fizz', '4', 'Buzz', 'Fizz', '7', '8', 'Fizz', 'Buzz', '11', 'Fizz', '13', '14', 'FizzBuzz', '16', '17', 'Fizz', '19', 'Buzz']

['1', '2', 'Fizz', '4', 'Buzz', 'Fizz', '7', '8', 'Fizz', 'Buzz', '11', 'Fizz', '13', '14', 'FizzBuzz', '16', '17', 'Fizz', '19', 'Buzz']

1 | 2 | Fizz | 4 | Buzz | Fizz | 7 | 8 | Fizz | Buzz | 11 | Fizz | 13 | 14 | FizzBuzz | 16 | 17 | Fizz | 19 | Buzz
$


Continua. Prossimamente. Forse 🧐

🔴

10 maggio, 2019

Social media prima del web

Enrico Bo

Come si faceva 100 anni prima del Web quando ancora non c'erano Facebook, Instagram, Twitter e tutti gli altri social media?

Non so quanto sia attendibile ma ho un testimone: il Dr. John H. Watson M.D., l'autore delle imprese del detective per passione Sherlock Holmes. Watson è scrupoloso, vede tutto (anche se...) e ce lo racconta. Vediamo allora che tutti continuano a inviare e ricevere telegrammi, indirizzati nei posti dove si trovano in quel momento, tutti riescono a essere informati su tutto quel che serve in tempo reale. Il telegramma è un po' la metafora della mail, c'è chi invia e chi riceve e l'info resta tra loro. Ma c'è l'equivalente di Twitter (non bisogna essere 'mici di Daily Gazette (o altri, c'è molta scelta), basta aprirlo e cercare). Una cosa usuale, quotidiana. Per illustrarla farò riferimento a The Adventure of the Red Circle, copiandone qualche frase (confidando che l'Autore non mi accusi di plagio; anzi colgo l'occasione per ringraziarlo dei momenti deliziosi che mi procura la sua lettura).

Nel primo capitolo Holmes dice:

This person is alone and cannot be approached by letter without a breach of that absolute secrecy which is desired. How is any news or any message to reach him from without? Obviously by advertisement through a newspaper. There seems no other way, and fortunately we need concern ourselves with the one paper only. Here are the Daily Gazette extracts of the last fortnight. ‘Lady with a black boa at Prince’s Skating Club’—that we may pass. ‘Surely Jimmy will not break his mother’s heart’—that appears to be irrelevant. ‘If the lady who fainted on Brixton bus’—she does not interest me. ‘Every day my heart longs—’ Bleat, Watson—unmitigated bleat! Ah, this is a little more possible. Listen to this: ‘Be patient. Will find some sure means of communications. Meanwhile, this column. G.’

Ecco questo è il  tweet  messaggio cercato (Sherlock rockz! 💥, sempre). E subito dopo, la verifica che è la pista giusta:

Let us see if we can pick up the trace again. Yes, here we are—three days later. ‘Am making successful arrangements. Patience and prudence. The clouds will pass. G.’ Nothing for a week after that. Then comes something much more definite: ‘The path is clearing. If I find chance signal message remember code agreed—One A, two B, and so on. You will hear soon. G.’ That was in yesterday’s paper, and there is nothing in to-day’s.

OK! proprio come oggi con i social-cosi. E --pensa te!-- hanno a che fare con lingue diverse dall'inglese (niente meno che l'italiano) e senza Google Traduttore. Ma niente panico, in un altro medium:

Take the message also, Watson, that we may check each other. A single flash—that is A, surely. Now, then. How many did you make it? Twenty. Do did In. That should mean T. AT—that’s intelligible enough. Another T. Surely this is the beginning of a second word. Now, then—TENTA. Dead stop. That can’t be all, Watson? ATTENTA gives no sense. Nor is it any better as three words AT, TEN, TA, unless T. A. are a person’s initials. There it goes again! What’s that? ATTE—why, it is the same message over again. Curious, Watson, very curious. Now he is off once more! AT—why he is repeating it for the third time. ATTENTA three times! How often will he repeat it? No, that seems to be the finish. He has withdrawn form the window. What do you make of it, Watson?”

“A cipher message, Holmes.”

My companion gave a sudden chuckle of comprehension. “And not a very obscure cipher, Watson,” said he. “Why, of course, it is Italian! The A means that it is addressed to a woman. ‘Beware! Beware! Beware!’


OK, e via verso la soluzione. Il PDF è online per chi fosse interessato alla storia; a me interessava solo segnalare l'aspetto storico dei predecessori dei social-cosi. non si inventa mai niente di nuovo, si progredisce sulle spalle dei giganti che ci hanno preceduti. Secondo me.

🔴

09 maggio, 2019

Visto nel Web - 394

Mentre fuori piove e fa freddo come a novembre ecco cosa ho wisto nel Web.


Allarme di Bruxelles e Fbi: “Sulle elezioni già iniziate le interferenze dei russi”
privacy, sicurezza, spionaggio, virus | politica
::: la Stampa

Da Chuwi ecco l’ultrabook Chuwi LapBook SE e l’ancor inedito e lillipuziano Chuwi Minibook
pubbkicità ma racconta di una vecchia idea sempre promettente
hardware
::: Hardware_Italia

Censorship 'Can't Be The Only Answer' To Anti-Vax Misinformation, Argues EFF
disinformazione, fake news, bufale | censura
::: Slashdot

How Amazon's Facial-Recognition Technology is Supercharging Local Police
privacy, sicurezza, spionaggio, virus
::: Slashdot

Oracle Exec Mocks Google Arguments About Java's APIs
copyright e brevetti
::: Slashdot

UK Nuclear Lab Achieves Americum-Generated Power
energia | spazio, esplorazione
::: Slashdot

Gotta give JavaScript some credit: thanks to JavaScript I obtained an excellent, intuitive understanding of continuation-passing style
linguaggi di programmazione
::: keleshev

Always be careful when proceeding with the foundations of language and logic. But, if you can get a working foundation, then it becomes such a solid base from which to explore and answer many more philosophical conundrums
matematica o filosofia; n'attira perché ne so niente, verrebe da dire "ἕν οἶδα ὅτι οὐδὲν οἶδα" (cit.)
matematica
::: PaulRitterbush

Colgo l’occasione per ringraziare i miei oltre 90.000 followers certificati da Twitter
social media | disinformazione, fake news, bufale
::: pisto_gol

Out now and free to download - Emergent Quantum Mechanics. David Bohm Centennial Perspectives
cito ma come detto sopra; la quantistica-qualsiasi-cosa è trendy
scienza
::: FetzerFrFund

Come ingannare il pubblico di #Instagram con una manciata di trucchi. Lo ha fatto Gabbie Hanna, una cantante (influencer?) che ha finto di partecipare al festival musical del #Coachella... e i suoi 3 milioni e 800 mila follower ci sono cascati
social media | disinformazione, fake news, bufale
::: SergioGridelli

Python Creator Guido van Rossum Blames His Resignation Partly On Social Media
Python | protagonisti
::: Slashdot

Governments should use that leverage to demand that companies share data in properly-protected databases with access granted to appropriately insulated, publicly-funded researchers. Industry participation in policy panels should be strictly limited
privacy, sicurezza, spionaggio, virus
::: demartin

#Twitstar con la sindrome di Karate Kid ne abbiamo?
umorismo
::: Genjuro75

Classical Music and Mathematics
matematica
::: cmuseorg

Tra poco la storia nella mia newsletter
la newsletter di Carola è obbligatoria, nèh!
novità
::: WebReflection

Why I Prefer Go Over Python or Java
linguaggi di programmazione
::: Slashdot


When #firefox disables all addons
umorismo
::: cbHXBY1D

New ‘Linux App Store’ Website Lets You Find Apps, Wherever
Linux
::: dcavedon

Top Cybersecurity Experts Unite to Counter Right-to-Repair FUD
hardware | economia, lavoro
::: Slashdot

Education
cit.
::: ProfFeynman

I’m kind of delighted that this exists. Oh, and please turn off Office macros
privacy, sicurezza, spionaggio, virus
::: evacide

Fatelo un video su #Youtube "Switching From Mac to Windows"
sistemi operativi
::: Genjuro75

I once knew a very, very good mathematician
matematica
::: mathematicsprof

The Pinebook Pro, a $199 Linux Laptop, Inches Closer to Launch
hardware
::: dcavedon

Boeing Believed a 737 Max Warning Light Was Standard. It Wasn't
programming, codice, snippet
::: Slashdot

The solution to wealth inequality
spazio, esplorazione | umorismo
::: fchollet

Scorri le prime pagine e trovi l'ormai usuale negazionismo dell'emergenza climatica in funzione anti-Greta (derisa e offesa), i soliti teoremi sugli hacker russi, un giornale che scopre nel 2019 l'esistenza dei profili fasulli online
i media seri, quelli di carta
disinformazione, fake news, bufale
::: fabiochiusi

La moderazione dei contenuti sui social funziona male e andrebbe completamente rivista
social media
::: _arianna

The 5.1 kernel has been released
Linux
::: Gianlucadfiore

Facebook is systematically censoring an article by @valigiablu about Facebook's systematical censoring of the cover of Led Zeppelin's 'Houses of the Holy' (it apparently contravenes FB's ToS on nudity🤦‍♂️). Result? @Facebook is effectively censoring critiques to Facebook
Facebook | censura
::: fabiochiusi

Intanto poteva mancare l’ennesima proposta anti-anonimato online
politica
::: fabiochiusi

#Copyright: Over the past few days i have collected all known (to me) versions of #Article13 (now 17) that were proposed or discussed during the entire legislative process in one convenient GitHub repo. One take away: Legislators had plenty alternatives
copyright e brevetti | censura
::: paul_keller

Una gara internazionale di robotica e una vallata di miniere dismesse in Romania: una speranza per alcuni giovani liceali
scuola, educazione | robots
::: BalcaniCaucaso


A JavaScript-Free Frontend
linguaggi di programmazione
::: xtofl

I social network avrebbero dovuto abbattere il 'muro dell'incomprensibilità', ma hanno generato il più grosso equivoco socio-comunicativo della storia: una dialettica paradossale e senza dialogo
social media
::: FscoMer

Qualcuno mi ha mandato via whatsapp il video di Alessandra Moretti
social media | umorismo
::: mante

Fermare l'automazione è come lottare contro i mulini a vento. Non si vince nella competizione con i robot, ma nel tocco umano
innovazioni, futuro | robots
::: SergioGridelli

Da oggi sul sito Copyleft-Italia è liberamente scaricabile il pezzo forte della mia collana di libri: "#OpenSource, #SoftwareLibero e altre libertà" dell'amico e collega @CarloPiana. Con prefazione di @rdicosmo e postfazione mia
open source
::: simonealiprandi

Microsoft is Bringing Visual Studio To the Browser, Unveils .NET 5
Web, Internet | programming, codice, snippet
::: Slashdot

Full Circle Weekly News #129
novità
::: fullcirclemag

Microsoft Unveils a New Terminal for Windows 10 and Windows Subsystem for Linux 2
sistemi operativi
::: Slashdot ::: MalwareTechBlog ::: codepo8 ::: dcavedon ::: lemire ::: migueldeicaza ::: windowsdev ::: fulcorno ::: belickim ::: TuxmAL ::: steveklabnik

The Future of Work is Remote
lavoro | economia, lavoro
::: Slashdot

Google Prepares To Launch New Privacy Tools To Limit Cookies
ad, pubblicità | privacy, sicurezza, spionaggio, virus
::: Slashdot

MIT team shows that neural networks can work just as well even if they're 10x smaller
neural networks
::: MIT_CSAIL

Visualizing 40 Years of Music Industry Sales
economia, lavoro | media
::: rtkrum

Quality is never an accident
cit.
::: RichRogersIoT

Di dati e clienti. Ecco perché Unicredit abbandona Facebook e Instagram
social media
::: albe_

Facebook Contractors Categorize Your Private Posts To Train AI
privacy, sicurezza, spionaggio, virus | artificial intelligence
::: Slashdot

The reason I am using Altair for most of my visualization in Python
Python
::: Cucho

Tanja Brandt

Software maintenance is not
cit.
::: RichRogersIoT

TypeScript is Exploding, JavaScript is the Fittest
linguaggi di programmazione
::: redmonk

I have implemented Fast-SCNN model using Tensorflow 2.0 and in this article I have explained the model and described how I implemented it using TF 2.0. Please read the article and let me know what you think about it
neural networks
::: KshitizRimal

First Private Japanese Rocket Reaches Space
mi sa che sta arrivando l'era che sognavo da ragazzino
spazio, esplorazione
::: Slashdot

Chelsea Manning and her Attorneys File Motion Declaring She will Never Cooperate with Grand Jury
Web, Internet
::: micahflee

Woah. A Chinese hacking group was using NSA exploits a ~year before~ they were leaked publicly by the Shadow Brokers. Also had different variations to those linked, potentially pointing to another source
privacy, sicurezza, spionaggio, virus
::: josephfcox

here is a looping video to make this tweet more interesting
matematica
::: roice713

Study: "social media effects are nuanced, small at best, reciprocal over time, gender specific, and contingent on analytic methods"
social media
::: fabiochiusi ::: fabiochiusi

la guerra Cina-America è lo scenario agghiacciante di fondo
privacy, sicurezza, spionaggio, virus
::: jacopo_iacoboni

hello @StackOverflow, I just got an email from a recruiter who told me that he created an account in their CRM for me harvesting my data from my profile on your platform, all without my consent, does this violate your T&C?
privacy, sicurezza, spionaggio, virus
::: vikkio88

'L'universo dei dati e la libertà della persona' - il testo dell'intervento odierno del Garante Privacy, Soro, che è anche il bilancio di un settennato
Web, Internet | privacy, sicurezza, spionaggio, virus
::: fabiochiusi

Deja vu
umorismo
::: ismonkeyuser

Software is made up of
cit.
::: liza

a nice introductory of scientific computing from the engineering dept at the Univ of Illinois
programming, codice, snippet
::: mathematicsprof

Facebook’s newest ‘fact checkers’ are Koch-funded climate deniers. #speechless
Facebook | disinformazione, fake news, bufale
::: NaomiOreskes

New research from @iftf shows that disinformation disproportionally targets latinos, muslims, and jews on social media with harassment, highjacked conversations, and flat out falsehoods spread by extremists
social media | disinformazione, fake news, bufale
::: JaneLytv

LRT: This comment
cit. | sistemi operativi
::: wilbowma


GNU/kWindows
sì William (rockz!) la cosa ha senso
sistemi operativi
::: Mike Gerwitz

Binance Says More Than $40 Million in Bitcoin Stolen in 'Large Scale' Hack
blockchain e crypto* | frodi
::: Slashdot

French company has created lots of fake domains pretending to be some very popular free software and is using these sites to distribute bundled adware and malware
frodi
::: Gabry89

Google's Pichai calling for GDPR-like privacy legislation for the US: "We think the United States would benefit from adopting its own comprehensive privacy legislation and have urged Congress to pass a federal law"
Web, Internet
::: fabiochiusi

La piattaforma di e-commerce cinese AliExpress verrà aperta anche a venditori in Italia e in altri paesi
economia, lavoro
::: ilpost

Le 8 novità più importanti presentate ieri da Google
hardware | sistemi operativi | innovazioni, futuro
::: ilpost

If you know the response function of your instrument, you can deconvolve it from your measurement to obtain a much sharper signal. But deconvolution is a dangerous procedure, as small mistakes in the kernel can result in heavy artifacts
programming, codice, snippet
::: j_bertolotti

San Francisco Bans Cashless Stores
economia, lavoro | politica
::: Slashdot

Se potessi fare una sola domanda a Darwin sulla selezione naturale
innovazioni, futuro
::: mante

This is quite remarkable, the CIA started its own Tor onion site
privacy, sicurezza, spionaggio, virus
::: jacopo_iacoboni

GnuPG's #OpenPGP (gpg) and #SMIME (gpgsm) implementation approved for restricted communication in Germany and Europe
privacy, sicurezza, spionaggio, virus
::: gnupg

Brian Kernighan interviews Ken Thompson
protagonisti | storia
::: b3h3m0th

L'alternativa inesistente al social
social media
::: mante

I finally put my thoughts down on #FacialRecognition. It's a long read and is my take on how we are drifting from #surveillance cameras to FR to profiling and predicting
privacy, sicurezza, spionaggio, virus | artificial intelligence
::: AnthroPunk

We’ll soon know the exact air pollution from every power plant in the world
spazio, esplorazione | innovazioni, futuro
::: emenietti

One of the most consolidated misconceptions about programming [..] is the idea that such activity is purely technical, completely exact in nature, like Math and Physics. Computation is exact, but programming is not
programming, codice, snippet
::: kamaln7

07 maggio, 2019

Codice chiaro: list comprehension


Alle volte i giovani sono molto più informati, aggiornati e --in una parola-- nerd di me. Lo so io sono solo wannabe-nerd e vecchio, mica facile adeguarsi.
Ah! 'na roba: una volta si usava commentare così lo sapevano tutti,intesi come quei pochi che leggono il post, ma the times they are a-changin' (cit.).
Allora provo anch'io ad andare di grok (si usa questa espressione?).

La versione Python dello script per inserire spazi tra i caratteri di una stringa del post Modi diversi per utenti diversi poteva essere scritta meglio, mi dicono.

Vero, verissimo, basta usare la list comprehension. Prossimamente riparlerò di questo argomento, più in dettaglio, come anche argomenti simili, p.es. map ma subito la nuova versione dello script.

Wikipedia è ottima per introdurre l'argomento nella sua definizione matematica e il suo inserimento, storicamente, nei linguaggi di programmazione, qui List comprehension il inglese; la versione italiana, Comprensione di lista, è purtroppo solo un abbozzo.

La documentazione ufficiale di Python è scritta in legalese, Displays for lists, sets and dictionaries.

Uh! ahemmm... cioè sarebbe... Mi serve un esempio semplice per vedere se ho capito.

Se voglio la lista dei quadrati dei numeri naturali da 1 a 10; una volta (OK, ancora adesso si può scrivere:

>>> quad = []
>>> for n in range (1, 11):
...     quad.append(n * n)
...
>>> print(quad)
[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]


Con list comprehension il codice è più sintetico e, una volta che ci si è abituati, più chiaro:

>>> quad = [n * n for n in range(1, 11)]
>>> print(quad)
[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]


Semplice vero? L'espressione ha cioè la forma risultato = [operazione in ciclo-for].

OK, torno allo script incriminato, questo:

#:/usr/bin/python3

import sys

f = sys.stdin
st = f.readline().strip()

stsp = ''
for c in st:
    stsp += c + ' '
print(stsp.rstrip())


diventa così:

#:/usr/bin/python3

import sys

f = sys.stdin
st = f.readline().strip()

st = ' '.join(c for c in st)
#print('*'+st+'*')
print(st)


nota: la print() commentata è per controllo, per vedere che non serve la strip().

Eseguendola si ha:

$ echo prova con List Comprehension | py3 lcomp
p r o v a   c o n   L i s t   C o m p r e h e n s i o n
$


🙂

py3 è un alias

$ alias py3
alias py3='python3 -q'
$


Altra nota: come si vede sopra la REPL (l'interprete dei comandi, quello che si ha scrivendo python3 nel terminale (per Windows digitare python)) è comodissima per le cose al volo 🙂

🔴

05 maggio, 2019

Visto nel Web - 393

Mentre fuori piove (uau temporale!) ecco cosa ho wisto nel Web 🧐


The federal agency will begin filtering all Internet traffic through special override systems that will be supplied to telecommunications providers free of chargecensura
::: fabiochiusi

Netflix Says Python Programming Language is Behind Every Film You Stream
Python
::: Slashdot

If a software has a GUI and a CLI
non dirlo a MACisti & Wins; dissentirebbero
cit.
::: Gianlucadfiore

Dopo le giapponesi, dopo le francesi, anche il gigante Volkswagen scommette forte sull’auto elettrica
innovazioni, futuro | ambiente, ecologia
::: robdellaseta

#GNU #GPLv3 At the center of the #BlackHole Image
open source
::: sdallagata

Se dovessimo applicare a questa trasmissione gli stessi criteri che chiediamo all’informazione in rete, cosa dovremmo chiedere? Che venga chiusa? Che sia penalizzata (con sanzioni o simili) la Rai?
media | disinformazione, fake news, bufale
::: fabiochiusi

LQDN soutient toutes les lanceuses et lanceurs d’alerte actuellement enfermé·e·s ou poursuivi·e·s. Julian Assange ne doit pas être extradé. Chelsea Manning & Ola Bini doivent être libérées
Web, Internet | politica
::: laquadrature

Several quantum-computing researchers have expressed skepticism regarding the physical realizability of the quantum-computing dream
quantum computing
::: vardi

Is this worrisome? Sure. The problem though is that number 1, 2 and 3 app are Facebook, Messenger and Instagram: apps that are as bad as the Chinese one
privacy, sicurezza, spionaggio, virus
::: thek3nger

Putin l'ha fatto. Ha ottenuto la legge per "un'Internet sovrana", che consente di staccare la rete russa da tutto il resto del mondo
censura
::: jacopo_iacoboni ::: libertNation

Congrats to @BlueOrigin on another successful suborbital flight!
spazio, esplorazione
::: BadAstronomer

#USBDropAttack 👉 297 chiavette USB usate come test, per verificare se, chi e quante sarebbero state inserite in un PC. Qui ti racconto come è andata a finire 🔥
privacy, sicurezza, spionaggio, virus
::: marcogovoni

La spesa #cinese in #ricerca e sviluppo è decuplicata dal 2000. #innovazione
innovazioni, futuro
::: Luca_Gualtieri1

Germany's Artificial Intelligence Strategy is people-centric & ambitious. It sets the foundation to take back the digital sovereignty and strategic autonomy of Europe in the digital age. It just needs much more investment & talent to make it work!
artificial intelligence
::: francesca_bria

Cosa bisogna fare con Huawei
L’approccio del governo britannico è quello giusto, dice l’Economist, per tre ragioni
Web, Internet | privacy, sicurezza, spionaggio, virus
::: ilpost


Writing code is fun
umorismo
::: thek3nger

Mozilla Says It Will Ban Firefox Add-ons With Obfuscated Code
privacy, sicurezza, spionaggio, virus
::: Slashdot

Maintenance
tip, suggerimenti
::: The_Maintainers

“Reinforcement Learning, Fast and Slow”, reviews recent techniques in deep RL that narrow the gap in learning speed between humans and agents, & demonstrate an interplay between fast and slow learning w/ parallels in animal/human cognition
artificial intelligence
::: DeepMindAI

We are starting a formal structure to supervise the evolution of the Keras API: the Keras SIG. All future API proposals should be submitted over there, and will be reviewed by the SIG chairs
machine learning | artificial intelligence
::: fchollet

Facebook ha rimosso gli account di Alex Jones, Milo Yiannopoulos e altri leader accusati di incitare all’odio e alla violenza
odio, razzismo, discriminazioni
::: ilpost ::: fabiochiusi

Che cosa mi sono perso?
social media
::: davidallegranti

Apple Is Telling Lawmakers People Will Hurt Themselves if They Try To Fix iPhones
Apple | hardware
::: Slashdot

hey kid, wanna smoke some lambdas
cit.
::: dustyweb

Our EU Political Advertising Transparency Report 2019 is out! A key milestone to fight misinformation @google
disinformazione, fake news, bufale | politica
::: marconav

America's Favorite Door-Locking App Has a Data Privacy Problem
privacy, sicurezza, spionaggio, virus
::: Slashdot

Google Says It's Reviewed Over 1M Suspected Terrorist Videos on YouTube This Year
privacy, sicurezza, spionaggio, virus
::: Slashdot

Deep learning used for efficient path planning, outperforming A* in complex environments
deep learning | robots
::: fchollet


That’s it astronomers. You’re not getting any more data until you have used the data you have already collected
dati, raccolta
::: AstroMikeMerri

When using my cellphone, I tend to become a passive consumer of the internet. When using my laptop, I become an active creator of it. The difference is the input mechanisms. The friction and inefficiency of typing on a mobile device is high enough to discourage most production
dispositivi mobili
::: devonzuegel

More than three quarters of jurisdictions globally are considered problematic or worse for press freedom
media | censura
::: fabiochiusi

How Satya Nadella remade Microsoft into the world’s most valuable company
protagonisti | ditte
::: emenietti

Quando a spargere #fakenews è ANSA
disinformazione, fake news, bufale
::: LaVladina

Story in four acts
social media
::: wesyang

En 1917, les #trottinettes à moteur semaient déjà la terreur dans les rues de #Paris : l' "Auto-ped" de M. Charron
innovazioni, futuro | storia
::: GallicaBnF

Airbnb listings in China are littered with racist discrimination
odio, razzismo, discriminazioni
::: astroehlein

Hey you live in Anonymous Proxy too!?
umorismo
::: x0rz

How did we find the policing app at the heart of Xinjiang's mass surveillance? It was an accident. Let me tell you
censura
::: wang_maya

Major media outlets failed to rebut President Trump's misinformation 65% of the time in their tweets about his false or misleading comments (...) the outlets amplified Trump's misinformation more than 400 times over the three-week period of the study -- a rate of 19 per day
disinformazione, fake news, bufale | politica
::: fabiochiusi

Facebook told FTC it's willing to accept vast new oversight to settle probe
Facebook
::: TonyRomm

Unigram
social media
::: fulcorno


Last year “Python” was Googled more in the US than “Kim Kardashian”
Python
::: MIT_CSAIL

Really fast bitset decoding for “average” densities
programming, codice, snippet
::: lemire

GNU Guix has released version 1.0
linguaggi di programmazione
::: fsf

Ex-YouTube Developer Reveals How He 'Conspired To Kill IE6
Web, Internet
::: Slashdot

The Official Ubuntu Merch Shop Has Closed Down
Ubuntu
::: dcavedon

Atomic Pi FIrst Look! $35 X86 Single Board Computer
hardware
::: Genjuro75

Facebook's Cryptocurrency Might Work Like Loyalty Points
blockchain e crypto*
::: Slashdot

Se cercate delle guide tech semplici e abbastanza precise con le definizioni di darknet, VPN, bitcoin, crittografia, ecc ne trovate di ottime nella parte iniziale di incriminazioni e affidavit americani
Web, Internet
::: carolafrediani

Il Garante interviene sui captatori informatici. Sottolineando la pericolosità dell'utilizzo di app e l'assenza di seri meccanismi di verifica ex post delle operazioni. Ma è solo la punta dell'iceberg...
privacy, sicurezza, spionaggio, virus
::: gbgallus ::: meobaldo

To activate the firewall
umorismo
::: tecmint

Ooops...
social media | privacy, sicurezza, spionaggio, virus
::: carloalberto

Could TypeScript replace JavaScript?
linguaggi di programmazione
::: Slashdot

hina is now blocking all language editions of Wikipedia
censura
::: fabiochiusi

Science and Technology links (May 4th 2019)
novità
::: lemire


04 maggio, 2019

Modi diversi per utenti diversi


È in corso un dibattito con due amici, PLG e AG, sui Massimi Sistemi, Windows e Linux. I pareri sono molto diversi, sto raccogliendo materiale, ma non trattenete il respiro, andrà per le lunghe. Anche perché c'è anche Android. E temo l'irruzione di iOS (sssht!).

Io non voglio intromettermi a gamba tesa, anzi un pochino (solo un po', nèh!). Una cosa recente, piccola, quasi trascurabile ma illustra --imho-- come agiscono gli utenti tipici dei due OS.

Ci viene richiesto di modificare una scritta inserendo uno spazio tra ogni carattere, così:

$ echo stringa da spaziare | inssp
s t r i n g a   d a   s p a z i a r e
$


Invece di aprire un editor e scrivere con gli spazi la stringa (o inserire gli spazi se la stringa già c'è con un editor) il linaro (it's me) sa che c'è sed e si costruisce uno script, questo:

#!/bin/bash
sed 's/\(.\{1\}\)/\1 /g;s/ $//'


Confessione: non l'ho scritto io; l'ho capiato, qui, dove viene anche spiegato (è particolare, meno comune di quelli usuali).

La stringa risultato dev'essere selezionata e copiata nella clipboard con Maiusc-Ctrl-C. Ma c'è un modo più semplice, ho lo script _k:

#!/bin/bash
xclip -f -selection clipboard


Per cui, per avere direttamente la stringa nella clipboard pronta per l'inserimento il comando diventa:

$ echo stringa da spaziare | inssp | _k
s t r i n g a   d a   s p a z i a r e
$


(sì, lo so che non si vede, se del caso provate, xclip è da installare).

Ha senso, ovviamente, se il testo da spaziare supera una certa dimensione, per esempio se il testo è nel file dati:

$ cat dati | inssp | _k
u n o
d u e
t e r z a   r i g a
q u a t t r o
$


In alternativa a _k posso reindirizzare l'output con > out.txt (visto che mi adeguo alle usanze di Windows e uso l'estensione?).

Questa procedura vale ovviamente solo per Linux, in Windows non ho sed ma niente panico (cit.) lo script lo scrivo con Python, così (insspy):

#:/usr/bin/python3

import sys

f = sys.stdin
st = f.readline().strip()

stsp = ''
for c in st:
    stsp += c + ' '
print(stsp.rstrip())


Facile vero? Funziona come lo script bash e funziona anche con Windows.

Quindi i due OS sono equivalenti? Non esattamente, gli utenti Windows sono molto meno disponibili a usare il terminale, vogliono finestre, bottoni e chissà quali altri widgets. Si usa ancora "widget" o sono solo più io? Anche la Wiki, lei non mi delude mai.

🔴

02 maggio, 2019

Visto nel Web - 392

Sempre ancora in rodaggio ecco cosa ho wisto nel Web 🧐


Quando ci fu il passaggio dai blog a Facebook ero molto scettico e resistetti per un po’. Poi, anche per altre questioni, attivai il profilo Facebook senza mai rinunciare al blog. Sono sempre più convinto che lo scetticismo di allora aveva molto senso
social media | personale
::: dionisoo

Hire these people
economia, lavoro | lavoro | programming, codice, snippet
::: RichRogersIoT

A-EON Talks About The Future of The Amiga Platform
esiste ancora? una volta era OK; norto per ragioni economiche
sistemi operativi
::: Slashdot

We need STEM majors in order to make
scuola, educazione
::: existentialcoms

Training ever bigger convnets and LSTMs on ever bigger datasets gets us closer to Strong AI -- in the same sense that building taller towers gets us closer to the moon
nota per me: LSTM Long short-term memory
artificial intelligence
::: fchollet

Use a FreedomBox to regain control of your online privacy
hardware | privacy, sicurezza, spionaggio, virus
::: Sjig

Seeing lots of excitement about Windows letting users see Android notifications on the desktop — #Ubuntu can do this (and a whole lot more) too!
Ubuntu | tools, componenti software
::: omgubuntu

Do Complex Systems Require Higher Safety Standards From Managers and Engineers?
privacy, sicurezza, spionaggio, virus
::: Slashdot

Data collected within a city, for example, might be placed under the control of a data trust, ensuring it can only be used in ways that benefit citizens, involving them in the decision making
dati, raccolta | privacy, sicurezza, spionaggio, virus
::: fabiochiusi

Uno dei motivi per cui strillare che “i social uccidono la democrazia” è non solo inutile ma nocivo è che non spiega come mai in Spagna per esempio - nonostante fake news etc. - abbiamo vinto i socialisti, con l’estrema destra che non sfonda. Ora non la uccidono più?
social media | disinformazione, fake news, bufale | politica
::: fabiochiusi

Sometimes @Twitter's recommendation algorithm gets things hilariously wrong. I can assure you that fans of @Sci_Hub will most emphatically NOT like @ElsevierConnect 😂
open source
::: rskudesia

Stephan Pastis 29 apr 2019
social media
::: stephanpastis

SpaceX: il punto della situazione una settimana dopo l’esplosione della Crew Dragon DM-1
spazio, esplorazione
::: AstronautiNEWS

Zuck ha inventato la sveglia
umorismo
::: quinta



Cloud Database Removed After Exposing Details on 80 Million US Households
privacy, sicurezza, spionaggio, virus
::: Slashdot

Hackers have breached Docker Hub, a popular programming tool used by major tech companies. The impact of the breach is still unclear but hackers accessed private keys and tokens for GitHub and BitBucket, which is potentially really, really, bad
privacy, sicurezza, spionaggio, virus
::: lorenzofb

SBCL 1.5.2 now available with lots of RISCV goodness. Consume with moderation
lisp(s)
::: ascii19

Some time ago I wrote about optimal transport for machine learning with @PyTorch. If you're really into this topic, check out GeomLoss: a fast, optimized library to calculate Sinkhorn distances (and their gradients!)
machine learning | Python
::: danieldazac

Spotify ha raggiunto 100 milioni di utenti iscritti al servizio premium in tutto il mondo
media
::: ilpost

German far-right AfD party is saturating Facebook with Russian memes while researchers also find evidence of “inauthentic coordinated behavior” ahead of EU elections
disinformazione, fake news, bufale | politica
::: profcarroll

Facebook is boycotting the European Elections by preventing not only EU parties but also many 💯 organisations from using Facebook/Instagram to run mobilization campaigns encouraging citizens to vote
Facebook | politica
::: alemannoEU

I'm so old I can remember when social media was going to be a force for good
cit.
::: defrag

a self-taught programmer from Belgium just cracked MIT's 20-year-old cryptographic puzzle
privacy, sicurezza, spionaggio, virus
::: MIT_CSAIL ::: codinghorror

Vodafone “identified hidden backdoors in the software that could have given Huawei unauthorized access to the carrier’s fixed-line network in Italy (...), according to Vodafone’s security briefing documents from 2009 and 2011 seen by Bloomberg”
privacy, sicurezza, spionaggio, virus
::: fabiochiusi ::: Slashdot

Vado a fare un giro
umorismo
::: BeppeBeppetti

UK police forces can use a ‘mobile phone extraction’ device to download all info on your phone, even if you’re a witness or victim of a crime - & often without informed consent
privacy, sicurezza, spionaggio, virus
::: privacyint

Yesterday #28A Spain went to the polls for #ElecionesGenerales, PI looked into how Spanish political parties are using online technologies and personal data to reach voters and conduct their campaigns
social media | politica
::: privacyint


Thanks to @maonus for showing me the most incredible talk I’ve seen in years. I am a huge fan of retrocomputing and spend a ton of time reading about computing history and old archs, but this blows it all out of the water. Watch til the end; it’s worth it
🤩 fantastico 🤩
storia | spazio, esplorazione
::: lexi_lambda

100% agree "Fake news is not a technological or scientific problem with a quick fix. It should be treated as a new kind of public health crises in all its [social] complexity", Samir Patel writes, the answer might be "increasing the immunity of citizens"
disinformazione, fake news, bufale | politica
::: rasmus_kleis

La velocità di adozione delle nuove #tecnologie sta crescendo sempre di più
innovazioni, futuro
::: Luca_Gualtieri1

Un Twitter libre, décentralisé, sans espionnite: Mastodon. A vous de jouer!
iscritto; provato ma non decolla
social media
::: davduf

Today's a big day in open-source history: #otd in 1993 @CERN released the source code for the World Wide Web for anyone to use
storia | Web, Internet
::: MIT_CSAIL

New project from @factchecknet: We combined five major lists of websites that repeatedly publish false or misleading information. The result: A database of 500+ unreliable news sources
disinformazione, fake news, bufale
::: dpfunke

Linux Release Roundup: Geary, Raven & Fedora 30
novità
::: dcavedon

SSE version of #simdjson ready! In included benchmarks, faster than #JSON alternatives. Exciting stuff, think I’m a #SIMD convert! Pending review by @lemire & @geofflangdale. Would love feedback from other folks too, @cowtowncoder interested?
programming, codice, snippet
::: sunnygleason

Non riesco a capacitarmi dell’autogol comunicativo di Facebook. Zuckerberg incentra tutto il suo speech a #F82019 sul motto “the future is private”. Che implica immediatamente una domanda: ma scusa, quindi stai ammettendo che ora FB non lo è?
Facebook
::: fabiochiusi

#SocialMedia in Italia, dati @AGCOMunica
social media
::: franzrusso

Mark Shuttleworth Sees Increased Demand For Enterprise Ubuntu Linux Desktop
Ubuntu
::: Slashdot

If I wasn't already in love with ArchLinux, I would likely be a Fedora user
Linux
::: WebReflection

Carlo Nardone

Print advertising – once the bedrock of all newspaper income - accounts for 8% of the company’s total revenue
Guardian breaks even helped by success of supporter strategy
media
::: fabiochiusi

Mark Zuckerberg ha cambiato idea sulla privacy
Facebook | social media
::: emenietti

These countries have the most robot workers
robots
::: wef

China blocks Facebook at home but enthusiastically uses it abroad: 5 out of 6 media outlets with the largest following are Chinese state-run
privacy, sicurezza, spionaggio, virus
::: Mantzarlis

I just released a library to make "ridge elevation plots" with Python and @matplotlib
Python
::: colindcarroll

Social media are a tool of US propaganda
social media
::: real_fabristol

Amazon Dismisses Idea Automation Will Eliminate All Its Warehouse Jobs Soon
robots
::: Slashdot

Your phone isn’t really spying on your conversations—the truth might be even creepier
privacy, sicurezza, spionaggio, virus
::: Gianlucadfiore

I don't know what's more depressing, this chart or the fact that people are trying to set fire to wood beams to 'prove' that the Notre Dame fire was a hoax
disinformazione, fake news, bufale
::: JaneLytv

These researchers want to study artificial intelligence systems in the same way we’ve always studied animals and humans: through empirical observation and experimentation
artificial intelligence
::: techreview

A Thiel-backed startup sells software that can recognize specific behaviors, like fighting, walking slowly when others are walking fast, virtually anything that aberrates from the norm
privacy, sicurezza, spionaggio, virus
::: FrankPasquale

People predict they (and others) wouldn’t unlock and hand over their phones if asked to in the course of an experiment
privacy, sicurezza, spionaggio, virus
::: zittrain

Saper ascoltare significa possedere
cit.
::: SergioGridelli

01 maggio, 2019

Creatività ovvero la programmazione dove non te l'aspetti


Cosa non sono capaci a fare i creativi! L'altro giorno ho visto una cosa che non so se sarò creduto ma la racconto lo stesso. Si può giudicare in modi diversi, io la metto nella categoria di quelli che hanno detto "💡idea!💡" quando hanno visto che si poteva fare il fuoco battendo due pietre o la ruota (la prima, non le successive re-invenzioni quotidiane). Vado con il racconto, semplifico di molto, non entro nei dettagli, solo l'idea.

Ci sono casi in cui la soluzione non è immediata, c'è la formula ma da quella non si ottiene subito quel che si cerca, per esempio  Riemann  Newton-Raphson. Ecco, qualcosa così; io che non sono tanto addentro --anzi è il mio primo aproccio-- mi limiterò a un esempio molto più semplice, un ciclo.

Il compito che mi propongo è di calcolare N2, N3 e √(N) per N intero da 1 a 10.
Nota: l'Unicode per √ è 0x221A.

Tra gli infiniti (quasi) linguaggi di programmazione userò VisiCalc, il foglio di calcolo, o meglio una sua evoluzione. In particolare il modulo Calc di LibreOffice, il mio giovane amico nerd usa Excel, sono perfettamente intercambiabili per quanto mi serve.

Lancio il programma e nella colonna A inserisco 1 e 2 nelle celle 2 e 3 peché nella prima riga inserirò i titoli delle colonne. Seleziono le due celle ed estendo la selezione (lo so che lo sapete, lo scrivo per me) a piacere; le celle vengono riempite con la serie desunta dalla selezione di partenza, nel mio caso la serie aritmetica [1..10].
I valori che voglio calcolare devo inserirli solo per la riga 2, quella per N = 1, rispettivamente:
  • cella B2: =A2*A2
  • cella C2: =B2*A2
  • cella D2: =RADQ(A2) #questo era difficile!

Adesso il bello: seleziono la regione B2-D2 e trascino verso il basso. Fatto 💥 la mia tabella è pronta, questa:


Ovviamente il caso che ho visto aveva una condizione/formula diversa, meno semplice ma concettualmente equivalente.

Fine del racconto; ma --personalmente-- un paio di considerazioni, assolutamente personali, nèh!
  • In casi come questo a me viene in mente (anzi no, c'è già da prima) di usare Python, interattivamente o costruendo uno script di poche righe; si può fare nello stesso modo anche con Windows, vero che Python dev'essere installato, esattamente come si è installato Office;
  • Python è una delle possibilità, ho visto che altri preferiscono/conoscono JavaScript (Node), MATLAB (in realtà Octave) o C++ (orrore, sì, qualcuno);
  • Per usare Excel (o equivalente) occorre apprenderlo, non è dato a priori. Dove viene insegnato, a scuola o nell'ambiente di lavoro? Perché non (anche) un linguaggio di programmazione (script)? Anzi, le macro del foglio di calcolo sono un linguaggio anche loro, e vengono usate (non sempre, magari copiate da chi sa farle).
Non si finisce mai d'imparare, ma tanto io sono vecchio, largo ai giovani 🧐

(devo ancora impratichirmi di Blogger, per esempio trovare le emoji che gli piacciono; le mie non me le colora 😡)
⭕