Via the Trendmatcher weblog I came across a nifty tool to use the Google Maps viewer for arbitrary images.

The Google Maps Image Cutter, as the application is called. Is a small Java application which cuts a selected image to thousands of small images compatible with the viewer and a working HTML file.

Really useful for embedding your favorite diagrams (this is diagram I generated for a legacy MMBase application) in a blog post:

Now… the only wish I still have is the option to just use .dot (graphviz) files or a vector graphics format directly ;)

I've been doing some development using Griffon lately. Griffon is a Grails like application framework for developing desktop applications in Groovy which lets you create Java Webstart applications without the hassle. It takes a clean MVC approach including nifty automatic binding of the model to the view. If you want to give Griffon a go, please have a look at the Quick Start guide.

I was looking for a solution to run the application I wrote in fullscreen mode. It took me a while to figure out how to do this. In the end it was quite simple.

Griffon offers a couple of hooks to execute code on specific states of the application lifecycle. The following hooks are availlable:

  • griffon-app/lifecycle/Initialize.groovy
  • griffon-app/lifecycle/Ready.groovy
  • griffon-app/lifecycle/Shutdown.groovy
  • griffon-app/lifecycle/Startup.groovy
  • griffon-app/lifecycle/Stop.groovy

I added the following code to the 'griffon-app/lifecycle/Ready.groovy' script:

GROOVY:
  1. import java.awt.GraphicsEnvironment
  2.  
  3. def graphicsEnvironment = GraphicsEnvironment.localGraphicsEnvironment
  4. def device = graphicsEnvironment.screenDevices.find{it.fullScreenSupported}
  5.  
  6. device?.setFullScreenWindow(app.appFrames[0])

The 'app' variable in the script is an implicit variable pointing to the actual application. Via this variable one can get access to all parts of the application; since I've just got one frame choosing was easy.

Haven't had the change to test the above on windows... but it works like a charm in OSX.

After seeing Blochs' session on Javapolis last year and some of the Java 7 sessions at JavaOne this year I gave up on closures in Java. I just didn't believe that they would be part of Java 7 anymore. I also had my doubts on the 'quircks' of the BGGA proposal.

Playing around with the BGGA prototype changed my opinion though. It might not be as concise as closures in Ruby, but it _is_ a really useful extension of the Java language.

The following code I wrote runs fine with the BGGA prototype:

JAVA:
  1. package com.finalist.closures;
  2.  
  3. import java.util.*;
  4.  
  5. public final class ClosuresExample {
  6.  
  7.     public static void main(String[] args){
  8.         List<String> words = toWords("altijd is kortjakje ziek");
  9.         Collections.sort(words, {String a, String b => b.compareTo(a)});   
  10.         System.out.println(words);
  11.         List<String> wordsContainingK = select(words, {String it => it.contains("k")});
  12.         System.out.println(wordsContainingK);
  13.     }
  14.    
  15.     public static <T> List<T> select(List<T> list, {T=>boolean} filter) {
  16.           List<T> results = new ArrayList<T>();
  17.           for (T t : list){
  18.             if(filter.invoke(t))
  19.               results.add(t);
  20.           }
  21.        return results;
  22.     }
  23.  
  24.     public static List<String> toWords(String input){
  25.         return Arrays.asList(input.split("\\W"));
  26.     }
  27. }

This is just one example, you can do _much_ more with the BGGA proposal. It integrates with the existing API. I like this. I want this. I feel a bit sad about the fact that it might not make it to Java7.

But...

Yesterday @headius / Charles Nutter came up with a very interesting idea on twitter:

@danny_l Gafter made the same mistake; I don't mean a forked Java any more than Groovy is a fork. I want a "mostly Java" with closures.

or the reply by @danny_l / Danny Lagrouw:

@headius or could the BGGA prototype be "bolted on" any future version of Java? That might be useful

That really is what I would like to see as well. Can't we have some sort of bytecode preprocessor to make the BGGA prototype work on any modern Java version? I mean scala, Groovy and JRuby have closures and produce valid bytecode!

I would even like to help and put effort in it. Although I don't really know where to start.


The following product description of Clean Code written by Robert C. Martin managed to trigger my interest:

Noted software expert Robert C. Martin presents a revolutionary paradigm with Clean Code: A Handbook of Agile Software Craftsmanship. Martin has teamed up with his colleagues from Object Mentor to distill their best agile practice of cleaning code on the fly into a book that will instill within you the values of a software craftsman and make you a better programmer—but only if you work at it.

