Skip navigation
kfarnham

Just Push Play Blog

Posted by kfarnham Feb 28, 2007

Two Java mini-conferences next week

At some point this week, I need to deal with packing for next week's Java Posse Roundup open space conference in Crested Butte, Colorado. The Posse has set "Java off the server" as their perferred topic and although and open-space conference could go whatever way the participants choose to take it, my expectation is that we'll get some interesting people shining a light on the user-facing side of Java, on the desktop, on the small device, on the phone, etc. A couple longtime friends will be there, including java.net blogger Joshua Marinacci and GWT in Practiceco-author Robert Cooper. I'm looking forward to digging into the topic of Java Media with Posse member Dick Wall, as we both have a long-standing and obvious interest in this topic. And Josh says he has a surprise for us.

And that's not the only GUI-oriented conference next week. On Thursday and Friday, the Wyndham San Jose will be the spot for Desktop Matters, the "Conference for Java Desktop Application Developers". Its list of prominent Java GUI expert speakers includes Chet Haase, Romain Guy, Kirill Grouchnikov and Ben Galbraith. Registration is still open for both conferences, by the way.

Maybe it's a bit unfortunate that these two desktop-skewing conferences are the same week, and thereby in an inadvertent competition for speakers and attendees, but on the other hand, the idea of multiple conferences sprouting up on this topic is itself an encouraging sign.


Speaking of Joshua

kfarnham

Safety Last! Blog

Posted by kfarnham Feb 27, 2007

I think I've been talking up QuickTime and Java in ways that seem to have confused people. Just the other week, the Java Posse talked about "that stuff that Chris Adamson did", and I'm like "oh crap, did they just say I wrote QuickTime for Java?"

The Freshman

Soooo... let's reset. Let's go way back. Way way back. We're talking "first season of The Simpsons" back. 1990, when Apple released QuickTime 1.0, a System Extension providing dynamic media capabilities to Macs running System 7 (and, to a lesser degree, to those on 6.0.8). Like most stuff at the time, this framework was, and continues to be, written in and called by procedural-C.

The term "QuickTime" is also associated with the file format and with provided applications such as the "QuickTime Player", but for the purposes of this blog, we're only interested in the multimedia framework.

During the 90's, Apple launched a couple of companies in collaboration with IBM. One of them was Kaleida Labs, which created an object-oriented, garbage-collected computing platform. Unfortunately, instead of creating Java, they created ScriptX. And I can tell by your puzzled reactions that you've never heard of it. In fact, according to Owen Linzmayer's Apple Confidential 2.0, the Kaleida misadventure resulted in only two pieces of software that could be used in the Classic Mac OS: some Unicode text classes, and QuickTime for Java.

The General

QuickTime for Java provided something that the original, ever-expanding QuickTime library didn't: an object-oriented interface. This made it fairly appealing in the late 1990's, when for a time it seemed like everybody was going to rewrite their applications in Java. Apple was apparently worried that existing QuickTime developers would not only change languages, but possibly media frameworks as well. There's a "Summary of QuickTime for Java" -- I cited it in my QTJ book, but it has disappeared from Apple's site in the intervening years -- that basically spells out Apple's motivation as wanting to continue to provide access to QuickTime, even if developers didn't use C anymore. It even had gentle introductions to Java concepts like object-orientation and garbage collection, while assuming prior knowledge of hard-core QuickTime concepts like reference movies and updating resources. In other words "we'll help you with Java, if you must go that way, but please keep using QuickTime".

The result was that Java developers had, on Mac and Windows anyways, a powerful (if hard-to-use and poorly-documented) media framework, the only one that ever gave Java developers significant creative capabilities like editing.

Problem is, QTJ was a pretty massive effort -- by class count, it is about as large as Java 1.1 -- and that made maintenance difficult. Furthermore, the mass defection to Java as a desktop platform didn't happen (or happened and was quickly reversed), so application developers ended up continuing to write native Mac and Windows apps and use the native libraries. In time, Apple lost interest in QTJ. They managed to break it in 2003 when they moved their Mac OS X Java implementation from Carbon to Cocoa, and fixed it with a radically new version six months later, and that's about the last time they put in a lot of work on QTJ.

Our Hospitality

A lot of people still like QTJ, and have wanted to do more with it. In 2006, I started the Lloyd project. The plan was to do what Apple wasn't doing: continue QTJ development, by writing open-source Java wrappers to procedural-C API's that hadn't been exposed as QTJ classes. I started working on some metadata stuff that was introduced in QuickTime 7. I also wanted to provide an on-screen preview component for video cameras, a feature that had been in earlier versions of QTJ but not after the big breakage of 2003, particularly given that an all-Java method of doing so was posted to thequicktime-java list. I showed off both of these at JavaOne 2006. And I really didn't do much else with it -- I never even attempted to get the native code working as a Windows DLL -- because I was really slammed editing both java.net and ONJava, and trying to do some programming on the side.

You see, at that time, I was also working on a QTJ application for Veldhiezen Group, who were looking for a simple "capture and go" type application. Their chief interest was an interesting feature, the ability to compress at capture time, rather than capturing uncompressed and then do a separate compression step. This necessitated working on the capture preview component and working through a lot of fascinating bugs, including handling changes to the camera settings (if you're expecting pixels in one format, and the format changes, you'll either render garbage or blow out a pixel buffer), dealing with some undocumented threading craziness on windows that was causing deadlocks, catching a bug that mangled the captured audio, etc. My plan was to put what I'd learned about capture previews back into Lloyd.

But in getting help from Apple, they weren't crazy about the idea. At first I thought it was that they thought I was drawing too heavily on not-for-public-consumption code, but it was more than that. They were concerned about leading too many people to base their apps on QTJ because if you hadn't noticed the lack of interest in QTJ over the previous three years, or its heavy dependence on deprecated native libraries like QuickDraw, the point was obvious: QTJ is no longer being actively developed, and depending on a heading-towards-obsolescence library is a Bad Idea.

Sherlock, Jr.

"OK," I'm thinking, "QTJ is breathing its last, and the existing alternatives all suck, so now what are we supposed to do?"

It turns out that I had taken a look at QTKit, the new Cocoa-friendly, object-oriented API for media programming on the Mac. Initially, it seemed at most a pleasant diversion, but Apple has been talking it up more and more in the last year or so. For example, their Leopard Overviewnotes that QTKit will be the only way to write 64-bit QuickTime applications... the straight-C API will remain 32-bit only.

