Oracle acquires Sun: Who needs to look out now?

As a Java developer who does a lot of work with Oracle products including Jdeveloper and ADF, my head is still spinning a little from the news that Oracle is buying Sun Microsystems.

Oracle buying BEA hurt a little, though it was completely expected and a great move on Oracle’s part, I was a little sad to see the application server competition field drop by one but I was very happy that Oracle was smart enough to choose Weblogic.  At that point it was really the only the decision they could make.

With Oracle buying Sun there is a lot of synergy, there are many technologies that are duplicated among both companies.  Oracle owning both should make those technologies better and enable them to compete with the leaders in those respective areas.  The big ones that stick out for me:

!. Oracle’s JDeveloper and Sun’s NetBeans

Could they really afford to drop NetBeans, probably not, but can they afford to drop JDeveloper, no, not really.  Here the only thing that really makes sense is to merge the two, probably adding in the ADF wizards and goodies like that into NetBeans.  At least, that is what I hope they do.  JDeveloper isn’t bad, but I only ever use it to develop ADF projects and I bet many, many people are in that same boat.  Combining the two could end up giving Eclipse a run for it’s money, hopefully the competition just spurs both to be better.

2. Oracle’s Oracle VM and Sun’s Virtual Box

I haven’t had much experience with Oracle VM, but I have lately become a huge fan of Sun’s Virtual Box.  It’s a great product and it lets me do everything I want for free.  Will this continue to be the case?  I don’t know.  I’m not an expert on virtualization in the enterprise, I use it for desktop VMs, but I hadn’t seen much about Virtual Box working in that space.  I would imagine Oracle VM is all about virtualizing the network and competing with VMWare on that level.  With the two together VMWare’s got some competition.

3.  Oracle’s Unbreakable Linux and Sun Solaris

Oracle had a great jumpstart to their linux platform basing it on the RedHat codebase way back when.  Solaris was my first exposure to any type of Unix (Solaris and AIX, actually) and it has been around forever.  If the adoption of Linux has hurt anything, it’s probably been Solaris and through that, sales of Sun’s hardware.  Oracle says that their owning of Solaris will enable them to tune the Oracle Database software to run even better on it, and since according to Oracle, most of their database customers are using Solaris, I think they’ll probably do that.  I have no idea what will have to Unbreakable Linux though.  Who has to look out with this one?  I’d say IBM.  Buying Sun probably would have been good for them in the products space, I think the only area IBM is going to be competing in future is going to be services.  RedHat has Ubuntu to worry about on the desktop side and now a bigger threat from Oracle and Sun on the server-side, they have their work cut out for them.

4.  Oracle Database and Sun’s MySQL

MySQL has a huge customer base, most of them probably non-paying.  I think with this one, Oracle just adds it to their ever increasing repetoire of niche databases.  It won’t go away, but I see less adoption in the future, maybe a boost for PostgreSQL if they can get their act together.

5. Sun’s Java and Oracle’s ADF

Oracle has always been a big player in the specifications for the Java language.  I’m sure someone else will go into all the details, because I honestly don’t know them off the top of my head, but I do know that many technologies and ideas that ADF is based on where either approved JSR’s or close to approved JSR’s.  Does Oracle’s acquisition of Sun and Java mean that they will be better equipted to push trhough whatever they want to add to the language?  Well, I don’t think it will be quite that easy, but I’m sure it makes it easier.

I’ve always been a Java guy at heart, I work with Oracle technology sometimes, and I think they have really come a long way, but Oracle owning Java does kind of scare me a little.  One thing Oracle does really well, and JDeveloper is great at this, is making complex technologies easy to use.  It is what Microsoft does really well.  .NET makes easy the things that Java makes hard.  ADF actually does a lot of the same.  The combination of ADF and Java together could pose a big threat to Microsoft’s .NET if Oracle does it right.

My first thought about Oracle owning Java is that many developers are going to jump up and down about it and complain.  Some will probably jump ship, maybe to .NET but probably to Ruby or PHP or something else.  I don’t think many coroporations are going to change the direction of their IT departments though, so for them, it will be .NET or Java as it always has.  In the end, I thnk most Java developers are going to remain Java developers and hopefully Oracle’s backing of Java will just end up making it a better language to work with.

Microsoft might have more to worry about with Oracle owning Open Office now also.  I hope that Oracle continues to invest in it, or it’ll end up being Microsoft Office vs. Google Apps and that’s about it.  I’m all for cutting edge, but Gmail hasn’t come out of Beta yet and I’d like to see Microsoft have some competiion in this area.

So I wanted to get my thoughts out there while they were floating around in my head and hopefully yours so I could hear your opinions on the topic.  Please let me know what you think about this acquistion and what you think it means to the future of technology and competition in the field.

Share/Save/Bookmark

JavaFX Flashcard Example Updated for 1.1

I have updated the sourcecode for my JavaFX flashcard game example to be compatible with release 1.1.  There certainly were a lot of changes from the pre-release to the release and this serverely impacted the example code.  So severely, in fact, that it was just chock full of compile erros and other issues.  I will attempt to cover most of the changes by explaining the resulting new classes.

The actual structure of the program hasn’t changed, The FlashcardApp is the main program, it builds an array of Flashcard objects.  Each Flashcard object is made up of a Word and a CardImage.  The Word is then made up of individual letters.

Let’s start by taking a look at the Letter.fx file.  This Letter.fx is a little better designed than the last one.  In this case, instead of extending the generic CustomNode I extended Text.  After doing that I was able to just override the variables I was interested in. I could set the alignment, font, color and relative position this way. Another change that had to be made was to drop using attribute and use var instead.

I stored the actual letter as a String because I wanted the option of tying two characters together to make one sound (called bends (”cl” or “st”) or diagraphs (”sh” or “ch”)).

The letter is class is repsonsible for displaying the letters and thus needs to know where to position them, therefore the size and position numbers are provided so it can determine where in the canvas to put the letters.

public class Letter extends Text {
    public var myLetter: String; //String the represents a Letter in the Card
    public var position: Number; //Position the letter is in in the current word
    public var size: Number; //Size of the entire word
    override var textAlignment = TextAlignment.CENTER;
    override var textOrigin = TextOrigin.TOP;
    override var translateX = bind ((scene.width - 40) - (((scene.width-40)/size) * (size+1 - position)));
    override var translateY = bind (scene.height - scene.height) / 2 ;
    override var font = Font{ name: 'Arial', size: 150 };
    override var fill = Color.BLACK;
    override var content = bind myLetter;

}

The Word.fx file did not change too much except to extend CustomNode and override the translateX and translateY variables to position the word correctly.

It contains an operation to flip the card, one to show the Word (to reset the state), and a constructor. The interesting part here is the “constructor”. As I mentioned in a previous post, there is no real constructor per say, instead you define a method with the same name as the class and this is used as a constructor.

public class Word extends CustomNode {
    var letters: Letter[];
    var show:Boolean = true;
    override var translateX = bind (scene.width - 40 - boundsInLocal.width) / 2 ;
    override var translateY = bind (300 - boundsInLocal.height)/2 - 20 ;

    public var word: String = null on replace {
       var aSize = word.length();
       var i = 0;
       while (i < aSize) {
            var nLetter = Letter { myLetter:word.substring(i,i+1) position:i+1 size:aSize};
            insert nLetter into letters;
            i++;
       }
    }

    public function flip() {
        show = not show;
    }

    public function showWord() {
        show = true;
    }

    public override function create(): Node {
        return Group {
            visible: bind show
            content: [
                letters
            ]
        };
    }
}

The CardImage file is similar in the changes there. I also made use of fitWidth and fitHeight to make all my images consistent sizes in the ImageView.

The show boolean is used in the CardImage class and the Word class to indicate whether or not it should be visible. This is what allows the flip() function to work in FlashCardApp by just setting one to true and the other to false.

public class CardImage extends CustomNode {
    override var translateX = bind (scene.width - 40 - boundsInLocal.width) / 2 ;
    var show: Boolean = false;

    public var imageSrc: String = null on replace {
        show = false;
    }

    public function flip() {
        show = not show;
    }

    public function hideImage() {
        show = false;
    }

    public function CreateCardImage(anImage:String) : CardImage {
        var cardImage1 = CardImage { imageSrc: anImage
        }
        return cardImage1;
    }

    public override function create():Node {
        var cardImage = Image {
            url: imageSrc
        }
        return ImageView {
            translateY: 25
            fitWidth: 500
            fitHeight: 250
            visible: bind show
            image: cardImage
        }

    };

}

Nothing too exciting in the FlashCard.fx file either, but I’ll include here for the sake of completeness. Note the flip function here as mentioned above. Also, this is the class where the sound integration is done. It isn’t as much sound as I originally intended as it was originally meant to be able to sound out individual letters or letter groups. I don’t think that would be too difficult to implement but I haven’t done it yet and probably won’t since my children have outgrown this little game already.

public class FlashCard extends CustomNode {
    public var cardImage: CardImage;
    public var showFront: Boolean;
    public var cardWord: Word;
    public var mp3: Mp3;

    public var aWord:String = null on replace {
       cardWord = Word{ word:aWord };
    }

    public var anImage:String = null on replace {
        cardImage = CardImage{imageSrc:anImage};
    }

    public var aMp3:String = null on replace {
        mp3 = new Mp3(aMp3);
    }

    public function showWord() {
        cardWord.showWord();
        cardImage.hideImage();
    }

    public function flip() {
        cardWord.flip();
        cardImage.flip();
        mp3.play();
    }

    public override function create():Node {
        return Group{
            content: [
            Rectangle {
                x: 10
                y: 10
                height: 300
                width: 550
                arcHeight: 20
                arcWidth: 20
                fill: Color.WHITE
                stroke: Color.BLACK
                strokeWidth: 2
            }
            ,
                Group {
                    content: [ cardWord,
                            cardImage ]
                }
            ]
        };
    }

}

FlashCardApp.fx had a couple of changes and some things of interest. First of all, instead of using a Frame, it uses a Stage component, as the Frame no longer exists. Inside the VBox I had to put the content inside a Group in order for the displayed FlashCard to be updated when the index changed. Essentially I needed to bind the “card” variable and I could not do that without it being inside a Group component.

The last thing I had to change was to remove a slash from the pointers to the images and mp3’s. The old insert statement looked like this:
insert FlashCard{aWord:”cat”, anImage:”{__DIR__}/img/cat.png”, aMp3:”{__DIR__}/sounds/cat.mp3″} into flashcards;

Note the “/” after the {__DIR__} in both instances. I had to remove that slash so that it now looks like:
insert FlashCard{aWord:”cat”, anImage:”{__DIR__}img/cat.png”, aMp3:”{__DIR__}sounds/cat.mp3″} into flashcards;

At first I thought this might have been because i was developing this new version on Linux, but it appears that it is necessary for Windows also. It appears the {__DIR__} includes a slash at the end of the directory and having 2 was a problem for the classes.

var flashcards:FlashCard[];
var myIndex:Integer = 0;
var size:Number = 5;
var card = bind flashcards[myIndex];
insert FlashCard{aWord:"cat", anImage:"{__DIR__}img/cat.png", aMp3:"{__DIR__}sounds/cat.mp3"} into flashcards;
insert FlashCard{aWord:"dog", anImage:"{__DIR__}img/dog.png", aMp3:"{__DIR__}sounds/dog.mp3"} into flashcards;
insert FlashCard{aWord:"car", anImage:"{__DIR__}img/car.png", aMp3:"{__DIR__}sounds/car.mp3"} into flashcards;
insert FlashCard{aWord:"hat", anImage:"{__DIR__}img/hat.png", aMp3:"{__DIR__}sounds/hat.mp3"} into flashcards;
insert FlashCard{aWord:"fish", anImage:"{__DIR__}img/fish.png", aMp3:"{__DIR__}sounds/fish.mp3"} into flashcards;

