Wednesday, March 25, 2020

Ardusimple simpleRTK2B with Long Range Radio and Bluetooth

When you need high precision Global Navigation Satellite System (GNSS) support, one of the best economical choices is the Ardusimple simpleRTK2B. I am using the Long Range Starter Kit that consists of a base station and a rover. By using 2 simpleRTK2B boards that communicate with each other, I am able to take advantage of Real-Time Kinematic (RTK) positioning which gives me centimeter accuracy. The simpleRTK2B has a convenient connector for Xbee radio modules which in my case is used for the long range radio. However, I would also love to use the XBee Bluetooth Module on the rover. That way I don't have to connect my Android-based smartphone via USB cable, but can also conveniently connect to the simpleRTK2B via Bluetooth. Unfortunately, for this use-case I have to wire up the XBee Bluetooth Module manually as there is only a single Xbee radio slot. The documentation on this was a bit sparse but the following pointers were useful:

I finally got everything working with the following wiring. The one thing that feels a bit odd is the need to also connect the 3.3V OUT on the simpleRTK2B to its IOREF pin.

Monday, December 25, 2017

Mapping Options with Angular 5

Just did a quick search on Angular components for either Google Maps or OpenStreetMap. For Google Maps the choice du jour seems to be Angular Google Maps (Git repo). A neat little blog post on how to get started is here.

When targeting OpenStreetMap, Leaflet.js is still the most popular library out there. While it is "just" a JavaScript library, you can use it directly in your Angular project or use dedicated components, of which the following 2 seem worthwhile to investigate further:

Monday, April 4, 2016

Spring Boot with JSPs using Undertow

This is a follow-up to my previous post Spring Boot with JSPs in Executable Jars.

Undertow is another alternative for using an embedded container with Spring Boot. You can find general information in the Spring Boot reference guide chapter Use Undertow instead of Tomcat. While I was working on updating the Spring Boot documentation regarding the JSP support for Tomcat, I noticed the following line in the reference guide for Spring Boot 1.3.3:

"Undertow does not support JSPs."

