Saturday May 31, 2014

Easy Profiling Point Insertion

One really excellent feature of NetBeans IDE is its Profiler. What's especially cool is that you can analyze code fragments, that is, you can right-click in a Java file and then choose Profiling | Insert Profiling Point. When you do that, you're able to analyze code fragments, i.e., from one statement to another statement, e.g., how long a particular piece of code takes to execute:

https://netbeans.org/kb/docs/java/profiler-profilingpoints.html

However, right-clicking a Java file and then going all the way down a longish list of menu items, to find "Profiling", and then "Insert Profiling Point" is a lot less easy than right-clicking in the sidebar (known as the glyph gutter) and then setting a profiling point in exactly the same way as a breakpoint:

That's much easier and more intuitive and makes it far more likely that I'll use the Profiler at all. Once profiling points have been set then, as always, another menu item is added for managing the profiling point:

To achieve this, I added the following to the "layer.xml" file:

<folder name="Editors">
    <folder name="AnnotationTypes">
        <file name="profiler.xml" url="profiler.xml"/>
        <folder name="ProfilerActions">
            <file name="org-netbeans-modules-profiler-ppoints-ui-InsertProfilingPointAction.shadow">
             <attr name="originalFile" 
             stringvalue="Actions/Profile/org-netbeans-modules-profiler-ppoints-ui-InsertProfilingPointAction.instance"/>
             <attr name="position" intvalue="300"/>
            </file>
        </folder>
    </folder>
</folder>

Notice that a "profiler.xml" file is referred to in the above, in the same location as where the "layer.xml" file is found. Here is the content:

<!DOCTYPE type PUBLIC '-//NetBeans//DTD annotation type 1.1//EN' 
'http://www.netbeans.org/dtds/annotation-type-1_1.dtd'>

<type 
	name='editor-profiler'
	description_key='HINT_PROFILER'
	localizing_bundle='org.netbeans.eppi.Bundle'
	visible='true' 
	type='line'
        actions='ProfilerActions'
        severity='ok'
        browseable='false'/>

Only disadvantage is that this registers the profiling point insertion in the glyph gutter for all file types. But that's true for the debugger too, i.e., there's no MIME type specific glyph gutter, instead, it is shared by all MIME types. Little bit confusing that the profiler point insertion can now, in theory, be set for all MIME types, but that's also true for the debugger, even though it doesn't apply to all MIME types. That probably explains why the profiling point insertion can only be done, officially, from the right-click popup menu of Java files, i.e., the developers wanted to avoid confusion and make it available to Java files only. However, I think that, since I'm already aware that I can't set the Java debugger in an HTML file, I'm also aware that the Java profiler can't be set that way as well.

If you find this useful too, you can download and install the NBM from here:

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

A small bonus tip: how to cause the New Profiling Point dialog to appear in the same way as a breakpoint is set, i.e., by simply clicking in the glyph gutter on a particular line:

@ActionID(
        category = "Tools",
        id = "org.netbeans.eppi.GutterPPI"
)
@ActionRegistration(
        displayName = "Unused")
@ActionReference(
        path = "Editors/text/x-java/GlyphGutterActions", 
        position = 400)
public final class GutterPPI extends AbstractAction {
    public GutterPPI() {
        putValue("default-action", true);
    }
    @Override
    public void actionPerformed(ActionEvent e) {
        FileUtil.getConfigObject(
           "Actions/Profile/org-netbeans-modules-profiler-ppoints-ui-InsertProfilingPointAction.instance", 
           Action.class).actionPerformed(e);
    }
}

For details on the above trick:

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

Thursday May 29, 2014

New: Online NetBeans 8 Crash Course

On Twitter today I came across an announcement for a brand new on-line course in NetBeans 8. Since NetBeans 8 has been released during the past few months, the course is really very new. Go here to get there directly:

https://www.video2brain.com/de/videotraining/netbeans-ide-8-0-crashkurs

Here's the general idea. As you can see, the course is in German. With my basic understanding of German, I've had no problem in following the course. The trainer speaks clearly and slowly and everything is very well structured.

The course covers all the basics of NetBeans IDE. From getting set up to using all the key features. The quality of the videos is great and the content is clear and informative.

Once you've bought the course, all the lessons are unlocked. As you can see, they're all quite short and there's really a lot of content, didn't all fit into the screenshot:

Quite some work must have gone into this.

Here's one of the free lessons in the course, to give an idea of what you'll get:

https://www.video2brain.com/de/tutorial/texte-internationalisieren

This one is also free:

https://www.video2brain.com/de/tutorial/eclipse-projekt-importieren

I highly recommend this course especially if you're switching, or thinking about switching, from a different IDE and want to get a thorough overview of all the features that NetBeans IDE provides. Everything in the course is done within NetBeans, which means no slides, just code. You get to see the workflow of all the standard tasks and, for these purposes, the course does a really great job.

Wednesday May 28, 2014

YouTube: Tips by Bitwise Courses on NetBeans

I really like the potential of YouTube in providing a platform for short info clips that take not much time to produce and about as much time to consume. Huw Collingbourne's Bitwise Courses channel is full of exactly this kind of YouTube clip.

Several of his YouTube clips are about or make use of NetBeans. The related Twitter account is @bitwisecourses and the homepage is bitwisecourses.com.

Here's a great example, the latest YouTube clip created by Bitwise Courses. Very clear and simple explanation, on a specific and narrow topic, and very short and sweet. And very useful! Didn't know about this feature myself.

Direct link to the movie: https://www.youtube.com/watch?v=b0fKT_hFQpU

Here's to more of these, they're wonderful. More such YouTube clips are needed, short and precise, on very specific topics. And I'm very happy to promote them, as you can see.

Tuesday May 27, 2014

YouTube: 14 NetBeans Web Development Tips in 7 Minutes

Are you sure you're getting everything out of NetBeans IDE? Here, especially for HTML5 developers, i.e., you're using some kind of combination of HTML, JavaScript, and CSS, is a slightly-HTML focused series of tips for NetBeans usage. Several secrets included, i.e., features that don't have much UI and that are a question of needing to know that they're there, otherwise you'll never know about them.

Direct link to the (silent) movie: https://www.youtube.com/watch?v=JaqAi3r0k1Y

Monday May 26, 2014

YouTube: How to Style an AngularJS App on the Device

I installed the Droid@Screen plugin into NetBeans IDE 8 so that you can see the Android device that I held in my hand while doing the demo below. The demo shows the usage of the Terminal window to create an Ionic Framework application (from "tabs", which is one of the cool templates that the framework provides), i.e., that means I can use AngularJS to create a Cordova application out of the box, with many mobile-oriented components available out of the box.

Then I deploy the app to the Chrome browser on Android, which means I can interact with it in NetBeans, e.g., for CSS styling and JavaScript debugging. In this demo, I show how the background color of the deployed app can be changed live from NetBeans. After that, once I'm happy with the styling, I deploy the app again, but this time as a Cordova app, i.e., a hybrid HTML5 application, which means the app is packaged as a native app and deployed directly to the device from NetBeans.

All of the above can be viewed here in about 4 minutes in this silent movie:

Direct link to the (silent) movie: https://www.youtube.com/watch?v=isP5TNI3kYk

Sunday May 25, 2014

The ABC of Front End Web Development

And here it is, the long awaited "ABC" of front end web development, in which the items I never knew existed until I was looking to fill the gaps link off to the sites where more info can be found on them.

  • A is for Android and AngularJS
  • B is for Backbone.js and Bower
  • C is for CSS and Cordova
  • D is for Docker
  • E is for Ember.js and Ext JS
  • F is for Frisby.js
  • G is for Grunt
  • H is for HTML
  • I is for Ionic and iPhone
  • J is for JavaScript, Jasmine, and JSON
  • K is for Knockout.js and Karma
  • L is for LESS
  • M is for Mocha
  • N is for NetBeans and Node.js
  • O is for "Oh no, my JS app is unmaintainable!"
  • P is for PHP, Protractor, and PhoneGap
  • Q is for Queen.js
  • R is for Request.js
  • S is for SASS, Selenium, and Sublime
  • T is for TestFairy
  • U is for Umbrella
  • V is for Vaadin
  • W is for WebStorm
  • X is for XML
  • Y is for Yeoman
  • Z is for Zebra

Saturday May 24, 2014

YouTube: AngularJS for Cordova via Ionic and NetBeans

Ionic is a framework built on top of AngularJS for developing hybrid mobile applications via Apache Cordova. Setting everything up and having all the right tools available is trivial with NetBeans IDE, as this short (and silent) YouTube clip of about 5 minutes shows:

Direct link to the (silent) movie: https://www.youtube.com/watch?v=cX4TTJX8Vck

Friday May 23, 2014

YouTube: From AngularJS via Cordova to Android

A small (and silent) 10 minute introduction to basic AngularJS features, ending with simple instructions for deploying the app to Android.

Direct link to the (silent) movie: https://www.youtube.com/watch?v=f9-aymIW91Y

Thursday May 22, 2014

YouTube: How to Expose Data via REST and Consume it in Java

Within about 5 minutes, you too will know how simple it can be to expose data via REST deployed from GlassFish and consumed in a Java client. Here the Java client prints out some of the data it accesses, though a more complex UI could be created, of course, via JavaFX or the NetBeans Platform or, even better, both.

Direct link to the (silent) movie: https://www.youtube.com/watch?v=HISV7eagogI

Wednesday May 21, 2014

Expand Selection to Word

A nice idea by Dmitri Goosens on Twitter today, based on the rectangular block selection that has been a standard part of NetBeans IDE for a few releases already.

The idea with this functionality, known as "block selection" or "rectangular selection", is that you can switch on "block mode" and then select across lines and change text all at the same time:

Here you can see, I have changed "multiple" to "many" simply by selecting a block of "multiple" and then typing, just once, "many":

However, what if you want to change only some of the instances of "multiple" and what if they're not neatly lined up like above? That's the point Dmitri Goosen made on Twitter today.

So I started creating a plugin that lets the user select (by double-clicking) the words that should be changed all in one go. Right now, only the selection works, which was quite a bit of work to get right.

Below you can see that only some of the "multiple" words are selected, i.e., I created a plugin that turns any selected word/s into a specially highlighted area, not with the standard yellowy background, but by making the borders of the selected word/s blue:

When you press Escape, all the blue borders disappear, i.e., nothing is then selected anymore.

Here's the sources:

https://github.com/geertjanw/ExpandSelection2Word

Would be great if someone would clone them and then add code for changing the selected word/s to whatever the user types. A basic implementation is as follows, where the workflow is (1) select multiple words and then (2) press F12 to popup a small dialog where you can enter the replacement text. Then (3) press OK to perform the replacement.

Inline replacement will be better, same as replacement after block selection.

This could be incredibly powerful feature in NetBeans, i.e., imagine being able to select arbitrary words in a file and change all of them at the same time.

Tuesday May 20, 2014

Quickly Beef Up NetBeans with New Hints

One of the best NetBeans plugins is called "Additional Java Hints". Go to Tools | Plugins and you'll find it in the Available Plugins tab:

In the Hints tab, in the Options window, search for "additional" and you'll see all the new Java hints that are now available:

For example, here's one I like a lot. Put the cursor in the middle of a string and press Alt-Enter to bring up the available hints:

As you can see, you get "Split at caret" which comes from the Additional Java Hints plugin. Press Enter and your string is split at the caret:

Bring up the hints again by again pressing Alt-Enter and now you can join them again or copy the joined string to the clipboard, which are both hints from the Additional Java Hints plugin, seamlessly integrated with the flip operands hint that is a standard hint in NetBeans:

Thanks, Benno Markiewicz for this great plugin.

People are free to file RFEs at the GitHub project page:

https://github.com/markiewb/nb-additional-hints/issues

So, if you're missing a hint of any kind in NetBeans, especially Java hints, let Benno know at the location above. Or you can join in and work with him on hints yourself. I think this is a great contribution to the NetBeans community.

Monday May 19, 2014

Oracle ACE Director Markus Eisele: "Using Oracle WebLogic 12c with NetBeans IDE"

How to account for the resurgence of NetBeans and other related topics, in relation to WebLogic and more, are all discussed in this great new YouTube interview with Markus Eisele, who is an Oracle ACE Director as well as a Java Champion:

The link directly there: https://www.youtube.com/watch?v=QClRH-IGRM0

The article referred to above is here:

http://www.oracle.com/technetwork/articles/soa/eisele-weblogic-netbeans-2193786.html

Friday May 16, 2014

From Project to Scenario

One of the powerful features of the NetBeans Platform is its project system. You can include NetBeans modules in your application that let the user choose File | New Project and then the user can begin creating a new project:

The dialog below then opens, where sample templates of your project type can be listed so that the user can get started with it easily:

The details on setting all this up is described in the tutorial, as well as in NetBeans Platform for Beginners.

However, what if we don't like the word "Project"? Instead, we want the word to be "Scenario", throughout all the UI of our application, in each menu item and dialog? Simply right-click the application and choose Branding:

In the Branding dialog, go to "Internationalization Resource Bundles" and then search for the word/s that you want to brand, e.g., "New Project":

Then a search is done through all the strings in the NetBeans Platform, which are all found in properties files. Each matching string can be right-clicked, as shown above, at which point you can type in a different word.

All changes you make are shown in bold:

After you click OK in the dialog above, open the Files window, expand the 'branding' folder of your application, and you will find that new properties files have been created, in a folder structure matching the folder structure where the original key/value pairs are found.

When you build the application, you'll find that a JAR is added for each NetBeans module that you have overridden with your branded words:

And now your words will override those from the NetBeans Platform. For example, you'll see "Scenario" everywhere, instead of "Project".

One small 'gotcha' is to be aware of the ampersands:

In other words, if you search for "New Project", you will not find your words if they have an ampersand (for quick access via accelerator keys that are created for them by the NetBeans Platform Action System).

And that's all, a very simple and effective mechanism for turning the Project system into a Scenario system.

Thursday May 15, 2014

Get Started with Hippo CMS in 5 Minutes

Step by step instructions for setting up a development environment for doing development with Hippo CMS.

Direct link: https://www.youtube.com/watch?v=vamC1dNa860

(Note that the movie has no sound, instead read the blue boxes for explanations.)

Consuming Java EE in Desktop, Web and Mobile Frontends

I did a keynote session at JavaCro '14 this week, based on a presentation that Reza Rahman gives about Java EE/JavaScript. Here it is below, many adaptations from Reza's version, e.g., different title, but also many other alterations.

I talked to many attendees at the conference after the session above. Many are on a Spring/Hibernate stack, wondering where to go next. Some are considering JSF, especially PrimeFaces, others prefer the more pure-Java programming model of Vaadin (which was also represented at the conference), while others have dropped Java completely on the front-end and are moving to AngularJS. (I learned at the conference that one very big bank in the Netherlands has done that for its customer front-end, i.e., AngularJS on top of Spring.) More and more developers have hybrid skills, so they don't care whether some of their work is in Java, with other parts in JavaScript. One (me, anyway) does wonder about the maintainability of such applications, however. Someone asked me if I had ever seen a million lines of JavaScript and how scary that would be to maintain. It seems to me, though, that JavaScript isn't being used for those types of applications, so that isn't really a valid critique. I.e., everything has its place.

The conference was excellent, I had a great time, met many new people for the first time and really enjoyed the town of Poreč. It was a very well organized conference as always.

Wednesday May 14, 2014

Virtual Developer Day in Europe/Middle East/Africa

Here's the link to the Virtual Developer Day to be held in the EMEA region today:

https://oracle.6connex.com/portal/java2014EMEA/login

If you use the old link, to the Virtual Developer Day in the Americas, you can watch all the sessions, but you won't get the live chats with the speakers, etc. Best to use the above link if you're attending today.

Times:

  • 9:00 AM  - 1:00 PM BST
  • 10:00 AM  - 2:00 PM CEST
  • 12:00 Noon - 4:00 PM GST
  • 12:00 Noon - 4:00 PM MSK

You'll see once logged in, which can be done from when the Virtual Developer Day starts, that the sessions are timeboxed, so that you first need to watch the keynote, then sessions per track in a specific order. All the sessions build up a complete picture of a particular technology, Java SE, EE, or Embedded, and it pays off to watch all the sessions in a particular track.

Tuesday May 13, 2014

OTN Provides New NetBeans Platform Tutorial

Great new and very detailed NetBeans Platform tutorial by John Kostaras from NATO:

Written for NetBeans Platform 7.4, but works for 8.0 too. Read it here:

http://www.oracle.com/technetwork/articles/java/rcp-todo-2194057.html

Monday May 12, 2014

Free Virtual Developer Day -- May 14, 9:00 - 13:00 in Europe/Middle East/Africa

I was recently involved in helping to put together part of the Virtual Developer Day, which was interesting and fun to do. The first of these was held last week in a US timezone. This week, on Wednesday you can attend it too/again, from 9:00 to 13:00 in Britain, one hour later in central Europe, etc, times below:

  • 9:00 AM  - 1:00 PM BST
  • 10:00 AM  - 2:00 PM CEST
  • 12:00 Noon - 4:00 PM GST
  • 12:00 Noon - 4:00 PM MSK

The sessions have been made especially for this event, covering Java SE, Java embedded, and Java EE. For example, amongst others, Simon Ritter talks about the new features of Java 8, Stephen Chin and Gerrit Grunwald talk about JavaFX, while Anegla Caicedo discusses Java embedded. Many examples and code demos are included and you'll see how all these technologies fit together.

Below is what it will look like, once you're logged in, which you can only do at the right time, i.e., shortly before the first session begins. Also, you can chat with each other and with the moderators, some of whom are the speakers in the sessions. For example, last week I attended and answered a lot of questions about NetBeans.

Make sure you can join in by getting everything set up on time, which you can do here.

Friday May 09, 2014

TomEE+, Apache CXF, and Maven in NetBeans 8

The most interesting thing about the awesomeness shown in the (silent) YouTube clip below is that everything you see in it is 100% free and supported out of the box, without needing to install plugins of any kind, in NetBeans 8:

https://www.youtube.com/watch?v=MTZnu-THXhc

It is also very easy to see above that everything, from registering TomEE+ to creating a Maven application to deploying the app and making changes and seeing those changes live takes about 4 minutes in total.

Thanks to Stepan Zebra from the NetBeans team for providing the steps for this YouTube clip and Ken Fogel for asking for them.

Thursday May 08, 2014

Java and NetBeans for Training Center Management

ITHRY Technologies has created a backoffice application for managing a training center.

In short, the purpose of the application is to enable the management of all the activities relating to a training center, specifically the following:

  • sessions
  • schedules
  • registrations
  • trainers
  • equipment
  • materials
  • participants
  • invoicing

Djamel Torche, who led the development of the application, sent me the screenshots below. The main reason the NetBeans Platform was chosen as the basis of the application was because of its module system, Plugin Manager, and update mechanism.

Above, you see the Welcome screen, which is simply the Welcome screen of NetBeans IDE, adapted for this application.

Above, you see a wizard to create training sessions with all the initial information, such as for related courses, participants, customers, and trainers of the session.

Above, you see the management window for editing courses and their categories. The BeanTreeView and OutlineView are used in addition to the Docking Frames framework.

Above, you see some basic and quick reports for training center activities, such as registration statistics, current sessions, trainer schedules, and invoices.

Above, you see the user management window, for the creation, modification, and deletion of users, as well as for changing passwords and permissions.

Above, you see JasperReport, which is used throughout the application to visualize and export activity data.

Want to create applications like this too? Here's how.
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« May 2014 »
SunMonTueWedThuFriSat
    
2
3
10
11
17
18
30
       
Today