types of info sharing sites

I recently deleted someone’s thread at coderanch where the post was just links to blog posts.  There’s a time and place for everything.  Which got me thinking about where it belongs.  Let’s look at some social media sites for Java.

Sharing links

Starting point is sharing links followed by comments/discussion.  I’m leaving out the framework specific forums like Spring’s.

Forums or Q&A

Starting point is a question or discussion topic.

Q&A only

I separate stack overflow because it is more Q&A focused than the forum sites.

What else?

What others do you use?  Which is your favorite?

getting started with the Finch in NetBeans

This year the robotics team is using The Finch for teaching the new programmers about programming.  The robot is cute and I know I’d want to play with it so I bought one too.

While I like Eclipse better than NetBeans, the programming team uses NetBeans.  I decided to try out NetBeans with the Finch so I’m familiar with their platform/interface.  I’ll want it soon enough anyway to check out NetBeans projects from git.

Step 1 – Install NetBeans on the Mac

  1. Download NetBeans – the basic JSE edition
  2. Open dmg file which allows you to choose to run the installer.
  3. Choose defaults and install
  4. When first launch NetBeans asks if want to install JUnit.  (not clear on why JUnit doesn’t come with NetBeans – it comes with Eclipse)
Step 2 – Import Finch project
This one took me a few minutes.  You need to
  1. Download the NetBeans project
  2. Copy it to the NetBeans project directory which is /Users/me/NetBeansProjects on a mac
  3. In NetBeans, File > “open project” and then drill down to Finch.
Step 3 – Run a program
  1. Connect the Finch’s USB to your computer.  (The tutorial doesn’t say this, but it is implied.)
  2. Per the tutorial, choose Run > Run File.
  3. Enjoy the Finch.  It’s so cute!
Step 4 – Run a different programs
I very carefully misunderstood the instructions about not choosing Run > Run and did it anyway.  Luckily, you can choose Run > Run File and have it ignore your preset default.  Or you can completely unset it by editing the file FinchBeans/nbproject/project.properties and removing the main class line.  Then I can remember to choose Run > Run File.

java 7 from the nyjavasig

Google java 7 a bug’s life – for approach to bug

Java 7 has come a long way since the Java road show 14 months ago when I blogged about what may or may not be in Java 7. And not always forwards. Oracle sent Donald Smith (director of project management with some coding knowledge) to the NY Java Sig.  In this blog entry, we’ll look at what features made it in, the strategy discussion from Oracle and then some details.

How does Java 7 shape up compared to the road show?

Before we get to what actually happened at the sig, let’s see how Java 7 shaped up compared to the road show.

Category Feature How to Use or Status
Modularity Project Jigsaw Java 8 – modularize the JDK to address the “Java is too big” problem.  Will not replace OSGi.
Multi-lingual Support DaVinci Machine Includes invokedynamic and more. See docs
invokeDynamic Implemented in virtual machine/bytecode to make dynamic languages faster. Invokevirtual was closest but slow because doing extra type checking. Builds CallSite so only does that extra work once and improves performance of subsequent calls. JRuby noted 20% perfromance increase.
Small languages changes (Project Coin) Diamond Operator List>Map<String, Integer> list = new ArrayList<>();
Integer Literals int num = 1_234_567;
Try Catch With Resources try (InputStream s = …) {  … }
Collection literals (like associative array) Didn’t go anywhere. Haven’t seen talked about for Java 8 either.
Other While other (undetermined) features weren’t publicized last year, they will be part of Java 8.
Performance Fork Join New APIs in Java 7.  See end of post for details.
ParallelIntArray Not in Java 7. Didn’t go anywhere.
Closures Closures/Lambda Expressions Deferred to Java 8.  Will include support for multi-core.

High Level/Strategy

Donald didn’t sound like a typical Oracle speaker. He was funny, easy to relate to and started out by talking about his biases/background It felt more personal than corporate. Usualy when Oracle prents something it sounds like legal reviewed it and stripped out a lot. The slide deck did have the standard nine line Oracle disclaimer. He did note that IBM’s Sarbanes Oxley disclaimer is twice as long as Oracle’s. People asked tough questions and he answered honestly when not knowing the answer.

Interesting things from Strategy and Q&A

  1. Timelines
    • Java 6 came out in 2006.  The four years to Java 7 was the longest time between releases anywhere.
    • Java 7 update 1 is due out in early September and will contain the major bug fixes.
    • Java 7 update 2 is due out in October and will contain garbage collection enhancements.
    • Java 8 is targeting 2012.  The speaker thinks 18 months is too soon for Java 8 because the industry is no longer used to a 2 year release cycle anymore, let alone more frequent..  He thinks we need time for the tooling to catch up.
  2. Java heath (just Java; doesn’t include JVM languages)
  3. Official terms for past are “legacy sun employee” or “legacy bea employee”.
  4. HotSpot vs JRockit
    • Survey says 70% use Sun JDK and only 5% use JRockit.
    • Oracle decided to officially kill the JRockit JVM and just use the JRockit tooling. (Mission Control, Flight Recorder and RT)
    • Over time, the two will merge with the JRockit tools being premium features.
    • Oracle emphasized performance will also be free and part of the main JDK.
    • Googlefight between the two shows Hotspot as the clear winner.
  5. JavaOne – Oracle is holding back announcements for JavaOne.  Expect some on
    • Java 7 Certifications
    • Something about the Mac.  Maybe with respect to Java 8.  (Oracle claims the delay in Java 7 on the Mac is to “make things right” with the Apple UI.)
    • Recognition that Oracle needs to clean up their name in community by announcing things at JavaOne and doing them without surprises.
  6. Open jdk is slowly becoming more open. For example, Oracle recognizes the need to open bugs to public before Oracle sees/runs triage. Looking at using jira for this.
  7. Java 7 theme is “moving Java forward.”  In other words, just get something out without waiting for all the features.

More on Java 7

The emphasis was the need to be careful about protecting the platform, the amount of work in the smallest of changes and the desire to not change the type system.  Changes fall into three categories:

  1. Language changes
    • All project coin changes noted in table up top
    • + Allowing Strings in the switch statement
    • + @SafeVarargs allowing the method itself to declare safety so all callers don’t have to suppress warnings.
    • + AutoClosable interface for I/O and JDBC 4.1 resources.  Using these within the try with resources syntax in the table above means they will get automatically closed.  It also means exceptions thrown in that auto generated finally will be suppressed but still available in the stack trace.
    • + Catching multiple unrelated exceptions catch(ExceptionType1 | ExceptionType2 e)
  2. Library changes
    • NIO – Better exceptions, more extensible to different file systems, rename behavior more consistent , more access to metadata
      • Path is the replacement for File. It understands symbolic links cross platform consistently and provides many methods.
      • Lots of methods to create/navigate/transform paths
      • Can call path.toFile() to get file from path to call old apis
      • Paths helper class to get path
      • Files helper class to copy files with lots of options such as copy with attributes or replacing exisiting attributes.  Also supports atomic move.
    • Concurrency (Fork/Join)
      • Phaser class which is similar to the cyclic barrier and countdown latch but has better synchronization and deadlock protection.  Can also add and remove threads on fly.
      • TransferQueue interface which is implmented by LinkedTransferQueue – the producer or consumer can block while waiting so dont get too far ahead
      • The key class to implement your logic in should implement RecursiveTask.  It is like RecursiveAction except that it returns a result.  All you have to do is implement the compute() method.
      • The ForkJoinPool is the executor so you can submit your task to have it run.  Methods are provided to see if it is done and get the result.  By default it uses the # available processors or you can specify explicitly.
  3. Runtime changes
    • See table up top for changes.
    • Oracle listed all the languages that can run on a JVM.  They noted that some are research projects by students and not “real” or “ready.”  I laughed because C# was on the list.  Why would you want to run C# on a JRE?
  4. Other
    • Swing nimbus look and feel is completed.  Metal is still the default.
    • Eliptic curve cryptography
    • Deadlock avoidance in classloader
    • Close method for UrlClassloader
    • Javadoc now has support for CSS.  Which means the JavaDoc now has “nice looking annoying frames”