31 March 2021

Java SE 16: some goodies

Record

Records are a simple form of classes intended for value objects. Example:

public record Expert (String name, String domain) {} 

Records are like classes for immutable data with default boilerplate code added

  • all attributes are private
  • Constructor with arguments for all attributes
  • getters
  •  equals and hashCode methods
  • toString()

This is similar to the conventions used in Lombok and Kotlin data classes.

Methods can be added to the class and default methods can be overridden.

Limitations

  • no inheritance: records cannot extend classes and are implicitly final
  • extra attributes must be static

instanceof instanciation

Classic code

if (car instanceof F1) {
    F1 redBull = (F1) car;
    redBull.race();
}

Java 16

if (car instanceof F1 redBull) {
  redBull.race();  

}

jpackage

jpackage is a command to generate an installer package for you project. It can

  •     generate a classical jar for you, but adds a  startup scrip including all necessary classpaths
  •     include the JRE (or just the modules you need) to have a n installer without dependencies
  •     produce .exe, .msi, .rpm ... pacakges

23 March 2021

Proof of Concept code for MicroSoft Exchange vulnerability dissapears from GitHub

Recently Microsoft got into open source code distribution by acquiring widely used open source distribution sites like github and npm. 

Its stance with respect to open software has changed remarkably over the last years. 

But the risks of Microsoft's influence in this market become clear now: it has removed proof of concept  code that showed weaknesses in Microsoft Exchange mail servers.

Although the code is still available from other Open Source repositories like GitLab, this shows the willingness and capability of Microsoft to control the distribution of Open Source Software.

More...

19 March 2021

Adope Acrobat DC: disable "preparing document for reading" popup

Problem: Every time i open up a new document I get the popup below, in which Acrobat wants to assist me by reading the document for me. I can perfectly read the document myself, so how to disable this popup?



Solution: Preferences > Accessibility > uncheck Assistive technology support

15 March 2021

2000 year old Greek automaton showed movement of starts and planets

 The Antikera mechanism was discovered in a ship wreck in 1901. It was split into 82 fragments, only a third of the original survings, including 30 corroded bronze gearwheels. Scientists have reconstructed the mechanism and published an article in Nature.

It calculated the ecliptic longi-tudes of the Moon, Sun and planets; the phase of the Moon; the Age of the Moon; the synodic phases of the planets; the excluded days of the Metonic Calendar; eclipses—possibilities, times, characteristics, years and the heliacal risings and settings of prominent stars and constellations; and the Olympiad cycle. It has a a ring system with nine outputs—Moon, Nodes, Mercury, Venus, Sun, Mars, Jupiter, Saturn and Date—carried by nested tubes with arms supporting the rings.

The top picture shows the reconstruction, the bottom picture the original findings: