29 February 2016

An Occasional Unit Test Failure Caused by Dates

In honor of the Leap Day of February 29th, let me tell a story about an unusual date problem I encountered while unit-testing.

One project I worked on had made a small effort at writing unit tests, using Java and jUnit. Unfortunately, the team culture was not to run the test suite frequently while developing. Rather, developers were sort of willing to run their own tests, but let the nightly job run the full suite.
When a test would fail, someone would track down and lean on whoever had broken it.

Once in a blue moon, a certain couple of Unit tests would fail. This is the story of why they were breaking, why it was hard to duplicate the issue, and how I fixed it once I found it.

These tests failed one night in the spring, and again one night in the summer.
But next morning, no one could reproduce the failure. So they were chalked up to disturbances in the Force or cosmic rays, one of "those things" that happen "sometimes" and nothing was done.

18 February 2016

ScalaFX Menu Basics

I am working on an application for a personal project, and learning ScalaFX in the process.
Since Menu bars are important parts of the user interface, with easy access to a range of application functionality, I plan to build a menu bar into my product.
This post explores some of what I am discovering about Menu-related features of ScalaFX.

First, let me set up a basic framework for my exploration, a scala object extending JFXApp.
I also import the scene, layout and control packages, since I will need them for the Scene, MenuBar and VBox classes.

import scalafx.application.JFXApp
import scalafx.scene.layout._
import scalafx.scene._
import scalafx.scene.control._

 * Exploring Menu-related classes in ScalaFX

object SfxMenuExplore extends JFXApp {

  // We will define the menu object here.
  val wholeLayout = new VBox {
    children = List(menu)
  val myScene = new Scene(wholeLayout, 300, 200)
  stage = new JFXApp.PrimaryStage {
    scene = myScene
    title = "Menu Exploring"

Since VBox lays out controls in a vertical stack, I will use it to place the menu bar at the top of the input form.
The code above does not yet define the menu object, just sets the stage for a 300 x 200 pixel window.

Let's create a very basic menu and add it to the above. Something like:

10 February 2016

ScalaFX: Button positioning with HBox

I'm working on an application, as an excuse to practice my Scala and learn ScalaFX in the process. The application will have several input forms. Most will have action buttons, such as Save and Cancel.
While the mobile world is going more and more vertical in its layout, the program I am working on is targeting Windows and Mac platforms. In them, buttons are usually laid out side by side.
The ScalaFX HBox layout does exactly that: draws its components in a horizontal sequence.

As I work through the different aspects of HBox, I will use this Scala object structure:

4 February 2016

Introducing: ME

Hello. I'm Steven Page, the maker of SJGP Software.
I started this blog several years ago, to show off the software I was creating out of my personal interests. It became a mini online user manual for two programs in particular.
Most of the blog's past activity occurred while I worked outside the Information Technology industry. When I returned to IT professionally in 2012, the blog's activity dropped off.
Time to resurrect it, with a different focus: me and what I am learning and discovering in the world of software development, instead of just tips for using the software I wrote several years ago.
Right now I am brushing up on my |Scala, exploring ScalaFX UI, promoting unit testing and continuous integration at my work, and learning Git.
Stay tuned for more.