Nelz's Blog

5 March 2010

Google App Engine in Maven + IntelliJ

Filed under: General — nelz9999 @ 13:33

At Widgetbox, I sometimes get to play around with interesting technologies that are outside of our regular stack. A couple of weeks ago, I was asked to use Google App Engine’s Java environment (GAE/J) to prototype a resizing image proxy.

At first, I just developed the prototype in the default GAE/J Eclipse environment until I could deliver a functional POC. After finding the GAE/J capabilities more than adequate for what we wanted to do, I was challenged to bring the project into our standard IntelliJ + Maven development environment. For the rest of this post, I’ll share a couple of tips and tricks for getting your GAE/J project to operate in this environment.

Basic POM File

There’s some funny business and frustration around the Maven community’s adoption of GAE/J, but I’ll skip that part of the story for right now. What I found is that the maven-gae-plugin project is the best place to go to for help Mavenizing a GAE/J build.

I have to say that it’s not ‘use the archetype’ easy (their archetype failed for me), but with a bit of elbow-grease and rummaging through their documentation I was able to get a decent and functional POM file built. Here it is (with some of our proprietary information scrubbed to protect innocent servers):

  1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  3   <modelVersion>4.0.0</modelVersion>
  4   <groupId>com.widgetbox</groupId>
  5   <artifactId>image-proxy-webapp</artifactId>
  6   <version>1.0-SNAPSHOT</version>
  7   <name>Widgetbox :: Image-Proxy :: Webapp</name>
  8   <packaging>war</packaging>
  9   <properties>
 10     <gae.version>1.3.0</gae.version>
 11     <gae.app.name>qa-image-proxy</gae.app.name>
 12   </properties>
 13   <dependencies>
 14     <dependency>
 15       <groupId>javax.jdo</groupId>
 16       <artifactId>jdo2-api</artifactId>
 17       <version>2.3-eb</version>
 18       <exclusions>
 19         <exclusion>
 20           <groupId>javax.transaction</groupId>
 21           <artifactId>transaction-api</artifactId>
 22         </exclusion>
 23       </exclusions>
 24     </dependency>
 25     <dependency>
 26       <groupId>javax.transaction</groupId>
 27       <artifactId>jta</artifactId>
 28       <version>1.1</version>
 29     </dependency>
 30     <dependency>
 31       <groupId>com.google.appengine.orm</groupId>
 32       <artifactId>datanucleus-appengine</artifactId>
 33       <version>1.0.4.1</version>
 34     </dependency>
 35     <dependency>
 36       <groupId>org.datanucleus</groupId>
 37       <artifactId>datanucleus-core</artifactId>
 38       <version>1.1.5</version>
 39       <exclusions>
 40         <exclusion>
 41           <groupId>javax.transaction</groupId>
 42           <artifactId>transaction-api</artifactId>
 43         </exclusion>
 44       </exclusions>
 45     </dependency>
 46     <dependency>
 47       <groupId>com.google.appengine</groupId>
 48       <artifactId>datanucleus-jpa</artifactId>
 49       <version>1.1.5</version>
 50       <scope>runtime</scope>
 51     </dependency>
 52     <dependency>
 53       <groupId>com.google.appengine</groupId>
 54       <artifactId>geronimo-jpa_3.0_spec</artifactId>
 55       <version>1.1.1</version>
 56       <scope>runtime</scope>
 57     </dependency>
 58     <dependency>
 59       <groupId>com.google.appengine</groupId>
 60       <artifactId>appengine-api-1.0-sdk</artifactId>
 61       <version>${gae.version}</version>
 62     </dependency>
 63   </dependencies>
 64   <build>
 65     <plugins>
 66       <plugin>
 67         <groupId>org.apache.maven.plugins</groupId>
 68         <artifactId>maven-compiler-plugin</artifactId>
 69         <version>2.0.2</version>
 70         <configuration>
 71           <source>1.6</source>
 72           <target>1.6</target>
 73         </configuration>
 74       </plugin>
 75       <plugin>
 76         <groupId>net.kindleit</groupId>
 77         <artifactId>maven-gae-plugin</artifactId>
 78         <version>0.5.3</version>
 79       </plugin>
 80       <plugin>
 81         <groupId>org.apache.maven.plugins</groupId>
 82         <artifactId>maven-war-plugin</artifactId>
 83         <version>2.1-beta-1</version>
 84         <configuration>
 85           <filters>
 86             <filter>${project.build.directory}/version.properties</filter>
 87           </filters>
 88           <webResources>
 89             <resource>
 90               <directory>src/main/external</directory>
 91               <targetPath>WEB-INF</targetPath>
 92               <filtering>true</filtering>
 93             </resource>
 94           </webResources>
 95         </configuration>
 96       </plugin>
 97       <plugin>
 98         <groupId>org.apache.maven.plugins</groupId>
 99         <artifactId>maven-antrun-plugin</artifactId>
100         <version>1.3</version>
101         <executions>
102           <execution>
103             <phase>compile</phase>
104             <configuration>
105               <tasks>
106                 <echo file="${project.build.directory}/version.properties">
107                     friendlyversion=${project.version}
108                 </echo>
109                 <replace file="${project.build.directory}/version.properties" token="." value="-"/>
110                 <replace file="${project.build.directory}/version.properties" token="SNAPSHOT" value="snapshot"/>
111               </tasks>
112             </configuration>
113             <goals>
114               <goal>run</goal>
115             </goals>
116           </execution>
117         </executions>
118       </plugin>
119     </plugins>
120   </build>
121   <repositories>
122     <repository>
123       <id>maven-gae-plugin-repo</id>
124       <name>maven-gae-plugin repository</name>
125       <url>http://maven-gae-plugin.googlecode.com/svn/repository</url>
126     </repository>
127   </repositories>
128   <pluginRepositories>
129     <pluginRepository>
130       <id>maven-gae-plugin-repo</id>
131       <name>maven-gae-plugin repository</name>
132       <url>http://maven-gae-plugin.googlecode.com/svn/repository</url>
133     </pluginRepository>
134   </pluginRepositories>
135 </project>

(FYI, we’re not actively using any datastore functionality just yet, so if you are going to use this template please forgive me if those dependencies are a little bit wonky.)

Since Google hasn’t (yet) decided to publish their development environment in a Maven-friendly way, there’s a bit of dependency wonkiness involved in getting the maven-gae-plugin to work. I included the repository information required by the plugin (lines 121 – 134), but if you use a repository manager (like Nexus), you’ll want to remove those lines from the POM and add a proxy for the maven-gae-plugin’s repository.

To get the development environment working the plugin also requires access to the unzipped SDK as packaged by Google. The plugin tries to help you set this up (“gae:unpack”) but that failed for me. I was able to get stuff working by manually unzipping the SDK artifact downloaded directly from Google to the following directory:

~/.m2/repository/com/google/appengine/appengine-java-sdk/1.3.0/appengine-java-sdk-1.3.0

Incremental Improvments

Initially, I had kept the appengine-web.xml within the WEB-INF directory, but I realized I could make our Release Manager’s life a bit easier if I added a bit of build-time substitution.

Here’s our appengine-web.xml:

<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
	<application>${gae.app.name}</application>
	<version>${friendlyversion}</version>
	<system-properties>
		<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
	</system-properties>
</appengine-web-app>

Directory Structure

And you’ll see that I put it into a new source directory called ‘external’:

At build time, I use the AntRun plugin (lines 97-118) to create a small file under the target directory that holds a ’sanitized’ version of the standard Maven version. (I.e. “1.0-SNAPSHOT” becomes GAE-friendly “1-0-snapshot”.) I then use the Maven filter functionality available in the WAR plugin (lines 80-96) to copy the appengine-web.xml into its proper directory with the version substituted in.

You’ll also notice in our appengine-web.xml that we substitute in our application name. By default this comes from the properties section of the pom.xml file (line 11). I did this because we’ve actually got 2 different applications up on GAE’s servers, the QA version and the Production version. By default we build using the QA server’s application name, but when our Release Manager is building to upload to Production, all that is needed is an additional command-line argument of “-Dgae.app.name=<prod-name>”.

Running, Debugging, and Deploying

The two most valuable targets that maven-gae-plugin provide are “gae:run” and “gae:debug”. These will assemble your code in the standard Maven webapp target directories and run your app. (Note: “gae:debug” didn’t actually work for me until the 0.5.3 version of the plugin.)

There is also a “gae:deploy” target that is supposed to invoke the Google-supplied shell script that will upload your application to the Google servers, but it failed for me several time. Since then, I’ve defaulted to using the shell script directly to deploy my app once it has been built:

~/.m2/repository/com/google/appengine/appengine-java-sdk/1.3.0/appengine-java-sdk-1.3.0/bin/appcfg.sh \
    update \
    ./target/myApp-1.0-SNAPSHOT

Results

So, this is how we got up and running with GAE/J in our standard development environment. Hopefully this post ends up helping people out to reduce their bootstrap time when evaluating/investigating GAE/J for their own uses.

11 February 2010

Interesting Blogging Coming Out of Twitter

Filed under: Links — nelz9999 @ 16:17

Why I Love Everything You Hate about Java“: It’s nice to see Java getting some love as a language.

The Anatomy of a Whale“: A nice write up on problem-finding and -solving within a large-scale operation.

21 January 2010

Embedded Job Posting?

Filed under: General — nelz9999 @ 12:43

So, I’m doing some stuff at work that has me looking at HTTP headers. As a reference, I looked at the feed URL for this blog, and I noticed the following header:

X-hacker: If you're reading this, you should visit automattic.com/jobs and apply to join the fun, mention this header.

I think this is a pretty cute and subtle way of looking for technically adept potential employees.

19 January 2010

More Maven Angst

Filed under: Java — nelz9999 @ 15:20

I don’t want to just jump on Maven-bashing bandwagon here, but a casual perusal of my previous posts will show that I talk about Maven a lot. This is going to be another one of those posts.

I’ve been starting to play with Google App Engine, both for personal projects and at work. Since most of my environments are Maven-based, I thought I’d go out and find a Maven Archetype or some kind of a POM file to bring these projects into my environment. I did find several blog posts trying to help: here, here, etc… The annoying thing you’ll notice on those blog posts is that Brian Fox ((formerly?) of Sonatype) posts a comment pointing towards Jason van Zyl’s post describing his efforts to Maven-ize the GAE SDK.

That would be all well and good if things had actually progressed. If you look at JvZ’s post, you’ll see he ends with “hopefully I’ll be able to get this out for Maven users by the end of the week!” What happens after that? Bupkis, nil, nothing, NADA!

There’s comments as late as Dec ‘09 expressing interest to use and/or help with the effort. But, there is NO RESPONSE from anyone at Sonatype.

I just find it galling that Sonatype would go on an all-out publicity spree talking people out of working on their own because JvZ himself was going to bring his skills to bear on the problem, only to completely fizzle out. I suspect the community at large would have been better off if those 4 or 5 early Maven + GAE adopters had continued on their own path, even if JvZ had succeeded.

Again: my patience with Maven/JvZ is waning. I’m eager to see what comes along next to take its place.

19 December 2009

Book Review: Apache Maven 2 Effective Implementation

Filed under: General — nelz9999 @ 15:04

A few months ago, I was approached by a representative from Packt Publishing to do a review of their book “Apache Maven 2 Effective Implementation”, presumably because of my frequent posts about Maven.

They gave me an electronic copy of the book to read, and asked for a 300 – 350 word review about the book. I’ve gotten it mostly to the point of ‘completion’, and any more changes would just fall under the category of ‘tinkering’.

Maven. I hate the word, as I hate hell, all Montagues, and MAKE.

Maven is a powerful Open Source build system which is becoming a de facto standard in Java development circles. Like any powerful tool, Maven has its own proponents and detractors, benefits and drawbacks. For example, one of the consistent issues that plagues the Maven ecosystem is a dearth of quality documentation.

When I heard about “Apache Maven 2 Effective Implementation”, I had hoped that it would be the One Book to rule them all, the One Book to find them, the One Book to bring them all and in the darkness bind them. Unfortunately, this is not that One Book.

“Apache Maven 2 Effective Implementation” is yet another effort by a Maven contributor to provide some clarity to Maven’s user community about how exactly to use Maven correctly. But much like the rest of the Maven documentation ecosystem, this book provides the type of documentation that only its author could love.

The author is obviously knowledgeable, however I can’t recommend this book as anything more than an incremental addition to the Maven user’s arsenal. Having been a Maven ‘believer’ since the late 1.x days, I would say that ALL the documentation I’ve seen on the subject has been no better than incremental. In most cases, like this one, the authors falls into a classical trap of technical documentation by explaining what to do, but rarely explaining why. (Nor, more importantly, explaining how to figure these things out for yourself).

I did find a few helpful tidbits of new information in the book. However, I’m not sure I would have been able to quickly find them again in a reference situation because the logical flow was all over the place. Example: Chapter 4 had ten pages of fundamental reporting information, which is great information to have; but maybe Chapter 5, which was titled “Reporting and Checks”, is where that information rightly should have resided.

Unlike some of the best technical books I’ve read, my ability to stay awake while reading this book was challenged because it is so very dry. I had no delusions of it being as compelling as the “Encyclopedia Galactica”, but the prose was completely wooden. This blandness and the previously mentioned problems render the book altogether forgettable.

I actually had a couple of people help me with the editing and/or proofreading of my review, and I’d like to thank Jennie-Sue, Eli, and Starchy for their offers of help.

If you haven’t noticed, I have ZERO advertising on my site. It only costs me a couple of bucks a year to keep this site going, and I didn’t want to spoil the relationship with my readers by trying to commodify their viewing. So, when I was approached to do the review, I was very specific that I would not pull any punches just because they gave me a free book. Packt also tried to sign me up with an affiliate link to the book, which you’ll notice is nowhere in this (or any) post.

As you can tell, I really didn’t use the kid gloves with this review. I’m not very happy with the general quality of Maven documentation (as I’ve noted before), and I wasn’t going to give this book high marks for being just as bad as the rest.

I did manage to sneak in (or are they clumsily manhandled?) 3 different literary fiction references, which I hope spices up the review and adds a bit of character. Let me know if you can name them.

27 October 2009

Motorcycle Diary

Filed under: General — nelz9999 @ 20:13

Scenic bike picture.As I mentioned in a previous post, I recently took a “where the wind blows me” vacation in France, and I’m gonna tell you about that wind.

I started out my trip in Bordeaux, where I found a pretty nice hotel to be my ‘base of operations’ whilst I tried to work out my motorcycle rental. I managed to find the website and then the physical location of Bordeaux Scooters, and this is where I rented the motorcycle for one whole week.

For the first day, I just rode around the city of Bordeaux a very little bit, trying to accustom myself to the Yamaha Fazer 650 (since I normally ride a Kawasaki Ninja 500).

On my first full day on the bike, I got out of Bordeaux and hit a bunch of secondary (C and D) roads. I hit places like Biscarosse(-en-Plage), Mimizan, and Léon, before I stopped for the night in Hasparren where I stayed at a cute Hôtes de Chambre (Bed & Breakfast). I was feeling pretty good and confident, both in my motorcycling ability and my language ability to operate in the hinterlands of France.

For my second day of riding, I figured I’d take some more scenic roads, and even cross over the Spanish border for a bit. I made it through the border just fine, and was cheerfully enjoying the nice big sweeping roads on the way to Elizondo, and then turned on the road towards Erratzu to make my way back into France near Saint-Etienne-de-Baïgorry.

It was just after a hairpin turn, not more than 1km from the French border and the summit of the hill. I noticed the old stone barn on the left side of the road, then I looked uphill and contemplated that I should be careful because of all the mountain mist that was probably making the road slippery. I brought my attention back to the road, and was alarmed to find that I had drifted close to the side of the road. I started to panic. I was so worried about the side of the road that I couldn’t look away, and motorcyclists know that’s exactly where I ended up.

