Programming Projects

Development Environment

Many tools, technologies and APIs were employed in developing and maintaining my Java applications and web content: Eclipse, NetBeans 7.2, ANT, CVS, SVN, JSE 6, Swing, JavaHelp, Java3D, JOGL, JDBC, EclipseLink JPA 2.0, Android OpenGL ES, World Wind SDK, Android SDK, Spring MVC, Enterprise JavaBeans, JAX-RS, JAX-WS, Java Servlet, JavaServer Pages, JNLP, Apache 2.2, Tomcat 6/7, GlassFish 3.1, XML, HTML, CSS, JavaScript, JSON, YUI Library, jQuery, WebGL, Google Maps API, MySQL, MySQL Workbench and Linux.

I subscribe to the "Linode 1536" plan from http://www.linode.com which provides flexible configuration options for developing and running my web server. This VPS node also offers a high bandwidth connection to the internet back bone (typically 300MB/s down-link and 30MB/s up-link). However, my home office machine internet connection speed through local ISP is limited (typically 120KB/s down-link and 20KB/s up-link) which presents some problems when maintaining the server or developing and deploying new web applications and components. I solve these problems in the following ways:

For ease in developing and deploying web applications and components, identical copies of the system software ( The "LAMP" Stack, GlassFish and NetBeans) are loaded on both the development and web server machines. The SVN repository is hosted on the web server and it can be access remotely via the svn+ssh protocol from the development NetBeans environment. To transfer source code changes to the web server, I "commit" the source code from the development NetBeans environment and then use the "update" command to update the source code in the web server NetBeans environment. The web server NetBeans environment is then used to compile and deploy the projects.

Since I prefer working in a graphical shell, I employ the use of NX Client/Server software suite to allow efficient streaming of the X display protocol stream over a low bandwidth/high latency connection. My experience with using this software suite is that the graphical interface connection to the server is satisfactory for occasional use but not for developing software remotely.

Desktop 800x500

Java/JavaScript Applications

Calculator

This is a calculator application that is based on the complex number system. I have developed a ComplexNumber class to encapsulate the ideas of the complex number system and the operators defined on them. Then I built a calculator parser and a GUI to utilize to complex number system. Project developed under NetBeans 7.0 so that I can utilize the Swing visual editor to layout the Swing components. Much of the Java Swing code was generated automatically, I simply fill in the code for the interactions between the visual components and the model (MVC).

Files: ComplexNumber.java, Token.java, Lexan.java and Parser.java



calculator.jpg

Calculator JS (under development)

The JavaScript version of "Calculator" as described above.The look and feel of the application is implemented using open-source YUI Library, a JavaScript/CSS framework for building interactive web applications. Windex JavaScript API is used to render high level windowing constructs such as Frames, MenuBars and Dialogs insulating the application programming from YUI Library calls. PACKAGE JavaScript API is used to enable Java-like Object-Oriented Programming.

Files: index.jsp, Calculator.css, Calculator.js, ComplexNumber.js, Tokens.js, Lexan.js, Parser.js and Frame.js



calculatorWeb.png

Ephemeris

Ephemeris calculates and displays the ephemeris of the planets for several different coordinate systems from several viewpoints applying the appropriate reductions for virtually any time in recorded history utilizing data obtained from the barycentric JPL Planetary and Lunar Ephemeris data files.



ephemeris.jpg

Ephemeris MVC (new development)

The JavaServer Page/Spring MVC version of "Ephemeris" provides a basic web form driven interface to perform plantary orbital mechanics computation not requiring the user to download the JRE to run the Java Web Start version of "Ephemeris" (See above). The "EphemerisController" class handles the work of the processing the input request, submitting the input query to the "EphemerisModel" (POJO) to generate a result and making the result of the query to available to the JSP context. Created custom tag libraries to make formating the HTML output easier.

Files: Ephemeris.jsp, Ephemeris.css, Ephemeris.js, EphemerisController.java, EphemerisCookies.java, EphemerisSession.java, Checkbox.java, Option.java, Radio.java and Table.java



ephemerisWeb.jpg

Visual Ephemeris

VisualEphemeris calculates and displays the physical aspects of the planets as might be seen through a telescope from an ecliptical, equatorial or horizontal point-of-view from any location for any arbitrary time in the recent past or near future. Java 3D is used to render the 3D graphics.



visualEphemeris.jpg

Jupiter Image - Courtesy NASA/JPL-Caltech.

Moon Clock Applet

This is a small Java applet that can be embedded in Astronomy themed web pages which shows the phase of the Moon for the current time. Three view modes are provided: Ecliptic (Calendar-like presentation), Equatorial (Telescope POV), and Horizontal (Local POV). Through the use of GoogleMap web services, the user can set the geographic locale for the Horizontal mode. Java OpenGL is used to render the 3D graphics.

Files: GLRenderer.java



moonClock.jpg

Android Moon Clock (Under development)

A Java application for Android that shows the phases of the Moon on the user's home screen (real time only) or in the simulator (start times can be set and time rates can be varied). Tapping the widget brings up the simulator screen to allow the user to set the graphical display options and to observe how the physical aspects of the Moon varies as a function of time. OpenGL ES for Android is used to render the 3D graphics.

moonClockWidget.jpg moonClockActivity.jpg

Moon Clock JS (under development)

This will be the JavaScript version of "Android Moon Clock" when completed. The look and feel of the application is implemented using open-source YUI Library, a JavaScript/CSS framework for building interactive web applications. Windex JavaScript API is used to render high level windowing constructs such as Frames, MenuBars and Dialogs insulating the application programming from YUI Library calls. PACKAGE JavaScript API is used to enable Java-like Object-Oriented Programming. WebGL is used to render the 3D graphics.

Compatible with the following browsers that are WebGL enabled (actual user experience may vary): Firefox and Chrome.

Files: index.jsp, MoonClock.css, MoonClock.js, Parameters.js, Preferences.js, PreferencesInterface.js and GLRenderer.js



moonClockWeb.png

Java Web Components

I also deploy JSPs, EJBs and Web Services in support of applications. Click launch button below to interact with the Web Services using a web browser test application:


Quirks Mode DOCTYPE Switcher

Operating Firefox browsers in Standards Compliance mode breaks the JavaScript/Java bridge (a.k.a., "LiveConnect") making it impossible to transfer longitude/latitude data from the Google Map window to the MoonClock Applet. This problem was solved with a few lines of JSP code to change the HTML DOCTYPE on-the-fly and to set the last modified date in the response header to the last modified date of the JSP file. The Apache web server passes the "*.jsp" references to to the GlassFish web container for execution.

Files: astronomy/index.jsp

Dynamic JNLP

This allows host independent implementation of the JNLP files. No longer need to code up the server name part of the jnlp codebase and href attributes; It is filled in at runtime. Logical to physical mappings are programmed into the web container to provide logical JNLP like files with the extension ".jnlp" in order to satisfy the requirements for the client host Java Control Panel. The logical mappings provided by the web container are jws/Calculator.jnlp, jws/Ephemeris.jnlp, jws/MoonClock3D.jnlp and jws/VisualEphemeris.jnlp. The JSP code also sets the last modified date in the response header to the last modified date of the JSP file.

Files: jws/Calculator.jsp, jws/Ephemeris.jsp, jws/MoonClock3D.jsp, jws/VisualEphemeris.jsp and web.xml

Ephemeris Model EJB

This is a POJO (Plain Old Java Object) that implements the ephemeris "business" logic which the Ephemeris MVC web application calls to perform orbital mechanics calculations. The logic was originally contained in a jar file but was converted into EJB module with minimal source code alterations.

Files: EphemerisModel.java, EphemerisModelRemote.java, EphemerisParameters.java and EphemerisParametersRemote.java

JPL Catalog EJB

This EJB extracts the barycentric data for the Sun, Moon and Planets; the nutation; and lunar libration data from the MySQL ephemeris database. The Java Persistence API ( EclipseLink JPA 2.0) provides a Java Object view into the database. The ephemeris database was populated with data from the JPL Planetary and Lunar Ephemerides catalogs DE200, DE405, DE406. This EJB will eventually supplant the flat file access code currently employed by the JPL Catalog Servlet. Ephemeris Model EJB calls this EJB when performing orbital mechanic computations.

MySQL Workbench was used to design the database schema (See diagram below) and to generate and execute the DDL SQL script to create the tables for the ephemeris database. The persistence files were generated using NetBeans "Entity Class from Database" utility. No additional coding was required apart from designing the database schema and running scripts to construct the persistent entities.

Files: EphemerisCatalog.java, EphemerisCatalogRemote.java and EphemerisCatalogInterpolator.java


ephemeris_db.png

JPL Catalog Web Service

The purpose of this web service is to serve on demand varying sizes of chunks of data from arbitrary offset into the indicated JPL Planetary and Lunar Ephemerides catalog. The combined file sizes for DE200, DE405 and DE406 catalogs total around 300MB making it impractical to bundle the files with Java or JavaScript client programs.

Files: EphemerisResource.java and EphemerisCatalogClient.java

ZipCode Web Service

The purpose of this web service is to serve on demand geographic locale data along with auxiliary information for the given zipcode. It would be impractical to include the zipcode database with Java or JavaScript client programs.

Files: ZipCodeResource.java, ZipCodeRecord.java, ZipCodeClient.java and ZipCodeClient.js

The following demo shows how to call the ZipCode Web Service from a JavaScript client. I employ the use of my PACKAGE API to bring Java class-like programming into the JavaScript world.

Files: index.jsp and ZipCodeTest.js