Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

AppFuse News: GlassFish, free demo hosting for java.net projects and Facelets

Some interesting news from the AppFuse world:

Posted in Java at Jan 30 2006, 09:06:35 AM MST Add a Comment

[DJUG] Real World Mapping and Holistic Testing

A few weeks ago (January 11th to be exact), I attended a Denver JUG meeting where Scott Davis spoke about Real World Mapping (download presentation) and Holistic Testing (download). Below are my notes from the event.

The first-generation mapping web application was MapQuest. Second generation mapping webapps include Google Maps (now renamed to Google Local) and MSN Virtual Earth (now renamed to Windows Live Local). The funny thing is MapQuest had sattelite images way back when, but they dropped it b/c no one was interested.

I like how googling for "msn virtual earth" brings up earth.google.com as the sponsored link at the top.

MapQuest - simple example from the oldest player in the map space. The URL of the query results gives us our first glimpse into building a custom application. For example:

http://www.mapquest.com/maps/map.adp?address=1600+Pennsylvania+Ave+Nw&city=Washington&state=DC

Is using MapQuest and building URLs on your site hacking? No - it might be considered hacking, but they encourage you to use it by publishing a howto. Once you're familiar with the basics, you can begin to customize the URL, for example:

Add a title: title=The+White House
Change the zoom level: zoom=9 (0-10, 0 == world)
Even use good ol' Latitude/Longitude: ?latlongtype=decimal&latitude&38(whitehouse)

Why use Lat/Long? While addresses are more user-friendly, lat/long coordinates are more precise. All map services must "geocode" addresses into lat/long anyway in order to show the location on the map.

Did you know that Google is a huge dictionary? Just use "define: geocode". So how do you find your Lat/Long? There are a couple of simple ways to geocode a street address for free:

  • Option #1: URL harvesting from http://maps.msn.com - when you submit an address, the resulting URL has the lat/long in it (in the "C" parameter)
  • Option #2: Use http://geocoder.us. Find the latitude & longitude of any US address - for free. The US Gov't provides the data, they just display it. If you want to use this in your application, you'll have to screen-scrape to get the data.

Geocoder.us also offers a web services interface - RESTful based on URLs. You query for address, it returns XML. There's also SOAP, XML-RPC and JSON interfaces.

RESTful Web Services: If your GET request returns XML instead of HTML, it is called a "RESTful Web Service". To use REST in Java, you can use the HttpClient package from Jakarta Commons.

Yahoo Maps

Yahoo! Maps offers the same level of hackability as MapQuest. The parameter names change, but remain conceptually identical. They use "mag" instead of "zoom", "addr" instead of "address", etc. One thing Yahoo! can do that MapQuest can't is allow you to display your own data on the map (more at http://developer.yahoo.net/maps/).

For example, the URL below displays cities on the NFJS tour:

http://api.maps.yahoo.com/Maps/V1/annotatedMaps?appid=nfjs_cities&xmlsrc=http://www.davisworld.org/nfjs.xml. Appid must be registered with Yahoo, but it is free and the process is fast. Xmlsrc is an XML file describing your map (most of the name/value GET parameters are pushed into XML...). Nice! The document linked to in Xmlsrc is actually an RSS feed.

Web 2.0

The Yahoo! Maps Web Service is getting very close to what the pundits are calling "Web 2.0". Tim O'Reilly calls it "Web 2.0," Jonathan Schwartz calls it "The Participation Age".

What is Web 2.0? The there are no hard and fast definitions, the same basic ideas come up over and over:

  • Favor interactive web applications over static/passive web pages
  • Favor data/web services over fixed presentation/HTML
  • Allow/encourage your content to be integrated into other applications

2/3rds of things bought and sold on eBay are done through web services - not through their web interface.

Google Maps

Google Maps does have Web 1.0 functionality, with query parameters. However, unlike Yahoo and MapQuest, the names of their parameters are only 1-digit. For example, z == "Zoom", t == "Type" (m=map, k=image, h=hybrid map/image). The reason it's called "k" for images is because Google bought Keyhole. It's now called Google Earth and and apparently the OS X version came out today.

Google also supports gazetteering - which are "natural language" queries. For example, you can search for "colorado rockies denver co" and it'll bring up a picture of Coors Field.

But what moves Googles aquarely into Web 2.0 territory is their Maps API. Using Ajax and Google's API, you can develop your own location-based services using Google Maps. To use Google's API, you have to singup for key, but then you become a JavaScript programmer.

Now Scott is showing some JavaScript - 2 lines of JavaScript code - 1 line of HTML to get a map. The bare-bones code will give you a map w/o controls - and you can programmatically add them. There's an API for adding overlays, and you can even control if the drop-shadow for the popup shows up. I wasn't aware the popup window shows a shadow on the underlying map - that's pretty cool. Finally, you can respond to user events by adding event listeners to the different user actions.

