Visto nel Web – 293

Poche segnalazioni: la scuola o il caldo? probabilmente la scuola; ma fa anche caldo, tanto, troppo 😯 CMQ ecco cosa ho wisto nel Web 😉

The Plain Person’s Guide to Plain Text Social Science
#:tools, componenti software
::: kjhealy

A Wilson’s Algorithm maze laid out as its spanning tree
#:Web, Internet #:linguaggi di programmazione
::: rvosa

European Parliament Committee Recommends End-To-End Encryption For All Electronic Communications
#:sicurezza, spionaggio, virus
::: lumendatabase

Lo splendido post di @jeffjarvis sulle radici del problema “fake news” in italiano
#:fake news, bufale
::: fabiochiusi

Deep Root Analytics behind data breach on 198 million US voters
#:sicurezza, spionaggio, virus
::: fabiochiusi

Toward a Better Internet: Building Prosocial Behavior into the Commons
#:Web, Internet
::: creative commons

Is the absence of Zuck and any other FB rep a political statement?
#:economia #:politica
::: fabiochiusi

quando, nel 2017, nella sezione My Account un sito di ecommerce ti fa VEDERE la tua password, in chiaro, via http #rip #security
#:sicurezza, spionaggio, virus
::: fulcorno

EFF Launches New AI Progress Measurement Project
#:artificial intelligence
::: Slashdot ::: fabiochiusi

Comune from scratch
#:free open source software
::: dcavedon

How Microsoft Is Shifting Focus to Open Source
ma non era IL cancro? Ballmer!!!1!
#:free open source software
::: nicolaiarocci

The trhee language problem, and how Web Assembly will help solve it
#:linguaggi di programmazione
::: Almar’s

Top speed for top-k queries
#:linguaggi di programmazione
::: Daniel Lemire

Exciting new tool from the plotly team – Dash: a fully open source Python library for creating interactive web apps & dashboards!
#:linguaggi di programmazione #:Web, Internet
::: jakevdp

California May Restore Broadband Privacy Rules Killed By Congress and Trump
#:sicurezza, spionaggio, virus
::: Slashdot

New location for the Python dev guide!
#:linguaggi di programmazione
::: gvanrossum

Microsoft Admits Disabling Anti-Virus Software For Windows 10 Users
#:sicurezza, spionaggio, virus
::: Slashdot

A “Rosetta Stone for Visualization in Exploratory Data Analysis” — super useful resource!
#:linguaggi di programmazione
::: jakevdp

Ddl Orlando, ecco le conseguenze giudiziarie delle intercettazioni con trojan
#:sicurezza, spionaggio, virus
::: demartin

Ready for the Internet of Malware Things? “IoT goes nuclear: creating a ZigBee chain reaction”
#:sicurezza, spionaggio, virus
::: fulcorno

Ottima idea seguire il modello cinese!
#:censura
::: fabiochiusi

today i was playing with vue.js and i made a small whack-a-mole game!
#:linguaggi di programmazione
::: b0rk

Google to push for law enforcement to have more access to overseas data
#:dati, raccolta
::: fabiochiusi

If you use @npmjs, you MUST read this
#:linguaggi di programmazione
::: matteocollina

Zuckerberg getting explicitly political with new FB mantra “bring the world closer together”
#:ditte
::: fabiochiusi ::: fabiochiusi ::: fabiochiusi

The US Government Wants To Permanently Legalize the Right To Repair
#:economia
::: Slashdot

my favorite chapter in the rust-lang book
#:linguaggi di programmazione
::: arshia__

Linus Torvalds Explains How Linux Still Surprises and Motivates Him
#:protagonisti
::: Donearm

Chrome and Firefox Headless Modes May Spur New Adware & Clickfraud Tactics
#:sicurezza, spionaggio, virus
::: Slashdot

Io vorrei essere libero di installare sui miei dispositivi il software che preferisco
#:politica
::: anucara

Obama Authorized a Secret Cyber Operation Against Russia, Says Report
#:sicurezza, spionaggio, virus
::: Slashdot

