Developer's Diary
Software development, with Terry Ebdon
WebDoxy, Eclipse & Engineering

Wednesday 28th June, 2017

Reverse date order on the Monthly Page

Ideally the list of daily journal pages would be reversed on the corresponding month page.

e.g.

  • 30-JUN-2017 – blah
  • 29-JUN-2017 – blah blooper

What's the smallest change I can make that doesn't need a change to Doxygen or it's layout? MonthPage.addSubPage() currently appends to the month page:

def addSubPage( final JournalPage dayPage ) {
// ... blah ...
append "${prefix}@subpage ${dayPage.pageAnchor}${suffix}"
}

Changing this would be non-trivial, and possibly brittle. If the list was ordered I could tell it to reverse itself. But that needs script / CSS, to inject the reversed attribute and hide the numbers. A better way would be to sort the list, with JavaScript, at run-time. This should have minimal overhead; the list has, at most, 31 items.

I added a few lines of script to the month page, based on a "stack overflow" answer from user VisioN.

Note
When Doxygen sees $(blah) it assumes blah is an environment variable, and tries to insert its value.

I found that Doxygen was confused by the $ symbol, that jQuery uses, and was deleting things like $(Document) from the generated HTML page. Replacing $ with jQuery solved the problem. (Fortunately I'd seen this before, when working on Liferay.) An alternative work-around would be to escape the dollar symbol, with \$, but I find that less reliable and possibly confusing.

Note
Doxygen already uses jQuery; you'll find a jquery.js file in the output folder.

This is the working code:

@htmlonly
<script>
jQuery( document ).ready( function() {
jQuery( 'li' ).each( function() {
jQuery( this ).parent().prepend( this );
});
});
</script>
@endhtmlonly
Note
The above code is moving the list items, not copying them.

This script solution works, with some restrictions.

Navigation bar

The navigation side-bar shows sub-pages in ascending date order, not descending. That's expected, as the page order matches the order that Doxygen parses them. i.e. the order they're mentioned in the monthly journal page. The list isn't reversed until run-time, after the navigation bar has been built.

PDF Output is reversed

The script only runs in HTML pages, so the above solution can't work for Latex / PDF output.

A choice: Contents List or nice dates?

By default the [TOC] and \tableofcontents commands only work if there are section headers with anchors. There's a configuration option to get a table of contents without anchors:

TOC_INCLUDE_HEADINGS = 3

This forces markdown style headers, up to level 3, to be included. It generates its own anchors, to allow this. Unfortunately that triggers the bug that prevents me using heading anchors in the first place: superscript characters, like th stop working. The <sup> and </sup> tags are displayed as if they've been escaped.

Eclipse – Upgrading to Oxygen

This machine only has the modelling framework (EMF) installed. I've been using Atom for recent development; time to get back to using a proper IDE. I'll start with a clean install of Eclipse Oxygen and add the Groovy plug-ins. I don't need EMF, as I really don't like it and found other tools to be more useful for modelling.

I'm currently on Groovy 2.4.7. That's recent enough that I shouldn't need to update.

I though I'd told the Eclipse installer to not install Groovy, but it seems to have done so. Eclipse is using Groovy 2.4.12, but a command prompt still uses 2.4.7. That'd be one reason that the download was so slow.

I'd forgotten how tiny Eclipse's buttons are, on a high resolution screen. They're really difficult to differentiate. This was supposed to have been fixed in Eclipse Nemo, according to various stack exchange posts. But the fix may have only addressed part of the issue, maybe? Eclipse Bug 421383 is marked as fixed. There's an interesting comment, No. 60, which details a work-around for Microsoft Windows. Subsequent posts verify that it works, so will be worth a try. Subsequent comments detail possible issues and further work-around. A similar fix is on this stack exchange page

On the plus side, Eclipse finally supports zooming text (via ctrl/+, CTRL/-), without having to search for plug-ins.

A test project runs fine. I've imported WebDoxy as a project, but it doesn't run. There's a conflict between Eclipse and AntBuilder. This is a major set-back, as WebDoxy depends heavily on AntBuilder.

... startup failed:
General error during class generation:
java.lang.NoClassDefFoundError:
Unable to load class groovy.util.AntBuilder due to missing
dependency org/apache/tools/ant/BuildException

The Eclipse build path seems to use the embeddable jar from its Groovy 2.4.12 install. This should be fine.

Note
Fixed! See Thursday's journal entry for the details.

Dependency Management & Inversion of Control

Spring Boot

  • Cloud native ready.
  • Can run in a "traditional" environment.
  • Embedded app server
    • defaults to Tomcat. Can use others, e.g. Jetty.
  • Supports database pre-population:
    • Schema
    • Data
  • Component scanning, via annotations.

Spring Initializr

  • https://start.spring.io
  • Choice of project types:
    • Maven
    • Gradle
  • Choice of Spring Boot framework versions.
  • Choice of jar or war packaging
    • war for server deployment
    • jar for local deployment... ish.
  • Choice of JVM language:
    • Java
    • Groovy
    • Kotlin
  • Choice of database
    • external databases
    • embedded databases

Spring Data

  • Easy swapping of data source
  • Reduced quantity of data access code.
  • Key Components
    • Repository – Repository Pattern?
      • CrudRepository
      • ...
    • Entity
  • Automatically generates query methods based on the name. Nice!

Interesting web pages

Eclipse

jQuery


Top of page Recent Posts The Archives © 2017 Terry Ebdon.

Find me coding on GitHub, networking on LinkedIn, answering questions on Stack Exchange and hanging out on twitter.