Racket – Espressioni regolari – 3

Prima Nugroho

Prima Nugroho

Proseguo, oggi qui: [doc]/guide/regexp.html, anzi qui: [doc]/guide/regexp-assert.html.

Indicazioni elementari

Basic Assertions dice la guida, dimmi te come si fa a tradurre? Anche perché poi sono le regole usuali di sempre, forse.

The assertions ^ and $ identify the beginning and the end of the text string, respectively. They ensure that their adjoining regexps match at one or other end of the text string:

re13

The regexp above fails to match because contact does not occur at the beginning of the text string. In

re14

the regexp matches the last laugh.

The metasequence \b asserts that a word boundary exists, but this metasequence works only with #px syntax. In

re15

the yack in yackety doesn’t end at a word boundary so it isn’t matched. The second yack does and is.

Ecco, questa è nuova :wink: mai fidarsi dei racketeers, sono troppo nerds :wink:

The metasequence \B (also #px only) has the opposite effect to \b; it asserts that a word boundary does not exist. In

re16

the an that doesn’t end in a word boundary is matched.

OK, pronto a passare alla prossima pagina, questa: [doc]/guide/regexp-chars.html.

Caratteri e classi di caratteri

Typically, a character in the regexp matches the same character in the text string. Sometimes it is necessary or convenient to use a regexp metasequence to refer to a single character. For example, the metasequence \. matches the period character.

The metacharacter . matches any character (other than newline in multi-line mode):

re17

The above pattern also matches pat, pit, pot, put, and p8t, but not peat or pfffft.

A character class matches any one character from a set of characters. A typical format for this is the bracketed character class [...], which matches any one character from the non-empty sequence of characters enclosed within the brackets. Thus, #rx"p[aeiou]t" matches pat, pet, pit, pot, put, and nothing else.

re18

Inside the brackets, a - between two characters specifies the Unicode range between the characters. For example, #rx"ta[b-dgn-p]" matches tab, tac, tad, tag, tan, tao, and tap.

re19

An initial ^ after the left bracket inverts the set specified by the rest of the contents; i.e., it specifies the set of characters other than those identified in the brackets. For example, #rx"do[^g]" matches all three-character sequences starting with do except dog.

re20

Note that the metacharacter ^ inside brackets means something quite different from what it means outside. Most other metacharacters (., *, +, ?, etc.) cease to be metacharacters when inside brackets, although you may still escape them for peace of mind. A - is a metacharacter only when it’s inside brackets, and when it is neither the first nor the last character between the brackets.

Bracketed character classes cannot contain other bracketed character classes (although they contain certain other types of character classes; see below). Thus, a [ inside a bracketed character class doesn’t have to be a metacharacter; it can stand for itself. For example, #rx"[a[b]" matches a, [, and b.

Furthermore, since empty bracketed character classes are disallowed, a ] immediately occurring after the opening left bracket also doesn’t need to be a metacharacter. For example, #rx"[]ab]" matches ], a, and b.

Insomma non più sempici del solito :roll:

Alcune classi di caratteri usate sovente

In #px syntax, some standard character classes can be conveniently represented as metasequences instead of as explicit bracketed expressions: \d matches a digit (the same as [0-9]); \s matches an ASCII whitespace character; and \w matches a character that could be part of a “word”.

Following regexp custom, we identify “word” characters as [A-Za-z0-9_], although these are too restrictive for what a Racketeer might consider a “word.”

The upper-case versions of these metasequences stand for the inversions of the corresponding character classes: \D matches a non-digit, \S a non-whitespace character, and \W a non-“word” character.

Remember to include a double backslash when putting these metasequences in a Racket string:

re21

These character classes can be used inside a bracketed expression. For example, #px"[a-z\\d]" matches a lower-case letter or a digit.

Classi di caratteri POSIX

A POSIX character class is a special metasequence of the form [:...:] that can be used only inside a bracketed expression in #px syntax. The POSIX classes supported are:

[:alnum:] — ASCII letters and digits
[:alpha:] — ASCII letters
[:ascii:] — ASCII characters
[:blank:] — ASCII widthful whitespace: space and tab
[:cntrl:] — “control” characters: ASCII 0 to 32
[:digit:] — ASCII digits, same as \d
[:graph:] — ASCII characters that use ink
[:lower:] — ASCII lower-case letters
[:print:] — ASCII ink-users plus widthful whitespace
[:space:] — ASCII whitespace, same as \s
[:upper:] — ASCII upper-case letters
[:word:] — ASCII letters and _, same as \w
[:xdigit:] — ASCII hex digits

For example, the #px"[[:alpha:]_]" matches a letter or underscore.

re22

The POSIX class notation is valid only inside a bracketed expression. For instance, [:alpha:], when not inside a bracketed expression, will not be read as the letter class. Rather, it is (from previous principles) the character class containing the characters :, a, l, p, h.

re23

Sono sicuro che non sono il solo a pasticciare qui :roll:

:mrgreen:

Un quiz, soluzioni con Python e Racket

bach-origTrovare quel numero che diviso per 2 ha come resto 1, diviso per 3 ha sempre resto 1, e ugualmente diviso per 4, per 5 o per 6 ha sempre resto 1, ma se viene divso per sette dà resto zero.
Federico Peiretti, Il matematico si diverte, Longanesi 2010, p.83. riferito a Claude-Gaspard Bachet.

Diophantus-cover

Claude-Gaspard Bachet è un matemeatico (e non solo) importante, che giustifica l’uso del quiz molto semplice ma devo fare pratica; e poi c’era anche il mio amico GG (prossimamente, forse…).

Ancora una cosa: l’immagine iniziale è presa da Gallica, qui.

Sono anche in regola con le condizioni d’uso. E grazie Gallica e Bibliothèque nationale de France :grin:

Ah! il problema lo trovate a p.199 del libro originale corrispondente a p.218 del PDF.

OK, siccome sono niubbo provo prima con Python.
Occorre trovare quel numero divisibile per 7 che ha modulo 1 per il minimo comune multiplo di {2, 3, 4, 5, 6}. La funzione per il calcolo del minimo comune multiplo (lcm) l’ho copiata da Rosetta Code.

Quindi ecco, Python, cgb.py:

#/usr/bin/python3

def lcm(*values):
	values = set([abs(int(v)) for v in values])
	if values and 0 not in values:
		n = n0 = max(values)
		values.remove(n)
		while any( n % m for m in values ):
			n += n0
		return n
	return 0

#main
mcm = lcm(2, 3, 4, 5, 6)
found = False
n = 0
while not found:
	n += 1
	found = ((mcm * n + 1) % 7) == 0
print(mcm * n + 1)

py

E con Racket? bèh, qui sono ancora un po’ (tanto) niubbo ma insomma…

E poi c’è la reference in locale, comodissima:

doc

Sì, bash si lamenta di Firefox ma solo per far vedere che c’è anche lui…

Ma Racket? OK, ecco cgb.rkt:

#lang racket

(define mcm (lcm 2 3 4 5 6))
(define num
  (let cgb ([n 1])
    (if (positive? (modulo (add1 (* n mcm)) 7))
      (cgb (add1 n))
      (add1 (* n mcm)))))
(print num)
(newline)   

rkt
La funzione per il calcolo del minimo comune multiplo (lcm) è predefinita :grin:
Il codice è elementare, da niubbo, costruito traducendo quello di Python. Ho usato troppe variabili; ho ripetuto un calcolo numerico una volta più del necessario. Prometto solennemente che in futuro sarò più funzionale.
Giustificazioni: 1) sono niubbo; 2) stavo propagandando Racket a una possibile vittima; con 3) paura di fare una figuraccia.
Poi a demo fatta ho dimenticato il tutto per una settimana, quasi. Ma devo fare pratica, per questo lo pubblico anche se non ottimale :mrgreen:

Nota: corretto un erroraccio, avevo scritto “divisore” al posto di “multiplo”. Grazie a Roberto Giacomelli :grin:

Racket – Espressioni regolari – 2

kk6Oggi, proseguo da qui, copiando qui: [doc]/guide/regexp.html, in particolare qui: [doc]/guide/regexp-match.html.

Usare espressioni regolari

The regexp-match-positions function takes a regexp pattern and a text string, and it returns a match if the regexp matches (some part of) the text string, or #f if the regexp did not match the string. A successful match produces a list of index pairs.

re1

In the second example, the integers 4 and 10 identify the substring that was matched. The 4 is the starting (inclusive) index, and 10 the ending (exclusive) index of the matching substring:

re2

In this first example, regexp-match-positions’s return list contains only one index pair, and that pair represents the entire substring matched by the regexp. When we discuss subpatterns later, we will see how a single match operation can yield a list of submatches.

The regexp-match-positions function takes optional third and fourth arguments that specify the indices of the text string within which the matching should take place.

re3

(il carattere ventesimo è “m” di “my“, il 39esimo lo spazio che precede “stack“)
Note that the returned indices are still reckoned relative to the full text string.

The regexp-match function is like regexp-match-positions, but instead of returning index pairs, it returns the matching substrings:

re4