FCC Grants OneWeb Approval To Launch Over 700 Satellites For ‘Space Internet’
#:Web, Internet
::: Slashdot

Tecniche di Programmazione – un corso Java online

Quando ero piccolo, ma nemmeno più tanto, mi sono iscritto al Poli, quello di Torino. Poi venuto il momento di scegliere –ricordo perfettamente– alla mamma avevo detto “sai ci sono i calcolatori elettronici…”. Faccio notare che allora alla tele e su Oggi venivano chiamati “cervelli elettronici” ma io ero ormai svezzato (un pochino).

La mamma –ricordo perfettamente– senza scomporsi, senza alterare la voce mi rispose “è solo una moda, un paio di anni e non se ne parlerà più”. Io ci avrei comunque messo più di un paio d’anni a finire e ho dato ragione alla mamma. Poi dopo mi sono rifatto; la previsione della mamma era sbagliata.

E ancora oggi, anche se no più nel mondo del lavoro, pasticco con i ‘puters, per esempio in questo blog. E faccio cose che allora non c’erano (cieè sì ma non per me). Per esempio il Lisp. O, meno esoticamente, Python. Con Python sto vedendo roba che allora facevo in Fortran; con la differenza che adesso fai un import e basta una chiamata a una funzione quando allora… OK, altri tempi.

Sul mio primo ‘puter (cioè il primo che ci pestavo i tasti) c’erano quattro linguaggi di programmazione ma si usavano solo il Fortran e un linguaggio di scripting interpretato, comodo perché interattivo, qualcosa di simile a Bash (o shell equivalente) perché l’interprete dei comandi non era programmabile.
Oggi invece a disposizione ce ne sono molti, molti di più di quelli che pensi. Tra i quali Java, uno che rockz! 🚀 assay 🚀 anzi di più 🚀

Con Java ho fatto qualcosa, quando era giovane, Ma non è mai stato tra i miei preferiti. Anche se usatissimo. Anche se c’è chi mi dice che se proprio voglio raccontare cose ci dovrei pensarci su 😎

Ma grossa novità, davvero una ***BREKKI NIUSS***, guarda qua: Tecniche di Programmazione 2016/2017.

L’autore del tweet è il titolare del corso di cui il tweet. E seguendo il link trovate i video di tutto il corso. Io per adesso ne ho visto quattro ore (4 video). Ottimi. Sapete come sono i prof (& aiutanti del prof) del Poli; anzi forse no ma ve lo dico io: ti dicono tutto quello che c’è da sapere così che all’esame hanno poi sempre ragione loro: “l’ho detto a lezione e c’è anche il video”, a differenza dei nastri di Ciump. Ovviamente mancano i laboratori, dove tu fai le cose e hai a disposizione un help fantastico (loro).

Il corso è per i gestionali, non si rischia di capitare tra gli über-nerds fanatici. E secondo me si può fare.

A differenza delle cose che faccio io sono applicazioni vere, in finestra, costruite in ambienti grafici (GUI) di uso professionale (tranquilli, free), il terminale ormai lo uso solo io. Quando ho iniziato il TTY era la novità, sostituiva le schede perforate da perforare con quella **BIP** di perforatrice; io sono rimasto fermo al allora. Anche se ho cambiato linguaggio, più volte.

Resta qualche mistero, per esempio: ma perché Windoze (OK, questa la so) 😊

:mrgreen:

SciPy – 10 – funzioni speciali

Continuo da qui, copio qui.

The main feature of the scipy.special package is the definition of numerous special functions of mathematical physics. Available functions include airy, elliptic, bessel, gamma, beta, hypergeometric, parabolic cylinder, mathieu, spheroidal wave, struve, and kelvin. There are also some low-level stats functions that are not intended for general use as an easier interface to these functions is provided by the stats module. Most of these functions can take array arguments and return array results following the same broadcasting rules as other math functions in Numerical Python. Many of these functions also accept complex numbers as input. For a complete list of the available functions with a one-line description type help(special), da me non funziona 😡 Each function also has its own documentation accessible using help. If you don’t see a function you need, consider writing it and contributing it to the library. You can write the function in either C, Fortran, or Python. Look in the source code of the library for examples of each of these kinds of functions.

