Blog

You may or may not find something useful here.

Browse the archive too see all entries.

Rant: Java versions in Debian

I need to run JabRef on my debian machine. But suddenly, it stopped working! After a little bit of searching, I found out that openjfx was lately upgraded to version 11+26-5. Nice! So finally it can be used with Java 11!

But wait... JabRef can only run with Java 8. But uhmmm that means I need the openjfx for Java 8 as well?!

Using snapshot.debian.org confirmed that theory. Downgrading the packages of openjfx to 8u171-b11-2 made JabRef working again... Yeah, but then openjfx does not work with other versions than 11.

On the debian issue tracker you can find this bug: Debian bug #910407. There you can read:

openjdk-8 is still there because we haven't completed the transition to
Java 11 yet. It may remain in Buster but only as a build dependency,
there is no plan to support it at runtime. Java based applications in
Buster must run on Java 11 (it should soon become the default JRE).

For these reasons packaging openjfx-8 doesn't really make sense. That
would be a string preventing us from moving forward.

Uhmmmm, so that means Java 8 is basically out of order soon, but there are still very useful tools using it. Why is it so hard to create different versions of openjfx to work with each java version? What is even weirder about the openjfx package, is that it does not pin the versions of the dependand packages and also does not specify the required java version:

Package: openjfx
Version: 11+26-5
Priority: optional
Section: java
Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
Installed-Size: 30,7 kB
Depends: libopenjfx-java
Recommends: openjfx-source
Homepage: https://openjfx.io
Download-Size: 8.848 B
APT-Sources: http://cdn.debian.net/debian testing/main amd64 Packages
Description: JavaFX/OpenJFX - Rich client application platform for Java
 JavaFX/OpenJFX is a set of graphics and media APIs that enables Java developers
 to design, create, test, debug, and deploy rich client applications that
 operate consistently across diverse platforms.

Package: openjfx
Version: 8u171-b11-2
Priority: optional
Section: java
Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
Installed-Size: 77,8 kB
Depends: libopenjfx-java, openjdk-8-jre
Homepage: http://openjdk.java.net/projects/openjfx/
Download-Size: 35,8 kB
APT-Manual-Installed: yes
APT-Sources: https://snapshot.debian.org/archive/debian/20180612T213951Z unstable/main amd64 Packages
Description: JavaFX/OpenJFX 8 - Rich client application platform for Java
 JavaFX/OpenJFX is a set of graphics and media APIs that enables Java developers
 to design, create, test, debug, and deploy rich client applications that
 operate consistently across diverse platforms.

From that alone, I thought that openjfx 11 would work with the old versions just fine. But no, it does not.

That means I need to run JabRef in a VM soon, in order to make it work... Nice!

Posted Mon Nov 19 12:36:36 2018
the science of boiling eggs

There is a very interesting article in German on boiling eggs from one of the Science Busters Werner Gruber: Wie lange kocht man ein 3-Minuten Ei?.

This article gives an equation how long an egg must boil for a certain core temperature to reach:

t = 0.0016 \cdot d^2 \cdot \mathrm{ln}\left(\frac{2 \cdot(T_{\mathrm{water}} - T_{\mathrm{start}})}{T_{\mathrm{water}} - T_{\mathrm{inner}}}\right)

For a soft-boiled egg, the value of T_{\mathrm{inner}} should be above 61.5°C but below 65°C. The article specifies 62°C as the target but another page, which is citing this article gives 64°C as the target value. We use this higher value here.

As T_{\mathrm{water}} can be set to 100°C and T_{\mathrm{start}} can be assumed to be 4°C, if the egg comes from the freezer, the whole equation can also be written as:

t = 0.002678 \cdot d^2

A normal egg has a minor diameter of about 41mm (S) to 49mm (XL). Plotting the function between these values, we can see, that the curve is almost linear in this region. The linear function can be calculated as:

t \approx 0.24 \cdot d - 5.36

Thus, to have an "in the ballpark" figure for the boiling time, just take a quarter of the minor diameter and subtract 5 and a half minutes from the result and take the eggs out a little bit earlier ;)

