Friday, December 28, 2007

How to set the License for a project in Netbeans 6.0

To set the project license on a per project basis, you need to set a property called project.license to the value of the license you want to use. For example: If I want to use the Apache 2.0 license, I need to set the property to project.license=apache20. This is accomplished by opening the project files and going to the nbproject directory. You will see a file called, double click on it to edit it.

You then add the line to the of the properties and save. Any java source files created now will contain the Apache 2.0 license.

* Copyright 2007 John Yeary.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* express or implied.
* See the License for the specific language governing
* permissions and limitations under the License.
* under the License.

How to set the Default License in Netbeans 6.0

To set the default license on Netbeans 6.0 for ALL projects go to Tools --> Templates and expand the Licenses tree. Select the Default License and Open in Editor.

You may then modify the default license to meet your needs.

<#if licenseFirst??>

${licensePrefix}To change this template, choose Tools | Templates
${licensePrefix}and open the template in the editor.
<#if licenseLast??>

Note: You must add ${licensePrefix} to each line you wish to add.

<#if licenseFirst??>

${licensePrefix} Copyright ${date?date?string("yyyy")} ${user}.
<#if licenseLast??>

This version sets the copyright to the current date and the name to the ${user} property. If you need to modify the ${user} property please see How to set @author or ${user} properties in Netbeans 6.0 templates

How to set @author or ${user} properties in Netbeans 6.0 templates

This is a simple task in Netbeans 5.5, but not obvious in Netbeans 6.0. To set the ${user} variable in templates in Netbeans 6.0, you must go to Tools --> Templates. This will bring up the Template Manager screen. Scroll to the section called User Configuration Properties and expand it. You will see a template called

Select the and Open in Editor. Uncomment the line user and set it to the appropriate value and then save the file.

Now when you create a new Java source file, the javadoc @author will be set to the new property. This same method is used to set other properties in your templates as well.

Thursday, December 20, 2007

Pragmatic Logging

After reading the book Release It! I decided to write a quick extension to the Java Logging framework from the JDK. I called it PragmaticLogging. It is a Netbeans 6.0 project. I have released it under the Apache 2.0 License.

The idea was to provide a simple extension to the JDK which would make logging easier for developers and administrators.

There is another zipped Netbeans project called PragmaticLoggingExample which will use the Pragmatic Logging framework to generate some example logging output.

The project is completely documented (If you see something missing... leave a comment).

If you have any suggestions/enhancements please post a comment and I will see about updating the framework.

Saturday, December 15, 2007

Release It! Review

I just completed reading Release It! by Michael T. Nyggard (Pragmatic Bookshelf 2007). It is part of The Pragmatic Programmers series. I have read the book cover to cover twice. At first, I thought that the book was just another book on how to manage projects. So What! The ideas presented in the book were common sense. I have been doing these same things for many years.

Then one day I was working on a project, and was trying to figure out how to handle a problem. I remembered what I read in Release It! about the topic. I grabbed the book off the bookshelf and looked it up; logging. The ideas presented are common sense, but how often have we missed to boat. The ideas presented in the book I implemented much to my own joy. The result was a customized deployment of the Java Logging system which is simple to maintain and does not require external libraries.

It was at that point I realized the brilliance of the book and the pragmatic side of things. I re-read the book. As an architect, project manager, developer, and maintainer of complex software ecosystems, the ideas in the book provide a "pragmatic" common sense approach to handling situations. The book is a learning tool, one person's personal perspective on software design and deployment, and a reference. It is an all-in-one book.

This book provides a great tutorial on how to manage complex projects for the novice, and a gentle practical reminder to the seasoned architect/project manager.

The book is divided into 4 major sections: Stability, Capacity, General Design Issues, and Operations. The first two sections provide the basis for the remainder of the book. The Stability and Capacity sections have divided the topic into an explanation, followed by general design patterns and anti-patterns. It explains in enough detail how to implement good patterns and recognize bad ones.

The section on General Design covers items like Administration and Security. There is nothing earth shattering in these sections, but they do provide a basis for a "check list" of items to make sure you consider in your designs.

The final section on Operations is the one where you will make friends with your administrators and keep your sanity. The portions on designing for monitoring including logging will be your savior at 2:00 AM in the middle of a blizzard. The discussion on designing for the future does not get enough attention in our modern get it out the door now world. This may be the push you need to think about it.

This is a book to have on your bookshelf. Mine is full of tabs and post-it notes.