Google now has competition - MSN Virtual Earth now called Windows Live Live. There is a website devoted to using Microsoft's API, but looking at Scott's example - the Google API is much cleaner. Interestingly enough, it also works best in IE.

If you want to learn more about this stuff, I encourage you to checkout Scott's Google Maps API book.

In the "Main Event", Scott talked about a whirlwind of open-source testing tools, including: JUnit, Cobertura, Groovy, EasyMock, HttpUnit, DbUnit and JunitPerf.

Before this talk, I'd never heard of Cobertura, but I have used jcoverage and EMMA . After seeing talk, and seeing that Mike Clark endorses Corbertura, I should probably check out. However, since there's already a AppFuse + EMMA HowTo, maybe I should just stick with that.

The main benefit of unit testing is it facilitates change. Unit tests are a safety net. It simplifies integration - if you "trust" the individual pieces, then using them in the larger picture is much easier. Unit testing makes your code "self-documenting" - rather than relying on Word documentations that get stale immediately, unit tests are always an up-to-date reflection of the code base. Enforces a loosely-coupled architecture - because your code is being consumed by two different entities (unit tests and application), best practices naturally occur. For example, coding to interfaces instead of implementations.

At this point, I decided to stop taking notes. Thanks for the great talks Scott!

Posted in Java at Jan 27 2006, 08:12:38 AM MST 3 Comments

This week at Apache with Ted Husted

Ted Husted gives a nice review of what's happening at Apache with Struts and Roller. Pretty cool to see him offering Struts Training as well. I wonder if most Struts 1.x users will upgrade to Struts Action 2.0 (a.k.a. WebWork)?

Posted in Java at Jan 27 2006, 07:13:09 AM MST 1 Comment

Learn about WebWork 2.2 and Tapestry 4.0 via Podcasts

podcastI've said in the past that Podcasts are boring. I still think this is true for the most part, but that's largely because most of them aren't appealing to me. However, this week I've found a couple of good ones. Tapestry 4.0 and WebWork 2.2 have recently been released, and now you can listen to interviews with both project's primary developers: Patrick Lightbody of WebWork and Howard Lewis Ship of Tapestry/Hivemind. The easiest way I've found to subscribe and listen to podcasts is to download iTunes. You also may want to checkout The Java Podcasters article on ONJava.com.

I hope to upgrade both Equinox and AppFuse to these releases in the near future, I just need to find the time. I also hope to change the default web framework in AppFuse to Struts Action 2 as part of AppFuse 2.0. This will allow us to ditch Struts and WebWork and only support 4 web frameworks (SA2, Spring MVC, Tapestry and JSF).

Posted in Java at Jan 26 2006, 08:22:02 AM MST 4 Comments

Does JPOX suck?

There's an ongoing effort in Roller to migrate from Hibernate to JDO. Mostly, this is due to Apache's silly rule about no L/GPL dependencies - even if they're downloaded separately. I think this is a valiant effort, especially if JDO performs as well as Hibernate.

However, it was interesting to see the following message on the mailing list this morning:

i have experience using jdo, and jpox in particular, with a commercial product. first, you probably already know this, but jdo is dead (from a spec perspective anyway). it will be phased out in favor of ejb3 persistence. maybe that transition will be graceful, maybe not. i see jpox has ejb3 on their roadmap, but not sure what that means.

second, jpox has really, very atrocious performance issues. the jpox folks admit that performance is a low priority, as they are an ri. if someone wants the details on this, i can dig them up.

Interestingly enough, this message is from a Sun employee. It's interesting to hear someone from Sun say that "jdo is dead". What are you thoughts? Should Roller change their persistence backend just to satisfy Apache?

Of course, now you'll tell me your favorite Apache-licensed persistence framework and why it's worked so well for you. The real question is - are you willing to re-write Roller's backend using it? ;-)

Posted in Java at Jan 25 2006, 10:57:56 AM MST 31 Comments

Spring Workshops from Virtuas

I'm pleased to announce that my company, Virtuas, has decided to start offering public workshops for many prominent open source projects. These include Spring, Geronimo, Tomcat, Hibernate and JSF/MyFaces.

I'll be teaching the first Spring course in Denver February 21st - 24th, followed by one in Boston in mid-March. It should be a fun class, especially since I'm adding a bunch of stuff regarding Spring 2.0. Since I know you're going to ask the price -- and it's not posted on virtuas.com -- it's $2,495 per person for 1-4 people from the same company/group/etc., $1,995 per person for five or more people.

In other Virtuas news, we've recently signed partnership agreements with IBM and Covalent. We also re-worked our site with Andreas Viklund's "andreas08" theme from Open Source Web Design. Thanks to the power of Drupal, all we had to do to change the whole site was modify one PHP template and one CSS file. Thanks to both Andreas and Drupal for vastly simplifying our new look-n-feel.

Update: It looks like Andreas's theme has been made into a Drupal theme. Nice.

Posted in Java at Jan 24 2006, 05:06:14 PM MST 10 Comments

J3Unit

J3Unit Over the weekend, I learned about J3Unit - a new object oriented JavaScript testing framework.

J3Unit is an object-oriented unit testing framework for JavaScript. J3Unit runs JavaScript tests directly in the web browser and can be automated using JUnit and Jetty. J3Unit builds on previous work by JSUnit and Script.aculo.us to provide a better way to automate JavaScript unit tests. Object-oriented JavaScript unit tests are written using the Script.aculo.us Test.Unit.Runner object, which is in turn built upon the prototype JavaScript library.

J3Unit has 3 modes of operation: Static Mode, Local Browser Mode, and Remote Browser Mode

To me, this looks similar to Selenium. I'd definitely like to explore using this package or Selenium in AppFuse.

Currently, AppFuse uses Canoo WebTest, which is based on HtmlUnit. The current version of HtmlUnit doesn't support Prototype, or any libraries that depend on it. The good news is "This will be quite simple to fix".

Posted in Java at Jan 09 2006, 05:41:42 AM MST 2 Comments

AppFuse and Equinox get some FishEye lovin'

In addition to many other java.net projects, the Cenqua guys have been kind enough to add FishEye to both AppFuse and Equinox's CVS repositories. You can now view FishEye goodies using the URLs below:

Later today, I'll see if I can hack java.net's browse CVS page to show FishEye instead of java.net. Thanks Cenqua!

Update: The hack is complete. IE gives a security warning b/c FishEye is only available at http (not https), but it works fine in Firefox. If you'd like to put FishEye into an embedded iframe in your java.net project, here's the JavaScript I used to do it. View source on any of AppFuse's java.net pages for more information. The JavaScript goes in your www/project_tools.html page.

function fisheye() {
    if (document.getElementById("browsesource") != null) {
        var fisheyeDiv = document.createElement("div");
        fisheyeDiv.className="app";
        var header = document.createElement("div");
        header.className="h2";
        header.innerHTML = "<h2>Browse source code with FishEye</h2>";
        fisheyeDiv.appendChild(header);
        var fisheye = document.createElement("iframe");
        fisheye.setAttribute("src", "http://fisheye5.cenqua.com/viewrep/appfuse");
        fisheye.setAttribute("border", "0");
        fisheye.style.width="99%";
        fisheye.style.height="700px";
        fisheye.style.border="0";
        fisheye.style.marginTop="10px";
        fisheye.style.marginLeft="5px";
        fisheyeDiv.appendChild(fisheye);
        document.getElementById("dirlist").insertBefore(fisheyeDiv, document.getElementById("browsesource"));
    }
}

Related: Fixing your java.net project's homepage.

Posted in Java at Jan 07 2006, 09:28:06 AM MST Add a Comment

Improving the Maven Repository

Brett Porter provides a few steps on how you can help improve the Maven repository. My advice? Convert your project to use Maven 2 as an experiment. That's what I did with Equinox 1.5. In the process I found 28 issues with POMs at ibiblio. If you're using Ant, you can use Maven 2's Ant Tasks to download your dependencies w/o going "whole hog" and converting everything to M2.

Yes, this is a somewhat twisted attempt to convince you to endure the same pain I went through. The best and worst part of Maven 2 is its transitive dependencies. If they can all be updated to be accurate by the project owner's - the problem will be solved. But how do you convince project owner's to do that? I wonder how good Ivy's metadata is?

Why is this whole debate important to you? Because Ant 1.7 is (supposedly) going to have a dependency download mechanism. It's likely you'll use it because it is a nice convenience. Steve Loughran is one of Ant's primary developers and he has this to say:

I do find the m2 tasks and repository hard to work with, and am debating a quick investigation of Ivy. Maybe focusing on one thing -library management- has let them do a better job than trying to be all of a next generation build tool.

The "best dependency downloading tool" debate is heating up. I wonder which one will win Ant Developers over? If it's M2, I can see the Apache folks smiling. However, if it's Ivy - at least we'll know it's not a political decision. It's because it simply does a better job. May the best tool win.

NOTE: I've yet to try Ivy, and don't know if I will. Especially now that I've fixed all the POMs I use at ibiblio.

Posted in Java at Jan 05 2006, 08:12:43 PM MST 9 Comments

Vongo

It's not everyday that the project you've been working on gets announced all over the news (even locally!).

Vongo

It's been a fun project to work on - with some pretty cool technology powering it all.

Posted in Java at Jan 03 2006, 08:48:26 AM MST 27 Comments