I have no special talent. I'm only passionately curious - Albert Einstein
May 05, 2010
Managing Application Configurations
Posted by Dave Malone
in Best Practices,
Spring,
Configuration,
Java,
Technology
Most applications require configurations specific to the environment they are being deployed to. Java applications are meant to be written once, deployed anywhere, so developers need a mechanism that allows them to deploy a single WAR or EAR file to any environment, instead of packaging a deployment for each specific environment. Using Spring, a simple naming convention for properties files, and a single environment variable (either on the server or from the command line) we can achieve this feat.
Continue Reading
April 30, 2010
Binding Indexed Properties in Grails
Posted by Dave Malone
in Grails,
Spring,
Configuration,
Java,
Technology
Here's an example of how to bind indexed properties to a Grails (or Spring) domain or command object without having to hand roll the parameter parsing and binding. The domain object graph is simple, and based on a project I'm currently working on, but this method can be applied to any sized object graph.
class LeagueMembersCommand implements Serializable{
String[] types
String[] firstNames
String[] lastNames
String[] emails
Integer[] handicaps
static constraints = {
types(nullable:false)
firstNames(nullable:false)
lastNames(nullable:false)
emails(nullable:false)
handicaps(nullable:false)
}
}
Continue Reading
April 29, 2010
Running a Jar file with Ant
Posted by Dave Malone
in Configuration,
Java,
Technology
I recently attempted to run a jar file that has multiple third party dependancies from an ant build script. I assumed that you could use a path element to define a path containing all of the external dependancies, and that you could use the built in java task in ant, pointing to my jar file, using the classpathref attribute to run the application. I quickly discovered that I was wrong, and there wasn't a very straightforward explanation on the web (that I could find) as to why.
Continue Reading
February 15, 2010
Acegi Security Plugin for Grails
Posted by Dave Malone
in Grails,
Configuration,
Java,
Technology
I've been attempting to develop an application using Grails 1.2.1, and the Acegi Security plugin for Grails v. 0.5.2 (also known as the Spring Security Plugin). Grails is still young, and so is it's group of plugins, so there are a lot of configurations that are flawed. This article outlines how to get up and running with Grails and the Acegi Security plugin v. 0.5.2, including how to get the JavaMail configurations working for use with Gmail
Continue Reading
February 10, 2010
Apache CXF on WAS 7.0
Posted by Dave Malone
in Bug,
Spring,
Configuration,
Java,
Technology
Apache CXF is an agile, open source web services framework that integrates out of the box with the Spring framework. This framework utilizes JAXB, and the new JAX-WS APIs, and does not require developers to use any proprietary APIs or annotations. CXF provides multiple transports - you can write a single service, and reuse it as a SOAP based web service, or a RESTful web service. The project, at the time of this writing, is very active, with new versions being released on a regular basis.
Continue Reading
February 02, 2010
Developing jsonp Services for jQuery
Posted by Dave Malone
in Javascript,
Java,
Technology
The documentation for successfully developing jsonp services for use with jQuery is not very straightforward. The examples consist of a number of ajax calls using jQuery's .ajax and .getJSON functions, but until recently did not contain any examples of performing remote calls to jsonp services. If you read the documentation for using the jsonp dataType with their ajax function, you will see a link to an article by Bob Ippolito outlining the first proposed jsonp format, and how to use it. The format documented on Bob's article is not valid when used with jQuery's functions (jQuery doesn't error out, it just doesn't do anything at all). Their most recent example of using the new Flickr jsonp API sheds light on the format that jQuery really expects for json returned by remote jsonp services.
Continue Reading
November 16, 2009
Unit Testing
Posted by Dave Malone
in Best Practices,
Java
Unit testing not only ensures that application code runs the way the developer intends it to, but can also provide a sort of guide for other developers. Unit testing helps to make an application more robust - running existing unit tests assists in revealing impacts changes may have on an application, assuring against defects. Any applications that don't have unit tests are considered Legacy Applications, and are usually more expensive to change, and have experienced more defects, adding into the break/fix cycle in production deployments. I prefer to implement unit tests using JUnit, since there is plenty of extensions and frameworks that support writing and running JUnit tests. EasyMock is a JUnit library that allows developers to unit test code which contains many dependancies, and provides a means to focus on actual unit tests instead of functional or integration testing. An excellent Unit test code coverage tool exists as a plugin for Eclipse, EclEmma, which provides package level, class level, and line by line statistics of unit test coverage in Java classes. The Spring Framework provides many utilities to unit test Spring configured code as well. Here are some example unit tests
Continue Reading
November 06, 2009
Tools of the Trade
Posted by Dave Malone
in Java,
Technology
When you begin your journey as a developer, either fresh out of college, or as an individual experimenting with technology, you'll soon discover a plethura of tools available to assist you in your development. I've encountered a lot of tools in my few short years of experience, but few remain in my arsenal today. Those few have proven to be the best, with the most available features, active open source communities, and fewest bugs.
Continue Reading
November 03, 2009
Automate your Twitter Feed in Java
Posted by Dave Malone
in Spring,
Java
I set out to automate the Twitter feed for the social networking site I developed, MyBuckStory.com. The site is written in Java, and I wanted to continue using bit.ly to shorten my URLs, and the custom format I had come up with to use as a Twitter status update for new stories posted on the site.
I was pleasantly surprised to find an open source library out there already, called Twitter4J. The library was quick and simple to get myself up and running. The closest thing I could find for a Java library for bit.ly was a JSP tag library. I wanted to be able to run this in the service layer of my application, so I began developing my own custom solution.
Continue Reading
July 28, 2009
Creating Wireframes
Posted by Dave Malone
in Technology
Wireframes are an effective way to communicate intended design to your business stakeholders. They are invaluable because they allow your users to decide if the application will be useful and usable in the way they need it to be, without developing the entire application. Developers love this because it helps to avoid scope creep, and it helps to produce an application even the most insatiable users will enjoy.
As a developer, I try to throw design concerns over the wall to a UI or usability specialist. I often find myself needing to prepare a quick set of screen mockups or wireframes anyways by drawing one up on a piece of paper or a whiteboard. I haven't convinced myself to use any of the software that's available to me because of price, or because of the lack of usability (yes, wireframe software can lack even common sense usability).
I've recently evaluated a few different wireframe technologies, including the Pencil plugin for Firefox, Axure RP Pro, and WireframeSketcher.
Continue Reading