Monday Nov 02, 2009

Web enabled database applications is one my favorite old pastime. I've built tools for this usecase. There are many ingredients that go into making a technology decision as you are building a site and the choice of database (assuming that you have that choice). For convenience, many folks use PHP & MySQL on the front end since they is part of the LAMP stack. Others choose JavaServer Faces since it is already part of the Java EE standard and provides a rich component set as well as the ability to easily bind to data sources. No matter what choice you make, one will have to deal with the performance considerations as they build their tiered application.

A good opportunity to tune your performance skills will be available Nov 5th during this webinar. Mark is an expert and you'll be able to learn directly from the source (author of the Connector/J driver).

Wednesday Oct 21, 2009

The NetBeans team (Tomas, Jirka & all) has just released version 1.2 of the VisualVM, Java profiling and troubleshooting tool. A bunch of good stuff in this release:

  • Sampling CRU and memory profiler
  • Redesigned charts with dynamic tooltips (my favorite feature by far)
  • Enhanced support for jstatd connections

I've already had a version the visualVM that came with JDK 6 update 16 (look in <JAVA_INSTALL_DIR>/bin/ for jvisualvm executable), however these new improvements made it worthwhile to install the stand alone version as well.


Thursday Oct 01, 2009

Oracle Open World is approaching fast and the Java team is signed up to present a few sessions and give a few demos. There are a few new highlights since Java One (June '09). First of all the Java Store, while still in beta, is completely redesigned. Second the Authoring Tool for JavaFX seems to be ready for the Early Access program. You'll also see JavaFX on a few handheld devices, also on a TV.

If you end up attending the Oracle Develop portion of the conference, I highly recommend the "Intro to JavaFX ..." session by Richard Bair and Stuart Marks. You'll get to meet the cool folks that are building this extension of the platform, get some details on the upcoming release of the platform, the obligatory demos, etc.

Monday Sep 14, 2009

The Java Store that was previewed during Java One earlier this year is getting ready to release support for paid applications. Developers who are getting ready to publish apps to the store should be aware of the license rights management facility. Here are the requirements in a nutshell:

  • Is transparent to users
  • Ensures users stay within their usage rights
  • Ensures that simple script based attacks to remove the rights management code aren't feasible
  • Eliminates the need to have an online connection when the application is used
Here is some sample code on how to use license management in your application:[Read More]

If you are looking for Java's mascot - Duke art work, you can now find it here. It is stored on the same infrastructure (kenai.com) that powers many other open source projects.


Thursday Jul 16, 2009

Nowadays there is a lot of hype about Netbooks. I've seen several projection from our marketing folks talking about the potential growth. I finally gave up and decided to find out for myself if the Netbooks are worth ones time. I am mostly interested how Java (SE) fares on these hybrid devices. Given that the netbooks are small notebooks that exibit many of features and behaviours if a smart phone, I'll call them personal centaurs

[Read More]

Thursday Jun 25, 2009

There is no secret that the Java community would like talented developers around the world to contribute their expertise to the OpenJDK project. There are many ways to contribute and not all of them have to include writing code. Though, I suspect that most of the folks are interested in scratching their itch (read - fix an annoying bug or adding their favorite lang feature). In my case I want to introduce #ifdef in Java (I still miss that from my days programming in C).

With that in mind, I decided to try to become an OpenJDK contributor and see where the community will guide me, based on expertise and skill set.

My enthusiasm was spoiled upon reading the contribution process. Having to fax the SCA is rooted in the 20th century. I pulled the sources from the repository without much fuss and I was pleasantly surprised by how fast is Mercurial. The documentation advises you to find a sponsor. Read ahead, since it seems that a sponsor is needed just for the basic setup :-).

Building OpenJDK (on Windows) should a lot simpler. The instructions on the project website are generally clear, however I could not find easily any info how to build the sources. I googled the topic and found some instructions which made me cringe. I have some of the software requirements other than cygwin. The rest seems very archaic. 