Posted Tue Oct 9 15:50:32 2018
fixing a hario scale

After a capuccino spill over a Hario VSTM-2000 scale, the timer was frozen and the buttons would not work anymore.

Also plugging in the USB would not work, the scale charged but did not reset. As the batteries are not removeable (at least not easily), I opened up the scale.

First you need to remove the rubber feet and remove the screws. There are also two more screews in the middle:

Now you open up the small lid, which has two more screews under it:

If you remove those two, the whole scale should come apart. You could have removed the scale plate before (I did not knew it was removeable), then it is much easier to separate the two halfes.

Here are a few impressions. First of all the load cell with it's four wire measurement:

Now the display and button module:

The USB charging module:

and the battery:

To reset the scale, I shorted the battery for a very short amount of time. It was enough to have the microcontroller reboot. I also cleaned the scale, as it had some milk in it. After that you can put everything back together. Make sure not to pinch the wires.

Posted Sat Jul 14 16:52:10 2018
nexus5 charging

You ever wanted to monitor the charging of your Nexus 5 from the commandline? Here is how it works.

The Nexus 5 uses two chips to control the charging:

While the first chip controls the maximum current which is drawn from the USB, the second chip monitors the current charging current.

Both chips can be read over their I2C interface:

$ ls -al /sys/bus/i2c/drivers/max17048
total 0
drwxr-xr-x  2 root root    0 2018-06-27 21:03 .
drwxr-xr-x 17 root root    0 2018-06-27 20:58 ..
lrwxrwxrwx  1 root root    0 2018-06-27 21:03 84-0036 -> ../../../../devices/f9923000.i2c/i2c-84/84-0036
--w-------  1 root root 4096 2018-06-27 21:03 bind
--w-------  1 root root 4096 2018-06-27 21:03 uevent
--w-------  1 root root 4096 2018-06-27 21:03 unbind

$ ls -al /sys/bus/i2c/drivers/bq24192/
total 0
drwxr-xr-x  2 root root    0 2018-06-27 20:58 .
drwxr-xr-x 17 root root    0 2018-06-27 20:58 ..
lrwxrwxrwx  1 root root    0 2018-06-27 20:58 84-006b -> ../../../../devices/f9923000.i2c/i2c-84/84-006b
--w-------  1 root root 4096 2018-06-27 20:58 bind
--w-------  1 root root 4096 2018-06-27 20:58 uevent
--w-------  1 root root 4096 2018-06-27 20:58 unbind

To get the current current, you can do the following:

$ cat /sys/bus/i2c/drivers/max17048/84-0036/power_supply/battery/uevent
POWER_SUPPLY_NAME=battery
POWER_SUPPLY_STATUS=Discharging
POWER_SUPPLY_HEALTH=Good
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_VOLTAGE_MAX_DESIGN=4350000
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=3200000
POWER_SUPPLY_VOLTAGE_NOW=3825000
POWER_SUPPLY_TEMP=290
POWER_SUPPLY_CAPACITY=55
POWER_SUPPLY_CURRENT_NOW=-303005
POWER_SUPPLY_CHARGE_FULL_DESIGN=2300

or while charging:

$ cat /sys/bus/i2c/drivers/max17048/84-0036/power_supply/battery/uevent
POWER_SUPPLY_NAME=battery
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_HEALTH=Good
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_VOLTAGE_MAX_DESIGN=4350000
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=3200000
POWER_SUPPLY_VOLTAGE_NOW=4005000
POWER_SUPPLY_TEMP=285
POWER_SUPPLY_CAPACITY=55
POWER_SUPPLY_CURRENT_NOW=1009776
POWER_SUPPLY_CHARGE_FULL_DESIGN=2300
Posted Wed Jun 27 21:22:29 2018
make your own finger tab

I used very cheap leather tabs for shooting recurve bow. I think the biggest disadvantage of them is the hole where your middle finger should fit through. It bends around the finger and the tab likes to entangle itself, thus will constantly try to avoid laying onto your fingers. Someone of our club suggested other finger tabs, which have a small strap attached to them, which is worn like a ring. I think the majority of finger tabs uses this technique, but they are sometimes quite expensive - especially if you want them with special abilities like a chin rest or adjustable plates.

