Écrit le 9 mars 2020 par Jeremy Howard and Rachel Thomas
Traduction en français par Patrick Jayet et deepl.com.
Article original.

Nous sommes des data scientists, c’est-à-dire que notre travail consiste à comprendre comment analyser et interpréter les données. Lorsque nous analysons les données relatives au COVID-19, nous sommes très inquiets. Les personnes les plus vulnérables de la société, les personnes âgées et les démunis, sont les plus exposées. Pour contrôler la propagation et l’impact de la maladie, nous devons tous changer notre comportement. Lavez-vous les mains soigneusement et régulièrement, évitez les groupes et les foules, annulez les événements et ne vous touchez pas le visage. Dans ce billet, nous expliquons pourquoi nous sommes inquiets, et pourquoi vous devriez l’être également. …

On my trip to Berlin for the Scala Days conference, I used Passbook for the first time to store my boarding pass. I thought it would be interesting to share this first paperless boarding experience with you.

When I did the check-in on Swiss’ website the day before my flight, I chose to receive the boarding pass electronically. In the e-mail I got, there was a Passbook file, which I opened with my iPhone. The Passbook app was started and showed the boarding pass. …

I have stumbled upon a weirdness regarding the behavior of readLine in Scala (at least with my current basic understanding of the language).

The following snippet is supposed to read three times a line from standard in. But it reads 3 times the same line (the first).

(1 to 3) foreach {
val line = Console.readLine
i => println(line)

while the following snippet (very similar) behaves as expected (reading the three first line from stdin):

(1 to 3) foreach {
i => println(Console.readLine)

Any idea why?

Java quiz of the day (easy): what gives

Object[] a = new Integer[]{};
List<Object> b = new ArrayList<Integer>();

Response: we get an exception on the second line:

Type mismatch: cannot convert from ArrayList<Integer> to List<Object>

Arrays and Generics are not consistent. While for arrays, an array of some type is also an array of one of its parent types, the same is not true for Generics. If it was, we could construct weird things where we would get at most a runtime exception when trying to access items of a collection. See the following example:

class A{
void foo(List list) {
List otherList = list; // (A)
otherList.add(“hi”); …

What gives:

Integer a = 100, b = 100;
Integer c = 200, d = 200;
System.out.println( (a == b) == (c == d) ); // A

Response: counter intuitively, the program prints ‘false’ out. Integer in Java is a non-native class, where ‘==’ means ‘reference equality’ (two variables are reference equal if they are pointing to the same object). From there we would expect the expression of line (A) to be reduced to ‘false == false’, but it is slightly more complicated: the Integer class has the particularity that all Integer (like Short) in the range [-128, 127] are shared. This means the two variables ‘a’ and ‘b’ are actually pointing to the same shared object. Hence the expression of line (A) is in fact reduced to ‘true == false’.

What gives

Double a = null;
Double b = a == null ? a : 1.0;

Response: as strange as it can seem at first look, b is not equal to null after the second statement, but the code produces a NullPointerException.

The reason for that is the type of the second expression (double) inside the ternery operator. The first expression ‘a’ of type Double is unboxed to double (calling doubleValue() on ‘a’ which is null), causing the NPE.

You can find a discussion about that here.

I was just checking which commands are supporting sparse files. I post hereafter a short overview of what I found out (working on Linux).

A sparse file is a file which does not take more space on disk than needed. Such a file is usually used to store a partition image on disk, for instance with a virtualization solution like Xen.

It’s super easy, to know if a file is sparse or not. Just use the ‘s’ option of ls.

ls -alsh

will yield:

4.0K drwxr-xr-x 9 root root 4.0K 2010-03-23 18:22 .
4.0K drwxr-xr-x 23 root root 4.0K 2009-01-09 19:47 ..
12G -rw-r----- 1 root root 24G 2007-01-10 19:55 dompat.data
3.7G -rw-r--r-- 1 root root 7.1G 2009-01-06 21:09 dompat-hardy.sys …

I had posted that some times ago on Twitter. There is a new version of the excellent GPGMail plug-in for Mail (OS X). Grab it, if you haven’t already.

GPGMail for OS X 10.6.2

Just put it inside ~/Library/Mail/Bundles and restart Mail. (More information on GPGMail’s web page.)

Edit: This is not an official version of GPGMail. There is still no official version of GPGMail compatible with Snow Leopard.

Check out my new mix 03.


Patrick Jayet

Polyglot (FR, DE, EN, ES), polyglot programmer (Java, Groovy, Ruby, Swift, Objective-C, Scala, Python, O’Caml) polyglot methodologist (Scrum, Kanban, Lean).

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store