Monday, July 28, 2003

Late night... procrastination woes

finally someone agrees with me...late night. It was bound to happen sooner or later.

Perhaps the root of the problem is a bad case of procrastination
. Anyway thanks for the good, timely advice. I've been at the coffee shop 5 times in the last week for my late night work sessions.

Friday, July 25, 2003

Erik Hatcher and Andy Barton are awesome.

Erik Hatcher is awesome. He just reviewed a chapter I wrote on the Tiles Framework. I swear Erik is the busiest guy in software development, yet always seems to take time to help others.

It was a long chapter, about 40 pages, and he had comments all the way to the end of the chapter. He really took the time to review it.


Andy Barton just reviewed my Tiles chapter too. You Rock Andy! Thanks!

Tuesday, July 22, 2003

Driven by Demons

I just read this quote from Erik's blog.

From http://www.washingtonpost.com/wp-dyn/articles/A28471-2003Jun24.html:

"All writers are vain, selfish and lazy, and at the very bottom of their motives there lies a mystery," he wrote in 1947. "Writing a book is a horrible, exhausting struggle, like a long bout of some painful illness. One would never undertake such a thing if one were not driven on by some demon whom one can neither resist nor understand."

Wow... I could not agree more. (Except the lazy part....)
Most great authors were drunkards or druggies. I either have to quit writing or don an addiction. I guess I never be great.

Writing is a mental mind screw for sure. It is addictive and painful. Every time I write, I always wonder, will this be read, will this be liked, will it be helpful.... my usual self confidense gives way to doubt and fear of critisism.

July 23rd
11:35 PM

It's my third night at the coffee shop. I've reached a new level of sleep deprived creativity. Did I mention that I am tired? I am considering going home to sleep. I got the monkey off my back by finishing the thing I needed to finish last night. Now I need to work on the next thing.


2:00 AM

I am out of here. Can't focus. Can't continue. Caffiene not working....

Catching up after my "praternity leave"

11:36 AM

I am at the all night coffee shop again (it has been a month or so since I've been here). I seem to get the most work done from 9 PM to 3 AM. No one to bother me. No phone. No radio. No TV. No kids. No spouse. No email. No connection at the coffee shop means I wont cruise the Internet, read other people's blog, read technical articles, read email, read news groups, read postings, etc. and mistake it for getting something done. How do you keep up with it all?


Plenty of caffiene and my laptop means I will get a lot of work done tonight and this morning. I've already got a lot done. I can't wait to finish this project.

I wonder how much productivety is lost due to the Internet. I realize it increases the flow of information, but sometimes it seems like an overflow of information. I love and hate it at the same time. It is useful and a big distraction. God's gift and Satan's curse.

Blogs are funny, any tin horn technical dicator can pontifcate an opinion no matter how bad or how stupid (myself included of course). I love and hate blogs. I read some blogs this afternoon. I wish all blogs had a reply button. Given my tendency for distraction maybe its better that they don't. Technical pontification is the scurge of all that is good about blogs. On the other hand, I value blogs ability to give context to technology by getting people's opinions about various technolgies.

I now have an office in my garage. It has four walls and an air conditioner. (Air conditioner is a must in Arizona not a luxury.) All I need now is a espresso machine, small fridge (for milk), and a timer to turn off the Internet from 9 PM to 3 AM, and I will never go to the cofffee shop again.


Here I am writing my blog in notepad, because I am not connected. Apparently, if you try hard enough distractions can be found without the Internet. Excuse me while I go read the newspaper. LOL

I'll wrap this blog entry up at the end of the night.

.....

3:15 AM
The crowded coffee shop, now has just two customers left. The card players, socialites, college students have all came and gone. I didn't get as far as I wanted to (about 1/2 as far to be exact), but the project is moving in the right direction. I had to switch to green tea and bottled water after my first vanilla latte lest I spend more time in the restroom than writing. I am going home to get some shut eye.

Yes I realize email, phones and communication with the outside world is important, but sometimes all you need is a laptop and some peace and quiet.

Monday, July 21, 2003

EJB CMP CMR

Jason Carreira writes in his blog....
" I'm thinking of Entity EJBs here, but the same is true to some extent with JMS and JDO, where all of the really useful pieces for O/R mapping are optional. I accidentally insulted Rick Hightower Thursday night when he was talking about successfully using Entity Beans in a project by saying that his domain model must have been simple…. Sorry about that. What I meant was that a reasonably sized project couldn't use Entity beans successfully without using vendor extensions, and in fact he was. "

First, it was on purpose. :)
Second, I was not offended my skin is pretty thick.
Third, the same arguments can be made against JDO or any other OR mapping solution.
Fourth, I have ported EJB CMP CMR applications to more than one vendors solution.
Fifth, At the time EJB CMP CMR was available, and JDO was not.
Sixth, I am going to try Hibernate on my next green field application.

Jason put your picture in your blog. I can't remember who was who.

Wednesday, July 16, 2003

The reason I changed the title of my blog....


" Announcing Rick Hightower 2.0......




His name is Richard Matthew Lucas Hightower Jr. We are going to call him Lucas.....

(I know... I know.... "Luke I am your father..... Use the force Luke")





Wednesday, July 09, 2003

What skills are marketable

I did a search of Dice to see which skills got the most hits.....

Java 3365
Perl 989
Python 58
Ruby 5
C 2659
C# 500
Struts 162
WebWork 3
WebLogic 554
WebSphere 770
Tomcat 132
Resin 7
Orion 1
SQL 4082
Oracle 3671
JBoss 43
TogetherSoft 20
Eclipse 17
JBuilder 66
WSAD 67
Web Services 1388
JSP 673
ASP.Net 12
EJB 3365
Velocity 37
Ant 74
XDoclet 3
SOAP 207
PORTAL 761
Tapestry 6


The surprise here is how little ASP.Net gets compared to JSP. Now this is not scientific (as if)..... just because Struts gets more hits than WebWork does not mean it is better.... it just means it is a more marketable skill (I suppose). EJB (bitter or not) is still very marketable (more so than JSP).

Monday, July 07, 2003

Bitter EJB and extreme sports

I've been reading Bitter EJB in my spare time.
Amazon.com: Books: Bitter EJB

This is a very thought provoking book. I am about 1/2 done with it. I can already recommend it to all those that will be doing or are thinking about doing EJB development.

Every chapter starts with a short story about the author(s) endeavors in extreme sports.

At first, I found the short stories distracting. As I continued to read the book, I found that they are a nice break from the material that are easily ignored if I choose not to read them.

I am not much of an extreme sports advocate, if I wrote a book like this.... the chapters would start more like this....

"It was a Sunday night, and it was my turn to do the dishes. I know I had to mentally prepare.... "

or

"I was sitting on the couch watching TV. I wanted to change the channel, but this would require looking for the remote... I ended up watching three hours of infomercials instead of finding the remote."

Actually, I did go snowboarding once.... my posterior hurts just thinking about it. My idea of an extreme sport is walking around the block with my kids or playing wiffle ball with my son and daughter. After reading this book, I just might put air into my mountain bike tires and ride around.

Wednesday, July 02, 2003

Observation about Tiles and sharing attributes from tile layout to tile

Observation about Tiles.

When inserting one tile into a page layout tile, The tile that is getting inserted into the page layout tile does not share the variables of the page layout tile scope. They each get there own tile scope.

Thus if the page layout tile is passed a title attribute that title attribute is not passed to the tile (e.g., header.jsp) that dispalys the header. In order to pass the variable to the header.jsp. I must use the tiles:put.

This is because the tiles:insert creates a new component context for the inserted tile (I checked the code and create a debug util to prove this). Thus there is a one to one relationship between component contexts and tiles. (Component context = tile scope for the tile).

The tiles:put allows me to put variable from various scopes if I leave the scope blank it searches all scopes including tile scope (i.e., component context).

Thus to move a variable from a page layout to a tile I would do this:

<tiles:insert attribute="header" ignore="true">
<tiles:put name="title" beanName="title"/>
</tiles:insert>

Random thoughts

Random thoughts

Interesting comments on IOC. It is worth reading if you are new to IOC.

Google Toolbar Installed

Google Toolbar Installed
Google Toolbar Installed

I just installed the Google Toolbar... now I can blog about sites that I visit... even quicker.

Debugging Util for Struts apps

I've been having this nasty little problem. I created a utility to print out various scopes in my app, e.g., tile, page, session, request, application.

I think I have written this same utility several times over the years.....

Here it is..... (maybe I wont loose it this time)....


/*
* Created on Jul 2, 2003
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package util;

import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;

import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.JspException;

import org.apache.struts.taglib.tiles.ComponentConstants;
import org.apache.struts.tiles.ComponentContext;

import java.io.IOException;

/**
* @author rhightower
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class DebugUtil {


public static void listScope(PageContext context, int scope) throws JspException, IOException{
JspWriter out = context.getOut();
switch (scope){
case PageContext.PAGE_SCOPE :
out.println("--- Page Attributes ---
");
break;
case PageContext.REQUEST_SCOPE :
out.println("--- Request Attributes ---
");
break;
case PageContext.SESSION_SCOPE :
out.println("--- SESSION Attributes ---
");
break;
case PageContext.APPLICATION_SCOPE :
out.println("--- APPLICATION Attributes ---
");
break;
}

Enumeration enums = context.getAttributeNamesInScope(scope);
while(enums.hasMoreElements()){
String name = (String)enums.nextElement();
Object value = context.getAttribute(name, scope);
printNameValueType(name, value, out);
}


out.println("---------------------------
");

}

private static void printNameValueType(String name, Object value, JspWriter out) throws IOException{
out.println(name + " = " + value
+ " type (" + value.getClass().getName()+ ") " +
"

");

}

public static void listParameters(PageContext context)throws JspException, IOException{
JspWriter out = context.getOut();
Map map = context.getRequest().getParameterMap();
Iterator iter = map.entrySet().iterator();

out.println("--- Request Parameters ---
");
while (iter.hasNext()){
Map.Entry next = (Map.Entry) iter.next();
if (next.getValue() instanceof String){
out.println(next.getKey() + " = " + next.getValue() + "

");
}
else if (next.getValue() instanceof String[]){
StringBuffer buf = new StringBuffer(100);
String[] values = (String[])next.getValue();
buf.append("{");
for (int index = 0; index < values.length; index++){
buf.append(values[index]);
buf.append(",");
}
buf.append("}");
out.println(next.getKey() + " = " + buf.toString() + "

");
}

}
out.println("--------------------------
");
}

public static void listTileScope(PageContext context) throws JspException, IOException {
JspWriter out = context.getOut();
ComponentContext compContext = (ComponentContext)context.getAttribute( ComponentConstants.COMPONENT_CONTEXT, PageContext.REQUEST_SCOPE);
out.println("--- TILE Attributes ---
");


if (compContext!=null){

Iterator iter = compContext.getAttributeNames();
while(iter.hasNext()){
String name = (String)iter.next();
Object value = compContext.getAttribute(name);
printNameValueType(name, value, out);
}
}else{
out.println("--- TILE Attributes NOT FOUND ---
");
}


out.println("---------------------------
");

}

public static void debug(PageContext context) throws JspException, IOException{
JspWriter out = context.getOut();
out.println("
--------------------------
");
out.println("---------D----------------
");
out.println("----------E---------------
");
out.println("-----------B--------------
");
out.println("------------U-------------
");
out.println("-------------G------------
");
out.println("--------------------------
");

listTileScope(context);

listScope(context, PageContext.PAGE_SCOPE);
listScope(context, PageContext.REQUEST_SCOPE);
listScope(context, PageContext.SESSION_SCOPE);
listScope(context, PageContext.APPLICATION_SCOPE);


listParameters(context);

}

}

Eratta for XDoclet tutorial

Thanks for lanuching the new tutorial....

I noticed some errors as follows: (If you send me the latest source, I can make the changes.)


FIRST ERROR:

On the about this tutorial, What is XDoclet page (page 1 of 4)


3rd paragraph last sentence.... it states
This tutorial focuses on using existing templates that ship with XDoclet.

This is incorrect.... it should read as follows

Unlike the last tutorial on XDoclet this tutorial does not focus on using existing templates that ship with XDoclet. Instead in this tutorial, you will create your own custom templates and XDoclet subtasks.


2ND ERROR

Simple template to introduce XDoclet: Servlet XDoclet example (page 1 of 1)
Servlet XDoclet example
should read
Simple XDoclet tempalte example


3RD ERROR

First Template: XDoclet Architecture : Servet XDoclet example

"Servlet XDoclet example" should read "Running Simple XDoclet template example"


4th ERROR

Page 3 of 7 Under Case Study 2nd try: Subclass xdoclet.XmlSubTask

The {0} will be replaces with the name of the current class. Therefore you are going to use a new template that just outputs one class at a time.

should read

The {0} will be replaced with the name of the current class. Therefore you are going to use a new template that just outputs one class at a time.

Developing your own templates and subtask with XDoclet

Developing your own templates and subtask with XDoclet



XDoclet tutorial: Creating your own templates and subtask


This tutorial shows J2EE developers how to use XDoclet to write their own custom templates and subtask. It steps you through three examples. Unlike the last tutorial on XDoclet this tutorial does not focus on using existing templates that ship with XDoclet. Instead in this tutorial, you will create your own custom templates and a XDoclet subtask.

The first example is a very simple example to show how to use XDoclet. The second example shows how to create an Axis Web Service deployment descriptor (WSDD) with just the templating constructs, and how to run this with Ant. The third example show developers how to create their own custom subtask, and refactors the template fore the WSDD with best practices in mind. By the end of this tutorial you will be able to write your own custom XDoclet templates and subtasks. And you will understand when to pass something as an attribute of a subtask and when to put the parameter as a XJavaDoc tag in your source.


----------------------------------


This tutorial shows J2EE developers how to use XDoclet to write their own custom templates and subtask. It steps you through three examples.

The first example is a very simple example to show how to use XDoclet. The second example shows how to create an Axis Web Service deployment descriptor with just the templating constructs, and how to run this with Ant. The third example show developers how to create their own custom subtask, and refactors the template with best practices in mind. By the end of this tutorial you will be able to write your own custom templates and subtasks. And you will understand when to pass something as an attribute of a subtask and when to put the parameter as a XJavaDoc tag in your source.

XDoclet enables simplified continuous integration and refactoring with component-oriented development using attribute-oriented programming. XDoclet allows you to radically reduce development time, by generating deployment descriptors and support code, allowing you to focus on application logic code. Not only can you use the plethora of templates that ship with XDoclet, but you can create your own. In addition you can create a subtask to pass in custom configuration parameters that you do not want to show up in the source files.

XDoclet facilitates automated deployment descriptor generation. XDoclet, a code generation utility, allows you to tack on metadata to language features like classes, methods, and fields using what looks like JavaDoc tags. Then it uses that extra metadata to generate related files like deployment descriptor and source code. This concept has been coined attribute-oriented programming (not to be confused with aspect-oriented programming, the other AOP).

XDoclet generates these related files by parsing your source files similar to the way the JavaDoc engine parses your source to create JavaDoc documentation. In fact, earlier versions of XDoclet relied on JavaDoc. XDoclet, like JavaDoc, not only has access to these extra metadata that you tacked on in the form of JavaDoc tags to your code, but also access to the structure of your source, that is, packages, classes, methods, and fields. It then applies this hierarchy tree of data to templates. It uses all of this and templates that you can define to generate what would otherwise be monotonous support files.

XDoclet ships an Ant task that enables you to create web.xml files, ejb-jar.xml files, and much more. In this tutorial, you will use XDoclet to generate a Web application deployment descriptor with the webdoclet Ant task. In addition you will generate EJB support files. Note that XDoclet Ant tasks do not ship with the standard distribution of Ant. You will need to download the XDoclet Ant tasks from http://xdoclet.sourceforge.net.

So you may wonder: "Why should I care? I am an excellent Java/J2EE Web developer and I have never needed XDoclet". Or you may say: "I already use XDoclet, why do I need to write my own templates?" As I stated before, you don't know what you are missing. Once you start use XDoclet, you will not stop. Once you start writing your own templates you will never repeat yourself again. If you are writing dry, mundane code, then you could probably use XDoclet instead. Allow XDoclet to generate the monotonous stuff, and stick to writing the good stuff. Computers were invented to do monotonous stuff to free humans to do creative things. XDoclet frees developers from monotonous code. XDoclet is the missing piece in your J2EE and Web service development process. It will speed your development. You must master how to use XDoclet templates.


XDoclet tutorial: Creating your own templates and subtask

Tuesday, July 01, 2003

Struts vs. WebWork?

WebWork



I just read through Mikes (mike@atlassian.com) slides comparing Struts and WebWork from the ServerSide Symposium. I am going to get this book as soon as it comes out.... (he one of the authors)


Java Open Source Programming : with XDoclet, JUnit, WebWork, Hibernate (Java Open Source Library)
by Joseph Walnes (Author), Ara Abrahamian (Author), Mike Cannon-Brookes (Author), Patrick Lightbody (Author)





WebOgnl

WebOGNL


I just spoke to Drew Davidson. He is fired up about WebOgnl. Drew is the creator of OGNL which gets used by Tapestry and WebWork. He said that he has rewritten some applications in various frameworks and has noticed a sharp reduction in LOC (lines of code) when using WebOgnl. He is sending me some sample code. As I mentioned before, Drew lives right here in good old Tucson. He is the fastest, smartest developer that I have ever worked with, and I have worked with some really good developers over the years. He is like a power of nature when he develops. He knows everything. And, he is a really big dude. He looks like a professional linebacker (football, american).

WebOgnl is still missing good documentation. Hopefully, it will come out really soon. BTW Ognl is pronounced OGG-NULL. We got in to some debate a the serverside.com symposium on the correct pronounciation of Ognl. I ended the debate with "well that is not how Drew pronounces it". My only claim to fame.... the correct pronounciation of Ognl.

Hibernate

Hibernate


My next project will try Hibernate, an open source OR mapping for Java. I just downloaded the 111 page user guide. Hibernate embraces the fact that it is doing OR mapping, and provides many granular features that are essential to doing OR mapping. Unlike EJB 2.0 and JDO which also do OR mappings, but don't specify how it should be implemented or what types of mappings the implementations must implement. OR mappings standards without the OR mapping in the specification just does not make sense to me anymore. The possible weaknesses of Hiberante is it not standards base (this could also be considered a bonus: read the above comments). Another weakness is Hibernates support for caching not working in a clustered environment.