Bessel
Bessel functions are a family of solutions to Bessel’s differential equation with real or complex order alpha:

Among other uses, these functions arise in wave propagation problems such as the vibrational modes of a thin drum head. Here is an example of a circular drum head anchored at the edge:

Inserisco il codice nel file bs.py che eseguo con python3 bs.py.

import numpy as np
from scipy import special
def drumhead_height(n, k, distance, angle, t):
    kth_zero = special.jn_zeros(n, k)[-1]
    return np.cos(t) * np.cos(n*angle) * special.jn(n, distance*kth_zero)

theta = np.r_[0:2*np.pi:50j]
radius = np.r_[0:1:50j]
x = np.array([r * np.cos(theta) for r in radius])
y = np.array([r * np.sin(theta) for r in radius])
z = np.array([drumhead_height(1, 1, r, theta, 0.5) for r in radius])

import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
fig = plt.figure()
ax = Axes3D(fig)
ax.plot_surface(x, y, z, rstride=1, cstride=1, cmap=cm.jet)
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
fig.savefig('sp32.png')

Ottengo un warning: UserWarning:
Matplotlib is building the font cache using fc-list. This may take a moment.
‘Matplotlib is building the font cache using fc-list.’

e alla fine ecco

Cython Bindings per funzioni special
Scipy also offers Cython bindings for scalar, typed versions of many of the functions in special. The following Cython code gives a simple example of how to use these functions:

Non ci sono riuscito. Se del caso sarà da approfondire ma la documentazione non mi sembra tanto chiara.

E così per tutto quanto riguarda Cython. Chissà se… È solo un problema di configurazione, pasticci dovuti ad Anaconda, se serve si può fare (cit.) 😯

:mrgreen:

JavaScript 78 – Tutto sulla programmazione nel browser – 2

Continuo da qui.

The dream behind the Web is of a common information space in which we communicate by sharing information. Its universality is essential: the fact that a hypertext link can point to anything, be it personal, local or global, be it draft or highly polished.
Tim Berners-Lee.

Ottima cit. per iniziare il capitolo su HTTP 😊
Poi Marijn spiega bene il protocollo HTTP, i messaggi che intercorrono tra te e il server e poi si arriva al browser con le URLs. Seguono XML, le request con sandox e le pomises. Infine un accenno alla sicurezza, argomento che andrebbe ampliato. Ma per intanto HTTPS.
Insomma un capitolo tutto da leggere e roba di tutti i giorni per tanti programmatori 😎

Intanto io passo al prossimo capitolo, le forms (le finestre di dialogo), per esempio


Le forms hanno diversi tipi di campi che vengono esaminati in dettaglio, per esempio

Ci sarebbero gli esercizi (Life di Conway) ma passo al prossimo capitolo, è un esercizio: A Paint Program per fare cose come questa:


Tanto JavaScript, da inserire in una pagina HTML. Per intanto pausa, poi si passerà a Node.js 😎

:mrgreen:

SciPy – 9 – funzioni base

Continuo da qui, copio qui.

Interazione con NumPy
Scipy builds on Numpy, and for all basic array handling needs you can use Numpy functions:

import numpy as np
np.some_function()

Rather than giving a detailed description of each of these functions (which is available in the Numpy Reference Guide or by using the help, info and source commands), this tutorial will discuss some of the more useful commands which require a little introduction to use to their full potential.

To use functions from some of the Scipy modules, you can do:

from scipy import some_module
some_module.some_function()

Trucchi
There are some class instances that make special use of the slicing functionality to provide efficient means for array construction. This part will discuss the operation of np.mgrid, np.ogrid, np.r_, and np.c_ for quickly constructing arrays.

For example, rather than writing something like the following

a = np.concatenate(([3], [0]*5, np.arange(-1, 1.002, 2/9.0)))

with the r_ command one can enter this as

a = np.r_[3,[0]*5,-1:1:10j]

