Rainy days and Java always get me down


I've Moved My Blog

It's currently located at http://www.urlinone.com/blog

I should say "I'm moving my blog." It's a pretty painful process.

Pebble has blown up on me, and it's been many months since I've been able to blog reliably. I've lost posts. And now I've got to figure out how to migrate my past blog posts from Pebble to my new destination without all the URLs changing, lest external links become 404 Not Founds.

Why does everything in the 21st century have to be a three-day project???

I have been looking for something for the past four or so years, and it turns out it was Tapestry! What's odd is that I first looked at Tapestry about sixteen months ago, but I had apparently not suffered enough at the time to recognize the relief that it offered.

Interestingly, Tapestry smells a lot like Spring (without the allergies). It's a dependency-injecting, aspect-oriented, proxy-building, clean and intuitive way to approach the web layer. It's the first web technology that has really felt right.

I'm feeling less JCranky! I think I might even be having fun again, although I can't really remember what that feels like.

Maybe it was the fact that I had just come off of nitrous oxide..., uh, because I had just had, uh, dental work, yeah, that's it, I had just had dental work, yeah, dental work! That's the ticket! Anyway, I would swear that Weird Al Yankovich came to the Atlanta Java Users Group meeting last week to talk about Tapestry. But that's probably just the nitrous talking.

In my susceptible state, Howard Lewis Ship convinced me that Tapestry was a very powerful web layer and superior alternative to Struts (not hard to convince me of that!), WebWork, Spring MVC, and all the other MVC frameworks now competing for our attention. I have to say, I think I agree. Tapestry takes a different approach from all the other MVC frameworks, and you end up with clean, succinct, and nice-looking code and web pages. I think I've found my presentation layer of choice -- at least until I start hunting for just the right RIA platform with which to drive myself nuts. Quick, where's that nitrous?!

Anyway, I was able to integrate Tapestry 3.0 into AppFuse 1.5, effectively tripling my version number to 4.5, which was quite a coup. Here's how I did it...

The first step is to add the tapestry jar to the classpath. To do this, you must copy the jar and edit two files.

1. Create directory Tapestry-3.0 under the lib directory.

2. Copy tapestry-3.0.jar into lib/Tapestry-3.0.

3. Edit lib/lib.properties, adding the following at the very bottom of the file:

#
# Tapestry - http://jakarta.apache.org/tapestry
#
tapestry.version = 3.0
tapestry.dir=${lib.dir}/Tapestry-${tapestry.version}

4. Edit properties.xml. Locate the line that says

<path id="web.compile.classpath">

5. Go down about 17 lines, and just before the line that says

</path>

add the following line:

    <fileset dir="${tapestry.dir}" includes="*.jar"/>

Now, all jar files in lib/Tapestry-3.0 will be part of the classpath when compiling the web module.

Next, we have to change the deployment descriptors to allow Tapestry's servlet to run and for certain URLs to reach it.

1. Add the following to the bottom of metadata/web/servlets.xml:

    <!-- Tapestry Servlet Configuration -->
    <servlet>
        <servlet-name>tapestry</servlet-name>
        <servlet-class>org.apache.tapestry.ApplicationServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>

2. Add the following to the bottom of metadata/web/servlet-mappings.xml:

    <!-- Tapestry Servlet Mapping -->
    <servlet-mapping>
        <servlet-name>tapestry</servlet-name>
        <url-pattern>*.htm</url-pattern>
    </servlet-mapping>

3. Add the following to the top of metadata/web/web-security.xml:

    <!-- Grant access to public areas -->
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>TapestryPages</web-resource-name>
            <description>Tapestry Pages</description>
	    <url-pattern>*.htm</url-pattern>              
            <http-method>POST</http-method>
            <http-method>GET</http-method>
        </web-resource-collection>
    
        <user-data-constraint>
            <transport-guarantee>NONE</transport-guarantee>
        </user-data-constraint>
    </security-constraint>

We've now added the Tapestry servlet, mapped all URLs with an .htm extension to it, and granted free access to these pages without having to be logged in via AppFuse's security model. Enabling security is outside the scope of this document.

Next, we'll add a simple Tapestry page to the application:

1. Create a file called Home.java in src/web/org/appfuse/webapp:

package org.appfuse.webapp;

import java.util.Date;
import org.apache.tapestry.html.BasePage;

public class Home extends BasePage {
	public Date getCurrentDate() {
		return new Date();
	}
}

2. Create a file called Home.html in web/WEB-INF:

<html>
<head>
<title>Simple</title>
</head>
<body>
<p>
   This application demonstrates some dynamic 
   behavior using Tapestry components.
<p>
   The current date and time is: 
   <b><span jwcid="insertDate">This Text Will Be Replaced</span></b>
<p>
   Click <a jwcid="refresh">here</a> to refresh.
</body>
</html>

3. Create a file called Home.page in web/WEB-INF:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE page-specification
      PUBLIC "-//Apache Software Foundation//Tapestry Specification 3.0//EN"
      "http://jakarta.apache.org/tapestry/dtd/Tapestry_3_0.dtd">

<page-specification 
	class="org.appfuse.webapp.Home">
    <description>Simple Home Page</description>

	<component id="insertDate" type="Insert">
		<binding name="value" expression="currentDate"/>
	</component>
	<component id="refresh" type="PageLink">
		<static-binding name="page">Home</static-binding>
	</component>
</page-specification>

If you read one of the many Tapestry tutorials, you will not have a difficult time understanding this exceedingly simple Tapestry page. I highly, highly recommend this free sample chapter from Tapestry in Action.

One note about Tapestry and accompanying jars:

I had to manually retrieve a couple of jars that I would have thought Tapestry would include automatically. Namely, I had to download and copy the jars for OGNL and Javassist, since Tapestry referred to them, but they were not included in the Tapestry install. Maybe it's a licensing thing? Anyway, I put all the jars in my $CATALINA_HOME/common/lib directory, rather than putting them into my AppFuse lib area. I guess either way will work, but who needs the monster war every time you build? But you do need the tapestry-3.0.jar in the web.compile.classpath to resolve external references.

Now, all you have to do is ant deploy start.tomcat, and your AppFuse project should be unchanged, other than the addition of the Tapestry page at http://localhost:8080/appfuse/Home.htm. You should be able to add a link to this URL within your Struts pages in AppFuse and jump back and forth, although I am sure that there are all kinds of ugly issues with session state once you start doing anything meaningful.

That's as far as I've gone with this, so there are probably plenty of issues to deal with in this mutant, hybrid environment. Matt Raible plans on adding a Tapestry version of AppFuse some time in late 2004, but this allows you to at least play with Tapestry today. Have fun, and feel free to post problems, suggestions, and enhancements!

One of the most disappointing moments of the Olympics for me was hearing Paul Hamm speak.

And then, when I heard Carly Patterson speak, my heart sank.

With both American gymnastics winning Olympic gold medals in their respective individual competitions, the scandal will be huge. Gymnasts use helium for a number of reasons:

  • It lightens the body to allow for seemingly effortless feats of strength.
  • It creates a sense of confidence and near-euphoria.
  • Its inert nature makes it virtually undetectable by standard Olympic drug-screening methods.

Sadly, there are a number of side effects:

  • In men and post-pubescent boys, the upper-body musculature tends to "balloon" as the tissues fill with lighter-than-air gas trapped within the body cavity that tries to rise, looking for a way out. This gives the look of broad, musculature shoulders.
  • In women and post-pubescent girls, this same ballooning occurs to a lesser extent, due to the breasts acting something like a pair of holding tanks. The nature of helium creates a characteristic "perkiness."
  • Shortness of stature is a side-effect of helium abuse. As the body tries to float up from the ground, the athlete reflexively creates a downward pressure with their muscles to hold themselves to the Earth. This internal pressure defeats the body's natural growth process and results in "helium height."
  • The characteristic high-pitched voice is a tell-tale sign of sustained helium use. As anyone who has ever sucked in the contents of a balloon and then spouted off a string of obscenities at a party where they've just been introduced to marijunana knows, helium makes the voice "so fucking funny."

This is an ugly blemish on the American Olympic team and the sport of gymnastics in general. When will athletes, coaches, and helium pushers realize that their selfish actions hurt us all?

  • What was wrong with the first George Bush, a truly decorated war hero? He flew 58 combat missions, was shot down by the Japanese, rescued by an American submarine, and awarded the Distinguished Flying Cross for bravery in action. Did you suddenly veteran-loving Democrats vote for the elder George Bush when you had the chance?
  • Why was Clinton the draft-dodger perfectly acceptable?
  • Why not pluck some other veteran out of the crowd and make him or her President? Are all veterans equally qualified to be President? Wouldn't a veteran of the Gulf War make a more compelling candidate? I'm sure you can find someone who fought in Kuwait and is now 45 years old. If that's your criteria for a President, why go with the guy who fought in Vietnam thirty-five years ago?
  • Why choose a veteran who then protested the war? I'm confused. Is being a veteran good, is being a war protester good, or do you have to be both?

I'm just amazed to hear the on-going discussion about Kerry's Vietnam experience, as if it's relevant. He just served as a Senator for nearly twenty years, and no one has anything to say about that??? You've got nothing to say about those recent 20 years of service as a United States Senator, but being in the Navy from 1966 to 1970 is what you think makes Kerry worthy of being elected President??? Would any of his Swift Boat buddies on the stage at the Democratic Convention be equally wonderful, given their years as veterans? If not, then let's hear about something else, other than his Vietnam war record!

With Clinton, you told us that a sexual indiscretion in the Oval Office doesn't matter, that lying under oath doesn't matter, and that dodging the draft didn't matter. Now, you've got a candidate that fought in Vietnam, and it's the most important thing about him. It seems to be the only thing about him!

58,000 Americans died in the war in Vietnam. Was every one of them a potential Presidential candidate? Since when does serving in the military make you Presidential material?!

The fact that you Democrats are hanging your hat on such tenuous, meaningless drivel as a war record from 35 years ago, and ignoring his more recent, more relevant history in the Senate, just makes me want to run the other way. At Kerry's own web site, it is easy to find detailed information about his four years of military service, but there is virtually no information about his twenty years in the Senate. There were tens of thousands of Vietnam veterans. There are one hundred United States Senators. Why would there be so much focus on Vietnam???

Don't any of you Bush-haters find anything troubling about this?

In case you were left wondering what score Japanese gymnast Hiroyuki Tomita got on his amazing final high bar routine, since NBC failed to announce it, he got a 9.850. It took some determined digging to find it, but I found it here.

A sincere thanks (not the sarcastic kind that NBC got ;) to all the gymnasts for an exciting night of amazing feats.

This content has been aggregated from another source. Read more...

A potentially effective strategy for dealing with terrorist threats is to let them know in advance how we will respond if they attack us again.

If we put the Muslim world on notice that an attack on American soil will result in five cruise missiles destroying the most holy sites in Mecca and Medina, it may be the one and only thing that could give terrorists pause.

These people don't care about their own lives or the lives of their own children, and they certainly don't care about the lives of non-Muslim civilians. They are barbarous murderers that cannot be reasoned with, negotiated with, or persuaded. The one thing they do understand, though, is destruction. That, and religious fervor.

Perhaps by combining the two things that their feeble brains are able to understand, it will make them less eager. If they know that their legacy will be the destruction of major Islamic holy sites, they might actually reconsider their attacks. I don't know of anything else that will sway them from their single-minded purpose.

If this is distasteful to you, as it is to me, consider the alternative. These people are not going to stop. They are not going away. They have been brainwashed into believing that everything that sucks about their miserable existence is due to America and Israel. It's a lot easier to believe that than to pull your miserable ass out of the muck and actually make something of yourself.

Good people don't want to do ugly things, but we face an enemy that is bent on our destruction and is not going to just go away. They are single-mindedly focused on destroying the western world. (Where the $%&@ is that going to leave them, when there is no one left to buy their oil, which is the only thing they've contributed to the world in over a thousand years? Oh, that's right, they are nostalgic for the days of the Stone Age.)

We're going to have to face the fact that this is a war in which the enemy has no qualms about either killing or dying. If we don't want to be burying lots of our own innocent citizens, we're going to have to accept burying lots and lots of terrorists. They are going to force us into this choice. As unpleasant as it is for us to deal with, it's not a difficult choice between the two.

How long are we going to try to be the good guys and take their abuse? How many more 9/11's will we have to endure before we say enough is enough and finally give them the ass-whooping they are so desperately in need of?

There is a point where civility ends and irrational behavior begins. Is it moral for us to let our children's future and our peace-loving way of life be threatened in the name of our so-called "goodness"? I say that is an immoral act of great arrogance. We are betraying all that we know to be good and right in the world to allow ourselves, our children, and the survival of our way of life be threatened by this evil! Shame on us for our equivocating on this matter. Is it an act of goodness to let evil overcome?!

Let's grant them their 72 virgins, thus making their dreams come true and making our children safe to grow up in a world of peace and creativity, rather than terror and destruction. Enough pussy-footing around these bastards. They don't respect it, and they certainly don't deserve it. It is nothing but weakness to them. They don't appreciate it or like us any better for it. It is our Achilles heel. Civilized behavior and fair play are lost on them. We do it at our own peril. Is it worth dying in an office building so that we don't do the "wrong" thing? Are our values not worth defending up-front, rather than as a response to an act of terror? It's not like their intentions are a mystery.

As horrific as the atom bombs on Japan were, they served to end a war that could have gone on for much longer. Previously Declared Retaliation. Let them know about the destruction they will bring on their own religious sites if they insist on attacking innocent Americans.

PDR. Not the Physician's Desk Reference, but just what the doctor ordered.