Č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)
NetBeans – Michael's blog (feed)
DukeScript (feed)
ProNetBeans (feed)
Paulo Canedo » NetBeans English (feed)
NetBeans – NetBeans Ruminations (feed)
Anchialas' Java Blog (feed)
Category: NetBeans | Software and Science (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)
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)
Need to find a title (feed)
Roger Searjeant's blog (feed)
NetBeans – John O'Conner (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 Community Docs Blog (feed)
Diego Torres Milano's blog (feed)
The Netbeans Experience (feed)
NbPython/ jpydbg / pymvs (feed)
Manikantan's Netbeans (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)
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)
Devel Blog (feed)
diamond-powder (feed)
Antonio's blog (feed)
Where's my Blog?!

Powered by:    Planet

Last updated:
June 25, 2017 12:02 AM
All times are UTC

Sponsored by
sponsored by Oracle

visit NetBeans website
Adam Bien - June 22, 2017 08:20 AM
Java EE -- The Competitive Advantage For Startups

At the infoshare.pl 2017 conference in Gdansk I got 30 minutes time to explain why Java EE is happily used by startups with live hacking. Deployment to Amazon Cloud (AWS) included:

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 - June 16, 2017 01:54 PM
Don't Push and Pull!

It is hard to push and pull at once in real life and people tend to know it. Yet I have witnessed many attempts that try to put both approaches into the same API at the same time and pretend those are equal. Small advice from a former API designer: don't do it!

For a longer advice please see the pull vs. push essay.

--JaroslavTulach 13:54, 16 June 2017 (UTC)

Adam Bien - June 16, 2017 08:07 AM
Building and Running a Fullstack Java EE ThinWAR in Oracle Container Cloud Service ...in 7 Minutes

7 minutes are sufficient to:

  1. Create Java EE 7 application (single JAX-RS endpoint) from scratch with Maven 3
  2. Build an executable Docker image based on CentOS 7, openJDK 8, GlassFishv5 and a ThinWAR (the app from above). The glassfishv5 file was used from: https://github.com/AdamBien/docklands
  3. Push the executable image to public docker registry: http://hub.docker.com/u/airhacks/
  4. Create a service in Oracle Container Cloud Service: https://cloud.oracle.com/container

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 - June 14, 2017 05:31 AM
Beautiful Java EE, JWT, EAR cases, Dynamic Serialization, @Asynchronous Testing or 39th airhacks.tv is online

39th airhacks.tv is available:

Any questions left? File the your questions now https://gist.github.com/AdamBien/37e7dde8f2ef447edfa04354b9819b7d or see you in MUC at: http://workshops.adam-bien.com.


Real World Java EE Workshops [Airport Munich]>

netbeans – markiewb's blog - June 13, 2017 10:48 PM
Java code formatting done right across different IDEs

http://blog.exxeta.com/java/2017/06/13/java-code-formatting-done-right-across-different-ides/


DukeScript - June 11, 2017 09:23 AM
Spice your Android app with Web Components!

Developing an Android application with Android Studio and in a need to talk to an HTML/web component? Then this article is for you. It gives a step by step description of how to add any web component into your application. We show how to communicate with it in the same language that you use for the native part of your application.

Let’s get started…

Setting the Project up

First of all you need Android Studio (can be downloaded from here). At the time of writing this tutorial version of 2.3.1 of Android Studio was used. The steps shall however be general enough to be applicable to any version. Let’s create a new project with an empty activity:

New Project in Android Studio Target devices Empty activity

Let’s put two buttons, one text area and most importantly a WebView component to the activity:

Design Activity

So far we’ve been using standard Android Studio tools. Now the time has come to turn the WebView into chart renderer. To do so, let’s use the DukeScript Presenter for Android and the charts library. Select File/Project Structure menu item and in the Dependencies tab add these two libraries as shown on following picture:

Project Dependencies

The project setup is finished. Now we can start writing the real application code.

The Code

First of all we need an HTML page to be displayed in the WebView. The page doesn’t have to be complex - it can contain just a single <canvas> element that will span over the area of a WebView.

