Typo of the day: "Busimess requirements". Should teach that to my f...ing auto correction. :-)
Monday, October 30, 2023
Wednesday, April 28, 2021
Installing native Docker on AlmaLinux
Today, I had to reinstall a Docker host, which was previously running on my beloved CentOS 8. As that is quickly approaching it's end, I decided to give AlmaLinux a try. To use it as a Docker host, I had to install native Docker. (I prefer to use native Docker over the one, that is part of the distribution.) So, according to https://get.docker.com/, this is supposed to work as follows:
curl -fsSL https://get.docker.com -o get-docker.sh sudo sh get-docker.shIn the past, I did that on CentOS, quite a lot, so I expected it to work out of the box. Unfortunately, that didn't quite work, and failed with the error message below:
sudo sh get-docker.shNote: In order to overcome minor dependency conflicts with podman, buildah, and the like, I also had to issue the command
Saturday, October 24, 2020
Incompatibility of Process.waitFor() between Linux, and Windows.
Today, after maybe two years, I figured out, why one particular piece of code works excellent on Windows, but has been causing a lot of trouble on Linux. That piece of code is the class Executor in my Java application framework library afw.
The reason turned out to be, that the method Process.waitFor() behaves differently on Windows, and Linux, with regard to the launched processes output.
- On Windows, the waitFor() method waits, until
- the launched process has terminated, and
- the processes standard output, and error output has been consumed (in other words: The input streams, as returned by Process.getInputStream(), and Process.getErrorStream() have been read.
- On Linux, however
- The method waits, again, until the launched process has terminated, but
- It doesn't wait for the consumption of the processes output.
- both threads have received EOF from their respective input streams, and
- the invocation of Process.waitFor() has returned.
Sunday, February 3, 2019
Announce: JSGen (Java Source Generation Framework)
It is with some pride, that I can announce JSGen today, as a new, and very minor, open source project, under the Apache Software License, 2.0
JSGen is short for Java Source Generation framework. As the name (hopefully) suggests, it is a tool for generating Java source code. It is the result of close to 20 years working on, and with Java source generation. That includes, in particular, the XML data binding framework JaxMe, its predecessor Apache JaxMe, and a lot of application programming in my professional work.
It is my opinion, that
- Java source generators have a tendency to grow into CLOB's over time, becoming less maintainable, and understandable.
- Java source generators do typically contain a real lot of boilerplate code, organizing things like import lists, and syntactical details, rather than their actual purpose.
In contrast, JSGen provides an object model, that aims to make source generation just yet another developers task, on which modern software engineering principles can be applied. JSGen will support you by
- Creating import lists semiautomatically (with the exception of static imports)
- Supporting multiple formatting code styles (An Eclipse-like format, the default, and an Apache-Maven-like alternative format.) Switching between code styles is as easy as replacing one configuration object with another.
- Enabling a more structured approach to source code generation. (Example: Implement the case of handling a single instance, and use that to handle the case of a collection.)
Let's have a look at an example, which is quoted from the JUnit tests. We intend to create a simple HelloWorld.java. Here's, how we would do that with JSGen.
JSGFactory factory = JSGFactory.create();
Source jsb =
factory.newSource("com.foo.myapp.Main").makePublic();
Method mainMethod =
jsb.newMethod("main").makePublic().makeStatic();
mainMethod.parameter(JQName.STRING_ARRAY, "pArgs");
mainMethod.body().line(System.class,
".out.println(",
q("Hello, world!"), ");");
File targetJavaDir = new File("target/generated-sources/mysrc");
FileJavaSourceWriter fjsw = new
FileJavaSourceWriter(targetJavaDir);
// You might prefer MAVEN_FORMATTER in the next line.
fjsw.setFormatter(DEFAULT_FORMATTER);
fjsw.write(factory);
Some things I'd finally like to note:
- JSGen is a complete rewrite of two mature, and reliable predecessors, namely JaxMeJS, and Apache JaxMe JS. As such, it is based on a mature API, and a real lot of applied experience. It may be new, but it should be quite reliable, nevertheless.
- It provides all the features, of the predecessors, but adds
- Support for Generics
- Support for Annotations
- Switchable Code formatters
- Builders heavily used in the API
This announcement has intentionally been deferred until the point, where JSGen has succesfully been used for a professional project in my professional work.
Finally, a few links:
Wednesday, February 24, 2016
Don't use Copy+Paste on Windows, if you've got a lot of data
So, tried something different: CygWin's rsync, the swiss army knife for backups, and related stuff. In other words, I am using the command
rsync -a -r --progress
Runs with 30MB per second (50% faster than native Windows copying). And is reentrant...
Thursday, November 5, 2015
VMWare Shared Folders oin Fedora 23
Hi,
if you haven't noticed: Fedora 23 is out, and its time to get your hands wet on it. Being forced to use a Windows Laptop, I am typically doing this by installing a VMware guest. Once the virtual machine is up, the first thing i want to do is accessing my Windows home directory. The easiest way to do this is by creating a so-called "Shared Folder" in the VMware settings for my machine. On the guest, you need to install the "VMware Tools" and do something like
mkdir /home/username/sharedfolder sudo mount -t vmhgfs -o uid=1000,gid=1000 .host:sharename /home/username/sharedfolder
(The options uid=1000,gid=1000 ensure, that the mounted directory is readable, and writable for the user with uid=1000, and gid=1000, which is me.)
The problem with that procedure is, that it depends on a kernel module called "hgfs", which must be installed as part of the "VMware Tools". And, needless to say: Installation of the VMware Tools (version 9.2.0-799703, as of this writing) fails, because the Kernel isn't compatible to the sources distributed by VMware.
So far, the only reasonable solution was to wait for an updated tools version by VMware. (I generally ignored the possibility to patch those distributed sources as overly complicated, and insecure. However, there's a new, and better solution available:
Fedora 23 automatically installs an RPM named open-vm-tools. And this includes two programs, that allow use of shared folders without the kernel module:
# Display a list of all shared folders:# Note, that it includes a share called "sharedfolder".
$ vmware-hgfsclient sharedfolder
# Create a directory named /home/username/foo, and mount the shared folder there.
$ vmhgfs-fuse .host:foo /home/username/sharedfolder
$ cd /home/username/sharedfolder
$ touch testfile
$ rm testfile
Note, that neither "sudo" nor the specification of any options was required.
So, in other words: As of Fedora 23, the VMware Tools are no longer required. Mouse integration, Cut and Paste, and using shared folders: Everything works out of the box. (I can live without the thin print drivers.)
Tuesday, March 17, 2015
His name, however, continues to be sent in the so-called Overhead of the clacks. The full message is "GNU John Dearheart", where the G means, that the message should be passed on, the N means "Not Logged" and the U that it should be turned around at the end of the line. So as the name "John Dearheart" keeps going up and down the line, this tradition applies a kind of immortality as "a man is not dead while his name is still spoken".This means, we'll be celebrating "Being childish day" today, by adding the HTTP Header
X-Clacks-Overhead: GNU Terry Pratchett
to our web sites. And, here's how to do that with any Java Web Application.
Its simple. First of all, you'll be adding this class to your web application. It is a so-called servlet filter. I'll quote the relevant method here:
public void doFilter(ServletRequest pReq, ServletResponse pRes,
FilterChain pChain) throws IOException,
ServletException {
if (pRes instanceof HttpServletResponse) {
final HttpServletResponse res = (HttpServletResponse) pRes;
res.addHeader("X-Clacks-Overhead", "GNU-Terry-Pratchett");
}
pChain.doFilter(pReq, pRes);
}
ClacksOverheadFilter
com.github.jochenw.clacksov.ClacksOverheadFilter
ClacksOverheadFilter
*