Well, that's interesting, I thought. And it got me thinking... there's almost 20 years of legacy code in QuickTime, some of which surely supports features that are either deprecated (the old Image Compression Manager that can't handle bi-directional codecs like H.264) or just quietly elided in Apple marketing (anyone remember wired sprites?). Someday, Apple will want to get rid of all that stuff, but without breaking anybody's apps, or QuickTime itself. So what if they created a simpler wrapper framework, got most people to move over to that, and then changed the framework so instead of wrapping QuickTime, it would be a concrete implementation of its features? Total conjecture, but I think QTKit might be part of a massive, decade-ish-long plan to migrate QuickTime over to Cocoa, eventually abandoning the legacy code instead of modernizing it. Obviously, if that's the case, then there are interesting implications (what becomes of QuickTime for Windows or QTJ? how much of the existing functionality will developers demand be migrated to QTKit?), and it'll be worth watching.

Feet First

But at any rate, there's this modern, object-oriented media API, the apparent future of Apple's media API's... and you can't call it from Java. Well, that sounds like a straightforward to-do. How hard could it be to write some JNI code to map Java objects to Objective-C objects?

As it turns out, pretty hard if you don't have a comfort level with Objective-C. But at least I've got the ball rolling... enough to put some code out there in the Keaton project. Keaton is a Java wrapper to QTKit, in pretty much the same way and for the same reasons that QTJ existed to allow Java apps to use QuickTime.

Don't get your hopes up yet; I've only barely started. I've made it far enough to know that it works and is practical. Specifically, I have two classes with one or two meaningful methods each, just enough to allow you to create a QTMovie object from ajava.net.URL and render it with aQTMovieViewComponent AWT object. This is what the TestQTMovieViewComponent class does:

    System.out.println ("Creating movie for URL: " + u);
    QTMovie movie = new QTMovie (u);
    System.out.println ("Created movie");

    // set movie on the view
    qtmvc.setMovie (movie);
    System.out.println ("Set movie on view");

Here's what the test app looks like, with movies loaded into both its windows:

keaton-test-02-27-07.png

The code is extremely primitive at this point, with lots of logging messages and no Obj-C memory management whatsoever. I also crashed trying to open some multi-GB DV files. But the idea works, the whole thing builds with Ant (the .jnilib is even a "universal binary"), and I'm pretty confident that the rest of the QTKit API can be wrapped pretty much with the basic ideas in these classes. Now it's just a matter of taking the time to do so.

Go West

But what does it accomplish? After all, Keaton will only run on Mac, since that's the only platform QTKit exists on. Well, for me, it's an opportunity to get deeper into QTKit and broaden my understanding of media frameworks in general. It might also be useful for developers putting together media apps who need a Mac solution... lots of times, we're forced to use an "isolation layer" approach, in which you put up an API with interfaces for the functionality you need on all platforms, and then back that up with platform-specific implementations you load at runtime (I think ION does this, using both JMF and QTJ and whatever else it can find). It's not an ideal solution, but people have been waiting 10 years for an ideal solution to Java multimedia, and it's obviously not coming, so we need to do what we can with what we've got.

OK, so there's my brain-dump about what I've been playing with media-wise. Thanks for indulging me. Check back in a few months and I might have something worth trying out.

kfarnham

Walk This Way Blog

Posted by kfarnham Feb 27, 2007

Limits on mobile apps?

My editorial standards are such that I'm not willing to put on the front page stories that seem to be based entirely on rumor, second-hand information, innuendo and insult... but that doesn't mean I won't blog about them if they're interesting and have at least a kernel of truth to them. In this case, it's a post on GearLog, also noted by Slashdot, that T-Mobile in the U.S. has changed policy and blocked network access to third-party mobile applications. This means that top-tier, world class Java ME apps like Opera Mini, Google Maps for Mobile, and GMail Mobileno longer have any meaningful functionality for T-Mobile customers. Even if you're paying six bucks a month for the data plan.

I was kind of wondering why Google Maps didn't work for me when I tried it on Friday, or why Opera Mini was kicking up network errors on Saturday.

Well, in my case, I guess I'll be canceling my data plan later today (I'm not going to pay T-Mobile just to use the crappy built-in WAP browser), and looking to change carriers once my contract ends. But it would be interesting to know if there is any other kind of pressure that could be brought to bear, as many ME apps are rendered useless without network access. Maybe the device manufacturers, or Sun itself, could put in an angry phone call or two to T-Mobile management?

Are you an ME enthusiast caught by this apparent change of policies at T-Mobile? What do you think could or should be done about it?


Speaking of mobile apps, Motorola is sponsoring a contest for Java ME game developers, and the grand prize is a publishing contract. As noted in Java Today, the MOTODEV Game Developer Challenge calls on developers to submit "a hot new unpublished title for the ultra-slim MOTOKRZR K1 running the Java software platform." The deadline is August 10, 2007, and games will be judged on "uniqueness, fun factor, design, operation and innovation in visual arts and audio."

Among the most significant new JDK 6 features are improvements to Swing and related client-side Java APIs. In Artima's Chet Haase Interview: The State of Swing, Sun Java Client Group architect Chet Haase discusses how performance gains, new APIs, and closer integration with the native desktop help developers write more appealing and better performing Swing applications.

dev2dev recently published an article by Drew Varner offering some Guidelines for Writing JSR-168 Portlets. "JSR-168 is a collection of Java APIs for portlet developers. There are a number of reasons to design JSR-168 portlets that adhere to the specification. Portability is an obvious benefit. Code written according to the specification will be easier to move to among portal servers. The majority of Java-based portal servers support JSR-168 portlets"


The latest Feature Article,ColdFusion for JSP Developers, makes the case for a somewhat surprising and atypical EE webapp integration. Still, ColdFusion has been around long enough, and in different forms, that it's easy to not see it for what it is. In this article, Kola Oyedeji looks at how this long-lived scripting language has been adapted to integrate into the world of Java EE.


Kohsuke

...and that's why I'm putting 75 buttons in my GUI

Apropos of nothing on the front page, but just because it's spectacularly bad, check out the GUI presented in Worse Than Failure's Classic WTF - Enter the Matrix.

By my count, this GUI has 75 buttons, and I may have missed some. Throw in four lists of various sizes, six popup menus, eleven drop-down menus, a dozen or so text fields, two text areas... hey, maybe if we're lucky, some of those buttons are effectively tabs and we can turn up more inscrutable controls.

On the one hand, there's a theory from the field of cognitive psychology that since human short term memory can contain 7 plus-or-minus 2 objects, you don't want to have more than five related items in one meaningful block of screenspace. But the other theory that seems to be more a product of habit or emulation than science is this idea that a GUI needs to have all its functionality graphically represented on screen at all times, perhaps because users wouldn't know it's there otherwise. This is the only thing I can think of to justify the trend in Office suites to have 5-10 toolbars of 10-20 widgets each. It's a doomed effort, because many of these actions don't lend themselves well to a visual representation -- images are well suited to showing things, not abstract actions -- and doing so in the space of a 16x16 icon is madness epitomized.

But I know the real-world considerations that lead to this kind of monstrosity. After all, nobody creates a screamingly crappy GUI like this on purpose. When I worked for Worthless Piece of Crap Wireless Software Company #1, our president spelled out his vision for our GUI in remarkable detail -- seven tabs to represent the major areas of functionality, each split three to five ways with JSplitPanes, with dockable tear-off windows, multiple rows of toolbars, complete madness. All for a glorified XML editor.

Oh yeah, we got merged and laid off en masse before seriously trying to write that monstrosity. A very Dilbert experience, in retrospect...


On the other hand, there's nothing wrong with trying to improve the appearance of a well-conceived GUI. That's what Simon

kfarnham

You Better Get It Blog

Posted by kfarnham Feb 22, 2007

Can you code without your favorite tools?

Kathy Sierra has a set of scenarios that might strike you as familiar:

It's lunchtime at the cafe and you give the cashier a $20 bill for an $8 purchase. She gives you $32.78 in change. You mention the mistake. She says, "But that's what the cash register says I owe you." She can't cope with the cognitive dissonance between reality and What The Machine Said. Later that day you get a frantic call from a co-worker--a recent addition to the programming team. "I keep getting this error message that it can't find the classes I'm using!" You ask, "By 'it' do you mean the compiler?" He answers "I don't know. I'm using an IDE." That night, you're helping your 12-year old son with his math homework when you realize--in horror--that while he's quite good with the calculator, he couldn't multiply two three-digit numbers using only paper and pencil if his Wii depended on it. These tools were designed to make us more efficient, so that we can focus on something more important than the tedious task of, say, giving change, organizing source code, and doing calculations. But are they helpful timesavers, or are we dumbing ourselves--and our users--down?

Kathy makes a call for tranparency, for tools to not hide what they're doing but rather make it more manageable. An IDE, for example, could offer an "understanding mode", which would allow the user to ask the tool what it's doing and why. She also calls on teachers to make students do things "the old-fashioned way" before introducing complexity-hiding tools, such as making developers write their first few apps with simple text editors and compiling on the command line instead of using IDE's.

Gregg

kfarnham

You Got What It Takes Blog

Posted by kfarnham Feb 22, 2007

If you can paint it, you can have it

One of the most beloved aspects of Swing is its infinite customizability. When presenting a JavaOne session on our Swing book, Josh Marinacci and I stuck to the catch-phrase "if you can paint it, you can have it." Actually, that's half the story -- the other half is "if you can model it, you can have it." Still, the point remains: if you can model some behavior with code, and use the various AWT, Swing, Java2D or even JOGL API's to put pixels into a Graphics2D, then you can create more or less anything.

It takes some prodding to get people past the built-in suite of Swing components. There's an "aha" moment when the young Swing developer figures out that while there's no canned tree-table component, a JTree can be wired to aJTable in various simple ways, using selection event listeners in the tree to drive changes in the table model. For the more ambitious, there's always Aerith as an extreme example of what's possible.

To get you on the road to customized Swing components, Substance creator Kirill Grouchnikov offers Feature Articletoday on How to Write a Custom Swing Component. By way of example, he takes a new component concept introduced by Windows Vista and shows how to use Swing -- and in some cases re-use what it already gives you -- to achieve the same thing in Java:

This article will illustrate the process of creating a custom component that is based on the new view slider from Microsoft Windows Vista OS Explorer (see Figure 1). While this component looks very much like a slider embedded in a pop-up menu, it has new features that are not available on a regular JSlider. First, it has control points that have associated icons and labels. In addition, while some ranges are contiguous (like Small Icons-Medium Icons) and allow continuous resizing of the file icons, other ranges are discrete (like Tiles-Details). When the value is in one of these ranges, the slider thumb can be only at control points, and not inside the range.

Have a look, open your mind to what's possible, and go have some fun with Swing.


There's a remarkable accolade to note in Java Today. The Canadian Broadcasting Corporation reportsthat James Gosling has been awarded Canada's highest civilian honor, the Order of Canada. The Order of Canada recognizes outstanding lifetime achievement and contributions to society and the country by Canadians from all walks of life. Gosling is one of 29 Canadians named Officers of the Order of Canada and will receive his insignia later in 2007.

Milestone 7 of NetBeans 6.0 (Dev) is now available for download. There is also an alternative way of installing M7 -- using NBI , the new NetBeans installation concept. M7 via NBI is available from the NBI page. Milestone 7 comes with many new features and improvements, including Java Web Start support for J2SE Projects, expression stepping in Debugger, JBoss 5 support, profiler Improvements, local history and Subversion properties editor, and more.

DZone blogger Daniel Spiewak asks Does Swing Need Saving? "There's been some discussion lately regarding various scripting languages and if they are (or aren't) the salvation for the "dying" Swing API (here,here andhere). However, all of these blog entries assume one critical fact: Swing is dead or at least dying. I call that assumption into question.


In today's Weblogs, Stuart

kfarnham

Show Me Blog

Posted by kfarnham Feb 21, 2007

Romain's GUI's get even shinier

Somehow, I hadn't noticed Romain Guy's blog Curious Creature (did the name change?), which is awash in digital imaging, from Java to Mac OS X to post-it notes, from one of the most recognized names in Java GUI's. Not for nothing is he a JavaOne "rock star".

Today, he's blogging about achieving visual effects in Fast Image Processing with JOGL. "Chet and I are almost done with our upcoming book, Filthy Rich Clients. Last week, I decided to add a fun demo to the book to show how to implement a bloom effect. Blooms are widely spread in modern video games to spread out light sources." Romain's demo adds the bloom effect to the Aerith splash screen, as well as to a GUI build with Kirill Grouchnikov's Substance look-and-feel.


In Java Today, the newly launched and incubated enterprise project Woodstock seeks to offer "an extensive set of JavaServer Faces (JSF) components for web application developers to build enterprise level applications. These components are fully featured, user accessible and fully localized for 10 languages." A preview page lets you try out the available components, including tree, table, progress bar, orderable list, add/remove idiom, and more. An Artima article has more information about Woodstock's announcement.

Issue 279 of the NetBeans Weekly Newsletter is out, with news on NetBeans Day at JavaOne 2007, a call for participation in the Enterprise Pack's community acceptance testing program, information on a new book about rich client development with NetBeans, blogs, articles, and more.


In today's Forums,deronj discusses Looking Glass client development inRe: Wonderland APIs The LG3D client API, of course, will be available. This will provide the ability to create graphics objects, specify their appearance, animate them, receive events on them, etc. Then there will be an distributed object API (implemented using the facilities of the Darkstar game server) which will allow multiple people to visualize and interoperate with 3D objects. Also, there will be the Darkstar APIs themselves which will allow people to write programs that live on the server and which coordinate the activities of multiple clients and manage the distributed graphics objects.

Joe Bowbeer discusses how to get midlets to dial phone numbers in Re: LG KG800 (Chocolate) platformrequest doesn't seem to workThe MIDP 2.0 spec allows PHONENUMBER text fields to initiate calls: "The implementation may automatically start a phone dialer application that is initialized so that pressing a single key would be enough to make a call. This is implemented on some handsets, though it is not a requirement. As for platformRequest, tel: support is required, so it looks like your handset is not compliant: ("If the URL specified is of the form tel:, as specified in RFC2806, then the platform MUST interpret this as a request to initiate a voice call.")

laurelwilliams has a question about collaborative content in adding online help to your javahelp I am looking for a technique that will allow users to access wiki pages to contribute help comments which could then be included into my application (presuming a web connection is present). These comments and suggestions would then need to be accessed via the javahelp.[...] But of course, when it is clicked on I get a complete mess in the javahelp frame. It looks like my online page but includes text from the css and quite frankly looks like a formatting disaster. I am assuming this is probably a "browser" problem. Any ideas how I could approach this problem in another way?


In today's Weblogs, Ted

kfarnham

Skinny Rails and All Blog

Posted by kfarnham Feb 20, 2007

What's the right response to Ruby?

Sorry about the lack of an editor's blog yesterday -- we've had some problems with the blogging engine that were not resolved in time for yesterday's editor's blog to get posted. Because of this, yesterday's front page didn't get archived, so today's blog will highlight everything on yesteday's page as well as today's.

In a short but thoughtful discussion-starter on InfoQ,Desktop Java Live author Scott Delap asks Must Java Have an Answer to Rails? He notes that there are two trends playing themselves out in the Java community in response to Rails. The first is running Ruby on the JVM, with JRuby fast approaching full compatibility with Rails. The second is trying to recapture the "secret ingredients" that make Ruby and Rails so appealing, such as simplicity and convention-over-configuration.

What Scott doesn't address in his write-up is the title question: does Java even need to try to adopt some of Ruby and Rails' traits? In a comment, Javier Paniza makes an interesting point:

About Ruby, I personally prefer Java simply because it's a strong typed language, in this way the compiler is always our friend. Remember the the real problem of software is not in the initial development. Remember the Meyer's words about Eiffel vs Smalltalk (a 80s debate).

This statement of strong typing reminded me of something very interesting in a blog comment. Replying to Daniel Jalkut's claim on the Red Sweater Blog that C Is The New Assembly, former Apple Java team member Jens Alfke made an interesting comment about the suitability of loosely-typed scripting languages for building GUI's:

One problem I suspect will bite people using scripting-language bridges is the lack of type checking. Yes, I've read all the propaganda about "duck typing" and how the lack of type checking makes you more Agile. For small quickie bits of code, I tend to agree. However, in a full app, type errors will bite you in the ass. A lot.

Now, if it's a web app, being obsessive about testing can save you. You use tests to drive development, you use all the cool Rails features to write test cases that drive your whole app to test out every single feature, and so on. Fine. So you make zillions of type errors, and the compiler won't catch them, but your test cases will, and you run the test cases every five minutes.

But in my experience, GUI apps are orders of magnitude harder to test than something that's linear and stateless and driven by a single command pipe. GUI apps have huge amounts of state, and all kinds of weird timing issues, and simulating real-world interaction in a repeatable way is very hard to do. I have never known of a real-world GUI app that got most of its testing from some kind of automated process. Rather, the vast majority of bugs get shaken out by actual users doing actual stuff with the app, in unpredictable ways, and filing bug reports.

So Jens (even though he rather prominently bailed on Java a while back) is making the same argument that Javier is: that strong typing and catching things at compile time is your friend.

All of which might explain why we don't see a lot of activity binding scripting languages to GUI frameworks. It seems like it should also be an argument in favor of using Java for desktop development. So what's the hold-up there? Don't assume it's some variant of "Swing sucks". Far from it. Another blog cited on the front page argues that "Java Swing is currently the best GUI toolkit - by a long way - if you want to build cross-platform user interfaces. Incidently, it's also the most popular, too." Responding to the much discussed Hybridizing Java (in which Thinking Java author Bruce Eckel advocates Flash/Flex based GUI's over Java clients) Simon Brocklehurst asks Is Bruce Eckel Right? Maybe Not.. His argument is that the difference is not in the GUI libraries at all, and that Flash applciations are popular "because they're so easy to deploy reliably. That's it. It's an application deployment issue. Plain and simple. Java Web Start doesn't cut it - it asks the user too many 'hard to understand' questions before running (that means it's fine for experts, but regular people just get confused), it looks ugly at start-up, and, even more importantly, people want applications that run inside the browser."

So there's some ideas to chew on, and some action items to take: Java's strong typing is actually an advantage, but where it could do the most good (the desktop), Java is held up by other problems (deployment). Do you buy this line of thinking? Do join in the comments below.


Also in Java Today, the Mac Java Community page notes that a pair of updates have just been released for Java on Mac OS X 10.4 (Tiger) and 10.3 (Panther). TheJava for Mac OS X 10.4 Release 5 "adds support for the latest Daylight Saving Time (DST) and time zone information as of January 8, 2007, and delivers improved reliability and compatibility for Java 2 Platform Standard Edition 5.0 and Java 1.4 on Mac OS X 10.4.8 and later. This release updates J2SE 5.0 to version 1.5.0_07, Java 1.4 to version 1.4.2_12 and improves SWT compatibility for J2SE 5.0." The Java for Mac OS X 10.3 Update 5 updates Java 1.4 to 1.4.2_12 and "addresses a problem where some Java applications fail to launch."

Java SE 6 was the first release in a while to offer a significant number of new features explicitly for the desktop developer. In the SDN article New and Updated Desktop Features in Java SE 6, Part 1, Robert Eckstein starts to look at some of these in depth, including splash screens,, access to the system tray, a fix to the "gray rect" problem, sub-pixel anti-aliasing on LCD displays, look-and-feel improvements, and more.

In episode 24 of the NetBeans Podcast, Roumen Strobl interviews Geertjan Wielenga, a technical writer on the NetBeans team, based in Prague. Topics include the various NetBeans platform tutorials, Geertjan's update center, and his upcoming NetBeans book.

The mobile & embedded community is running a poll to assess interest in a certain style of tool. "A recent discussion in the phoneME Advanced forum touched on JavaCheck, a now-stagnant technology that lets you test an app's compatibility with a specific Java API and the devices that implement it. Take our poll and let us know if you would find value in such a tool."


Today's Feature Article, revives the not-so-stupid question series with the sensible queryWhat's the Difference Between Wildcard Generics and no Generics? In other words, "What is the difference between specifying a wildcard for a genericized type and not using the generic notation at all?", since you can omit the generics altogether, and thereby replace something likeList<?> with just List. Have a look at the question and its example, and feel free to join in the discussion.


This week's Spotlightsection links to the java.net wiki pages for JavaOne. The java.net Community Corner wiki is where you can check out the posted mini-talks, or sign to present your own mini-talk, providing a title, speaker, and abstract. The latter is important, because we'll copy-and-paste it into the podcast feed, meaning it'll help listeners around the world decide which talks to listen to. Also on the wiki, check out our overall JavaOne wiki page, in which we'll be keeping track of technical session and BoF's presented by java.net members (once they're announced), along with other java.net activities during the week.


A thread in the Forums started recently, in response to a two-year-old blog that makes the argument that making Java available on Windows hurts Linux and therefore Sun should stop making Java for Windows. podlesh rejects the argument in Re: Java has harmed Unix but helped Windows win: "Sorry, I think you are just wrong. I understand the feeling, I'm UNIX guy too (although younger one, almost the "linux" generation). Windows and their environment is something new, strange, different, sometimes just twisted. Unfortunately, most people out there consider Windows as THE operating system and environment. This "new linux thing" is just "new", "strange", "different" for them. And most decision makers are from this category. Removing Java from Windows would be just major blow to UNIX. Programmers will NOT rush to install Linux/Unix on their PC to continue working: they will be forced to install Windows."

barz26 would like to slim down GlassFish in Minimalistic GlassFish V2 Installation possible? "Hi is it possible to reduce a GlassFish installation by doing the following: - turn off Sun MQ at all (neither local/remote/embedded config) and remove the IMQ dir? - remove all JBI stuff (disabling the JBI lifecycle module und removing the references to it doesn't seem to work as I get a startup exception and the admin app doesn't work anymore get rid of all references to JavaDB/derby by removing the javadb dir and all config references like timer jdbc pool. The rationale is to prepare a standard setup for a corporate environment where people should be restricted to use plain JavaEE(no JBI) and use the corp standard products for jms providers and databases"

hepler has some suggestions in Re: Project Looking Glass, whats next.... Just wondering if the Sun Secure Global Desktop might provide a solution to this request to run Windows based programs in Looking Glass. It should be able to display any application in an X based environement. Maybe the people working on the Secure Global Desktop would be willing to do the interface to Looking Glass? Maybe the server and client would run on the same system. Maybe you guys could get together with them but not take on more than a few days of work in order to orient them to the project. This could result in the ability to display any program in Looking Glass that the Secure Global Desktop can handle (IBM Mainframe, HPUX, ...).

swpalmer seems to be hitting an undocumented barrier in Desktop.mail(URI) what are the limits? "I've found that with Java 6 on Windows XP ( running Outlook email client) that the body size included in the URI provided to Desktop.mail(URI) can cause the API call to fail with a java.io.IOException("Error: Access denied") Is there any way to tell what the limit is at runtime? (Other than re-trying with different length URIs until you cross the boundary.) I noticed this first when I was making a simple bug reporter that emailed stack traces and found that the method would fail depending on exception being reported."

Marco Sambin is dealing with applet-only memory issues in [JAI] JAI, memory usage and Java applets: "I am experiencing some stange memory problems with my JAI and JIIO - based Java applet. This applet is able to load, display and process sets of medical images. Within a single execution of my Java applet, everything's working really fine: I am able to load very large sets of images (thanks to JAI's pull model), even multiple times in the single execution without problems. The problems begin when I exit from the applet without closing the web browser (for instance, I browse to another web page), then I return back to the applet and load another set of images. If I do this 4 or 5 times, then upon loading a given set of images I get an "out of memory" exception."

Meanwhile, pepe reports a curious case of inconsistent cpu use: "I am testing multiple platforms for support of the application i am currently working on. I get very inconsistent results from one to an other. For example: on a P-IV D 2.8Ghz (dual core, cores enabled), geforce7300 GS, CPU is around 18% at 50hz. on a p-IV 3Ghz (hyperthreaded, HT enabled), intel 82945G (!!!), cpu is around 0-4%.. Both machines have latest drivers, both run flawlessly and cycletime is set at 20 on both. This is very troubling."


Among the recent Weblogs, Alexey

kfarnham

I Want To Do Blog

Posted by kfarnham Feb 19, 2007

Aspiration and inspiration for projects

So, on Friday, I was pining for time over the weekend to work on a project of mine. But instead, I ended up blowing off editing for a few hours in the afternoon and banging out some code. It went pretty well. What I'm working on is putting a Java wrapper around the Mac OS X QTKitframework, for reasons I'll make clear in a later personal blog (the Java Posse got confused again last week about where QuickTime for Java ends and my various QT projects begin, so I'll need to do a big reset for everyone on that).

Anyways, it was time well spent. I did manage to create a CocoaComponent that wraps a QTKit QTMovieView, and thus displays QuickTime content in a heavyweight Java component:

keaton-test-02-17-07.png

The fun part, which I got working a few weeks ago, was building all the native code with an Ant task. As you can see, it creates a "universal binary" library, meaning it can be used on PowerPC or Intel Macs:

keaton-jnilib-info-02-17-07.png

So, this is the beginnings of a new project for me, called Keaton. I haven't checked in the code yet, because right now the file selector andQTMovie creation is being done on the native side, and I want to get that moved over to Java before I check in, so that Java-based callers at least have the basic ability to create a movie and get an onscreen component for it, all in Java.

Anyways, why am I indulging this much space in the editor's blog about a proto-project that doesn't even have any public code yet? Because I wanted to get it real enough in time to serve another purpose, and that's as an example of signing up for mini-talks at the java.net booth during JavaOne 2007. If you've been by our booth (or listened to the podcasts from last year), then you know what these are: 20 minute presentations from members of the java.net community about their projects, JUG's, communities, etc.

This week's Spotlightsection links to the java.net wiki pages for JavaOne. The java.net Community Corner wiki is where you can check out the posted mini-talks, or sign to present your own mini-talk, providing a title, speaker, and abstract. The latter is important, because we'll copy-and-paste it into the podcast feed, meaning it'll help listeners around the world decide which talks to listen to.

So that was one of the reasons I wanted to get my project sufficiently real that I could at least know that it was doable, that I'd be able to have something interesting to discuss by JavaOne, and could grab the name and reserve a time and let it serve as an example of how to sign up for a mini-talk.

 

You might also notice from the screenshot above that the proper package convention for java.net projects isorg.jvnet.projectname and notnet.java.projectname, but let's get into that another day.

Also on the wiki, check out our overall JavaOne wiki page, in which we'll be keeping track of technical session and BoF's presented by java.net members (once they're announced), along with other java.net activities during the week.


Speaking of Java on the Mac, in Java Today, the Mac Java Community page notes that a pair of updates have just been released for Java on Mac OS X 10.4 (Tiger) and 10.3 (Panther). The Java for Mac OS X 10.4 Release 5 "adds support for the latest Daylight Saving Time (DST) and time zone information as of January 8, 2007, and delivers improved reliability and compatibility for Java 2 Platform Standard Edition 5.0 and Java 1.4 on Mac OS X 10.4.8 and later. This release updates J2SE 5.0 to version 1.5.0_07, Java 1.4 to version 1.4.2_12 and improves SWT compatibility for J2SE 5.0." The Java for Mac OS X 10.3 Update 5 updates Java 1.4 to 1.4.2_12 and "addresses a problem where some Java applications fail to launch."

Java SE 6 was the first release in a while to offer a significant number of new features explicitly for the desktop developer. In the SDN article New and Updated Desktop Features in Java SE 6, Part 1, Robert Eckstein starts to look at some of these in depth, including splash screens,, access to the system tray, a fix to the "gray rect" problem, sub-pixel anti-aliasing on LCD displays, look-and-feel improvements, and more.

In episode 24 of the NetBeans Podcast, Roumen Strobl interviews Geertjan Wielenga, a technical writer on the NetBeans team, based in Prague. Topics include the various NetBeans platform tutorials, Geertjan's update center, and his upcoming NetBeans book.


A thread in the Forums started recently, in response to a two-year-old blog that makes the argument that making Java available on Windows hurts Linux and therefore Sun should stop making Java for Windows. podlesh rejects the argument in Re: Java has harmed Unix but helped Windows win: "Sorry, I think you are just wrong. I understand the feeling, I'm UNIX guy too (although younger one, almost the "linux" generation). Windows and their environment is something new, strange, different, sometimes just twisted. Unfortunately, most people out there consider Windows as THE operating system and environment. This "new linux thing" is just "new", "strange", "different" for them. And most decision makers are from this category. Removing Java from Windows would be just major blow to UNIX. Programmers will NOT rush to install Linux/Unix on their PC to continue working: they will be forced to install Windows."

Marco Sambin is dealing with applet-only memory issues in [JAI] JAI, memory usage and Java applets: "I am experiencing some stange memory problems with my JAI and JIIO - based Java applet. This applet is able to load, display and process sets of medical images. Within a single execution of my Java applet, everything's working really fine: I am able to load very large sets of images (thanks to JAI's pull model), even multiple times in the single execution without problems. The problems begin when I exit from the applet without closing the web browser (for instance, I browse to another web page), then I return back to the applet and load another set of images. If I do this 4 or 5 times, then upon loading a given set of images I get an "out of memory" exception."

Meanwhile, pepe reports a curious case of inconsistent cpu use: "I am testing multiple platforms for support of the application i am currently working on. I get very inconsistent results from one to an other. For example: on a P-IV D 2.8Ghz (dual core, cores enabled), geforce7300 GS, CPU is around 18% at 50hz. on a p-IV 3Ghz (hyperthreaded, HT enabled), intel 82945G (!!!), cpu is around 0-4%.. Both machines have latest drivers, both run flawlessly and cycletime is set at 20 on both. This is very troubling."


In today's Weblogs, Alexey

kfarnham

It's A Wild Weekend Blog

Posted by kfarnham Feb 16, 2007

Got time for your project?

Some work on open-source for their day job; for the rest of us, it's a weekend activity, to be juggled with all the other demands on our time, like fixing the garage door, organizing the tax records, and taking the kids to the circus. It's easy to understand why some projects get stuck when their developers just never have enough time to work on them. Well, that's my excuse, anyways. Still, I've got three emacs windows (two Java, one Obj-C) and one terminal that have been minimized for two days and want to at least get compilable again... hopefully this weekend.

And how do we get the younger generation into our projects? Sure, they've got time, but they have demands on their time too: school, career-building, part-time or summer jobs, etc. Well, there's help for the last of these... a recent blog announces that Google will again host its Summer of Code, which provides stipends for students to work on major open source projects. In the past few years, java.net projects such as JXTA and Project Looking Glass have participated as mentoring organizations in the SoC.

So there's your heads-up -- for appropriate projects, it's time to apply for the program, and for students, this could be a chance to hack away the Summer months. Unless you're south of the Equator, in which case it'll be Winter.


In Java Today, ANetBeans Enterprise Pack 5.5.1 community acceptance testing (NetCAT) Beta program offers an advance look at upcoming NetBeans enterprise features. The 5-week program is scheduled to begin on February 26. "We are looking for community members who have previous experience with enterprise features and who have the availability to provide us with their feedback in a timely manner. All participants will be directly supported by the product team on the Enterprise Pack mailing list."

The 111th issue of the JavaTools Community newsletter is out, compiling tool news from around the web, welcoming new projects to the community, congratulating a graduation (JLab), and featuring a Tool Tip on how to write java.net feature articles as a means of promoting your project.


Mark

kfarnham

It's Not So Hard Blog

Posted by kfarnham Feb 15, 2007

Do framework developers need to give it a REST?

JDK 7 is turning into one of the best-debated releases of Java. We've already started vigorous discussions about closures, properties, and the modularization of Java, now get ready for the debate over the REST API.

The newly-unveiled JSR-311 proposes a Java API for "RESTful" web services. "This JSR will aim to provide a high level easy-to use API for developers to write RESTful web services independent of the underlying technology and will allow these services to run on top of the Java EE or the Java SE platforms. [...] The goal of this JSR is to provide an easy to use, declarative style of programming using annotations for developers to write REST-ful Web Services and also enable low level access in cases where needed by the application."

The question that's being raised immediately is whether REST needs its own Java API. A book editor I was IM'ing with this morning was surprised by JSR-311, saying in effect, "what do you mean you can't do REST in Java, I just signed a book on it." Author and developer Elliotte Rusty Harold goes further in yesterday's Café Au Lait news, questioning the motives and mindset behind JSR-311:

A major selling point of REST is that it's simple. It doesn't require big, complicated frameworks with seven levels of indirection to solve simple problems. However there are some companies (Sun being one of them) that can't imagine regular, ordinary developers building systems without using some ultra-complex framework they've designed. The idea that people might just want to send plain old XML over plain old HTTP is inconceivable to them. There has to be some big framework for serializing objects and abstracting databases and faking method calls and guaranteeing message delivery and a dozen other things people either can already do perfectly well with HTTP and XML or don't actually need to do at all.

Marc Hadley takes on some of the concerns in his blog JSR 311: Java API for RESTful Web Services, denying that the JSR presumes that developers are incompetent:

This one seems to come from this sentence in the JSR submission: "Correct implementation requires a high level of HTTP knowledge on the developer's part." OK, perhaps this wasn't put very well, but the plan is to offer default implementations of things like content negotiation and precondition support to save developers having to implement those things themselves (unless they really want to).

So what do you think? Does Java SE need an API for RESTful web services? Take a look at the discussion out there and jump in. The best way to make sure JDK 7 gets done right is if developers get involved early.


Also in Java Today, the Java Desktop Community recently featured Stopwatch as its "Project of the Day". "Stopwatch is a platform independent timesheet recording application that may be used to track the time you spend on clients, projects and tasks. You can also generate reports from your timesheets by using one of the predefined templates, or from one you create yourself. "

Gilad Bracha, Neal Gafter, James Gosling, and Peter von der Ahé recently updated their Closures for the Java Programming Language proposal to version 0.5. The new revision changes terminology to clarify the difference between a closure literal and the result of evaluating it, corrected an example, further specified throws type parameters, added support for control abstractions that act as loops, and more. An introduction to closures, along with all the previous versions of the proposal, are available at the javac.info site.


In today's Weblogs, James Gosling reports on real-world Java use in HBO: visiting another great customer: "One of the best parts of my job is going on customer visits. Yesterday I got to visit the folks that run HBO&Cinemax. No, not the CEO and a pile of executives: the folks who make the bits flow. The server and storage farms, the transcoding arrays, the video stream construction and the satellite uplinks. It's all in an impressive 5 9's reliability site on Long Island. Redundant everything. Big power supplies. There are big bags of Java code in the control system."

Would you believe The Web as a Database? David

kfarnham

That's Neat, That's Nice Blog

Posted by kfarnham Feb 14, 2007

MPEG finally notices Java

It's easy to see when developers choose Java to solve problems for other developers: IDE's, build tools, XML processors, etc. It's a lot more interesting when it gets used for some other purpose, because that proves once again that it fills a need.

To this point, I was encouraged to see that MPEG founder and chairman Leonardo Chiariglione has chosen Java to implement his latest project. I'd always wished they'd done the MPEG-4 reference implementation in Java -- late 90's performance concens notwithstanding -- because it would have gotten more developers up and running faster, rather than requiring everyone who wanted to work with it to be Windows-based and be able to read and port Windows code. Adopting Java should be a good way to advance a standard, because far more developers will be willing and able to work with it.

In this case, Chiariglione has used Java for the implementation of a standard, open-source DRM system called Chillout. He mentions it in a responseto Steve Jobs' recent anti-DRM essay.

"The Moving Picture Experts Group (MPEG) has produced most of the standard DRM technologies that are required by a DRM system. The Digital Media Project (DMP) has added a few more technologies that were missing, has integrated them with the MPEG DRM technologies to provide complete solutions, is now setting up the governanceof the system based on established practices and is releasing Chillout, the reference software of its specification, as open source under the Mozilla Public Licence v.1.1."

Political concerns about DRM notwithstanding, it's encouraging to see the DMP adopt Java for its reference implementation, and let's hope we see MPEG do the same in the future.


Also in Java Today, The ever-prolific Kohsuke Kawaguchi has just released NLink, a project to simplify calling native code from Java. "The problem with calling native libraries with JNI is that, for every method, you need to write a java method declaration, and then a bit of native code to do the parameter conversion. This makes it difficult to casually call into native libraries, because you'd have to write another native library just for JNI handling. NLink overcomes this problem by providing a general-purpose method invocation converter driven by annotation." A brief tutorial on using NLink is available in the project's web space.

In the InfoQ video interview Mike Keith on EJB 3, co spec lead discusses the state of EJB 3, talks about how the community has driven the development of the EJB 3 spec, and comments on the evolution of the specification to work better with POJO's and embrace newer ideas such as dependency injection.


Mark

kfarnham

Get Rhythm Blog

Posted by kfarnham Feb 13, 2007

The back-and-forth of high-performance servers

If you're working with the low-level I/O of a server, it's pretty much a no-brainer that performance concerns will probably compel you to use the NIO package, introduced in Java 1.4. But once you've made that choice, do the rest of the pieces fall into place easily? Hardly. You also have significant threading issues to consider. It's easy enough to dispatch each request to its own thread, but this ends up not scaling particularly well.

In our Feature Article, Architecture of a Highly Scalable NIO-Based Server , Gregor Roth argues for a different architecture, one which responds to events (such as requests) and employs a thread pool to do the non-blocking IO work needed for each request.

An event-driven non-blocking architecture is a fundamental layer to implement highly efficient, scalable, and reliable servers. The challenge is to minimize the thread synchronization overhead and to optimize the connection/buffer management. This will be the hardest part to program.

Of course, easier said than done. Check out the article for both the ideas behind the architecture, and links to servlet frameworks that already implement this approach for you.


In Java Today, the ROME project offers a popular set of parsers and generators for various RSS and Atom syndication formats, and the wiki page Products or sites powered by ROME reveals just how widespread its use is. Take a look and see how many major sites you recognize. The page also offers a set of "Powered By ROME" badges to put on your site.

Jiri Sedlacek's article Uncovering Memory Leaks Using NetBeans Profiler discusses memory management in Java, how it can go wrong, and how NetBeans can help you fix it. "This article will cover [a] scenario when there are many small objects that are continuously accumulating without being released. This type of leak can be more difficult to detect because typically it's not related to any concrete action and doesn't use a noticeable amount of memory until the program has run for a long time. This scenario is dangerous especially with Java EE applications that are expected to run for long periods of time. After some time the leak starts to consume memory and may slow down performance of the application or cause anOutOfMemoryError crash without any visible cause."

Google blogger Steve Yegge is getting a lot of notice with a new blog that tries to predict the traits of The Next Big Language. "People are still always trying to make new languages, because we have yet to see a language that is (a) popular and (b) doesn't suck. Do you disagree? If so, I don't mind. It just means your standards aren't as high as mine. Nothing wrong with that."


Jacob

kfarnham

Things We Like To Do Blog

Posted by kfarnham Feb 12, 2007

What do you want from JavaOne?

With JavaOne 2007 a few months away and registration already open, the stars of the show have yet to be announced. And that's because they could be you and your project.

There's about a month left to nominate the world's best Java innovations for the Duke's Choice Awards, which will be handed out at JavaOne in May. The awards "celebrate extreme innovation in the world of Java technology and they are granted to the best and most innovative projects using the Java platform." Check out the nomination form, and submit your nominations by March 15.

On today's front page, we're also featuring Annette Vernon's blog on the JavaOne program committee, in It's (Java)One Big Happy Family. "The content selection team (aka "The PC", for Program Committee) invited several renowned members of the Java developer community to participate in our review and selection process for JavaOne." In her blog, you'll find some well known names among those deciding what will be in this year's show, a number of whom are probably on a first-name basis with the java.net community by this point (Romain, Fabiane, Hani, etc.).

Also, while you're making early JavaOne plans, do plan on stopping by the java.net Community Corner, where once again we'll be featuring 20-minute mini-talks by members of the java.net community about their projects. The wiki is live and ready for you to reserve a time for your mini-talk. We also intend to podcast them again this year, so you'll be talking not just to attendees in the booth, but to headphones and speakers world-wide.


In Java Today, the BluePrints Solutions Catalog project has released a new Early Access version of the catalog. According to the release notes, some of the new features include a new viewer application, a Digg mashup in the Viewer application so users can easily comment and bookmark associated online articles, and a dynamic bundling mechanism so the Solutions Catalog can be released using only the examples that apply to the targeted audience. The new version upgrades all components to be JSF 1.2 compliant and has been updated to use Dojo 0.4.1 libraries.

Issue 110 of the Java Tools Community newsletter is out, pointing to activity in the Java Tools Forum and a video interview with Roumen Strobl about Java 6's effect on NetBeans. Also in the newsletter: a tool tip on adding a spell-checker to NetBeans, tool news from around the web, and a welcome to a new Tools Community project.


Michael Nascimento

kfarnham

The World I Know Blog

Posted by kfarnham Feb 9, 2007

About writing feature articles

Something I've long planned to do is to put the basic materials for writing feature articles up in a public place. Until now, I've just sent them to authors either when they e-mail asking how to write a feature article, or when their proposal is approved. In the last week though, I've had repeated problems trying to get this .zip file of HTML documents past over-zealous mail providers (yes, I'm talking to to you, GMail), who have a dubious belief that the zip format is inherently not to be trusted... see Zip Considered Harmful for my previous rant on this.

So, in launching the trivial jn-editorial project and hosting the writer's guides in its web space, I had an opportunity to do a little bit of a refresh on some of the guidance, clearing up dated or inaccurate material, trimming guidance from other O'Reilly sites that doesn't apply to java.net, etc.

I made a lot of changes to the "wish list" of topics we're interested in. As we internally discuss the goals and guidance of the site, one thing I've settled on is a real desire to make the feature articles not just a general interest item, but to really focus them on the java.net projects and the site. Considering we now host reference implementations of ME, SE, and EE, not to mention NetBeans and over 3,600 community projects, it seems to me like we ought to be able to use the features to enhance knowledge about all the things going on here at java.net. We probably couldn't have done when the site launched three and a half years ago, but times have changed. This is a large, successful community, and frankly, I'd much rather read a proposal about the core platforms or your cool project than see a proposal about projects that don't have anything to do with java.net.

If you're interested in writing a feature, have a look at the guides, and send me an e-mail if you have any questions, or if you're ready to make a 5-10 line proposal. Thanks.


The Java Todaysection kicks off today with a little history. "Eight years ago, a team of developers set out to forge the free tool that today is the Swiss army knife of software development." The video High-level Introduction to NetBeans IDE and the Community"gives you an overview of the NetBeans IDE and the enthusiatic community that made this project come alive."

An SDN interview gets an update on Java SE 6 monitoring in Managing Applications With Java SE 6: A Conversation With Vasanthan Dasan: "Java SE 6 now enables developers to attach command-line utility diagnostic tools such as jstat,jmap, jhat, and jstack to any application without requiring startup in a special mode. In addition, JConsole, with enhanced plug-in support and dynamic attach capability, is much improved."

2007 will go down in history as the year Sun Microsystems gave up the reins of the Java platform, releasing it under an open source license to the Java developer community. In the article Java 2007: The year in preview, Elliotte Rusty Harold predicts new directions for the Java platform, in everything from scripting to bug fixing to new syntax.


Tips abound in today's Weblogs. Tim

kfarnham

Better Now Blog

Posted by kfarnham Feb 8, 2007

Validation without roundtrips or duplicate code

If you'd written it as a Swing app, you could use your Java-based validation classes everytime a field loses focus. But no, you went and created an Ajax webapp, so while your server is Java, the client is a browser, not exactly well-suited to running your validation code. What are you going to do, port all the validation code to JavaScript, and keep the two versions in sync? Or just forget validating individual fields and let the user fill out everything, validating the input only when it hits the server.

There's another way. In our Feature Article, Eric Spiegelberg introduces an approach for Ajax Form Validation Using Spring and DWR.

Using what is referred to as Ajax form validation, just after a user finishes filling out an input form field a background process of the browser can transparently transmit the form input value to the server. The server then performs validation of the input values. Should the server determine an input value is invalid, a validation error message is returned to the browser and dynamically displayed next to the invalid form input entry. While some advanced web applications have demonstrated this functionality for a short while, the software has typically been hardwired and custom-coded for each form or for each application. This article presents a generic and reusable Ajax form validation design that, by using existing open source components and leveraging your applications' existing validation logic, can easily and quickly be used to Ajax validate every form of your web-based applications.

So, you can have your thin client and validate it on the server-side too. Check out Eric's approach and let us know what you think.


Screencasts and webcasts top today's Weblogs. Arun

kfarnham

Run Blog

Posted by kfarnham Feb 7, 2007

This late blog is brought to you by the alarm clock I forgot to set

One mistake leads to a cascade of others. It's never enough forjavac to tell you that you forgot toimport a package, nope, you'll get an class-not-found error for every instance of classes in that package that you try to use. Well, it's still better than the old C compilers that would in turn nag you about every line that used one of those instances, but still... one slip and the whole tower of cards comes down.

I'm still catching up because somehow I forgot to set my alarm last night, so instead of waking up at 5:15 like a normal person (I used to wake up to 5:15 by the Who, but the joke got old), I woke up at 7 when my son Keagan walked into the bedroom. So that has all my internal timing for the day off, when weblogs and forums for the front page need to get selected, when I tour RSS feeds, communities, and other sites for "Java Today" links... all of which usually alternates with a routine of also exercising, breakfasting, and helping my wife get Keagan off to school.

So, I think I'm done, and I'm plowing through the eternal e-mail backlog when I go to check something on iTunes -- namely whether the Java gaming-oriented video podcast Level Up! is on the iTunes store (it is) -- and I find search results for this week's blog-theme band.

Which is the exact point it hits me: it's 1PM and I still haven't written the daily blog!

It's the downside of having a consistent routine: you can really get messed up when you fall out of the routine.


In Java Today, InfoQ has posted a video interviewwith JavaOne "rock star", Filthy Rich Clients co-author, andAerith co-developer Romain Guy, in which he discusses Swing, "filthy rich" clients, applets versus Flash, and whether the world needs a "browser edition" of Java.

Do you have an idea for a standard that should be codified into a JSR? Ever wondered what it takes? The JCP's The Life of a Spec Lead, parts 1 and 2, discusses the JSR process with several star spec leads, collecting their insights on how to write a JSR, recruit and organize an expert group and observers, manage the group and deliver a draft.

Author and speaker Elliotte Rusty Harold considers the idea that Java is so widely understood that it's a good way to express general concepts, in the blog Java as Lingua Franca. 'When I need to teach cross-platform subjects like DOM or data structures to mixed language audiences, I can easily use Java to show examples and everyone can follow them, even if they're not Java programmers. Everyone reads at least pidgin Java. Only C++ programmers can read C++. Only Ruby programmers can read Ruby. (Still better than Perl though. No one can read Perl, Perl programmers included.)"


Jean-Francois

kfarnham

Heavy Blog

Posted by kfarnham Feb 6, 2007

Lightening JAAS couplings

Returning to a topic he's covered before, Denis Pilipchuk is looking at the Java Authentication and Authorization Service (JAAS) in the context of Service Oriented Architectures (SOA's). In today's java.net, he shows how to turn JAAS into something of an authentication and authorization service, and in so doing overcomes some of the limitations he brought up in his previous article, namely that JAAS expects the applications it serves to be in the same JVM, and, implicitly, that it only works with Java applications.

As a result, many of today's real world enterprise systems avoid JAAS authorization altogether and embed security logic right into the application code. This logic controls access to application-specific resources in a way that is not available via permission-based Java policies. Unfortunately, hardcoded security logic has many inherent pitfalls, such as lacking deployment and runtime flexibility, presenting a maintenance nightmare, being inconsistent across multiple applications, and so on. More advanced applications, while still using JAAS for authentication, delegate all authorization decisions to external entitlements systems.

If you've already committed to JAAS for your application, but need to move to a more heterogeneous service model, what do you do? Denis' Feature Article, Adapting JAAS to SOA Environments: SOA Security Service shows how to use JAAS in the context of a web service, using SOAP messages to interact with the JAAS system.


New releases dominate the Java Today section today, starting with the the Substance look-and-feel project, which has just released version 3.2. As noted by Kirill Grouchnikov in his blog, the new version includes two new dark skins (Challenger Deep and Emerald Dusk), a new SubstanceDefaultLookAndFeel, scrollbars with overlay effects and grip handles, rollover effects on table editors, a new version of Xoetrope color wheel panel, and more.

The Sun Java Wireless Toolkit 2.5 for CLDC has just been released for Windows-based CLDC developers. As Tomas Brandalik notes in his blog, new features include support for the Mobile Service Architecture (MSA), Scalable Vector Graphics (SVG), a payment API, JSR-238 mobile internationalization, and Session Initiation Protocol (SIP).

After several years of development, version 1.0 of the Lightweight Java Game Library has been released. "The Lightweight Java Game Library (LWJGL) is a solution aimed directly at professional and amateur Java programmers alike to enable commercial quality games to be written in Java. LWJGL provides developers access to high performance crossplatform libraries such as OpenGL (Open Graphics Library) and OpenAL (Open Audio Library) allowing for state of the art 3D games and 3D sound. Additionally LWJGL provides access to controllers such as Gamepads, Steering wheel and Joysticks. All in a simple and straight forward API." This release supports Linux, Mac OS X, and Windows, and more information about the release is available in a LWJGL 1.0 Released forum thread.


David

kfarnham

Gel Blog

Posted by kfarnham Feb 5, 2007

A jolt of animated orange for launching SE 6 applets

Setting aside issues of applet viability and installation hassles, it's all but a given that a proper loading screen will assuage your users that the content is being loaded, with an indication of how the startup is going. Thing is, this wasn't really a consistent part of the applet experience prior to Java SE 5 -- on the Mac, you get a static image of a coffee cup with "reload" arrows, and I think other platforms got some other indicator. In SE 5, Sun's VM finally provided a fairly attractive logo and progress bar. Future versions of SE 6 are going to take this an animated step further, as illustrated in Chris Campbell's blog Orange Box: New Java Plugin Animation. Compare the old startup logo:

Java SE 5 applet loading logo

to the new one:

Future Java SE 6 applet loading logo

The latter doesn't show how the animation works -- the vertical swirl appears down the box and then splits it in two by a couple appropriately beveled pixels. But let's let Chris talk about how this was accomplished:

The old animation was already beginning to look a bit dated, so I think we were happy to give the design (and implementation) a much needed makeover. Coleen's new designs were much more sleek and modern looking than the old gray box. And this time they were predominantly bright orange. (Hooray for Sun branding!) The design we settled on looked fantastic, but it was also a bit of a fun challenge for me trying to convert her Photoshop blueprints into Java 2D-isms. Fortunately around that time I had pushed to get LinearGradientPaint (and RadialGradientPaint) included in the JDK, which turned out to be a lifesaver. I also had to figure out how to achieve cheap, efficient drop shadows, glow effects, and soft clipping in Java 2D.

Chris' blog includes an SE6-based Web Start preview of the applet-loading animation, so check it out.


Also in today's Weblogs, Scott

kfarnham

All I've Got Tonight Blog

Posted by kfarnham Feb 1, 2007

Thinking in Java, but not on the client side?

Thinking in Java author Bruce Eckel's latest essay has the title Hybridizing Java, and by that he means developing Rich Internet Applications where only the server side is in Java. He starts by stating that "the web is a mess" with incompatibilities between browsers, and describing Ajax as "an excellent hack that gets the last bit of mileage from JavaScript", asserting that the end is in sight for what Ajax can do. A better client-side experiences is needed, and Bruce says "at some point we must ask why Java applets haven't become ubiquitous on the internet as the client-side standard for RIAs (Rich Internet Applications)."

The culprits he lists are many: a lack of pre-installed Java runtimes, a miserable experience for many who try to install it themselves, bad experiences with applets and Java applications (Bruce apparently uses the same horrible Memorex Swing app for making DVD labels that I do), inconsistent cross-platform behavior, the lack of a viable multimedia library, and more. To Bruce's mind, this litany of failure all but closes the door on client-side Java:

It's not impossible to build GUI applications with Java, but it's been 10 years and there are still installation hiccups with applets, Java WebStart, and regular applications. After 10 years, people don't trust it anymore. If it's not there after 10 years, then I'm going to go out on a limb and say that someone doesn't consider this problem important enough to fix. And even if they did, there have been so many bad experiences among consumers that it would take years to get the trust back.

So what's the alternative? Bruce's concept of "hybridizing" Java means to continue to use Java on the server side, but to move to Flash-based solutions for the client, such as Flex.

One of the most appealing things about Flex is that Flash was created with the idea of UI first. In a very real sense, it's a domain-specific language (DSL) for graphics, multimedia, and UIs, whereas most other solutions have been languages with UI libraries tacked on afterwards.

Moving beyond the browser, he points out Apollo, a cross-OS runtime that allows for creating desktop apps with Flex, potentially allowing you to write apps that work both in the browser and on the desktop.

Feedback to this article has been, as you might imagine, quite active. There are dozens of comments on the Artima post, a response from ONJava blogger Paul Browne that calls for a solution that degrades more gracefully than Flash, and further commentary on InfoQ's write-upof the story.

But what do you think? Does Bruce make the case for giving up on client-side Java, and is Flex really the best alternative today? Are Java's installation, behavior, and multimedia problems really insoluble in the short term? Think about it and let us know your opinion.


Apropos of the debate Bruce has started, the latest java.net Poll asks "What do you think is the most practical client technology for Rich Internet Applications?" Cast your vote on the front page, then visit the results page for current tallies and discussion.


In Java Today, the sqlb project has graduated from the incubator to a Java Enterprise Community Project. This project, based on six years of ongoing development, makes Portable SQL a first-class Java citizen. SqlB is a pragmatic solution to java persistence, providing the richest possible SQL functionality while still working across all supported databases (including Oracle 9 &10, Microsoft SQL Server 2005, Sybase ASE 12.5 & 15, and more). It supports compiled SQL, allows full spectrum SQL, EJB 3 entities, and much more.

Perhaps the third time will be the charm, as JSR 310 proposes a new "Date and Time API" to address the deficiencies ofDate and Calendar. "The new API will be targeted at all applications needing a data model for dates and times. This model will go beyond classes to replace Date and Calendar, to include representations of date without time, time without date, durations and intervals. This will raise the quality of application code. For example, instead of using an int to store a duration, and javadoc to describe it as being a number of days, the date and time model will provide a class defining it unambiguously."


In today's Forums,enicholas updates the thinking behind the "modular JDK" proposal in Re: Java Kernel. How it is? When it will be part of JSR ? "The fact that people want a stripped-down JRE and, being open source, we can't stop them from doing that is one of the driving forces behind this. By providing our own implementation, we hopefully reduce the impetus for people to do this themselves, and then we have folks distributing a 100% compatible version of Java complete with Plug-In and Web Start support, rather than a half-formed monstrosity which cannot be called Java."

Joshua Marinacci discusses the new Swing Application Framework in Re: JSR296: "JSR 296 will not provide the same thread tricks that foxtrot and spin do. JSR 296 is more like SwingWorker, but a lot easier to use. On the other hand, the EDT still works the same way so there is nothing which would prevent you from using Foxtrot or Spin in an application which also uses JSR 296."

adamman71 is hoping to find some Documentation for JXTA 2.4.x? "I am trying to understand how to use JXTA 2.4.1, but the class structure and organization is quite different than in JXTA 2.3.x. I have been searching for the equivalent of JxtaProgGuide_v2.3 for JXTA 2.4.1, but I could not find any such document. I am currently reading the javadoc provided for each class, but it is far from obvious to get the whole picture (especially for the newbie to JXTA that I am...) Does anyone have a 'global' document explaining how classes interact with each other in JXTA 2.4.1?"


Eamonn

kfarnham

Shake It Up Blog

Posted by kfarnham Feb 1, 2007

So just what do we mean by closures anyways?

It serves the platform well to have a vigorous debate now about what should go into JDK 7 -- to dig through the pro's and con's of closures, a new properties syntax, a modular JDK, etc. -- and thereby prioritize what should go in. If one of these is a dud with the community, better to know now than after JDK 7 comes out.

Closures came in a very close third in the recent poll What one feature would you most like to see in JDK 7, and was the highest-ranking language change. It's probably gotten the most discussion over the last few months, and has the advantage of already being backed with a concreted, if still-evolving, proposed specification, authored by some of the top luminaries in the Java world.

But... just what are we talking about? Outside of the specification itself, can we speak consistently about what closures are, are not, and how they differ from anonymous inner classes? Neal Gafter has stepped in to provide A Definition of Closures, which traces closures back to their origins in Scheme and Smalltalk, and then makes the case for what they would be in Java:

We are now considering adding closures to Java, a significantly more complex language than either Scheme or Smalltalk. We're not considering them because they seem like a neat idea, or because they worked out well in other languages, or because we're bored. Rather we're considering them: because of the power and flexibility they will add to the programmer's arsenal; because of the improved readability we expect from programs that use closures instead of the existing alternatives; and because of a number of other recently proposed language extensions that will be unnecessary if closures are added. In order to get the full power of closures, they should capture all lexically scoped semantic language constructs.

The last part of Neal's blog makes the case that anonymous inner classes don't cut it, that they can be made to do the same things as closures, but not cleanly or effectively. Take a look and decide for yourself if this helps make the case for putting closures in the next version of Java SE.


Also in Java Today, the JSR-296 Swing Application Framework prototype implementation is a small set of Java classes that simplify building desktop applications. The prototype provides infrastructure that's common to most desktop applications: application lifecycle, support for managing and loading resources, support for defining, managing, and binding Actions, and persistent session state. "The intended audience for this snapshot is experienced Swing developers with a moderately high tolerance for pain."

Issue 276 of the NetBeans Community Newsletter is out, featuring NetBeans Visual Web Pack 5.5 ML, NetBeans Mobility Pack for CDC 5.5 with Demo, Intel Endorsement of NetBeans, New Hands-On Labs: Java SE 6, Web Services Security, a Cool Tip on Tabs, How to Create a Movie Player, Using the Ajax Map Viewer Component, High-level Introduction to NetBeans IDE & the Community and much more...


In today's Weblogs. James Gosling announces that doc.java.sun.com is alive! (again): "doc.java.sun.com (the javadoc website designed for communal collaborative translation) is finally back up again after a couple of days being dead. It took so long because (tragically) I have a Real Job."

Fabrizio

Filter Blog

By date: