Stephen Masters logo
  1. Home
  2. Blogs

Blogs

October 2, 2021 •1 min read

Moving to Hugo

Switching to Hugo as a static site generator.

March 16, 2021 •1 min read

Computing in Armenia

In preparation for an Armenian Institute event on Armenian Women in Science and Innovation, I looked into Armenia's pivotal role in developing computers in the Soviet Union.

August 6, 2020 •1 min read

Digitizing Surmelian

In 2020, the Armenian Institute republished I Ask You, Ladies and Gentlemen, by Leon Surmelian; a memoir of a child surviving the horrors of the Armenian Genocide. This is the story of how I got involved in digitizing it and the peculiarities of the process.

March 20, 2017 •4 min read

Using the Kie Workbench Api to Create a Project

I was playing around with the KIE Workbench Docker image and came across an issue whereby the container would become unusable if the IP address of the host changed. My sandbox is VirtualBox, running Ubuntu 16.04, so this would happen all the time. I needed some way to be able to blow away an existing container and start up a new one with the project I had been working on. ...

January 5, 2016 •2 min read

Multiple Databases With Spring Boot and Spring Data Jpa

A little while back I knocked up a post describing how to enable a Spring application to connect to multiple data sources. At the time, I had only just heard about Spring Boot at the SpringOne 2GX conference in Santa Clara, so the examples didn’t take advantage of that and also didn’t work around some of the autowiring that it does. Recently, I was working on a little ETL project to migrate data from one database to another with a different structure, so I returned to this problem and the following is the result. ...

February 6, 2015 •4 min read

A Minimal Spring Boot Drools Web Service

A little while back, I knocked up Qzr to demonstrate using Spring Boot with the Drools rules engine. However, I also wanted to play around with a few more technologies (AngularJS and Spring HATEOAS), so it’s a bit large for just demonstrating exposing Drools rules as an HTTP web service. A few folks found it difficult to pick out the essentials of running Drools in a Spring Boot application, so I thought I’d have a go at creating a simpler application, which does nothing more than that. ...

January 23, 2013 •2 min read

A Web Service Powered by Spring and Drools

For the past few years I have been designing and building web services which make use of decision management technology such as Drools and FICO Blaze Advisor. The past year or so has all been about using Drools Guvnor to enable business users (legal and operations teams) manage rules, and using the Drools rules engine to evaluate trade requests against those rules. My preference in setting up web services is to use the Spring Framework to configure my application and manage its various components. However, I struggled to find much information online about how best to wire up a Spring web application to make use of Drools for rules evaluation. The Drools documentation does include a chapter on Spring integration, but I found that it didn’t seem to make the integration any simpler, and forced dependencies on older versions of Spring that I didn’t want to use. In the end, I decided to hand-crank the integration in my application, and it turned out to be quite easy to do. ...

January 17, 2013 •3 min read

A Big Decimal Accumulator for Drools

Working in the financial industry, I have become rather strict about avoiding doubles in Java. The trouble is that they are a floating point representation of a number, which is just an approximation of the real value. This can lead to some unusual results. For instance, according to this, 0.34 + 0.01 is not equal to 0.35. double x = 0.35; double y = 0.34 + 0.01; System.out.println(x + " : " + y + " : " + (x == y)); 0.35 : 0.35000000000000003 : false Those inaccuracies might seem very small, but it’s surprisingly easy for them to start impacting a real world application. Imagine you wanted to sell dollars and buy Iranian Rial. You would be getting almost 20,000 Rial for every dollar. At that rate, imprecise floating point values could easily impact the final amount being sent. Although with the current US trade sanctions against Iran, that could be the least of your problems. ...

January 16, 2013 •2 min read

Bundling Project Dependencies With the Shade Plugin

Have you ever struggled with the mass of .jar files that you can find in a directory of Java libraries? You have no idea what version each of them is and what its dependencies are. You want to put your own application jar in there, but you know that will mean needing to get hold of 20 other jar files to deal with its dependencies. I certainly have trouble with this. I use the Drools Guvnor web application to manage business rules, but this sometimes requires that I place my own libraries in that web application’s lib directory. Some of these libraries are actually minimal Spring applications which need to do data access and invoke web services. This means that each of them does require multiple additional Jar files. It becomes difficult to keep track of what libraries I have added to that directory and what I need to add. ...

January 15, 2013 •2 min read

Getting the Latest Snapshot From Sonatype Nexus

Sonatype Nexus is a repository for build artifacts, which is particularly handy if you have a Maven project. Once you have your Maven project configured, every time you run mvn deploy Maven will do a bit of building and then upload the resulting artifacts (.jar, .war, …) to the repository. If you browse Nexus you will then be able to find those artifacts with a unique name and download them. ...

  • 1
  • 2
Copyright © 2024 Stephen Masters All rights reserved. Powered by Hinode.
Stephen Masters
Code copied to clipboard