Wednesday, 28 December 2011

Use ColorBrewer for coloring maps rendered with GeoTools

ColorBrewer is an excellent library for creating dynamic color palettes that can be used to apply colors to a map based on the spread of data values. The ColorBrewer web tool allows you to select a color scheme based on the nature of the data (sequential, diverging, qualitative) and  the number of data classes present in the data. You can opt to select a color scheme that is color blind safe and works well on a photocopier.
Based on your requirements, the web tool will display the name of the color scheme that works best for the entered combination. For example, in the screenshot below, the color scheme chosen by the tool is BuGn.

ColorBrewer 2.0

ColorBrewer comes bundled with GeoTools. To include the correct library,use the following Maven snippet.

     org.geotools
     gt-brewer
     2.7.2

To instantiate the required palette within your Java application,
   String paletteName = "BuGn";
  ColorBrewer brewer = null;
  try {
   brewer = ColorBrewer.instance(ColorBrewer.DIVERGING);
  } catch (IOException e) {
   //Log Error
  }
                // Instantiate the color palette 
                 palette = brewer.getPalette(paletteName);
                // Get the number of colors your need. In this case, 3 colors
                // which are a variant of Green
                 palette.getColors(3);
Now, you have an array of colors which you can apply to your GIS features.

Sunday, 25 December 2011

India's upcoming tour of DownUnder 2011

The last time I put together my thoughts before India (the then Twenty20 World Champions) toured Australia, and predicted an exciting time, little did I realise that the tour would become infamous for all the wrong reasons. This time around, both teams have resolved to play cricket in the spirit that it is meant to be played. Michael Clarke will be leading a relatively inexperienced side against the one day World Champions who not so long ago where also the leading Test team. Both sides have a lot to prove. Clarke will be hoping to assert his leadership early in the series while the Indians will be hoping to go 1-up early.

The Boxing Day Test which will be viewed by about 60,000 fans at the MCG including myself will see Tendulkar, Dravid, Laxman and possibly even Ponting play a Boxing Day test for perhaps the last time in their long and illustrious careers.Lets hope that these stalwarts get the best possible opportunity to perform before an adoring legion of fans and we are treated to some superb cricket in the Boxing Day test and through out the series. I guess this series will in all probability see Tendulkar (barring an injury) get his 100th International hundred and it will be a well-deserved milestone that will perhaps stand the test of time, just like the Don's famous average of 99.94 will.

Addendum : The first day of the Boxing Day test was attended by 70,068 fans, a record for an India-Australia test match and the day lived up to its billing. Tough cricket was played out by both sides with neither willing to give an inch and the match looks headed for an exciting finish.Here are some pictures from day one of the test.




Friday, 25 November 2011

Install JFreeChart 1.0.14 with Maven

After 2.5 years, JFreeChart came out with a new release of the toolkit on Nov 21,2011.Version 1.0.14 promises bug fixes, improvements in the TimeSeries graphing and much more. Over the last few years, JFreeChart has been a popular open source choice for charts and graphs in Java.  The previous version has been download close to 430,000 times and while there are not many examples available describing the usage of the toolkit, installing it and implementing it in a Java application is relatively pain free.
Currently, the Maven repositories have not been updated with this release and you will need to manually install it into your local repository. To do so:

  • Download the latest release from the source-forge download page. Unzip the jar onto your local file system to any directory, say C:\jFreeChart\jfreechart-1.0.14
  • Open a command prompt in the directory where you have your Maven POM located and invoke the following command from the command line:
  • mvn install:install-file -Dfile=C:\jFreeChart\jfreechart-1.0.14\lib\jfreechart-1.0.14.jar -DgroupId=jfree -DartifactId=jfreechart -Dversion=1.0.14 -Dpackaging=jar
This should install jFreeChart into your local Maven repository. Now you can add a dependency to the Maven POM as follows:

     jfree 
     jfreechart
     1.0.14 
     compile 
    

Saturday, 19 November 2011

Tomcat 7.0, JSF (Mojarra) 2.3.1 and PrimeFaces 3.0M4


Spent the last few nights experimenting with the bleeding edge of Java Server Faces (JSF), Prime Faces and Tomcat and expectedly came away bloody and a lot more wiser.

