Skip to main content


Showing posts from May, 2016

Fixing "resource modena.css not found" in SBT

I have a project that is building a system in Scala. Its GUI is being defined using the ScalaFX system, which is a thin layer that delegates to the underlying JavaFX tools, components and features.

The application was running with a fine-looking GUI in early testing, but all the builds were being driven by the IDE. For various reasons, we wanted to migrate the build to the SBT system.

But upon launching with
$ sbt run
we would get entries like this in the console:
[info] Running StartHere
May 21, 2016 8:50:28 PM com.sun.javafx.css.StyleManager loadStylesheetUnPrivileged
WARNING: Resource "com/sun/javafx/scene/control/skin/modena/modena.css" not found.

The application would compile without issue and would run correctly, but looked terrible. For instance there would be no edges visible for buttons or for text box input fields.

Obviously, a dependency was missing from the build.sbt file. It was easy enough to add, with a line like the following:
unmanagedJars in Compile += Attribute…

TinT: Composition vs Inheritance vs Unit Testing

This episode of Testing in the Trenches describes, with appropriate modifications to protect the parties involved, a unit-testing situation I encountered on a client's project.

One question I was asked in a job interview some number of years ago was: "For code reusability, which is better: Inheritance or Composition?"

As I recall from the interview, I chose one - in my case, Inheritance - and defended my choice: there is conceptual power in defining higher-level, common traits and behaviors higher up the hierarchy, and re-using it in its sub-classes, or overriding and refining it when more specific behavior is required. Or something like that.

It was obvious from my interviewer's reaction that he was not impressed with my answer. And I have occasionally wondered, in hindsight, if I should have not chosen either, but talked about both and shown my grasp of both concepts. That might have been the better interview technique.

After all, a couple years later, with more ti…

Windows .BAT Script to launch task, then loop until done

My last post described my discovery of the Windows Schtasks.exe utility to trigger via the command-line a scheduled task on a local or - more relevant to the challenges I was facing - on a remote server. I described its ability to query the state of the task, and to launch it.

Of course, since my whole purpose was to automate a tedious manual section of our build process, Schtasks.exe is helpful but hardly the end of the story.

To benefit from that new knowledge, I now need to create a Windows shell script that our Continuous-Integration tool Jenkins can launch. This post is almost a stream-of-consciousness blog as I play with this problem.

The requirements are that the script launch the remote scheduled task, poll its status until it is complete, and end with an appropriate result code. Some minimal logging of activity would also be nice.

To begin, I created a .BAT file and created a labelled section to trigger the remote task:
REM  QUESTION: What if it is already running?…

Trigger Windows Scheduled Task from Remote Computer via Jenkins

One thing I love about working in Information Technology is the opportunity - the NEED - to constantly learn new things. If a week goes by in which I have not looked up something on StackOverflow or other message boards, I start lobbying my team for more challenges.

This week, I learned the power of running "SCHTASKS.exe" from a command-line script for a remote server in a Microsoft Windows environment.

If you don't know Schtasks, you can read up on it here:

In a nutshell, it is the command-line interface for the Windows Task Scheduler, and allows you (or a system administrator) to create, change, run, query, terminate, and delete scheduled tasks on a work-station, either the local one or a remote one.

Not all of the features are available in older versions. In my scenario below, this was relevant as the local computer will be a Windows 8 machine, and the remote server is, shall we say, a muc…

TinT: Avoiding User Interactions

This episode of Testing in the Trenches describes, with appropriate modifications to protect the parties involved, a situation I encountered on a client's project that challenged our efforts to create a suite of automated unit tests and what we did about it. It is adapted from one of the internal Tips that I regularly sent to the team.

One of the key goals in unit testing is that we can run the suites of tests quickly. When the tests run in just a handful of seconds, we get fast feedback when issues arise. It is easier and safer to resolve those issues when the developer's mind is still on the problem they were working on.

And tests that run quickly are less of a perceived interruption to the work of a test-averse developer. This increases the odds that the developer will adopt the practice of running the test suite before committing their code.

But a run of tests comes to a complete halt when user interaction is required. For example, a path through the code that creates a po…