Articles Written in 2015

Jyroscope (rosjava alternative)

ROS (Robot Operating System) is currently the most popular platform for robot development. On ROS, the de facto standard for Java development is a package called rosjava.

I have created an experimental alternative to rosjava that I call Jyroscope. Jyroscope makes it easier to write ROS code using Java.

  1. It uses dependency injection to wire up publishers and subscribers.
  2. It does not have any external dependencies.
  3. It does not require any particular build system. It works with javac or any IDE. It can be embedded in another project by copying the source code.
  4. It does not require any message generation. Mappings between Java and ROS messages are resolved at runtime.
  5. It uses Java-to-ROS and ROS-to-Java translators that are compiled at runtime to maintain efficiency and speed.
  6. It implements TCPROS protocols directly so it works with any version of ROS (until ROS switches to DDS).
  7. It is free to use however you wish -- it is under a Creative Commons Zero / Public Domain license.

I’ve been using it for a number of small projects but the code is very much experimental:

  1. It is only a prototype / technology-concept.
  2. It is not documented or tested.
  3. It only supports publishing and subscribing.
  4. It must be run on a full Java 8 JDK (not just a JRE).
  5. It does not implement future ROS 2.0 DDS-based protocols.

You can download the full source from Github

In the remainder of this article, I will demonstrate how to use Jyroscope.

Continue Reading (Published 12 December 2015)

Unvalidated Input Hidden in JSF

When developing complex applications, JavaServer Faces (JSF) works best when used “statefully”. In practice, this means using @ViewScoped backing beans. A consequence is that client-specific view state is persistent on the server.

JavaServer Faces can also be used in a stateless mode.

Unfortunately, stateless operation presents problems when using validation. In particular, validation failures prevent model update. This means that model state cannot be used to render a view in the event of a validation error.

Input components can use posted-back form data to re-render the view during a validation error. However, output components (e.g., <h:outputText>) have no posted-back data. Their state needs to be maintained using hidden fields in a form.

In JSF, hidden state can be maintained using <h:inputHidden>. However, validation interferes with <h:inputHidden>. Like any other input component, validation errors prevent all model updates.

My solution to this problem is to use a custom component. The component works almost the same as <h:inputHidden>. Instead of following the usual JSF lifecycle, it performs model update before validation.

Read on for the implementation and an example of its use.

Continue Reading (Published 6 September 2015)

The Job Market for Prolog (Part 2)

Eleven years ago, I set up keyword alerts for “Prolog” on the major Australian career websites.

For ten years, there was no match. Until one-and-a-half years ago, when I reported a match on this blog.

I've just got another match. I believe that two Prolog jobs in 18 months counts as a boom in the Prolog job market!

Look out, Java. Look out, C#. Look out, Python. Prolog is taking over.

The advertisement disappeared quickly, but I took a few screen-grabs with my phone. I've stitched them back together below (and added the red circle).

Continue Reading (Published 29 July 2015)

Smartphone vs Loaf of Bread

In Sydney, it is possible to order a single loaf of bread from an “artisan” bakery for around $15. A fully featured Android smart phone or Windows Phone can be purchased for just over $30.

One smartphone for the price of two loaves of bread.

This smartphone price will, no doubt, come down. The bread prices will, no doubt, increase.

It won’t be long before a loaf of bread you order online will cost more than the computer you used to place the order.

(Published 3 July 2015)

Reading the Binary Screens

Binary Screens on UTS Broadway Building

The University of Technology, Sydney recently opened a new building (the ‘Broadway building’). It was created for the Faculty of Engineering and IT. It is wrapped in aluminium screens that are perforated with binary code. The university has a video about it on YouTube.

What do the screens say? How are they encoded? Read on for an explanation.

Continue Reading (Published 19 April 2015)

Minimal ASP.NET Identity

Visual Studio 2013 has several templates for creating new web projects. A brand new web project with authentication will have over 1500 lines of C# code. This saves a lot of time for new applications.

1500 lines for authentication may be too much if you’re learning ASP.NET. Fortunately, ASP.NET Identity is not too complicated when you start “from scratch”.

What follows is a short tutorial on setting up basic ASP.NET Identity in an empty web project.

Continue Reading (Published 28 March 2015)

Discarded Apple Newton

This is a photograph of an Apple Newton that I noticed was lost/discarded in a park near my home today.

Discarded Newton

The hand-held computer is almost 20 years old. In fact, it might be regarded as a museum piece.

It doesn’t make sense to hold onto such a device for so long and then just discard it in the park.

I like to imagine it was owned by a die-hard Newton fanatic. Perhaps he or she felt that no modern smart phone or tablet could rival the classic. Thus, it was left in the park by accident.

For this reason, I left the Newton for their return. I can only hope that the original owner was joyfully reunited with their device.

(Published 8 March 2015)

Church Numerals in C#

This is a just-for-fun post. I’ll explore a C# implementation of a theoretical system called Lambda calculus.

It certainly isn’t practical. A calculation of the 25th Fibonacci number (75025) is not complex. An efficient algorithm can calculate it in just a few CPU cycles. A naïve recursive function can calculate it in 3 milliseconds. However, using Church numerals in a Lambda calculus takes 2300 times longer (7100 milliseconds).

The exercise may be pointless from a pragmatic perspective. However, it is interesting to see that the theory can be translated so directly into working C# code.

Continue Reading (Published 1 March 2015)

Published 1 January 2015 by Benjamin Johnston.