Java Server Faces has come a long way in the last 5 years or so but a steep learning curve and relatively poor documentation makes it even harder to adapt. The latest specification release of JSF is 2.1, compatible with JavaEE 6 application servers, or any server implementing Servlet 3.0.JSF has two main implementation flavours- Apache MyFaces and Sun (now Oracle 's) Mojarra.

Now herein lies the problem.There are some subtle differences between JSF 2.0 and 2.1 specifications as pointed out by BaluC. JSF 2.1 is aimed at marrying the Servlet 3.0 API and so targets Servlet Containers supporting the 3.0 specification, such as Tomcat 7.0, Glassfish v3. while JSF 2.0 was aimed at the Servlet specification 2.5 and so works well with earlier releases of the servers.

If you are intending to use the latest release of Tomcat which is 7.0.22 and JSF MyFaces, you should be fine but if you try and bring in a component library such as Tomahawk, you'll find that support for the > JSF 2.0 version of a JSF implementation is not all there.I decided to use PrimeFaces and went with 3.0M4, a milestone release from last week and while the setup and integration of the stack (Tomcat 7.0.22, MyFaces 2.3.1 (and later I removed MyFaces and bought in Mojarra) was smooth(Thanks to Maven), getting the FileUpload component of PrimeFaces to work was impossible. The fileUpload bean would just not get called and there were no errors in the server log. Baffling!!Questions to the user forum did not show much light until I came upon Bug 49711 related to annotation scanning in the Tomcat archives. The problem was not with PrimeFaces of a JSF implementation but with a regression of Tomcat's handling of a multi-part request. This problem was reported since version 7.0.6 and while there is an indication that setting allowCasualMultipartParsing = true in the Context definition will by-pass this issue, I can tell you otherwise. Anyway, I got it all to work with Tomcat 7.0.2 (i.e I had to go back 20 releases).

Tomcat version 7.0 onwards implements the Servlet 3.0 specification and brings in some new and very much needed features such as out-of-the box authentication support(via the HttpRequest) and FileUpload. This major leap forward could have possibly led to these regression defects that need to be addressed before Tomcat can be regarded as a stable candidate for implementing a JSF based stack. JSF (MyFaces & Mojarra) doesn't really help Tomcat in the sense that itself is in a state of evolution and the component libraries are struggling to keep up.

To end on a positive note, I was very impressed by the PrimeFaces showcase and the extensive set of features offered which currently makes it one of the best JSF component libraries going around.However, again a word of caution.The last stable release of version PrimeFaces is 2.2.1 which has Flash based components while the latest 'milestone' version 3.0M4 is based on HTML5.This again is a major revamp of the architecture and currently the forum is littered with support questions and reports of 'not working', so wait for a few more releases before choosing PrimeFaces version 3+ or like me, prepare for battle!!

Thursday, 10 November 2011

Deploying your web application to TomCat 7.0 using Maven

Deploying your web-application using the tomcat-maven-plugin can be done by as follows:
1. Create a user in Tomcat with the manager-script role. Before Tomcat 7.0, this was accomplished using the manager role. The user details can be sepecifed in the conf/tomcat-users.xml file as follows:
2. Now you need to tell maven that it can deploy applications to Tomcat using this role.
To set this connection, open your settings.xml file which should be present .m2 directory. Search for 'server' and put in the following credentials:

          localhost
          tom
          cat

Obviously, the server name is :localhost in this case.
3. In your maven pom.xml configure the tomcat-maven-plugin as follows:

             org.codehaus.mojo
             tomcat-maven-plugin
             
                http://localhost:8080/manager/text
                      localhost
                      /test
             
         

Take note of the
http://localhost:8080/manager/text
This is important otherwise you will keep getting 403:Access Forbidded errors when you attempt to deploy.
  • To build you war and deploy on Tomcat, use : mvn tomcat:deploy
  • To redploy your war, use : mvn tomcat:redeploy
  • To undeploy your war, use : mvn tomcat:undeploy
Troubleshooting : If you are getting connection refused : 401 errors while deploying, it means that most probably you have not setup your Maven settings.xml file correctly or that you have added the configuration parameters to the wrong file.

Wednesday, 2 November 2011

log4j - power logging at your fingertips

log4j has been a popular logging framework in Java applications for several years. It is simple to implement, thread safe and light weight. While there are no current major releases planned, it is still a popular download among the Apache Logging Services toolset.
To add log4j to your project using Maven, add the following dependency snippet to your code


  log4j
  log4j
  1.2.16
 
Maven will download and add the log4j jar to your respository. Next, you need to specify a configuration file, which could be either a .properties file or a .xml file.The configuration file is usually named as log4j.properties or log4j.xml and need to be placed within the classpath for the application to find it.
If you are building an application that ships as an executable JAR, place this file within your src/main/resources or your src/test/resources directory depending upon whether you need your logging framework in the production code or not
The log4j manual describes a sample properties file.If you don't have access to a .properties file, you can use the entries shown in the example to create a .properties file for yourself.Now that you have a log4j properties file, you need to make sure that you have a Appender defined within it.
For logging messages to the console, use a ConsoleAppender. For logging to a file, use a FileAppender.
To control what should be logged with the log statement, set up a Layout and initialise it to a particular Pattern. A popular Layout is the PatternLayout that formats the output line with meta data using a pre-defined pattern.

For example, here is a snippet from the manual.

# Set root logger level to DEBUG and its only appender to A1.
log4j.rootLogger=DEBUG, A1

# A1 is set to be a ConsoleAppender.
log4j.appender.A1=org.apache.log4j.ConsoleAppender

# A1 uses PatternLayout.
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.appender.A1.layout.ConversionPattern=%-4r [%t] %-5p %c %x - %m%n

The ConversionPattern can be used to specify meta-data about the logged statement, such as the Class from were the log originated, the date and time in different formats, the severity level etc.An exhaustive list is available in the API docs. It is worth noting the several warnings posted in the API docs regarding speed and efficiency before choosing a ConversionPattern character.
Another aspect of log4j logging performance that one needs to be aware of is the cost of creating a log statement that may not be used.To get around the parameter construction code, wrap the logging statements within a check:
if(logger.isDebugEnabled() {
    logger.debug("Log : " +  " String 1 " + "String 2"));
}
If the check is not place, the log statement will create 4 Strings (yes , we could have used a StringBuffer), but a simple check prevents this overhead. Ofcourse, there is now the cost of checking the LEVEL at which the logger is set, but this is a miniscule overhead.
Finally, now that the log4j is setup and has been configured, instantiate it 

static final Logger logger = Logger.getLogger(MyClass.class);
and start logging:
logger.info("Starting the APP");
Exceptions can be sent to the log file as an argument to the logger.error method.
catch (Exception exception) {
logger.error("Error in loading application! ", exception);
To conclude, if you need an easy and fast logging framework, log4j will fit your bill.However, if you are in the market for the next generation of logging, then have a look at Logback

Saturday, 29 October 2011

Using 'R' for Statistical Computing

I recently tried out the 'R' toolkit for performing some statistical operations and was impressed with the power and the extensibility of the toolkit in manipulating terra-byte sized data and its ability to produce publication ready graphs. Being open-source, it is available under the GNU GPL and can be downloaded from a CRAN site and set up to run on Windows, UNIX or Mac OS.
The toolkit basically provides a command-line enviroment for manipulating and loading data into memory arrays which can be subject to further statistical analysis. While the majority of the users see 'R' as a statistical package, it can be also be used as a modelling tool for linear / non-linear models.Apart from providing some high level functions for statistical computing, 'R' also has a well-developed suite for looping and conditional execution. It  also allows extensibility so that users can write their own functions.While the user-interface is easy to get used to, if you are coming from a UNIX background, it might take some getting used to for Windows users.

The 'Help' module is a well designed and is easy to use. Documentation on any function can be loaded from the command-line by preceeding the function name with a '?'. Overall, 'R' is a powerful toolkit for statistical computing and an excellent choice for manipulating large data sets.

Tuesday, 18 October 2011

GeoTools - GIS for Java Developers

GeoTools is an excellent Geographical Information System (GIS) toolkit for Java. It is open-source and has regular updates. The last released version at the time of writing is 2.7 released on the 7th of October 2011. The toolkit also serves as an engine for some other GIS based open-source tools such as uDig, GeoMajas and GeoServer.GeoTools also has some good supporting documentation with tutorials for setting up the toolkit in Eclipse / Maven. The tutorials also give some pointers on generic Geospatial concepts, such as Features, Layers and Maps

A Feature in GIS world is any real world entity that can be represented on a Map. Valid examples of such entities are rivers, buildings, roads, etc. In GeoTools, Features are an instance of a FeatureType. Thus, Features can be considered analogous to (Java) Objects and FeatureTypes can be modelled as (Java) Classes. Features have attributes. for example,  a river may have length, depth, water salinity as its attributes similar to the Field concept in Java. Features also define operations which are analogous to Methods in the Java world. Thus, this close analogy between Java concepts and the GIS toolkit implementation  makes it an easy for Java programmers to work with the toolkit.

Data in GIS (& GeoTools) can be represented in two forms, Raster or Vector type. Raster type data refers to digital images that can be transformed to a grid representation. Vector type data use Geometry to represent real-world elements.Geometry can be reduced to three main forms: Point, Line and Ploygon. Geometry also gives a location attribute to the element it refers to.

Thus, in GeoTools, defining a Feature using a Vector datatype requires a Geometry component specification.  A Feature also has a Style component associated with it. The Style component defines the rendering and look and feel of the Feature on the Map. Features are connected to a Map using Layers. A Map can have several Layers. A Layer contains a set of Features and their associated Styles. It is possible to overlay several Layers on a Map and thus have different objects visible in the same view.Usually, this entire information schema is stored within a file, known as a ShapeFile.

To summarise the process of rendering a Map using GeoTools, the following steps need to be followed:

1. Create a Map, using a DefaultMapContext
2. Load the ShapeFile 
3. Extract the FeatureSource from the ShapeFile  [FileDataStoreFinder.getDataStore(shapeFileLocation)]
4. Create a Style using the FeatureSource. GeoTools has some good tutorials on getting this done.
  A Style involves creating FeatureTypeStyles and associating Symbolizers and Rules with the defined FeatureTypeStyles.
5. Add the Style to a Layer of the Map.
6. Add the Map and a Renderer, to a JMapPane which extends JPanel.
7. Display the JMapPane.

GeoTools also has tools available for creating ShapeFiles from CSV files.Thus, GeoTools simplifies the process of creating GIS applications in Java and enables applications to be up and running within a matter of hours.

Saturday, 24 September 2011

Maven-ise your Eclipse (Indigo)

With the transition of the Maven2Eclipse plugin project from the Sonatype boys to the Eclipse umbrella, support for running Maven from within Eclipse has become smoother and definitely easier. To get started, install the Maven2Eclipse plugin from within Eclipse using the Help->Install new software menu option. The link to the plugin download is http://download.eclipse.org/technology/m2e/releases but verify the same from the  plugin site.
After successfully installing Maven, you will have access to several Maven project wizards that will help you get started with a Maven project with a few clicks as shown in the example below as I did for Eclipse Indigo.

  • Select a New project and choose Maven project. Click through the next few steps. You will get an option to choose the Maven archetype and specify the GroupId, Artifact Id, Version and Package






















  • After you select the required options, the wizard will generate a project file structure and populate it with some skeleton code including a Junit test.











  • That's it. You have created a Maven based project which is now awaiting functionality. Adding new dependencies, plugins to the project and the POM is made easy using the Maven project menu, available by right clicking on the project folder and selecting the required option.























  • A Maven Build can be set-up and initiated from the Run- As menu option. 













  • Selecting the Maven build option for the first time which will bring up a set-up configuration dialog that will enable you to specify the goals, profiles and set up any required parameters.

















  • Once the Run configuration is ready, you can build your Maven project and deploy your snapshot.

Friday, 16 September 2011

Generating Entity Relationship diagrams from a database schema

Consider the situation where you have been given a database schema to work with but there is no E-R diagram documentation available and you need to re-design the database schema. The first step would be to try and understand the existing schema by generating an Entity-Relationship (ER) diagram from the existing database schema.To get an E-R diagram where none is provided, use SchemaSpy.

SchemaSpy produces a rich set of diagrams and tables which gives the users and developers a detailed description of the schema tables, constraints, anomalies ( to investigate what might be wrong with the schema) and most importantly, it displays the relationships between the entities as an E-R diagram. The following steps should help you get started with SchemaSpy. 
  • The tool is Java based open source software tool that it has been developed using Java, runs on Windows as well as UNIX and requires the Java Runtime Environment (JRE) so install the JRE if you don't have it,
  • For generating Graphical views of the schema, the tool is dependent upon the Graphviz library, so download and install it before installing Schema Spy. You'll have to make sure that your Windows PATH Enviroment variable points to the bin directory of the Graphviz install. If it doesn't, you can still run SchemaSpy but you'll need to specify an additional parameter along with the start up parameters of SchemaSpy.
  • Download the jdbc driver for the database SchemaSpy will connect to. For example, for PostGresql, you can download the jdbc driver from this page. For MySql, you'll find the driver here and for Oracle, here.
  • Download and install SchemaSpy. Have a read of the start up instructions and see which parameters are mandatory and which are optional.  Open a DOS command prompt and run SchemaSpy using the following command : 
  • java -jar schemaSpy_5.0.0.jar -dp    -t databaseType  -host -db -s  -u  -p   -o
  • You may also need the -gv pathToGraphviz parameter 
Depending upon the size of the database schema, SchemaSpy will take a few minutes to generate the ER diagram which can be viewed by clicking on the index.htm in the 


Saturday, 10 September 2011

Designing Model Driven Architectures using the Eclipse Modelling Framework

The Eclipse Modelling Framework (EMF) is another useful tool within the Eclipse suite that offers an open source framework for the designing model driven applications. In terms of technology, EMF unifies Java, XML and UML. Given a 'model' described in either of the three technologies i.e Java, UML or XML schema, it is possible to generate the other two. To get an idea of what type of applications can be designed using the EMF, check out this list

The major advantage of using EMF is that it connects a model to its Java based implementation and this simplifies the process of designing and implementing a model. EMF generates Java code separating interfaces from their implementation. In addition, it also generates Factory classes for managing objects. EMF also supports standard CRUD operations, specification of cardinality constraints and the enforcement of referential integrity. Database persistence is available via Teneo.

Designing models in EMF is done using the Eclipse Java Development Tools.Third party options such as Topcase's Ecore editor and Ormondo's EclipseUML editors can also get the job done.
While the Ecore model can realised from Java (using Annotations) , XML Schema orUML, persisting the serializable version requires another form : XML Metadata Interchange (XMI).

Lars Vogel's tutorial is a good starting point for learning and implementing an EMF based application. While the learning curve for EMF is not very steep, debugging problems in the generated code can be a little painful. To get started with the development of EMF based applications, download the Eclipse Modelling Tools IDE and create a new EMF project using File -> New -> Project

Saturday, 3 September 2011

Designing Swing / SWT GUIs using WindowsBuilder in Eclipse Indigo

The latest release of Eclipse code named Indigo includes the WindowsBuilder project as an open source project within the Eclipse umbrella of projects. WindowsBuilder which is a significant GUI designing tool in its own right provides a WYSIWYG editor for desgining Swing and SWT interfaces from within Eclipse.

WindowsBuilder comes bundled with the standard download 'Eclipse IDE for Java Developers' but if you choose to download another version of Eclipse and you need to manually add the plugin, , goto Help->Install New Software -> and in the 'worh with' box enter the site : site http://dl.google.com/eclipse/inst/d2wbpro/latest/3.7  and then follow the usual steps for adding the plugin. After successfully installing it, you will be able to view the plug-in in the 'Installation History' and the'Plugins' tab of Eclipse Installation Details.


Now that you have WindowsBuilder installed, creating Swing / SWT based GUIs is just a matter of clicking through a few wizards. To create a screen using the wizard, create a Java project and then select New-> Other->WindowsBuilder and open up the wizard.

Other->WindowsBuilder and open up the wizard. Select the required option. In this case, I selected 'ApplicationWindow' and the wizard generates the ApplicationWindow for me as shown in the screenshot.
At the bottom of the editor view, there will be two options, 'Source' and 'Design'. Click on the Design option. This will open the design page and load up the pallet and give you the WYSIWYG option.You can now see your 'frame' object on the right hand side and the pallet with different Swing and SWT controls that you can use. I added a JPanel and set its layout to 'JGoodiesFormLayout' and then added a couple of labels, textboxes and a 'Send' button.
Add the required controls you need. You can also select any of the controls and add any EventHandlers that you might need by right clicking on the controls.


The wizard will create skeleton code for you which you can customize as required. Once you are done, just run the application.




Finally, if you want a different 'Look and Feel', especially a 'Native Platform' look, the WindowsBuilder has an option in the top menu, that allows you to change the Look and Feel as shown in the screenshot below.


Thus, within a few minutes, you can design a fully functional Java application with a few bells and whistles. This is very useful, if you need a prototype and some sample screenshots to show the user. Instead of wasting time,drawing the screens in a prototyping tool, create the same using the WindowsBuilder plugin and when the client gives you the green light, come back to your prototype, clean up the code and add the required functionality. Finally, there are a couple of good tutorials on YouTube that describe using WindowsBuilder with Eclipse.

Sunday, 28 August 2011

JGraph : An open source diagramming tool

JGraph  has an excellent open source Java based diagram creation tool. The guys who have developed the tool also give access to a free online diagram creation tool which is pretty nifty and useful if you don't have MS Visio installed and need a quick diagram on the fly. Once created, the diagram can be downloaded as in xml, jpg or png formats.

Saturday, 23 July 2011

Mock or Stub.. Test it inside out!!

If you have been living in the Test Driven Development (TDD) world, then Mocks and Stubs will be second nature to you. The very philosophy of writing a test case before writing any code sounds like putting the cart before the horse but when you start implementing the practice, it all begins to make sense. Your tests before 'smaller'. They don't have dependencies between them and your code is  much more readable and easier to maintain.

Mocking and Stubbing are two essential components of TDD. While they may appear to perform the same function, they are different sides of the coin. To understand the similarities and the differences between these two forms, consider for example, the class, Compute defined as follows:

public class Compute {
private Integer a;
private Integer b;
public Integer getA() {
if (a instanceof Integer)
{
return a;
}
return null;
}

public Integer getB() {
if (b instanceof Integer)
{
return b;
}
return null;
}

public Compute(Database db) {
this.a = db.getA();
this.b = db.getB();
}

public Integer addNumbers()
{
if  ((getA() != null) && (getB() !=null ))
{
return getA() + getB();
}
return null;
}

public static void main(String[] args) 
{
Compute comp;
Database db = new Database();
comp = new Compute(db);
comp.addNumbers();

}

}

In this example, Compute is getting its input from another class, Database. In the real world, Database would be actually be an RDBMS such as Oracle or MySQL. Since running test cases against a LIVE database can bring in additional complexity such as the setting up of a connection, running an SQL statement against the tables and retrieving the data, Mocking and Stubbing allows the role of the Database to be mimicked.

While there are several subtle differences, the major difference between the frameworks is that Mocks enable the testing of the behaviour of the code while Stubs allow the final result  to be tested.

To test the add Compute with the EasyMock framework, I would 'mock' the behaviour of the Database class using the EasyMock framework as follows:

 Compute compute;
Database mockDB;

@Before
public void setUp() throws Exception {

mockDB = EasyMock.createMock(Database.class);
EasyMock.expect(mockDB.getA()).andReturn(100);
EasyMock.expect(mockDB.getB()).andReturn(200);
EasyMock.replay(mockDB);
}

@After
public void tearDown() throws Exception {
mockDB = null;
compute = null;
}

@Test
public void testAddNumbers() {
compute = new Compute(mockDB);
assertEquals(300,compute.addNumbers(), 0);
}

In the  EasyMock, approach outlined above, we set up the expectations related to how the method calls related to retrieving and adding two numbers would play out and then Assert the actual result against the expected. To understand the code, check out this excellent summarisation of EasyMock. The main rule of thumb while writing a Mock is to specify exactly what should happen and no more

Using Stub frameworks, such as StubOuts to test the above scenario would require creating a Class that implements the addNumber and subtractNumber methods of the Compute class and returns hard coded values, to suit the test. For example, the testAddNumbers  method would look like this:
        
public Integer addNumbers()
{
if ((getA() == 100)  && (getB() ==200 ))
{
return 300;
}
  else
  {
return null;
  }
}

Mocks and Stubs are both powerful ways of testing code and catching regression.However both frameworks are applied differently and are suitable in different scenarios. To ensure a robust testing framework, both approaches should be used in conjunction.

Thursday, 14 July 2011

Java 7 is finally here...

With Java 7 (codename : Dolphin, Project Coin) slated for an official July 28, 2011 release and a developer preview available, it is encouraging to see the excitement generated by the Java 7 celebration webcast. Its been around 18 months since Oracle absorbed Java and there was a bit of uncertainty when all one would see in the Java updates was be the re-branding of JDK with the Oracle logo.

While Java 7 doesn't promise any ground breaking features, there will be an improved I/O API and a few other bits and pieces (Strings in Switch constructs, Easier Generics, Improved error handling and readability of code). It is also encouraging sign for developers that Java based applications will continue to thrive and move in an expected direction guided by the JCP.

Saturday, 2 July 2011

Building RCP applications with Eclipse

While Eclipse is a well known and respected development platform, it also serves as a basis for the development of RCP (Rich Client Platform) applications. In doing so, Eclipse presents itself as an open tools platform. Since the architecture of the Eclipse platform is modular and is built upon the plugin methodology, it is possible to reuse the core components of the Eclipse platform and build just about any Rich Client Platform. Here is a good list of commercial products that are based on the Eclipse RCP framework. The main reasons for developing an Eclipse RCP application would be that it would be realised as a 'Component' model. In other words, building blocks of the application can be re-used as building blocks of other distinct applications. Further, the application would remain OS Independent while giving the user an OS based native look and feel.


Since the main components that serve up an Eclipse RCP UI application JFace and SWT (Standard Widget Toolkit) are distinct to Swing in architecture and purpose, there is a learning curve involved which is made easier via a good set of regularly updated tutorials. Hardcore Swing users need not despair as it is possible for both technologies to share the same space. A good place to start learning RCP applications is here and Lars Vogel's comprehensive tutorial.

Tuesday, 28 June 2011

Eclipse Indigo arrives...

Eclipse Indigo became available for download on June 22,2011. 62 teams coordinated in bringing together 46 million lines of code to make this release possible.I download a copy and noticed a marked improvement in Project Refresh rates. While Indigo appears to be faster, it has bought in some key features such Better support for using GIT, WindowsBuilder for GUI development and automated functional testing of GUI development for Java.

Thursday, 14 April 2011

Research Paper Writing

"If any man wish to write in a clear style, let him be first clear in his thoughts; and if any would write in a noble style, let him first possess a noble soul".
- Johann Wolfgang von Goethe

Writing a research paper is an art. Some people get it right in the first go and some don't even after several attempts. My readings have educated me to a couple of simple facts. I will share them with you in these paragraphs. These facts are quite simple and straight forward. If you like them and make them a part of your writing, I have a feeling that it will make life easier for you and for all those who read your papers.

First of all, there is no right or wrong way of writing a paper. Consider the motivation for writing the paper. Why do you want to write. Is it because, you have an idea, you would like to talk about or maybe you have done some research and you want to present your results. That's good enough. Start writing, but keep in mind that not everyone who will read your paper, especially the reviewer is NOT as brilliant as you. Keep it simple, in word and in expression. Next, maintain the flow. It is very easy to get carried away and jump from one idea to another, without them being connected. If you are not sure of what I am saying. Write a couple of paragraphs and ask your friend to read it. If he or she can relate the last paragraph to the first, well then that's a start.

Diagrams and Tables. Someone has said, A picture is worth a thousand words. True, I agree but if the picture has no meaning in the general scheme of things, then it has no business being there. Introduce your picture before you put it in. That will protect your readers from the abruptness of coming across it unannounced. Look at your picture. Is it descriptive or too descriptive. I have seen pictures with information crammed into it. You would like to avoid falling into that trap. A diagram or illustration is meant to simplify things, not to further complicate them. Explain your illustration in the paragraphs following it, and remember you have to move with the flow of the paper.

I have often come across the use of non-standard wording. Well, what is standard and what is not standard terminology is often difficult to decide. But one rule of thumb could be, when describing scientific experiments or situations try to use technical terms which are recognised by the academia, you are aiming your paper at. If ever you decide to introduce a term, use it consistently. If it occurs regularly, give it a place of honour in the key words section of the paper. Okay, so now you have written your paper. Read it.
Is it good ? Probably not. Rewrite it in parts. Keep your sentences short and easier to understand.

Finally, last but not the least is referencing. There are some well known forms of referencing. Follow any style but be consistent in it. Reviewers on receiving papers switch straight away to the reference section as it is a good indication of how well the paper has been researched and of the writers understanding of the subject. Finally, something which I believe in is, enjoy your writing. If it is a drag, then you are not doing it 'write'. A composition should have life of its own. It should breathe. It should have a meaning for its existence. It should be able to sing and dance and make others do the same. I close this monologue by putting together a few links, which I came across in my meanderings. I hope they help. Please refer to some good books on research paper writing.

Referencing and Citations
Monash University's Page on Referencing Styles

Bibliographies
DBLP Computer Science Bibliography : Quite Comprehensive
Cite Seer Home Page & Search CiteSeer

Thesis Writing : Some Ideas
How to Write a PhD Thesis : By Joe Wolf :-A good article. You can read it in French, as well as in Spanish. At the end of the article there are a few other useful links.

Purdue University's Links: Writing a thesis statement, Writing a research report.

Link
to IEEE, ACM Digital Libraries through Monash (Need to be a current Monash Student with a valid Authcate account to access theses links)