Wednesday, September 10, 2008
Effective Java @ Parleys - Presentation
Tuesday, September 9, 2008
jpwgen - Password Generator for Java
What is nice about it is that you can use it both as a command line program and/or as a library within your applications.
By the way, if you need a GUI tool for Windows to generate passwords, check out pwgen-win
Monday, September 8, 2008
A Life-Changing Event...
Thursday, August 21, 2008
Adobe Flex in Atlanta
Additionally, here in Atlanta there are more and more Flex projects going on...I wonder if it starts reaching a tipping point.
Finally, I think I need to check out the Atlanta Flash and Flex User Group, especially since it is just around the corner from where I live :-)
Wednesday, August 20, 2008
AJUG DevCon 2009 - Planning
Tuesday, August 5, 2008
Spring does not like IBM's Java Runtime Environment
As it turns out, this was already a reported issue in Spring's Jira. Even better - it was already fixed and after updating Spring from 2.5.3 to 2.5.5 everything is running smoothly again.
Saturday, July 26, 2008
Struts2, JFreeChart - Transparent Charts
JFreechart
that has a transparent background (rendered as png). Well, I thought
this would be trivial to do as Struts 2 ships with a
plugin
for it...
I created a simple action that creates a chart:
public final String execute() throws Exception {
final DefaultCategoryDataset categorydataset = new DefaultCategoryDataset();
this.chart = ChartFactory.createLineChart("MyTitle",
"categoryLabel", "valueLabel", categorydataset,
PlotOrientation.VERTICAL, true, true, false);
chart.setBackgroundPaint(new Color(255,255,255,0));
return SUCCESS;
}
In my Struts XML file I put this:
<br /><action name="createChart"
class="com.hillert.sandbox.ChartAction"><br /> <result
name="success" type="chart"><br /> <param name="width">200</param><br /> <param
name="height">150</param><br /> </result><br /></action>
Well, the result is that my chart gets generated and rendered but
without transparency.
After asking the internet's oracle for guidance, Google returns a fews
results, e.g
this
one
that indicate that JFreeChart by default does not generate Alpha
Transparency for Pngs.
The solution however lies in customizing the jFreeChart Struts plugin.
In it's shipped version the plugin is calling:
ChartUtilities.writeChartAsPNG(os, chart, width, height);
For transparency you need to use the
extended
method call
. Simply change the method call above to:
ChartUtilities.writeChartAsPNG(os, chart, width, height, true, 0);
As a result aplha transparency is enabled and my chart is generated with
a transparent background.
Just for completeness, here is my action configuration using the
customized jFreeChart plugin:
<package name="chart"
extends="jfreechart-default" namespace="/chart"><br /><result-types><br /><result-type
name="customChart" class="org.jrecruiter.web.CustomChartResult"><br /></result-type><br /><br /><action
name="createChart" class="com.hillert.sandbox.ChartAction"><br /><result
name="success" type="customChart"><br /> <param name="width">200</param><br /> <param
name="height">150</param><br /></result><br /></action></result-types></package>
Tuesday, July 1, 2008
Book Review: Effective Java, Second Edition
Effective Java, Second Edition by Joshua Bloch is certainly the best Java book I have read in a long time. As a disclaimer, I never read the first edition and I am thus unable to compare the two editions. Effective Java, Second Edition is a mostly easy and fun read providing you with many insights and best practices on how to use Java effectively. It certainly is not a book for the beginner just starting out learning Java. For that purpose you may want to take a look at Thinking in Java by Bruce Eckel instead. Nevertheless, Effective Java would serve as an excellent follow-up.
In Effective Java, Joshua Bloch does a great job describing best practices that you as developer will find useful on a daily basis. For example, I really found his description of the builder pattern (Item 2, page 11) quite interesting. Another Item that fascinated me, was Item 15 (page 73) - "Minimize mutability". Both items are part of a broader theme throughout the book that promotes creating code that is as immutable as possible. In that regard, reading the book will enable you to simply write better and safer code. The book also leads the way towards promoting functional programming techniques which will come in quite handily when developing multithreaded applications. Therefore, as a next book I may recommend reading Java Concurrency in Practice by Brian Goetz.
Even for the experienced Java developer, Effective Java contains quite a few little eye openers. I for example was previously unaware of how static factory methods can simplify the creation of parameterized type instances using "type inference". This example is described on page 9 (Item 1). In the past I had always used something like this:
List
But by using a static factory method you can do:
List
I thought that this was a pretty nifty example that may help making code a bit cleaner. What I also very much liked about Effective Java was that Joshua points out certain short-comings of the Java language itself and its APIs whenever applicable. For example, page 64 describes the inconsistent behavior between BigDecimal's 'equals' method and its 'compareTo' method, and in item 41 (page 194) Joshua details the shortcomings of the List interface when using Autoboxing.
While the vast majority of the book was very easy to read and to understand, I found that the chapter about bounded wildcards using generics (item 28) was a little difficult to grasp and I wished it were a bit more extensive. On the other side, the provided mnemonic is quite helpful: PECS - Producer-extends, Consumer-super.
Overall, I highly recommend Effective Java, Second Edition which will continue to serve me, and likely you too, as an excellent reference resource.
Wednesday, June 18, 2008
TED - Ideas and Inspirations
Wednesday, June 4, 2008
NFJS Atlanta 2008 Report
Here are the sessions I attended:
Friday
- Developing Rich Internet Applications by Richard Monson-Haefel
- Java Memory, Performance and the Garbage Collector by Ken Sipe
- Architecture and Scaling by Ken Sipe
- Tactical Continuous Integration with Hudson by Andrew Glover
- SOA's Challenges by Ken Sipe
- Dojo: Getting Started by Nathaniel Schutta
- Configuring Spring with Annotations by Mark Fisher
- Enterprise Integration Patterns with Spring by Mark Fisher Part I
- Enterprise Integration Patterns with Spring by Mark Fisher Part II
- Introduction to Tapestry 5 by Howard Lewis Ship
- Pragmatic Patterns with Tapestry 5 IoC by Howard Lewis Ship
In terms of speakers - Ken Sipe was simply terrific. I did not expect an overly exciting presentation when listening to "Java Memory, Performance and the Garbage Collector" but I was very impressed. Great talk and very informative.
Lastly it is always nice to listen to Howard Lewis Ship - Tapestry looks good and I really need to play with it at some point - if only the day had 48 hours...
Can't wait for the next conference - Jay, job well done.
