« Back to home

Bluemix J2EE basics with Eclipse and WAS Liberty Profile

IBM Bluemix is a cloud platform build around Cloud Foundry, OpenStack, and other popular open source projects. As well as using it to deploy Go, nodeJS and PHP applications, you can use it to develop J2EE applications. To do so, you can use WebSphere Liberty, a clean ground-up implementation of J2EE in a single 60MB download. Don’t confuse it with the old WebSphere Application Server — this new beast can start up in seconds and run in 512MB of RAM.…

Read more »

Better string lists in XPages

Like Notes, XPages supports multi-valued fields. You can set a separator for multiple values, and tell XPages whether to trim whitespace from around each value. Unfortunately, if you have (say) a list of string values, the separator ends up with no whitespace after it. This can look ugly: Mon,Tue,Wed Ideally we’d like to display the multiple values with a space after each comma, and also accept separators like newline or semicolon when entering data.…

Read more »

Domino XPages namePicker vs Directory Assistance

A common need in Domino applications is a way to add one or more users to a list using their Domino IDs, for example to add additional allowed editors to a document. In the Notes client, this is pretty easy — you select “Use Address dialog for choices” in a drop-down, and optionally check the two boxes to turn on autocomplete. Done. In XPages, it’s nowhere near that simple. The XPages Extension Library — which is now a standard part of Domino — provides a Name Picker componebnt, xe:namePicker.…

Read more »

The worst mergers and acquisitions

ZDNet ran a story in the week before Halloween about the worst tech mergers and acquisitions. Here are my thoughts on some of them. Caldera and SCO Xenix was the first Unix I ever used. It’s how I ended up using the C Shell — I remember the Xenix box as only having csh, though it’s possible that it also had a really feature-poor version of sh. Either way, csh was the only sane option for interactive use.…

Read more »

XPages JavaScript mystery meat

When using XPages, I try to build as much as possible in Java, and then use as little JavaScript as possible to glue the Java code into XPages. The main problem I hit when doing this is ensuring that my Java methods have the right type signatures to get found and called by JavaScript. It’s confusing to call someMethod(true) and find that you get a run-time error saying there’s no Java method someMethod(boolean), even though there is.…

Read more »

SLF4J and XPages Java debugging

I like to write code once and be able to run it both in the Domino XPages environment, and in regular Java environments. That means I don’t want to use any Domino-specific logging. I also like the SLF4J interface, at least on the Java source code side of things. In particular, I like how easy it is to log values using parameterized logging: // Painful JDK logging Logger logger = Logger.…

Read more »

OSGI "Hello World" with Eclipse Luna

If you follow a simple tutorial to set up an OSGI project, there’s a good chance that running your project will cause the console window to fill up with errors and backtraces. The root cause seems to be that by default, Eclipse assumes that your OSGI bundle wants to run inside a complete Eclipse runtime. So when you choose Run, Eclipse tries to run your bundle inside another instance of Eclipse running inside Eclipse.…

Read more »

JDK 8 JavaScript scripting experiment, with added Domino

Oracle’s new JDK 8.0 includes a new JavaScript engine called Nashorn, designed to support both embedded JavaScript in Java applications, and standalone command-line JavaScript. As well as accessing JavaScript from Java code, you can do the reverse, and access Java classes from JavaScript — just like in IBM Domino XPages. The new scripting features are now a standard part of the JRE. For now, the command to actually run a script is described by Oracle as “experimental and unsupported”, but I wasn’t going to let that put me off; I immediately wondered how easy it would be to write a command-line script which accessed Domino data, using only JavaScript.…

Read more »

Java file I/O in 2014

There are lots of articles about file handling in Java. However, a lot of them seem to be out-of-date, given the advent of New IO (NIO) and the enhancements in Java 1.7. So, I sat down with the J2SE 7 JavaDoc, and put together this guide to how to do modern Java file I/O. Step 0 Before you start dealing with file streams, see if Java NIO will do all the work for you.…

Read more »

Attack of the Heisenbug

This week I battled a bug which was exceptionally sneaky at hiding itself. Consider the following Domino Java code accessing a single-valued date-only field: Document doc; […fetch document…] Vector v = doc.getItemValueDateTimeArray("SomeDateField"); DateTime dt = (DateTime) v.get(0); Date jdt = dt.toJavaDate(); System.out.println(dt.toString() + " = " + jdt.toString()); What happens when you run the code? Well, the getItemValueDateTimeArray() call fetches the contents of the Notes item (field) from the document, and returns it as a Vector of Notes DateTime objects.…

Read more »