Č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
APIDesign - Blogs (feed)
David R. Heffelfinger (feed)
Carsten Zerbst's Weblog (feed)
Winston Prakash's Weblog (feed)
NetBeans – Michael's blog (feed)
DukeScript (feed)
ProNetBeans (feed)
Paulo Canedo » NetBeans English (feed)
NetBeans – NetBeans Ruminations (feed)
Anchialas' Java Blog (feed)
Need to find a title (feed)
Category: NetBeans | Software and Science (feed)
Roger Searjeant's blog (feed)
Adam Bien (feed)
Inspiration and Expression » Netbeans (feed)
NetBeans – Enrico Scantamburlo (feed)
Bernhard's Weblog (feed)
Michel Graciano's Weblog (feed)
Ramon.Ramos (feed)
Ozone and Programming » netbeans (feed)
netbeans – markiewb's blog (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 Web Client (feed)
Rechtacek's (feed)
Virtual Steve (feed)
The Aquarium (feed)
Tinuola Awopetu (feed)
Insert Witty Irony Here (feed)
Netbeans – Gualtiero Testa (feed)
netbeans – James Selvakumar’s Blog (feed)
NetBeans – nB gUru (feed)
netbeans – Newsintegrator Blog (feed)
NetBeans – Praxis LIVE (feed)
NetBeans – TechAshram (feed)
Netbeans – There's no place like 127.0.0.1 (feed)
Anuradha (feed)
Netbeans6/6.5 my best practices (feed)
Java Evangelist John Yeary (feed)
Neil's Dev Stuff (feed)
Computer says null; (feed)
NetBeans Adventures, Java and more (feed)
NetBeans – John O'Conner (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)
Manikantan's Netbeans (feed)
Oliver Wahlen's Blog (feed)
Shuttle between Galaxies (feed)
Welcome to my live... (feed)
Devel Blog (feed)
diamond-powder (feed)
Antonio's blog (feed)
Where's my Blog?!

Powered by:    Planet

Last updated:
April 28, 2017 08:05 AM
All times are UTC

Sponsored by
sponsored by Oracle

visit NetBeans website
Geertjan's Blog - April 26, 2017 10:35 AM
DevExpress Meets Oracle JET

I'm at Code Europe in Krakow, Poland and met Don Wibier from DevExpress, with the developer site at js.devexpress.com. Just like me, he runs around to promote enterprise JavaScript technologies and just like Oracle JET, DevExpress is focused on the enterprise, specifically, DevExpress provides enterprise JavaScript components. A match made in heaven (Krakow)!

Guess what, there's great integration with Oracle JET. Here's the DevExtreme Scheduler, integrated into the Oracle JET Quick Start Basic template:

Take a look at all the enterprise widgets here:

https://js.devexpress.com/Demos/WidgetsGallery/

The starting point for doing the above is to take a look at this extremely useful example, which is focused on integrating DevExtreme with Require and Knockout:

https://github.com/DevExpress/devextreme-examples/tree/16_2/requirejs-knockout

Geertjan's Blog - April 25, 2017 07:00 AM
Trip Report: NetBeans Day UK 2017

The 3rd NetBeans Day took place in London today! (Go here for the 2016 report and here for the 2015 report.) As before, NetBeans Day UK took place at the beautiful and historic Greenwich University.

Many people were involved in making the event possible, such as Chris Walshaw, lecturer at Greenwich University; Mark Stephens, Zain Arshad, and Georgia Ingham from IDR Solutions; Mike Croft and Andrew Pielage from Payara; Neil C. Smith from Praxis LIVE; and John Kostaras who came all the way from Belgium. Also present to do sessions and demos were Vladimir Voskresensky and Petr Kudryavtsev from Oracle Russia, as well as Chris Seaton from Oracle Labs. Paul Tinker from the local Oracle office was present as well, supporting the Oracle JET workshop.

There was a lot of engagement and interaction between attendees, which was really cool. We focused a lot on providing informal opportunities, e.g., workshops and activities in the lunch area, for people to chat in an informal way. E.g., those without laptops in the workshops were quickly paired up with those with laptops, so that new connections were established while working with NetBeans IDE! 

The day began with a warm welcome from Chris Walshaw and myself, followed by an overview of the history of NetBeans IDE and an update on the Apache NetBeans process. This was followed by Chris Seaton's intoduction to Graal/Truffle, i.e., the new fast polyglot JVM being developed by Oracle Labs. Mark and Zain then did a "NetBeans 101", with lots of tips and tricks, quite a few of which came back in discussions I had with people afterwards.

All this was followed by lunch. We had put tables throughout the lunch area and various attendees demoed and hacked code with attendees. For example, we had briefly introduced their projects to the whole group, e.g., Vladimir introduced the C/C++/Java integration work done in Oracle Russia via Oracle Solaris Studio, which he discussed at one of the tables in the lunch room. Meanwhile, Neil C. Smith showed off PRAXIS Live at another table and discussed it with those interested in that topic, while eating lunch. I.e., the lunch room became a hacker garden, where whoever wanted to hear more about a topic brought their lunch and hung out and discussed with others on particular topics. 

After which the group split into two tracks for workshops. Based on previous surveys, workshops were something missing from previous events, i.e., opportunities to learn new things and actually code and use them at the same time. We set up two workshops in parallel, the first on Java 9 and Jigsaw, while the other room had a Java EE microservices session with the Payara team. The Java 9 session, introduced by John Kostaras, was pretty interesting, i.e., seeing attendees playing with JShell and Jigsaw for the first time. After that followed a session on Oracle JET in parallel with a NetBeans IDE plugin development session. The choices were hard to make, i.e., quite a few would have wanted to attend all the workshops, though the day wasn't long enough for that! Many thanks to Paul Tinker for the excellent help during the Oracle JET session, his assistance made a big difference also because I had to rush off to the airport for the next conference.

The day ended with a prize draw for books, including "Java EE 7 Recipes", kindly donated by its author Josh Juneau, and "Java EE 7 with NetBeans 8" kindly donated by David Heffelfinger, followed by the inevitable hangout at a local pub!

All the resources used throughout the day are available here:

https://github.com/NetBeansDay/042517-London

Adam Bien - April 24, 2017 10:06 AM
GlassFish v5 (Java EE 8 RI)--Docker Image Is Available

GlassFish v5 ea (Java EE 8) builds available for download: http://download.oracle.com/glassfish/5.0/index.html

The nightly build is also available from docklands as glassfish5 and glassfish5-ping Dockerfiles.

Binary images are directly available from the public docker registry: https://hub.docker.com/u/airhacks/.

To start glassfishv5 perform docker run -d -p 8080:8080 --name glassfishv5 airhacks/glassfish-ping

The ping should be availabe after ~3 secs under: http://localhost:8080/ping.

See you at Java EE Microservices. Is Munich's airport too far? Learn from home: javaeemicro.services.
Real World Java EE Workshops [Airport Munich]>

netbeans – markiewb's blog - April 23, 2017 12:34 PM
NetBeans: How to simplify copy/paste Java code from online tutorials

Some months ago I created a small useful NetBeans plugin, which allows to you to save time when pasting code samples from online tutorials. Today I used it again and I still find it very useful in this specific context. And it saves you time. That is why I want to report about it.

What is the feature? You can copy the Java source code of whole classes from a tutorial and paste it via Menu|Edit|Paste to new file. Either the package declaration of the Java class is taken in account or the Java class is placed in the correct package. This depends on the selected node and it is documented included screencasts at https://github.com/markiewb/nb-paste-to-new-file.

That sounds familiar? Yes, this feature already exists natively in Eclipse JDT and Intellij IDEA.

Give it a try, when using NetBeans! Happy coding.

BTW: I am still looking for maintainers for my plugins! Because of time issues, I will not bugfix nor implement features anymore. Support your favorite IDE and by contribution to your favorite plugin!

PasteToNewJavaFile


Geertjan's Blog - April 22, 2017 06:20 PM
Software Adoption Surveys: From Quantity To Quality!

In a democracy, everyone is equal. One person, one vote, and all votes are equal since all people are equal.

Erroneously, that approach is applied to software adoption surveys too. Anyone at all can respond to a survey and can indicate that they use software product X, Y, or Z. However, what if I am a student paddling in the shallow waters of software development, with the likelihood that I'll abandon it before I graduate, while you are a senior Java architect creating mission critical software for NASA? Should my vote for product X, Y, or Z be equal to yours? Surely not?

According to "Baeldung", NetBeans usage has MORE THAN DOUBLED between 2016 and 2017, from 5.9% to 12.4%:

And look here! NetBeans IDE is 2nd, beating IntelliJ IDEA and Eclipse:

And... wow... look at this one, NetBeans is 2nd, after Eclipse, leaving IntelliJ IDEA far away in the dust:

Hurray, NetBeans is waaaaay more popular than X, Y, and Z! 

Sorry, the above results are meaningless, just like the results by RedMonk and the results by RebelLabs. Yes, even though the above results favor NetBeans, the tool that I like and have been promoting, and will continue to promote, for many years, the above results are bullshit.

When you look at the results of a software adoption survey, you have no idea at all whether the 70% using product A are creating financial software while the 2% using product B are brain surgeons or rocket scientists. And surely that makes a difference, i.e., knowing that information makes a difference in how you would evaluate software adoption surveys. Your software may be aimed at brain surgeons or rocket scientists and so the 70% doing financial software with a competing product are irrelevant to you.

So, let's stop the meaninglessness of software adoption surveys. Let's instead turn things around and do surveys of projects instead of people. One project, one vote—instead of one person one vote.

And there'd also need to be distinctions between types of projects. Plus, there'd need to be agreement on which specific projects to survey, with the same survey being done with exactly the same projects over a specific number of years, e.g., 5, to show trends.

We'd get richly textured results like this:

  • In the 1000 commercial projects surveyed over the past 5 years, 40% use Java-based product X, 30% use competing Java-based product Y, while the remainder don't use Java-based products at all. Over the past 3 years, adoption has shifted significantly amongst the 1000 commercial projects surveyed, from product B to product A in the financial sector, while in the logistics sector adoption has remained constant. Meanwhile, Java-based product Z has declined, though not significantly, and remains popular in large enterprises with over 500 fulltime software developers who combine product A with product B.

  • 90% of the 700 financial projects that have been surveyed use product X, while 75% of the 500 scientific projects that have been surveyed use product X together with competing product Y because product Y provides benefit A in the context of process B which is important specifically to scientific projects because of reason C. In 20% of the organizations surveyed, strict rules are defined about software usage, while 70% leave it up to the developer, and 10% did not respond to this question. 

  • In all of the 2500 organizations with over 100 fulltime developers surveyed, three competing open source products are used in one way or another. In the aerospace domain, which is 15% of the 2500 organizations surveyed, product A is slightly more popular than product B, while in the educational domain, which is 60% of the 2500 organizations surveyed, product B is clearly dominant, while product C is mainly popular amongst developers at startups, encompassing 20% of the organizations surveyed.  

Wouldn't these kinds of results be far more meaningful than the winner-take-all mentality of one (random) person, one vote—which is the current approach that software adoption surveys take? You'd be able to judge the relevance of the results based on your target audience. For example, you'd be able to say things like: "Well, since we don't care about startups, it doesn't matter that we're not popular there." Right now, we're unable to say these kinds of meaningful things because of the random 2000 people taking part in your survey, they could all be in the same country or working in a similar domain or a majority could be sympathetic to your organization, or came across your survey because they happened to be following you on Twitter, or all working on the same or similar projects.  

Let's stop focusing on the very simplistic "how many people filled in my survey" (e.g, "Last year, 2250 Java developers decided to take the time to answer the questions, and so it's fantastic to see this year that number is almost double - we got 4439 answers.") and switch over to the much more complicated task of "how can I be sure I am getting quality data from my survey". E.g., if you were to ask me "do you use OpenOffice or Microsoft Word", I would probably say "OpenOffice" even though I am using both these products more or less equally (together with other small editors like Notepad and Sublime, but you'll never know that since you never asked about that), though you're not giving me the choice to say that, and my individual usage statistic is meaningless if everyone else answering your survey is just like me or working on the same project or I have persuaded my friends to fill in your meaningless survey or rocket scientists at NASA don't care enough or are behind a firewall and so aren't filling in your survey.

To be honest, I am not hopeful, at all. I admit to being a bit cynical since I have the feeling that the most important reason for software surveys is not to gain meaningful insights, though I believe you completely when you claim good intentions and I applaud you for what I think you think you're honestly trying to do—instead, the reason why surveys exist is to promote the organization behind the survey as a neutral repository of truth and insight. And the glossier the brochures you print, the shinier the graphs that display your random data, the more suspicious I am that you're marketing your organization rather than gathering meaningful data.

Adam Bien - April 22, 2017 05:35 AM
Serverless Microservices On Java EE Servers -- Oracle Code Keynote In London

The "Live For The Code" Keynote in London, 20th April 2018 is available:

The sample code from the slideless keynote was pushed to: https://github.com/AdamBien/live4code -- expect commits during upcoming keynotes.

See you in Berlin. I decided to continue with the implementation of the serverless microservice :-).

I also participated in "Ask Me Anything" Q&A reddit session after the keynote. The conversation is available at: https://www.reddit.com/r/IAmA/comments/66k9rv/hey_redditors_its_adam_bien_author_of_real_world/

Interested in more details? Then see you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.
Real World Java EE Workshops [Airport Munich]>

Adam Bien - April 21, 2017 03:14 PM
Accessing The Current Build User In Jenkinsfile Pipeline

To access the current user in the Jenkinsfile install the Build User Vars Plugin first. After the installation the current user becomes available within the wrap block:


 wrap([$class: 'BuildUser']) {
    echo "userId=${BUILD_USER_ID},fullName=${BUILD_USER},email=${BUILD_USER_EMAIL}"
}

See you at Java EE Workshops at MUC Airport, particularly at the Java EE Testing, Pipelines as Code, CI / CD, Testing and Quality workshop


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - April 21, 2017 01:56 PM
JShell Integration in NetBeans IDE

I've blogged about the integration of the Java 9 JShell in NetBeans IDE before, here and here.

In the latest daily builds, assuming you're running the daily build on top of Java 9, you'll see the top part of the JShell looks the way you'd like it, i.e., there's a nice code fold and the first statement is numbered 1, rather than 9 as it was initially, as can can be seen in the previous blog entries.

Click to enlarge the below.  

The JShell can be opened from Tools | Open Java Platform Shell. 

Now the JShell integration looks really nice and polished and is ready for your REPL experiments. 

Adam Bien - April 20, 2017 11:59 AM
Java EE, Microservices and HTML 5 -- Bucharest Voxxed Days Keynote

During the Bucharest Voxxed Days Keynote I discussed the impact of using "standards" from Java EE backend to the HTML 5 frontend:

Any questions left? See you at airhacks.tv.

Interested in Thin WARs and WebStandards? See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Building HTML 5 Applications With WebStandards Is Munich's airport too far? Learn from home: airhacks.io.
Real World Java EE Workshops [Airport Munich]>

NetBeans – Enrico Scantamburlo - April 17, 2017 11:36 PM
Automatic increase module version in a NetBeans Platform Based Application

Some time ago on the NetBeans-dev mailing list, a user asked how to automatically increment the version of a module when it is built. I remember doing something similar for work but in my case, the update was not automatic but was made when the suite was built.

The github link for the sample application is here.

The first attempt was to write the version as 1.0.20170417223643, the module compiled fine, but it won’t install because 20170417223643 does not fit an integer.

The second attempt was to write the version as 2017.0417.223643, which worked, however, this was not very good looking and I decided to just read the previous version and increase it.

I create an Ant Task that increased the version number; I also made certain that if the version of the module is not written in the manifest file but in the module properties, it would be updated as well.  This could happen when you declare implementation dependencies.

I gave a look at the README file inside the netbeans-8.2/harness to refresh my memory on how to customize the module build system.

IMHO the best place to increase the version number was the “nbm” target. This is the target that is called when the NBM file is constructed.

I overwrote the “nbm” with my own in this way:

<target name="nbm" depends="updateManifest, projectized-common.nbm">
 </target>;

“updateManifest” is the target that increases the version number, while “projectized-common.nbm” is the original that builds the nbms. The order of the dependencies makes sure that the two targets are called in the right order.

The “updateManifest”  looks like this:

<taskdef name="updatemanifest" classname="it.scantamburloenrico.dailymanifestant.UpdateManifestTask" >
 <classpath>
 <fileset dir="${basedir}/../../dailymanifest/dailymanifestAnt/target" >
 <filename name="dailymanifestAnt-1.0-SNAPSHOT.jar" />
 </fileset>
 </classpath>
 </taskdef>

 <target name="updateManifest">
 <updatemanifest />
 </target>

The taskdef at the beginning is needed to import the jar file that contains the task.

I used maven to create the ANT task, it just searches for the manifest file, if the task finds it then the version number is increased, otherwise, the task searches for the “spec.version.base” property inside the project properties and updates it.

The image comes from here

Adam Bien - April 16, 2017 07:10 AM
(Free) Oracle Code Conference and Enterprise Java.next: A Slideless Keynote

I will deliver keynotes for (free) Oracle Code conferences in London, Berlin, Prague and Brussels. The deal was: slideless content. The advantage is: the content (=code) will vary across cities and is going to be influenced by the attendees.

See you soon at 9am:

  1. April, 20th, London
  2. April, 24th, Berlin
  3. April, 28th, Prague
  4. June, 6th, Brussels

Prepare your questions!

Also see you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.
Real World Java EE Workshops [Airport Munich]>

Adam Bien - April 07, 2017 10:45 PM
CORS Auth,Mobile,Pretty Metrics,JSON Links,Thin WARs in Practice, Performance Or 37th airhacks.tv

1h, 110 live attendees, over 20 questions -- the 37th airhacks.tv Questions and Answers show is available:

Non-blocking questions queue for the 38th airhacks.tv is created and is going to be processed at May 8th, 6 pm CET, 2017. See you live!

Ask questions now, during the show via twitter mentioning me: http://twitter.com/AdamBien (@AdamBien) or using the hashtag: #airhacks. You can join the Q&A session live each first Monday of month, 6 P.M at airhacks.tv or http://www.ustream.tv/channel/adambien

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.
Real World Java EE Workshops [Airport Munich]>

Adam Bien - April 05, 2017 03:49 AM
Perceptor: The "Performance Metrics Gathering Interceptor For Java EE" Released

perceptor v0.0.1 released. Perceptor is "Performance Metrics Gathering Interceptor" for Java EE 7. It comes as a 9kB, zero dependencies, Thin JAR with "plug and play" installation and two flavors:

  1. perceptor (metrics available via injection only):
        
    <dependency>
        <groupId>com.airhacks</groupId>
        <artifactId>perceptor</artifactId>
        <version>0.0.1</version>
    </dependency>
        
    
  2. perceptor-spy (metrics are exposed via: /monitoring/methods endpoint):
        
    <dependency>
        <groupId>com.airhacks</groupId>
        <artifactId>perceptor-spy</artifactId>
        <version>0.0.1</version>
    </dependency>
                
    Metrics are accessbile under:  curl [YOUR_THIN_WAR]/resources/monitoring/methods/[exceptional|recent|slowest|unstable]
    

Usage:


import com.airhacks.interceptor.monitoring.boundary.PerformanceSensor;

@Interceptors(PerformanceSensor.class)
public class Invoker {
    public String slow() {}
    public String fast() {}

}

Checkout https://github.com/AdamBien/perceptor for more information. You may also like https://github.com/AdamBien/porcupine

See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Java EE Performance, Monitoring and Troubleshooting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

Adam Bien - April 04, 2017 04:15 AM
Introduction to firehose -- the prometheus gateway

firehose is a standalone, Thin WAR (16 kB) gateway, which converts application metrics into prometheus.io format without any external dependencies:

See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Java EE Performance, Monitoring and Troubleshooting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - April 03, 2017 10:36 PM
YouTube: JavaScript for Sceptics

NetBeans – Enrico Scantamburlo - April 03, 2017 12:44 AM
Adding Spotbugs support to a NetBeans Platform Application

In the past week, I have been integrating FindBugs in my company NetBeans based Rich Client Application. FindBugs is a famous tool for static code analysis; it looks at your jars to find bugs, bad practices, unclosed streams … FindBugs did its job, and spotted many problems in our code, later I discovered this it was forked into a new project called SpotBugs that seems well maintained.

We wanted a complete report for all our modules, so I had to run FindBugs on them all, merge the results and convert them to HTML. All these tasks were done in ANT scripts because ANT is our build system and it was automated inside Jenkins.

I made a small sample project on GitHub to show what I did.

The first step was to create a separated ANT build.xml file called spotbugs.xml, that would be imported by every module because in this way I reduce duplicated code.

<?xml version="1.0" encoding="UTF-8"?>
<project name="changeme" default="all" basedir=".">

 <!-- where SpotBugs is located -->
 <property name="spotbugs.home" value="${basedir}/../../libs/spotbugs" />

 <path id="spotbugs.classpath">
 <fileset dir="${spotbugs.home}/lib">
 <include name="**/*.jar" />
 </fileset>
 </path>

 <taskdef name="spotbugs" classname="edu.umd.cs.findbugs.anttask.FindBugsTask">
 <classpath refid="spotbugs.classpath" />
 </taskdef>

 <target name="spotbugs" depends="jar">
 <echo message="${spotbugs.home}" />

 <property name="output.folder" value="${basedir}/../../output" />

 <!-- I launch SpotBugs -->
 <spotbugs home="${spotbugs.home}"
 output="xml"
 outputFile="${output.folder}/${code.name.base}_spotbugs.xml"
 >
 <sourcePath path="${basedir}/src/java" />
 <auxClasspath path="${module.classpath}" />
 <class location="${suite.dir}/build/cluster/modules/${module.jar.basename}" />
 </spotbugs>
 </target>

</project> 

Writing the task was easy because SpotBugs/FindBugs’ ANT task is well documented, and I had just to plug the right variables that were generated by the NetBeans build system thanks to the dependence to the jar task.

The output format must be XML so I can merge the results later and it is better to pass the path used to build the module (auxClasspath). The class tag points to the generated jar file.

Inside each module’s build.xml I added this line to import the file:

<import file="${basedir}/../../spotbugs.xml" />

The next step was to launch the ANT target on each project, collect the results and convert them into HTML. I modified the module suite’s build.xml to perform this.

<property name="spotbugs.home" value="${basedir}/../libs/spotbugs" />

 <path id="spotbugs.classpath">
 <fileset dir="${spotbugs.home}/lib">
 <include name="**/*.jar" />
 </fileset>
 </path>

 <taskdef name="unionBugs" classname="edu.umd.cs.findbugs.anttask.UnionBugs">
 <classpath refid="spotbugs.classpath" />
 </taskdef>

 <taskdef name="convertXmlToText" classname="edu.umd.cs.findbugs.anttask.ConvertXmlToTextTask">
 <classpath refid="spotbugs.classpath" />
 </taskdef>


 <target name="spotbugs" depends="-init">
 <!-- I define some variable -->
 <property name="output.folder" value="${basedir}/../output" />
 <property name="xml.output" value="${output.folder}/spotbugs.xml" />
 <property name="html.output" value="${output.folder}/spotbugs.html" />

 <!-- I remove the previous files-->
 <delete failonerror="false">
 <fileset dir="${output.folder}" includes="**/*"/>
 </delete>

 <mkdir dir="${output.folder}" />

 <subant buildpath="${modules.sorted}" target="spotbugs" inheritall="false" inheritrefs="fakse" failonerror="false" />

 <unionBugs to="${xml.output}" >
 <fileset dir="${output.folder}">
 <include name="**/*_spotbugs.xml" />
 </fileset>
 </unionBugs>

 <convertXmlToText
 classpathref="spotbugs.classpath"
 input="${xml.output}"
 outputfile="${html.output}"
 format="html:fancy-hist.xsl"
 />

 </target>

In the script above, first I define some useful variables, then I delete the old output, finally, there is the most important part: the subant task that invokes SpotBugs on all modules. The modules.sorted variable has the list of all suite modules and it is very convenient in this case.

The unionBugs task merges all the .xml files generated by the previous subant task into a single XML file that is converted to HTML by the convertXmlToText task.

The convertXmlToText task lets specify how the HTML file will be generated with the format attribute; if we take a look at the documentation we can use specify 4 type of formatting (plain.xsl, default.xsl, fancy.xsl, fancy-hist.xsl) or use our own.

Running the spotbugs target in the suite will generate a spotbugs.html file inside the output folder at the same level of the suite.

if you open it will look like this:

 

A small note about SpotBugs: SpotBugs is a fork of FindBugs, so if you point to the FindBugs home instead of the SpotBugs one everything should work the same way, the class packages are also the same. However, I had some problems building SpotBugs, I could clone the git repository and launch Gradle to generate its jars, but I had to manually rename them and put them in a proper directory structure to make them work. I have included them in the GitHub repository to make your life easier.

 

 

 

 

 

NetBeans – Michael's blog - April 02, 2017 08:07 PM
JavaLand 2017

The fourth edition of JavaLand had been on March 28th + 29th 2017. JavaLand is one of the biggest Java Congresses in Europe and is hosted in my home town. Yesterday I wrote my reports for an online channel as well as for a German printed magazine. Here I’ll blog about it from three personal […]

Adam Bien - April 02, 2017 07:24 PM
Masterdata Diffs, CORS, Multi-Tenant EM, Service Discovery, HATEOAS and JAX-RS, Career Boost, ContextResolver, LB Microservices, DB Sharing or Topics For The 37th airhacks.tv

Topics (https://gist.github.com/AdamBien/beae7dd8966a6d57b7225ba310b18abe) for the 37th airhacks.tv Questions && Answers live show for Monday, 3rd April, 6pm CET:

  1. Best technology to distribute masterdata diffs
  2. CORS and Access-Control-Expose-Headers
  3. How to implement token based authentication in Java EE?
  4. Monitoring Java EE applications in production (with pretty UI)
  5. Tenant-dependent EntityManager injection
  6. Service discovery and Java EE 7
  7. How to build Hateos links with JAX-RS?
  8. Ideas to improve your career
  9. Solutions for mobile applications for Java EE services
  10. What is javax.ws.rs.ext.ContextResolver?
  11. Naming for load balanced microservices
  12. How JTA transactions are implemented under the hood?
  13. Security in Java EE 8 news
  14. Thin WARs in practice
  15. Declarative JSON validation
  16. Microservices and DB sharing
  17. Plain Java SE without Java EE -- is it viable in real world?

Ask questions during the show via twitter mentioning me: http://twitter.com/AdamBien (@AdamBien) or using the hashtag: #airhacks. You can join the Q&A session live each first Monday of month, 6 P.M at airhacks.tv or http://www.ustream.tv/channel/adambien

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.
Real World Java EE Workshops [Airport Munich]>

NetBeans – Michael's blog - March 30, 2017 08:40 PM
JShell at JavaLand – Slides

Yesterday I had my talk at JavaLand. It was all about Java 9’s great JShell, its API and a short view at its integration within NetBeans. Mathias had been so nice to take this snapshot of my talk. Although I prepared a lot of slides, I showed only a few one and demonstrated the JShell […]

Adam Bien - March 27, 2017 03:49 AM
firehose v0.0.1 released --the prometheus gateway for Java EE (micro) service monitoring

firehose v0.0.1 (ignition) the MIT-licensed, "prometheus metrics gateway" is available as docker image, Thin WAR.

firehose connects to (micro) services (Thin WARs), gathers monitoring data and provides it in prometheus-compliant format. Lacking metadata can be provided via environment variables at docker start or via HTTP / JSON at runtime. New endpoints can be re-configured on-the-fly. One firehose instance can handle multiple endpoints. Firehose is a 16 kB Java EE 7, zero dependency, Thin WAR.

Firehose and prometheus are going to be covered in Java EE Microservices / javaeemicro.services and Java EE Monitoring, Performance and Troubleshooting workshops.
Real World Java EE Workshops [Airport Munich]>

Geertjan's Blog - March 26, 2017 08:41 PM
Running NetBeans IDE 9 Development Build on JDK 9 EA Build 162

For the adventurous, interesting times ahead since you're able to try out the NetBeans IDE 9 development build on top of JDK 9 EA, in my case, Build 162.

When you configure that in your 'etc/netbeans.conf' file, the first thing you see on start up is this error, which appears to be related to the Darcula plugin that I'm using. Of course, since it's awesome despite this aspect for the moment, I'm using the Darcula plugin, which you can download and install from here, i.e., simply use the latest release of the plugin for 8.2, works fine in 9 development builds, except for this error.

After seeing the above, simply click Cancel, and, so far, despite the above, things are pretty good!

There are two big advantages to running the NetBeans IDE 9 Development Build on top of JDK 9.

The first is that the fonts are automatically a lot better, at least, on Windows and, at the very least, on my system (click to enlarge the below, where you see NetBeans IDE 9 Development Build on JDK 9 on the left versus on JDK 8 Update 121 on the right):

The second advantage is that you automatically have JShell integration (choose Tools | Open Java Platform Shell), as shown below. Excellent enhancement here is that, since the last time I used it, there's now a code fold for the text at the top of the JShell.

Until further notice, this is the environment I'll be using. 

Geertjan's Blog - March 24, 2017 04:43 PM
New: JDK 9 Jigsaw Modular Projects in NetBeans IDE

The NetBeans IDE 9 development builds now enable you to create Java Modular Projects, i.e., Jigsaw projects that can contain multiple Jigsaw modules, which can be compiled together as a unit:



They're visualized as follows, for example, in this case, for the Jigsawified Anagram Game (discussed here):

Details: 

Adam Bien - March 22, 2017 07:53 AM
polymer 2.0 with browsersync: a minimal installation / hot reloading

For a minimal polymer (2.0) with browsersync (hot reloading) installation perform the following steps:

  1. Install www.npmjs.com
  2. Install bower.io with: sudo npm install -g bower
  3. Install browsersync.io with: sudo npm install -g browser-sync

Create bower.json with minimal dependencies:


{
  "name": "(...)",
  "main": "(...).html",
  "dependencies": {
    "polymer": "Polymer/polymer#^2.0.0-rc.2"
  },
  "devDependencies": {
    "webcomponentsjs": "webcomponents/webcomponentsjs#^1.0.0-rc.5"
  },
  "resolutions": {
    "polymer": "^2.0.0-rc.2"
  }
}
    

Execute: bower install

Maintain your code in src folder

Launch browsersync with with: browser-sync start --server src -f "**/*" --serveStatic ./bower_components -b "google chrome" --no-notify

Browsersync will open chrome, serve static files (polymer libs) from bower_components folder and watch src folder. Any changes are going to be automatically pushed to the browser without reloading. Skip the bower_components folder in all imports:

	
<link rel="import" href="polymer/polymer-element.html">
(...)
<script src="webcomponentsjs/webcomponents-lite.js"></script>
	
    

Also see sample project: github.com/AdamBien/polymer-essential

Interested in lean apps? See you at Java EE Workshops at Munich Airport, Terminal 2 and particularly at Building HTML 5 Applications with WebStandards only
Real World Java EE Workshops [Airport Munich]>

DukeScript - March 20, 2017 08:23 AM
DukeScript with Node.js backend

In one of our latest projects the customer has decided to use Node.js as a backend. So we decided to share a minimal demo how simple it is using DukeScript APIs.

You’ll need node installed and in addition the websocket module. Here’s the server, we’re using a websocket to make it a little fancier.

var ipaddress = 'localhost';
var port = 8085;

const WebSocket = require('ws');

var WebSocketServer = WebSocket.Server
  , wss = new WebSocketServer({host:ipaddress, port:port});

wss.broadcast = function(data) {
  wss.clients.forEach(function each(client) {
    if (client.readyState === WebSocket.OPEN) {
        console.log('send response');
      client.send(data);
    }
  });
};

wss.on('connection', function (ws) {
    ws.on('message', function (message) {
        console.log('received message ' + message);
        wss.broadcast("{message: 'message from server'}");
        setInterval(function () {
            wss.broadcast("{message: 'message "+i+" from server'}");
            i++;
        }, 5000);
    });
});

The websocket server sends a simple JSON message every 5 seconds after we connected. Don’t worry too much about the server code. This is just for demo purposes. Now we need a Java model to read the message:

@Model(className = "Data", targetId = "", instance = true, properties = {
    @Property(name = "message", type = String.class)
})
final class DataModel {
}

DukeScript has the extremely convenient @OnReceive annotation, that takes care of serializing messages to and deserializing messages from the server. So we extend our class with:

@OnReceive(url = "ws://localhost:8085", data = Data.class, method = "WebSocket")
public static void receive(Data data, Data message) {
    if (message != null) {
        ui.setMessage(message.getMessage());
    } else { // null means: connection established
        System.out.println("conection established");
    }
}

This will generate a method in our Model class with all the boilerplate code. To establish the connection you once call the method with a null argument.

private static Data ui;
static void onPageLoad() throws Exception {
    ui = new Data("Hallo");
    ui.applyBindings();
    ui.receive(null); //connect
}

After that you can call the receive method with data to send and receive messages via the websocket. The websocket can also push back messages to you. Let’s add a @Function, so we can send a message from the UI:

@Function
public static void send(Data data) {
    data.receive(data);
}

Now we only need a UI to start the connection, so we add this to our View:

<input type="text" data-bind="textInput: message">
<button data-bind="click: send">Send Message</button>

The full code to play with is available on Github.

And if you want to code the Node based server in Java as well, have a look at this project: Node4J.

That’s it. Easy, isn’t it? Have fun coding DukeScript!

Adam Bien - March 19, 2017 04:59 AM
Voxxed Days At Cern: Java EE -- As Cool As The LHC

After watching the keynote at Voxxed Day CERN I decided to add the "almost" to the title: "Java EE -- (Almost) As Cool As The LHC":

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.
Real World Java EE Workshops [Airport Munich]>

Adam Bien - March 18, 2017 10:12 AM
Yes/NO User Input in Jenkinsfile

The method input within the Jenkinsfile suspends the build and waits infinitely for the user input with configurable options.

A Yes / No dialog waits for user input and returns true / false with the following code snippet:


def doesJavaRock = input(message: 'Do you like Java?', ok: 'Yes', 
                        parameters: [booleanParam(defaultValue: true, 
                        description: 'If you like Java, just push the button',name: 'Yes?')])

echo "Java rocks?:" + doesJavaRock

See you at Java EE Workshops at MUC Airport, particularly at the Java EE CI/CD, Testing and Quality workshop
Real World Java EE Workshops [Airport Munich]>

Adam Bien - March 17, 2017 12:14 PM
JMS Redelivery, HA Singletons, Message Ordering, Test Coverage, JSON-P vs. JSON-B, UI Strategies or 36th airhacks.tv Episode Is Available

The 36th airhacks.tv, or 3 years anniversary live question and answers show with 96 live viewers and 20+ topics is available:

Past episodes are available at: airhacks.tv playlist.

Any questions left? Ask now https://gist.github.com/AdamBien/beae7dd8966a6d57b7225ba310b18abe and see you at April, 3rd, 6pm CET.

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>

APIDesign - Blogs - March 15, 2017 05:27 AM
Advanced Injection in Jersey

I've just learned a new trick: proper way to do JerseyInjection. Maybe somebody finds it useful...

--JaroslavTulach 05:27, 15 March 2017 (UTC)

DukeScript - March 07, 2017 08:23 AM
How to display a "Loading" Indicator

When deploying a DukeScript Application to the Browser, it takes a bit until the Java libraries are loaded. During that time the HTML is already displayed.

Since the Bindings aren’t applied yet, the application will look “broken” for a few moments. Let’s take my little match 3 game as an example. Here’s what it’s supposed to look like:

And here’s how it looks before the bindings are applied:

Obviously that’s not very nice. It’s not a big issue for desktop applications where the view typically only takes a few milliseconds to load. But it’s clearly visible when you deploy it in the browser, because the Java Libraries are still loaded via the internet while the game is already displayed.

It would be much nicer if there was a splash screen while the game is loading.

Let’s fix this. Fortunately I have a nice image that I can display as a loading screen:

To show the image we add a div to the html of the page:

<div id="title" ></div>

We now make the image visible at the beginning via CSS:

#title {
    background-color: black;
    background-image: url("../assets/title.png");
    padding-top: 0;
    position: absolute;
    background-size: 100%;
    background-repeat: no-repeat;
    width: 100vh;
    height:100vh;
    margin-left: auto;
    margin-right: auto;
    left: 0;
    right: 0;
    z-index: 10;
}

Now the only thing left to do is to make the image vanish, when the page is loaded. We can do so via a boolean Property in our Model:

@Model(className = "Level", properties = {
    @Property(name="loading", type=boolean.class),
    //  other Properties omitted
}, targetId = "")
class LevelVM { 
    //...
}

The property will only take effect when the Application is loaded, so we can safely use it in our DIV:

<div id="title" data-bind="visible: loading"></div>

In our “onPageLoad”-method we set the property to “false” and the startup page vanishes. And now this is what users see while the application is loading:

Click here to see it in action.

That’s it. Simple isn’t it? Have fun coding DukeScript!

Adam Bien - March 07, 2017 06:10 AM
Java 8: An Endless Stream Of Random Numbers

The method Math#random is a Supplier<double> and can be used to generate an endless Stream or random numbers:


import java.util.stream.Stream;
import org.junit.Test;

public class RandomNumbersTest {

    @Test
    public void streamNumbers() {
        randomStream(10).
                limit(10).
                forEach(System.out::println);
    }


    public Stream<Long> randomStream(int range) {
        return Stream.generate(Math::random).
                map(n -> n * range).
                map(Math::round);
    }
}

The unit test above generates:

5 4 2 9 8 9 9 0 9 8

(...hopefully a different sequence on your machine :-))

See you at Java EE Workshops at Munich Airport, Terminal 2 or Virtual Dedicated Workshops / consulting. Is Munich's airport too far? Learn from home: airhacks.io.


Real World Java EE Workshops [Airport Munich]>