which can ease typing and make for more readable code. Notice how objects are concatenated, and the slicing syntax is (ab)used to construct ranges. The other term that deserves a little explanation is the use of the complex number 10j as the step size in the slicing syntax. This non-standard use allows the number to be interpreted as the number of points to produce in the range rather than as a step size (note we would have used the long integer notation, 10L, but this notation may go away in Python as the integers become unified). This non-standard usage may be unsightly to some, but it gives the user the ability to quickly construct complicated vectors in a very readable fashion. When the number of points is specified in this way, the end- point is inclusive.

The “r” stands for row concatenation because if the objects between commas are 2 dimensional arrays, they are stacked by rows (and thus must have commensurate columns). There is an equivalent command c_ that stacks 2d arrays by columns but works identically to r_ for 1d arrays

Another very useful class instance which makes use of extended slicing notation is the function mgrid. In the simplest case, this function can be used to construct 1d ranges as a convenient substitute for arange. It also allows the use of complex-numbers in the step-size to indicate the number of points to place between the (inclusive) end-points. The real purpose of this function however is to produce N, N-d arrays which provide coordinate arrays for an N-dimensional volume. The easiest way to understand this is with an example of its usage:

Having meshed arrays like this is sometimes very useful. However, it is not always needed just to evaluate some N-dimensional function over a grid due to the array-broadcasting rules of Numpy and SciPy. If this is the only purpose for generating a meshgrid, you should instead use the function ogrid which generates an “open” grid using newaxis judiciously to create N, N-d arrays where only one dimension in each array has length greater than 1. This will save memory and create the same result if the only purpose for the meshgrid is to generate sample points for evaluation of an N-d function.

Manipolazione della forma
In this category of functions are routines for squeezing out length- one dimensions from N-dimensional arrays, ensuring that an array is at least 1-, 2-, or 3-dimensional, and stacking (concatenating) arrays by rows, columns, and “pages “(in the third dimension). Routines for splitting arrays (roughly the opposite of stacking arrays) are also available.

Polinomi
There are two (interchangeable) ways to deal with 1-d polynomials in SciPy. The first is to use the poly1d class from Numpy. This class accepts coefficients or polynomial roots to initialize a polynomial. The polynomial object can then be manipulated in algebraic expressions, integrated, differentiated, and evaluated. It even prints like a polynomial:

The other way to handle polynomials is as an array of coefficients with the first element of the array giving the coefficient of the highest power. There are explicit functions to add, subtract, multiply, divide, integrate, differentiate, and evaluate polynomials represented as sequences of coefficients.

Vettorializzare funzioni
One of the features that NumPy provides is a class vectorize to convert an ordinary Python function which accepts scalars and returns scalars into a “vectorized-function” with the same broadcasting rules as other Numpy functions (i.e. the Universal functions, or ufuncs). For example, suppose you have a Python function named addsubtract defined as:

which defines a function of two scalar variables and returns a scalar result. The class vectorize can be used to “vectorize“ this function so that vec_addsubtract = np.vectorize(addsubtract) returns a function which takes array arguments and returns an array result:

This particular function could have been written in vector form without the use of vectorize. But, what if the function you have written is the result of some optimization or integration routine. Such functions can likely only be vectorized using vectorize.

Gestione dei tipi
Note the difference between np.iscomplex / np.isreal and np.iscomplexobj / np.isrealobj. The former command is array based and returns byte arrays of ones and zeros providing the result of the element-wise test. The latter command is object based and returns a scalar describing the result of the test on the entire object.

Often it is required to get just the real and/or imaginary part of a complex number. While complex numbers and arrays have attributes that return those values, if one is not sure whether or not the object will be complex-valued, it is better to use the functional forms np.real and np.imag. These functions succeed for anything that can be turned into a Numpy array. Consider also the function np.real_if_close which transforms a complex-valued number with tiny imaginary part into a real number.

Occasionally the need to check whether or not a number is a scalar (Python (long)int, Python float, Python complex, or rank-0 array) occurs in coding. This functionality is provided in the convenient function np.isscalar which returns a 1 or a 0.

Finally, ensuring that objects are a certain Numpy type occurs often enough that it has been given a convenient interface in SciPy through the use of the np.cast dictionary. The dictionary is keyed by the type it is desired to cast to and the dictionary stores functions to perform the casting. Thus, np.cast['f'](d) returns an array of np.float32 from d. This function is also useful as an easy way to get a scalar of a certain type:

Altre funzioni utili
There are also several other useful functions which should be mentioned. For doing phase processing, the functions angle, and unwrap are useful. Also, the linspace and logspace functions return equally spaced samples in a linear or log scale. Finally, it’s useful to be aware of the indexing capabilities of Numpy. Mention should be made of the function select which extends the functionality of where to include multiple conditions and multiple choices. The calling convention is select(condlist,choicelist,default=0). select is a vectorized form of the multiple if-statement. It allows rapid construction of a function which returns an array of results based on a list of conditions. Each element of the return array is taken from the array in a choicelist corresponding to the first condition in condlist that is true. For example

Some additional useful functions can also be found in the module scipy.misc. For example the factorial and comb functions compute n! and n!/k!(n−k)! using either exact integer arithmetic (thanks to Python’s Long integer object), or by using floating-point precision and the gamma function. Another function returns a common image used in image processing: lena.

Finally, two functions are provided that are useful for approximating derivatives of functions using discrete-differences. The function central_diff_weights returns weighting coefficients for an equally-spaced N-point approximation to the derivative of order o. These weights must be multiplied by the function corresponding to these points and the results added to obtain the derivative approximation. This function is intended for use when only samples of the function are available. When the function is an object that can be handed to a routine and evaluated, the function derivative can be used to automatically evaluate the object at the correct points to obtain an N-point approximation to the o-th derivative at a given point.

:mrgreen:

JavaScript 77 – Tutto sulla programmazione nel browser – 1

Continuo da qui.

Il progetto di un gioco nel browser
My initial fascination with computers, like that of many kids, originated with computer games. I was drawn into the tiny computer-simulated worlds that I could manipulate and in which stories (sort of) unfolded—more, I suppose, because of the way I could project my imagination into them than because of the possibilities they actually offered.

Comincia così il prossimo capitolo di Marijn 🚀 e continua dicendo:

This chapter will walk through the implementation of a simple platform game. Platform games (or “jump and run” games) are games that expect the player to move a figure through a world, which is often two-dimensional and viewed from the side, and do lots of jumping onto and over things.

E il gioco lo fa tutto e rockz 🚀 tutto da giocarci 😊 e studiarlo se si vuole approfondire JavaScript e diventare very über nerd 😊

Siccome è troppo specifico non lo copio, vedetelo di là.

Anche il capitolo successivo, disegnare sul canvas è specialistico; siccome riguarda solo il browser lo vedete di là, vero? 😎

Ebbene sì, sono giunto a qualcosa fuori dal mio mondo, anche se non si è interessati a programmare per il browser sono cose da leggere, perché si usano continuamente. E ormai i nuovi sono tutti sul Web (OK, quasi). Pausa, devo leggere anch’io 😯

:mrgreen:

Fahrenheit to Celsius

Ieri faceva così caldo che non vi dico; proprio da solstizio. In questi casi l’idea di viaggiare con il bus è pessima se capita che i finestrini non si possono aprire e l’impianto di condizionamento non funzioni. A peggiorare il tutto il mio giovane compagno di sventura legge le brekkiniuss sul telefono: in Arizona fa così caldo che gli aerei non possono decollare, 120 gradi Fahrenheit.

Uh! peggio di noi, forse; quanto fa? Velocissimo con una googlata, 48°C.

Ma mi sono preso la rivincita; o almeno ci ho provato. Come fai a passare da una scala all’altra, basta uno script per quella formula semplicissima… 😊

Ora sembra che io sia prevenuto su certe cose come Micro$oft, la scuola, lo zeitgeist tutto ma la soluzione che mi ha prontamente fornito —N.B.: quelli di una certa età deboli di cuore valutino se continuare a leggere, avvisati nèh!— non l’avrei mai immaginata: ha usato un foglio di calcolo, tipo Excel 😯

Io non ero attrezzato al momento ma appena giunti a destinazione l’ho indottrinato, come si deve fare, o si dovrebbe o –almeno– si potrebbe. Basta uno script Bash, con Linux, ovvio.

f2c

#!/bin/bash
if [[ $# -eq 0 ]]; then
    exit 2
fi
    
F=$1
let C="$((($F-32) * 5 / 9))"
echo $F"°F ->" $C"°C"

e per la conversione inversa

c2f

#!/bin/bash
if [[ $# -eq 0 ]]; then
    exit 2
fi
    
C=$1
let F="$(($C * 9 / 5 + 32))"
echo $C"°C ->" $F"°F"

Sì c’è un arrotondamento, si usano gli interi, troncando. Ma volendo essere più precisi ci sono tanti linguaggi –parte lasciata come esercizio 😜 Anche perché qui fa molto caldo 😊

Aggiornamento: l’amico Flavio, the Man from Mars cinguettaGuida per l’Utente del C64 pag. 35. Ai tempi del C64 la conversione °F/°C era già un classico. Il foglio di calcolo è un’esagerazione!
E sì, io sono più vecchio, allora ero alle prese con il Fortran per le stesse cose che adesso vedo e rivedo con Python. Niente C64 ma ho pasticciato con il Vic20 (in Forth).
Tutti d’accordo sull’esagerazione. Non serve Excel, basta VisiCalc 😉

Aggiornamento: lunga conversazione con il giovane amico; ha ragione lui, sono stato parziale, con il telefono mica puoi fare certe cose…
Vero anche che –ma non apriamo un’altra tirata 😊
CMQ (cit.) un modo veloce, disponibile per tutti, al volo:

js-repl
Ah! sembra che la notizia sia confermata.

:mrgreen:

SICP – cap. 2 – Sequenze come interfacce convenzionali – 47 – esercizi

Continuo da qui, copio qui.

Exercise 2.38: The accumulate procedure is also known as fold-right, because it combines the first element of the sequence with the result of combining all the elements to the right. There is also a fold-left, which is similar to fold-right, except that it combines elements working in the opposite direction:

(define (fold-left op initial sequence)
  (define (iter result rest)
    (if (null? rest)
        result
        (iter (op result (car rest))
              (cdr rest))))
  (iter initial sequence))

What are the values of

(fold-right / 1 (list 1 2 3))
(fold-left  / 1 (list 1 2 3))
(fold-right list nil (list 1 2 3))
(fold-left  list nil (list 1 2 3))

Give a property that op should satisfy to guarantee that fold-right and fold-left will produce the same values for any sequence.

Intanto ricopio la procedura accumuate rinominandola fold-right

(define (fold-right op initial sequence)
   (if (null? sequence)
       initial
       (op (car sequence)
           (fold-right op initial (cdr sequence)))))

inoltre in Racket non è definito nil ma null.

Ed ecco:

OK, le due procedure danno risultati diversi. Allora… op dev’essere … proprio come dice Bill the Lizard: The property that will guarantee that fold-right and fold-left will produce the same values for any sequence is commutativity. You may remember the commutative property of both addition and multiplication from algebra. It’s the law that says that: A + B = B + A and A x B = B x A.
Subtraction and division are not commutative operations. The AND and OR operations in Boolean algebra are commutative.


OK anche sicp-ex e Drewiki.

Ripensandoci 😜 Racket ha le due procedure, com’era logico supporre:

Ripensandoci ancora: l’esercizio non è sul Lisp, non è sulla programmazione ma per vedere se l’allievo si applica e ragiona. Cosa che onestamente —ahemmm…– ci sono arrivato solo dopo ore, in viaggio con un caldo da solstizio, afa, condizionatore che non funziona e non si possono abbassare i finestrini. Devo affrontare diversamente SICP, demitizzarlo ma impegnarmi di più; chissà come facevano gli studenti; chissà come fanno adesso 😯

:mrgreen:

JavaScript 76 – gestione degli eventi (nel browser)

Continuo da qui, copio qui.

Some programs work with direct user input, such as mouse and keyboard interaction. The timing and order of such input can’t be predicted in advance. This requires a different approach to control flow than the one we have used so far.

, quasi tutti i programmi funzionano così. Fanno eccezione i comandi da terminale e pochi altri. Qui, seguendo Marijn, qualche cenno, sempre relativo al browser.

Gestori di eventi
Imagine an interface where the only way to find out whether a key on the keyboard is being pressed is to read the current state of that key. To be able to react to keypresses, you would have to constantly read the key’s state so that you’d catch it before it’s released again. It would be dangerous to perform other time-intensive computations since you might miss a keypress.

That is how such input was handled on primitive machines. A step up would be for the hardware or operating system to notice the keypress and put it in a queue. A program can then periodically check the queue for new events and react to what it finds there.

Of course, it has to remember to look at the queue, and to do it often, because any time between the key being pressed and the program noticing the event will cause the software to feel unresponsive. This approach is called polling. Most programmers avoid it whenever possible.

A better mechanism is for the underlying system to give our code a chance to react to events as they occur. Browsers do this by allowing us to register functions as handlers for specific events.

The addEventListener function registers its second argument to be called whenever the event described by its first argument occurs.

Segue una lunga lezione, esaustiva, che non riporto. Al solito –mi ripeto– sto solo vedendo il linguaggio JavaScript per apprenderne le basi. Riporto solo le conclusioni di Marijn 🚀

Event handlers make it possible to detect and react to events we have no direct control over. The addEventListener method is used to register such a handler.

Each event has a type ("keydown", "focus", and so on) that identifies it. Most events are called on a specific DOM element and then propagate to that element’s ancestors, allowing handlers associated with those elements to handle them.

When an event handler is called, it is passed an event object with additional information about the event. This object also has methods that allow us to stop further propagation (stopPropagation) and prevent the browser’s default handling of the event (preventDefault).

Pressing a key fires "keydown", "keypress", and "keyup" events. Pressing a mouse button fires "mousedown", "mouseup", and "click" events. Moving the mouse fires “mousemove” and possibly "mouseenter" and "mouseout" events.

Scrolling can be detected with the "scroll" event, and focus changes can be detected with the "focus" and "blur" events. When the document finishes loading, a “load” event fires on the window.

Only one piece of JavaScript program can run at a time. Thus, event handlers and other scheduled scripts have to wait until other scripts finish before they get their turn.

:mrgreen:

cit. & loll – 49

Caldo, troppo, roba da solstizio 😯 Ma ecco cit. & loll fresco-fresco 😎

Same with me always
::: Google+

Once a new technology rolls over you
::: CodeWisdom

List your most used commands (sorted)
::: NabilElqatib

docx received, 2 pages, no images: size 150kb
::: zacchiro

Google begins beta testing “feudalism”
::: leemkuilschu

#CJEU looks at knowledge & intent in #PirateBay #copyright case
::: FixIt_EU

Pretty sure they’re just trolling at this point
::: lizardbill

Party Time
::: CommitStrip

Declaring absolutely that your systems have not been compromised by a highly sophisticated intelligence service
::: JohnHultquist

Dear young person, if you are a geek, the world needs you
::: CodeWisdom

The two hardest things in Computer Science
::: listrophy

“Russian Hackers” is mainstream media equivalent of “The Jews”. You can blame them for anything you want, facts don’t matter
::: t_a_w

Water drops create beautiful human-like animations
::: ValaAfshar

Non Sequitur
::: GoComics

I love the moment when I come home from a bookstore with an armful of great new books and settle down to vacantly scroll Twitter for 3 hours
::: sadydoyle

The generation of random numbers is too important to be left to chance
::: alienoid

Remember the following classic C data types, it could save your life
::: Lioncache

I am a 10X developer
::: discostu105

After refreshing my C++ knowledge on C++14/17 …
::: thek3nger

The Life of a Project
::: Jonahlobe

Home is where your devices are plugged in
::: GonzoHacker

URGENT: the Internet is doomed, unless we save it. July 12 defend #NetNeutrality!
::: dcavedon