Blog

Start Java virtual machine (JVM) from C++Builder or Delphi application - the JNI Invocation API

This text describes how a JavaVM (and hence a Swing application) can be started from  a C++ program developed in Borland (or Codegear or Embarcadero)  BDS 2006 / RAD Studio /  C++ builder. The Java VM is started by means of the so-called "Invocation Interface". The Java program resides in the same process space as the calling application, and the C++ application can (almost) directly call methods from the Java-application (and the other way around).

Apache derby or javadb client ij from a windows batch file

To connect ij to a derby-database from a windows batch script seems to be not too well documented, but it turns out to be extremely easy : you can set environment variables in advance. (I wanted to use the provided batch files for setting the classpath etc.)

@echo off

set DERBY_OPTS=-Dij.user=XXXXX -Dij.password=YYYYY -Dij.database=jdbc:derby://localhost/DATABASENAME

set DERBY_HOME=c:\Program Files\Sun\JavaDB\

Use the provided batch file from the Javadb installation :
"c:\Program Files\Sun\JavaDB\bin\ij.bat"

Find a formatted number (phone number, ...) in a MySQL table from a differently formatted search word

Often one has to retrieve a record based on - say - a phone number. The phone numbers in the database may have some layout (e.g. +32 412/123.123.123). A user who types a differently formatted search word (e.g. 412-123 12.31-23, so with different punctuation and without countrycode) still expects to find the correct row in the database.

Cannot send mail via MAPI : MapiLogon returns MAPI_E_USER_ABORT

Setting : a HP PC on which originally a Microsoft Office trial version was pre-installed. It was removed (not sure if the trial was effectively fully installed before). Thunderbird was installed (Thunderbird has simple mapi support). When trying to send mail via MAPI (from a Delphi program), this failed with 'The user canceled one of the dialog boxes, ...' (which is MAPI_E_USER_ABORT).

On several other PC's we could solve this same scenario by

- setting outlook express as the default email/newsgroups program

- close all programs

Sign a Java Web Start application with your own key in Netbeans

Java Web Start applications have to be signed in order to get certain permissions (accessing different websites e.g.) on the client computer. By default, if the "self-sign" property is on, Netbeans signs Java Web Start applications with a key which is only valid for 6 months and generated on the fly during the build process. This key is different for each build, which is not convenient.

In order to sign Netbeans JNLP's with your own key, turn off the "self-sign" property, and :

Netbeans platform EE-client-application as a signed Web Start application (JNLP), with long-term certificate

We summarize the steps required to deploy a Netbeans Platform Suite which consumes an EJB as a Java Web Start application in Glassfish.

VCL component to render and show HTML in Delphi or C++ builder

I came across this nice set of VCL components, now free and open (MIT-style license I guess), which allows you to render and show a relatively extensive set of html constructs inside a C++ builder application. It can even do some CSS. Using HTML in Delphi or c++ Builder has always been cumbersome (with the TCppBrowser components delivered in the Borland/Codegear/Embarcadero VCL package that actually mask Internet Explorer which then starts stealing your keyboard shortcuts).

Test available certificate authorities installed in Glassfish (or any https-server)

If you want to test if the installation of a trusted CA in Glassfish (or any SSL-based http-server) has succeeded (see e.g. http://www.nogid.org/Belgian-identity-card-Glassfish-beid-eid ), you can test with

openssl s_client -connect host:port

If you need to navigate to a page (e.g. root page does not require client auth), add -prexit to the openssl-command line and type GET /pagename/ (e.g. GET /MyContextRoot/) in the openssl program.

This will show a long response containing :

[...]
---
Acceptable client certificate CA names
[...]

Belgian identity card ( Beid / EID ) : user authentication in Glassfish

In order to have a web application running on Glassfish 2.1 (http://www.glassfish.org) use the Belgian electronic identity card (eid) for authentication :

First, download the certificates from  http://certs.eid.belgium.be/belgiumrca2.crt and http://certs.eid.belgium.be/belgiumrca.crt.  (see also http://eid.belgium.be/nl/Achtergrondinfo/De_eID_technisch/index.jsp )

Now configure glassfish. The utility "keytool" can be found in your JDK bin-directory.
 

Digon. CRM- en ERP-software voor KMO / MKB

Syndicate content