serhii.net

In the middle of the desert you can say anything you want

03 Nov 2020

Day 673

Java / German

Sehr schönes deutschsprächiges Buch über Java, dem ich nützen könnte, um mein IT-Wortschatz zu verbessern:

Rheinwerk Computing :: Java ist auch eine Insel - Inhaltsverzeichnis

Intellij Idea commit window

The commit window is (as with conflict resolution) a fully-functioning text editor, including all the usual ideavim bindings! All changes/diffs get automatically updated as they get changed.

Intellij idea copy file

“Copy”-ed files get pasted as the filename with all the extensions. “Copy filename” does only the file name, w/o the last extension.

Intellij environment variables copypaste - check for spaces at the end.

I’ve been bitten by this before at least twice. When copypasting them, for example even from another Intellij running configuration, check for spaces at the end. Not visible at all ever in any of the context one might hope to see them.

Java REPL / shell / cli

Called jshell on my box. Has tab-completion etc. Really nice!

jshell> NavigableSet original = new TreeSet();
   ...> original.add("1");
   ...> original.add("2");
   ...> original.add("3");
   ...>
original ==> []
jshell> original.floor("2")
|  Warning:
|  unchecked call to floor(E) as a member of the raw type java.util.NavigableSet
|  original.floor("2")
|  ^-----------------^
$8 ==> "2"

Java floor/ceil with Pairs and in general, especially with HashMapS and stuff

Think about compareTo() and equals() of the classes if I’m doing something that may need it. Such as using Pairs as keys in a TreeSet and expecting that they will be compared only based on first value.

Java comparing Integers

Java: Integer equals vs. == - Stack Overflow

Using !=/== … works only for Integers -128..127. Otherwise they will likely be different Objects => not equal. And of course, -128..127 is exactly the kind of numbers one might see in tests as opposed to real world situations.

The way to do it is if (!one.equals(two)) {

OWASP Java Gotchas

TODO read this: Java gotchas - OWASP

(Link from AA in the context of comparing integers)

Linux - run command after some time has elapsed

I usually use sleep 5m && foobar, so if I change my mind and ^C the sleep, the next command doesn’t run. – Peter Cordes May 28 ‘16 at 14:07 1

And sleep is installed by default in a lot of places!

sleep 5m && foobar

From the man page:

SUFFIX may be ’s’ for seconds (the default), ’m’ for minutes, ‘h’ for hours or ’d’ for days. Unlike most implementations that require NUMBER be an integer, here NUMBER may be an arbitrary floating point number.

Duckduckgo (ddg) Wolfram Alpha !bang

!wa now plus 12.5h

Nel mezzo del deserto posso dire tutto quello che voglio.