Now that I was on the edge of the road, I made a snap decision to bite the bullet and take the bike off the road and try to stop before anything untoward happened. Something untoward happened. The mist I had been worrying about mere milliseconds before was coating the grass I was on and the front tire slipped sideways, dumping me and the bike onto our left sides.

I am lucky because I had just recently come out of a tight turn and I wasn’t going all that fast. I landed face down with my torso on the pavement, and did only about 1 1/2 horizontal pirouettes before I came to a rest. While the helmet I was wearing was scraping across the pavement, I remember thinking “Boy, a helmet is a really good idea!”

I was up in an instant, just in time to see that the hard case (holding most of my possessions) rolling down the hill. In my adrenaline-addled mind, I decided that I really needed to get my stuff back. So, I went careening down the side of the mountain in my full gear. I found the case 1 1/2 switchbacks down. I brought it up to the road (1 full switchback below the motorcycle) and only then did I decide to take off some of my gear and inspect for damage. Other than a little bit of scuffed up skin, I was actually fine.

As I was walking back up to inspect the bike, a younger French guy in a car stopped to give me a hand. He helped me turn the bike over, and point it away from downhill. He told me he expected insurance (assurance in French) could be found in any town, and that they’d have me set back up in no time. I thanked him for his help and advice, and sent him on his way, while I figured out what I needed to do.

After I got all my stuff assembled, and took a couple of pictures, I sat down and tried to call the rental shop. I ended up calling Ryan (in the U.K) for some research help because I didn’t know what the country-code is for France. After we got that figured out, I realized the rental shop was on their stated lunch break until 2PM. (It had just turned about 12:30PM.) I sat there for a bit trying to keep myself calm and counting my lucky stars. After I changed into some less-sweaty and warmer clothes, I decided that I should try to get to ‘civilization’, preferably on the French side of the border since the motorcycle was rented from France.

Eventually a nice (German?) couple on motorcycles stopped to give me a hand. We were formulating an elaborate me-plus-my-stuff-on-their-bikes plan, when I realized it was a bit soon for me to be riding on a motorcycle again. I got them to help me flag down a passing carpenter, who agreed to take me and my stuff in his truck to the mechanic’s in Saint-Etienne-de-Baïgorry. The local mechanic was of no help, other than trying to help me call the rental shop again, which I knew was still closed. After he basically told me to go away because he didn’t deal with motorcycles and he was on his lunch break, I walked towards town center and sat on the steps of a hotel/brasserie that was also closed for lunch. I decided to wait out the remaining hour or so until the rental shop opened up by chilling out and reading my Kindle on those steps.

Once I did get the rental shop on the phone, they told me that I needed to get the bike transported back to Bordeaux (250km) by whatever means necessary. The shop owner offered to see if he could find someone to do it, and I said I’d look around at my end. After our conversation, I had no idea if I would be stuck in the town of Saint-Etienne-de-Baïgorry overnight, but I figured I’d check into the hotel until things settled, and if I had to leave early, I could just lump one night’s charge.

As I was checking into Full-screenHotel Juantorena, I mentioned (or whined) to Mélanie (who I later found out was one of the owners) that I had just been in a motorcycle accident and needed to find a truck to bring the broken motorcycle back to Bordeaux. She said that her husband might be able to help me out. Bixente came out from the kitchen, and called around to some truck services in Biarritz, and found me a quote of €1,200. I thanked him and said I would call back to Bordeaux to see if the rental place had found me a better quote. The rental place said to call back in a couple of hours because the friend they were going to ask was out at the moment and it would be a while before they got an answer.

It turns out that Bixente is also a motorcyclist, and offered to take me (after he finished setting up his kitchen for the evening) to pick up the motorcycle on his motorcycle trailer to bring it down (the 10 km) to his hotel parking lot. I was kind of amazed at this, but just went with it after the day I was having. About a 1/2 hour later, after I had washed off some of my road rash, he called me down to the front of the hotel where he, his truck, and his motorcycle trailer were waiting for me. He drove me up to the crash spot where we loaded up the wreck, and brought it back to the hotel.

The ride up and back could have been horrible. But after figuring out my French skills needed just a bit of annunciation and a slower pace, Bixente actually took the time to get to know me. We had a really nice conversation, and I’ve come to look back upon that conversation as one of the nicest moments during my time in France.

After getting back to the hotel, I called the rental shop to tell them that the bike was now in the parking lot. In addition to the location of the bike, we had some (mis-)communication where I thought they said to wait several more hours to verify that the truck from Bordeaux would be interested in the job. So, I took a little nap, then read some more whilst having a beer in the bar. I was really surprised when Bixente told me the truck driver was at the other end of town and would be arriving soon. (Evidently, when I thought the rental shop was telling me that I was waiting for confirmation, they were actually telling me that I was waiting for the arrival of the truck.)

The truck driver, myself, and Bixente loaded up the bike into the truck. It was now about 8 or 9PM, and the driver hadn’t eaten, and neither had I, so we had dinner at the restaurant. The driver was kind of gruff, and not all that friendly, but I managed to get some small-talk in. After dinner, using Bixente as a patient go-between, we established that it was best if I went with the truck driver back to Bordeaux with the bike. (I didn’t realize there was more for me to do there.) So, I checked out of the hotel. I tried to convince Mélanie to keep my room charge, but she wouldn’t hear of it. She insisted that if I weren’t staying overnight they wouldn’t even think about keeping my money.

The driver brought be back to Bordeaux, and dropped me off at midnight at a hotel right near the rental shop. The next day, I went to the rental shop to find out that we were waiting for a verdict from the motorcycle repair shop. When I remembered that I hadn’t yet paid the driver from the evening before, the rental shop owner called him for the price. Since I was paying in cash for the truck ride, it only came out to €500, which is a great deal compared to the other quotes I had received.

Later that afternoon, the verdict came down that the bike’s frame was bent and therefore “totaled”. I went back over to the rental shop to sign the credit card slip for the €1800 security deposit that I had now forfeited. And thus ends my motorcycle adventure in France.

Looking Back

Now, people say all sorts of horrible things about the French. In general, I can tell you that much of this is wrong. In specific, I can tell you that Mélanie and Bixente are some of the warmest and most caring people I’ve ever run into in my travels. They took the time to patch up and help this stupid American with bad French and even worse motorcycle skills, and not ask for anything in exchange, other than an email greeting at some time in the future. I hugged Mélanie and Bixente fiercely, and I left their hotel with tears in my eyes because I felt really fortunate to have met these beautiful people.

I realize that I directly benefited from what I refer to as the Motorcyclist (a.k.a. Motard) Fraternity. Without knowing me, but because I spend time on two wheels like they spend time on two wheels, both the German couple and Bixente went way out of their ways to make sure I was taken care of. I guess it’s a similar thread amongst motorcyclists to help out your fellow motorcyclists.

Doing Them A Solid

In addition to adding Mélanie and Bixente to my Xmas card list, I have decided to send as many people as I can to them. So, if any of you readers are ever interested in a quaint village in the beautiful Basque region of France, might I suggest Hotel Juantorena? Also, spreading this info to motorcyclists far & wide would be much appreciated.

(I will try to scan in their pamphlet, but in the mean time, here’s their contact info:) t

Hotel Restaurant Juantorena

64430, Baigorry

Pyrénées-Atlantiques, Aquitaine, France

Lat/Long: 43.17405, -1.34875

Phone: 05 59 37 40 78

Email: hotel.juantorena@orange.fr