Stage {
    title: "Flash Card JavaFX"
    width: 600
    height: 400
    scene: Scene {
    fill: Color.GREY
    content: VBox {
        content: [
            Group { content: bind card },
            HBox {
                content: [
                    SwingButton {
                        translateX:0
                        translateY:10
                        text: "Next"
                        action: function() {
                            flashcards[myIndex].showWord();
                            if (myIndex < (size - 1)) {
                                myIndex++;
                            } else {
                                myIndex = 0;
                            }
                        }
                    },
                    SwingButton {
                        translateX:20
                        translateY:10
                        text: "Flip Me!"
                        action: function() {
                            flashcards[myIndex].flip();
                        }
                    }
                ]
            }

        ],
        }
    }

You can download all of the new sourcecode here. You will need the JLayer library for the Mp3 class to compile.

Be sure to check out the other articles on my blog related to JavaFX and the Flashcard game for more details on the Flashcard JavaFX code itself.

Stephin Chin has a good post about some of the changes from the pre-release to the release.

Share/Save/Bookmark

NetBeans - Working with XML Schemas

Lately I have been doing a lot of work with XML Schemas.  The main thrust of the project I have been working on is to generate a Canonical XML Schema from many different XML Schemas that are used for many different reports but all report on bascially the same type of data.

In order to make better use of my time on this project I decided to take a look to see what types of tools might be available for me to use.  The budget for tools is very low so free tools were at the top of the priority list.

I decided on using NetBeans because it seemed to have more capability with XML Schemas than Eclipse did.  I have since tried Eclipse and even JDeveloper.  I found Eclipse less intuitive to use than NetBeans and JDeveloper about the same as NetBeans though a lot more colorful.

When working with XML Schemas, NetBeans provides 3 different views that you can work with.  The Source, Schema, and Design views.

NetBeans XML Source View

NetBeans XML Schema Source View

The Source view allows you to work directly with the schema file itself.  This can be quite a time saver when copying and pasting element definitions or when moving elements or types around.  It provides color coding and the right-click menu will allow you to Check or Validate your schema in addition to formatting it so everything lines up correctly.  Just as in the other views you can use Goto from the right-click menu to switch to one of the other views.

NetBeans XML Schema View

NetBeans XML Schema View

The Schema view is where I started off doing most of my work.  It allows you to right click and create new types or elements with a wizard type interface.  Customizing the elements and changing properties can also be done here, very handy if you can’t remember the syntax for a particular attribute.  Copying and pasting can be done in the Schema view but I still haven’t quite gotten the hang of it and I find it much easier in the source code view.  The Schema view does provide the ability to refactor an element or type and rename it so that it becomes renamed in any other schemas in the project that reference it.  This alone makes it worth the price of admission even if you mostly work with the source view.

I found the wizards to be extremely helpful in developing schemas for the reason most wizard-type interfaces are useful, I did not have to remember the specific details of the syntax, I could just choose the properties I wanted.  When choosing an existing built-in type, a small window provides a description of the element which made it really easy to choose the types I wanted.  The biggest drawback which seems like an oversight is the inability to add properties to the element you are creating inside the wizard, you can choose the type of element and name it, but if you want to change the properties, such as minOccurs or nillable, you have to create the element and then right-click and bring up the properties window where it can be changed.

NetBeans XML Schema Design View

NetBeans XML Schema Design View

The Design view provides a nice picture of the schema or schemas you are working with and makes it easy to see your entire schema in a nice tree format.  I found this view especially helpful when talking about the schema with the business non-techie folk.  I had started a review in Eclipse but found it’s view hard for me to work with and not as easy for the non-techies to grasp, switching to the NetBeans view made the conversations much easier.  One issue I noticed with this view is that once viewed it isn’t always in sync with changes that are made to that schema file.  Sometimes it seemed to be stuck showing me the last revision or a version from a couple changes ago.  Restarting NetBeans caused it to refresh the view, but closing and re-oopening the schema itself did not.

You can also edit your schema from the design view, being able to drag and drop attributes and elements into your design as well as delete or refactor elelements and types much in the way you can in teh schema view.  Personally, I found the schema view easier to work in and the design view really nice for being able to step back and get an overall picture of the schema design.

Share/Save/Bookmark

Using Conditional Breakpoints

Conditional breakpoints are a great way to reduce debugging time and one of those features you might not even have known existed. This article will cover how to use them in 3 different ide’s including NetBeans, Eclipse and JDeveloper.

Have you ever tried to debug a problem that only occurs somewhere in a list of 100 objects? It can be a bit of a hassle.

You could put in a breakpoint and hit continue each time that breakpoint is hit until you find the problem object. This is acceptable the first time, but often the first time isn’t going to cut it.

You could put an if statement in your code to check for the condition that is causing the problem, but then you need to remember to remove that if statement after you fix the problem. Often my if statements in the past would have looked like this:

i f (problem.exists()) {

System.out.println(”This is the problem.”);

}

And I’d set a breakpoint on the System.out.println line.

A much better approach is to make use of conditional breakpoints available in most modern IDE’s.

NetBeans Breakpoint Editor

In NetBeans, create a breakpoint, the right click on the little pink square that signifies the break. Click on “Customize”. When the customize dialog comes up, check “Condition” and fill in the condition. Above is an example of this dialog in NetBeans.

Eclipse Breakpoint Properties

To accomplish the same thing in Eclipse, create your breakpoint, then right-click on the little blue dot signifying the breakpoint and choose “Breakpoint Properties”. In the Properties window, check “Enable Condition” and then fill in your condition or conditions in the box provided. An example is shown above.

Finally, to accomplish the same in JDeveloper (TP4, anyway), set your breakpoint, right click on the little red circle that appears. Then click on “Edit Breakpoint” and in the dialog that pops up, move to the “Conditions” tab. You can set your conditions there as shown in the picture above.

So now that you know, from now on, no more useless breakpoints!

And if you’ve still been debugging using System.out’s, I’m sorry I wasted your time. I’m sure Vi is just sitting there flashing it’s cursor at you waiting for you to save those changes.

Share/Save/Bookmark