A software craftsman. That is what I’d like to be. It is however a fairly bold claim; wasn’t craftsmanship something you learn through experience? After having read Clean Code however, I can tell you that the Robert C. Martin did a really good job at doing just that.

The content

Clean Code is divided into three parts. The first part describes the principles, patterns, and practices of writing clean code. The second part consists of several case studies. The third part is a single chapter containing a list of heuristics and smells gathered while creating the case studies.

In part one Robert explains the fundamentals of good code. Robert introduces some great concepts like “the newspaper metaphor – ‘think of headlines, synopsis, increasing detail as you continue downward’” and “boyscout rule – ‘leave the campground cleaner than you found it’”. He dives into how to do this: meaningful names, what should a good function look like (in terms of abstraction, arguments, error handling), comments in code, formatting, objects and data structures, error handling in general, talking to third party code, unittests, class hierarchy, architectures and concurrency.
The level of detail is spectacular. Robert doesn’t just tell you how it should be, he also explains how to achieve it; with good, modern, Java code. This part also contains excerpts and metrics gathered from different open-source project illustrating his points; a nice touch.

Part two contains two cases where Robert applies his principles, patterns and practices to real-life projects (JUnit and JFree). What I really like about this part is that Robert explains every single refactor he did; even if he decided to revert his changes later on. The JUnit example is great. The JFree example is a bit tougher; mostly due to the fact that the code for this case is not part of the text but located in an appendix; it takes a lot of ‘random access’ to actually read it.

Part three is a concise list of ‘rules’ you should apply to write good code. Really useful as a reference.

The verdict

I think every (Java) programmer should read this book. It will make you a better programmer. Even if you know all the concepts Robert talks about. Seeing the concepts being applied to code from real-life projects by a skilled developer with a complete explanation is really valuable. I’ll be pointing developers in my team and teams to come to this book!

BBQ Tutorial: Steaming a chicken

Today I got present: a device which is meant to steam poultry on a BBQ. Next to the device I got a nice French chicken from the poulterer. Here a photo story of what happened after that.

RubyEnRails 2008

Today I went to the RubyEnRails 2008 conference. Last year I went there as well and was really enthusiastic about the presentations I visited. This years' conference was good, but didn't manage to come close to what I expected. Maybe my expectations where to high this year.

Zed Shaw gave a really nice opening presentation. He addressed some interesting problems of current software development and benchmarks using some great examples.

After this Obie Fernadez showed some crappy Rails code and told us not to write that sort of stuff. To bad he didn't show how we _should_ code.

Sam Aaron tried to tell us something about the aesthetics of code. Nice presentation. Nothing really conclusive which I didn't know before (yes, domain specific languages are useful).

Mod_rails... interesting nice to have. Next.

JRuby. Good presentation. The JRuby team is really delivering great stuff. I've been spoiled though; Not to different from the one at JavaOne ;)

Then Roderick van Domburg tried to tell something about code metrics. Auch. Apart from really straightforward metrics like the LOC in tests vs the LOC and the average number of lines per method he showed Heckle, Flog and rCov. Which have all been around for years now. Nothing new here.

The Rails Q&A with David Heinemeier Hansson via iChat was horrible. I'm not interested in whether David prefers his Macbook Air over his Macbook Pro.

I did met a lot of people and had some interesting discussions in the corridors; which was really nice!

Macbook Pro doing the impossible

I was debugging a Java application for a customer this afternoon when I noticed something fairly unique in my activity monitor:

I knew that Java can be memory hungry from time to time but this exceeds everything I've seen before ;)

Could it be related to the 10.5.3 update which I recently installed?

JavaOne 2008 - Summary & Reflection

1 day of CommunityOne and 4 days of JavaOne went by in a flash. I've been to a lot of great, a couple of not-so-great and some really bad sessions.

To avoid information overload on semi-interesting topics I really tried to only go to sessions about topics I'm really interested in. For this JavaOne these where (in no particular order):

  • alternative languages on the virtual machine
  • methodologies
  • the future of Java / JEE
  • cool new stuff

I tried to avoid product pitches as much as possible! Some of my personal highlights:

  • the No Fluff Just Stuff session at the g2one party
  • Both Neal Ford presentations I've attended (JRuby vs. Groovy / Enterprise Debugging techniques)
  • the scripting bowl
  • Taming the Leopard with Java

I'm still processing everything I've seen, but so far I didn't see to much I didn't know about before; certainly nothing shocking. Here are some of my observations:

Java 7

Sun is adding more and more annotations, the Java 7 spec-leads feel it's a safe way of extending the language; even though it decreases readability (well, that is MY opinion). They are even planning to extend the number of targets for annotations; in the future we will probably see annotations inside generic type definitions... auch!

I also sincerely doubt that we will see a useful implementation of closures in Java 7; the spec-leads don't want to burn their hands on it; Gafter seems the only one who dares to risk his neck...

Alternative languages on the VM

Groovy gained a lot of traction the past years. Most mayor app-servers offer out of the box support and major speakers are promoting it (Neal Ford repeatedly called it JDK 2.0).
JRuby is looking better and better. It is now even possible to just drop your Rails app in Glassfish to make it run. I do however feel that some users should stand-up and really demonstrate the virtues of Ruby on the VM to get peoples' attention. The Jython presentation(s) where horrible; I think they did more harm to the language than good. I saw some great demonstrations of scala; but popularity seems to be at an alltime low.

As I said I'm still processing al the information and probably blog about various nice details and insights. Now I'm heading towards a restaurant and some beers!

Javaone 2008 - Warming up

Yesterday I (with two of my collegueas) travelled to San Francisco to attend JavaOne 2008 and the Community one sessions which start on May 5th. The interesting conversations began during the flight; we we're located just in front of the David Booth (JetBrains Executive Manager) and had a nice little chat about what features we would pay for in IDE software.

After arriving we just walked through San Francisco and had some beers, good Italian Food en Coffee. The weather is just fine!

Today I'll probably walk arround to see the Fishmens' Wharf, Golden Gate and various other touristic attractions.

I'm uploading foto's to my flickr account; you can browse my JavaOne related pictures here.

university_sessions_pictureIt has been a bit silent on my blog lately. This can be accounted to several reasons including some very busy projects at work and family business. I did write an article (in Dutch) for the Finalist blog about Fluent Interfaces though.

But recently I got some great work-related news which I just have to share: I get to go to JavaOne in San Francisco!

I went over the schedule and created a preliminary schedule (which proved to be quite hard with so much to choose from) of the sessions I'd like to visit. As you can see; I'll be on a tight schedule!

Time Session ID/Title Speaker(s)
Tuesday , May 06
8:30 AM - 10:30 AM Sun General Session
Java + YOU

 
11:30 AM - 8:00 PM Tuesday Pavilion Hours: 11:30 a.m. - 8:00 p.m.  
11:50 AM - 12:10 PM Break between sessions  
11:50 AM - 11:50 AM Lunch Served from 11:50 a.m. to 2:00 p.m.  
12:10 PM - 1:10 PM TS-6623
More "Effective Java"
Joshua Bloch
1:30 PM - 3:00 PM Sun General Session
Java-Centricity: Leveraging Java Technology at the hub of your Digital Life

 
3:20 PM - 4:20 PM TS-5581
Upcoming Java™ Programming-Language Changes
Alex Buckley; Michael Ernst; Neal Gafter
4:20 PM - 4:40 PM Break between sessions  
4:40 PM - 5:40 PM TS-5030
Building Secure Mashups with OpenAjax
Jon Ferraiolo
5:40 PM - 6:00 PM Break between sessions  
6:00 PM - 7:00 PM TS-5764
Grails in Depth
Guillaume Laforge; Graeme Rocher
7:00 PM - 7:30 PM Evening Break  
7:30 PM - 8:20 PM BOF-5031
Upcoming Java™ Programming Language Features
Alex Buckley; Maurizio Cimadomore; Jonathan Gibbons
8:30 PM - 9:20 PM BOF-5111
Scripting in GlassFish™ Project
Arun Gupta; Vivek Pandey
9:30 PM - 10:20 PM BOF-5205
All About the Sun Certified Enterprise Architect (SCEA) Exam
Mark Cade; Humphrey Sheil
Wednesday, May 07
8:30 AM - 9:15 AM Oracle General Session
Enterprise Application Platform

 
9:30 AM - 10:30 AM PAN-5435
The Script Bowl: A Rapid-Fire Comparison of Scripting Languages
Guillaume Laforge; Charles Nutter; Jorge Ortiz; Raghavan Srinivas; Frank Wierzbicki
10:30 AM - 10:50 AM Break between sessions  
10:50 AM - 11:50 AM TS-5286
Introduction to Web Beans
Gavin King
11:30 AM - 4:30 PM Wednesday Pavilion Hours: 11:30 a.m. - 4:30 p.m.  
11:50 AM - 11:50 AM Lunch Served from 11:50 a.m. to 2:00 p.m.  
1:30 PM - 2:30 PM TS-5535
Tying Java™ Technologies Together the RESTful Way
Roderico Cruz; Peter Liu
2:30 PM - 2:50 PM Break between sessions  
2:50 PM - 3:50 PM TS-7064
Future Challenges for Open Source and Java™ Technology
Patrick Finch; Simon Phipps
3:50 PM - 4:10 PM Break between sessions  
5:10 PM - 6:30 PM Evening Break  
5:30 PM - 6:15 PM AMD General Session
The Role of the Microprocessor in the Evolution of Java Technology
 