Create assets directory. Right click app, choose New/Folder/Assets Folder and create your HTML file in that folder. Call it chart.html and put the following content to it:

<h1>Hello from DukeScript!</h1>

<canvas id="chart" width="300" height="300"></canvas>

Prepare the WebView for Java Access

The next step is to load the page into our WebView component and initialize the view for access from Java. This is done in the onCreate method of our MainActivity class:

import com.dukescript.presenters.Android;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    WebView web = (WebView) findViewById(R.id.web);

    onWeb = Android.configure(null, web, "file:///android_asset/chart.html", false);
}

The configure method initiates loading of the provided HTML page and returns an Executor that can be used to modify content of the page from Java any later time. Let’s store it in a field called onWeb.

Modify the HTML Content

There can be multiple WebView components in each activity. When using any API that needs access to the HTML context, it is important to select the WebView one intents to work with. This is done by using the previously returned Executor instance.

import net.java.html.charts.Chart;
import net.java.html.charts.Color;
import net.java.html.charts.Config;
import net.java.html.charts.Values;

onWeb.execute(new Runnable() {
    @Override
    public void run() {
        chart = Chart.createBar(
            new Values.Set("left", Color.valueOf("red"), Color.valueOf("magenta")),
            new Values.Set("left", Color.valueOf("blue"), Color.valueOf("violet"))
        );
        chart.getData().add(new Values("state", 1, 1));
        chart.applyTo("chart");
    }
});

The example is using the Charts API for Java provided as one subproject of the whole DukeScript effort. First of all we use the onWeb instance of Executor associated with our WebView to enter the right context. Then we create new instance of bar chart (other types of charts like line, pie, doughnut, radar, polar are also available as the documentation showcases). We prepare some initial values and add them to the chart. Then we bind the chart to an existing <canvas> element on the page using applyTo method.

Web Component in Android app

That’s it. When you execute your application, you shall see the chart taking most of your screen.

Congratulation. You have just successfully used a Web Component in your Android application - and please note: without a single line of JavaScript!

Reacting to Events

Showing static HTML content is a nice initial step, but of course, the goal is to make it live. The android activity we designed contains two buttons - let’s connect them with the chart!

Button left = (Button) findViewById(R.id.left);
left.setOnClickListener(onWeb(new View.OnClickListener() {
    @Override
    public void onClick(View view) {
        chart.getData().set(0, new Values("state", ++leftCount, rightCount));
    }
}));

This is a typical Android code. It locates your component and attaches a listener to it. When the click is triggered, it accesses the data of existing chart and modifies them by increasing either left or right column in the chart.

Your Charts web component is now alive - again without any use of JavaScript and fully integrated into your Android application.

Reacting to Web Component Events

Of course, not only native Android components influence the web components. In a real application web components can also influence the native ones. Here is an example showing how that can be achieved:

chart.addChartListener(onUi(new ChartListener() {
    @Override
    public void chartClick(ChartEvent chartEvent) {
        if (chartEvent.getValues() == null || chartEvent.getValues().length != 2) {
            return;
        }
        final String msg = "Red is " + chartEvent.getValues()[0] + " blue is " + chartEvent.getValues()[1];
        TextView text = (TextView) findViewById(R.id.text);
        text.setText(msg);
    }
}));

When creating your chart, you can attach a listener to it. It gets triggered when a click on the chart is detected and is called back with an event object providing information about the location of the click. In response of such click, we can locate our text view (another native component) and change its text property.

Summary

We have successfully enhanced our native Android application with a web based component - in this case a bar chart - and have done so without a line of JavaScript. This is possible thanks to DukeScript Presenter for Android and its configure method that allows you to turn any WebView in your application into a full featured DukeScript presenter.

There is a lot of innovation happening in the HTML landscape. DukeScript project gives you access to all of that from inside of your Android application and while using the same language that you use for the rest of your application.

Where to go from here?

Check the Android.configure documentation to understand possible embedding alternatives.

Read the overview javadoc page to see available Java APIs that have already been prepared and documented by the DukeScript documentation project. Choose from charts, maps, JQuery, knockout, canvas, SVG, and more…

Get the sources of here-in presented application, clone, fork, enhance. See the GitHub project.

Talk back. Contact us via forums, twitter or support channels.

Enjoy

Enjoy web components inside of your Android app done the proper Java way!

DukeScript - June 07, 2017 08:11 AM
Version 1.3 of Mobile Presenters

The presenters are the soul of any DukeScript system. They help you to code in Java (or other JVM based language) and render in HTML - on Android, iOS, desktop, etc. Here comes a short note about them.

Version 1.3 has just been uploaded to Maven central, and its javadoc has been published too.

Check the javadoc for the Android class - it comes with a new advice how to embed DukeScript views into your existing Android applications.

Spice your Android apps with DukeScript!

Adam Bien - June 06, 2017 08:56 AM
Java EE Application Servers Are Not Suitable To Host Microservices

Due to low footprint, fast startup and low runtime overhead ("The Overhead Of Java EE Application Servers"), deploying multiple WARs into one application server instance running on a single JVM does not save a considerable amount of resources unless you have to deal with Netflix-like scale (ten thousands of dynamic VMs).

You could manage multiple WAR-microservices on a shared application server, but this approach would come with serious disadvantages:

  1. Less Isolation: A misbehaving WAR can influence other microservices
  2. Complicated Monitoring: it is harder to monitor the activity of a single WAR
  3. Less Stability: a redeployment of a WAR could influence others (memory leaks, classloader leaks)
  4. Less scalability: it is harder to scale a single process, than multiple processes
  5. More complex CI / CD: an executable image will contain multiple microservices and requires coordination between teams

Java EE Application Servers are not suitable to host multiple microservices. The way to go is to ship exactly one Thin WAR ("Thin WARs, Java EE 7, Docker and Productivity") with one application server instance and consider the OS, JVM, applicaton server and the Thin WAR as the executable unit.

A Java EE microservice architecture is about multiple application servers hosting exactly one WAR ("Why Not One Application Per Server?) communicating with each other. Using a single application server instance as a microservice runtime is too brittle, too complicated and hard to justify with numbers.

See you at Java EE Microservices where we build Java EE Thin WARs, and Java EE CI/CD, Testing and Quality workshop where the Thin WARs get automatically deployed.
Real World Java EE Workshops [Airport Munich]>

APIDesign - Blogs - June 06, 2017 08:54 AM
Just Code

Is it JustCode that matters in a project or do projects need more? Is it necessary to have a bug tracking system or can we embed everything in the code? Is it better to keep snapshot of an API in the code or track it independently with additional tools?

Check my JustCode essay to see the benefits and drawbacks of both approaches.

--JaroslavTulach 08:54, 6 June 2017 (UTC)

Adam Bien - June 05, 2017 08:25 AM
2017 Free Summer Java Events, Workshops and Sessions

  1. Free: Oracle Code Brussels, 6th June, 9 AM, Enterprise java.net: A Slideless Keynote
  2. Devoxx Krakow, 21th June, Session: "Build To Last: From Frontend To Backend #slideless #talk"
  3. 27th-29th June, airhacks.com: Java EE 7 (and a bit 8) Bootstrap (very few seats available), Effective (very few seats available) and Java EE CI, CD (Jenkins 2 Pipelines), Testing and Quality Workshops at Munich's Airport, Terminal 2. workshops.adam-bien.com
  4. Free: July 18th, Munich (location TBD), evening event: "Pragmatic Architectures With Microservices" follow up meeting in Munich. This time #slideless (one slide recap).

...or see you at airhacks.io or airhacks.tv.


Real World Java EE Workshops [Airport Munich]>

Adam Bien - June 05, 2017 07:56 AM
EAR Use Cases, JSF Modularization Again, JWT, CRUD Generators, Subset Entity Serialization, @Asynchronous Testing, Fat WARs, or 39th airhacks.tv

Topics (gist) for the 39th airhacks.tv, June 5th, 5 pm CET (one hour earlier):

  1. News
  2. Follow up JSF modularization
  3. Beautiful Java EE frontends
  4. JWT Authentication With Java EE
  5. Java EE CRUD Code Generators / bootstrap Frameworks
  6. Are there still use cases for EARs?
  7. Serializing a dynamic subset of fields / properties
  8. JPA with WildFly
  9. Testing @Asynchronous methods
  10. Fat WARs -- if you really need them
  11. Use Cases and experiences with Java EE Batch
  12. Multitenancy with JPA
  13. Opinions about Multiple WARs, one server, one DB

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 – Enrico Scantamburlo - June 04, 2017 12:55 AM
Programmatically install a module in a NetBeans Platform Application

Since we developed a new feature for my company software, I was asked to automatically install the help module for this one. The only way to do it was to install the module programmatically because we couldn’t add a dependency since all the help modules sit in a different suite.

You can find a copy of the code on my Github repository.

First of all, I added an Installer to my module because I wanted to check if the module was installed or not at the when the application starts.

To add an Installer, just right click on your module in the Project View and select New/Other…, in the popup window that appears select Module Development on the left and Installer / Activator on the right, continue with the wizard and NetBeans will create one file called Installer.java with a restore() method that will be called every time the application starts.

The first thing I do is to refresh the application module list because it might happen that the application does know new modules are available yet.

// I refresh the module list
for (UpdateUnitProvider provider : UpdateUnitProviderFactory.getDefault().getUpdateUnitProviders(false)) {
    try {
        provider.refresh(handle, true);
    } catch (IOException ex) {
        LOGGER.log(Level.SEVERE, null, ex);
    }
}

Then I search for my module UpdateUnit, an UpdateUnits represents something we want to install or update.

  • List<UpdateUnit> updateUnits = UpdateManager.getDefault().getUpdateUnits();
    UpdateUnit moduleUpdateUnit = null;
    for (UpdateUnit updateUnit : updateUnits) {
         final String codeName = updateUnit.getCodeName();
         if (MODULE_CNB.equals(codeName)) {
             moduleUpdateUnit = updateUnit;
            break;
        }
    }
    

    I ask if there are any updates available, in this case, the module is not installed so the platform will install it.

    List<UpdateElement> availableUpdates = moduleUpdateUnit.getAvailableUpdates();
    UpdateElement update = pickLatest(availableUpdates);
    

    Finally, I can start the real installation: I create an OperationContainer which will take care of the operation.
    Some notes here:

  • The InstallSupport doDownload() methods take three parameters: the ProgressHandle,  a boolean to install the module for all users or only for the current one and a second boolean that allows setting the user dir as a fallback. I’d highly recommend setting the last argument to true.
  • The Restarter allows restarting the platform immediately or setting it to being restarted later, I prefer the former because is less invasive. In my company application, all modules require restarting before being installed for safety reasons.
    OperationContainer<InstallSupport> container = createForInstall();
    container.add(Collections.singleton(update));
    
     InstallSupport support = container.getSupport();
     try {
         Validator v = support.doDownload(handle, true, true);
         InstallSupport.Installer i = support.doValidate(v, handle);
         Restarter r = support.doInstall(i, handle);
         if (r != null) {
             support.doRestartLater(r);
             setModuleInstalled();
         }
     } catch (OperationException ex) {
         LOGGER.log(Level.SEVERE, null, ex);
     }
    

    Here there are some useful links:

  • NetBeans Update Centers content management process
  • NetBeans Architecture Answers for Auto Update Services module
  • Class OperationContainer<Support>

 


The image was designed by FreePik

NetBeans – Michael's blog - May 30, 2017 08:41 PM
Hunting session is open

Do you like hunting for bugs? Or confirming that NetBeans can be used without serious bugs? Then participate the Apache NetBeans (Incubating) IDE Community Acceptance Testing (NetCAT) program for NetBeans 9.0. Become one of the first who work with the upcoming version of this great Open Source IDE. Read the NetCAT FAQ [1] and join […]

Adam Bien - May 23, 2017 08:15 AM
Setting Timeout For JAX-RS / TomEE CXF Client

The name of the "read" and "connection" timeout properties is not standardized in Java EE 7. For TomEE / CXF clients you will have to use the "CXF-proprietary" names:


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

Client client = ClientBuilder.newClient();
client.property("http.connection.timeout", 500L);
client.property("http.receive.timeout", 500L);

The name differs in Jersey (used in GlassFish / Payara), but the semantics are the same.

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

Adam Bien - May 19, 2017 09:33 AM
Java EE (and Docker) Quickstart

  1. Create a Thin WAR Java EE project. Name it "micro".
  2. Create a Dockerfile in project folder with the following content:
                
                FROM airhacks/wildfly
                COPY ./target/micro.war ${DEPLOYMENT_DIR}                
                
            

    Also airhacks/payara, airhacks/tomee images are available from https://hub.docker.com/u/airhacks/. The docker files are maintained in https://github.com/AdamBien/docklands.

  3. Perform build from project folder: mvn package && docker build -t airhacks/micro .
  4. Run the project: docker run -d -p 8080:8080 --name micro airhacks/micro

See it in action: https://www.youtube.com/watch?v=P6Bk3Eiz3kE.

Behind the scenes:

  1. CentOS 7, JDK 1.8, the chosen application server (WildFly, Payara, TomEE) is going to be downloaded the first time (~560 MB, see https://youtu.be/hoqJdH87e7g) from https://hub.docker.com/u/airhacks/.
  2. All subsequent builds will only rebuild the Thin WAR -- it will take milliseconds. The smaller the WAR, the higher the productivity: https://youtu.be/5N4EUDhrkec
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 - May 15, 2017 12:44 PM
Gartner and Java EE, BCE, Modular JSF, Monitoring, JAX-RS Refactoring or 39th airhacks.tv

55 mins, 125 live attendees, ~20 topics ranging from Gartner and Java EE, BCE architecture, modular JSF, monitoring, REST refactoring, how to learn Java EE (see all topics), or the 38th airhacks.tv episode is available:

Any questions left? A fresh question queue is setup. Ask now: https://gist.github.com/AdamBien/b1a66dafdae21c0c40d647f05f44e57c and see you at June, 5th, 2017, 6 pm 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]>

NetBeans – Michael's blog - May 13, 2017 10:10 PM
Impressions from Tenerife II

I took a snapshot down into a Aloa Vera or similar plant. The camera automatically focused onto the ground and the picture shows very clear a leaf at the bottom of this plant. Then I manually focused on that little animal I discovered there. Two photos taken from the same position, showing very different details. […]

Adam Bien - May 11, 2017 11:37 AM
Java EE (and Microservice) Quickstart

  1. Create Thin WAR project with: mvn archetype:generate -Dfilter=com.airhacks:javaee7-essentials-archetype. (see: Setting Up Java EE 7 Projects With Maven 3)

    Result: 24 lines of pom.xml. The pom.xml only conatins a single dependency to Java EE 7 API. In real world projects you will only need to add test dependencies like JUnit or Mockito. The file beans.xml (one tag), was created to enable Depenency Injection (DI) everywhere and the annotated class JAXRSConfiguration activates JAX-RS under the resources uri. The generated Thin WAR project is a production ready template for Java EE / Microservices / Thin WARs.
  2. Create a JAX-RS resource, like .e.g.
            
        import javax.ws.rs.GET;
        import javax.ws.rs.Path;
        
        @Path("message")
        public class HelloResource {
    
            @GET
            public String message() {
                return "works!";
            }       
        }
    
    
  3. Perform mvn package and copy the Thin WAR ./target/[NAME].war (~4 kB) into the autodeploy / deploy folder of Java EE 6 / 7 / 8 application server of your choice.
  4. ...or download NetBeans "Java EE Edition", open the project, and click "run".
  5. Open the browser with: http://localhost:8080/[NAME]/resources/message

Use a full profile Java EE application servers (Payara, WildFly, TomEE, WebLogic, Websphere Liberty Profile). The download size varies between 55 MB and 200 MB. The runtime overhead is around 50 MB RAM (see live memory profiling: "The (RAM) Overhead Of Java EE Application Servers").

For mainstream (microservices) projects there is no further tuning, configuration or optimization required.

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 - May 08, 2017 04:33 AM
Gartner, BCE, Modular JSF, Firehose, Translations, Favorite Application Server, GET Refactoring or Questions for 38th airhacks.tv

Questions (gist) for the 38th airhacks.tv, May, 8th, 7pm (exceptionally one hour later):

  1. Java EE 8 and Oracle Code Conference News
  2. Gartner and obsolete Java EE
  3. BCE and loggers, custom validators and "helpers"
  4. Wider topic: what are helper classes?
  5. Modular JSF?
  6. Firehose: performance and scalability considerations
  7. Storing / caching translations
  8. Refactoring GET endpoints with query params
  9. Dealing with Jackson "Unknown Properties"
  10. My favorite application servers
  11. Cross cutting libs (e.g. JCache) and docker
  12. CDI Events and generic types
  13. IBM, RedHat and Project Jigsaw
  14. How to approach effectively Java EE
  15. Application servers, connection pools and clustering

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]>

DukeScript - May 07, 2017 04:51 PM
Can DukeScript Ecosystem Benefit from Java9?

Today we’ve got engaged into particularly interesting discussion: Can DukeScript benefit from Java9? Java9 is feature freezed and it’s release date seem to be unstoppable: thus it is really the right time to look at its features and analyze how an independent and extremely portable project like DukeScript could benefit from the new major Java release. Here are few things that crossed our minds.

Modularity - Meaning Small

DukeScript systems are designed to be heavily portable. They fit into your phone, iPad or even a browser. As such it seams fine that Java9 defines so called java.base module - e.g. the smallest independent deployment unit one can use when bundling a Java9 application. That is indeed good.

On the other hand the smallest unit still has more than three thousand of classes. E.g. it is not as small as it could be: for example when running DukeScript in a browser, it is possible to reduce the application to less than 1000 of classes - so there is still a room for improvement. But at least the Java maintainers are heading in the right direction.

JShell

It is common in the world of browsers that developers have an interactive console: a place to evaluate its queries while the program is running. JShell brings the same possibilities into Java9 and thus also into DukeScript based applications.

In theory we could give you the same console as JavaScript programmers have, but let you code in Java. Let you talk directly to your application: use for example typed JQuery to manipulate with DOM elements.

One question remains: is such feature what you want and need?

Something Else

There is said to be 55 new features in the up-coming release of Java9. We don’t see all of them to directly fit into the charter of DukeScript, but we may be missing something: What is your favorite feature and how it could enhance DukeScript?

Question for You!

How would you like us enhance DukeScript to benefit from Java9 features? Let us know: either by twitter or by participating in the discussion below.

Thanks for helping to make DukeScript better.

APIDesign - Blogs - May 05, 2017 04:08 PM
Midlife Crisis of an API Designer

I have to admit I am currently at a midlife crisis. I dedicated my last twenty years to promotion of a proper API design. I wrote TheAPIBook, I tried to propagate the principles of good APIDesign and modularity wherever I could. However I am tired...

Because it is always the same. Why do I have ask: where is your Usecase? What this method is good for? What do you actually want to achieve with this method/class/type? Have you considered the difference between APIvsSPI aspects of your design? Do you have a unit test? Is your proposed change BackwardCompatible? Do you have an evolution story for your design? Is your solution optimized for your comfort or comfort of users of your API? And so on and so on... People should read TheAPIBook before attempting to design an API, but they don't and they make the same mistakes again and again.

I got so disgust that I feel sick, physically sick, when I have to think about API design. Last weekend Toni asked me to review an API he is creating and showed me what he has. I starred at him, then at the code and at him, etc. for three minutes before I could say a word. Then I had to apologize and describe my current MidlifeCrisis.

When I look at an API these days, all I see is the wasted potential the API could have, but it doesn't and never will, because the amount of investment I would have to do to educate the API stakeholder is so huge, that I just don't want to make it.

Anyway, if you have an API that you'd like me to improve, let me know. If I see real interest in proper API design my disgust and MidlifeCrisis may go away...

--JaroslavTulach 16:08, 5 May 2017 (UTC)

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


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]>

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]>