Oct 06

Ruby is trading in your wife for a younger model?

Ruby, Tech 4 Comments »

Ted thinks that Ruby is a love affair.

He is close. I can see how it is like trading in your middle-age wife for a new younger model. However, I don’t think that in this scenario many are going back to their original partners.

It is probably more like we sometimes have to go back to see the mothers of our children, but it is a chore. We are thinking about our new partner even while we are with our old one (which DOES mean that we are better lovers in the old bed which is good).

There are always going to be other young models trying to get your attention, and even the old models are trying to do extreme makeovers to get us back there.

Or, maybe these are just languages? :)

Oct 04

Java Install: First NetBeans, now Google Toolbar?

Google, Java, Tech 1 Comment »

How many times have I mistakenly clicks on the “JVM with NetBeans” link when trying to get the latest JRE onto a machine? More than I would like.

Now, I will have to watch out for the “JVM with Google Toolbar” link too? Are you kidding me?

Next we will have a “JVM with a MacDonalds Coupon” :)

I think it is great that Google and Sun are working together and all, but I look forward to an announcement of a real project that they worked on. This felt like a marketing project :) Google Office works ;)

Oct 04

Splashing around quickly with Mustang

Java, Tech 1 Comment »

Out of the corner of my eye I saw New Splash-Screen Functionality in Mustang, and how you can get a splash image up even BEFORE the JVM is started.

You can set a splash filename via:

java -splash:filename.gif SplashTest

or set it up in a jar manifest:

Manifest-Version: 1.0
Main-Class: SplashTest
SplashScreen-Image: filename.gif

And, of course you will often want to do more than just show an image, you may want to overlay a progress bar:

SplashScreen splash = SplashScreen.getSplashScreen();
Graphics2D g = (Graphics2D)splash.getGraphics();
Dimension size = splash.getDimension();
g.setComposite(AlphaComposite.Clear);
g.fillRect(0, 0, size.width, size.height);
g.setPaintMode();

I can’t wait to see the new splash images show up in Mustang based Java apps of the future :)

Oct 03

Apache Beehive 1.0

Java, Open Source, Tech, Web Frameworks 4 Comments »

It was great to see an email from Eddie O’Neil from BEA, announcing the Apache Beehive final 1.0 release.

I got to work on an Apache Beehive project, and was very impressed with certain parts and pieces. This may be a 1.0 release, but remember that it has been around for awhile in production projects such as Portal, and Workshop.

Nice work lads!

We are pleased to announce the v1.0 release of Apache Beehive!

This release provides the following major features:

  • NetUI (Page Flow + JSP tag library)
  • Controls framework
  • System controls for accessing JDBC, JMS, and EJB resources
  • Many bug fixes
  • Significantly enhanced documentation
  • Additional samples

Binary and source distributions can be downloaded via an Apache mirror from:

http://beehive.apache.org/releases/release-1.0.cgi

Documentation for v1.0 is here:

http://beehive.apache.org/docs/1.0

A few notes about this release:

* WSM and the web service control are not included as WSM has not passed the JSR 181 TCK yet. Both will be available in a subsequent release.
* v1.0 does not include XMLBeans due to licensing issues with the JSR
173 API JAR; however, XMLBeans can still be used with Beehive and is available from http://xmlbeans.apache.org
* Changes in v1.0 from v1.0m1 can be found here:
http://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&pid=10570&fixfor=12310123
* Thanks to everyone who submitted bug reports, patches, testing, and feedback. All of these contributed significantly to this release.
* Please send comments / questions about this release to [email protected] and development-related issues to [email protected]
* Bugs found in 1.0 should be filed in JIRA at http://issues.apache.org/jira/browse/BEEHIVE
* This version was built at SVN change 291405.

We welcome your feedback.

On to v.next…

The Beehive Team

Oct 02

LINQ 101 to Ruby 101 to Groovy 101

Groovy, Microsoft, Ruby, Tech 2 Comments »

Jon Udell posted some code that he was playing with to test out LINQ.

The code takes his blog format, and filters based on the XML, and some internal datastructures.

Then Sam Ruby ported it to Ruby.

For some reason I just ported it to Groovy:

def d = ["2005-09" : "September 2005", "2005-08" : "August 2005"]
def a = ["greasemonkey", "ajax"]

def rss = new XmlParser().parse("blog.xml")

def xml = new groovy.xml.MarkupBuilder(new PrintWriter(System.out))

rss.channel.item.findAll { item ->
d.keySet().any { day ->
t(item.date) =~ day;
} && a.any { tag ->
t(item.tags) =~ tag;
}
}.sort { x, y -> t(y.date) <=> t(x.date) }.each { i ->
xml.item() {
month(d[d.keySet().find { key -> t(i.date) =~ key }])
date(t(i.date))
title(t(i.title))
tags(t(i.tags))
}
}

def t(node) { return node[0]!=null ? node[0].text() : '' }

There are some uglies in there (especially the “node to text” pain), but I do prefer the native build syntax that we have in Ruby and Groovy, compared to nesting new XElement("item", ....). They could easily add more sugar to make that work on the .NET side of course.

The other interesting differences are that I didn’t use XPath in the Groovy version, and the lack of SQL like stuff. Here it is just method chaining. No need for a special orderby, you simply do a sort. Of course, the beauty of LINQ is its polymorphism across XML, SQL, etc etc.

Update: New Version

John Wilson took out his namespace aware XmlSlurper (to access dc:date vs. date), and a new builder syntax that handle multiple objects:

def d = ["2005-09" : "September 2005", "2005-08" : "August 2005"]
def a = ["greasemonkey", "ajax"]

System.out << new StreamingMarkupBuilder().bind {
mkp.declareNamespace(dc: "http://purl.org/dc/elements/1.1/")

new XmlSlurper().parseText(blog).channel.item.findAll {item ->
d.any{entry -> item.date.text() =~ entry.key} &&
a.any{entry -> item.tags.text() =~ entry}
}.list().sort{x, y -> y.date.text() <=> x.date.text()}.each {i ->
item([{month d.find{entry -> i.date.text() =~ entry.key}.value}, i.date, i.title, i.tags])
}
}