PlanetJava

January 29, 2012

Tim Bray

Street

Over on Google+, there are a lot of photographers. I mean, really a lot. And not just nerd-with-an-OK-camera dabblers like me; we’re talking pros, big-name pros, some of them. Organized in circles, of course; go have a look.

Now, I’ve noticed that some of these people identify themselves as “street photographers”. Says so right there in the titles they put on the pictures. I’m a city boy and I like pictures of city streets, too. Here’s one I took today.

Cambie street, looking south from 18th

But this isn’t like what the real photographers over on G+ call “Street”. They men low-contrast B&W captures of people usually against unremarkable backgrounds. There’s an art to it and occasionally one will snatch at your heart. But most of them are boring to my eye. Which doesn’t bother me that much; tastes vary. It does bother me that apparently “street photography” implies “grey on grey”.

My pictures of streets would be better with people in them; there’s a challenge for me. But anyhow, maybe we need another word for urban photography with a conscious aversion to low-contrast monochrome.

January 29, 2012 06:19 AM

OSDir.com - Java

Oracle's Java Plans Draw Ire

From the Haters dept.:

Oracle, which officially took on the big job of shepherding Java two years ago this month, is traveling bumpy roads lately, with its modularization and licensing plans for Java raising eyebrows and security concerns coming to the fore as well.



Plans for version 8 of Java Platform Standard Edition, which is due next year, call for inclusion of Project Jigsaw to add modular capabilities to Java. But some organizations are concerned with how Oracle's plans might conflict with the OSGi module system already geared to Java. In the licensing arena, Canonical, the maker of Ubuntu Linux, says Oracle is no longer letting Linux distributors redistribute Oracle's own commercial Java, causing difficulties for the company. Meanwhile, security vendor F-Secure views Java as security hindrance.

January 29, 2012 06:01 AM

OSDir.com - Java

Apache Discontinues Independent Java Implementation 'Harmony'

From the DisHarmony dept.:

After the resignation of Apache from the Java SE/EE Executive Committee, the time has now come for Harmony to be added to the Apache Attic. Harmony was 'the project to produce an open source cleanroom implementation of Java.' An open vote was taken within the Project Management Committee, which resulted in a 20-2 majority to discontinue development.

January 29, 2012 06:01 AM

OSDir.com - Java

Java SE 7 Released

From the Grande dept.:

Oracle today announced the availability of Java Platform, Standard Edition 7 (Java SE 7), the first release of the Java platform under Oracle stewardship.

January 29, 2012 06:01 AM

OSDir.com - Java

JDK 7 RC1 Released

From the JDK dept.:

After an initial round of testing we’ve declared build 147 to be the first Release Candidate of JDK 7.



There are only thirteen changes in this build. Over half of them are administrivial updates that don’t affect the actual code; the remainder are true showstoppers, including several hard VM crashes and a JIT correctness bug identified by an Eclipse unit test.

January 29, 2012 06:01 AM

OSDir.com - Java

Java SE 7 Passes JCP

From the Jitters dept.:

The next edition of Java has been approved by a Java Community Process executive committee, but not without some acrimony.

January 29, 2012 06:01 AM

OSDir.com - Java

Oracle Introduces New Java Specification Requests to Evolve Java Community Process

From the Yet Another dept.:

To further its commitment to the Java Community Process (JCP), Oracle has submitted the first of two Java Specification Requests (JSRs) to update and revitalize the JCP.

January 29, 2012 06:01 AM

OSDir.com - Java

Red Hat's top secret Java Killer/Successor: The Ceylon Project

From the Ceylon dept.:

Gavin King of Red Hat/Hibernate/Seam fame recently unveiled the top secret project that he has been working on over the past two years, a new language and SDK designed to replace Java in the enterprise. The project came out of hiding without much fanfare or publicity at QCon Beijing in a keynote titled "The Ceylon Project - the next generation of Java language?".

January 29, 2012 06:01 AM

OSDir.com - Java

No copied Java code or weapons of mass destruction found in Android

From the Fact Checking dept.:

ZDNET: Sometimes the sheer wrongness of what is posted on the web leaves us speechless. Especially when it’s picked up and repeated as gospel by otherwise reputable sites like Engadget. “Google copied Oracle’s Java code, pasted in a new license, and shipped it,” they reported this morning.



Sorry, but that just isn’t true.

January 29, 2012 06:01 AM

OSDir.com - Java

Apache Software Foundation Resigns from Java Community Process

From the So Long dept.:

The Apache Software Foundation has resigned its seat on the Java SE/EE Executive Committee. Apache has served on the EC for the past 10 years, winning the JCP "Member of the Year" award 4 times, and recently was ratified for another term with support from 95% of the voting community. Further, the project communities of the ASF, home to Apache Tomcat, Ant, Xerces, Geronimo, Velocity and nearly a 100 mainstay java components have implemented countless JSRs and serve on and contribute to many of the JCPs technical expert groups.



We'd like to provide some explanation to the community as to why we're taking this significant step.



The recent Java SE 7 vote was the last chance for the JCP EC to demonstrate that the EC has any intent to defend the JCP as an open specification process, and demonstrate that the letter and spirit of the law matter. To sum up the issues at stake in the vote, we believe that while continuing to fail to uphold their responsibilities under the JSPA, Oracle provided the EC with a Java SE 7 specification request and license that are self-contradictory, severely restrict distribution of independent implementations of the spec, and most importantly, prohibit the distribution of independent open source implementations of the spec. Oracle has refused to answer any reasonable and responsible questions from the EC regarding these problems.

January 29, 2012 06:01 AM

OSDir.com - Java

Apache loses Java showdown vote to Oracle

From the Dis Harmony dept.:

The Apache Software Foundation – one of tech's most influential open-source groups – is closer to quitting Java's governing body after losing a stand-off vote against Oracle on Java.



The Reg has learned that with 75 per cent of qualifying Java Community Process (JCP) members having voted on whether to ratify Oracle's proposed roadmap for Java 7 and 8, Oracle's plan has been accepted.

January 29, 2012 06:01 AM

Javable

JUG.RU meeting

JUG.RU will held a scheduled meeting on Feb 23d. Read on for details.

January 29, 2012 06:01 AM

Javable

Happy New Year!

We wish a Happy New Year to all our readers and contributers. Hope to see you all in 2008.

January 29, 2012 06:01 AM

Javable

Ruby on Rails 2.0 released

Ruby on Rails 2.0 has been released. "Rails 2.0 is finally finished

January 29, 2012 06:01 AM

Javable

NetBeans 6.0 released

New version of pure Java IDE has been released, with support for many new

January 29, 2012 06:01 AM

Javable

JUG.RU meeting on November 24th

JUG.RU will be hosting its meeting in Saint Petersburg, Russia, on November 24th. More details in our

January 29, 2012 06:01 AM

Javable

Javable

Google Android SDK is available

The development kit and API for Google mobile platform, Android, has been released.

January 29, 2012 06:01 AM

Javable

Sun phases out mobile Java

Sun will gradually phase out mobile Java (Java Micro Edition) and move respective services to Standard Edition. "We're trying to converge

January 29, 2012 06:01 AM

Javable

Consumer JRE Early Access

Sun has started an early access program to Java SE 6 Update N (formerly known as the "Consumer

January 29, 2012 06:01 AM

Javable

YourKit Java Profiler 7.0 released

The major update to YourKit Java Profiler has been released. Version 7.0 includes

January 29, 2012 06:01 AM

January 28, 2012

Planet Eclipse

Ayushman Jain: Faster Java search using pre-built indexes with Eclipse JDT

JDT indexes referenced libraries (or JARs) in your projects for use in the Java search. However, in most cases these libraries seldom change, and the indexing may be costly and take time when you invoke search for the first time after adding the JAR on the buildpath.



From 3.8M5 onwards, you can avoid this redundant indexing by providing a pre-built index for each classpath entry in the classpath container. This feature was recently implemented in bug 356620.



So how do you generate the indexes in the first place?

1. Create the JAR

2. Go to Run Configurations>Eclipse Application. Give a name to the configuration, viz. indexer, and in 'Main' tab choose Run an application, and use the list to select org.eclipse.jdt.core.JavaIndexer



3. Go to the 'Arguments' tab and use the arguments -option <indexFileLocation> <jarFileLocation> in addition to the existing ones.



4. The index file will be generated at the specified location.


Now when the JAR in question is being added to the build path of a project, the classpath containers can add the index location to classpath, which will look as follows:


<classpathentry kind="lib" path="C:/Users/IBM_ADMIN/Desktop/TestIndex.jar">
<attributes>
<attribute name="javadoc_location" value="file://C://abc"/>
</attributes>
</classpathentry>


Voila! JDT will no longer index the JAR and even the first search will be lightning fast!


Note: This feature is mainly intended for plug-ins that implement their own classpath container, not for the end user.

by Aupsy-The cOOlest One!! (noreply@blogger.com) at January 28, 2012 01:18 PM

Planet Eclipse

Holger Voormann: How to use Vex as a Widget – Article in Eclipse Magazine

Florian’s article on how to use Vex as an editor widget has just been published in the German Eclipse Magazin 2.12. In a sample dialog Vex is used to enter Wiki text in the WYSIWYG way.

Vex is a pure SWT widget and doesn’t require any web browser. It’s an alternative to the solution FCKEditor in a browser widget which Thomas Kratz recently described in his post.

Vex is an acronym for Visual Editor for XML. With Florian’s WYSIWYG Wiki editor we have to rename Vex into Vest: Visual Editor for structured text. ;-)



Flattr this



January 28, 2012 08:38 AM

The Aquarium

Planet Eclipse

Ian Bull: Eclipse Juno Milestone 5, available for download

It’s never to early to start thinking of a Valentines Day gift, and what better gift than that of an excellent IDE!  The Eclipse and Equinox teams are happy to announce that Eclipse Juno Milestone 5 is available for Download.

As I hope everyone is aware, Juno (Coming Summer 2012) is an important release for Eclipse. It represents the transition from an Eclipse 3.x platform to 4.x.  If you plan on shipping products based on Eclipse Juno, make sure you start testing NOW!  This milestone has a number of noteworthy items including:

A great deal of static analysis checks

Null field checks

null analysis prefs Eclipse Juno Milestone 5, available for download

And more resource leak detection:

wrapped resource Eclipse Juno Milestone 5, available for download

There are also some notable UI improvements such as editor navigation arrows:

tab navigation Eclipse Juno Milestone 5, available for download

Checkout the entire New and Noteworthy:

http://download.eclipse.org/eclipse/downloads/drops4/S-4.2M5-201201271145/eclipse-news-M5.html

Or better yet, download the milestone and TEST YOUR PLUGINS!

http://download.eclipse.org/eclipse/downloads/drops4/S-4.2M5-201201271145/index.php

January 28, 2012 12:02 AM

January 27, 2012

Ed Burnette

iPad lead over Android tablets cut in half, say reports, as Kindle Fire surges ahead

Things are looking up for Android tablets, according to two reports released this week. The first report, from the research firm Strategy Analytics, shows global tablet shipments on the rise with Android taking a larger piece of the pie:

“Android captured a record 39 percent share of global tablet shipments in Q4 2011, rising from 29 percent a year earlier. Global Android tablet shipments tripled annually to 10.5 million units. Dozens of Android models distributed across multiple countries by numerous brands such as Amazon, Samsung, Asus and others have been driving volumes.”

The second report comes from mobile analytics firm Flurry. They found:

“In January, after the holiday boom in devices and in apps, we see that strong adoption of Kindle Fire, combined with significant downloads driven from the Amazon App Store, resulted in a massive surge in session usage that just edges out the Galaxy Tab. Unrounded, Kindle Fire represents 35.7% of sessions and Galaxy Tab represents 35.6%. Remarkably, and from a standing start, the Kindle Fire overtook the Galaxy Tab in just a few short months. Total Android tablet sessions in January more than tripled over November, with Galaxy Tab sessions increasing by more than 50%. Overall, Android Tablets are growing aggressively as a category.”

The numbers are not exactly comparable, since the first report looks at new sell-in shipments and covers October-December, while the second looks at total usage for January, but it’s clear that Android tablets are finally getting some traction thanks in part to the success of Amazon’s Kindle Fire.

by Ed Burnette at January 27, 2012 11:09 PM

Planet Eclipse

Ian Bull: Lending a hand with the Eclipse SDK

Shipping Eclipse each year is a lot of work. The SDK contains code from 3 Top level projects (Eclipse, RT and Tools (Orbit)). There are 4+ Products (Platform, JDT, PDE , Equinox + Releng) and close to 20 Components (SWT, Text, UI, UA, etc…).  Once the SDK is built, the release train starts bolting on other projects (Mylyn, EGit, CDT, Birt, WPT, etc..).  Getting all these bits in the right place at the right time isn’t easy (although Kim and David sure makes it look easy).

While some teams are actively working on their components, other components are very mature and simply need some TLC from time-to-time.  There is certainly a number of things we could do with p2, but for the most part it works very well.  Pascal has been donating much of his personal time to p2 in order to give it the TLC and polish it needs. Pascal is pretty smart and 10 minutes of his time equates to an hour for most people icon smile Lending a hand with the Eclipse SDK .  However, it’s not fair that he spends all his free time tracking down problems in order for p2 to makes its contribution to the SDK.

EclipseRT Logo Medium Lending a hand with the Eclipse SDK

I’m happy to say that I’ll be helping Pascal co-lead the p2 project.  There’s a few things I have planned including

  1. Fixing a few recent problems on Java 7 Runtimes
  2. Improving the performance of the UI
  3. Looking at how we can reduce the size of our metadata (content.jar)

I’ll also be presenting some p2 related work at EclipseCon.  If you have questions, I try to hang around IRC and I’m also on twitter (@irbull).

January 27, 2012 10:48 PM

Planet Eclipse

Ekkehard Gentz: mobile development – my next sessions + events

here’s an overview of my upcoming sessions and events and I would be glad to meet you there:

M-Days – Frankfurt, 2012-02-01: Location Based Services

At the Mobile Days in Frankfurt I’m talking about Location Based Services. In many of my customer projects I’m using Location Based Services, have integrated Maps, track GPS etc. I’ll talk about good practices, tips and tricks and demonstrate some of my work. You’ll find me at Developer Stage 1 on Wednesday 2012-02-01 at 13:00.

In the night I’ll also attend the Mobile Media Night ;-)

At M-Days I’ll first time use my new Camholder from Heiko Behrens (@HBehrens) – will later blog about my experiences with heikos awesome new product.

BBDevCon Europe – Amsterdam, 2012-02-08: SuperApps

Only some days later I’ll speak at BlackBerry Developer Conference about developing Super Apps. I’m happy to meet some friends again and looking forward to get the newest informations about BB10 – the future OS for BlackBerry.

Mobile Developer Conference – HH, 2012-02-15: Push Services

More and more mobile applications are using Push Services. Unfortunately there’s no common API and so you have to know the differences and what’s possible on the different platforms. I’ll talk about PushServices for Apple, Google, Microsoft and RIM.

Mobile Tech Con 2012 – Munich 2012 – 2012-03-29: Power Workshop Cascades

Next MobileTechCon is in Munich – not far from Rosenheim, where I work and live. I’ll present a full-day Power Workshop about the new UI Framework Cascades from RIM. With Cascades you can write great apps in a short timeframe with awesome animations. Designers and Developers can work hand-in-hand: a PlugIn for Photoshop allows you to easy move graphical work and drag it into your QML Editor. Cascades is one of te reasons why I as a developer am sure, that RIM will came back in 2012. Using Cascades you can develop Applications for PlayBook 2.x and also upcoming BB10.