In our club I saw one guy with a felt tab - I'm not sure where he got this from because I can not find a single shop selling those... He said that he finds the felt type the most comfortable to use. So I thought, I would give felt a try!

From a recent project, I had some 3mm felt with 0.36 density. I cut off a rectangular piece about 70 by 60 mm and reused the finger separator from my old tab.

Then I cut a small strap of leather and sewed it on one end to the felt. I figured out, that a small hole is already sufficient, but it will probably loosen itself over time.

The other end I just put through the same hole as the separator.

I also cut a larger slot between index and middle finger and just a single cut between middle and ring finger. I think this gives you a little bit more flexibility, but you might decide to leave it as it is.

Today I tried the tab and I in my oppinion it works great. You can feel the bowstring much better - which might be painful to you (I think it is just right).

When you make your own, here is a good advice: You probably want to cut the tab to size directly at the shooting range. Never cut off large pieces, as your fingers are very sensitive already for small pieces! So what you feel might might be a huge chunk of material but in reality it is just a milimetre. I made this mistake when cutting to length my old tab. I thought that I would need to remove much material which wasnt the case.

For the future, I might create a new one with a aluminium plate attached. You should also think about a better mechanism to hold the strap, because it will loosen over time. I think the easiest way would be to create small metal plate, which secures the leather strap.

Posted Mon Mar 12 18:44:28 2018
get every nth day of month in the year

Here is a short script to get the nth day in the month for the whole year, e.g. every fourth thursday:

for month in $(seq -w 01 12); do ncal -M $month 2018 | grep Do | awk -v var="$month" '{ print "2018-" var "-" $5 }'

you need to adopt to your locale...

Posted Thu Feb 8 20:57:14 2018
track disk writes

On a system which has de-facto nothing to do (a router basically), I observed constant disk writes with collectd:

As you can see, in 12h alone there was a total write of 3.2GB to the disk.

Using lsof, I could identify all opened files in write mode:

diff <(lsof | awk 'NR==1 || $4~/[0-9]+[uw]/ && $5~/REG/ && $6~/8,1/') <(sleep 30; lsof | awk 'NR==1 || $4~/[0-9]+[uw]/ && $5~/REG/ && $6~/8,1/')

I know that my only physical disk in the system is 8.1, regular files are denoted by REG and write condition is either a w or a u. The SIZE/OFF column gives you some feeling of how many bytes are written in the last 30 seconds.

The output looks like this

< rsyslogd    509             root    6w      REG                8,1  3936622     785024 /var/log/syslog
---
> rsyslogd    509             root    6w      REG                8,1  3937650     785024 /var/log/syslog
8c8
< rsyslogd    509             root   12w      REG                8,1  1636869     786638 /var/log/daemon.log
---
> rsyslogd    509             root   12w      REG                8,1  1637897     786638 /var/log/daemon.log

clearly something was logging to the logs constantly. After watching the logs for a moment I could identify the problem and resolve it.

But I still could not identify the real cause. The log messages had some influence but where not the root cause.

Here comes iotop to the rescue. Start with

iotop -a -o

to see only active processes and accumulate. Let this run some minutes.

I could find a process which would write files every so often, but would not keep them open. Thus they would fall through the search with lsof!

Posted Tue Jan 23 06:54:17 2018
kodi mount discs

There is this "weird" problem: you can not play BluRays that are not mounted and you can not play DVDs that are mounted... So, I created this UDEV script to check if a BluRay or DVD is inserted and mount the disk if necessary.

First of all, you need to configure systemd-udevd to allow mounting into the correct device tree:

mmkdir -p /etc/systemd/system/systemd-udevd.service.d/
vim /etc/systemd/system/systemd-udevd.service.d/myoverride.conf

with this content:

[Service]
MountFlags=shared

Now you can create the udev rule vim /etc/udev/rules.d/82-cdrom.rules:

ATTRS{type}=="5", KERNEL=="sr0", SUBSYSTEM=="block", ENV{ID_PATH}=="pci-0000:00:1f.2-ata-3", ACTION=="change", RUN+="/home/kodi/kodi-play-disc.sh

I also used this useful script to detect if the tray of the drive is open. So download and compile it.

Here is the kodi-play-disc.sh:

/home/kodi/trayopen /dev/sr0
if [ $? -eq 0 ]; then
    # try umount
    grep -q cdrom /proc/mounts
    if [ $? -eq 0 ]; then
        umount /media/cdrom0
        logger "unmounted device..."
    fi
    logger "tray is open"
    exit
fi

logger "BD/DVD detection script started"

# wait a little bit until disk is loaded
sleep 5

blkid /dev/sr0 | grep -q UUID
if [ $? -eq 1 ]; then
    logger "No disk inserted... exit right away"
    exit
fi

# Need to mount first:
mount /media/cdrom0

if [ -f /media/cdrom0/BDMV/index.bdmv ]; then
    logger "this looks like a bluray, keep mounted"
else
    logger "this looks like a dvd, unmounting"
    sleep 2
    umount /media/cdrom0
    logger "umount returned $?"
fi

#logger send play to kodi
#kodi-send --host=127.0.0.1 --port=9777 --action="PlayDVD"
logger "DISC DETECTION exited"

you can also comment in the kodi-send line to play the disc directly.

The sleeps are required so the drive has time to spin up and so on. Otherwise the script will exit too early.

Posted Sat Dec 23 19:24:37 2017
schnitten destroyer

I build a small device to test the orthotropy of Manner Schnitten (a famous Austrian biscuit, consisting of layered waffles with hazlenut creme in between).

The idea was to test, if and how the biscuit would break when the waffles are parallel or perpendicular. In theory, the force required should be larger for the perpendicular case.

I thought about a simple hydraulic mechanism to test it. Syringes would be ideal, I thought, as they are quite cheap and easily available. I would just need to measure the pressure. Good I had a pressure transducer from my Gaggia Pressure Project (no, not the analog one. I bought a digital transducer a while ago but had problems to fixate it in the machine...).

Everthing started with a sketch in FreeCAD:

Using the Sheet Metal workbench, I was able to easily create a drawing for the bended Aluminium frame.

Next, I used the mill in Metalab to create the aluminium frame for the syringes. Here are at least two fotos from the creation process:

Using an old Arduino Uno and a even older Protoshield (which had some other components on it already), I hacked together the software. It reads the sensor value and converts it to mbar. Knowing the area of the syringe, I can convert to the force which acts on the piston.

But now for some images!

The piston

The display unit

Hydraulic mechansim. I used distilled water as medium.

Pressure transducer unit

The piston seen from the back

Arduino unit (the IC's on the protoshield are not used)

Pressure transducer

Starting up!

Parallel configuration

During the measurement

Maximum force is when it breaks (if you are careful...). Reading 24.74N in parallel configuration

Broke to pieces...

Now the same for the perpendicular configuration: 32.69N! Theory confirmed ;)

The break is much cleaner too

The Piston top

Posted Tue Dec 5 11:35:27 2017
epoxy a pcb

I had a small adapter board, where I wanted to isolate the bottom of the board. A good time to see if epoxy would work.

First, I used electrical tape to build a form. I had no idea if it would work, but seemed like a good idea. I also had two mounting holes. I used two small plastic pipes, I cut from a Q-tip to fill the holes.

The top of the PCB, I also covered with electrical tape.

Now I used 5 minute epoxy (which was by the way >8 years old...) and some carbon black pigment to make the epoxy black.

Then I filled the form with epoxy

After some minutes, I removed the electrical tape from the PCB. It was removable very easily without any residue!

Some epoxy found it's way through the form though...

But with a sharp knife, it was easily removable. I also drilled the holes again to clear the hole (not seen in the image).

I had to remove also some epoxy on the back. It looks like the epoxy filled one side too much...

For a first try, it turned out pretty good!

Posted Sat Nov 4 10:13:27 2017