Gadgets & hobbies

Electronic gadgets, hobbies, developing

Belkin KVM: Falied to validate certificate

After one of JVM updates, my Belkin KVM (Remote IP Manager) has started refusing to start with “Falied to validate certificate” error followed by “PKIX path validation failed”:

I’ve found following exceptions in Java console:

sun.security.validator.ValidatorException: PKIX path validation failed: java.security.cert.CertPathValidatorException: Algorithm constraints check failed on disabled signature algorithm: MD5withRSA
 at sun.security.validator.PKIXValidator.doValidate(PKIXValidator.java:352)
 at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:249)
...

and

com.sun.deploy.security.BlockedException: User has denied the privileges to the code
 at sun.plugin2.applet.Plugin2ClassLoader.getPermissions(Unknown Source)
 at sun.plugin2.applet.Applet2ClassLoader.getPermissions(Unknown Source)
 at java.security.SecureClassLoader.getProtectionDomain(SecureClassLoader.java:206)
 at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
 at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
...

Google says that this is pretty common problem and returned plenty of receipts how to fix it.

Scanning the system for potential locations of the java.security file, there are four candidates. However, there is a catch: we should fix Java not in the system-wide location but the Java plugin for the web browser you’re using (Safari on MacOS in my case).

Jareks-MacBook-Pro:~ jhartman$ locate java.security
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/security/java.security
/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/security/java.security
/Library/Java/JavaVirtualMachines/jdk1.8.0_102.jdk/Contents/Home/jre/lib/security/java.security
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre/lib/security/java.security

So we can skip the last three locations and just focus on the 1st one. Change the lines as described

Jareks-MacBook-Pro:~ jhartman$ edit "/Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/lib/security/java.security"

jdk.certpath.disabledAlgorithms=MD2, RSA keySize < 256, \
 DSA keySize < 1024, EC keySize < 224
jdk.tls.disabledAlgorithms=SSLv3, RC4, DH keySize < 768, \
 EC keySize < 224

Save and restart the browser (Safari). This time the KVM applet can start (after plenty of security warnings though).

Update

The application has to be also white-listed, otherwise it will generate error as below:

Open System Preferences, Java settings and add IP address of your KVM to the list:

Add following:

Again: save and restart your browser.

How to check if all Calibre books are already in the Amazon cloud?

Preface

My primary software for managing Kindle books is Calibre. I’m using Amazon cloud for books synchronisation and sometimes I’d like to ensure that all my books stored in Calibre have been already sent to the cloud. Mainly, to avoid re-sending books and avoid duplicates.

Getting a list of Amazon books

Refer to Kindle Library List article.

After executing this step you should have one or more text listing your books:

Jareks-MacBook-Pro:Downloads jhartman$ java -jar KindleLibrary.jar 1.htm
Amazon book list extractor
Elements found:400
Saving 1.html
Saving 1.txt
Saving 1.xml
Done!
Jareks-MacBook-Pro:Downloads jhartman$ java -jar KindleLibrary.jar 2.htm
Amazon book list extractor
Elements found:400
Saving 2.html
Saving 2.txt
Saving 2.xml
Done!
Jareks-MacBook-Pro:Downloads jhartman$ java -jar KindleLibrary.jar 3.htm
Amazon book list extractor
Elements found:373
Saving 3.html
Saving 3.txt
Saving 3.xml
Done!

Getting a list of Calibre books

Now open your Calibre, press a small triangle icon next to the Convert Books icon. Follow the instructions below:

After pressing OK you should get your Calibre books:

Jareks-MacBook-Pro:Downloads jhartman$ head CalibreBooks.csv
title,authors
"Świat pani Malinowskiej ; Trzecia płeć","Tadeusz Dołęga-Mostowicz"
"Drugie życie doktora Murka","Tadeusz Dołęga-Mostowicz"
"Świat pani Malinowskiej","Tadeusz Dołęga-Mostowicz"
"Wysokie Progi","Tadeusz Dołęga-Mostowicz"
"Złota maska","Tadeusz Dołęga-Mostowicz"
"Morderstwo pod cenzura","Marcin Wroński"
"Wąż Marlo t1","Marcin Wroński"

Compare the lists

In the very last step, use tide up the output files.

#!/usr/bin/env bash

awk -F $'\t' '{print $1,$2}' 1.txt > Amazon.tmp
awk -F $'\t' '{print $1,$2}' 2.txt >> Amazon.tmp
awk -F $'\t' '{print $1,$2}' 3.txt >> Amazon.tmp
sort Amazon.tmp > Amazon.txt

awk -F ',' '{print $1,$2}' CalibreBooks.csv | sed 's/"//g' | sort | grep -v "title authors" > Calibre.txt

And finally – use a side-to-side text compare tool (JEdit, WinMerge, any other) and view the differences between Amazon.txt and Calibre.txt:

Review the differences and take proper actions:

  • Send the file to the cloud
  • Remove duplicates in the cloud (yes, this will be also visible in the output)

I hope it will help.

(more…)

Alfred 3 workflow – Time Zone

Do you like Alfred? I like too… I’ve recently found bunch of very nice Workflows. For me, the most used one is for sure Time Zone.

The workflow has been created by Mr Carlos from New Zealand and published on the Alfred Forum. I’ve enhanced the workflow by adding a few new functionalities:

 

 

 

  • Migration to Alfred 3
  • Converting any time to all pre-defined time zones
  • Enabling 24-hrs time format
  • Displaying phone country code

After all it looks like below:

Conversion of a time in your local time to your pre-defined time-zones – “tz <time>” in formats HH, HHMM or HH:MM:

CarlosNZ, thanks for this great tool!

Updated version can be downloaded from Time Zones v1.8.

(more…)

From Drupal 6 to Drupal 8 and… finally at WordPress

Website update & engine refreshment (announced in Changes, changes post) took me really a lot of time (it might be 12-18 months or so). For whole this time I was scratching my head how to migrate old Drupal 6 with plenty of dirty configs to the latest & greatest version.


I’ve had plenty of attempts for migration, including Drush, Drupal migration plugin, even manual (!!) – in each of them, the result was not really satisfying:

 

  • Content and formatting was not migrating correctly
  • Multi-language pages made the migration tools totally confused

Time was flying and I couldn’t run away from buggy and insecure D6.

(more…)

Changes, changes…

After years, significants changes on the site:

  • New domain! Finally, I managed to get my personal domain http://jhartman.pl hence I’m not tied to webd.pl
  • It turned out that it’s easier to migrate my old Drupal 6 to WordPress rather than to Drupal 8. Therefore I’m now on the new engine and so far I’m pretty happy
  • Attempted to AdSense, however Google is pretty picky and I’m not really sure if I will get approval

Withings to Garmin Connect

Since a while I’m owning great Withings Scale which has a capability to store measurements in a cloud. Because I’m using Garmin GPSes (and Garmin Connect), I’d love to synchronize the measurements to the Garmin Connect site.

Lucky, I found a great script garmin-withings.

Unfortunately, after latest changes in the Garmin Connect (implementation of SSO on march 2014) the script stopped to work. I’ve compiled changes proposed by https://github.com/cpfair/tapiriik and it seems that the script with my updates works again (well, at least until further changes in Garmin Connect…)

You can find the script on https://github.com/jaroslawhartman/withings-garmin-v2

ToDo

Garmin Connect can display a lot of other parameters, not only weight and body fat level:

Measurements

It would be great to calculate all these figures and post them to Garmin Connect, right? 🙂

Half-Life 1 on Wine

Almost 20 years after game release I wanted to play it to check if it provokes same feelings.

As I’m on MacOS now, the obvious choice was to use Wine to run the game.

After setting Wine environment and installing the game, it turned out that although the game starts up, it’s completely un-usable as we can see just 1/3 of the screen, without any option to change the resolution:

$ wine hl.exe -startwindowed

HL1

(more…)