EclipseCon America 2012 :(

Unfortunately this time I cannot travel to EclipseCon America, because exactly same week there’s MobileTechCon in Munich.

But of course I’m developing the BlackBerry Conference App for EclipseCon 2012 and hope that the timing is better next year.

—————————————————————————————————————————

(c) 2012 Creative Commons License 3.0 (BY-NC-SA) by  ekkescorner 



Filed under: Blackberry, EclipseCon, mobile

January 27, 2012 05:43 PM

Planet Eclipse

Birt World: BIRT Runtime Addition

As part of the 3.7 release BIRT now uses a BIRT POJO runtime. This change was described in the BIRT 3.7 New and Notable. If you are using a version of BIRT prior to 3.7 be sure to check out the Migration Guide. As part of the 3.7.2 release of BIRT which will be released in a couple of weeks, the team has decided to release a second runtime that uses the OSGi runtime. This new download will function similar to the BIRT runtime prior to BIRT 3.7 and is available on the full downloads page. You can try out the 3.7.2 release candidate version of this download by selecting the release candidate on the recent builds page.



by Jason Weathersby (noreply@blogger.com) at January 27, 2012 03:57 PM

The Aquarium

Planet Eclipse

Ian Skerrett: Dev + Ops = Getting Software Deployed Faster (DevOps)

DevOps is one of those terms you hear a LOT about lately but I am not sure it is really well understood.  However, if you are going to be successful at Agile ALM it would seem natural you would want to bring the operations side of IT closer into the development process.   Puppet is one example of an open source project that is implementing some of the DevOps concepts.

When we put together the program committee for Agile ALM Connect we specifically wanted an expert from the DevOps community to make sure the program had a healthy devops slant.   Therefore, I was thrilled to have Lukes Kanies, the founder of Puppet and CEO of PuppetLabs, agree to be on the program committee and also speak at Agile ALM Connect on ‘what is devops’ and introduce Puppet.    We will also have Kenn Hussey talk about Geppetto, an Eclipse-based Puppet IDE.

In my Q&A series with Agile ALM Connect speakers, Luke answered three questions about DevOps.

1. ‘DevOps’ is a term that is used quite a bit lately.  How do you describe the term DevOps and why should developers care?

DevOps is in to operations what Agile is to development.  Operations needs to be a competitive advantage, adopting new technology quickly and with minimal business interruption, but in many cases the business goals have been lost and the new focus on policy and compliance has allowed IT to become a cost center.  DevOps is about operations teams working closely with everyone involved in product delivery to make sure that business needs come first.  This often involves a lot of automation, but the main thing is about making sure the customer comes first, just like in agile development.

Developers should care because organizations following devops practices will do a better job of supporting them, getting their software deployed faster and more easily.

2. You are the founder of the Puppet open source project.   Why did you start Puppet?

When I started Puppet, the tools and practices in IT had barely changed in ten years.  I was afraid that it would still not have changed in ten more years, and I saw an opportunity to build a better tool and help make the lives of sysadmins better.   Based on how passionate our user base, we seem to have struck a chord.

3. What advice do you have for people that want to learn how to use Puppet? 

First, start small, and fix the most painful things first.  Trying to boil the ocean by automating your whole infrastructure will just frustrate you and have little reward, but if you start by automating the small, menial work in your infrastructure you’ll have quick rewards and, even better, more time available in your day to work on the hard and important stuff.

 



January 27, 2012 04:22 AM

Planet Eclipse

Dave Carver: Does Popularity = Success?

Does the current popularity of an open source project, automatically mean that it is successful?   It can but how do we define successful for an open source project?

Just because a project is popular does not necessarily mean that it is successful.  It just means at that point in time and duration it is also getting a lot of attention.   I’ve been involved with a wide variety of open source projects over the last 15 years.  Several I’ve started. Several I’ve participated in from both as a community member and as a committer.   Some I would say have been popular at one point or another, other’s I would say never hit the “High School” popularity meter thresh hold.

Popularity is defined by Merriam-Webster’s Learner’s dictionary as, “state of being liked, enjoyed, accepted, or done by a large number of people : the quality or state of being popular”.

Successful is defined as “having the correct or desired result.”   So being successful does not necessarily equal popularity.   A successful open source project is one that has met its desired goals and objectives.   One of them could be, to become popular, and blogged about, and tweeted about constantly, but the winds of popularity change at a moments notice.  Success lasts for as long as the project is meeting its stated goals.

Success is defined by the commiters and the community that forms around the project.  Is it meeting its user’s needs?  Is it growing its user community and committer base?  Is it adapting and changing to meet knew requirements?   These are just some of the criteria that a project can be measured on to be successful.  Yes, popularity can be one criteria, but it should not be the sole deciding factor.

We need to be careful on tying success to popularity alone.   There are many projects out there that I would consider successful that have never hit the popularity threshold.  Those projects may not be used by Millions of people, but they have built a community around their project, and provide value to that community.   How many people are using it, or number of companies that have adopted it, should not take away from the success of the project if it has met its objectives.

So success is going to mean different things to different people.  There is no one way to measure if project is successful.  To me, if your project even gets a handful of people forming a community around it, you are already successful.



January 27, 2012 01:24 AM

January 26, 2012

The Server Side

Java is dead? 9 million devs disagree

Java is dead? 9 million and one devs disagree



Add to digg Add to StumbleUpon Add to del.icio.us Add to Google

January 26, 2012 07:22 PM

The Server Side

GWT - Pros and Cons

This article discusses the advantages and disadvantages of GWT



Add to digg Add to StumbleUpon Add to del.icio.us Add to Google

January 26, 2012 07:21 PM

Planet Eclipse

Deepak Azad: Weird code pattern in Eclipse SDK

In recent Juno milestones JDT has added several new static analysis capabilities - resource leak detection (Juno M3), annotation based null analysis (Juno M4), null analysis for fields (Juno M5). This week I have been testing these new features on the entire Eclipse SDK source code. 


While there are quite a few 'gems', the following code pattern occurs quite frequently. If the object can be null at the first if condition, how is it magically guaranteed to be non-null at the second if statement?  :-)




As Stephan mentioned in his blog today - Help the JDT Compiler helping you. Please start using the new static analysis options and report any issues you find. In the process you will certainly make improvements to your code as well.

by Deepak Azad (noreply@blogger.com) at January 26, 2012 05:47 PM

Planet Eclipse

Eclipse Announcements: EclipseCon 2012 Gold Sponsors Announced

The Eclipse Foundation is pleased to announce the Gold sponsors for the upcoming EclipseCon 2012 conference in Reston, Virginia on March 26-29, 2012. Actuate, IBM, Oracle, Red Hat and SAP have all agreed to be the premier sponsors of the annual Eclipse community event.

January 26, 2012 03:29 PM

Planet Eclipse

Stephan Herrmann: Help the JDT Compiler helping you! - 1: Resource Leaks

During the Juno cycle a lot of work in the JDT has gone into more sophisticated static analysis, and some more is still in the pipe-line. I truly hope that once Juno is shipped this will help all JDT users to find more bugs immediately while still typing. However, early feedback regarding these features shows that users are starting to expect miracles from the analysis :)

On the one hand seeing this is flattering, but on the other hand it makes me think we should perhaps explain what exactly the analysis can see and what is beyond its vision. If you take a few minutes learning about the concepts behind the analysis you’ll not only understand its limitations, but more importantly you will learn how to write code that’s better readable - in this case for reading by the compiler. Saying: with only slightly rephrasing your programs you can help the compiler to better understand what’s going on, to the effect that the compiler can answer with much more useful error and warning messages.

Since there’s a lot of analysis in this JDT compiler I will address just one topic per blog post. This post goes to improvements in the detection of resource leaks.

Resource leaks - the basics

Right when everybody believed that Eclipse Indigo RC 4 was ready for the great release, another blocker bug was detected: a simple resource leak basically prevented Eclipse from launching on a typical Linux box if more than 1000 bundles are installed. Coincidentally, at the same time the JDT team was finishing up work on the new try-with-resources statement introduced in Java 7. So I was thinking: shouldn’t the compiler help users to migrate from notoriously brittle handling of resources to the new construct that was designed specifically to facilitate a safe style of working with resources?

What’s a resource?

So, how can the compiler know about resources? Following the try-with-resources concept, any instance of type java.lang.AutoCloseable is a resource. Simple, huh? In order to extend the analysis also to pre Java 7 code, we also consider java.io.Closeable (available since 1.5).

Resource life cycle

The expected life cycle of any resource is : allocate—use—close. Simple again.

From this we conclude the code pattern we have to look for: where does the code allocate a closeable and no call to close() is seen afterwards. Or perhaps a call is seen but not all execution paths will reach that call, etc.

Basic warnings

With Juno M3 we released a first analysis that could now tell you things like:

  • Resource leak: “input” is never closed
  • Resource leak: “input” is never closed at this location (if a method exit happens before reaching close())

If the problem occurs only on some execution paths the warnings are softened (saying “potential leak” etc.).

Good, but

Signal to noise - part 1

It turned out that the analysis was causing significant noise. How come? The concepts are so clear and all code that wouldn’t exhibit the simple allocate—use—close life cycle should indeed by revised, shouldn’t it?

In fact we found several patterns, where these warnings were indeed useless.

Resource-less resources

We learned that not every subtype of Closeable really represents a resource that needs leak prevention. How many times have you invoked close() on a StringWriter, e.g.? Just have a look at its implementation and you’ll see why this isn’t worth the effort. Are there more classes in this category?

Indeed we found a total of 7 classes in java.io that purely operate on Java objects without allocating any resources from the operating system:

  • StringReader
  • StringWriter
  • ByteArrayInputStream
  • ByteArrayOutputStream
  • CharArrayReader
  • CharArrayWriter
  • StringBufferInputStream

For none of these does it make sense to warn about missing close().

To account for these classes we simply added a white list: if a class is in the list suppress any warnings/errors. This white list consists of exactly those 7 classes listed above. Sub-classes of these classes are not considered.

Wrapper resources

Another group of classes implementing Closeable showed up, that are not strictly resources themselves. Think of BufferedInputStream! Does it need to be closed?

Well? What’s your answer? The correct answer is: it depends. A few examples:

1
2
3
4
5
6
7
8
	void wrappers(String content) throws IOException {
		Reader r1, r2, r3, r4;
		r1 = new BufferedReader(new FileReader("someFile"));
		r2 = new BufferedReader(new StringReader(content));
		r3 = new FileReader("somefile");
		r4 = new BufferedReader(r3);
		r3.close();
	}

How many leaks? With same added smartness the compiler will signal only one resource leak: on r1. All others are safe:

  • r2 is a wrapper for a resource-less closeable: no OS resources are ever allocated here.
  • r3 is explicitly closed
  • r4 is just a wrapper around r3 and since that is properly closed, r4 does not hold onto any OS resources at the end.
  • returning to r1, why is that a leak? It’s a wrapper, too, but now the underlying resource (a FileReader) is not directly closed so it’s the responsibility of the wrapper and can only be triggered by calling close() on the wrapper r1.

Summarizing: wrappers don’t directly hold an OS resource, but delegate to a next closeable. Depending on the nature and state of the nested closeable the wrapper may or may not be responsible for closing. In arbitrary chains of wrappers with a relevant resource at the bottom, closing any closeable in the chain (including the bottom) will suffice to release the single resource. If a wrapper chain is not properly closed the problem will be flagged against the outer-most wrapper, since calling close() at the wrapper will be delegated along all elements of the chain, which is the cleanest way of closing.

Also for wrappers the question arises: how does the compiler know? Again we set up a white list with all wrapper classes we found in the JRE: 20 classes in java.io, 12 in java.util.zip and 5 in other packages (the full lists are in TypeConstants.java, search for “_CLOSEABLES”).

Status and outlook

Yes, a leak can be a stop-ship problem.

Starting with Juno M3 we have basic analysis of resource leaks; starting with Juno M5 the analysis uses the two white lists mentioned above: resource-less closeables and resource wrappers. In real code this significantly reduces the number of false positives, which means: for the remaining warnings the signal-to-noise ratio is significantly better.

M5 will actually bring more improvements in this analysis, but that will be subject of a next post.

January 26, 2012 02:32 PM

Planet Eclipse

Chris Daniel: Fedora Eclipse Build: Introduction

It has been almost a month, since I stared my work for Red Hat.



I am taking care of Eclipse Build, which is even more complicated than regular Eclipse build (yes, Kim, that *is* possible).



The first and the most important assumption of Linux Eclipse Build is: no binaries allowed.



Some people call that kind of builds liberating. That is the last word that I'd use now ;-).



I will describe nuances that I have met during preparing Eclipse Juno for Fedora 17 in the following posts, but right now I'd like to mention just the first issue I have met:



If you want to build Eclipse, you need a builder, namely, a PDE Build. It looks like a chicken an egg problem, and the only solution is to build the builder using ant and OpenJDK. There is only one problem with that (OK, one serious problem and a lot of smaller ones that I will skip for now): Eclipse Java Compiler is not consistent with OpenJDK javac, or, stating it more clearly, JDT code cannot be compiled with javac.



That's not a big technical problem, as patching the source code before the build and making it javac compatible (and JDT incompatible) is not a very difficult thing, but it is open a rather serious question.



How does it come to the situation, where you cannot build Eclipse from scratch, but you have to use binaries to build Eclipse? Isn't it a bit against open-source philosophy? Today need we just Eclipse Compiler, which cannot be built (unless customized) from source. Tomorrow may we depend on something far less open.



Would not it make sense to put a requirement on Eclipse that some core plugins must compile with OpenJDK? I do not expect here mirroring all OpenJDK bugs in Eclipse compiler, but at least allowing for true open source build of it...



Here is a bug for those of you who are interested in the cause of the javac problem when building JDT.



In the next post: do Orbit users get what they expect?



EDIT: here is the link to the patch that makes JDT compile with OpenJDK.

by Christopher Daniel (noreply@blogger.com) at January 26, 2012 01:37 PM

Tim Bray

Chinese Workers’ Problems

This New York Times story, telling ugly stories of human suffering at Chinese outsourcers, isn’t about Apple. It’s pure politics and economics.

It’s Simple

The management of well-connected Chinese companies needn’t worry much about regulation or law enforcement, because China is governed by a corrupt autocracy. They needn’t worry much about unions or other worker activism because that government has as a matter of industrial policy disempowered labor, making real unionism impossible.

We’ve seen this movie before. The description of 21st-century Chinese political reality applies pretty well to 19th-century Europe. Not surprisingly, so do the descriptions of the sufferings of industrial laborers.

History says: The systemic pressures of capitalism will always, in the absence of countervailing forces, lead to brutal exploitation. Fortunately, history also teaches that capitalism can still create prosperity even when fenced in with safety, environmental, and labor-law regulation.

Some will push back, pointing out that China’s policies have lifted the best part of a billion people out of grinding rural poverty; also that people take Foxconn jobs eagerly because they are an escape from the village.

I stand by my point; Europe’s industrial revolution’s backdrop was a mass migration out of the countryside, and people lined up for jobs in Dickens’ dark satanic mills because it was better than starving down on the farm.

That’s not good enough. It seems to me that it should hardly need saying that just because there are worse alternatives, it’s not OK to brutalize people so that people in my timezone can pay less for electronic lifestyle baubles.

Something’s Gotta Give

In the short term, the most likely outcome is: no change. In a society where there’s no transparency and no rule of law, it will remain possible, and immensely profitable, to sweep the problems under the rug, dodge accountability, and continue with Business As Usual.

But not for long, where “long” is measured in generations. I suspect that the longer we go on with Business As Usual, the more violent will be the inevitable breakthrough to modernity.

But I’m optimistic. Europe figured out that messy, petty, parliamentary politics leading to a messy, petty, regulatory framework are sort of optimal, if by “optimal” you mean “we haven’t been able to figure out anything better”. I haven’t seen any evidence that the Chinese aren’t as smart or courageous as my ethnic group; given the same opportunities, there’s no good reason they shouldn’t get the same or better results.

Prediction

I totally guarantee this one: Eventually, the cost of buying anything that requires human intervention in the manufacturing process is going up. The sooner the better.

January 26, 2012 09:53 AM

The Aquarium

JCP.next with merged Executive Committee - JSR 355

The latest JSR filed is #355 and it's not a technical one - "JCP Executive Committee Merge". As the name implies this is about merging the current ME and SE/EE executive committees into a unified one.

If you've been following carefully the changes planned for the JCP, the 2-step process turned into a 3-step evolution:

1/ JSR 348, JCP transparency

2/ Merging the two existing Executive Committees

3/ Sorting out the more complicated legal issues

ALT_DESCR

If you're curious about the role of the executive committee members, check out this page on JCP.org. Hint: voting on JSRs is part of it, but there's more. The JSR Review Ballot starts on February 7th.

by alexismp at January 26, 2012 07:00 AM

Planet Eclipse

Eclipse Announcements: Program Announced for the OMG/Eclipse Workshop

The Eclipse Foundation and OMG are pleased to announce the program for the third Eclipse/OMG Workshop on open specifications and open source software. The Workshop will occur on Sunday, March 25 in Reston, Virginia at the same location as EclipseCon 2012.

January 26, 2012 06:50 AM

Planet Eclipse

Lars Vogel: The end of Eclipse 3.x

Currently we have in my option the unfortunate situation that Eclipse did fork itself into a 3.x and 4.x stream.

Fortunately this is going to change.

I think it is worth to put emphasis on the statement of Mike Milinkovich.

Quote: As of the Juno release, Eclipse 4 is going to be the base platform for the Eclipse ecosystem. [SNIP] Eclipse 3.8 will also ship as part of the Juno release, but currently there are no 3.x releases planned after that..

I think its great the the platform gets ride of the two code lines.

For users this means that they should give the Eclipse 4.2 milestones a try. For Eclipse projects this means that they should test their plug-ins based on Eclipse 4.2.

For vogella.de this mean that I should update my Eclipse RCP tutorials.

Both should report bugs in case they find issues.

Happy bug hunting!

flattr this!

January 26, 2012 05:40 AM

Planet Eclipse

Tasktop Team: Why I joined Tasktop

I’ve long been an admirer of Tasktop, for a number of reasons: First, as Eclipse users already know, Tasktop has built some really cool Eclipse technology, including the Mylyn task-focused interface. But many companies have built cool open source tools. It’s much harder to take those tools and build a growing, dynamic company around them. But plenty of companies have also done that, usually by following the standard open source business model: package services and a bit of value-add around a captive open-source offering, and wait for customers. Tasktop takes a far more challenging and rewarding approach: It nurtures a healthy open source eco-system around core technologies, but then re-imagines and re-purposes them, leveraging unique products that address real customer pain. That takes real vision, and to me it’s a clear signal that the Tasktop leadership is able to imagine and execute at an entirely different energy level.

So rather than admire Tasktop from a distance, I joined it! I first worked with Tasktop last year as a consultant developing the initial implementation of what has become the Mylyn Model Focusing Tools project. That was a great opportunity to get to know some of the team and the Tasktop way. Everything I saw then fit nicely with what I’d already intuited. We have a really great combination of engineering excellence, creativity and lightweight organization.

It’s nice to say “we” again — I hadn’t realized just how much I’d missed having colleagues to work together with on challenging problems. The morning I joined Tasktop, I saw a stream of emails from everyone welcoming me to the team. I must admit to some cynicism about the whole “team” thing — like so much else, it can be an empty word that doesn’t match up to reality — but in this case it feels very genuine. So heartfelt thanks to everyone.

It’s an exciting time to be building software tools. It might sound funny, but I like to think of software development as a helping profession. That’s because I think that software products really can help people live more fulfilling, interesting and even happy lives. When I tell my family and non-techie friends that I’m working on Automated Lifecycle Management (ALM) tools I get a blank look. So instead I remind them that almost everything we do relies on software and that software programs are by far the the most complex artifact that humans have ever created. And I tell them that software development communities are growing ever more diverse, distributed, interwoven and complex. So what do we do at Tasktop? We build software that embraces those complexities.

Tasktop Dev tackles the issue of software complexity. It handles a lot of the repetitive and boring stuff, simplifies and clarifies everything else, and is deeply and imaginatively integrated with other development tools. Tasktop Sync and Code2Cloud — along with other exciting tools that we’re working on — tackle the even more challenging issue of community complexity. Even a relatively small software product might involve code developed by a rich community spanning companies, technologies, continents, and even (think about the Open-Source movement) different economic models and incentive systems. And in larger projects thousands of developers might be collaborating across all of these dimensions. Software development efforts are intimately connected with customers, management, marketing, support, regulators and every other imaginable kind of stakeholder. All of these people need to talk to one another, and it seems that everyone uses different tools to manage the unique aspects of their tasks or work environments. Tasktop builds software that helps those tools to work together so that everyone can focus together on the stuff that matters. In short, we break down boundaries and help people communicate. That’s worth doing.

January 26, 2012 12:09 AM

January 25, 2012

Tim Bray

Size Still Matters

I have to carry two phones; one for G-stuff, which is often unreleased software running on unreleased hardware, and another for my personal life. For the last few months, the G-phone has been a Galaxy Nexus and the Tim-phone a Nexus S.

I noticed right from the start that I was always using the bigger one whenever there was a choice, and I assumed that was just Ice Cream Sandwich being so much nicer than Gingerbread. But now they’re both running the same software and I’m still using the GN for everything.

[Sorry, Google, yes I have texted my kid and looked up map destinations on the “company” phone that you’re paying for.]

Yeah, there are a few occasions where I have to wiggle the phone around in my hand to reach some part of the screen. But the huge display and the soft buttons just make the Nexus S feel dinky and stupid and clumsy.

Remember, “data” is not the plural of “anecdote”. But unless I’m weird, big-screen phones are going to be appealing to lots of people.

January 25, 2012 10:44 PM

Planet Eclipse

Ralf Sternberg: Javascript validation with JSHint in Eclipse

Besides all the Java code in the RAP project, we also have more than 250 JavaScript files which total up to 75k lines of code. For such an amount of code, you should have some kind of code analysis that detects common coding problems like unintentional global variables. We use the JSEclipse plug-in for JavaScript editing which detects some, but not many JavaScript problems.

A while ago, we’ve tried to use JSLint, a tool written by JavaScript guru Douglas Crockford. Unfortunately, this tools produces several thousand warnings on our code base, many of them were not really problems but debatable coding style issues and there was no way to turn them off. JSLint’s lack of customizability recently lead to a fork named JSHint that is going to provide more flexible configuration options.

Like JSLint, JSHint is written in JavaScript, but can be run on the command line using tools like Rhino or JavaScriptCore. I tried JSHint on our codebase with good results using a shell script that runs it on top of Rhino. Unfortunately, checking all our 250+ *.js files keeps my machine busy for 5 minutes and 40 seconds and effectively turns it into a fan heater. This is not because JSHint itself is so demanding, but because for every file, a JVM has to be started, Rhino has to be loaded, then Rhino has to parse and load the JSHint JavaScript library, and then finally, jshint can parse and validate the source file.

Encouraged by the good results I tried to find a solution that doesn’t have this overhead. And as an Eclipse hacker and user, I certainly wanted to integrate the tool into my daily working environment. The result is a simple, yet efficient JSHint Eclipse integration that validates the same bunch of *.js files in less than 15 seconds.

jshint eclipse screenshot Javascript validation with JSHint in Eclipse

This speedup could be achieved by exploiting the way Eclipse builds projects: It uses the same builder instance to visit all files of the project recursively. That makes it possible to load and configure the JSHint library only once for the entire project and reuse it for all files being checked. Of course, validating all files of a project is only necessary for a full rebuild. During normal work, single files are being validated instantly when they have changed.

Although the configuration options are still somewhat basic, this integration proved to be very helpful already. I thought that it may be useful for others as well and decided to build and publish a first version. It’s available on the jshint-eclipse page. There’s an update site that let’s you install the plug-in right into your Eclipse IDE. If you find the plug-in useful, have ideas for improvements, find a problem or want to contribute, I’m happy to hear about it. To report problems, please use the github issue tracker.

January 25, 2012 10:07 PM

Planet Eclipse

Chris Aniszczyk: Kepler

Just to let everyone know, some members of the eclipse.org community recently voted on naming the next simultaneous release after Juno gets released in June 2012. Taking input from the community, the Eclipse Planning Council finalized the name to be Kepler.

Personally, I think it’s a great choice and a nod to Johannes Kepler.

January 25, 2012 07:08 PM

The Aquarium

Upcoming JavaOne conferences. Around the World.

JavaOne

Building on the successful Java One San Francisco and Latin America editions in 2011, the conference is on the road to three international destinations : Tokyo, Moscow and Hyderabad. Here are the details :

JavaOne Tokyo (Japan)

Date: April 4-5, 2012

Location: Academy Hills 49F, Roppongi Tokyo

Event Web site : Japanese | English

JavaOne Moscow (Russia)

Date: April 17-18, 2012

Location: Crocus Expo, International Exhibition Center

JavaOne Hyderabad (India)

Date: May 3-4, 2012

Location: Hyderabad International Convention Center

We're looking forward to meeting you at one of those events to chat anything Java EE and GlassFish!

By the way, the dates for JavaOne 2012 San Francisco are September 30th - October 4th and registration is open already.

by alexismp at January 25, 2012 07:00 PM

Planet Eclipse

Blaise Doughan: JAXB and Inhertiance - Using XmlAdapter

In previous posts I have covered how to map inheritance relationships in JAXB. This can be done by element name (via @XmlElementRef), by the xsi:type attribute, or in EclipseLink MOXy using another XML attribute (via @XmlDescriminatorNode/@XmlDescriminatorValue).  In this post the type indicator will be an XML attribute/element unique to that type, and we will leverage an XmlAdapter to implement this behaviour.



Read more »

by Blaise Doughan (noreply@blogger.com) at January 25, 2012 11:09 AM

Java.net Weblogs

Vulcan-ized Rhino: Telepathic Power for your Code

In this article we coax the JVM's Rhino (an elusive, misunderstood, and ignored member of the ecosystem) into a mind meld, giving it access to the JVM's thoughts, experiences, memories, and knowledge; and take it where no Rhino has gone before !

Let me set the context with some quick code:

ScriptEngineManager sem = new ScriptEngineManager(); 
ScriptEngine jsEngine = sem.getEngineByName("javascript"); 
    ... 
String message = "Hello rhino!"; 
    ... 
jsEngine.eval("println(message)");

Everyone knows that this code does not work (it produces a "ReferenceError: "message" is not defined"). To make it work the variable message must be put into the script engine's bindings, as described in these articles. That's easily done. But the overhead and distraction of the extra boilerplate makes the body of code much less intuitive. (The 4-line example above already has 2 lines of distracting boilerplate!)

A Quick Example

What can we do to make something as simple as "println(message)" in a script just work? In fact, let's raise the bar some more. Take a look at Sqrt.java. Let's say you were explaining that code to a novice, and wanted to provide a probe into the while loop of the running program, by adding the line in red:

    ...
while (Math.abs(t - c/t) > epsilon*t) {
    t = (c/t + t) / 2.0;
    if (args.length == 2) 
        VulcanRhino.eval(args[1]);
}
    ...

Think of class VulcanRhino as your friendly telepathic pachyderm, and eval() its static, void JavaScript evaluator. The idea is that a JavaScript snippet could be passed into the program as an optional second command-line argument. That snippet (specified at run time) could contain logic with references to any of the in-scope Java variables. The code above is a simple example. But this approach allows you to include any number of VulcanRhino.eval()s, located wherever the invocation of a static void function would be legal, each executing a different script. Each invocation of VulcanRhino.eval() has access to all in-scope variables at its location.

Our modified Sqrt.java would run normally (doing nothing unusual) if run with just one command-line argument, but giving it a second argument awakens the slumbering telepath. Here are a few sample runs (the different colors separate the command line from the program's output) ...

See how "t" evolves Track value of "c/t"
> java Sqrt 49 "println(t)"
49
25
13.48
8.557507418397627
7.141736912383411
7.001406475243939
7.000000141269659
7.000000000000002
> java Sqrt 49 "println(c/t)"
1
1.96
3.635014836795252
5.725966406369197
6.861076038104466
6.9985938072953795
6.999999858730344
7.000000000000002

The last line of output (struck out) is not from the script, but is the program's normal 1-line output. The examples above use scripts to track the values of "t" and "c/t" respectively. But you are free to pass in any expression that makes sense at the location of VulcanRhino.eval(). You may even use it for something completely unforeseen ...

Timing the loop Memory problem?
> java Sqrt 49 

"println(java.lang.System.

currentTimeMillis())"
1327399502966 1327399502970 1327399502973 1327399502974 1327399502975 1327399502976 1327399502977 7.000000000000002
> java Sqrt 49 

"println(java.lang.Runtime.

getRuntime().freeMemory())"
30472936 30472936 30472936 30472936 30308384 30308384 30308384 7.000000000000002

The one thing you can not do with a script in this way is to assign a value to a variable.

The Vulcan-Rhino User Guide

To use this approach, you must pre-process your source-code using a tool described below. This step is the key to the magic -- it augments each VulcanRhino.eval() in your code with something that gives it access to all the in-scope variables. So, proceed as follows:

  • edit your program (say Sqrt.java), adding VulcanRhino.eval()s as required, and save it with a different name (say SqrtVR.java)
  • pre-process SqrtVR.java following instructions below. Save the output as Sqrt.java. Note: this overwrites any other Sqrt.java
  • run as usual, making sure that class VulcanRhino is on the classpath. The VulcanRhino.java source should be compiled and deployed as required.

To pre-process a file use the following command:

java >Sqrt.java -cp VLL4J.jar net.java.vll.vll4j.api.Vll4j VulcanRhino.vll SqrtVR.java

The files used are described below:

If you have trouble with the above steps, check the following:

  • does a SqrtVR.java file exist?
  • have you edited SqrtVR.java to add VulcanRhino.eval(args[1])
  • copy and paste the command line above directly
  • ensure VulcanRhino has been compiled and exists on the classpath

How Does it Work?

Let's first get VulcanRhino out of the way. Observe that eval() does nothing special, but there is another function defVars() that enables the caller to inject information about variables into the JavaScript engine.

import javax.script.ScriptContext;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;

public class VulcanRhino {
    public static void eval(String script) {
        try {
            engine.eval(script);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    public static void defVars(Object... args) {
        engine.getBindings(ScriptContext.ENGINE_SCOPE).clear();
        for (int i = 0; i < args.length; i += 2) {
            String name = (String)args[i];
            Object value = args[i + 1];
            engine.put(name, value);
        }
    }
    static ScriptEngine engine = new ScriptEngineManager().getEngineByName("javascript");
}

Next take a look at the pre-processed version of Sqrt.java.

    ...
while (Math.abs(t - c/t) > epsilon*t) {
    t = (c/t + t) / 2.0;
    if (args.length == 2)
        {VulcanRhino.defVars("epsilon", epsilon, "c", c, "t", t, "args", args); VulcanRhino.eval(args[1]);}
}
    ...

The part you added is still in red. But the pre-processor has spliced in the blue text. The pre-processor makes this change at each occurrence of VulcanRhino.eval(...), injecting information about the locally visible variables into the JavaScript engine.

Pre-Processor Internals

I won't go into all the details here, presuming that not everyone is interested. So the remaining part of the article is a short summary of the technique together with links to all the other material you will need to understand the details.

The pre-processor uses a parser for the Java language to analyze your program and obtain information about which variables are visible at each VulcanRhino.eval(...) location. It then modifies the source code by wrapping each VulcanRhino.eval(...) in a block ({ ... }) preceded by a VulcanRhino.defVars(...) call that injects the information required into the JavaScript engine.

The parser-generator used is the easily learned, completely visual tool VisualLangLab. For an introductory tutorial look at A Quick Tour. Scala programmers will find Rapid Prototyping for Scala useful too.

The last piece of the puzzle is in the grammar file VulcanRhino.vll. This file contains a Java grammar modified with action functions that perform the pre-processing. To examine the grammar, its rules, and the code in the action functions, proceed as follows:

  • double-click VLL4J.jar (the same file used in the pre-processing step described above). this will start up the VisualLangLab GUI as shown in Figure-1 below
  • select "File" -> "Open" from the main menu, choose the grammar file VulcanRhino.vll, then click the Open button
  • in the rule-tree (the JTree at the left of the GUI) select (click on) the node just below the root node (see red arrow). This will cause the action-code associated with this parser-rule to be displayed under Action Code (right side of the GUI). This is the code (in JavaScript) that pre-processes your code

Using VisualLangLab

Figure-1 VisualLangLab GUI with VulcanRhino grammar loaded

The information used by the action-code above is in several global variables (VLL members). That information is gathered by other action-code in other rules. To examine all the remaining code proceed as follows:

  • select the rule named block (use the combobox in the toolbar), and click on the reference node labeled blockStatement
  • select the rule variableDeclaratorId, and click on the sequence node just below the root node
  • select statement, click on the node just below the token node for FOR

If you do want to pursue this further, a thorough reading of A Quick Tour is strongly recommended. You will also need AST and Action Code and Editing the Grammar Tree.

AttachmentSize
Using-VisualLangLab.png49.78 KB

by sanjay_dasgupta at January 25, 2012 08:59 AM

The Server Side

ZK with Non-relational Database mongoDB

A series of articles that guides you through the development of a non-relational database driven ZK application using mongoDO Java Driver, Morphia and Spring Data.



Add to digg Add to StumbleUpon Add to del.icio.us Add to Google

January 25, 2012 08:30 AM

The Aquarium

Help shape the future of GlassFish (we're hiring)!

The team is looking for talent to help build the future of our application server. If you are interested, check out this job posting. Here's an extract :

"Technical lead, design and develop features to manage the configuration of clustered, highly available deployments in elastic cloud environments that delivers massive scalability."

ALT_DESCR

This is a job based in the US to work on the admin infrastructure, including on PaaS features.

by alexismp at January 25, 2012 07:00 AM

Java.net Weblogs

Getting Started (Very Preliminarily) with JavaFX 2.1 Developer Preview on Linux

Yesterday, Jonathan Giles announced that the JavaFX 2.1 Developer Preview, build 09, is available for Windows, Mac and Linux! Jonathan says, "From here on out we'll be putting out developer preview builds for all three platforms." That this is news that a lot of people have been long awaiting is shown by the immediate response (seven comments) to Jonathan's brief (three sentences) announcement.

I've been waiting for this myself, since I'm starting work on a new open source project (related to efficient use of multicore processors in desktop applications), and I've wanted to be able to use JavaFX as a front end for my demos (or, at least offer it as an option). My preferred platform is Linux (though I also have an old MacBook and a Windows machine). My primary development machine runs CentOS 5.5 (equivalent to RedHat Enterprise Linux, but with no non-free packages).

So, let's get started!

Before you download JavaFX 2.1 build b09, you must accept the OTN License Agreement (I looked for a link to the license, just for reference, but didn't immediately find it). Also, I had to log in to my Oracle account in order to actually receive the download.

The Mac OS X and Linux downloads are in zip format. Once I'd logged in, I was able to save the file, javafx_sdk-2_1_0-beta-b09-linux-i586-17_jan_2012.zip, onto my system. At present, there isn't a link that provides installation instructions for the Linux edition. An


unzip javafx_sdk-2_1_0-beta-b09-linux-i586-17_jan_2012.zip

creates a javafx-sdk2.1.0-beta directory. Diving into that, you'll see COPYRIGHT.html, README.html, THIRDPARTYLICENSEREADME.txt, and directories bin, docs, rt, and tools. README.html sends you to Oracle's JavaSE README page, which includes README's for the JavaFX 2.0 runtime and SDK. So, that's not your path to installing JavaFX 2.1 on Linux.

Poking around a bit more, it suddenly dawned on me that maybe the unzip operation itself was the install. Aside from PATH settings, of course (since I did the unzip in a somewhat arbitrary location).

The docs subdirectory consists of documentation of the API itself. The bin subdirectory contains the javafxpackager, a shell script internally documented as being the "JavaFX Packager tool execution script for Linux/Solaris/OS X."

It's interesting that OS X is lumped in with Linux and Solaris, right? So, I clicked the Mac OS X installation instructions and release notes link, which brings you to a page titled "JavaFX 2.1 Developer Preview for Mac OS X Release Notes." This page includes a link to instructions for setting up NetBeans with JavaFX 2.0 -- which is how I was planning on getting started anyway. It also talks about the JavaFX Samples available on the downloads page; but, again, there is no link for "Linux" in that section of the page.

The next step in my investigation will be to see if I can get any of the simple Mac OS samples work under Linux. Whether that works out or not, the step after that will be to see if I can make my own first very simple JavaFX app that runs on CentOS Linux.


Java.net Weblogs

Since my last blog post, several people have posted interesting new java.net blogs:


Poll

Our current java.net poll asks for your response to In 2012, job opportunities for Java/JVM developers will.... Voting will be open until Friday, February 3.


Articles

Our latest Java.net article is Michael Bar-Sinai's PanelMatic 101.


Java News

Here are the stories we've recently featured in our Java news section:


Spotlights

Our latest java.net Spotlight is Markus Eisele's The Heroes of Java: Trisha Gee:

The 11th part of my "Heroes of Java" interview series. Thanks for following it! Stay tuned for the next parts! Trisha is a developer at LMAX, the London Multi Asset eXchange. She's been working in financial markets for the last 5 years or so...

Subscriptions and Archives: You can subscribe to this blog using the java.net Editor's Blog Feed. You can also subscribe to the Java Today RSS feed and the java.net blogs feed. You can find historical archives of what has appeared the front page of java.net in the java.net home page archive.

-- Kevin Farnham

Twitter: @kevin_farnham

by editor at January 25, 2012 12:21 AM

January 24, 2012

Planet Eclipse

Felipe Heidrich: How to load content in your IFRAME

When we started the TextView we used an IFRAME as the top most element.Over the time we changed the way we load the content of the IFRAME a few times, in this blog I will go over what we learnt in the process.

In our first version we made the entire initialization of the text view synchronous. That was done using this strategy:



var iframe = document.createElement("IFRAME");

parent.addChild(iframe);

var frameWindow = iframe.contentWindow;

var frameDocument = frameWindow.document;

var html = "<!DOCTYPE html><HTML><HEAD>";

for (var i = 0; i < stylesheets.length; i++) {

var objXml = new XMLHttpRequest();

objXml.open("GET", stylesheets[i], false);

objXml.send(null);

html += "<STYLE>" + objXml.responseText + '</STYLE>';

}

html += "</HEAD><BODY></BODY></HTML>";

frameDocument.open();

frameDocument.write(html);

frameDocument.close();

// call method to create all other elements

createElements(frameDocument.body);

This method works on all browsers but is not without limitations.

First, it is possible that iframe.contentWindow is undefined. This happens when the parent is not connected to the DOM.Another similar problem is that the parent (or an ancestor of it) can be hidden, in which case the browser can choose to notapply any styling to it.

The second problem is using STYLE instead of LINK to include the css files. In order to use STYLE we need to download all the filessynchronously one after the other. Another problem using STYLE is that all the URIs in the CSS are relative to the page base URI, which causes problemsduring deployment.

The solution for these problems is to wait for the load event of the iframe to write the html and to use LINK to include the css files:



var iframe = document.createElement("IFRAME");

var iframeLoaded = false;

iframe.addEventListener("load", function() {

if (iframeLoaded) return;

iframeLoaded = true;

var frameWindow = iframe.contentWindow;

var frameDocument = frameWindow.document;

var html = "<!DOCTYPE html><HTML><HEAD>";

for (var i = 0; i < stylesheets.length; i++) {

html += "<LINK rel='stylesheets' type='text/css' href='" + stylesheets[i] + "'></LINK>";

}

html += "</HEAD><BODY></BODY></HTML>";

frameDocument.open();

frameDocument.write(html);

frameDocument.close();

createElements(frameDocument.body); // BAD CSS is not done loading

}, false);

parent.addChild(iframe);

This code is step forward, it solves the problem when iframe.contentWindow is undefined.Using LINK also means that all files are downloaded in parallel and there is no problems with relatives URI inside the CSS.

The main problem with the code above is that the CSS are not loaded at the time body is being accessed. The solve this problem our initialsolution was to use the load event for the frameWindow:



var iframe = document.createElement("IFRAME");

var iframeLoaded = false;

iframe.addEventListener("load", function() {

if (iframeLoaded) return;

iframeLoaded = true;

var frameWindow = iframe.contentWindow;

var frameDocument = frameWindow.document;

var html = "<!DOCTYPE html><HTML><HEAD>";

for (var i = 0; i < stylesheets.length; i++) {

html += "<LINK rel='stylesheets' type='text/css' href='" + stylesheets[i] + "'></LINK>";

}

html += "</HEAD><BODY></BODY></HTML>";

frameDocument.open();

frameDocument.write(html);

frameDocument.close();

var windowLoaded = false;

frameWindow.addEventListener("load", function() {

if (windowLoaded) return;

windowLoaded = true;

createElements(frameDocument.body);

}, false);

}, false);

parent.addChild(iframe);

Here is where things get ugly, there are number of problems:

  • Firefox does not send any load events when document.write() is called from the iframe load handler.
  • calling document.write() not from the iframe load handler causes Firefox to change the navigation history.
  • Chrome some times does not fire load events for the iframe window (when navigating back or forward).
  • Safari sends the load event for the iframe before the CSS is loaded.
  • Webkit sends the load event for the iframe before the CSS is loaded, adding a SCRIPT element after the last LINK element fixes it for Webkit.
To workaround the problems listed above the next version includes a timer:



var iframe = document.createElement("IFRAME");

var iframeLoaded = false;

iframe.addEventListener("load", function() {

if (iframeLoaded) return;

iframeLoaded = true;

var frameWindow = iframe.contentWindow;

var frameDocument = frameWindow.document;

var html = "<!DOCTYPE html><HTML><HEAD>";

for (var i = 0; i < stylesheets.length; i++) {

html += "<LINK rel='stylesheets' type='text/css' href='" + stylesheets[i] + "'></LINK>";

}

html += "<SCRIPT>var waitForStyleSheets = true;</SCRIPT>";

html += "</HEAD><BODY></BODY></HTML>";

frameDocument.open();

frameDocument.write(html);

frameDocument.close();



var done = false;

frameWindow.addEventListener("load", function() {

if (done) return;

if (frameDocument.readyState === "complete") {

done = true;

createElements(frameDocument.body);

}

}, false);

var createTimer = function() {

if (done) return;

if (frameDocument.readyState === "complete") {

done = true;

createElements(frameDocument.body);

} else {

setTimeout(createTimer, 10);

}

}

setTimeout(createTimer, 10);

}, false);

parent.addChild(iframe);

The version above is almost our current solution. Except that it does not work on Firefox. For some reason, on Firefox the frameDocument.readyState stays permanently set to "interactive" when document.write() is called from the iframe load handler. The only way we found to detected that all CSS are loaded was checking the cssRules of each stylesheet (thank you Mihai).



var iframe = document.createElement("IFRAME");

var iframeLoaded = false;

iframe.addEventListener("load", function() {

if (iframeLoaded) return;

iframeLoaded = true;

var frameWindow = iframe.contentWindow;

var frameDocument = frameWindow.document;

var html = "<!DOCTYPE html><HTML><HEAD>";

for (var i = 0; i < stylesheets.length; i++) {

html += "<LINK rel='stylesheets' type='text/css' href='" + stylesheets[i] + "'></LINK>";

}

html += "<SCRIPT>var waitForStyleSheets = true;</SCRIPT>";

html += "</HEAD><BODY></BODY></HTML>";

frameDocument.open();

frameDocument.write(html);

frameDocument.close();



var done = false;

frameWindow.addEventListener("load", function() {

if (done) return;

if (frameDocument.readyState === "complete") {

done = true;

createElements(frameDocument.body);

}

}, false);

var createTimer = function() {

if (done) return;

var ready = false;

if (frameDocument.readyState === "complete") {

ready = true;

} else if (frameDocument.readyState === "interactive" && isFirefox) {

var sheets = frameDocument.styleSheets;

if (sheets.length === stylesheets.length) {

var index = 0;

while (index < sheets.length) {

var count = 0;

try {

count = styleSheets.item(index).cssRules.length;

} catch (ex) {

//invalid access error means the css is not loaded

if (ex.code !== DOMException.INVALID_ACCESS_ERR) {

//other errors, like network security, assume the css is loaded

count = 1;

}

}

if (count === 0) { break; }

index++;

}

ready = index === sheets.length;

}

}

if (ready) {

done = true;

createElements(frameDocument.body);

} else {

setTimeout(createTimer, 10);

}

}

setTimeout(createTimer, 10);

}, false);

parent.addChild(iframe);

This is all the code that was needed to load the content into the iframe - somewhat extreme if you'd ask me. Probably the most pertinent question is why we are using an iframe, the answer to that is definitely another post...

by Felipe Heidrich (noreply@blogger.com) at January 24, 2012 09:51 PM

The Server Side

Agile Before there was Agile: Egoless Programming and Step-by-Step

This article discusses two key ideas underlying modern Agile development practices, Egoless Programming and the Step-by-Step method



Add to digg Add to StumbleUpon Add to del.icio.us Add to Google

January 24, 2012 08:58 PM

The Server Side

Scan your code for open source with Antelink's SourceSquare

Antelink proposes SourceSquare 1.1, a free and open source tool to scan and visualize the open source files you have in your code.



Add to digg Add to StumbleUpon Add to del.icio.us Add to Google

January 24, 2012 08:58 PM

Planet Eclipse

Felipe Heidrich: Using the Orion Editor with Almond

In my last post I gave instruction how to use the Orion Editor without requirejs, since then the code changed quite a bit and the instructions in the last post no longer work. We changed all the editor files to follow the AMD spec (you can find more details about this change here). It is still possible to use the editor without requirejs but you will need to use an AMD "shim" loader. The one I recommend is almond.

To illustrate how to use the editor with almond I decided to write an simple application for that. It is actually an upgrade of the code snippet written by Andrew Niefer in this post. You can find my version of the code in gist.

Besides changing the snippet to use requirejs I have also added a few extra features.

Here are the instructions:

First, in your blog post add a pre element with the attribute name set to "orion".

Then, in the class attribute you can specify the following parameters:

  • writable - if set the element is writable.
  • ruler - if set the line numbering ruler is shown.
  • js - use the javascript syntax highlight styler.
  • java - use the java syntax highlight styler.
  • css - use the css syntax highlight styler.
  • html - use the html syntax highlight styler.
Last, at the end of your blog added these lines:


<script src="http://planetorion.org/editor/orionformatterbuilt.js"></script>

<script type="text/javascript">

require("examples/textview/orionformatter");

</script>

Here is an example:


<pre name="orion" class="js ruler writable">

var this = "is some javascript code";

</pre>

This gets rendered to:


var this = "is some javascript code";

Now that the introduction part is over I'd like to talk about the process I used to create the orionformatterbuilt.js file which is the compiled version of orionformatter.js.

First lets take a look at what a html page with requirejs needs to do use orionformatter.js:



<!DOCTYPE html>

<html>

<head>

<script data-main="orionformatter" src="../../requirejs/require.js"></script>

<script type="text/javascript">

require({

baseUrl: '../..'

});

</script>

</head>

<body>

<h3>Orion Text View Demo: using Orion Formatter and RequireJS</h3>

<pre name="orion" class="js writable ruler" style="border: 1px solid teal;">

/* Some js code */

function log (text) {

var console = window.document.getElementById('console');

showConsole();

}

</pre>

</body>

</html>

It only needs to include "requirejs/require.js" and point data-main="orionformatter", very clean. The second script element setting the baseUrl was just necessary because our directory structure is a bit different.

The next step is to replace requirejs by almond.



<!DOCTYPE html>

<html>

<head>

<script src="/examples/textview/almond.js"></script>

<script src="/examples/textview/orionformatterbuilt.js"></script>

<script src="/examples/textview/orionformatter.js"></script>

<script src="/orion/textview/eventTarget.js"></script>

<script src="/orion/textview/textModel.js"></script>

<script src="/orion/textview/keyBinding.js"></script>

<script src="/orion/textview/textView.js"></script>

<script src="/orion/textview/projectionTextModel.js"></script>

<script src="/orion/textview/tooltip.js"></script>

<script src="/orion/textview/rulers.js"></script>

<script src="/orion/editor/regex.js"></script>

<script src="/orion/editor/textMateStyler.js"></script>

<script src="/orion/editor/htmlGrammar.js"></script>

<script src="/orion/textview/annotations.js"></script>

<script src="/examples/textview/textStyler.js"></script>

<script type="text/javascript">

function onload() {

require("examples/textview/orionformatter");

}

</script>

</head>

<body onload="onload();">



<h3>Orion Text View Demo: using Orion Formatter and Almond</h3>



<pre name="orion" class="js writable ruler" style="border: 1px solid teal;">

/* Some js code */

function log (text) {

var console = window.document.getElementById('console');

showConsole();

}

</pre>



</body>

</html>

Note that to use almond directly it was needed to include all the required files manually. Another difference is that requirejs ensures that orionformatter only runs when the dom is ready. With almond we don't get that, that is why the load event handler was necessary.

Now is the time to run the requirejs optimizer on almond. This is the magic:

$ node r-edge.js -o baseUrl=../.. name=examples/textview/almond include=examples/textview/orionformatter.js out=orionformatterbuilt.js uglify.ascii_only=true

Notes:

  • uglify.ascii_only=true was needed because textView uses unicode characters
  • r-edge.js was used because of a bug in r.js, this will soon be fixed.
  • See orionformatter.js line 16, without this line almond did not work (for me).
  • The doc suggests to pass wrap=true to the optimizer, in this case that can't be used as the load event handler needs to call the require method.
Now using orionformatterbuilt.js the html above can be simplified to this:


<!DOCTYPE html>

<html>

<head>

<script src="orionformatterbuilt.js"></script>

<script type="text/javascript">

function onload() {

require("examples/textview/orionformatter");

}

</script>

</head>

<body onload="onload();">



<h3>Orion Text View Demo: using Orion Formatter and Almond (optimized version)</h3>



<pre name="orion" class="js writable ruler" style="border: 1px solid teal;">

/* Some js code */

function log (text) {

var console = window.document.getElementById('console');

showConsole();

}

</pre>



</body>

</html>

In some cases, like when using the Orion Formatter with Blogger, it might not be possible to add a load event handler to the body. The workaround is add the script elements at the end of the body. The html would look like this:


<!DOCTYPE html>

<html>

<body>



<h3>Orion Text View Demo: using Orion Formatter and Almond (final version)</h3>



<pre name="orion" class="js writable ruler" style="border: 1px solid teal;">

/* Some js code */

function log (text) {

var console = window.document.getElementById('console');

showConsole();

}

</pre>





<script src="orionformatterbuilt.js"></script>

<script type="text/javascript">

require("examples/textview/orionformatter");

</script>

</body>

</html>

by Felipe Heidrich (noreply@blogger.com) at January 24, 2012 08:38 PM

The Aquarium

New in JPA 2.1 Early Draft

Java EE 7 is moving along nicely at the speed of its various JSRs and Arun has a rundown of the new features planned for JPA 2.1 as described in the recent Early Draft document.

ALT_DESCR

The blog entry covers Stored Procedures (similar to named queries, defined on the entities themselves), bulk operations, new FUNCTION, ON, TREAT JPQL keywords, more alignment with CDI and unsynchronized persistence context.

There are more features planned for JPA 2.1 that didn't get in the early draft (such as multi-tenancy). As a reminder, EclipseLink is the reference implementation (RI) for this specification while GlassFish 4.0 will deliver the overal Java EE 7 RI.

by alexismp at January 24, 2012 07:17 PM

Planet Eclipse

Ian Skerrett: Integrating Lifecycle Tools with OSLC and Eclipse Lyo

Lifecycle tool integration is a key issue for the new breed of tools emerging around the concepts of Agile ALM.   Eclipse is a great platform for tools integration on the desktop but how do tools integrate on the server?   OSLC and Eclipse Lyo are a specification and open source implementation for solving lifecycle tools integration.

Michael Fiedler and Steve Speicher will be talking about OSLC and Eclipse Lyo at the upcoming Agile ALM Connect conference.    To introduce people to the Agile ALM Connect speakers and topics, I will be doing a short Q&A with some of the speakers.    Below Michael and Steve provide some background on OSLC and Eclipse Lyo.

1. What is OSLC and why does the industry need OSLC?

OSLC (Open Services for Lifecycle Integration) is an open community dedicated to reducing barriers for lifecycle tool integration.   The community authors scenarios and specifications for exposing application lifecycle data (change requests, test cases, requirements, etc) through uniform interfaces which rely on the architecture of the World Wide Web and Linked Data standards.

Organizations use a variety of lifecycle tools – commercial, open source and those developed in house – which need to share data, resources and assets.  Current integration approaches are often based on fragile and proprietary point-to-point APIs.   Tools adopting OSLC can interoperate easily using a linked data approach which enables loosely-coupled integrations with improved quality, navigation and traceability of shared data.

2. How would you like people or companies to contribute to the Eclipse Lyo project?

Individuals and companies are welcome to participate in both the Eclipse Lyo project and in the OSLC workgroups.   The Lyo project is looking for developers interested in promoting OSLC adoption by developing SDKs, reference implementations, compliance tests and examples.   OSLC workgroups develop integration scenarios and specifications to address different aspects of the system and software lifecycle (requirements, development, test, etc).   Workgroup participation is open and is a great way to learn more about OSLC and contribute to new and evolving specifications.

3. What is the best resource to start using OSLC and Eclipse Lyo?

Getting started with Eclipse Lyo and OSLC is easy.  To get started with Lyo, visit the Wiki on eclipse.org (http://wiki.eclipse.org/Lyo) to get an overview of the project.  To participate in Lyo development, you can start by introducing yourself on the development mailing list, lyo-dev@eclipse.org.  To participate in OSLC, visit http://open-services.net/participate and  join in the discussions on the forums, mailing lists and workgroup meetings.



January 24, 2012 06:13 PM

Planet Eclipse

Wayne Beaton: Top Ten Ways to Say Eclipse

Every couple of days, I get an email from somebody looking for a price quote for Eclipse. Generally, the sender is a software reseller acting on behalf of a client. Sometimes they ask to partner with us, sometimes they just want a simple price quote. In all cases, I answer with some boilerplate text that I keep around:

Eclipse is free and open source software that is distributed royalty-free under the terms of the Eclipse Software User Agreement. Please let me know if we can be of further assistance.

Now, the interesting thing for me, is the number of different product names people use to describe the thing that they want to buy. Here are a few of my favourites (in no particular order).

  • Eclipse Foundation Eclipse Galileo SR1 3.5.1 EN 01
  • IDE License JAVA programming: Open Source
  • The “Eclipse” Software
  • “For a Better World” (an Eclipse Publication)
  • LTO Ultrium 5 1500 GB Data Cartridges
  • Eclipse Indigo (3.7) Packages for Mac OS
  • Eclipse + plug-in
  • ECLIPSE IDE for Java EE Developers 1.2.0.20090621-0820 epp.package.jee for Win7
  • ECLIPSE Practice Management Software/Medical Billing Software
  • SCA dev lab Software and SCA tools

There’s a couple in there that seem to come out of nowhere, obviously from folks who have us confused with somebody else. Curiously, I get almost no email about soccer clubs or vampires.

EclipseCon 2012AGILEALM 2012



January 24, 2012 03:39 PM

Planet Eclipse

Ian Skerrett: Final Week for Eclipse Award Nominations

This is the final week of nominations for the Eclipse Community Awards.   I would particularly like to see more nominees in the Top Committer, Top Contributor and Newcomer Evangelist category.    Deadline for nominations is Friday, January 27, 2012.



January 24, 2012 03:34 PM

A