Aside

Fixing a slow UI of a Java application running on Windows 10 in VMware Fusion

When maintaining systems for customers, I regularly use Windows 10 for VPN’ing to their systems and DbVisualizer for querying databases. However, recently the DbVisualizer user interface (UI) became sluggish and with what seemed like very slow refresh rates.

I suspected that some programmatically changed 3D settings of the virtual machine running in VMware Fusion or the settings in Windows 10 could be to blame, and I tried changing them systematically, but to no avail.

I then turned to tuning the Java VM graphics-related parameters and found that adding the following property (and restarting DbVisualizer) did the trick:

-Dsun.java2d.noddraw=true

Now, DbVisualizer is again speedy as I don’t know what. 

Aside

Troubleshooting “detected broken kqueue” on macOS

When attempting to compile a program using the Crystal compiler on macOS Sierra 10.12.1, I ran into the following error:

[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
[warn] kq_init: detected broken kqueue; not using.: Undefined error: 0
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I solved the problem by reinstalling libevent:

brew update && brew reinstall libevent

…and then reinstalling the Xcode command-line tools:

xcode-select --install

Afterwards, I was able to run crystal -v and compile my program without any errors. 

Sources

https://github.com/Homebrew/homebrew-core/issues/2869

Aside

What to do when an external hard drive won’t mount on OS X

I recently experienced the that my external Western Digital My Book hard drive wouldn’t mount the WD Unlocker partition (for encrypted drives) on Mac OS X as it usually does.

Skimming though the console logs, I found a rather disturbing error message that described why the partition couldn’t be mounted:

28/07/2016 20.48.34,000 kernel[0]: disk2s0s2: alignment error.

After doing some googling, it seemed as if the disk was toast: in some forum posts, WD staff suggested that people should get the disk replaced if they experienced such errors. In other threads, it would seem that people suddenly experienced the error after upgrading to OS X 11.something.

Apparently, it all relates to the partition table information somehow being in an inconsistent/erroneous state, and OS X thus not being able to read the disk at all. OK, so OS X not being able to read the data, let alone not being able to fix the problems, is bad enough by itself, but the thought of not being able to recover the data on the disk at all was pretty annoying.

Luckily, I have had great experiences with installing file system drivers for various non-native file systems in different operating systems, and I thought that installing a driver for OS X’s HFS+ on a Windows box, and attaching the external hard drive to it, just might do the trick, as the driver, and the way that the operating system would access the disk might be different from what OS X does natively.

So, I installed the HFS+ driver for Windows 10 from Paragon Software, and after connecting and unlocking the drive with the Windows-based WD software, the HFS+ partitions showed up, and I was able to access the data without any problems whatsoever. Afterwards I tried reconnecting it to OS X, and the WD Unlocker partition showed up just as it had before the error.

Aside

Connecting DbVisualizer to Heroku Postgres

DbVisualizer is a fantastic cross-platform database client, and I wanted to connect it to a Heroku Postgres instance I just spun up.

Postgres on Heroku is SSL-enabled with self-signed certificates, so for the connection to work in DbVisualizer, I had to define two special driver properties for the PostgreSQL JDBC driver:

  1. ssl was set to true
  2. sslfactory was set to org.postgresql.ssl.NonValidatingFactory

Observe the screenshot below to identify the configuration of the properties:

Screen Shot 2016-06-05 at 13.18.40

 

Sources: http://bartling.blogspot.com/2013/06/connecting-dbvisualizer-to-heroku.html and https://devcenter.heroku.com/articles/connecting-to-heroku-postgres-databases-from-outside-of-heroku

Aside

Accessing a locked HSQLDB database file in read-only mode

Working a lot with the Atlassian tools (JIRA, Confluence, Crowd, Stash etc.), I often have to connect to the databases running behind them in order to perform various SQL queries on the data.

In a couple of use cases, it’s very convenient just to use the standard embedded HSQL database (HSQLDB) instead of a standalone relational database management system. However, with HSQLDB running in embedded mode, a lock file is set on the database file to inhibit other JDBC connections from writing to the database, which is, of course, very sensible (wouldn’t want any inconsistent data, now would we).

Database lock acquisition failure: lockFile: org.hsqldb.persist.LockFile@d446e57c[file =/SOME_FOLDER/database.lck, exists=true, locked=false, valid=false, ]

To remove the lock on the database file, we would have to stop the application altogether. However, in many cases I want to query the database in read-only mode while the application is running, and fortunately the HSQLDB JDBC driver provides a property that can be set to provide lock-ignoring read-only access to the database file.

My database query tool of choice is the excellent Java-based tool called DbVisualizer, and setting the property can be done very simply in the Driver Properties tab of the connection settings view, adding a parameter “readonly” with value “true”.

HSQLDB readonly property in DbVisualizerWith that set, all that is left is rock and roll – SQL style! 


Further reading

Atlassian: Connecting to HSQLDB using DBVisualizer or HSQL database manager