When regexp-match is used with byte-string regexp, the result is a matching byte substring:

re5

Note: A byte-string regexp can be applied to a string, and a string regexp can be applied to a byte string. In both cases, the result is a byte string. Internally, all regexp matching is in terms of bytes, and a string regexp is expanded to a regexp that matches UTF-8 encodings of characters. For maximum efficiency, use byte-string matching instead of string, since matching bytes directly avoids UTF-8 encodings.

If you have data that is in a port, there’s no need to first read it into a string. Functions like regexp-match can match on the port directly:

re6

The regexp-match? function is like regexp-match-positions, but simply returns a boolean indicating whether the match succeeded:

re7

The regexp-split function takes two arguments, a regexp pattern and a text string, and it returns a list of substrings of the text string; the pattern identifies the delimiter separating the substrings.

re8

If the first argument matches empty strings, then the list of all the single-character substrings is returned.

re9

Thus, to identify one-or-more spaces as the delimiter, take care to use the regexp #rx" +", not #rx" *".

re10

The regexp-replace function replaces the matched portion of the text string by another string. The first argument is the pattern, the second the text string, and the third is either the string to be inserted or a procedure to convert matches to the insert string.

re11

notare l’Unicode nella prima e il . nella seconda (almeno io ci ho dovuto far mente locale).

The regexp-replace* function replaces all matches in the text string by the insert string:

re12

Uhmmm… sì ho messo gli accenti e notare le parentesi quadre, credo se ne parlerà prossimamente :mrgreen:

Racket – Espressioni regolari – 1

click

Capitolo nuovo, argomento classico e panicante, RE o regexp, qui, [doc]/guide/regexp.html.

La guida ci ricorda che questa (o meglio lei) è una versione modificata di un classico: Dorai Sitaram, “pregexp: Portable Regular Expressions for Scheme and Common Lisp.” 2002.

A regexp value encapsulates a pattern that is described by a string or byte string. The regexp matcher tries to match this pattern against (a portion of) another string or byte string, which we will call the text string, when you call functions like regexp-match. The text string is treated as raw text, and not as a pattern.

La guida ne parla diffusamente ma se non bastasse: Regular Expressions in The Racket Reference provides more on regexps, qui [doc]/reference/regexp.html.

OK, passo a [doc]/guide/regexp-intro.html dove trovo…

Scrivere regexp

Un paio di cose: userò regexp anch’io e poi il “patterns” del titolo originale –al solito– uhmmm, schemi, modelli, ___________.

A string or byte string can be used directly as a regexp pattern, or it can be prefixed with #rx to form a literal regexp value. For example, #rx"abc" is a string-based regexp value, and #rx#"abc" is a byte string-based regexp value. Alternately, a string or byte string can be prefixed with #px, as in #px"abc", for a slightly extended syntax of patterns within the string.

Most of the characters in a regexp pattern are meant to match occurrences of themselves in the text string. Thus, the pattern #rx"abc" matches a string that contains the characters a, b, and c in succession. Other characters act as metacharacters, and some character sequences act as metasequences. That is, they specify something other than their literal selves. For example, in the pattern #rx"a.c", the characters a and c stand for themselves, but the metacharacter . can match any character. Therefore, the pattern #rx"a.c" matches an a, any character, and c in succession.

Note: When we want a literal \ inside a Racket string or regexp literal, we must escape it so that it shows up in the string at all. Racket strings use \ as the escape character, so we end up with two \s: one Racket-string \ to escape the regexp \, which then escapes the .. Another character that would need escaping inside a Racket string is ".

If we needed to match the character . itself, we can escape it by precede it with a \. The character sequence \. is thus a metasequence, since it doesn’t match itself but rather just .. So, to match a, ., and c in succession, we use the regexp pattern #rx"a\\.c"; the double \ is an artifact of Racket strings, not the regexp pattern itself.

The regexp function takes a string or byte string and produces a regexp value. Use regexp when you construct a pattern to be matched against multiple strings, since a pattern is compiled to a regexp value before it can be used in a match. The pregexp function is like regexp, but using the extended syntax. Regexp values as literals with #rx or #px are compiled once and for all when they are read.

The regexp-quote function takes an arbitrary string and returns a string for a pattern that matches exactly the original string. In particular, characters in the input string that could serve as regexp metacharacters are escaped with a backslash, so that they safely match only themselves.

re0

The regexp-quote function is useful when building a composite regexp from a mix of regexp strings and verbatim strings.

Pausa, argomento nuovo (cioè no ma ogni linguaggio lo tratta a modo suo, piccole (o meno piccole) varianti rispetto alla versione cannica, Stephen Kleene, AWK e Perl).

:mrgreen:

Racket – Input e Output – 3

kepler

Continuando da qui oggi –forse– finisco il capitolo di I/O, qui: [doc]/guide/i_o.html anzi qui: [doc]/guide/serialization.html.

Tipi di dati e serializzazione

Che sarebbe la mia traduzione di Datatypes and Serialization.
prefab structure types (see Prefab Structure Types, [qui: [doc]/guide/define-struct.html)] automatically support serialization: they can be written to an output stream, and a copy can be read back in from an input stream:

io21

Other structure types created by struct, which offer more abstraction than prefab structure types, normally write either using #<....> notation (for opaque structure types) or using #(....) vector notation (for transparent structure types). In neither can the result be read back in as an instance of the structure type:

io22

oops! ma

io23

The serializable-struct form defines a structure type that can be serialized to a value that can be printed using write and restored via read. The serialized result can be deserialized to get back an instance of the original structure type. The serialization form and functions are provided by the racket/serialize library.

io24

In addition to the names bound by struct, serializable-struct binds an identifier with deserialization information, and it automatically provides the deserialization identifier from a module context. This deserialization identifier is accessed reflectively when a value is deserialized.

Uhmmm… da pensarci su un po’.
Intanto passo a [doc]/guide/encodings.html.

bytes, characters e encoding

Functions like read-line, read, display, and write all work in terms of characters (which correspond to Unicode scalar values). Conceptually, they are implemented in terms of read-char and write-char.

More primitively, ports read and write bytes, instead of characters. The functions read-byte and write-byte read and write raw bytes. Other functions, such as read-bytes-line, build on top of byte operations instead of character operations.

In fact, the read-char and write-char functions are conceptually implemented in terms of read-byte and write-byte. When a single byte’s value is less than 128, then it corresponds to an ASCII character. Any other byte is treated as part of a UTF-8 sequence, where UTF-8 is a particular standard way of encoding Unicode scalar values in bytes (which has the nice property that ASCII characters are encoded as themselves). Thus, a single read-char may call read-byte multiple times, and a single write-char may generate multiple output bytes.

The read-char and write-char operations always use a UTF-8 encoding. If you have a text stream that uses a different encoding, or if you want to generate a text stream in a different encoding, use reencode-input-port or reencode-output-port. The reencode-input-port function converts an input stream from an encoding that you specify into a UTF-8 stream; that way, read-char sees UTF-8 encodings, even though the original used a different encoding. Beware, however, that read-byte also sees the re-encoded data, instead of the original byte stream.

OK, infine [doc]/guide/io-patterns.html.

Patterns di I/O

If you want to process individual lines of a file, then you can use for with in-lines:

io25

If you want to determine whether “hello” appears in a file, then you could search separate lines, but it’s even easier to simply apply a regular expression (see Regular Expressions [prossimamente]) to the stream:

io26

If you want to copy one port into another, use copy-port from racket/port, which efficiently transfers large blocks when lots of data is available, but also transfers small blocks immediately if that’s all that is available:

io27

:mrgreen:

Racket – Input e Output – 2

kk0Continuo da qui, oggi qui: [doc]/guide/i_o.html, anzi in dettaglio qui:[doc]/guide/default-ports.html.

Porte di default

For most simple I/O functions, the target port is an optional argument, and the default is the current input port or current output port. Furthermore, error messages are written to the current error port, which is an output port. The current-input-port, current-output-port, and current-error-port functions return the corresponding current ports.

io9

If you start the racket program in a terminal, then the current input, output, and error ports are all connected to the terminal. More generally, they are connected to the OS-level stdin, stdout, and stderr. In this guide, the examples show output written to stdout in purple, and output written to stderr in red italics.

 

io10

OOPS! non vale quanto detto nella guida; non da me. Provato a eseguirla anche come script con lo stesso risultato. Ma who cares? :wink:

The current-port functions are actually parameters, which means that their values can be set with parameterize.

Note: See Dynamic Binding [doc]/guide/parameterize.html: parameterize for an introduction to parameters.

Example: Attenzione!!! con questo esempio (dopo averlo modificato per completarlo) sono riuscito a bloccare il ‘puter in modo assoluto e sono ricorso all’hard reset; rimandato quindi a quando sarò meno niubbo :wink:

(let ([s (open-output-string)])
    (parameterize ([current-error-port s])
      (swing-hammer)
      (swing-hammer)
      (swing-hammer))
    (get-output-string s))

Ma mica finisce qui, anzi passo subito alla pagina successiva: [doc]/guide/read-write.html.

Leggere e scrivere dati

As noted throughout Built-In Datatypes [Racket – tipi di dati built-in – 1], Racket provides three ways to print an instance of a built-in value:

  • print, which prints a value in the same way that is it printed for a REPL result; and
  • write, which prints a value in such a way that read on the output produces the value back; and
  • display, which tends to reduce a value to just its character or byte content—at least for those datatypes that are primarily about characters or bytes, otherwise it falls back to the same output as write.

Here are some examples using each:

io11-17

Overall, print corresponds to the expression layer of Racket syntax, write corresponds to the reader layer, and display roughly corresponds to the character layer.

The printf function supports simple formatting of data and text. In the format string supplied to printf, ~a displays the next argument, ~s writes the next argument, and ~v prints the next argument:

io18

After using write, as opposed to display or print, many forms of data can be read back in using read. The same values printed can also be parsed by read, but the result may have extra quote forms, since a printed form is meant to be read like an expression:

io19

:mrgreen:

Una nota sulla gestione dei files e su Racket tutto

john-belushi-college-obama-posterIl post iniziale sull’I/O mi ha lasciato un qualcosa in sospeso.
Tutto OK, semplice, funziona ma…
Poi ripensandoci mi sono venuti in mente cose che si fanno abitualmente e chissà come si faranno con Racket?
Per esempio appendere testo a un file (p.es. un log) oppure aprire un file in scrittura senza sapere se già ne esiste uno con quel nome o ancora _________. Ecco mille casi. A me queste cose vengono in mente quando sono lontano dal ‘puter, a volte anche in sonno mi sveglio con la fissa “come si fa?”.

E allora per auto-tranquillizzarmi mi dico (si mi parlo da solo, sarà grave?) che appena posso provo, non è il caso di preoccuparsi, mettere il carro davanti ai buoi :roll:

Ecco, adesso che ho riaperto la guida ho la conferma che non era il caso. C’è tutto sulla guida, nel caso in oggetto in File Ports di The Racket Reference, in locale in [doc]/reference/file-ports.html.

In questa pagina vengono descritte (se ho contato bene) dodici procedure, probabilmente più di quelle che servono. E resto tranquillizzato dal verificare –ancore una volta– la completezza e bontà della documentazione di Racket (e famiglia, mica solo lui).

Però…
Ecco adesso devo dire un’altra cosa, su un documento –al solito– molto bene. E speciale, si tratta infatti di The Racket Manifesto.

L’ho letto tutto un paio di volte, non ne ho (ancora) parlato perché un po’ m’intimidisce ma ecco a p.13 si trova:

Racket’s key advantage is its syntax extension system. It makes experienced programmers extremely productive, but it comes with an extraordinarily steep learning curve. Its syntax elaboration algorithm is hard to understand; its toolbox is large and complex; and it has some brittle, unexplored corners that occasionally trip up even experienced programmers. The situation calls for simplifications of the syntax system and for the creation of a smooth ramp for the toolbox (in terms of both tools and documentation).

Ecco. Se non fossi abbastanza incosciente forse mi verrebbe da domandarmi se ce la posso fare. Vero che non ho l’assillo di scadenze (e non mi preoccupano le scarse visite del blog) ma in fondo-in fondo, solo poco-poco ma sì, OK, panico!

alf

D’altro canto: When the going gets tough, the tough get going, come si dice dalle mie parti. E io un po’ a Bluto assomiglio, vero? Altrimenti –se del caso– potrei sempre ripiegare su Alf.

Racket – Input e Output – 1

athena_postage_stamp

Oggi inizio un nuovo capitolo, qui: [doc]/guide/i_o.html.

Input e output

Un po’ di terminologia, sapete ognuno usa la sua e quelli di Racket (tutti über-nerds) ovviamente non fanno eccezione. Continuo a curiosare in PLT e ci sono davvero tante cose, per esempio qui :grin:

A Racket port corresponds to the Unix notion of a stream (not to be confused with racket/stream‘s streams).

A Racket port represents a source or sink of data, such as a file, a terminal, a TCP connection, or an in-memory string. Ports provide sequential access in which data can be read or written a piece of a time, without requiring the data to be consumed or produced all at once. More specifically, an input port represents a source from which a program can read data, and an output port represents a sink to which a program can write data.

Ecco, pronto a passare qui: [doc]/guide/ports.html.

Varietà di porte

Various functions create various kinds of ports. Here are a few examples:

Files: The open-output-file function opens a file for writing, and open-input-file opens a file for reading.

io0

e poi…

io1

If a file exists already, then open-output-file raises an exception by default. Supply an option like #:exists 'truncate or #:exists 'update to re-write or update the file:

io2

Nota: ho aggiunto newline (si poteva usare anche il solito “\n“) perché altrimenti il prompt del terminale è fuori posto :wink:

Instead of having to match open-input-file and open-output-file calls, most Racket programmers will instead use call-with-output-file, which takes a function to call with the output port; when the function returns, the port is closed. Questa è una cosa che viene direttamente dal Lisp, ne avevo parlato dettagliatamente quando studiavo l’ottimo Peter Seibel.

io3

Strings: The open-output-string function creates a port that accumulates data into a string, and get-output-string extracts the accumulated string. The open-input-string function creates a port to read from a string.

io4

TCP Connections: The tcp-connect function creates both an input port and an output port for the client side of a TCP communication. The tcp-listen function creates a server, which accepts connections via tcp-accept.

io5

Process Pipes: The subprocess function runs a new process at the OS level and returns ports that correspond to the subprocess’s stdin, stdout, and stderr. (The first three arguments can be certain kinds of existing ports to connect directly to the subprocess, instead of creating new ports.)

io6

esattamente come

io7

Internal Pipes: The make-pipe function returns two ports that are ends of a pipe. This kind of pipe is internal to Racket, and not related to OS-level pipes for communicating between different processes.

io8

OK, mi piace. Mi viene da fare il paragone con il (vecchio e più macchinoso) I/O del Common Lisp; deve aggiornasi, imho.

:mrgreen:

Ma i giovani conoscono i file di testo?

es0Un post estivo, anche se ormai l’estate sta finendo (cit. per chi se la ricorda). Pare questi post piacciano e allora ecco…

Capitato recentemente. Leggo la bozza quasi definitiva di una tesina (un compito delle vacanze) e prendo appunti. Io che sono vecchio uso un editor normale, Gedit –OK ci sono Emacs e vi ma ormai…– che, ovviamente, produce un file di testo, niente fronzoli tipo font, neretto, sottolineato, corsivo, colori e compagnia bella. Se mi ricordo metto anche l’estensione .txt. E ci sono anche i caratteri accentati, mica solo il set ASCII, tutto l’Unicode.

OK, fatto, salvato, copiato su una chiavetta USB e andato –a piedi, roba di pochi minuti– a casa dello studente.
Qui sono cominciati i fatti che rendono la vita interessante e mi permettono di scrivere questo post. Stavo per dire guai ma sarebbe eccessivo, troppo.
Occorre precisare che il computer del giovane studente (modello, davvero bravo come pochi) ha Windows 8 come sistema operativo. E un antivirus che gode di molta considerazione per via di spiacevoli episodi del recente passato, ma non voglio andare OT.

Il mio file, passato il controllo dell’Ufficio Immigrazione che ha preteso di scannare tutto il driver mobile, è finito, con altri millemila, sul desktop.

Doppio click per aprirlo e –sorpresa– non si vedono gli a-capo. Già Blocco note|Notepad pretende CR-LF invece del solito (per Linux) LF. Che fare?
Ovviamente è da escludere l’installazione di alcunché, anzi il web è considerato pericoloso.
La prima idea è stata quella di visualizzarlo nel browser, c’è Chrome, lo lancio, riduco in finestra e ci droppo sopra il mio file di testo.

browser

L’immagine è dal mio ‘puter, con Firefox, ma è simile a quella di cui sto raccontando.
Uhmmm… gli a-capo ci sono ma i caratteri fuori dal set ASCII non vengono visualizzati correttamente. Sì, si potrebbe dire al browser … ma così al volo, poi va a finire che ci faccio una figura barbina, già vengo visto come lunatico che uso Linux con tutte quelle diavolerie esotiche come i file di testo.

La soluzione, semplice e immediata, è di creare un documento tipo Word –in realtà LibreOffice, ormai usano quello anche loro–, aprirlo e incollarci dentro il testo del file di testo. È un’operazione immediata. Funziona. La dimensione del nuovo documento è di 22.5 kB, contro i 4.9 dell’originale.

doc

Però, questi giovani: sono molto più avanzati di me, sanno messaggiare con lo smartphone componendo i testi (brevi, sintetici) usando con una velocità che implica effetti relativistici i pollici, opponibili, quelli li avrei anch’io ma la sola idea mi spaventa da non dire.

Ma non conoscono gli elementi basilari, come il file di testo. E mettono tutto sul desktop. E usano un sacco sakko di maiuscole. E usano termini come “cartella”, “app”, “scaip”. Tutte cose che non so, a me nessuno dice mai niente :mrgreen:

Visto nel Web – 197

Finita la stagione delle ferie si torna alla solita routine –prossimamente. Intanto ecco cosa ho visto nel Web.

11935576_10206359150371376_2293463242272500239_n

Convert an Android Device to Linux
::: Linux Magazine

Documents Indicate Apple Is Building a Self-Driving Car
::: Slashdot

Mozilla Tests Improved Privacy Mode For Firefox
::: Slashdot

The Promise Of 5G
::: TechCrunch

Kjell – a refurbished Erlang shell with support for color profiles and extensions
::: karlll

IMG_5843

ACM Classic Books Series
intrigante assay; e al solito –OK :wink:
::: Lambda the Ultimate

Facebook Should Pay All of Us
::: The New Yorker

A graphic guide to algorithms
::: dlion92

Overheard at pool just now
::: extempore2

Meet Dash & Dot
Discover a new world of play, learning and adventure.
::: Make Wonder

evolution

Studente di Harvard scopre un difetto di Messenger, Facebook gli revoca lo stage
::: la Stampa

Bash Pitfalls
non nuovo ma …
::: Greg’s Wiki

ShareLaTeX has over 500,000 users!
::: sharelatex

Anti-Science Trolls are Starting Edit Wars on Wikipedia
::: Gizmodo

Rupert Murdoch Won’t Be Teaching Your Children To Code After All
::: Slashdot

Quotation-Steve-Wozniak-life-best-people-Meetville-Quotes-235195

IBM Launches Linux-Only Mainframes
::: Slashdot  ::: Amplify the Signal ::: Ubuntu Insights

State of the Haskell ecosystem – August 2015
::: Gabriel439

Lettera aperta sulla questione Office365 all’assessore alla sanità della Provincia di Bolzano
::: LibreItalia ::: Tech Economy

First feedback on my @university Scala-Java interop class today
::: travisbrown

batman