Once I have more time, I'll get back to the build process and I hope to come up with some suggestions on how to improve the process. Perhaps that will be a form of contribution in itself!

Friday May 29, 2009

Brian Goetz and the VM folks are doing it again - the 2009 JVM Language Summit. Come share your programming language expertise with industry experts and the JVM crew. There will be a number of traditional talks as well as time to interact with subject mater experts in informal settings.

Sept 16-18 (Sun campus in Santa Clara, CA)

Friday May 22, 2009

Java One is around the corner and many times developers and analysts ask us how we make money with Java. In Jonathan's blog you get a glimpse of how we leverage the ubiquity of Java on the Windows desktops to sell distributions services. There is also licensing and middleware/hardware enablement via world class performance of our VM. One of the less known programs that enables us to monetize Java in the enterprise is Java for Business. Lot's of details on the website, however if you don't have the time, here is the offering in a nutshell:
  • A subscription service offering that provides more control for customers that depend on our software while developing a compelling partnership/relationship between Sun's key customers and Sun's Java experts
  • A replacement and enhancement for Java Multi-Platform Support offering
  • A framework to offer a wide range of requested services and features to our customers
    • Porting, tuning, custom work, special builds, emergency fixes, long-term support, etc.
    • Desktop, asset management, etc.

Friday Apr 24, 2009

Craig Gering's team recently released the Java ME SDK 3.0. The bundle includes the Java Wireless Toolkit 2.5.2 and JavaToolkit 1.0 for CDC. The tooling is predictable (in a good way): emulator (Windows only for now) and utilities for rapid application development using CLDC/MIDP, CDC and BD-J. In addition you also get LWUIT support. This is cool, especially since I've seen very rich UI on HTC phones at the MWC in Barcelona earlier this year.

The SDK will be complemented later on this summer by the release of Java FX 1.2. The team is shooting for Java One in June. I am looking forward to seeing on devices on the show floor.

Thursday Apr 16, 2009

The Java One 2009 Conference will give full access (general and technical sessions, hands-on-labs, etc.) to all students that can make the trip. This new program provides students a huge opportunity to learn, network and interact with industry experts.

Friday Apr 03, 2009

I had a great time at the Ricoh & Java Developer challenge in London. I represented Sun, one of the sponsors of the this University event, and judged the submissions by the five finalists of the contest.

Being the judge was quite an interesting experience. I was truly inspired by the innovation and dedication of the students from Norway, Spain, Germany, France and Hungary that presented projects at the competition. Submissions ranged from Optical Mark Readers, to Context aware Multi Function Printers (MFP) software. Judging had to take into account both technical and business point of views. Hungary (Zoltan Szabo & Balazs Lajer from University of Pannonia) won, by a hair ahead of Germany. Congratulations to all the students and professors involved.

Wednesday Mar 25, 2009

Mark Reinhold just published a blog which details the list of features that are currently planned for JDK 7, by the OpenJDK community. The idea is to give a  preview at Java One in June and release in the spring of CY10.

We are hoping for comments and feedback, via the openJDK mailing list. Dalibor is also working out the schedule for the next OpenJDK call, which will be open to all the folks in the community.

Thursday Feb 05, 2009

 Java SE 6 update 12 shipped earlier this week and it is now available for download here. Key improvements include:

  • Windows 2008 Server Support : Java 6 Update 12 now support Windows 2008.
  • Java Plug-in now supports 64-bit browsers (4802695)

Friday Jan 09, 2009

Talking about pace. The Java TV folks created in a very short period of time the Java specification for digital terrestrial TV. In a nutshell, the API has been designed to provide access to functionality unique to digital television receivers. Here are some of the key features:

  • Audio/video streaming
  • Conditional access
  • Access to in-band and out-of-band data channels
  • Access to service information
  • Tuner control for channel changing
  • On-screen graphics control
In the future this should tie nicely with key value proposition of the JavaFX platform which will enable to seamless deployment of RIA across multiple devices, including TVs.

Tuesday Dec 30, 2008

A priceless resource for developers trying to learn Java and related technologies is the free service that Sang Shin provides online. This is a site maintained by a Sun employee who provides a huge set of online tutorials. I recently reviewed some of the courses to see if we could help provide some expert assistance. The materials are truly well put together and easy to follow. I highly recommend this site to all students and professional looking to learn Java, Ajax, Web Services, Java EE.

I am now looking forward for the update of the JavaFX programming course.


Friday Nov 28, 2008

The next key iteration of the Java platform & language is currently planned. The stakes, for this highly anticipated release, are high, however Java 7 looks promising. There are several JSRs (203, 294, 291, etc.) in progress and the issue of modularity is also on the docket. A modular Java platform will help address issues of performance (download & startup time, memory footprint), platform scalability (e.g. Java SE scaling to small devices) and packaging (fixing the jar hell issues). These are real customer problems that Java 7 will attempt to address.

The blog to watch for more details is Mark Reinhold's.

Wednesday Nov 12, 2008

Here is a demonstration of the power of the JavaFX platform. We are still fixing some issues, so the clip will only play if you are within Sun's internal network an it will only play on the Mac since the clip is encoded as mp4. 

Media player - written in JavaFX Script

Below is the code of the JavaFX applet that creates the video player. This sample is bundled with NetBeans 6.5, the upcoming  distribution that  has support for JavaFX Script.
package simplevideoplayer;

import javafx.stage.Stage;
import javafx.scene.Scene;
import com.sun.fxmediacomponent.*;
import javafx.scene.Group;

def mediaUrl:String =
    "http://sun.edgeboss.net/download/sun/09b01806/09b01806_00.mp4";
println("using mediaUrl = {mediaUrl}");
var vidWidth = 512;
var vidHeight = 288;
var fullWidth = 700;
var fullHeight = 400;

var mediaBox:MediaComponent = MediaComponent {
    
    // set the media and make the component visible
    mediaSourceURL : bind mediaUrl
    visible:true

    // the position and size of the media on screen
    mediaX: (fullWidth-vidWidth)/2 // center
    mediaY: (fullHeight-vidHeight)/2 // center
    mediaViewWidth : vidWidth
    mediaViewHeight: vidHeight
    mediaVisible: true

    // determines if the control bar is visible at all
    controlBarVisible: true

    // determines if the control bar is below the media or on top 
    staticControlBar: false
    
    // the position of the scroll bar.
    //leave as the defaults to have it be below the media
    //controlBarX: -1
    //controlBarY: -1

    // set the size for full screen.
    fullScreenWidth: fullWidth
    fullScreenHeight: fullHeight
    
    // make the movie play as soon as it's loaded
    mediaPlayerAutoPlay: true

    // set the volume
    volume: 0.5
};

Stage {
   title: "Simple Media Player"
   scene: Scene{
       width: fullWidth
       height: fullHeight
       content: mediaBox
   }
}

Tuesday Jul 08, 2008

The NetBeans team just announced the availability of VisualVM 1.0, which ships along JDK 6 update 7.

"VisualVM is a free opensource visual tool integrating several commandline JDK tools and lightweight performance and memory profiling capabilities. Designed for both production and development time use, it further enhances the capability of monitoring and performance analysis for the Java SE platform."

This version of the tool requires Java SE 6, so to run it on the Mac you'll have to install the latest version from the Apple website. In addition you'll likely have to invoke the tool with the --jdkhome flag to load the appropriate version of the JDK.

./visualvm --jdkhome /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home/

As you can see from the screen shot, you can easily monitor local and remote Java applications. The tool will help you discover performance and memory bottlenecks, debug threading problems or inspect contents of the heap. The data can be saved into a single snapshot and processed offline.

Sunday Feb 17, 2008

So how can you tell what server is being used to run a website? Here is a simple Java program that can help one figure out the kind of server that serves a particular website.

package whataretheyrunning;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author octav
 */
public class SnoopURL {

    String URLString = null;

    public SnoopURL(String URLString) {
        this.URLString = URLString;
    }

    public void snoop() {
        try {
            // build URL
            URL url = new URL(URLString);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();

            conn.setRequestMethod("GET";);
            conn.setDoOutput(true);

            // start talking
            conn.connect();

            // int length = conn.getContentLength();
            // System.out.println(" **** the length of the content is " + length + " for URL " + URLString);

            System.out.println(" **** Server type is:  " + conn.getHeaderField("Server";) + "\n\n";);

            // get more information
            Map map = conn.getHeaderFields();
            for (int i = 0; i < map.size(); i++) {
                System.out.println(" **** " + conn.getHeaderField(i));
            }

            // cleanup
            conn.disconnect();
        } catch (MalformedURLException ex) {
            Logger.getLogger(SnoopURL.class.getName()).log(Level.SEVERE, null, ex);
        } catch (java.io.IOException ioe) {
            ioe.printStackTrace();
        } finally {
            // do whatever cleanup ...
        }
    }

    @Override
    protected void finalize() throws Throwable {
        super.finalize();
    }

    @Override
    public String toString() {
        return super.toString();
    }
}

The output of this program is something like this:

**** Server type is: Sun-Java-System-Web-Server/6.1

**** HTTP/1.1 200 OK
**** Sun-Java-System-Web-Server/6.1
**** Mon, 18 Feb 2008 04:46:48 GMT
**** text/html;charset=UTF-8
**** policyref="http://www.sun.com/p3p/Sun_P3P_Policy.xml", CP="CAO DSP COR CUR ADMa DEVa TAIa PSAa PSDa CONi TELi OUR SAMi PUBi IND PHY ONL PUR COM NAV INT DEM CNT STA POL PRE GOV"
**** Servlet/2.4,JSP/2.0
**** chunked
**** Starload=star-fep5; Path=/
 

Now let's look at some popular websites.

Sun's www.sun.com is using the old Web Enterprise server, version 6.1 (the same is true for java.sun.com). The site the publishes this blog: blogs.sun.com is powered by Sun-Java-System-Web-Server/7.0 (a newer version of the same web server). Google seems to use their own version: gws. Yahoo does not tell you (returns null). Microsoft eats their own dog food: Microsoft-IIS/7.0. Nice. IBM runs something called: IBM_HTTP_Server (I bet is Apache's web server).



 

Tuesday Dec 18, 2007

One of the thoughts that I had the other day was related to design patterns in JavaFX Script. Patterns are quite popular with developers. The are books on this topic and lots of web resources. The question is how could write, for instance a Singleton, in JavaFX Script.
 
In Java it would look like this:

public class OnlyOne {

    private static OnlyOne singleton = null;

    private OnlyOne() {

    }

    public static synchronized OnlyOne getInstance() {
        if (singleton == null) {
            singleton = new OnlyOne();
        }

        return singleton;
    }
}

/**
* Test program to prove we've coded the singleton correctly
*/
public class Driver {

    public static void main(String[] args) {
        // one would try this OnlyOne one = new OnlyOne();
        // and it won't work due to the private constructor
       
        // get an instance
        OnlyOne one = OnlyOne.getInstance();
        System.out.println("Myfirst attempt: " + one.toString());
       
        // get another instance to see if they are the same
        OnlyOne two = OnlyOne.getInstance();
        System.out.println("My second attempt: " + two.toString());
    }
}

The result of running the Driver program is: 

Myfirst attempt: onlyone.OnlyOne@9b49e6
My second attempt: onlyone.OnlyOne@9b49e6

As expected, any time one is trying to get a handle to the OnlyOne object, the same instance is returned.

Wednesday Nov 14, 2007

The old proverb: "a picture is worth a thousand words", has an interesting mapping in the world of programming. On the Java platform one has a few facilities that enable a developer to get a stack trace that can point to the cause of a UI freeze, slow down in an application performance, etc. A thread dump can save a developer a lot of time in troubleshooting tough problems. In the old days one could start the application and a terminal and call CTRL + Break on the Windows platform or kill -QUIT pid on the Unix platform. Of course if one has access to the sources you can force the application to show you the call stack by doing something "un-natural" such as Thread.getCurrentThread().dumpStack(). Keep in mind that this will crash you application, so don't do it on production code. This wiki entry has more details on how to, gently :-), get a Thread dump.

In a recent conversation with Tor I learned some more details. For instance, on the Windows platform, using Java 6 one could employ the jps -ln command to get the process id of Java application and then use the jstack command on that process id (jstack pid) to get a thread dump. Nice documentation can be found here.

If you really in the mood to experiment, take a look at the Visual VM project that was just launched on java.net. You'll find a cool tool, based on the NetBeans platform, that helps monitor and profile Java applications. It only runs on top on Java 6, however it can work on applications based on JDK 1.4.2 or later.
 

Tuesday Aug 14, 2007

The answer is simple. Just subscribe to a blog's RSS (Really Simple Syndication, basically a computer-readable summary of the content of a web page) feed. Here is how and what should be on your radar:

There are several ways to subscribe and read feeds. I found this article quite useful. On the other hand I use Apple mail to read the RSS feeds.

Thursday May 31, 2007

Everyone (especially in the US) loves a winner and at every Java One you have one product, technology or event that makes the biggest splash. 2007 is shaping up as the year of Java FX. In a nutshell: "JavaFX comprises a comprehensive set of runtime environments, widgets, development tools, and scripting environments At the 2007 JavaOne Conference, Sun introduced two products in the JavaFX family: JavaFX Script and JavaFX Mobile." You owe to yourself to kick the tires on Java FX Script, so here are some pointers to some resources on the web.

As far as I am concerned, this year's conference was one of the better ones, that I've attended (since '96). I have not been so excited since 2003 when we previewed Java Studio Creator. One of the cool things about the conference is the social networking aspect. You end up having a beer with entrepreneurs that will become the next Jeff Bezos, renowned technologists and lot's of other folks with who you collaborate during the year, but they always at the end of the phone line or just a name in the CC list.
 

Thursday May 03, 2007

The NetBeans platform and IDE has evolved tremendously in the last couple of years. Version 6 is around the corner and the Sun will be releasing a preview at NetBeans Day / Java One. So what's on tap? Support for native and dynamic languages (Ruby, JavaScript), Java Studio Creator's ease of use available for desktop applications, integrated profiler, rapid visual web application development, UML, REST W/S, lots of productivity features, etc. The best way to get more info is by attending NetBeans Day (details below).

May 7th, Moscone 

NetBeans Day

Highlights

  • NetBeans Day Opening Session: Jonathan Schwartz and Rich Green
  • Lunch with the Java Posse
  • NetBeans 6.0 IDE
  • Partner Showcase
    • CollabNet, YASU Technologies
  • Swing GUI Building With Matisse: Chapter II
  • NetBeansMobility
  • JRuby: Understanding the Fuss
  • Partner Showcase
    • Intland, USDA, Xoetrope
  • Closing Session: James Gosling

The first 400 attendees will receive a free copy of Rich Client Programming: Plugging into the NetBeans Platform. We will also be giving out 1 GB USB flash drives, loaded with the latest NetBeans 6.0 Milestone. Throughout the day, we will be giving out special edition NB 6.0 T-shirts and NetBeans cubes. Pay attention, you may have to earn your T-shirt by asking or answering a question.

This blog copyright 2009 by octav