Wednesday, 29 August 2012

Java: adding state to interfaces in Java 8 (pre-release)

Java 8 introduces the concept of default methods to interfaces and this post looks at the cost of adding state to them.

This information pertains to the pre-release version of Java 8 mentioned in a previous post.

Wednesday, 22 August 2012

Java: checked exceptions and lambdas in Java 8 (pre-release)

Update: Java 8 has been released and I've implemented a library with a more elegant approach to exception handling than the one described in this post: details + downloads; source code; blog posts.


This post looks at the effect of lambdas on checked exception handling.

This code uses a pre-release Java 8 build. See the previous post for more.

Sunday, 19 August 2012

Java: lambda support in Java 8 (pre-release)

Pre-release builds of Java 8 with lambda support are available for download. This post looks at lambda-8-b50-linux-x64-26_jul_2012.tar.gz.

Sunday, 29 July 2012

JSF: CDI and EL

The Contexts and Dependency Injection (CDI) API introduced in Java EE 6 complements the JSF framework. There are good reasons to favour it over JavaServer Faces (JSF) managed bean mechanisms.

CDI doesn't do everything and there are edge cases where you might want to make use of Expression Language (EL) bindings during dependency injection. Fortunately, the gaps between these APIs are easy to fill.

Wednesday, 27 June 2012

WebSphere Portal: users versus spiders - form reset issue

Some users can run afoul of Portal's user-agent rules. Symptoms include the inability to log in and form submissions just causing page refreshes where all the form data is lost.

The problem is an intersection of two things:

  • Pestware installed in the browser that changes the user-agent.
  • WebSphere Portal misinterpreting the user-agent type and altering application behaviour.

See Technote 1441915 for IBM's support analysis.

Saturday, 26 May 2012

Dojo: adding your own loader plugins

define(["dojo/text!./path/some.txt"], function(textData) {

Dojo's AMD loader has some useful contextual loading features. Note the exclamation mark in the dependency. dojo/text! can be used to load character data; dojo/has! can be used to load different modules based on environment.

Writing your own plugin is relatively trivial.

Saturday, 5 May 2012

HOWTO: install WebSphere Portal 7 on CentOS 6.2

A short post about setting up a trial WebSphere Portal Express server on the (unsupported) CentOS operating system.

Friday, 4 May 2012

ThinkPad X121e: running 64-bit guest operating systems

Like many programmers, I like to run virtual machines to isolate development and test environments from everything else I do on my laptop. My Lenovo ThinkPad didn't support all the virtualization features I wanted out of the box, but it was relatively trivial to enable them.

Errors from virtualization software manifest as complaints about missing VT-x support or a failure enabling long mode. Virtualization support needs to be enabled in the BIOS. Instructions are provided in the user guide.

Saturday, 7 April 2012

Dojo: mocking dependencies with DOH

This post demonstrates a way to use the Dojo 1.7 AMD loader to provide mock/stub/fake/dummy artefacts in place of the defined dependencies.

Wednesday, 4 April 2012

Dojo: version 1.7 and the AMD loader

Along with a few other JavaScript libraries, Dojo is making the transition to the Asynchronous Module Definition (AMD) API. This post presents a few minimal files written to make use of it.

Monday, 2 January 2012

JSF: managed beans without JSF dependencies

A previous post discussed how to inject the FacesContext into managed beans using a broker. This post demonstrates how to build on that approach with greater levels of abstraction.

It is generally possible to remove direct JSF dependencies from managed bean code. You might want to do this to reduce coupling, improve cohesion or in the interests of writing testable code.

The code was written against Java 6, JSF 2 and JUnit 4 but the approach could be adapted to earlier versions of all of these.