A common problem when using confidential data is how to save it. Usually you would encrypt this data and save a encrypted version.

Java provides several build-in algorithms for symmetric-key cryptography (AES, DES …). To use those algorithms, you have to generate a secret-key and initialize a cipher for decryption and one for encryption with it.Those ciphers can now be used to crypt your data.

To simplify this task, I created a small library which provides the needed methods to decrypt and encrypt a String. There are several static methods to automatically initialize a crypter for a certain algorithm such as AES.

How to encrypt and decrypt a String:

Crypter myCrypter = Crypter.getAES_Crypter();
String encrypted = myCrypter.encrypt("my secret text");
String decrypted = myCrypter.decrypt(encrypted);

Download:

Library

Source

A big thank you goes out to the author of the used Base64-Coder: http://www.source-code.biz/

Innerhalb eines unserer Projekte lernen wir gerade die Vorteile von Maven kennen. Dies betrifft vor allem das dynamische Nachladen von benötigten Libraries und die Möglichkeiten, die man zum Deployen einer Anwendung hat.

Bei unserem Projekt handelt es sich einerseits um eine Tapestry 5 Anwendung. Diese lässt sich auf jedem beliebigen Server mit installiertem Maven über den Befehl

mvn jetty:run

starten.

Auf der anderen Seite haben wir dann noch eine einfache Java-Anwendung, die eine Verbindung über einen Socket aufbaut.

Als Einführung ins Thema Maven haben wir uns das folgende Buch gekauft:
Maven: A Developer’s Notebook (Developer’s Notebooks)

Zwar behandelt es eine etwas ältere Maven Version, es ist aber gut für die Grundlagen geeignet.

I just created a small piece of java-code, which allows you to receive geo coordinates (longitude / latitude) for a certain address.

It’s quite simple to use:

final CoordinateTool ct = new CoordinateTool();
final Coordinate coord = ct.getCoordinateForAddress(YOUR_ADDRESS);

Another feature is the possibility to load a route from A to B. You have the possibility to get this route as String or to save it to a File.

final CoordinateTool ct = new CoordinateTool();
final String route = ct.getRouteForAddresses(YOUR_ADDRESS, YOUR_DESTINATION);
ct.saveRouteForAddresses(YOUR_ADDRESS, YOUR_DESTINATION, FILENAME);

If you need the distance between two addresses or coordinates, you can use this “getDistanceBetween” method.

Download:

Library

Source.