Being a good citizen, I dug a little deeper and discovered the Undertow JSP sample application by Chris Grieger. It turns out that Undertow has indeed JSP support by using jastow, which is a Jasper fork for Undertow. The key was to adapt the Undertow JSP sample application for Spring Boot. Doing so was actually fairly straightforward. The actual Undertow configuration uses Spring Boot`s EmbeddedServletContainerCustomizer:

final UndertowDeploymentInfoCustomizer customizer = new UndertowDeploymentInfoCustomizer() {

  public void customize(DeploymentInfo deploymentInfo) {
    .setResourceManager(new DefaultResourceLoader(JspDemoApplication.class))
    .addServlet(JspServletBuilder.createServlet("Default Jsp Servlet", "*.jsp"));

    final HashMap<String, TagLibraryInfo> tagLibraryInfo = TldLocator.createTldInfos();

    JspServletBuilder.setupDeployment(deploymentInfo, new HashMap<String, JspPropertyGroup>(), tagLibraryInfo, new HackInstanceManager());


The full source is available in the JspDemoApplication class. The main issue is more or less the retrieval and configuration of the used Taglibraries. The Undertow JSP sample provides the TldLocator class, which does the heavy lifting. For our example, I am adapting that class so that it works in the context of Spring Boot. In Spring Boot we are dealing with ├╝ber-Jars, meaning the resulting executable jar file will contain other jar files representing its dependencies.

Spring provides some nifty helpers to retrieve the needed Tag Library Descriptors (TLD) files. In TldLocator#createTldInfos I use a ResourcePatternResolver, specifically a PathMatchingResourcePatternResolver with a location pattern of classpath*:**/*.tld.

final URLClassLoader loader = (URLClassLoader) Thread.currentThread().getContextClassLoader();

final ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(loader);
final Resource[] resources;
final String locationPattern = "classpath*:**/*.tld";

try {
 resources = resolver.getResources(locationPattern);
catch (IOException e) {
 throw new IllegalStateException(String.format("Error while retrieving resources"
   + "for location pattern '%s'.", locationPattern, e));


Don’t forget the asterix right after classpath. The classpath*: allows you to retrieve multiple class path resources with the same name. It will also retrieve resources across multiple jar files. This is an extremely useful feature. For more information please see the relevant JavaDocs for PathMatchingResourcePatternResolver.

Once we have the TLD resources, they will be parsed and ultimately used to create a collection of org.apache.jasper.deploy.TagLibraryInfo. With those at hand, we create a JSP deployment for Undertow using the DeploymentInfo and the TagLibraryInfo collection.

final HashMap<String, TagLibraryInfo> tagLibraryInfo = TldLocator.createTldInfos();
JspServletBuilder.setupDeployment(deploymentInfo, new HashMap<String, JspPropertyGroup>(), tagLibraryInfo, new HackInstanceManager());

And that’s it. Simply build and run the application and you should have a working JSP-based application.

$ mvn clean package
$ java -jar jsp-demo-undertow/target/jsp-demo-undertow-1.0.0-BUILD-SNAPSHOT.jar

In your console you should start seeing how the application starts up.

Once started, open your browser and go to the following Url http://localhost:8080/.

You can find the full source-code for this sample at

Friday, February 12, 2016

Starter Project - Angular 2.0 + TypeScript + WebPack + Bootstrap

As Angular 2.0 is finally in Beta (¡Yeah!), it is playtime now. In my opinion, the best starter project to use (Feb 2016 ;-) is Angular2 Webpack Starter by AngularClass. Unfortunately, it does not come with Bootstrap support out of the box. This is typically not a major issue but many front-end developers will be faced with 2 major changes:

  • Grunt, Gulp and Bower are dead, long live NPM and Webpack
  • TypeScript rules but how do I "require" my CSS dependencies?
Therefore, I created fork of the aforementioned starter project adding Bootstrap support. Also, in order to customize your Bootstrap theme, I believe it is advisable to use either Less or Sass. As I am more familiar with Less, I added it to my setup as well.

Monday, October 12, 2015

AngularJS + Karma - Loading JSON Files for Mocking HTTP Responses

In order to kick-off AngularJS projects, I have been looking at generator-gulp-angular lately, which you can find at:

When doing your unit tests, it is quite convenient to mock HTTP responses using JSON files. However, having your unit tests load additional (JSON) files may not be super obvious using the Karma test runner.


For the task at hand, I am using jasmine-jquery which provides “jQuery matchers and fixture loader for Jasmine framework”. Add that dependency to your bower.json file:

"devDependencies": {
  "jasmine-jquery": "2.1.1"


Now we need to do some additional configuration for Karma. By default, generator-gulp-angular wires the needed files up with:

return wiredep(wiredepOptions).js
    path.join(conf.paths.tmp, '/serve/app/index.module.js'),
    path.join(conf.paths.src, '/**/*.spec.js'),
    path.join(conf.paths.src, '/**/*.mock.js'),
    path.join(conf.paths.src, '/**/*.html'),
    {pattern: path.join(conf.paths.src, '../mocks/**/*.json'), watched: false, included: false, served: true}

In order to make your JSON file available, add

  pattern: path.join(conf.paths.src, '../mocks/**/*.json'),
  watched: false,
  included: false,
  served: true

So that it becomes:

return wiredep(wiredepOptions).js
    path.join(conf.paths.tmp, '/serve/app/index.module.js'),
    path.join(conf.paths.src, '/**/*.spec.js'),
    path.join(conf.paths.src, '/**/*.mock.js'),
    path.join(conf.paths.src, '/**/*.html'),
    {pattern: path.join(conf.paths.src, '../mocks/**/*.json'), watched: false, included: false, served: true}]);

Mocks is a directory in my project’s root folder. Customize as needed. For further details see:

Now, you're ready for testing. In your spec aka unit test file, in the beforeEach:

beforeEach(inject(function (_$httpBackend_, _$rootScope_, $controller) {

you can now mock up the $httpBackend:



Saturday, October 3, 2015

AngularJS Best Practices - Style Guide

Looks like the place du-jour for THE AngularJS style guide is here:

The author, John Papa, also provides the HotTowel Yeoman generator, that implements this style-guide:

If you're a TypeScript aficionado, you may want to keep an eye on the following GitHub issue:

In the meantime - checkout:

And all this came up, as I was looking, for some good explanation for the advice to use AngularJS’
“Controller as” syntax and to avoid $scope as much as possible.

A really good explanation is also here:

Friday, October 2, 2015

TypeScript versus ES6

A good question is: Why would you want to use TypeScript versus ES6?

A few reasons for me:

  • I have to use a transpiler anyway in order to support older browsers such as Babel
  • TypeScript gives me types
  • You can still use JavaScript as valid TypeScript (TS being a superset of JS)
  • It seems to be a more natural fit for Java developers
  • Tooling support seems pretty good
  • AngularJS 2.0 will use it natively - as such you have Google and Microsoft supporting it


Will ES6 make Typescript irrelevant?

TypeScript vs ECMAScript 2015/2016

TypeScript and ES6 Dan Wahlin & Andrew Connell

Angular Air Episode 25: TypeScript or ES6 with Babel?

Thursday, October 1, 2015

AngularJS 1.x and TypeScript

I did a bit of research today on TypeScript. As it is favored (but not required) for the upcoming AngularJS 2.0 release, I wanted to dig a bit deeper. Keep in mind that as of Oct 2015, AngularJS 2.0 is still a pure alpha version and even new projects shall continue using AngularJS 1.4.

Nonetheless, it looks like TypeScript is a viable option even for the latest 1.4 version. In fact, Yeoman now provides an Angular starter (generator-gulp-angular) that gives you the option to use TypeScript as your language of choice.

Here are some resources that I thought were helpful:

I believe, that particularly for Java Developers, TypeScript could be quite interesting - as you have much better type-safety compared to using plain JavaScript. See the following blog entry by Veit Weber:

Why Java Developers might love TypeScript

There is a good presentation by Sander Mak from JavaOne: "TypeScript for Java Developers: Coding JavaScript Without the Pain" on that subject as well:

A longer version:

As you can have a much better OO experience with TypeScript, I think it will be also quite interesting to use rich domain objects with AngularJS rather than using JSON structures directly when retrieving data from your REST endpoints.

There is a great presentation by Gert Hengeveld from NG-NL 2015.


Blog Post:

Convert JSON Structure to TypeScript Classes

If you create TypeScript classes that need to handle JSON, the follow online tool to generate TypeScript interfaces from JSON might be of interest:

TypeScript type definitions

I still need to wrap my head around TypeScript type definitions. They basically bolt on type definition for libraries that are not inherently based on TypeScript. There is a repository for them:

Monday, March 2, 2015

Still want to go to DevNexus 2015 (for free)? Room Volunteers Needed!

We are still looking for a few more room volunteers to help us with the monitoring and basic quality control of the breakout session rooms at DevNexus 2015 next week.

In total we need 24 volunteers (12 tracks x 2 days) for the 2 main conference days (March 11 and 12)  It will be first come, first serve - So please apply ASAP. We will be accepting room monitors from now and up until Thursday, March 5th.

The room monitor will be responsible for:

  • Getting a copy of the presentation slides from speakers right after each session
  • Making sure speakers don't go over their allotted time
  • Communication of any room related issues (power, sound , temp... etc).
  • Count the attendees in each session
  • Provide some feedback in regards to the observed sessions

A volunteer will be in charge of a single track room for one full day. Then s(he) will be free all day on the alternate conference day. For example, you monitor the Agile session room on Wednesday, then you are free to attend any session on Thursday.

Please contact info at ajug dot org if you are interested with the following info:

  • Day and Track
  • Alternative Day and Track 
  • Name
  • Email
  • Phone

Also, let us know if you have any further questions.


Saturday, January 10, 2015

DevNexus 2015 at BMW's Car Hackathon

Thanks to my colleague Sabby Anandan, DevNexus 2015 is getting some mentioning at BMW's Car Hackathon - Hack The Drive in San Francisco. The event takes place this weekend January 11-12.

Details at:

Here are some photos: