Saturday Feb 07, 2015

React.js and NetBeans IDE

I tried some small experiments with React.js in NetBeans IDE today. It more or less works and NetBeans IDE is certainly a productive environment for React.js:

I set up JSX from the command line to watch my 'js' folder and push to the 'build' folder: 

From the above, it would appear that JSX is like SASS, i.e., it takes one file and generates another file from it, so creating support for it in NetBeans IDE it could be based on SASS integration in NetBeans IDE. 

In the Options window, I tweaked the Error category for JavaScript files so that red error lines aren't shown in the editor (the red error marks aren't a problem, though the red error lines make the code unusable) because the background of my Error category is more or less the same as the background of the editor: 

I'm looking into creating an editor that understands (no error messages) and supports (embeds HTML syntax coloring and code completion) for files that make use of React.js. 

Friday Feb 06, 2015

Takari: Maven Incremental Build

Add this to your POM:

<build>
    <plugins>
        <plugin>
            <groupId>io.takari.maven.plugins</groupId>
            <artifactId>takari-lifecycle-plugin</artifactId>
            <version>1.10.2</version>
            <extensions>true</extensions>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <compilerId>jdt</compilerId>
            </configuration>
        </plugin>
    </plugins>
</build>

Make sure you're using Maven 3.2.1 or above. Click to enlarge the image: 

Details:

Thursday Feb 05, 2015

Trip Report: Topicus

I had a great time introducing NetBeans IDE at Topicus, which does software development in Deventer, in the Netherlands. To the outside geeky world they're primarily known as the home of Wicket.

The group consisted of about 20 developers and looked like this:

To me, the session was an opportunity for me to warm up for NetBeans Day Netherlands (still seats available, sign up!), which will take place one week from now, and where I'll do a series of demos at the start of the day, making use of these slides, which I created for the Topicus session:

https://prezi.com/1cdqgrnox0cj/netbeans-ide/

Here's the main pieces of the technology stack used at Topicus:

  • Wicket
  • Maven
  • WildFly
  • Hibernate
  • Spring
  • Ember.js

They're increasingly moving away from Spring, and towards Java EE, have considered GlassFish/EclipseLink, and are now going for WildFly/Hibernate, and are going to move their front end towards Ember.js, though they don't seem 100% committed to that, though they do want a responsive client-side front-end, on top of a Java EE back-end using REST, of some flavor or other.

That's pretty much a standard scenario, I believe, in the Java ecosystem. They like Eclipse for its incremental compilation, while they dislike it for its Maven integration. Their setup didn't work in IntelliJ IDEA, and they're wondering why they should pay for something that has free competitors of similar quality, while they find NetBeans interesting for its Maven integration, but they don't like the performance of native Maven, which Eclipse avoids via its incremental compilations. Also since Maven is partly under pressure from the new world of Gradle, I'm hoping that the incremental compilation problem can be handled via Maven, thanks to http://takari.io, at some point, while the usage of JRebel by Topicus mitigates these problems to some extent.

Anyway, it was a great afternoon/evening and it must be wonderful to work in a company where there's a pizza oven in the backyard. Thanks, Martijn Dashorst, for organizing the event, and also because now I have several new topics to investigate and blog about!

Tuesday Feb 03, 2015

Greenfoot and NetBeans

When I met with Michael Kölling, from BlueJ and Greenfoot, when we discussed the relationship between those tools and NetBeans, Michael pointed out that BlueJ users are closer to NetBeans IDE than Greenfoot users. I took copious notes of our discussion, especially on the differences between BlueJ and Greenfoot, since that difference has never been completely clear to me. As Michael explained it to me: "BlueJ visualizes program structures and their execution, while Greenfoot uses visualization as the input to the program."

"Today we're building a game," is the angle teachers with Greenfoot in the classroom use, rather than "today we're going to learn about object orientation". Clearly, the two tools, though built on the same framework, have different approaches, with "motivation first" being the approach applicable to Greenfoot. It doesn't try to be as complete and formal as BlueJ and it's not a general IDE, while BlueJ is for teaching full programming. Anything in Java you can do in BlueJ, including Java 8. On the other hand, Greenfoot is just for two dimensional graphics, i.e., a very specific domain. Many programs you would never make in Greenfoot; it sacrificises generality for one thing only, to raise interest in programming. Then, after that, you potentially, assuming Greenfoot has raised your interest, go somewhere else to become a real programmer.

The underlying reasoning for Greenfoot came about upon the discovery that, increasingly, the first contact people have with programming is before university or technical college. Long before that, you've normally already decided whether programming is "for you". To "catch them early", the insight was that you need to enthuse people in the early stages of their development, i.e., you need to go to schools.

Anyway, all that having been said, let's see what it takes to take a Greenfoot project and work with it in NetBeans. It's less intuitive than BlueJ (as described here) but Michael and I worked through a process that works. My plan is to make a NetBeans plugin for converting a newly opened Greenfoot project in NetBeans to being a project that does step 2, 3, and 4 below automatically:

  1. Import Java Source Files. Use the 'Java Project with Existing Sources' wizard in NetBeans to import the Java source files created in Greenfoot, same as for BlueJ.

  2. Configure Classpath. Add the two JARs, greenfoot.jar and bluejcore.jar, from the Greenfoot distribution, to the classpath of the NetBeans project.

  3. Set NetBeans Project Properties. Set the main method to 'greenfoot.export.GreenfootScenarioMain' and set the working directory to point to the location of the sources. Click to enlarge the image below.



  4. Set Greenfoot Project Properties. Create a 'standalone.properties' file in the 'default package', with properties such as 'main.class' and 'project.name':

    project.name=boids
    main.class=Sky
    #scenario.lock=true
    run.once=Act
    controls.run.button=Run
    controls.runonce.shortDescription=Call 'act' once for every actor.
    pause.simulation=Pause
    run.simulation=Run
    controls.run.shortDescription=Run the simulation.
    reset.world=Reset
    controls.reset.shortDescription=Reset the simulation.
    controls.speed.label=Speed\:

  5. Figure Out Images and Resources. Images and resources aren't found automatically. Either put all images and resources into the default package or add 'setImage' method to the classes where images are used and do the same for the resources. Possibly something needs to change within the Greenfoot code to find the images and resources automatically when the Greenfoot JAR is used in standalone mode.

The whole project, here the 'Boids' project, looks something like this:


When you run it from NetBeans, you should see this, which is exactly what you see when you run it from Greenfoot. Take note of some of the properties shown above in step 4, which are applied to the viewer, e.g., the buttons you see in the lower part below:

As you can see from the above, a bit of tweaking must be done, which is why I think a small NetBeans plugin that does the above automatically would be helpful, i.e., what's needed is a "Greenfoot" tab in the Project Properties dialog of Java SE projects, which will let the user specify the above items to be added to the project and configure the project automatically to smoothen the transition from Greenfoot to NetBeans.

Something like this:

Sources: https://github.com/GeertjanWielenga/NetBeans4Greenfoot

Note: See part 2 for enhancements to the above procedure.

Monday Feb 02, 2015

YouTube: Yeoman in NetBeans IDE

Here's a quick overview of the planned workflow for Yeoman in NetBeans IDE.

The sources are here and anyone is more than welcome to clone them: https://github.com/GeertjanWielenga/YoNetBeans.

Saturday Jan 31, 2015

Thanks, BlueJ: Code Outline for NetBeans

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

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

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

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

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

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

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

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

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

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

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

Friday Jan 30, 2015

NetBeans has Integrated javac from jdk8u40-b22

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

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

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

Instead of this (click to enlarge):

Related issue, thanks Lukas:

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

Tuesday Jan 27, 2015

Displaying and Processing Yeoman Generators and Commands

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

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

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

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

Monday Jan 26, 2015

Exposing Yeoman Generators to NetBeans IDE

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

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

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

Friday Jan 23, 2015

Processing Output on the Yeoman Command Line

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

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

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

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

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

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

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

Thursday Jan 22, 2015

Parsing the Yeoman Command Line

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

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

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

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

Wednesday Jan 21, 2015

How to Implement Yeoman in NetBeans IDE

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

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

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

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

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

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

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

Tuesday Jan 20, 2015

Free: Virtual Technology Summit by Oracle Technology Network

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

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

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

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

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

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

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

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

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

Monday Jan 19, 2015

Gulp for NetBeans IDE (Part 2)

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

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

wiki.netbeans.org/NewAndNoteworthyNB81 

Sunday Jan 18, 2015

Gulp for NetBeans IDE (Part 1)

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

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

All the code is here:

github.com/GeertjanWielenga/Gulp

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

Saturday Jan 17, 2015

Knockout.js in 2 Minutes (Part 3)

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

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

Code:


        
    

Friday Jan 16, 2015

Knockout.js in 2 Minutes (Part 2)

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

Code:

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

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

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

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

Thursday Jan 15, 2015

Knockout.js in 2 Minutes (Part 1)

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

Code:

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

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

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

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

Wednesday Jan 14, 2015

NetBeans Day in the Netherlands: 12 February 2015

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

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

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

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

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

Tuesday Jan 13, 2015

Free: Learn NetBeans on Udemy

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

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

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
« March 2015
SunMonTueWedThuFriSat
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    
       
Today