Comment atteindre Inbox Zero à la rentrée
::: CommitStrip

Using context managers in test setUp
::: Ned Batchelder

Debate Over Amazon Working Conditions Goes Back Years
::: Slashdot

Map of all Public Libraries in the USA
Jake & Python: miracoli resi ordinaria amministrazione
::: jakevdp

At 5,200 comments the Amazon story is now officially the most commented-upon story in NYT history
::: fmanjoo

0e63884d-e06a-4412-bec8-f692f0b409e1

Una storia di giornalismo: New York Times vs. Amazon
::: Giuseppe Granieri ::: Scott Berkun

Here’s what we know about the Ashley Madison hack
::: Fusion ::: Ars Technica ::: mikko ::: mikko ::: fabiochiusi

L’intelligenza artificiale contro il terrore dell’ISIS
::: Oggi Scienza

Intel: il software vocale di Stephen Hawking è ora gratuitamente scaricabile
::: Gravità Zero

Intel Promises ‘Optane’ SSDs Based On Technology Faster Than Flash In 2016
::: Slashdot

Łucja Goliasz

Łucja Goliasz

The Future Of The Web Is All About Context
::: TechCrunch

Facebook overtakes Google as referrer to news sites
::: nxthompson

Getting started with ‘The Little Prover’
sarebbe tutto un mondo nuovo da esplorare; solo che la vita è troppo breve
::: LambdaCat

Chinese police arrest 15,000 for Internet crimes
::: Reuters

Eric Lippert’s Sharp Regrets
conosco chi usa quasi solo C# anche se non ne parlo mai
::: Lambda the Ultimate

CMjouR-W8AANr7H

Smartphone, per innovare è meglio ascoltare i ragazzi
::: Wired

Com’è la sicurezza dei siti scolastici italiani? Imbarazzante
::: Il Disinformatico

For close to 90% of the #world population #LibreOffice is available in the own #language
::: libreoffice

Rural #Brazil will find alternatives to Internet.org
::: webwewant

stitchcounter-scm – Command line tool to help you with knitting and crocheting
It is a porting in Chicken Scheme of the same program I wrote in Clojure and in C
::: manuel-uberti

73153544-1b8e-4a77-a3fa-9c830645b1f9

Installare stampante multifunzione alla sister
per evitare il ritorno alla barbarie
::: dcavedon

Go 1.5 is released
::: The Go Programming Language

I nuovi analfabeti: usano Facebook, ma non sanno interpretare la realtà
::: Wired

Linus Torvalds Isn’t Looking 10 Years Ahead For Linux and That’s OK
concordo perfettamente :wink:
::: Slashdot

11095476_915321581854554_6266519450244667531_n

Une histoire de mot de passe
::: CommitStrip

Tutto l’openness che serve ai bambini in una chiavetta: Freestyle PC for Kids
::: Tech Economy

Ubuntu 15.10 To Ship With Gnome’s Overlay Scrollbars By Default, Ditching Unity’s Overlay Scrollbars
::: Web Upd8

Why Aren’t People Using Smalltalk?
::: Medium

Attacchi informatici in tempo reale
ipnotico
::: SIAMO GEEK

vr

Sergey Brin on Google Lens
::: Google+

L. Peter Deutsch invented the first interactive #Lisp REPL in 1963 when he was 17
::: RainerJoswig

Un obolo per Microsoft
::: Tech Economy

L’ #informatica nei film americani
::: Genjuro75

Annamo bene #Windows10
::: djnooz

Pinuccio

Pinuccio

Google’s feature or (wanted) bug?
::: Google+

Google integrates Twitter into its desktop search results
::: The Next Web

Meet Linux’s Newest File-System: Bcachefs
::: Slashdot

Perché Spotify vuole sapere tutto dei suoi utenti
::: Chiusi nella rete

Guida pratica al software libero… e gratuito
::: Gravità Zero

11873518_745554048904739_2378862926896776826_n

Canonical is letting the Ubuntu Software Center wither and die
::: PCWorld

I love it when I can write a single SQL
::: thomasfuchs

New recipe, HtMaB
::: jasonyeojs

casamonica

Iscriviti

Ricevi al tuo indirizzo email tutti i nuovi post del sito.

Unisciti agli altri 88 follower