I was happy to have my first opportunity at delivering an open-source project for the use of everyone. This project is available here and has been uploaded into Sonatype’s Central Maven Repository.

Isn’t there already XML Parsers for Java?

It may seem weird as there are already many XML parser out there for Java. Actually I was using XML in an odd scenario and could not find a solution suitable to my needs after a few hours of searching.
I noticed that many libraries that were available were verbose and I wanted to minimize the number of lines required to load the XML file content. I also needed it to be able to accommodate XML that is not intended to represent structured data (objects with the same attributes) but rather I needed it to be able to handle the unstructured data that can be found in an application configuration file.
Oddly, after completing the library I did read about a Java Library called XPath and also read that the same solution was not geared toward performance consideration.

Why not write a Java properties file?

One of the considerations I had is if I needed to move the config in the future I would rather have it as an XML as parsers would be available for many programming languages.
Another is that the properties file can become really difficult to read and maintain if your intention is to logically nest objects within others. Imagine having to read keys like:

cows.cow.bettie.length

Now try nesting a few more times to see the point.

What is it about?

The project basically is geared towards reading an entire XML file and providing it as key->value pairs in a HashMap. In order to accomplish this, a few assumptions had to be made in order for the library to work effectively.
The readme in GitHub explains what these assumptions are as well as the rules used for generating the keys for each value.

Problem
Images were displaying in a way that was not desired, by default. Many times we want images to display with the same width and height while maintaining the aspect ratio of the image. Typically we also want to be able to see our images have consistent widths and heights, especially when working with tiles or lists.

Solution
I paste the basic layout of one of my adapters to illustrate.

Compute a scale that will maintain the original src aspect ratio, but will also ensure that src fits entirely inside dst. At least one axis (X or Y) will fit exactly. The result is centered inside dst.

android:adjustViewBounds="true"

This attribute is important and required. Android says about this attribute

Set this to true if you want the ImageView to adjust its bounds to preserve the aspect ratio of its drawable.

I had issues making the ImageView work when I’m applying the scaling and using weights, so I put it as a child of a FrameLayout and found it to work successfully.

This guide was intended towards my ILP group working on adding features to an old java game made previously.

Assumptions

This guide assumes you have already cloned and made changes to indexed files in the project.

I am also assuming that there is only one branch, namely the master branch.

Step 1

Right Click on your project in the package explorer > Team > Commit…

Step 2

Add the files you would like to apply to the remote repository to the staged changes section, shown below.

Right Click on the File > Add to Index

Step 3

Enter a commit message.

Enter your author (if necessary).

Click “Commit”

Step 4

At this point, if you have other members working on the same branch, you will want to retrieve updates that happened between the time you started making changes in the project and the time you committed those changes.

Step 5

You may or may not have to deal with conflicts from other commits. I have not come across this situation yet so I can’t show an example here at this time.

Step 6

After handling conflicts. You want to push your changes to the remote Git repository.

Right Cick on Project > Team > Remote > Push…

NOTE: This is NOT the same as Team > Push Branch ‘master’ or Push to Upstream

Whether you want to set your ear, war or whatever type of application up on Glassfish, we typically want to get rid of the default landing page and replace it with one of the apps. This guide will show you how, with one image. This method is the easiest but has a caveat which I will mention later. It should work in Glassfish 3 and beyond, at the least.

Build

Glassfish 4.1

Using an Enterprise Application Archive (EAR)

Assumptions

Name of configuration and virtual server are default

Instructions

Deploy your application

Navigate to Configurations > server-config > Virtual Servers > server

Select desired application on Default Web Module

Save

Caveat
If you specified in the configurations of your file a different context root (file depends on what type of application) then you will be able to access the application from the Domain Base as well as the context root defined in the application’s configuration file.

Introduction
This is meant to be a reference for me anytime I use oracle with a JavaEE project. I hope it benefits you as well. This is pretty much remade from the reference at the end, so its easy for me to find at a later time.

Warning
In the default Glassfish 4.1.1 shipped with Netbeans 8.1 there is a problem with the admin console when trying to do certain things. Amongst them is adding JDBC Resource. I decided I would use Glassfish 4.1 to solve that problem but you are welcome to find a guide on how to setup a JDBC Resource in command line instead as an alternative. It’s a problem with that Glassfish version, not Netbeans.

My Build

Glassfish 4.1

Oracle Database 11g XE

Instructions

First off, we need to make a connection pool. I already made mine, its called Oracle11g so don’t be startled if it doesn’t appear.

Navigate to Resources > JDBC > JDBC Connection Pools

Set the values as below, to use oracle.jdbc.pool.OracleDataSource ensure you have ojdbc_6.jar (or whatever version is appropriate for you).

Then set the additional properties values. I cut out my password and username in the diagram, fill it with your own values. Click save after completing. 1521 is the default port for oracle db 11g, if yours differs change it accordingly.

Next we need to create a JDBC Resource.

Navigate to Resources > JDBC > JDBC Resources

Fill in the values as below. The pool name should be that which you set when you made a new Connection Pool a few steps ago.

The following step ONLY applies if you are using JavaEE. This is to ensure that your jdbc driver behaves in a way which is compliant with JavaEE.

IF YOU DO NOT NEED THIS STEP then you need to restart the domain on glassfish to apply. With the default domain this can be done as

/path_to_glassfish/bin/asadmin restart-domain domain1

Navigate to Configurations > server-config > JVM Settings

In the JVM Options tab, add a new option then save.-Doracle.jdbc.J2EE13Compliant=true