8:30 PM - 9:20 PM BOF-5102
Cooking Your Own Groovy Builder: A Step Forward into Domain-Specific Languages
Andres Almiray; Ixchel Ruiz
Thursday , May 08
8:30 AM - 9:15 AM Intel General Session
Innovations through Software

 
9:30 AM - 10:30 AM TS-5686
New I/O APIs for the Java™ Platform
Alan Bateman
10:30 AM - 10:50 AM Break between sessions  
10:50 AM - 11:50 AM TS-5415
Java™ Servlet 3.0 API: What’s New and Exciting
Rajiv Mordani; Sridatta Viswanath
11:30 AM - 4:30 PM Thurdsay Pavilion Hours: 11:30 a.m. - 4:30 p.m.  
11:50 AM - 11:50 AM Lunch Served from 11:50 a.m. to 2:00 p.m.  
1:30 PM - 2:30 PM TS-5165
Programming with Functional Objects in Scala
Martin Odersky
2:30 PM - 2:50 PM Break between sessions  
2:50 PM - 3:50 PM TS-6457
Choosing Your Java™ Technology-Based Web Framework: A Comparison
Richard Pack; Stacey Schneider
3:50 PM - 4:10 PM Break between sessions  
4:10 PM - 5:10 PM TS-5596
Pimp My Build: 10 Ways to Make Your Build Rock

Conor MacNeill; Matt Quail
5:10 PM - 6:30 PM Evening Break  
5:30 PM - 6:15 PM Motorola General Session
Dial in, Drive Deep: Using Motorola's Platforms to Reach Consumer and Enterprise Markets
 
6:30 PM - 7:20 PM BOF-6362
LinkedIn: A Professional Social Network Built with Java™ Technologies and Agile Practices
Nick Dellamaggiore; Eishay Smith
8:30 PM - 9:20 PM BOF-5998
Meet the Java™ Posse
Tor Norbye; Dick Wall
Friday , May 09
8:30 AM - 10:30 AM Sun General Session
Extreme Innovation
 
10:50 AM - 11:50 AM TS-6391
Using Java™ Technology at the World’s Largest Web Site
Joshua Blatt; Dean Yu
11:50 AM - 12:10 PM Break between sessions  
11:50 AM - 11:50 AM Lunch Served from 11:50 a.m. to 2:00 p.m.  
12:10 PM - 1:10 PM TS-6658
GlassFish™ Project Web Services Stack “Metro”: Easy to Use, Robust, and High-Performance
Jitendra Kotamraju; Marek Potociar
1:10 PM - 1:30 PM Break between sessions  
1:30 PM - 2:30 PM TS-4883
Advanced Java™ NIO Technology-Based Applications Using the Grizzly Framework
Jean-François Arcand; Oleksiy Stashok
2:30 PM - 2:50 PM Break between sessions  
2:50 PM - 3:50 PM TS-5358
Detecting and Defending Against Security Vulnerabilities for Web 2.0 Applications
Barry AuYeung; Ray Lai
3:50 PM - 4:10 PM Break between sessions  
4:10 PM - 5:10 PM TS-5349
So Many Faces: Web 2.0 XD Experience with JavaServer™ Faces and JavaFX™ Technology, Flex, and Windows Presentation Foundation
Ray Lai; George Mount



About

Welcome to the weblog of Peter Maas. Here you'll find various posts related to stuff I like (like my kids and espresso) and stuff I do (like developing software).

JavaOne 2008 Pictures

IMG_4603 IMG_4595 Obie Fernandez IMG_6147 sander kijkt rond over de grachten Sjoerd met speer kikker (frog) IMG_4656.JPG IMG_4590 IMG_6128 Danielle op de bruggen van Beeld en Geluid sea_lion bridge Tim Bray introducing the (J)Ruby panel Sjoerd achter de computer Slippery Surface bee on yellow flower Charles Nutter on JRuby IMG_4708.JPG
View more photos >

Categories



Meld u aan voor PayPal en begin direct met het accepteren van creditcardbetalingen.