Wednesday 4 December 2013

Java: JSON to XML with JAXB and Jackson

Here's a small example demonstrating how to convert JSON to XML using JAXB data binding. You might want to use this over streaming where you want to operate on objects in an intermediary step. It is possible to perform the reverse operation but that is not demonstrated here.

  • Java 7
  • Jackson 2.2
    • jackson-core-2.2.0.jar
    • jackson-databind-2.2.0.jar
    • jackson-annotations-2.2.0.jar
    • jackson-module-jaxb-annotations-2.2.0.jar

Wednesday 20 November 2013

Java: notes on IBM's multitenant v8 beta JVM

I thought I'd take a look at IBM's Java 8 beta multitenancy support. This is a mechanism for sharing runtime resources across Java virtual machine instances. See developerWorks' "Introduction to Java multitenancy."

I installed ibm-java-sdk-ea-8.0-0.0-x86_64-archive3.bin on Linux using a CentOS-6.4-x86_64-LiveCD.iso based host.

Saturday 9 November 2013

HOWTO: create WebSphere AS 8.5.5 development workspace in Eclipse

This post is a follow-up to HOWTO: script WebSphere AS 8.5.5 internet install and describes the post-install steps to create a development workspace.

The clean install described in the previous post requires further configuration before you can start the server and deploy applications.

Wednesday 9 October 2013

HOWTO: script WebSphere AS 8.5.5 internet install

This post describes how to perform a scripted install of a WebSphere Application Server (WAS) development environment from the internet. This is adequate if you want automated installation that will be repeated infrequently. Prior knowledge of WAS, Eclipse and Linux is assumed.

IBM has at least three offerings for basic Java EE development:

  • WAS for Developers - the full-fat commercial WAS server
  • Liberty Profile - a lightweight, developer-friendly server
  • Community Edition - a blue-washed Apache Geronimo

The scripts described here install the first two options with IDE tooling and Java 7. Eclipse Juno is the latest release with this level of WDT support.

Formally, the following are installed:

  • IBM WebSphere Application Server for Developers 8.5.5.0
  • IBM WebSphere SDK Java Technology Edition 7.0.4.1
  • IBM WebSphere Application Server Liberty for Developers 8.5.5.0
  • IBM WebSphere SDK Java Technology Edition Version 7.0 for Liberty 7.0.4.1
  • Eclipse IDE for Java EE Developers (Juno Sr2; Eclipse 4.2)
  • WebSphere Application Server V8.5 Liberty Profile Tools
  • WebSphere Application Server V8.5 Tools

Friday 4 October 2013

Java: writing a MongoDB driver

I didn't set out to write a MongoDB driver; it came about while I was trying to write proof-of-concept code for my Java binary protocol API. The MongoDB wire protocol just happened to be well documented and easy to implement.

Caveats:

  • No binaries have been published; sources are in a git repository.
  • The code presented here is not a substitute for the official driver.
  • Information pertains to MongoDB 2.2.4.
  • APIs may change without warning.

This post is informational; not a tutorial. Everything presented here is pre-alpha code.

Friday 27 September 2013

Toshiba Equium A110-233: keyboard malfunction

The H key stopped working on a Toshiba Equium A110-233 - an obsolete but until now reliable laptop. This was a problem as H was in the power-on password. Notes on the Equium:

  • It uses a Fn key to emulate a numeric keypad but it won't emit Alt code based characters.
  • It recognises USB keyboards at boot time/in the BIOS.
    • The Advent K112 wired USB keyboard was the cheapest I could find at short notice
    • .

Sunday 15 September 2013

Java: "Did you mean 'stream'?" (Java 8 pre-release)

This post re-implements the "did you mean..?" spell checker from an earlier post using the new Stream type in Java 8.

Saturday 14 September 2013

Java: lambdas, streams and functions (Java 8 pre-release)

The JDK 8 Developer Preview came out recently so I thought I would take a look at the API enhancements. This post demonstrates how refactoring to utilize the new types can change code.

This post refers to JDK build 1.8.0-ea-b106. IntelliJ IDEA has good Java 8 syntax support.

Tuesday 25 June 2013

Go: Unicode on the Windows command prompt (golang)

Go (golang.org) has pretty good Unicode support on the Windows command line. I've written about Unicode and cmd.exe before in the context of C++, C# and Java.

Versions: Windows 7 (64-bit); go1.1.1 windows/amd64; Java 1.7.0_21

Thursday 6 June 2013

Java: detecting JSON character encoding

JSON documents are generally encoded using UTF-8 but the format also supports four other encoding forms. This post covers the mechanics of character encoding detection for JSON parsers that don't provide handling for them - for example, Gson and JSON.simple.

EDIT: 2014; a version of this library has been published to Maven central.

Sunday 17 February 2013

JavaScript: debugging with embedded Rhino in Eclipse

The Eclipse JavaScript Development Tools allow step-through-debugging of JavaScript files using a provided Rhino instance. The Wiki describes how to utilise Eclipse plugins to connect your own embedded Rhino context to Eclipse.

Versions: Java 7; Rhino 1.7R4; Eclipse Juno (4.2) SR1 (Eclipse IDE for Java EE Developers).

Saturday 16 February 2013

Java: caseless strings

The simple task of trying to match strings without regard to upper or lower case is surprisingly hard when you try to take into account different language conventions. Things get more complicated when you start to consider accented letters and the legacy of typography.

This post discusses the Java 7 implementation which is documented to suport Unicode 6.0.0.

Note: graphemes will vary based on rendering engines and system fonts.

Sunday 10 February 2013

JavaScript: debugging with embedded Rhino

Mozilla's Rhino engine includes a step-through debugger. It is relatively easy to embed this in your own Java application.

Versions: Rhino 1.7R4 on Java 7.

Thursday 31 January 2013

Java: validating regular expression syntax during compilation

Java doesn't support regular expression literals like some other languages. Still, you can get half way.

Wednesday 23 January 2013

Dojo: bootstrapping in an embedded Rhino context

Dojo supports Mozilla's Rhino engine for things like headless DOH tests and builds. This post demonstrates how to bootstrap Dojo using an embedded context.

This information pertains to Dojo 1.7.2, Rhino 1.7R2 and Java 6. Knowledge of JavaScript, Dojo and Java is assumed.

Friday 18 January 2013

JavaScript: AMD module dependency analysis with the Java Rhino engine

The Asynchronous Module Definition (AMD) API provides powerful modularization options to JavaScript developers. But this introduces its own problems when it comes to dependency management. As this post demonstrates, Mozilla's Rhino engine offers developers a means to analyze these dependencies.