Česky   |  Deutsch   |  English   |  Español   |  Français   |  Indonesia   |  日本語   |  한글   |  Polski   |  Português (BR)   |  Türkçe   |  中文   |  正體中文   |  Your Language  
PlanetNetbeans
Planet NetBeans is an aggregation of NetBeans related musings from all over the Blogosphere.
Feeds
[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)
richunger's blog (feed)
APIDesign - Blogs (feed)
ludo's blog (feed)
pandaconstantin's blog (feed)
hansmuller's blog (feed)
pkeegan's blog (feed)
tball's blog (feed)
timboudreau's blog (feed)
David R. Heffelfinger (feed)
Winston Prakash's Weblog (feed)
Java, business and... NetBeans ! [[ Jonathan Lermitage ]] - NetBeans IDE (feed)
Need to find a title (feed)
Roger Searjeant's blog (feed)
Optonline Webmail (feed)
Michael's blog » NetBeans (feed)
DukeScript (feed)
ProNetBeans (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's Blog (feed)
Neil's Dev Stuff (feed)
Category: NetBeans | Software and Science (feed)
Computer says null; (feed)
NetBeans Adventures, Java and more (feed)
Allan Lykke Christensen » NetBeans (feed)
Inspiration and Expression » Netbeans (feed)
open source. open mind. (feed)
John O'Conner » NetBeans (feed)
Koberoi Oracle (feed)
Adam Bien (feed)
Ignacio Sánchez Ginés » NetBeans (feed)
Bernhard's Weblog (feed)
Michel Graciano'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 127.0.0.1 » 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)
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:
January 31, 2015 03:05 PM
All times are UTC

Sponsored by
sponsored by Oracle

visit NetBeans website
Geertjan's Blog - January 31, 2015 02:16 PM
Thanks, BlueJ: Code Outline for NetBeans

And this is why open source software, and the community around it, is so awesome—yesterday I spent some hours with Michael Kölling (read his Wikipedia entry here) while he was visiting here in Amsterdam, who explained to me (aside from many other things we discussed) that BlueJ and NetBeans work together very smoothly and that no plugins are needed for interacting between these tools.

That was great to hear, so as soon as I got home I tried it out. He was right. I made a movie about it and posted it on YouTube:

<span id="XinhaEditingPostion"></span>

You'd think that that was "all", maybe, and that I'd end here by saying, "pretty cool, isn't it, how these tools work together and how different projects can strengthen each other, and how cool it is to meet enthusiastic leaders of the open source movement like Michael Kölling".

But there's more to this story! Benno Markiewicz, who is the most prolific NetBeans plugin developer over many years now, and who lives in Leipzig, Germany, saw the movie above today and... saw that BlueJ has a great Code Outline feature, which you can see vertically along the right side below which you can scroll up and down as a bird's eye view of your code:

And NetBeans doesn't have that feature, as discussed in this issue:

https://netbeans.org/bugzilla/show_bug.cgi?id=199663

As you can see, various tools already have that feature, including BlueJ. Benno wrote today to say: "Because BlueJ's code is not so complex and is based on Swing too, I could extract the relevant classes from BlueJ, deleted some lines of code, and created a NetBeans module using them."

Here's the result (click to enlarge the image to see the whole context):

Get it here, where you can also see how to use it:

http://plugins.netbeans.org/plugin/57219

More features can be added to it, in time, but it's great to have this feature now available in NetBeans... all thanks to a chain of events that started yesterday over a coffee in a cafe in Amsterdam!

Geertjan's Blog - January 30, 2015 01:19 PM
NetBeans has Integrated javac from jdk8u40-b22

The 'javac' from the latest JDK, that is, JDK 8 Update 40 b22, is now in NetBeans IDE development builds.

As a result, Lukas Eder should be happy to see sources of jOOQ now look like this in NetBeans (click to enlarge):

(Install the 'Dark Look and Feel Themes' plugin if you want NetBeans to look like the above.)

Instead of this (click to enlarge):

Related issue, thanks Lukas:

https://netbeans.org/bugzilla/show_bug.cgi?id=249956

Adam Bien - January 29, 2015 03:16 PM
Injectable, Configurable, Resilient and Monitorable ThreadPools in Java EE 7 -- Porcupine Is Available

The Apache 2.0 licensed Project Porcupine is based on JSR 236: Concurrency Utilities for Java EE and allows you to setup injectable thread pools on-the-fly.

Each thread pool is created according to sensible conventions and produces an injectable statistics POJO. Not only the configuration, but also all major components are extensible without any additional configuration:


import com.airhacks.porcupine.execution.boundary.Dedicated;
import java.util.concurrent.ExecutorService;
import javax.inject.Inject;

public class MessagesService {

    @Inject
    @Dedicated
    ExecutorService light;

    @Inject
    @Dedicated
    ExecutorService heavy;
    //...
}

The installation is easy:


<dependency>
	<groupId>com.airhacks</groupId>
	<artifactId>porcupine</artifactId>
	<version>NEWEST_VERSION</version>
	<scope>compile</scope>
</dependency>
and the dependency small (16 kB).

Enjoy https://github.com/AdamBien/porcupine and see you at workshops.adam-bien.com. Porcupine is heavily discussed during the workshops. Stay in touch with airhacksnews.com!.


Real World Java EE Workshops [Airport Munich]>

NetBeans Zone - The social network for developers - January 27, 2015 08:58 PM
Agenda: NetBeans Day Netherlands

NetBeans Day Netherlands, to be held on Thursday, 12 February, is filling up fast. However, there's certainly still space to attend. You, and your friends, colleagues, fellow students, including teachers in the software development domain, are warmly invited to attend this free, unique, and action packed day. Sign up for the event...

DukeScript - January 27, 2015 11:53 AM
Type-safe JSON Parsing. Easy with DukeScript!

DukeScript is primarily optimized for designing client side responsive applications in Java and HTML, however libraries in its core are built with the goal of making Java/JavaScript interoperability easier. One of the essential concepts in JavaScript is JSON. Thus it is no surprise, DukeScript makes processing JSON from Java really smooth.

Where is My JSON?

First of all we need to obtain a JSON file. One of the free JSON services is the GitHub REST API, so let’s use it. The following command lists all repositories for a github account (actually the Jersey JAX-RS developers account):

$ curl https://api.github.com/users/jersey/repos

The ouput of this query has the following format. Save it into a file and let’s design a type-safe way to parse such a file with the help of DukeScript:

[
  {
    "id": 6109440,
    "name": "hol-sse-websocket",
    "full_name": "jersey/hol-sse-websocket",
    "owner": {
      "login": "jersey",
      "id": 399710,
      "avatar_url": "https://avatars.githubusercontent.com/u/399710?v=3",
      "gravatar_id": "",
      "url": "https://api.github.com/users/jersey",
      "html_url": "https://github.com/jersey",
      "followers_url": "https://api.github.com/users/jersey/followers",
      "following_url": "https://api.github.com/users/jersey/following{/other_user}",
      "gists_url": "https://api.github.com/users/jersey/gists{/gist_id}",
      "starred_url": "https://api.github.com/users/jersey/starred{/owner}{/repo}",
      "subscriptions_url": "https://api.github.com/users/jersey/subscriptions",
      "organizations_url": "https://api.github.com/users/jersey/orgs",
      "repos_url": "https://api.github.com/users/jersey/repos",
      "events_url": "https://api.github.com/users/jersey/events{/privacy}",
      "received_events_url": "https://api.github.com/users/jersey/received_events",
      "type": "Organization",
      "site_admin": false
    },
    "private": false,
    "html_url": "https://github.com/jersey/hol-sse-websocket",
    "description": "Hands-on-lab on using server-sent events and web socket with Jersey and Tyrus.",
    "fork": false,
    "url": "https://api.github.com/repos/jersey/hol-sse-websocket",
    "forks_url": "https://api.github.com/repos/jersey/hol-sse-websocket/forks",
    "keys_url": "https://api.github.com/repos/jersey/hol-sse-websocket/keys{/key_id}",
    "collaborators_url": "https://api.github.com/repos/jersey/hol-sse-websocket/collaborators{/collaborator}",
    "teams_url": "https://api.github.com/repos/jersey/hol-sse-websocket/teams",
    "hooks_url": "https://api.github.com/repos/jersey/hol-sse-websocket/hooks",
    "issue_events_url": "https://api.github.com/repos/jersey/hol-sse-websocket/issues/events{/number}",
    "events_url": "https://api.github.com/repos/jersey/hol-sse-websocket/events",
    "assignees_url": "https://api.github.com/repos/jersey/hol-sse-websocket/assignees{/user}",
    "branches_url": "https://api.github.com/repos/jersey/hol-sse-websocket/branches{/branch}",
    "tags_url": "https://api.github.com/repos/jersey/hol-sse-websocket/tags",
    "blobs_url": "https://api.github.com/repos/jersey/hol-sse-websocket/git/blobs{/sha}",
    "git_tags_url": "https://api.github.com/repos/jersey/hol-sse-websocket/git/tags{/sha}",
    "git_refs_url": "https://api.github.com/repos/jersey/hol-sse-websocket/git/refs{/sha}",
    "trees_url": "https://api.github.com/repos/jersey/hol-sse-websocket/git/trees{/sha}",
    "statuses_url": "https://api.github.com/repos/jersey/hol-sse-websocket/statuses/{sha}",
    "languages_url": "https://api.github.com/repos/jersey/hol-sse-websocket/languages",
    "stargazers_url": "https://api.github.com/repos/jersey/hol-sse-websocket/stargazers",
    "contributors_url": "https://api.github.com/repos/jersey/hol-sse-websocket/contributors",
    "subscribers_url": "https://api.github.com/repos/jersey/hol-sse-websocket/subscribers",
    "subscription_url": "https://api.github.com/repos/jersey/hol-sse-websocket/subscription",
    "commits_url": "https://api.github.com/repos/jersey/hol-sse-websocket/commits{/sha}",
    "git_commits_url": "https://api.github.com/repos/jersey/hol-sse-websocket/git/commits{/sha}",
    "comments_url": "https://api.github.com/repos/jersey/hol-sse-websocket/comments{/number}",
    "issue_comment_url": "https://api.github.com/repos/jersey/hol-sse-websocket/issues/comments/{number}",
    "contents_url": "https://api.github.com/repos/jersey/hol-sse-websocket/contents/{+path}",
    "compare_url": "https://api.github.com/repos/jersey/hol-sse-websocket/compare/{base}...{head}",
    "merges_url": "https://api.github.com/repos/jersey/hol-sse-websocket/merges",
    "archive_url": "https://api.github.com/repos/jersey/hol-sse-websocket/{archive_format}{/ref}",
    "downloads_url": "https://api.github.com/repos/jersey/hol-sse-websocket/downloads",
    "issues_url": "https://api.github.com/repos/jersey/hol-sse-websocket/issues{/number}",
    "pulls_url": "https://api.github.com/repos/jersey/hol-sse-websocket/pulls{/number}",
    "milestones_url": "https://api.github.com/repos/jersey/hol-sse-websocket/milestones{/number}",
    "notifications_url": "https://api.github.com/repos/jersey/hol-sse-websocket/notifications{?since,all,participating}",
    "labels_url": "https://api.github.com/repos/jersey/hol-sse-websocket/labels{/name}",
    "releases_url": "https://api.github.com/repos/jersey/hol-sse-websocket/releases{/id}",
    "created_at": "2012-10-07T04:44:32Z",
    "updated_at": "2014-06-29T22:29:42Z",
    "pushed_at": "2013-05-29T16:56:03Z",
    "git_url": "git://github.com/jersey/hol-sse-websocket.git",
    "ssh_url": "git@github.com:jersey/hol-sse-websocket.git",
    "clone_url": "https://github.com/jersey/hol-sse-websocket.git",
    "svn_url": "https://github.com/jersey/hol-sse-websocket",
    "homepage": null,
    "size": 7750,
    "stargazers_count": 11,
    "watchers_count": 11,
    "language": "Java",
    "has_issues": true,
    "has_downloads": true,
    "has_wiki": true,
    "has_pages": false,
    "forks_count": 5,
    "mirror_url": null,
    "open_issues_count": 1,
    "forks": 5,
    "open_issues": 1,
    "watchers": 11,
    "default_branch": "master"
  },
  {
     "etc." : "etc."
  }
]

Setting the Project Up

Let’s get started following the same way we start with regular HTML UI based DukeScript application. Follow the getting started tutorial if you are OK with using NetBeans. If you want to stay on command line, you can use:

$ mvn archetype:generate -DarchetypeGroupId=org.apidesign.html \
  -DarchetypeArtifactId=knockout4j-archetype \
  -DarchetypeVersion=1.1.2

Once our application is generated, we can start modifying the sample application to avoid displaying the UI, but rather parse our JSON file. Let’s remove:

  • src/main/webapp/pages/index.html - no UI definitions
  • src/main/java/your/pkg/DataModel.java - no UI model
  • src/test - we don’t need tests for this simple sample

The next step is to change dependencies in our pom.xml - the sample project can parse JSON inside of a running browser, but we want to do it in Java. Luckily there is a JAR that can handle that. Just include it on runtime classpath and it will handle all the parsing for us. Add the following dependency:

<dependency>
  <groupId>org.netbeans.html</groupId>
  <artifactId>ko-ws-tyrus</artifactId>
  <version>${net.java.html.version}</version>
  <scope>runtime</scope>
</dependency>

In addition to that let’s clean the Main.java so it is ready for our parsing code and looks like:

package your.pkg;

public final class Main {
    private Main() {
    }
    
    public static void main(String... args) throws Exception {
    }
}

Now we have an empty skeletal application what we can use to do the parsing, which can be verified by executing ‘mvn clean install’ - the project should built without any issues.

Parsing JSON Files

We are ready to start the parsing. There is the net.java.html.json.Models class in the core DukeScript API and it contains two overloaded variants of the method parse. One method can parse a single JSON object, the second can parse a JSON array of multiple JSON objects. Given the fact that the file we obtained from GitHub lists an array of repositories, we should use the more complicated variant. Here is the code:

public static void main(String... args) throws Exception {
    BrwsrCtx ctx = parsingContext();
    FileInputStream is = new FileInputStream("/tmp/jersey.json");
    List<RepositoryInfo> arr = new ArrayList<>();
    Models.parse(ctx, RepositoryInfo.class, is, arr);

    System.err.println("all parsed data: " + arr);

    RepositoryInfo first = arr.get(0);
    System.err.println("id: " + first.getId());

    is.close();
}

As part of the setup we get the parsing context. Then we open the JSON file we want to parse. We allocate an array to hold the results and then ask the parse method to do the parsing and fill the list. Then we print the whole array to output and also access the first element in the array in a type-safe way and obtain its id property. Here is the output from the execution of the above program:

all parsed data: [{"id":6109440}, {"id":4368712}, {"id":14029306}, {"id":4522462}, {"id":911627}]
id: 6109440

Now one important question: How does the code know there is an id property in the JSON?

Defining the Model

DukeScript core APIs support a type-safe way of accessing JSON structures. Moreover, in order to avoid writing tons of boiler-plate code, we describe the JSON structure using annotations and generate the rest with the help of annotation processors. As such the RepositoryInfo class is defined by:

@Model(className="RepositoryInfo", properties = {
    @Property(name = "id", type = int.class)
})
public final class Main {
   // now the main method
}

The above definition generates the RepositoryInfo class with a single integer property id and code to unmarshall JSON into instances of that class. The RepositoryInfo class also defines a reasonable toString() method - hence the whole list of such objects can be dumped into output in JSON format.

What to do when you want to parse other JSON properties? Take a look at the format of the downloaded JSON response file and add a new property definition! For example there is the name property which seems to be of type String. Just change the definition to:

@Model(className="RepositoryInfo", properties = {
    @Property(name = "id", type = int.class),
    @Property(name = "name", type = String.class),
})

Just by adding a single line, a getter getName() is added to the RepositoryInfo info class and you can use it in Java code:

RepositoryInfo first = arr.get(0);
System.err.println("id: " + first.getId());
System.err.println("name: " + first.getName());

The output when running the modified program is now:

all parsed data: [{"id":6109440,"name":"hol-sse-websocket"}, {"id":4368712,"name":"jersey"}, {"id":14029306,"name":"jersey-1.x"}, {"id":4522462,"name":"jersey-1.x-old"}, {"id":911627,"name":"jersey-old"}]
id: 6109440
name: hol-sse-websocket

And we can continue adding as many properties into our @Model definition as we need. For example one named private of type boolean. And so on, and so on, until we can access enough information via type-safe Java getters. The remaining, not listed, properties are silently ignored.

Parsing Nested Objects

We can see that the JSON format contains a nested object named owner. How can we parse such a structure in a type-safe way? Just define yet another model definition for it:

@Model(className="RepositoryInfo", properties = {
    @Property(name = "id", type = int.class),
    @Property(name = "name", type = String.class),
    @Property(name = "owner", type = Owner.class),
    @Property(name = "private", type = boolean.class),
})
public final class Main {
    @Model(className = "Owner", properties = {
        @Property(name = "login", type = String.class)
    })
    static final class OwnerCntrl {
    }
    // the main method...
}

With the above definition one can call getOwner().getLogin() to obtain the login information from a nested object. In addition to that, one can also access an array of values by specifying @Property(array = true, ...) when defining the JSON structure we want to access from Java. Here is the final code of our class:

import java.io.FileInputStream;
import java.util.ArrayList;
import java.util.List;
import net.java.html.BrwsrCtx;
import net.java.html.json.Model;
import net.java.html.json.Models;
import net.java.html.json.Property;
import org.netbeans.html.context.spi.Contexts;

@Model(className="RepositoryInfo", properties = {
    @Property(name = "id", type = int.class),
    @Property(name = "name", type = String.class),
    @Property(name = "owner", type = Owner.class),
    @Property(name = "private", type = boolean.class),
})
public final class Main {
    @Model(className = "Owner", properties = {
        @Property(name = "login", type = String.class)
    })
    static final class OwnerCntrl {
    }

    private Main() {
    }
    
    public static void main(String... args) throws Exception {
        BrwsrCtx ctx = parsingContext();
        FileInputStream is = new FileInputStream("/tmp/jersey.json");
        List<RepositoryInfo> arr = new ArrayList<>();
        Models.parse(ctx, RepositoryInfo.class, is, arr);

        System.err.println("all parsed data: " + arr);
        
        RepositoryInfo first = arr.get(0);
        System.err.println("id: " + first.getId());
        System.err.println("name: " + first.getName());
        System.err.println("private: " + first.isPrivate());
        System.err.println("owner.login: " + first.getOwner().getLogin());
    }
}

Here is the final output:

all parsed data: [{"id":6109440,"name":"hol-sse-websocket","owner":{"login":"jersey"},"private":false}, {"id":4368712,"name":"jersey","owner":{"login":"jersey"},"private":false}, {"id":14029306,"name":"jersey-1.x","owner":{"login":"jersey"},"private":false}, {"id":4522462,"name":"jersey-1.x-old","owner":{"login":"jersey"},"private":false}, {"id":911627,"name":"jersey-old","owner":{"login":"jersey"},"private":false}]
id: 6109440
name: hol-sse-websocket
private: false
owner.login: jersey

Parsing JSON in a type-safe way in Java has never been easier!

Appendix: Setting the Context

The last thing to mention is the way to setup our parsing context. It is a bit magical, but as it is done just once, when setting up the classpath of the whole application, it can be hidden, for example, in the following method:

private static BrwsrCtx parsingContext() {
    Contexts.Builder builder = Contexts.newBuilder("tyrus");
    Contexts.fillInByProviders(Main.class, builder);
    return builder.build();
}

What does it do? Well it uses the ‘magic string’ “tyrus” to request the Java implementation of JSON parser which is provided by the ‘ko-ws-tyrus’ module (that is the reason why we added a dependency on this module in our pom.xml).

This is exactly the kind of configuration done by Jersey Faces to register proper entity convertors, so one can use the classes generated by the @Model annotation inside of Jersey’s @GET, etc. methods just by including the appropriate JAR on the Jersey application classpath.

Once again, enjoy DukeScript everywhere!

Geertjan's Blog - January 27, 2015 08:00 AM
Displaying and Processing Yeoman Generators and Commands

Each Yeoman generator, when installed, makes available one or more Yeoman commands. On the command line, you don't run a Yeoman generator, but a command provided by a generator. To make that distinction, the user interface of the Yeoman wizard has been changed a bit:

A generator that is available without having been installed is iconized by means of a green download arrow. When that icon is right-clicked, an Install action can be invoked, which will run "npm install -g generator-xyz" from within NetBeans IDE. Once that has been done, the "yo --help" command will be run again, automatically, to populate the upper view with the newly available Yeoman commands.

When a Yeoman command is selected and Next is clicked, the Yeoman command will be run, via "yo ko:app", or whatever the selected command is. Then the generated application will automatically open in NetBeans IDE.

From the above, it's very clear what the biggest advantage of Yeoman integration in NetBeans IDE will be: anyone will be able to browse through (the lower view above has built-in search and filtering features) the available generators and pick the ones they'd like to use directly in the place where the generated applications will be developed.

Geertjan's Blog - January 26, 2015 08:00 AM
Exposing Yeoman Generators to NetBeans IDE

The plan is to, as shown below, show all of the Yeoman generators and let the user select the generator they want to use.

Above, all of them are shown, including those already installed. The next step is to distinguish those that are installed from those that are not. If an uninstalled generator is selected, it will automatically be installed via 'npm install -g', after which it will immediately be used. If it is already installed, it will simply be used when selected, after Next is clicked above, and a folder is specified.

The biggest problem at that point will be ensuring that the generator runs non-interactively. Or to enable the user to enter somehow the arguments and parameters requested by the selected generator. Finally, the generated application will then automatically be opened into NetBeans IDE when the Yeoman process completes.

Geertjan's Blog - January 23, 2015 10:35 PM
Processing Output on the Yeoman Command Line

Here's where things are right now for Yeoman in NetBeans IDE. First, as pointed out yesterday, just like Maven projects from archetypes, you can create HTML5 applications from Yeoman:

When Next is clicked above, all the Yeoman generators that have been installed are shown, exactly as when you run "yo --help" on the command line:

(A feature I'd like to have would be to either have hardcoded or somehow generated the Yeoman generators that are listed here and then to let the user select the ones they'd like to have installed for them via NetBeans.)

(Also need to work more on the responses required from the generators. Right now, Enter is clicked automatically and the default generator is run.)

When Next is clicked above, the name of the selected generator determines the suggested project name of the application that will be generated.

When Finish is clicked, the generator is run in the location specified above, with the result shown below.

The next step is for me to add an 'nbproject' folder in there, with the correct content, so that the application will be recognized as a NetBeans HTML5 application. And then it will automatically be opened into NetBeans IDE, i.e., as soon as it has been generated via the steps above!

Geertjan's Blog - January 22, 2015 04:19 PM
Parsing the Yeoman Command Line

The Yeoman command line, when you run "yo --help", shows you the available Yeoman generators that you have installed:

Integrating Yeoman into NetBeans IDE means that you want to let the user make use of those generators from within a New Project wizard, i.e., as discussed in this blog yesterday. So, here you go, thanks to Steve Souza (sitting on the couch at Concerto in Amsterdam next to me, great coffee and free Wifi hurray) and me:

The code for this is here on GitHub: YeomanHelpParser.java. You'll see the Yo executable is hardcoded, that's one thing I'll be working on, via a new item in the Options window.

Now that the above is done, things are looking pretty good. The user will select one of the installed generators (there'll also be a list of available generators that haven't been installed yet), click Next, and then the "yo" command will be called from NetBeans, the app will be generated, and will open automatically as an HTML5 project (from existing sources) in NetBeans. (JBoss Forge and LazyBones support for NetBeans should be implemented in a similar way.)

Adam Bien - January 22, 2015 12:49 PM
Listing Docker Containers with Nashorn

Nashorn is a convenient REST-service client:


#!/usr/bin/jjs -fv
var host = "DOCKER_HOST"
var dockerUri="http://${host}:5555/containers/json";
var command = "curl ${dockerUri}";
$EXEC(command);
var containers = JSON.parse($OUT);
for each(container in containers){
	print("${container.Image} 	 ${container.Names[0]}	 ${container.Status}");
}

See also: https://github.com/AdamBien/watchdock

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


Real World Java EE Workshops [Airport Munich]>

APIDesign - Blogs - January 22, 2015 09:52 AM
Can Real Threads be Brought to JavaScript?

What it would take to bring Java like threads into JavaScript (via Bck2Brwsr VM)? Here is my [[1]]!

--JaroslavTulach 09:52, 22 January 2015 (UTC)

markiewb's blog - January 21, 2015 09:36 PM
New version of Open File At Cursor plugin – 1.3.1

Today I released the version 1.3.1 of the “Open File At Cursor” plugin. There are some new minor features, which proofed to be useful for myself and may be also useful for other Java developers.

1395696437_2014-03-24_22h26_10

Updates in 1.3.1:

  • [Issue 18]: NPE when pressing CTRL in the diff dialog

Updates in 1.3.0:

  • [Feature 12]: Support fully qualified classnames
  • [Feature 14]: Search for classname in dependencies too (only works for dependencies with sources)
  • [Feature 10]: Find files in same package but different source root
  • [Issue 16]: Make the hyperlinking faster / use less IO

You can download it from http://plugins.netbeans.org/plugin/52349/open-file-at-cursor. The plugin is currently scheduled for verification for NB 8.0 and NB 7.4 and will be available from the plugin dialog within your NetBeans IDE within the next days (after verification).

As always please file issues and enhancements at https://github.com/markiewb/nb-resource-hyperlink-at-cursor/issues . Pull request are also appreciated. Thank you


Geertjan's Blog - January 21, 2015 08:57 AM
How to Implement Yeoman in NetBeans IDE

I've been looking into what it would take to support Yeoman in NetBeans IDE. My initial idea was to use the dynamic actions mechanism (see it on YouTube here), to create something like the "External Tools" functionality in IntelliJ IDEA, where you can register Yeoman configurations as external tools, which means each configuration gets a keyboard shortcut, menu item, and toolbar button for invoking the configuration.

I showed the above approach to Ralph Ruijs yesterday and his immediate reaction was along the lines of: "That's just weird. If I want to create a new project via Yeoman, I'd expect to be able to go to the New Project wizard and have access to all the available Yeoman commands via a Yeoman category." Of course, it's a pity I can't use the dynamic actions approach but I agree that it doesn't apply so well in this context. So then I spent some time working on "dynamic project templates" instead of "dynamic actions", which is doable, but even more difficult.

And then... I thought about how Maven archetypes are suppored in NetBeans IDE:

When you want to create a Maven project from an archetype from the on-line Maven repository, you go to the above project template in the New Project wizard. When you click Next above, you see this dialog:

What that means for Yeoman (and for JBoss Forge, I believe) is that, assuming one wants to be consistent with the existing NetBeans IDE approaches, is to create an entry point like this:

When Next is clicked above, a dialog should appear similar to the second step of the Maven archetype wizard. At that point, "yo -- help" should be run (same as is done for grails and griffon in NetBeans IDE), which will then give access to the available generators, which should be made available in a drop-down list, which the user can then select, at which stage the generators are executed.

In other words, that means (1) no dynamic actions are needed and (2) no dynamic project templates are needed. Instead, a much simpler solution based on an existing NetBeans pattern is applicable here and, as you can see above, will provide a very clear entrypoint into Yeoman from within NetBeans IDE.

markiewb's blog - January 20, 2015 09:49 PM
Maven: Force the exclusion of dependencies

In large Maven-based projects consisting of several high-level frameworks sooner or later there will come the time, when there are two versions of the same dependency in the classpath. For example: two versions of the same logging framework.

One approach to solve such ambiguity is to choose one of the versions (which is hopefully compatible) and to use it as an explicit dependency. Nevertheless other dependencies may still introduce other version as transitive dependencies. This may be caused by different groupIds, which will result in two similar named jar.

Once you got a candidate you can start finding all the possible sources of the dependency.

mvn dependency:tree -Dverbose -Dincludes=log4j:log4j

will show you the dependency-tree, but only the relevant excerpt. Using this information you can now add your exclusions to the affected pom.xml files.
Exclusions are configured via the exclusion-tag [1], which excludes specific transitive dependencies. For example:

<dependency>
	<groupId>sample.ProjectB</groupId>
	<artifactId>Project-B</artifactId>
	<version>1.0-SNAPSHOT</version>
	<exclusions>
		<exclusion>
			<groupId>log4j</groupId>
			<artifactId>log4j</artifactId>
		</exclusion>
	</exclusions>
</dependency>

By the way: Java IDEs can help you doing this.

After that you can make sure the faulty dependency versions will never ever be included again. This can be done using the maven-enforcer-plugin [2]

      
<build>
	<plugins>
		<plugin>
			<groupId>org.apache.maven.plugins</groupId>
			<artifactId>maven-enforcer-plugin</artifactId>
			<version>1.3.1</version>
			<executions>
				<execution>
					<id>enforce-version</id>
					<goals>
						<goal>enforce</goal>
					</goals>
					<configuration>
						<rules>
							<bannedDependencies>
								<excludes>
									<!-- exclude all versions lower than 1.2.17-->									
									<exclude>log4j:log4j:[0.0,1.2.17)</exclude>
								</excludes>
							</bannedDependencies>
						</rules>
					</configuration>
				</execution>
			</executions>
		</plugin>
	</plugins>
</build>

[1] http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html
[2] http://maven.apache.org/enforcer/maven-enforcer-plugin/


NetBeans Zone - The social network for developers - January 20, 2015 09:00 PM
Free Virtual Technology Summit with NetBeans Session

The Oracle Technology Network (OTN) is excited to invite you to the Virtual Technology Summit Series.  Four times a year come and join us to learn first hand from Oracle ACEs, Java Champions, and Oracle product experts, as they share their insight and expertise on using Oracle technologies to meet today’s IT challenges. Four main content areas covered will be Database, Java, Middleware and...

Geertjan's Blog - January 20, 2015 08:48 PM
Free: Virtual Technology Summit by Oracle Technology Network

The Oracle Technology Network (OTN) is excited to invite you to the Virtual Technology Summit Series.  Four times a year come and join us to learn first hand from Oracle ACEs, Java Champions, and Oracle product experts, as they share their insight and expertise on using Oracle technologies to meet today’s IT challenges. Four main content areas covered will be Database, Java, Middleware and Systems.  

Are you struggling in being productive with Maven, HTML5 frameworks such as AngularJS, IoT hardware such as the Raspberry Pi, and Java EE? Do you want free, easy to use, out of the box tools for quickly and efficiently developing all kinds of applications? You really need to give NetBeans a whirl!

In the "Free Open Source Tools for Maven, HTML5, IoT, and Java EE" session, during the upcoming free Virtual Technology Summit by OTN (nice and simple URL http://oracle.com/otnvts) we'll show you the latest enhancements and cool features of the free, open-source NetBeans IDE, which are used around the world, from engineers at Boeing and NASA to Java architects such as James Gosling and Stuart Marks!

If you haven't looked at the NetBeans IDE lately, you'll be blown away by the fast speed and performance enhancements. If you are completely new to the NetBeans IDE, see how easy it is to get started and be productive.

Tip: The full agenda is available here and notice that the session described above is in the Java Content Area: https://community.oracle.com/docs/DOC-894285

The sessions are prerecorded, while the speakers and other experts will be available live, to answer questions. To give a sneak peak at what the site will look like, take a look at these two screenshots from the session described above.

Click below to register. Pick a date and time that matches your location:

  • Americas February 11th - 9am to 12:30 PT - click here.
  • EMEA February 25th - 9am to 12:30 GMT - click here.
  • APAC March 4th - 9:30am to 1pm IST - click here.

Spread the news to members of your JUGs, colleagues at your office, and fellow students at your schools, colleges, and universities!

Adam Bien - January 20, 2015 04:35 AM
Amazon AWS Became Lightweight--Support For Java 8 and GlassFish 4.1 Available

Amazon AWS supports GlassFish 4.1 on Java 8. Now you can focus on business logic and push skinny WARs to the cloud.

Big thanks to Robert Herschke for the hint.

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 - January 19, 2015 08:24 AM
Gulp for NetBeans IDE (Part 2)

Turns out there was no point in getting started making Gulp support for NetBeans IDE myself, since it's already part of daily development builds, and much better than my support was going to be.

For details on this and all the other awesome new features that are already available, go here:

wiki.netbeans.org/NewAndNoteworthyNB81 

timboudreau's blog - January 19, 2015 02:43 AM
What if your logs were in JSON?

Bunyan is a NodeJS library that rethinks logging in some really useful ways. I wrote a Java port you can use in your applications.

In particular, with Bunyan, logs are JSON - and Bunyan comes with a great filtering and analysis tool.

The Java port uses some innovative techniques to make logging simple and foolproof - in particular, a use of AutoCloseable to make a logging code simple and foolproof.

A walkthrough on my real blog on timboudreau.com.

Geertjan's Blog - January 18, 2015 08:00 AM
Gulp for NetBeans IDE (Part 1)

The first part of Gulp support is complete. When the plugin is installed, the 'gulpfile.js', if it exists, is parsed and all the Gulp tasks are shown as child nodes of a new Gulp node in the Projects window:

Creating the above was trivial. Initially I got into all kinds of problems when I started by creating a new file type for Gulp files. But the solution ended up being much simpler than that. Using the NetBeans Project Type Extension Tutorial, I registered a new org.netbeans.spi.project.ui.support.NodeFactory for the org-netbeans-modules-web-clientproject project type.

All the code is here:

github.com/GeertjanWielenga/Gulp

The next step I'm working on is being able to run those Gulp tasks from within NetBeans. Once that's done I'll publish the plugin in the NetBeans Plugin Portal.

Adam Bien - January 17, 2015 02:18 PM
Java is #2 at the Tiobe Community Index

According to the TIOBE Community Index Java is #2, C is #1 and JavaScript is #7 and the programming language of 2014.

So if you learned C at school and are using JavaEE at the backend, HTML 5 + JavaScript at the frontend you are one of the cool kids :-)

Subscribe to airhacksnews.com newsletter.


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - January 17, 2015 08:06 AM
Knockout.js in 2 Minutes (Part 3)

Instead of hardcoding the values, let's read them from a JSON file, "courses.json", which I have in the same folder as the "index.html" file:

[
    {
        "name": "John",
        "courses": [{"title":"History"},{"title":"Geography"}]
        
    },
    {
        "name": "Bob",
        "courses": [{"title":"Science"}]
        
    },
    {
        "name": "Susan",
        "courses": [{"title":"Math"},{"title":"English"}]
        
    }
]

Code:

					

Geertjan's Blog - January 16, 2015 03:00 PM
Knockout.js in 2 Minutes (Part 2)

If you liked part 1, you should squeeze in another 2 minutes and watch part 2!

Code:

<script src="js/libs/knockout/knockout-min.js" type="text/javascript"></script>

Name: <input data-bind="value: name, valueUpdate:'afterkeydown'" />

<h3>
    Hello, <span data-bind="text: name"></span>.
</h3>
<ul data-bind="foreach: courses">
    <li><span data-bind="text: title"></span></li>
</ul>

<script type="text/javascript">
    
    var viewModel = {
        name: ko.observable("John"),  
        courses: ko.observableArray([{"title":"History"},{"title":"Geography"}])  
    };
    ko.applyBindings(viewModel);
    
</script>

Geertjan's Blog - January 15, 2015 08:00 AM
Knockout.js in 2 Minutes (Part 1)

Scratching your head over Knockout.js? Spend two minutes getting your feet wet here:

Code:

<script src="js/libs/knockout/knockout-min.js" type="text/javascript"></script>

Name: <input data-bind="value: name, valueUpdate:'afterkeydown'" />

<h3>
    Hello, <span data-bind="text: name"></span>.
</h3>

<script type="text/javascript">
    
    var viewModel = {
        name: ko.observable('John')  
    };
    ko.applyBindings(viewModel);
    
</script>

Adam Bien - January 15, 2015 07:54 AM
10th Airhacks.tv Q & A Uploaded--Killer Servers, Complex JSON, EARs and Modularization

14+ questions answered in 37 minutes:

Subscribe to airhacksnews.com and receive updates about my upcoming "airhacks" events, new workshops, opensource projects and publications.

See airhacks.tv for past episodes.

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 - January 14, 2015 01:36 PM
NetBeans Day in the Netherlands: 12 February 2015

During NetBeans Day 2014 in San Francisco, mention was made of more NetBeans Days being planned over the coming months. NetBeans Day Germany was held in Munich during December, hosted by Oracle, see the pic below, and read the report here.

In the Netherlands, the equivalent event to the above will be held on 12 February, i.e., less than a month from now, again hosted by Oracle:

Fill in the registration form and join the NetBeans community at the event:

https://pidome.wordpress.com/netbeans-day-februari-12th-2015-the-netherlands/

Or, even better, if you're not available to be there, because you're in some other country, set up a NetBeans Day yourself! Drop me an e-mail (geertjan dot wielenga at oracle dot com) and the NetBeans team will help set up the day, contact an Oracle office if needed for the location and food, and assist in getting speakers for your NetBeans Day!

Adam Bien - January 14, 2015 08:05 AM
JSON-P and JAX-RS 2 Client Maven Dependencies For RESTEasy

RESTEasy is a JAX-RS 2.0 implementation and comes with JAX-RS 2.0 client implementation / provider.

To use RESTEasy as a JAX-RS 2.0 client implementation (e.g. for system testing) you will have to declare the following dependencies in pom.xml:


<dependency>
    <groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-client</artifactId>
    <version>3.0.10.Final</version>
</dependency>
<dependency>
	<groupId>org.jboss.resteasy</groupId>
    <artifactId>resteasy-json-p-provider</artifactId>
    <version>3.0.10.Final</version>
</dependency>

The choice of the JAX-RS implementation does not have any effect at the code--it remains implementation independent:

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;

@Test
public void oracle() {
	Client client = ClientBuilder.newClient();
	String content = client.target("http://www.oracle.com/technetwork/java/index.html").
			request().
			get(String.class);
	assertNotNull(content);
	assertTrue(content.contains("java"));
}

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 - January 13, 2015 08:00 AM
Free: Learn NetBeans on Udemy

Free! An excellent course for anyone working with NetBeans IDE, covers all the basics, as well as many advanced features. It is unbelievable that a course this good is available for free, make use of the opportunity today!

Click the image above or click here to get directly to the site to get started with the course!

Geertjan's Blog - January 12, 2015 12:28 PM
Free: Learn Java with NetBeans on Android

Free! Start learning Java and NetBeans on your Android phone today. A step by step guide is available that can be installed on Android, with many instructions and a thorough guide to Java with many illustrations and insights into NetBeans IDE:

Go here or click the link above and happy learning!

https://play.google.com/store/apps/details?id=net.samaysoftware.javanetbeans

APIDesign - Blogs - January 12, 2015 09:27 AM
Bck2Brwsr @ 0.13 Released

Bugfix release of Bck2Brwsr 0.13 is out and it powers another classical game: fifteen. Give it a try!

--JaroslavTulach 09:27, 12 January 2015 (UTC)