Scala problem: You want to be able to read configuration files that are written in the Lightbend “Config” file format.Back to top
Lightbend — initially named Typesafe — created a configuration file format named HOCON, which stands for, “Human-Optimized Config Object Notation.” As an example, a small HOCON configuration file looks like this:
As a brief note to self, if you ever want to write some code using Scala that recursively descends through a directory tree, here’s a solution that uses the Java
Files.walkFileTree method. First, here’s a skeleton class for the
SimpleFileVisitor part of the solution:
Summary: This page is a printf formatting cheat sheet. I originally created this cheat sheet for my own purposes, and then thought I would share it here.
A great thing about the
printf formatting syntax is that the format specifiers you can use are very similar — if not identical — between different languages, including C, C++, Java, Perl, PHP, Ruby, Scala, and others. This means that your
printf knowledge is reusable, which is a good thing.
I don’t know where this originated, but I just saw it on a friend’s Facebook feed. Nothing like Java humor. :)
As a brief note today, I found that GraalVM was actually making one of my Scala/Java/JVM applications slower, so with the help of Thomas Wuerthinger at Oracle, I learned a little bit about how to use the GraalVM profile-guided optimizations.
I’m working on a small project to parse large Apache access log files, with the file this week weighing in at 9.2 GB and 33,444,922 lines. So I gave myself 90 minutes to try a few different ways to write a simple “line count” program in Scala. (Not my final goal, but something I could use to measure file-reading speed without applying my algorithm.)
GraalVM native executables can run faster than Scala/Java/JVM applications, with much less memory consumption
In two small tests where GraalVM was able to create a native executable, the native executable ran significantly faster than the equivalent Scala/Java code running with the Java 8 JVM, and also reduced RAM consumption by a whopping 98% in a long-running example. On the negative side, GraalVM currently doesn’t seem to work with Swing applications.
Very briefly, I spent a little time today trying to understand how much memory/RAM a Java/Swing application was really using, and these are my notes from that excursion. Note that the app is bundled as a MacOS/Java app I named AlPad, but from some system perspectives it is only seen by the name
JavaAppLauncher. Here are my notes, which will hopefully be useful to me in the future:
In this article it helps if you already know a little bit about AppleScript, though that’s not completely necessary. Near the end of the tutorial I show how to invoke the AppleScript code using Scala, so feel free to skip down to there if you just want to see that — you can always read the stuff at the top for reference later.