Tuesday, September 5, 2017

Banner 9/Grails 2.5 Development Problems and Resolutions

This is a page of random problems and solutions encountered using Grails 2.5 for Ellucian Banner XE (9) Self-Service development. As new problems are resolved, they will be added to this list.

20170902 Grails Throws a NullPointerException on Recompile & Reload

After a file is changed, such as a controller, Grails notices the change, recompiles, and reloads the file but throws an error similar to this: ERROR plugins.AbstractGrailsPluginManager  - Plugin [controllers:2.5.0] could not reload changes to file.

This problem has only appeared for me on Microsoft Windows systems: when a class is recompiled and reloaded, a NullPointerException is thrown, often by the AbstractGrailsPluginManager. The class is actually recompiled and reloaded, so it was not clear exactly what the problem was. Sometimes the error originates in the scaffolding system, even when the application does use scaffolding. There are plenty of comments around the Internet about disabling forked execution, but only one comment clarified why.

Banner, Eclipse, and Grails!

You can use Eclipse as a single IDE for developing both Banner Admin Pages and Self-Service extensions! It is also possible to use other IDEs for developing Self-Service extensions; NetBeans has excellent Groovy and Grails support. The focus here is on using Eclipse for both development environments.

Disclaimer and warning: this post may become outdated at any time, but currently the most up-to-date information from Ellucian is:
  • Eclipse 4.6 (Neon) is the most current Eclipse IDE supported for developing Admin Pages. You must use an Eclipse-based IDE for developing Admin Pages, because the required plugins for development are only available for Eclipse. The plugins have been tested with Eclipse 4.4 (Mars), 4.5 (Luna), and (4.6) Neon.
  • IntelliJ Idea Ultimate is the recommended IDE for developing Self-Service extensions. The current IntelliJ version 2017.2.3 still supports the Groovy and Grails versions being shipped with Banner.
  • Other IDEs with Groovy and Grails support may be used for Self-Service development. Support for extending Banner and using Grails will be provided, but do not count on any support for using the IDE with Groovy and Grails.
  • Banner 9 ships with Grails 2.5, which depends on and includes Groovy 2.4.

Thursday, August 3, 2017

ORM and JSON in JavaScript and TypeScript

Mapping JSON to entity objects and objects to JSON is trivial, if the objects only contain data and allow direct access to the properties. There is a bit more work if the class needs to have helper methods for things like validation, and if we want to wrap the data members with getters and setters.

The goal is to meet these requirements during coding:
  • Entity classes may include validation
  • Data members have accessor (getters and setters)
  • Entity classes may have other methods
  • Entity class type is important (this encapsulates the previous three points)
  • Missing data in the JSON source should be logged.
  • Extra data in the JSON source should be logged.
  • Support DRY - Don't Repeat Yourself
Full disclosure here: I know that there are two big problems with what I am about to describe. If you have been trying to handle ORM conversion already, you may have hit them. The problems are not insurmountable, but we'll get to that later.

Friday, May 26, 2017

Anonymous Functions and Arrow Functions are Closures

Functions in JavaScript and TypeScript are "first-class citizens;" which means that they can be passed as a parameter, assigned to a variable (and passed as a parameter), and may be dynamically created at runtime. The last stipulation is important: not only do many people consider it a major requirement to be a "first-class citizen," but creating new functions at runtime is how JavaScript and TypeScript function is built.

Dynamically creating functions at runtime is good and bad. It is good because it simplifies the code and can make it cleaner, but it is bad because there is a penalty to pay for creating all these functions.

Saturday, May 20, 2017

Safeguarding Development Environments

When I am teaching I often refer to a mistake I made years ago, typing "rm * .o" in a Unix shell while in a project folder. I realized when the shell said ".o not found" that by placing the asterisk accidentally all by itself I had selected and removed all the source for the project!

I am sure that it was not the first mistake that I ever made that corrupted a project, nor will it be the last. You or I do not even have to make a mistake; it could just be that your hardware fails or that today some black-hat exploits a security flaw that nobody has patched yet and voilĂ , all of your files are encrypted and forever beyond your reach.

In fact, it is the WannaCry ransomware attack that prompted this post! Not that it bit me, but something like it could some day...

Monday, March 20, 2017

Oracle Database 12c Perl Distribution and VirtualBox/VMware

The Perl 5.14.1 distribution included with the Oracle 12c Database instance is flawed and crashes when given the true CPUID for the processor. This can happen in several cases, especially when installed on MacOS, VirtualBox, or VMware with newer Intel processors.

This behavior, and solutions, is documented in several places, including here by Laurent Leturgez and here by Danny Bryant. Most noticeably, it occurs when the Perl scripts are run during the creation of a multitenant database using dbca.

The problem hit me hard using virtual computers during a customized Oracle boot camp I am teaching as I write this. The purpose is to document what I found out and how I decided to fix it.

Wednesday, December 28, 2016

Increasing the Performance of React Callbacks

The React framework is typically a very heavy user of closures or arrow functions in the component classes. Especially since JavaScript 2015 introduced the arrow function, putting the functions inline when the component renders the sub-components binds the functions tightly to the components where they are used.

Since React has moved on to JavaScript 2015 a common example of handling a button click to change state often looks something like this:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import React, { Component } from 'react';

"use strict"

export default class CounterComponent extends Component {

    constructor(...args) {

        super(...args);

        this.state = {

            value: 0
        }
    }
    
    render() {

        return (
            <span>
                Value: { this.state.value } &nbsp;
                <input
                    type="button"
                    value="Increment"
                    onClick={ () => { this.setState({ value: this.state.value + 1}) }} />
            </span>
        );
    }
}

The arrow function on line 25 has a big advantage in JavaScript 2015 over the closure definitions from version 5: when it is created "this" is bound to the same object where it was created, the instance of the CounterComponent. But it is still a closure, and the problem is that a new function is created every time the render method is called.