apply plugin:'war'
apply plugin:'jetty'
sourceSets {
main {
java {
srcDir 'src'
}
}
}
war {
from 'war'
}
jettyRun{
webAppSourceDirectory = new File('war')
}
Tuesday, July 13, 2010
AppEngine and Gradle
I have a project that was initiallly created using Eclipse and the Google Eclipse plugin. This creates a project structure where the web resources go in /war and the java resources go in /src. What I would like to be a be able to do is execute gradle build or gradle jettyRun and execute the web app from the command line. Here are the modifications that I had to make to get this to work.
Saturday, July 10, 2010
Google Sitebricks
I just need to take a few minutes to talk about this. I have really started to love Google Guice the lightweight dependency injection framework. The next question was how to use Guice and some web technologies to build the simplest website with some basic capabilities.
Enter Google sitebricks. I selected sitebricks the other day while working on a report problem in another application. Today I selected it again and included it in the maven pom.xml for a project. After grabbing the dependencies I was a little turned off by how much was brought down. After all I like to think of myself as a minimalist. So off I went to find something even smaller and simpler. I even went back to using plain old JSPs, which would be a good option but I am too lazy to find the TLD's hidden amongst the piles of JSP garbage on the Internet. During this process I even revisited an old friend Wicket. I almost through the switch on using Wicket when I saw how much configuration went into the web.xml to use Guice. Forget that. Something didn't feel right.
So I went back to my last project where I used sitebricks and started looking for what was really required. The first thing was to toss maven out and use Gradle. I set the new project up with the same build.gradle used in my last project with a few less configurations and I was ready to see how small I could make things.
The good news is that I didn't need all those jars brought down initially by Maven.
Summary
google-sitebricks 200kb
google-guice2 650kb
google-guice-servlet 28kb
mvel 680kb
For around 1.5MB (Floppy size) I can start developing and can't wait to show how simple it really is to develop a Java backed page.
To see now go to sitebricks.
Thursday, July 8, 2010
Roo Investigations (Part 1)
This is the first post on a series of post that I plan on making. Roo is a new productivity product from SpringSource. Why do they need another rapid application development tool? I am not totally sure but that is one of the reason's I have started looking into it. One thing I have learned over the past few years is that the folks at SpringSource know what they are doing. When the rest of the industry was going nuts over J2EE Rod Johnson was making stuff work.
What initially brought me back to look at Roo again is the fact that Bruce Johnson the lead developer for GWT (Google Web Toolkit) and Ben Alex the creator of Roo was on stage at the Google IO keynote this year and announced a partnership between the two teams. Well I am already sold on GWT for building RIA style applications and this meant I needed to pull up the Roo home page and give it a second look.
The point that I want to make today is that the whole download of Roo is around 5MB. That is impressive. I checked the Grails download and it sits around 41MB. For someone that likes to keep there code lean and mean as possible this is very cool!
A little closer look at the spring-roo distribution reveals that they are using Apache Felix for their platform. From my 10 seconds of research on Felix it looks like an OSGi container.
The last thing of note for me about Roo is the fact that the samples come as scripts that get executed in the shell. The shell actually generates the applications on the fly. I like the fact that you can potentially write a script that will generate scaffolding for the application and the application itself. I know, I know grails create-app... but that only creates a default application and then you need to run additional commands to create domains, controllers, views, etc... granted that can all be in a single .bat or .sh but that is not the standard procedure for Grails. Roo is designed to handle this kind of generation and provides commands for creating the fields and restraints.
Loving the tab completion too!
Thursday, July 1, 2010
Chrome features
Google's new browser Chrome, or not so new now, has some great features that I have just started to explore. Pinning tabs. While I had seen folks do this I had never really thought much about it. Well today there are several windows that I keep open all the time. Gmail happens to be one of them. Why take up the full amount of tab room for something that is always there and I don't need to think about it. So if you right click on the tab and select Pin it will shrink the tab down and stack it nicely off to one side. Very cool.


Then for the next level of coolness is the Gmail extension for Chrome that allows you to turn on Desktop notification. That is one feature of Outlook that I tend to like because it helps me respond promptly to important messages. Now my Gmail can have those features too.


Chrome is a crazy fast, extremely cool browser. Thanks Google!
Creating Unix scripts with Groovy
I ran across a need to write some scripts that could run on my Mac or any Linux box. I don't regularly keep up with Groovy changes but last night I ran across this article and thought it was very cool. I know very little about writing Unix shell scripts but I have been playing in Groovy and Java for a long time. So the fact that I can create a Unix like script but in Groovy makes me very happy.
Name your file something like "project" and execute a chmod +x project. You are now good to go and can execute the Groovy code by typing ./project. Any parameters that are passed to this file will be passed to the Groovy script using the implicit args parameter.
#!/usr/bin/env groovy
println("Hello world")
for (a in this.args) {
println("Argument: " + a)
}
Name your file something like "project" and execute a chmod +x project. You are now good to go and can execute the Groovy code by typing ./project. Any parameters that are passed to this file will be passed to the Groovy script using the implicit args parameter.
Wednesday, June 30, 2010
Open Wonderland
Just wanted to take a few minutes to blog about the virtual world I learned about yesterday through the FLOSS weekly podcast, Open Wonderland. I am not a gamer and I have never spent more then 5 minutes of my day thinking about games or gaming technology. On the other hand, having worked for a virtual company for several years, I find myself intrigued with the possibility of being able to create virtual 3D work environments. As I am told you can do in the popular online game Second Life, you can create an avatar and maps for your workday encounters. It seems very real and there are dynamics that can only be captured by recreating this type of environment or meeting in person. The latter can be rather expensive and time consuming.
I spent 30 minutes yesterday evening and was able to get a small environment setup using Open Wonderland. This will definitely stay on the list of things to investigate. One idea would be to create an AMI with the Open Wonderland server pre-installed and ready to use. Then by executing a command a virtual workplace could be brought online. The attendees would receive a link to the workplace which would launch a Java Webstart application to provide them with entrance.
Several things I haven't looked into yet, sound, land-line connections, and video chat.
I spent 30 minutes yesterday evening and was able to get a small environment setup using Open Wonderland. This will definitely stay on the list of things to investigate. One idea would be to create an AMI with the Open Wonderland server pre-installed and ready to use. Then by executing a command a virtual workplace could be brought online. The attendees would receive a link to the workplace which would launch a Java Webstart application to provide them with entrance.
Several things I haven't looked into yet, sound, land-line connections, and video chat.
Friday, June 11, 2010
Java Date Parsing down to the millisecond
Today I ran into a problem where a String needed to be converted into a java.util.Date. The String looked like this:
So the code to parse the date was originally written like this:
The problem was that the value printed out was several minutes ahead, 9:10 instead of 8:27. The problem turns out to be that the date parsing format does not allow more then 3 values of "S" in the milliseconds placeholder.
Solution
Strip off the last 3 zeros and change the parse pattern to
String date = "16MAR2010:09:08:27.126000";
So the code to parse the date was originally written like this:
String date = "16MAR2010:09:08:27.126000";
SimpleDateFormat format = new SimpleDateFormat("ddMMMyyyy:HH:mm:ss.SSSSSS");
Date value = format.parse(date);
System.out.println(value);
The problem was that the value printed out was several minutes ahead, 9:10 instead of 8:27. The problem turns out to be that the date parsing format does not allow more then 3 values of "S" in the milliseconds placeholder.
Solution
Strip off the last 3 zeros and change the parse pattern to
SimpleDateFormat format = new SimpleDateFormat("ddMMMyyyy:HH:mm:ss.SSS");
Subscribe to:
Posts (Atom)