Gillius's Programming

GP Blog

The Lunchbus -- June 30, 2016 11:06 PM

I made a project ("lunchbus") to play with Spring Boot + websockets + AngularJS 1.5 + Groovy + Redis. This may be interesting to those who are interested to see how these are set up. The project also has the configuration to run on Heroku.

The lunchbus app keeps track of who owes lunches and to whom, a list of people and places that can be selected, a button to randomly select a place, a chat functionality, and a demonstration of high-speed log output from backend. Persistence is provided by Redis. Due to how it uses Redis, it's just almost ready for horizontal scaling with multiple servers, for that time that you have over 100,000 people going to lunch with you. All that's needed for that is to integrate Spring Boot to Redis pubsub.

My goal is to learn Spring Boot and websockets primarily, and also to see what does an application relying solely on websockets look like and its strengths/weaknesses.

jalleg Update -- June 30, 2016 10:19 PM

The jalleg binding for Allegro covers essentially the entire library now, with all of the major parts tested. It is at the point I believe it is good enough to start using. Any feedback is appreciated, and if no issues arise, I will probably make a 0.1 release, although the binding itself is more like "1.0 beta". The library has been tested on both Windows and Linux (Ubuntu) at this point. I've also set up a wiki page on getting started in Windows and Linux.

There are a few examples but the default one that runs is a ball and paddle game using a handful of Allegro features:

  • Display and primitives addon
  • Font addon for scores
  • Keyboard: A/Z left player, up/down right player
  • Mouse: click where you want the paddle to be
  • Joystick: controls the right player
  • Haptics addon: if you have for example XBox controller as your joystick, you get rumble effect when ball hits
  • Audio addon: sound effects generated by square waves
jalleg, JVM binding for Allegro -- May 25, 2016 11:27 PM

jalleg is a JVM binding for Allegro 5.2 to be used by any JVM language (Java obviously, but also other languages such as Groovy, Kotlin, JavaScript, Scala, Jython, JRuby, and Clojure).

I've just put up a new repository for those interested in following the progress. Currently I have a working but not fully tested JNA-based binding auto-generated by JNAerator.

Allegro was a library I originally worked with a lot when I was learning C/C++ development in DOS in the late 1990s, and has always had a special meaning to me. Allegro 5 is a modern, cross-platform variation of the library supporting hardware rendering and even mobile development. Allegro is a simple library to use and programming a game is a great way to get into learning programming. My hope is that jalleg expands the Allegro fun to Java and all the JVM languages.

jalleg is on GitHub

JFXUtils 1.0 Released -- May 25, 2016 11:16 PM

Version 1.0 of JFXUtils is released now.

JFXUtils is now available on Maven Central, so no custom repository settings are needed! The maven coordinates for this release are org.gillius:jfxutils:1.0.

A special thanks goes to gforman44, who contributed a lot of code and ideas for this release and encouraged me to finish to 1.0. Also thanks go to Daniel Weil for bug fixes.

You can find more information at the GitHub Project Page.

Continue reading for the full list of changes.

IMAP Duplicate Mails Deleter -- February 9, 2014 9:18 PM

I have a problem with Thunderbird. For some reason when I try to move a few thousand e-mails, in the destination folder the majority of messages get duplicates. Some could get 2 duplicates. I have no idea why. But I created to clean up the mess. I built it for my own use and used it only on my own account. But it might be useful to others in the same situation or as an example of JavaMail usage from Groovy (as that is the language I used). I also used the GMavenPlus plugin to build from Maven. If you have Java and Maven it will be easy to run.

JFXUtils 0.3: Mousewheel Zooming -- March 15, 2013 10:13 PM

Version 0.3 of JFXUtils is released now, with only two real changes:

  1. Support for zooming with mousewheel. The location of the cursor is used as the "focal point" of zooming in or out. If cursor is on X or Y axis, only that axis is zoomed. ChartZoomManager allows drag zoom and wheel zoom to be enabled independently, by default both are on.
  2. Fix/workaround for auto-zooming in the charting example.

You can get it at the GitHub project page, or directly from the Maven Repository. You can also view documentation online.

I released version 0.2 of the JFXUtils project I started recently, and now there is code for chart panning, and zooms are now animated. With panning and zooming working, I noticed that the default NumberAxis was not working at all how I would like. The tick positions remain in the same place no matter what the graph's bounds, and the values of the ticks then change to reflect the value. Well, with zooming and panning you will get for example a lower bound of "1432.34234", and this is exactly what NumberAxis will display. So, I created a replacement axis type called StableTicksAxis that keeps the ticks at the same data location for the given zoom level, which has a drastically better UI feel when the graph is changing rapidly during panning and zooming operations. It automatically computes the number and distance between tick marks based on the size of the graph, the graph label font, and the range of data displayed to maximize the number of tick marks without having the labels run into each other. When auto-ranging, it can force zero in the view like NumberAxis, and also like NumberAxis it can add some padding around the data, but unlike NumberAxis the amount of padding (as a percentage of graph size) is configurable.

JFXUtils 0.1 Released -- February 22, 2013 10:43 PM

I wrapped up some of the JavaFX code I've been working with into a library org.gillius:jfxutils, which is hosted at github (project page). The artifact is also published in my Maven repository. It offers the following now:

  1. Ability to add zooming capabilities to a JavaFX XYChart in both plot area and axes.
  2. The scaling-on-resize effect described in my previous post.
  3. An experimental way to replace a Node in the scene graph with a different one (it's not as easy as you think)
  4. A way to get X and Y offsets of a Node from an arbitrary ancestor in a way that handles translation/padding/layout, etc., but does not yet handle scale and rotations (this might be possible if transforms can be combined as rumored for JavaFX 8)

I plan on adding panning compatibility in a future release.

With JavaFX billed as the preferred new front-end system for Java, and Java 7 becoming prevalent and bundling JavaFX as of 7u6, I've started to take a very hard look at this technology, especially compared to Swing. And from everything I've seen so far, I'm very impressed.

The first application I've had the chance to use JavaFX with is a presentation application on a custom piece of kiosk hardware that has 4 separate screens on it. For my skillset, the choices were either HTML5 or Java. I wasn't keen on trying to figure out how to get 4 separate monitors to work with Chrome browsers or something similar, and I know Java better, so I went the route of JavaFX.

For this application, I wanted to create screens that worked basically like PowerPoint slides. The resolution on the kiosk screens is high and the user is far away, so the "normal size" of the GUI interface would not be sufficient. I wanted something where as I expand the window the content gets larger (like in PowerPoint) rather than stay the same size and reflow, like in a standard GUI application. Fortunately, the transform capabilities in JavaFX make this very easy.

By Christopher Piggott | No Comments

SmartGWT controls are beautiful.  Unfortunately, using them is an all-in proposition - you miss out on most of the benefits (and make a lot of extra work for yourself) if you don't use the entire stack from GUI to backend.  I had some good reasons for not using their backend, namely that my GWT application already used Jersey and GWT RequestFactory, and I didn't want to add yet a third servlet to feed data in a form of SmartGWT's liking.  This post shows a simple way to create your own SmartGWT compatible DataSource to back their sexy controls and widgets but mapped to your existing backend.

Blog Archives

Older News Archives