Johann N. Löfflmann's Weblog

Sunday, March 11, 2018

To be honest, it is not a lousy T-shirt at all, it is great T-shirt from the Linux Foundation actually. It has a simplified Tux icon and a little riddle on its front:

Warning: don't scroll down if you want to solve the riddle by your own. Scroll down in order to see how I solved the riddle.
.
.
.
.
.
.
.
.
.
.2nd WARNING
DON'T SCROLL DOWN IF YOU WANT TO SOLVE IT BY YOUR OWN !!!
.
.
.
.
.
.
.
.
.
. Last WARNING
Ok, either you have solved the riddly by your own or you are simply too curious ;-)
OK, FEEL FREE TO SCROLL DOWN IF YOU WANT TO SEE THE SOLUTION !!!
.
.
.
.
.
.
.
.
.
Actually, I was wondering whether I can solve the riddle by using the NumericalChameleon (yeah, you know I am the author of it, don't you?) and I am glad to announce that it can be used to solve the riddle as well. I entered the bitstream at the category "Positional Notations, Radix 2-36", and converted the value to hex. Since the Unicode character set is a superset of ASCII, and numbers 0 - 127 have the same meaning in ASCII as they have in the Unicode character set, it was possible to prefix each hex number by 00 in order to satisfy the expected input format at the "Unicode® Characters (Basic Multilingual Plane)" category. Below you see screenshots of both the NumericalChameleon (with the solution) and a hex editor in the background (with the solution) in order to verify the result.

Sunday, October 22, 2017

Sometimes it can be useful to open a browser from your bash. I have developed a bash function that does exactly that - and since I am a fan of multiple operating systems - the function works not only on GNU/Linux, macOS, and Solaris but also on the bash on Windows as part of the WSL (Windows Subsystem for Linux).

To use the function in your bash-script, simply source the file that contains the function - I called the file network.include. You find the file as well at the repository of my tiny project called bash-dwarfs - that is a tiny collection of both bash scripts and bash includes, released under the terms of the Apache 2.0 license. The script below calls the function from above and opens the homepage to bash-dwarfs:

#!/usr/bin/env bash

. ./network.include

openBrowser https://github.com/jonelo/bash-dwarfs

Best regards,

Johann

Update Oct 23, 2017: uname -r is not reliable enough, it does not work on the wls beta with Ubuntu 14.04 for example, better is to do a cat /proc/sys/kernel/osrelease

Friday, June 9, 2017

Recently I detected an error message on macOS saying that it seems to be required to install a JDK in order to just use the java command-line tool. A JRE is not enough? Really? Are you kidding me?

The screenshot below shows the error message in German: "Um das java-Befehlszeilenprogramm nutzen zu können, musst du ein Java-Entwicklerpaket installieren." In English it means: "To use the java command-line tool you need to install a JDK".

Since I am a developer, I always installed the JDK on my Mac and I detected that phenomenon very late. Actually the web is full of those traces - however, without a suitable solution in my opinion. Well, I simply don't want to tell my users to install a JDK if a simple JRE is enough. Any existing JRE on the system should do the job in my humble opinion.

Here we go, here is my little bash launcher that tries its best to launch java even if you have installed a JRE only on your Mac:

The script checks for the JAVA_HOME environment variable and if that is not set, it checks for any registered JDKs by calling /usr/libexec/java_home and if that didn't return anything, it simply uses the JRE that could be available at a well known path on macOS (tested with both Java 8u131 and Java 9-ea) and if that fails as well, it uses java and if even that fails it means you really don't have any Java installed and you should get the error message above again.

Since there is no access to a proc file system on macOS (at least not by default), both pargs and penv call the ps command and pmap calls vmmap. Furthermore pwdx calls lsof with the current working directory descriptor request in order to get the required info. Since "ps wwe" returns not only the environment variables for the given process but also the program arguments on macOS, we need to strip the program arguments from the output. This has been done by calling pargs, determining the length of that output and cutting that length from the string again before we pass it to the tr command that gives us an environment variable for each line. For blog purposes I have shortened the variable names, L stands for line and C for count.

Sunday, May 7, 2017

I really like the p-commands on Sun/Oracle Solaris and I miss those on GNU/Linux.
Therefore I have gathered/created rudimental equivalent one-liners that work on a PID.

I have added the following functions to my ~/.bash_aliases file that is being sourced by my ~/.bashrc. pargs, penv, and pmap are gathering the proc file system, while pfiles and pstack are calling lsof resp. gdb.

Friday, February 10, 2017

Today I will explain how the NumericalChameleon installer obtains the latest Java Runtime Environment (JRE) for Microsoft Windows.

The NumericalChameleon (http://numericalchameleon.net) is written in Java and it relies on a JRE that is installed on your system. The NumericalChameleon installer checks at first whether a JRE is installed. If there is one, everything is fine and the installer will continue with a normal installation. If there is none, the installer downloads the latest JRE offline installer from Oracle and launches it. The offline installer installs the JRE on your system and once it is installed, it will give back the control to the NumericalChameleon installer that continues with the installation until the NumericalChameleon software package is installed as well.

Below you find a screenshot of the NumericalChameleon installer, localized in German, running on Windows 10 x64 while downloading the latest JRE offline installer:

Since the actual locations of the JRE offline exe installers are different for each Java version, and those locations are both unpredictable and volatile, it is important for the NumericalChameleon installer to rely on well known static URIs, because the installer binary cannot be changed/patched anymore once it is deployed on the web.

Those well known URIs are redirects in the .htaccess file on my Apache server actually, and the redirects are being updated every day. I create those redirects by parsing the website that has the locations of the Windows JRE offline installers.

Now you know how the NumericalChameleon installer gets the latest JRE on Windows.

Hint: if the approach above should ever fail and the redirects are not being created, the current installer will fail with a 404. In that case you can simply install the JRE manually before you start the NumericalChameleon installer. In that case the installer won't even go to the internet, because the condition is met already that a JRE has to be installed.

Monday, June 6, 2016

The NumericalChameleon is free, open source, cross platform and
comprehensive software in order to convert units with a precision of up
to 1000 decimal places. It supports more than 5200 units in 93 categories, including not only all important physical units, but also useful units in non-standard categories like exchange rates, time zones, spoken numbers (literally and by audio), roman numerals, geographic coordinates, radixes, fractions, checksums, bits&bytes, screen resolutions, colorcodes, unicodes, international dial codes, calendar and holiday calculations and many more.

Sunday, February 14, 2016

Jacksum is a free cross platform checksum utility. It exists since July 2002. Time to create a logo for it.

Considerations:

Jacksum is entirely written in Java, it
runs on Apple's OS X, Microsoft Windows, GNU/Linux, and any other operating system
that has a Java Runtime Environment. So Jacksum is really cross
platform, without the need for the user to recompile it. The purpose of Jacksum is to compute and
verify checksums, mainly to check whether a data transfer was successful.

Actually "Jacksum" is a synthetic word made of
JAva
and ChecKSUM and I wanted to create a logo that reflects both the J as in Java (cross platform feature) and the check as in checksum.
Checkboxes usually have a rectangle shape and the circle should reflect
the comprehensiveness of the sum of all Jacksum's features. Black as in Jack and green as in successful check.

Furthermore the logo should be recognized even it has been resized to 16x16 pixels. That is important, because Jacksum also supports the File Browser Integration. So it was clear to make a very simple logo, but not simpler.

The logo:

Here it is:

And the icon resized to 16x16 pixels, integrated in the Windows Explorer (menu is localized in German):