home / blog

JOGL with Java 17

JOGL 2.3.2 fails on Java 17 with errors such as

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 1 at jogamp.opengl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationImpl(WindowsAWTWGLGraphicsConfigurationFactory.java:171) 

There is limited info on this, traced to this nasty

chosenGC = Win32SunJDKReflection.graphicsConfigurationGet(device, winConfig.getPixelFormatID());

This relies on reflection on core JDK classes, obviously a no-no from Java 9 onwards, but things appear to have been tightened further more recently?

For non-modular deployments this can be ‘fixed’ with JVM args


There appears no official fix for this is available, even with latest 2.4.x

During travels I found no official recent JOGL releases on Maven central. There are two choices, use the alternative artifacts like so

implementation "com.metsci.ext.org.jogamp.gluegen:gluegen-rt:2.4.0-rc-20200202:natives-windows-amd64"
implementation "com.metsci.ext.org.jogamp.jogl:jogl-all:2.4.0-rc-20200202:natives-windows-amd64"

Or use the jzy3d repo

maven {
  url "https://maven.jzy3d.org/releases/"
dependencies {
  implementation "com.metsci.ext.org.jogamp.gluegen:gluegen-rt:2.4.0-rc-20200202:natives-windows-amd64"
  implementation "com.metsci.ext.org.jogamp.jogl:jogl-all:2.4.0-rc-20200202:natives-windows-amd64"

Posted in Uncategorized | Leave a comment

Simple minimal install

Refreshing some very old hardware for use with iPlayer etc. Only 2GB RAM and latest Ubuntu is very bloated.

Did minimal install from standard desktop ISO which I happened to have on USB key

# old school - no display manager, just openbox
sudo apt remove gdm3 gvfs cups kerneloops whoopsie modemmanager
sudo apt install openbox

# auto start stuff in openbox
vi ~/.config/openbox/autostart

firefox &
xterm & # gnome-terminal requires all sorts of nonsense

# openbox startup
vi ~/.xinitrc

# start with xinit

# fix audio
sudo usermod -a -G audio adam

Posted in Uncategorized | Leave a comment

Quick photo tidy up

convert from DCIM conventions to date based…

brew install exiftool
exiftool '-FileName<${CreateDate}.jpg' -d %Y%m%d_%H%m%s%%-c -ext jpg *.JPG
exiftool '-FileName<${CreateDate}.mp4' -d %Y%m%d_%H%m%s%%-c -ext mp4 *.mp4
Posted in geek | Leave a comment

Cesium 3D model translation

If you’re using the primitive API rather than the entity API then you do not have easy access to the orientation parameters.

It’s possible to do all this from scratch, but it’s hard work….

var getModelMatrix = function(lon, lat, rotationZ) {
    // 1) create a translation position matrix
    var posMat = Cesium.Transforms.eastNorthUpToFixedFrame(Cesium.Cartesian3.fromDegrees(lon, lat));

    // 2) create a Matrix3 with a given Z rotation
    var rotMat3 = Cesium.Matrix3.fromRotationZ(Math.random() * 360);                        

    // 3) transform the Matrix3 into a Matrix4 with no translation
    var rotMat4 = Cesium.Matrix4.fromRotationTranslation(rotMat3, undefined, undefined);

    // 4) empty matrix to place result in
    var result = new Cesium.Matrix4();

    // 5) multiply position by rotation
    return Cesium.Matrix4.multiply(posMat, rotMat4, result);             
Posted in geek | Tagged , | Leave a comment

Install JavaFX Scene Builder 2.0 without local administrator on Windows

Yes, this is possible, by default the javafx_scenebuilder-2_0-windows.msi installs to all users and tries to registry some fonts etc.

This can be avoided by running the following command. This will install a link to the Desktop, when it is run Scene Builder will install, just click Ignore on all the warnings about failed font installation.

msiexec /ju javafx_scenebuilder-2_0-windows.msi
Posted in geek | Leave a comment

Corrupted mythtv database table [SOLVED]

Started seeing “No seektable” when trying to edit recordings – to set cut points…After investigation turned out the table recordedseek in mythconverg was corrupt.

Tried to fix with this but didn’t work.

mysqlcheck --databases mythconverg --auto-repair

Ended up with this solution. Export database excluding bad table, purge database, rebuild and then replay export file on top. Worked perfectly.

# stop mythtv - just in case
sudo service mythtv-backend stop

# backup without bad table - otherwise mysqldump fails
mysqldump --ignore-table=mythconverg.RECORDEDSEEK -p mythconverg > ~/mythconverg-backup.sql

# remove old
mysql -p
> DROP DATABASE mythconverg
> exit
sudo apt-get remove --purge mythtv-database

# replace
sudo apt-get install mythtv-database
mysql -p mythconverg < ~/mythconverg-backup.sql

# start mythtv again
sudo service mythtv-backend start
Posted in geek | Tagged | Leave a comment

Mounting OS X 10.7.5 anonymous share with Ubuntu 14.04 [SOLVED]

This is the final solution. See failed attempts below and error outputs.

# as line in /etc/fstab
//horse.lan/Movies /data/Movies cifs username=guest,password=none,sec=ntlmssp,nounix 0 0

# using mount
sudo mount -t cifs //horse.lan/Movies  -o username=guest,password=none,sec=ntlmssp,nounix /data/Movies

Attempt 1. Fail. Why. mount.cifs not installed by default.

sudo mount -t cifs //horse.lan/Movies  -o guest /data/Movies

mount: wrong fs type, bad option, bad superblock on //horse.lan/Movies,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount.<type> helper program)
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

Attempt 2 – installed cifs-utils. Fail. Why. Need to use sec option.

sudo apt-get install cifs-utils
sudo mount -t cifs //horse.lan/Movies  -o guest, /data/Movies

mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
# dmesg output
[208134.060470] Status code returned 0xc000006d NT_STATUS_LOGON_FAILURE
[208134.060484] CIFS VFS: Send error in SessSetup = -13
[208134.060648] CIFS VFS: cifs_mount failed w/return code = -13

Attempt 3 – added sec option. Fail. Why. Guest option doesn’t work with OS X. Need to use username=guest,password=none.

sudo mount -t cifs //horse.lan/Movies  -o guest,sec=ntlmssp /data/Movies

mount error(13): Permission denied
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
# dmesg output
[208134.060470] Status code returned 0xc000006d NT_STATUS_LOGON_FAILURE
[208134.060484] CIFS VFS: Send error in SessSetup = -13
[208134.060648] CIFS VFS: cifs_mount failed w/return code = -13

Attempt 4 – added manual setting of username/password. Fail. Why. Needs nounix option

sudo mount -t cifs //horse.lan/Movies  -o username=guest,password=none,sec=ntlmssp /data/Movies

mount error(95): Operation not supported
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

# dmesg output
[208260.854805] CIFS VFS: Send error in QFSUnixInfo = -95
[208260.856792] CIFS VFS: cifs_read_super: get root inode failed

Attempt 5 – added nounix option. Win ! Success

sudo mount -t cifs //horse.lan/Movies  -o username=guest,password=none,sec=ntlmssp,nounix /data/Movies

Posted in geek | Tagged | Leave a comment

Ubuntu 14.04 Mythtv box setup notes

# extra repos
sudo apt-add-repository ppa:ehoover/compholio
sudo add-apt-repository ppa:jon-hedgerows/get-iplayer
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'

# update
sudo apt-get update
sudo apt-get dist-upgrade

# essentials
apt-get install openssh-server emacs

# static IP address
sudo emacs /etc/network/interfaces
auto eth0
iface eth0 inet static

# restore home directories from backup
chown -R mythtv:mythtv ~mythtv
chown -R adam:adam ~adam

# apps
sudo apt-get install mythtv mythweb xmltv-util dvb-apps google-chrome-stable get-iplayer vlc mplayer

# util
sudo apt-get install ethtool nmap git php5-cli cifs-utils

# hardware
sudo apt-get install nvidia-current r8168-dkms

# restore mythtv database
sudo service mythtv-backend stop
mysql -u root -p < backup.sql
sudo service mythtv-backend start
# change mythtv password in database to match /etc/apache2/sites-available/mythweb.conf and ~mythtv/.mythtv/config.xml
mysql -u root -p
update mysql.user set Password=PASSWORD('password') where user = 'mythtv';

# enable auto login
sudo emacs /etc/lightdm/lightdm.conf

sudo emacs ~/config/autostart/mythtv-frontend.desktop
[Desktop Entry]
Name=mythtv frontend

# Bugfix - stop screen blanking
sudo apt-get remove gnome-screensaver

# configure listings
su mythtv tv_grab_uk_rt --configure
# add update script to crontab
sudo mythtv crontab -e

# remove unnecessary stuff
sudo apt-get remove indicator-bluetooth indicator-keyboard indicator-messages indicator-power  evolution-data-server modemmanager cups-browsed ubuntuone-client cups  unity-lens-video unity-lens-photos unity-lens-music unity-lens-friends unity-lens-files zeitgeist
Posted in geek | Tagged , | Leave a comment

iperf bandwidth testing woes – killing cleanly etc.

When running iperf on Windows platforms it is difficult to shut it down cleanly, without leaving stray child processes – especially if using within Java using ProcessBuilder.

The solution I’ve discovered takes two approaches. Firstly run iperf server using the lesser known -P 1 switch, this causes it to shutdown after the client has connected.

The second issue is stray processes left. It seems that ProcessBuilder.terminate() and ProcessBuilder.terminateForcibly() won’t kill child processes. The way to do it is to send a SIGINT, i.e. a -2 or Ctrl-C in Linux. Unfortunately Windows + Java doesn’t allow such niceties. Fortunately there is an amazing Third Party library called Sigar which will save the day. This keeps your code platform independent.

Sigar sigar = new Sigar();
sigar.kill(12345, "SIGINT");
Posted in geek | Tagged , | Leave a comment

Installing JDK 6, 7, 8 on Windows XP (without admin) [SOLVED]

  • 7zip extract the .exe
  • unzip the tools.zip
  • Create a install.bat in the top level directory
    FOR /R %%f IN (*.pack) DO .\bin\unpack200.exe -r -v "%%f" "%%~pf%%~nf.jar
  • Extract the src.zip from an equivalent linux tar.gz distribution as 7zip doesn’t manage to extract this – it’s the same file
Posted in geek | Leave a comment