Česky   |  Deutsch   |  English   |  Español   |  Français   |  Indonesia   |  日本語   |  한글   |  Polski   |  Português (BR)   |  Türkçe   |  中文   |  正體中文   |  Your Language  
Planet NetBeans is an aggregation of NetBeans related musings from all over the Blogosphere.
[RSS 1.0 Feed] [RSS 2.0 Feed]
[FOAF Subscriptions] [OPML Subscriptions]
Do you blog about NetBeans ? Add your blog to PlanetNetBeans.
Feed Subscriptions
NetBeans Zone - The social network for developers (feed)
ludo's blog (feed)
APIDesign - Blogs (feed)
pandaconstantin's blog (feed)
hansmuller's blog (feed)
pkeegan's blog (feed)
richunger's blog (feed)
tball's blog (feed)
timboudreau's blog (feed)
David R. Heffelfinger (feed)
Carsten Zerbst's Weblog (feed)
Winston Prakash's Weblog (feed)
Need to find a title (feed)
Roger Searjeant's blog (feed)
Optonline Webmail (feed)
Michael's blog » NetBeans (feed)
DukeScript (feed)
ProNetBeans (feed)
Tim Boudreau (feed)
Paulo Canedo » NetBeans English (feed)
Bistro! 2.0 (feed)
Anchialas' Java Blog (feed)
markiewb's blog (feed)
Anuradha (feed)
Netbeans6/6.5 my best practices (feed)
Java Evangelist John Yeary (feed)
Java, business and... NetBeans ! [[ Jonathan Lermitage ]] - NetBeans IDE (feed)
Neil's Dev Stuff (feed)
Category: NetBeans | Software and Science (feed)
Computer says null; (feed)
NetBeans Adventures, Java and more (feed)
Inspiration and Expression » Netbeans (feed)
John O'Conner » NetBeans (feed)
Koberoi Oracle (feed)
Adam Bien (feed)
Ignacio Sánchez Ginés » NetBeans (feed)
Bernhard's Weblog (feed)
Ramon.Ramos (feed)
Ozone and Programming » netbeans (feed)
NetBeans Ruminations » NetBeans (feed)
Tiplite » netbeans (feed)
Arun Gupta, Miles to go ... (feed)
Geertjan's Blog (feed)
.JARa's Bilingual Weblog (feed)
JavaFX Composer (feed)
The Java Jungle (feed)
Jesse Glick (feed)
Martin Grebac (feed)
The NetBeans Community Podcast (feed)
NetBeans Profiler (feed)
NetBeans for PHP (feed)
NetBeans Web Client (feed)
Rechtacek's (feed)
Virtual Steve (feed)
My First Blog - Satyajit Tripathi (feed)
The Aquarium (feed)
Tinuola Awopetu (feed)
Insert Witty Irony Here (feed)
Gualtiero Testa » Netbeans (feed)
James Selvakumar's Blog » netbeans (feed)
nB gUru » NetBeans (feed)
Newsintegrator Blog » netbeans (feed)
Praxis LIVE » NetBeans (feed)
TechAshram » NetBeans (feed)
There's no place like » Netbeans (feed)
mkleint (feed)
NetBeans Community Docs Blog (feed)
The Netbeans Experience (feed)
NbPython/ jpydbg / pymvs (feed)
Shanbag's Blog (ರಜತ ಲೋಕ) (feed)
Wade Chandler's Programming Blog (feed)
Devlin's Lab (feed)
Michel Graciano's Weblog (feed)
Big Al's Blog (feed)
Code Snakes (feed)
In perfect (spherical) shape (feed)
Van Couvering Is Not a Verb (feed)
Diego Torres Milano's blog (feed)
Vroom Framework (feed)
Messages from mrhaki (feed)
Jeff's Blog (feed)
Oliver Wahlen's Blog (feed)
Shuttle between Galaxies (feed)
Welcome to my live... (feed)
Netbeans IDE Blog by Tushar Joshi, Nagpur (feed)
Devel Blog (feed)
diamond-powder (feed)
Manikantan's Netbeans (feed)
Antonio's blog (feed)
Where's my Blog?!

Powered by:    Planet

Last updated:
May 27, 2015 06:05 AM
All times are UTC

Sponsored by
sponsored by Oracle

visit NetBeans website
Geertjan's Blog - May 26, 2015 03:50 PM
Knockout.js Community Interview: Ryan Niemeyer

NetBeans IDE, over several releases now, has been building up an awesome set of tools for frontend web development with Knockout.js:

And there's also a handy plugin for generating a Knockout frontend for a Java EE backend:


These features include a bunch of different things, such as intellisense and documentation within Knockout's data-bind attribute...

...as well as intellisense for the attributes of Knockout components, as shown here:

So, to explore Knockout more broadly, it's time for the NetBeans community to get to know the Knockout community a bit better! To that end, Ryan Niemeyer, one of the active Knockout community members, has kindly responded to some 'getting to know you' questions I recently sent him.

Hi Ryan, thanks for taking the interview, can you tell us a bit about who you are and what you do?

My name is Ryan Niemeyer and I am a web developer who has been in the software industry for over 16 years. I work for a great company called LeanKit (http://leankit.com). We have an awesome product for visualizing workflows and I have the chance to work with many wonderful and talented folks. I work remotely from the Madison, Wisconsin area and live with my wife and two girls (7 and 4). I have been interested and involved with open source projects as well for the last 5 years, which has been a very enjoyable and valuable experience.

How and when did you get involved with Knockout.js?

I have always been interested in templating and data-binding technologies. I did a lot of XML/XSL work years back and the combining data with a description of how to present it (a template) always made a lot of sense to me. Eventually I started working with jQuery and jQuery templates, which I felt was a quite powerful tool at the time.

Finally, in 2010 when Knockout was first released, it just clicked for me right away. Knockout was able to eliminate so much of the spaghetti code normally required to wire up an application. At the time, I did not have a ton of my own problems to solve with Knockout, so I started getting heavily involved in the Knockout forums and answering questions on StackOverflow. Soon after that, Steve Sanderson, the author of Knockout, asked me to join him on the core team.

You have a very active Knockout.js blog—what are your aims with it and what should one expect to find there?

My blog is at www.knockmeout.net. When I started the blog, there wasn’t a lot of information about Knockout available on-line other than from the official site (http://knockoutjs.com). The blog gives me a chance to share some ideas that I have had for solving problems, introduce plugins that I have written, and provide additional background when there are Knockout releases. My posts have been a bit more infrequent lately, as life is busy at the moment, but I certainly intend on keeping the blog going of the long-term.

What do you consider to be the most awesome features of Knockout.js?

I think that Knockout has a very low barrier to entry. It is easy to learn and stays very focused on data-binding and templating concerns. Knockout definitely provides plenty of extensibility points to allow advanced usage, but you can be productive with it right away.

I believe that another great feature of Knockout is that we have worked hard to maintain backwards compatibility and support browsers all the way back to IE6.

There are many other frameworks in the JavaScript ecosystem, what are the strengths/weaknesses of Knockout.js versus others you may have used, e.g., AngularJS?

Tools like Angular and Ember are definitely focused on providing more of a complete out-of-the-box experience for an entire web application, while Knockout stays focused on just the data-binding and templating pieces.

Some like to build their own stack by combining the most appropriate tools for their situation and Knockout can work well with a variety of other libraries.

What are the tools that you've been using with Knockout.js?

Many people can be pretty productive with Knockout in just about any tool. For most uses, it has a pretty low API surface area. I tend to use WebStorm or Sublime Text 3, but have tried a variety editors.

You've seen a bit of the NetBeans tooling via recent blogs—what do you think of them? 

The tooling around Knockout in NetBeans looks very impressive. Having intellisense and even help information is really useful and powerful.

Anything else you'd like to share with the NetBeans community? 

It is an exciting time for web development, as there are so many tools and solutions that are improving each day. I would encourage everyone to add Knockout.js to their list of solutions to evaluate for their web development projects.

Geertjan's Blog - May 25, 2015 08:17 AM
New: Maltego Training Video for Absolute Beginners

If you've just downloaded Maltego, which is based on the NetBeans Platform, and you're not sure what to do next, you should watch this new introduction video, released this month:

NetBeans Zone - The social network for developers - May 25, 2015 08:14 AM
Ivar Grimstad: My Five Favorite NetBeans IDE Features!

Continuing a series of articles focusing on NetBeans users and their five favorite NetBeans IDE features, here's the next part, by Ivar Grimstad. -- NetBeans team. Preview Text:  With NetBeans, you get a complete tool suite for enterprise development. No need to download anything extra unless you absolutely want to. The Maven integration is...

Adam Bien - May 25, 2015 07:19 AM
"Playing With Nashorns" Session from itKonekt Conference

"Playing With The Nashorns" conference session from the itKonekt conference at May 23rd, 2015:

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting

See also other screencasts at: http://tv.adam-bien.com or subscribe to http://www.youtube.com/user/bienadam.

Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - May 24, 2015 07:54 AM
YouTube: Arquallian and NetBeans IDE

Great new screencast, by Thomas Jost, about using NetBeans with Arquallian:

Also see this excellent article from a while ago on the same topic by NetBeans Dream Team member at Red Hat Markus Eisele:


Geertjan's Blog - May 24, 2015 04:37 AM
News from the Modular JavaFX Application Framework

The last time I reported on the status of the mFX project was in July last year.

The biggest problem at that time was that the mouse didn't work on the menus. I ran the project again today and I guess my JDK is different (newer) than what I was using at that time because now that problem is fixed, without any changes in my code, i.e., something has been enhanced on the JavaFX level.

Click to enlarge the image below to see a JavaFX application on top of mFX:

The remaining problem is that the window system is still in Swing. If the tabs could somehow be rewritten to JavaFX (and I have tried several things without success) then the entire application would be stylable via CSS.

Aside from that, it's looking pretty good. Above, you see a CSS-styled label that updates itself, via NetBeans Lookup, based on whatever the user has chosen in the selector window in the top right. There's an editor module, a viewer module, and a domain module, in other words, mFX truly enables you to do modular JavaFX development, using all the techniques provided out of the box by the NetBeans Platform, i.e., modularity, loose coupling, and pluggability.

Adam Bien - May 22, 2015 02:17 PM
MVC, Models and Java EE 8

The Model-View-Controller (MVC 1.0) Specification (JSR-371) enables unmanaged POJOs to be used as models:

You will find an executable example at: https://github.com/AdamBien/javaee8-mvc-sample.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting

Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - May 22, 2015 07:00 AM
javafx.scene.media.MediaPlayer in the NetBeans Platform

Let's integrate javafx.scene.media.MediaPlayer in a NetBeans Platform application so that you can, for example, have an interesting TopComponent like the below.


  1. Copy this class into a NetBeans module.

  2. In your TopComponent, which here is named 'NBMediaPlayerTopComponent':
    public NBMediaPlayerTopComponent() {
        setLayout(new BorderLayout());
        JPanel playerpanel = new JPanel();
        final JFXPanel jFXPanel = new JFXPanel();
        add(playerpanel, BorderLayout.CENTER);
        Platform.runLater(new Runnable() {
            public void run() {
    private static void initFxLater(JFXPanel panel) {
        MediaPlayer mediaPlayer = new MediaPlayer(new Media(MEDIA_URL));
        panel.setScene(new Scene(new MediaControl(mediaPlayer)));






Geertjan's Blog - May 21, 2015 06:43 PM
Open LaTeX Studio

Open LaTeX Studio is a lightweight LaTeX editor, with LaTeX code syntax highlight, code completion and live preview of the document in edition. It allows generating PDF files from the editor and provides Dropbox support, by allowing to connect the application with the Dropbox account, saving and uploading files to the remote directories and providing version control of the remote files. The application is delivered for the Windows and Linux platforms.

The project is Open source and is developed as a part of the master's thesis of Sebastian Brudziński.

It is built using the NetBeans Platfrorm 8. The code repository is located at:


and the application website is:


DukeScript - May 21, 2015 09:53 AM
New Version of Controlsjs DukeScript Plugin

Position has released a version 2.0 of their NetBeans Plugin for controlsjs.

Controls.js is a technology for building modern web and mobile applications. Controls.js is fully integrated with DukeScript. DukeScript applications are plain Java applications that internally use HTML5 technologies and JavaScript for UI rendering. That is where Controls.js can help. Just write an application in Java, design the application user interface in Controls.js Form Editor and run your application on iOS, Android or in a standard web browser. The main features of this plugin are to provide new project wizard and integration of Controls.js Form Editor.

While DukeScript wants you to get rid of JavaScript this goes even further. It wants you to get rid of HTML and CSS as well. It’s really nice to create your DukeScript applications simply via Drag & Drop.

Download and install the Plugin either from the Plugin Portal or install it from inside the IDE. Go to Tools->Plugins, and make sure that in “settings” tab the “Certified Plugins” are activated. Then switch to “Available Plugins”, click “Check for Newest” and install “Controls.js Support for Java”.

For more info check here.

Geertjan's Blog - May 20, 2015 12:42 PM
NetBeans Day Twente

Today NetBeans Day was held in Twente, which is an area in the east of the Netherlands, with a high population of grass and farm animals. The turnout was great, exactly as expected, though the narrow focus on MooTools, while relevant for the audience, limited active participation to cows only:

The photo above was taken during the workshop "JavaScript Developers Are Basically Sheep", which had as a subtitle "Weakly Typed Languages Are For The Birds".

Did you miss NetBeans Day Twente? Not to worry, there's NetBeans Day UK coming up end of this month and NetBeans Day Brazil end of the next!

Adam Bien - May 20, 2015 07:26 AM
beans.xml and JAXRSConfiguration: javaee7-essentials-archetype v1.3 released

The version 1.3 javaee7-essentials-archetype comes with two features:

  1. beans.xml for Java EE 7 and bean-discovery-mode="all" is created
  2. JAXRSConfiguration class mapped to the "resources" path enables JAX-RS

Create a project directly from the IDE (in NetBeans: New Project -> Maven -> Project From Archetype. Choose com.airhacks as groupId in the search box).

Or use the CLI:

mvn archetype:generate -Dfilter=com.airhacks:javaee7-essentials-archetype

If you like to stay lean without beans.xml and JAXRSConfiguration, choose the version v1.2.

The archetype's source is available at: https://github.com/AdamBien/javaee7-essentials-archetype. The project can be also directly cloned from: https://github.com/AdamBien/javaee-essentials-pom

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting

Real World Java EE Workshops [Airport Munich]>

NetBeans Zone - The social network for developers - May 19, 2015 03:17 PM
NetBeans in the Classroom: Using the NetBeans Rest Service Wizard

Ken Fogel is the Program Coordinator and Chairperson of the Computer Science Technology program at Dawson College in Montreal, Canada. He is also a Program Consultant to and part-time instructor in the Computer Institute of Concordia University's School of Extended Learning. Preview Text:  Ken Fogel, the Program Coordinator and Chairperson of the...

NetBeans Zone - The social network for developers - May 19, 2015 11:09 AM
Handy Tools for HTML5 Client Development

I had a chance to work a bit more with NetBeans and HTML5 client development this week and some of the features that really came in handy were: Preview Text:  I had a chance to work a bit more with NetBeans and HTML5 client development this week and some of the features that really came in handy are described here! Legacy ...

Adam Bien - May 19, 2015 06:20 AM
Auto-Creating JMS Destinations With JMS 2.0 and Java EE 7

Java EE 7 and JMS 2.0 introduced the @JMSDestinationDefinitions annotation which allows automatic creation of JMS resources at deployment time:

import javax.ejb.Singleton;
import javax.ejb.Startup;
import javax.jms.JMSDestinationDefinition;
import javax.jms.JMSDestinationDefinitions;

        value = {
                    name = "java:/queue/duke-queue",
                    interfaceName = "javax.jms.Queue",
                    destinationName = "duke"
                    name = "java:/topic/duke-topic",
                    interfaceName = "javax.jms.Topic",
                    destinationName = "duke-topic"
public class Initializer {
    @Resource(lookup = "java:/queue/duke-queue")
    private Queue queue;      
    public Queue expose() {
        return this.queue;

The conveniently created JMS destination (Queue or Topic) can be immediately exposed to dependency injection with the CDI @Produces annotation.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting

Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - May 19, 2015 06:02 AM
Knockout Simplicity for Bootstrap.css (Part 2)

Continuing the theme from the previous blog entry, here's the current state of my 'menubar' component, i.e., this is all I need to put into an HTML file...

...to get this:

The above is a Bootstrap.css menubar, created from the Knockout component shown above.

The HTML below is the template that styles the menubar, notice that there's JavaScript logic, thanks to Knockout, within the template:

Finally, here's the business logic that connects the template to the component, which receives its parameters from the component:

DukeScript - May 17, 2015 04:53 PM
Here it is, the inevitable Twitter Demo!

OK, drum roll, raise the curtain, clear the stage, here it is, the inevitable return of the Twitter demo. This time in DukeScript.

It’s OK to roll your eyes, but let’s face it, no technology is complete without a Twitter client written in it. Twitter client is the new “Hello World”! And rightfully so. A Twitter client demonstrates a lot of essential techniques, for example how to authorize an application and how to consume web services.

Our Twitter Client will use Application level authorization.

DukeScript, JSON and the REST

Consuming REST Web Services and parsing JSON results in DukeScript is simple. That’s good, because the Twitter API produces JSON. We just need to create a ViewModel class that has all the properties of the Message we’re interested in. You can have a look at this blog entry for more details.

Here’s the ViewModel of a tweet:

@Model(className = "Tweet", properties = {
        @Property(name = "from_user", type = String.class),
        @Property(name = "from_user_id", type = int.class),
        @Property(name = "profile_image_url", type = String.class),
        @Property(name = "text", type = String.class),
        @Property(name = "created_at", type = String.class),})
    static final class Twt {

We can now send a Query to the API, let DukeScript parse the tweets, organize them in a ViewModel with some additional functionality, like adding or deleting Twitter Users we’re interested in, and so on. I don’t want to show that code here. You can look it up on Github, where the project is hosted.

In this blog post we’ll have a look at something much more interesting. We’ll have a look at how to extend Dukescript’s functionality. Because we need to work around a limitation in the current version of DukeScript.

DukeScript SPIs, registering your own Transfer

The API for consuming REST messages works fine if we can encode everything in the URL. But sometimes we need to set Request Headers. The Twitter API for example requires us to set a Bearer token in an Authorization Header. That’s currently not supported in DukeScript. So we need to change the default behaviour.

Fortunately DukeScript was created with extensibility in mind. So we can create our own implementations for the DukeScript SPIs. For changing the way data is sent, we need to register our own Transfer.

We need to set some additional Headers, the rest of the functionality is fine, so let’s simply copy the default implementation classes (Transfer, LoadJSON, LoadWS) and make some small changes to the loadJSON method in class LoadJSON:

@JavaScriptBody(args = {"url", "done", "method", "data"}, javacall = true, body
            = "console.log(url);"
            + "var request = new XMLHttpRequest();\n"
            + "if (!method) method = 'GET';\n"
            + "var res = url.split('|');\n"
            + "url = res[0];"
            + "console.log(url);"
            + "request.open(method, url, true);\n"
            + "request.setRequestHeader('Content-Type', 'application/json; charset=utf-8');\n"
            + "if (res.length > 1){\n"
            + "  for (i = 1; i < res.length; i++) { \n"
            + "    var head = res[i].split(':');\n"
            + "    if (head.length == 2){\n"
            + "           console.log(head[0]);"        
            + "           console.log(head[1]);"        
            + "       request.setRequestHeader(head[0], head[1]);\n"
            + "    }\n"
            + "  }\n"
            + "}\n"
            + "request.onreadystatechange = function() {\n"
            + "  if (request.readyState !== 4) return;\n"
            + "  var r = request.response || request.responseText;\n"
            + "  try {\n"
            + "    var str = r;\n"
            + "    if (request.status !== 0)\n"
            + "      if (request.status < 100 || request.status >= 400) throw request.status + ': ' + request.statusText;"
            + "    try { r = eval('(' + r + ')'); } catch (ignore) { }"
            + "    @com.dukescript.twitterdemo.transfer.AuthorizedTransfer::notifySuccess(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)(done, str, r);\n"
            + "  } catch (error) {;\n"
            + "    @com.dukescript.twitterdemo.transfer.AuthorizedTransfer::notifyError(Ljava/lang/Object;Ljava/lang/Object;)(done, error);\n"
            + "  }\n"
            + "};\n"
            + "request.onerror = function (e) {\n"
            + "  @com.dukescript.twitterdemo.transfer.AuthorizedTransfer::notifyError(Ljava/lang/Object;Ljava/lang/Object;)(done, e.type + ' status ' + request.status);\n"
            + "}\n"
            + "if (data) request.send(data);"
            + "else request.send();"
    static void loadJSON(
            String url, JSONCall done, String method, String data
    ) {

Now we’re able to pass RequestHeaders through the URL. loadJSON will parse them and add them to the request. The next thing we need to do is register this behaviour to replace the default implementation. For this we create ‘RegisterTransfer’, a class responsible for, well, registering, the Transfer (I renamed my Transfer to ‘AuthorizedTransfer’):

@ServiceProvider(service = Contexts.Provider.class)
public class RegisterTransfer  implements Contexts.Provider {

    public void fillContext(Contexts.Builder context, Class<?> requestor) {
        context.register(Transfer.class, new AuthorizedTransfer(), 10);

The class itself is annotated as a ServiceProvider. As a result during compilation a file will be created in the META-INF/services directory that registers it declaratively. When the application is running all registered Context.Providers will be instantiated. DukeScript will call their service method fillContext. This is how our AuthorizedTransfer will get added to the system as an implementation of the Transfer SPI. The Integer number is the Rank of our Service. Smaller is better here, so our Service will be used instead of the default Implementation, which has a rank of 100.

One additional little step is required for this to work. We need to modify the pom.xml to include the META-INF/services in the jar.


Now our implementation is registered and we can use it:

@OnPropertyChange({"activeTweeters", "activeTweetersCount"})
    static void refreshTweets(TwitterModel model) {
        if (model.getActiveTweeters().isEmpty()) return;
        StringBuilder sb = new StringBuilder();
        String sep = "";
        for (String p : model.getActiveTweeters()) {
            sep = "%20OR%20";
        sb.append("|Authorization: Bearer ");
        model.queryTweets("https://api.twitter.com/1.1/search", sb.toString());

The rest of the application is plain DukeScript. So check it out on github. In order to run the demo, you will need to get a bearer token from Twitter. That means you need to register an app here and then get the Consumer Key (API Key) and Consumer Secret (API Secret). You’ll find those values in your app registration in section Keys and Access Tokens.

With these values you can request a Bearer Token. I’ve just uploaded a utility class to the github project that you can use like this:

String bearerToken = BearerTokenUtil.getBearerToken(  CONSUMER_KEY, CONSUMER_SECRET);

You have to create the bearer token only once. It will usually only change at your own request.

APIDesign - Blogs - May 17, 2015 10:26 AM
API Design as a Service

Domain Expert is a person who has knowledge of a particular system. With such knowledge it may seem easy to design APIs for the domain. However without understanding the API Paradoxes the quality of such API may not be high. It is likely going to cover the domain field, but the API usability or readiness for evolution will very likely suffer (unless such Domain Expert reads TheAPIBook first).

However can it work backwards? E.g. can one be just an API expert and then design good enough API without appropriate domain knowledge?

I am now participating in an experiment that will check that. OracleLabs guys asked me to help them design Truffle interoperability APIs. I do understand bit about Truffle, but certainly I am not a Domain Expert, yet I am supposed to design something as complicated as API to allow mixing of languages: imagine part of program written in Ruby, part in JavaScript, part in Java with objects floating between these languages without any borders!

This is a new situation for me: In case of NetBeans or in case of HTML/Java APIs, I was also the architect of the system. I knew it by heart. Now I barely understand how Truffle works and what makes it the fastest execution system for dynamic languages. My biggest fear is that I will design something that will be inherently slow.

On the other hand, I am not yet damaged with the expert knowledge. I can still see the system with new comer eyes - just like you, users of Truffle will. As such I can perform a usability study on me, at least initially.

If I can design easy to use APIs for Truffle, then I can create a perfect API facade around everything! Soon we'll have a chance to see whether one can be good API designer without being real Domain Expert. Soon we'll find out if API Design can be offered as a service!

--JaroslavTulach 10:26, 17 May 2015 (UTC)

Adam Bien - May 17, 2015 08:00 AM
Playing With Model View Controller MVC (JSR-371) from Java EE 8

Playing with JSR-371 MVC (Reference Implementation) ozark scheduled to ship with Java EE 8.

See also executable example: https://github.com/AdamBien/javaee8-mvc-sample

See also other screencasts at: http://tv.adam-bien.com or subscribe to http://www.youtube.com/user/bienadam.

Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - May 17, 2015 07:27 AM
Knockout Simplicity for Bootstrap.css (Part 1)

Imagine you need to create a menubar for your website:

If you had a choice, which of the two below would you choose as the way to express your menubar?

In both cases, you start by declaring Bootstrap.css:

<link href="css/bootstrap.css" rel="stylesheet" type="text/css"/>

However, which of the two would you prefer to use, after you have added the stylesheet reference above?

Option 1:

Option 2:

Of course, it's up to you and I won't judge you either way. However, to me, option 2 is much simpler and more expressive. Plus, I can use it in any website where I need a menubar, i.e., it's a simple lightweight generic tag in my HTML ready to be used anytime I need a menubar. It also means I don't need to type all that error-prone HTML code and it is also a lot more readable, as well. It looks a bit like JSON, while option 1 is very heavily loaded with angle brackets and other superfluous noise.

Option 2 is a Knockout component.

It is created like this, in my 'appViewModel.js' file:

ko.components.register("menubar", {require: 'components/menubar/menuBar'});

The above points to a JavaScript file named 'menuBar.js', which has this content:

define([], function () {
    function MenuBarModel(params) {
        self.menus = [];
        for (var key in params) {
            if (key.substring(0, 3)==('tab')) {
    return {
        viewModel: MenuBarModel,
        template: {
            require: 'text!components/menubar/menuBar-template.html'

Above you see the 'template' binding points to an HTML file, which has this content:

<div class="navbar">
    <div class="navbar-inner">
        <ul class="nav" data-bind="foreach: menus">
            <li data-bind="css:  { active: $data.substring(0,1) == '*' }">
                <a data-bind="attr: { href: $data.substring($data.indexOf('/')+1) }">
                    <span data-bind="text: $data.substring(1,$data.indexOf('/'))"/>

And now you can make the menubar a lot fancier: http://www.w3schools.com/bootstrap/bootstrap_case_navigation.asp

By means of the above, we have a simple syntax to define (1) the active menu, (2) the name of the menu, and (3) the URL that is returned when the menu is clicked. The Knockout 'menubar' component figures all these things out under the hood so that the user of the menubar doesn't have to think about it themselves. They simply specify the values that should be passed into the component and the component parses the value and figures out what to do with it.

The above provides a simple and comprehensive architecture for component-based development with JavaScript.

Geertjan's Blog - May 16, 2015 07:01 AM
Porting Knockout Components to DukeScript

With Knockout, you can extend the DOM by means of widgets, also known as 'components', such as the "user" component that you see below, which has the parameters "firstName" and "lastName":

As discussed yesterday and the day before in this blog, a component is created in JavaScript, like this:

ko.components.register('user', {
    viewModel: function (params) {
        this.firstName = ko.observable(params.firstName);
        this.lastName = ko.observable(params.lastName);
        this.fullName = ko.pureComputed(function () {
            return this.firstName() + " " + this.lastName();
        }, this);
        'First Name: <input data-bind="textInput: firstName"/>\
        Last Name: <input data-bind="textInput: lastName"/>\
        <h2 data-bind="text: fullName"></h2>'

As you can see here, by means of 'ko.components.register', you're able to register a new component, which is named 'user' here, consisting of a viewmodel and a template.

Now let's imagine we're using DukeScript, i.e., the WORA framework for Java programmers. Imagine you have several Knockout components like the above, how would you integrate them into your DukeScript application?

One of the Maven projects provided by the DukeScript Maven archetype has "JavaScript Libraries" in its name:

Notice that in the above there's a JavaScript file named 'userEntryComponent.js'. The content of that file is the 'user' component described in code at the start of this blog entry. Also notice that there is a Java source file in the above screenshot, named 'UserEntryWidget.java', which has this content:

package org.demo.ko4j.DemoKO4J.js;

import net.java.html.js.JavaScriptBody;
import net.java.html.js.JavaScriptResource;

@JavaScriptResource(value = "userEntryComponent.js")
public final class UserEntryWidget {

    private UserEntryWidget() {

    @JavaScriptBody(args = {}, body = "")
    public static native void registerComponent();


Notice that there is a reference to the JavaScript file, as well as a static method named 'registerComponent'.

OK, congratulations, you have ported your Knockout component to DukeScript, which consists of (1) copying the JavaScript file into the correct place in the DukeScript application structure and (2) registering it via the @JavaScriptResource annotation shown above.

The final step is to use the component. In the 'Main.java' class, i.e., in the Maven project where the client code is defined, you need the following:

public static void onPageLoad() throws Exception {
    Data d = new Data();
    Models.toRaw(d); // this line is required to initialize knockout

Notice the two lines in bold above. Notice that we're calling the static method in the UserEntryWidget class above. Also notice that we do not initialize the Data class above, i.e., we do not need to use 'setFirstName' and 'setLastName' on the Data class, because the initialization is done when you make use of the 'user' component, as you can see in the first screenshot above.

That's all you need to do to include a Knockout component in a DukeScript application.

DukeScript - May 15, 2015 11:53 AM
On device debugging for iOS!

We’re proud to announce the latest version of the DukeScript archetypes has been released to Maven Central. The greatest new feature is support for on-device debugging on iOS. If you have installed the NetBeans Plugin, the new archetypes will be used automatically. So you don’t need to install or update anything. Just create a new project.

In order to get debugging to work, you will need a license from RoboVM (There’s a 14 day trial available). After installing your license, simply start your app using the “debug” action in the projects context menu. This will launch your app in the iPad Simulator. To debug on an iOS device connected to your Mac, switch to the “Files” tab and add this to your nbactions.xml:

        <displayName>Debug on iOS Device</displayName>


This will add a new entry “Debug on iOS Device” to the “Custom”-submenu. The new task will automatically be available in the upcoming release of the DukeScript NetBeans Plugin.

If you prefer creating your projects from the command-line, the version number is 0.9.

Use this Archetype to create a basic application:

mvn archetype:generate 

The second archetype creates a CRUD application that shows how you can do client-server communication and reuse Model code on both ends:

mvn archetype:generate 

For on device debugging with Android, you’ll have to wait for NetBeans 8.1. The archetypes support it already. If you can’t wait, use a development build of NetBeans.

The Source Code of the new version of the presenters is available on Github:


We have also published the sources for the Maven Archetypes:


Geertjan's Blog - May 15, 2015 08:45 AM
require.config with Knockout in NetBeans

The application structure discussed yesterday is as follows:

Thanks to require.config, here's a significantly cleaned up version of the code discussed yesterday in 'init.js':

    baseUrl: './',
    paths: {
        knockout: './bower_components/knockout/dist/knockout',
        text: './bower_components/requirejs-text/text',
        appViewModel : './scripts/appViewModel'
    waitSeconds: 2
require(['knockout', 'appViewModel', 'text'], 
   function (ko, appViewModel) {
     ko.applyBindings(new appViewModel());

Putting the above together was simplified via the code completion and documentation in NetBeans:

What's also pretty handy is that you can see all the available configurations when you call up code completion before the start of a word within a 'require.config' block:

And here's the 'appViewModel', also significantly cleaned up, thanks to the 'require.config' in the 'init.js' above:

function (ko) {
    return function appViewModel() {
        ko.components.register("user", {
            viewModel: function (params) {
                this.firstName = ko.observable(params.firstName);
                this.lastName = ko.observable(params.lastName);
                this.fullName = ko.pureComputed(function () {
                    return this.firstName() + " " + this.lastName();
                }, this);
            template: {require: 

Again, notice the editor support below, not only syntax coloring, but when you hold down the Ctrl key and move your mouse over the file reference in the 'text' binding, in line 16 below, the reference becomes a hyperlink, which can be clicked to open the related file.

As shown yesterday, the final step of this scenario is to actually make use of the 'user' component in the view, where again NetBeans has helpful code completion to support you:

The application is modulerized and wired together via RequireJS, with its 'data-main' attribute, e.g., in the 'index.html', where the above is found, there is also the below, providing the entry point into the application, which is the 'init.js' file with which this blog entry started:

More on RequireJS (sorry for the poor audio): https://www.youtube.com/watch?v=v4jnTWFihMU

Adam Bien - May 14, 2015 09:39 PM
An Interview With the Killerfish--Payara

Q: C2B2 already provided commercial support for GlassFish, what is the idea behind www.payara.co?

Payara is a new initiative for C2B2. Previously we provided operational support and consultancy for customers using GlassFish in production. With Payara we are going a completely different direction. We are using the upstream open source GlassFish code base as our core to build a new application server, Payara.

We are looking to build new capabilities into Payara Server and recently we’ve added in JSR107 and data grid capabilities by incorporating Hazelcast. I did a webinar on this with Hazelcast last month: http://www.payara.co/javaee_applications_supercharged_ldquo_using_jc. We are also investigating new deployment scenarios for cloud and micro services environments through Payara Micro; and we aim to connect with the wider DevOps ecosystem through integrations with tools like Chef, Puppet, Ansible, Docker and Kubernetes.

Q: Have you got any feedback from Oracle about your Payara activities?

We have had no official feedback from Oracle. A number of our employees have signed the Contributor Licensing Agreement with Oracle and so can now submit fixes back to the upstream GlassFish team.  A number of these have been incorporated into the current GlassFish nightly builds. Informally, we’ve had support and encouragement from some of the engineers of the upstream GlassFish projects and in the spirit of open source they are keen for us to contribute.

Q: I've been watching Payara since JavaOne 2014 and the github account is very active. What triggers the activity?

People are using Payara and GlassFish and see that we are active, so they are reporting bugs and suggest lots of new ideas for new things they would like to see. This drives the list of things we want to add into each release. Payara is released quarterly and all development is carried out in the open on GitHub, which generates all the activity. We also see people raising questions, suggestions and issues on Twitter, StackOverflow, Facebook etc. The community has been really active and the interest is definitely growing – we’re really happy about it and we encourage all Payara and GlassFish users to get involved in the discussion!

Q: Does the community participate in Payara Development?

Absolutely! A number of people have signed the CLA and submitted pull requests for bug fixes and changes, which have been incorporated in the latest Payara release. New ideas from the community are also forming the basis of the enhancements and Payara Micro is a direct result of ideas from the community of how they would like to run their Java EE applications. We are completely open to community contributions and ideas. To be honest, we can’t think of everything ourselves, so we are very keen to get other people’s cool ideas to implement. GitHub is the central place to participate but people can ask questions on Twitter and other social media platforms, or even come along to one of the Java EE & GlassFishUser Group sessions in London (more info http://www.meetup.com/GlassFish-User-Group/).

Q:How many GlassFish users are switching to Payara? Can you give us any rough ideas?

There are a number of people we are aware of who are planning to or have already switched to Payara, including some very well know companies. We have been pleasantly surprised at how quickly the level of interest has grown and the speed at which some organisations are planning to switch. The level of interest and demand is growing and this spurs us on to make Payara better and better.

Q:How hard was the implementation of Payara Micro Edition?

To be honest, it was pretty easy to get the initial release of Payara Micro out. Not a lot of people know, but GlassFish has had an embedded edition for a long time. We’ve built on GlassFish embedded and our new Hazelcast integration to produce our first version of Payara Micro. A lot of the work we did was packaging GlassFish embedded in such a way that we could get more JavaEE capabilities and to get full web session clustering. The new Hazelcast integration gave us Dynamic Clustering which is fundamental to Payara Micro.

For us, Payara Micro marks the beginning of development in new ways of deploying JavaEE applications in radically new topologies. I’ve recently written an overview of Payara Micro which can be found on our blog: http://www.payara.co/introducing_payara_micro. We have a lot of cool ideas for taking Payara Micro in an exciting direction so stay tuned.

Q:Do you know any cool projects using Payara?

We are aware of projects using or planning to use Payara in many different cool ways e.g. for SAAS, Point of Sale, Intranet and Microservices. You should hear more about this in the near future as we are already gathering some success stories to publish on our website soon. Also, if you continue to blog about cool projects like the recent dreamIT one, I’m sure we’ll hear more on your blog ;-)

Q:What is your opinion about Java EE? Is it productive? How many of your customers are using it?

Is JavaEE productive? Absolutely! You can create applications in very few lines of code using a standard IDE like NetBeans with zero IDE setup. Producing a standard war file which can then be run on the command line with java –jar payara-micro.jar –deploy your.war. What could be more productive? You don’t need complex dependency management, complex installations or weird XML configuration files any more. I’ve got a talk at NetBeans Day in London on the 29th of May which will build and run a simple JavaEE application in 45 minutes: https://blog.idrsolutions.com/2015/03/netbeans-day-uk-friday-29th-may-2015/

Q:What are the features of the current release?

The latest release added Payara Micro; a small footprint version of Payara that requires no pre-installation and can run war files from the command line. Saying that, Payara Micro supports applications that use Java EE web profile apis along with JBatch, Concurrency and JCache. It also auto-clusters to give full web session replication across multiple Payara Micro instances.

From core GlassFish we’ve replaced the Shoal based clustering with Hazelcast as an embedded Data Grid which gives us JCache support and dynamic clustering capabilities. We’ve extended the range of JBatch persistence providers by adding support for MySQL, Oracle and DB2. Along with numerous critical bug fixes and upgrades to a lot of the underlying components like Jersey, Tyrus and Grizzly etc.

Q:What are the next cool features we can expect on Payara?

We are focusing on a number of areas.

Payara Micro is going to morph and grow into a fundamentally different way of installing and managing Java EE applications. Targeted at dynamic cloud environments and large scale installations. Our long-term goal is to make 1000 Payara Micro instances manageable from a single console on the cloud. We are looking at how RTS games present a lot of information to a user on the status of their units as a model for building a new management console for the cloud.

We have a focus on manageability and are starting to build in transaction tracing and fault finding capabilities to identify problems and make the operator aware of them as they happen so you don’t have to dig around to work out what went wrong.

Finally we are also focusing on integrating with the rest of the DevOps ecosystem with tooling around Payara for Chef, Docker, Maven etc.

Q: How expensive is the commercial support? Where is the pricelist?

Our commercial support is simply based on the number of Payara servers you are running rather than cpus, cores or power factors. We have priced commercial support in 3 tiers starting from $1,500 per server per annum for the most basic support, which we hope is set at a level that even small shops can get support. Our Enterprise support which provides full 24/7 screen sharing assistance runs to $5,000 per server per annum. We’ve also added unlimited options for organisations looking to run Payara everywhere without having to keep track of the numbers of servers they run. Of course there is also open source support on GitHub on a best endeavours basis. However we want to encourage people to buy commercial support as all the money that people spend with us on support is being reinvested into cool new Payara features. You can get the full pricelist with a feature breakdown on http://www.payara.fish/support  

Steve, thank you for the interview!

Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - May 14, 2015 12:45 PM
How to Separate HTML Templates in Knockout Apps

A problem with the solution discussed in the recent YouTube clip about component-based Knockout.js development is that you end up with your HTML template embedded in your JavaScript file, as shown below:

From a tooling perspective, the above is suboptimal because you're not able to benefit from code completion and syntax coloring that an HTML editor provides. One approach would be to create an extension to NetBeans that would somehow recognize the above construct as being HTML (i.e., if a "template" binding is encountered, treat everything that follows as HTML), which is doable and something I'll take a look into (using this as a starting point). And here's the initial result of looking into this, i.e., compare the string in the pic above to the string in the pic below; in the lower pic notice the HTML syntax coloring:

However, in a real Knockout application, you're more likely to separate out your HTML into separate files, thus making it possible to hand those HTML files over to your front-end designers, while you continue working separately on the business logic in your JavaScript files.

Starting with this useful article on the Knockout site, I restructured the application discussed in the YouTube clip so that its HTML is now separated out from the JavaScript, which has as an added benefit that all the Knockout support features available out of the box in NetBeans are available to you:

To get to the above point, I followed various articles where 'requirejs' and 'requirejs-text' are described. My application now looks like this:

And here's my 'appViewModel.js', which still has some work to be done to it (which is discussed here), i.e., I need to use 'require.config', which is the next topic I'll be looking at. However, in the meantime, here's how things are set up to get to the above point:

function (ko) {
    return function appViewModel() {
        ko.components.register("user", {
            viewModel: function (params) {
                this.firstName = ko.observable(params.firstName);
                this.lastName = ko.observable(params.lastName);
                this.fullName = ko.pureComputed(function () {
                    return this.firstName() + " " + this.lastName();
                }, this);
            template: {require: 

The rest is the same as here. Finally, as in the YouTube clip, you use the above defined 'user' component in your 'index.html' as follows, again supported by code completion and other Knockout-friendly features in NetBeans:

NetBeans for PHP - May 14, 2015 08:46 AM
Phing support added

<p> Hi all, today we will show you our support for&nbsp;PHP project build system or build tool&nbsp;which has been added in&nbsp;<strong>NetBeans 8.1</strong>. This time, we will talk about <a href="https://www.phing.info/" target="_blank" title="Phing homepage">Phing</a>.</p> <p>This support works exactly the same way as the existing support for JavaScript build tool, <b>Grunt</b> (please note that for NetBeans 8.1, we have added another popular JavaScript build tool, <b>Gulp</b>). This starts with configuration of Phing executable, of course:</p> <p><img src="https://blogs.oracle.com/netbeansphp/resource/article_images/phing-1.png" alt="Phing executable configuration" /></p> <p>Now, we can create a new Phing build file if it does not exist in the PHP project yet:&nbsp;</p> <p><img src="https://blogs.oracle.com/netbeansphp/resource/article_images/phing-2.png" alt="Phing build.xml template" /></p> <p>Phing build file appears among Important Files of the project:</p> <p><img src="https://blogs.oracle.com/netbeansphp/resource/article_images/phing-3.png" alt="build.xml is Important File" /></p> <p>Phing targets can be assigned to common IDE actions in the Project Properties dialog so then, if one e.g. <i>Runs Project</i>, the relevant Phing target is automatically executed as well.</p> <p><img src="https://blogs.oracle.com/netbeansphp/resource/article_images/phing-4.png" alt="Project Properties of Phing" /></p> <p>Any Phing target defined in project's <i>build.xml</i> can be run via project's context menu. One can even specify an <i>advanced</i> task:</p> <p><img src="https://blogs.oracle.com/netbeansphp/resource/article_images/phing-5.png" alt="Advanced Phing target" /></p> <p>Advanced task can be configured with custom options and parameters. Moreover, more Phing targets can be run at once and every advanced task can be optionally stored in VCS so every team member can use it easily:</p> <p><img src="https://blogs.oracle.com/netbeansphp/resource/article_images/phing-6.png" alt="Advanced Phing target configuration" /></p> <p>NetBeans remembers a few of the latest advanced tasks and allows to rerun them easily. Ordinary Phing targets can be run directly as well, of course:</p> <p><img src="https://blogs.oracle.com/netbeansphp/resource/article_images/phing-7.png" alt="Stored advanced Phing target" /></p> <p>Output of every Phing target run can be easily found (and reviewed if needed) in the Output window:&nbsp;</p> <p><img src="https://blogs.oracle.com/netbeansphp/resource/article_images/phing-8.png" alt="Phing output" /></p> <p><span style="line-height: 18px;">That's all for today, as always, please&nbsp;</span><a title="Development version of NetBeans" target="_blank" href="http://bits.netbeans.org/download/trunk/nightly/latest/" style="line-height: 18px;">test it</a><span style="line-height: 18px;">&nbsp;and report all the issues or enhancements you find in&nbsp;</span><a href="http://netbeans.org/community/issues.html" target="_blank" title="NetBeans Bugzilla" style="line-height: 18px;">NetBeans Bugzilla</a><span style="line-height: 18px;">&nbsp;(component&nbsp;</span><em style="line-height: 18px;">php</em><span style="line-height: 18px;">, subcomponent&nbsp;</span><em style="line-height: 18px;">Phing</em><span style="line-height: 18px;">).</span><span style="line-height: 18px;">&nbsp;You can also&nbsp;</span><span style="line-height: 18px;">leave a comment here (</span><b style="line-height: 18px;">please notice that the comments are moderated so they will not appear here immediately</b><span style="line-height: 18px;">) but reporting issues is strongly preferred.</span> </p>

Geertjan's Blog - May 13, 2015 08:31 AM
YouTube: Component Based Development with Knockout.js

Knockout.js has some extremely handy facilities for doing component based development, as shown in this brand new YouTube screencast:

Adam Bien - May 13, 2015 04:19 AM
From Devoxx 2014: Pico Services with Java EE 7 on Java 8 and Docker

My presentation about (pico|micro|femto)services on Java EE from Devoxx 2014.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting

Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - May 12, 2015 09:39 PM
Eclipse Recommenders for NetBeans IDE (Part 2)

Following on from part 1 of this series, here's two interesting screenshots to look at:

Above you see Eclipse code recommenders for NetBeans APIs, which is something Andreas Sewe and Marcel Bruch, from the Eclipse code recommenders project, have been working on, together with some NetBeans guys.

Also read Marcel Bruch's tweet on this topic: https://twitter.com/MarcelBruch/status/598187743634706432

Imagine how much easier it will make learning the NetBeans APIs if the code completion box, as shown above, recommends methods to you based on the API class you're currently coding against? Really useful, indeed.

Watch this space for further development.

NetBeans Zone - The social network for developers - May 12, 2015 09:10 AM
New NetBeans Platform Trainers in US: Gail and Paul Anderson

The Anderson Software Group, led by Gail and Paul Anderson, is one of many organizations actively using NetBeans IDE, over many years. Recently they provided a great quote to the NetBeans Community site on Oracle.com, summarizing their experiences with NetBeans IDE: Preview Text:  Announcing two new certified NetBeans Platform trainers, based in...