Their pamphlet shows that they have a website (http://www.hotelrestaurantjuantorena.fr) but it doesn’t seem to be working?

Widgetbox Rocks!

Filed under: General — nelz9999 @ 19:47

On a lark, I recently submitted a request to the Widgetbox HR person, Brittany, to see if I could get the company to allow me to attend the “Random Hacks of Kindness” event in mid-November. I was considering taking a PTO day, but I’m still at a negative balance after my recent European adventure, and I thought it’d be nice if I could get Widgetbox to support my efforts in what Brady Forest called a ‘Disaster Relief Code Jam’.

I was blown away today when I got an email from Brittany saying that not only will Widgetbox management support me in this endeavor, but they are going to add a 1 day per year allowance to our policies for all the employees to pursue similar efforts. Wow!

This just cements for me that I am totally working with the right set of people in a company that is just the right size for me. I feel appreciated, listened to, and respected, even when I bring forth crazy ideas like sending me off on our investors’ dime to save the world.

Yeah, my life: it doesn’t suck! :-D

20 October 2009

Precompile JSPs for Tomcat 6

Filed under: Java — nelz9999 @ 16:34

At the day job, we are working to upgrade our Tomcat from 5.5.X to 6.0.Y. The biggest problem I found when running our app against Tomcat 6 was that a bunch of JSPs used some quote escaping patterns that the later version of the compile considered to be syntax errors.

To get a feel for how many of these problems existed (after I just-in-time fixed the individual JSPs that crossed my path), the boss wanted me to run a precompile against our whole JSP codebase.

I found the instructions on the Tomcat site, which proved to be incomplete and/or incorrect (of course).

Here is what I ended up with:

<project name="Webapp Precompilation" default="all" basedir=".">
   <import file="${tomcat.home}/bin/catalina-tasks.xml"/>
   <target name="jspc">
       <jasper
             validateXml="false"
             uriroot="${webapp.path}"
             webXmlFragment="${webapp.path}/WEB-INF/generated_web.xml"
             outputDir="${webapp.path}/WEB-INF/src"
             compilerTargetVM="1.5"
             compilerSourceVM="1.5"
             failOnError="false" />
  </target>

  <target name="compile">
    <mkdir dir="${webapp.path}/WEB-INF/classes"/>
    <mkdir dir="${webapp.path}/WEB-INF/lib"/>
    <javac destdir="${webapp.path}/WEB-INF/classes"
           optimize="off"
           debug="on" failonerror="false"
           srcdir="${webapp.path}/WEB-INF/src"
           source="1.5"
           target="1.5"
           excludes="**/*.smap">
      <classpath>
        <pathelement location="${webapp.path}/WEB-INF/classes"/>
        <fileset dir="${webapp.path}/WEB-INF/lib">
          <include name="*.jar"/>
        </fileset>
        <pathelement location="${tomcat.home}/lib"/>
        <fileset dir="${tomcat.home}/lib">
          <include name="*.jar"/>
        </fileset>
        <fileset dir="${tomcat.home}/bin">
          <include name="*.jar"/>
        </fileset>
      </classpath>
      <include name="**" />
      <exclude name="tags/**" />
    </javac>
  </target>

  <target name="all" depends="jspc,compile"></target>

  <target name="cleanup">
        <delete>
        <fileset dir="${webapp.path}/WEB-INF/src"/>
        <fileset dir="${webapp.path}/WEB-INF/classes/org/apache/jsp"/>
        </delete>
  </target>
</project>

The real stroke of luck is this piece:

             compilerTargetVM="1.5"
             compilerSourceVM="1.5"

Their document said stuff about adding some parameters (source="1.5" target="1.5") to the “javac” target, but they neglected the “jasper” target. The error messages complained about the above two parameters being set to 1.4, so as an experiment I plugged them into the ANT target with 1.5’s and the compilation ran correctly!

Another word of note, the “showSuccess” directive did not work as their documentation states, but the “failOnError” directive does.

I hope this helps others!

26 September 2009

Facebook Connect: Nonconsensual Privacy Leak

Filed under: General — nelz9999 @ 17:57

The Problem

I do not like Facebook. I do not like it one bit. I want nothing to do with Facebook at all, and I’ve been very adamant about not signing up for an account despite the urging of everyone and their brother.

So, when I recently gained an understanding of how Facebook Connect works, I got a bit upset. Let me show you why with an example.

Let’s say I want to create an account at MapMyRun.com which implements Facebook Connect, I will use my primary email address of “nelz@example.xxx”. After my account gets created MapMyRun then encrypts my email address with a one-way hash, which for the sake of argument looks like “BIGBADHASH”, and sends this hash to Facebook. “So what?” you think. Sure, they can’t figure out anything about me from a single one-way-hash of my email address, right?

Well, then let’s say I register for an account at io9, again with my primary email address “nelz@example.xxx”. Since io9 also implements Facebook Connect, they also hash my email address and send it to Facebook. Guess what? The resulting string, “BIGBADHASH”, is the exact same as what MapMyRun just sent them.

Now, Facebook knows that someone with an email address that hashes to “BIGBADHASH” has an account on both MapMyRun and io9. Again you think “So what?” That one-way-hash protects my identity from being associated with any of these specific behaviors, right? Au contraire, mon frère.

Now one of my well-meaning friends, who doesn’t know how much I loathe Facebook, tells Facebook that they want to connect with someone at the address “nelz@example.com”.

This was the last piece of the puzzle that Facebook needed. Facebook need only apply the one-way-hash to the plaintext email that my friend just provided them with, and they get “BIGBADHASH”. Then, they look up in their database where they’ve seen that hash before, and now they know that a user with an email address of “nelz@example.com” has an account on both MapMyRun and io9.

Now I, who has never ever logged into Facebook, am getting tracked by Facebook whether I like it or not.

External Remediation

Okay. So what can we do about this?

I looked on Facebook.com, and I found a Privacy Policy. But everything on there requires that you have an account on Facebook. I guess I could create an account, then delete it, but I don’t want an account on Facebook! What Facebook really needs is some web form for non-members that says “Forget anything you have, or will, ever collect about email XYZ”. But, that’s not likely to happen.

What about the end-points, the sites that are implementing Facebook Connect? Personally, during their sign-up processes, I’d like to see a check box that says “Don’t sell me out to Facebook.” Again, that’s not likely to happen.

Personal Remediation

Now, don’t get me wrong, I’m not a n00b. I realize there are all sorts of sites tracking my footprints across the digital landscape every day. (Quantcast, DoubleClick, etc…) For most of them, if I were paranoid and technical enough I could purge their cookies or set up a proxy that doesn’t let my browser connect to those URLs.

But this Facebook thing is different, because it’s highly likely that the communication back to Facebook is not coming from my browser, but from the servers of sites like io9 and MapMyRun. And I have no way to stop it.

How about using a different email address for each site. Sure, that could work. If I had my own mail server, I could create “io9@nelzserver.xxx” for io9 and “mapmyrun@nelzserver.xxx” for MapMyRun, but how many people will have access or technical ability for something like that?

Gmail has a feature that could help out here. If I have an email address like “example@gmail.com”, I will still get the mail if it is sent to “example+io9@gmail.com” or “example+mapmyrun@gmail.com”. I found two challenges with this pattern: 1. it can break the “Forgot My Password” functionality if you forget what email you signed up with, and 2. emails with “+” in them don’t always pass the (incorrect) regex’s sites use to validate emails.

Conclusion

As I have said before, I am living life pretty openly on the internet. And like I said above, I know there are countless other companies doing much more specific tracking and profiling of me.

But Facebook’s hegemonic desires to run the internet frustrate me, and I don’t want to be a part of it. And it pisses me off that there’s nothing I can do to extract myself.

Update: Found this interesting blog post – “Dark Stalking on Facebook

21 September 2009

How To Rock In Life

Filed under: General — nelz9999 @ 18:50

Somewhere I found a link to this blog post: “How to Ensure Your Life is a Bull Run“. I found it amusing how they couched the whole conversation in financial market terms, but otherwise I really liked it, mostly just from a bullet-point list perspective.

So, here is the short version:

  1. Have Rocking Goals
  2. Be Ambitious
  3. Invest In Yourself
  4. Healthy Lifestyle
  5. Be Responsible
  6. Patience Is The key
  7. Never Give Up
  8. Learn From Failures
  9. Remain Positive
  10. Celebrate Success
Older Posts »

Blog at WordPress.com.