Friday, 25 December 2009

Looking back to 2009 and predictions from 2010

So this is Xmas and what have you done...
Well this is christmas and just like in John Lennon's song another year is over. 2009 was quite active and I suppose 2010 won't be much different... Here are few picks as what we left behind and what we should expect from Santa;

Adobe; This year Adobe Max was great, they have so much to show to developer community. Flex 4 Beta 2 is out which is quite stable (Here is something I have done for a friend while playing with Flex 4), probably we should expect to see the full version end of first quarter. This is the first major upgrade since version 2, most of the animation libraries are rewritten, and the language gets more mature. There are great changes and shortcuts making the syntax and coding style much simpler. Another big move from Adobe for Flex is the LiveCycle Data Services 3 and Fiber. Adobe seems quite keen to offer easy development with Fiber via LCDS3. You can check out beta version. I really think this will be a good step, Model Driven development will drive more people to Flex and more corporations will be interested in them. However, I still believe Adobe should lower the licence costs. Flex builder is not expensive but still there is a chain between the ide and the community. Open sourcing Blaze as a subset of LCDS was a great move but still LCDS is a bit isolated due to licence cost. I know Adobe needs to generate revenue, but forming a huge community is a big step, once Flash-Flex tools spread that wide I am sure money will follow. Another expectation from 2010 is the mobile Flash player. The long waited love between mobile world and flash coming to a happy end. Also suprisingly the new Flash CS will be capable to export native iPhone Applications. This would not ruin Apple's Objective-C but will definetly make iphone development much easier. One more thing, Flex ups sorry Flash builder 4 will also be offering mobile applications. I watched a session at AdobeMAX which was quite impressive. It will be offering nice features such as realizing the platform and arranging the UI more suitable for the device. So Adobe did well on 2009 and seems like a very happy 2010 is ahead.

Apple; The year started with questions over Steve Job's health and ended with his return. Everyone is worried about an Apple without him. This year apple did not release any major new product but nearly all the products had nice upgrades. Macbooks go pro (i missed that with just one week!!), iPhone received an S to its name which comes with faster chipset and a compass. On software side iPhone OS 3 is released which is quite important for every developer interested in iPhone. Finally the snow leopard came from the snowy mountain peaks to the town. After installation you do not realize the change at first but the details is great. Its tuned well and getting better. That should be something others envy, having a innovative and still stable OS and just release new versions to tune it! The new year brings new expectations from Apple, the tablet rumors has been around for quite long and it has been told that Apple had been researching on that for a quite long time, even the mobile safari on iPhone comes from that research. I am sure Steve has more suprises than Santa which is hard to predict. Good job apple, but i still wish to see cheaper models so macs can become more widely used.

Google; is on the top of the world. They are building their dream products, conquiring the world and still do not need to think where the revenues are generated. Its the only company offering everything for free to end user and still made the highest income in 2009. Chrome is getting more popular and extensible each day. Now the linux and mac versions are out which i had been using the developer previews for a long time. Google Wave which they introduced at Google I/O is out for beta testing. First preview of ChromeOS is available, may not be impressive but very promising. Google apps and mail is available for anyone for free even with your own domain name. GWT2 which should be out in 2010 is offering everything the first version failed and is a flagship of html+ajax against the Flex+JavaFX apps. Google App Engine is finally available for Java, and it is the most easy cloud to start with. Android is marching and for sure has brighter future than any other including the iPhone. Android SDK is the dream platform of any developer and soon with the better hardware devices it may become the dream phone. Well done Google! By the way one more thing I expect from Google in 2010, they should hire me :)

IBM; Everything started with the rumor of IBM buying Sun which ended in a not expected way. IBM should be wondering what will happen to Java and all other what if scenarios. 2010 will be hot for them.

Microsoft; Still trying to recover from Vista disaster, Microsoft finally released Windows7. Its not a huge step, not innovative but at least it is not Vista!, yes it can work, and if you are a vista user and not planning to move to ubuntu or mac than yes it is definitly worth to upgrade! Not much news for developers except for their own cloud, the Azure. I feel they are much behind what they expect from silverlight but silverlight 3 seems much more complete can compete with Flex. Windows mobile is suffering, really i can't even imagine how i survived using my old phone about a year and I don't really expect much. Windows mobile was the only platform the demo failed at AdobeMAX for the new Flash player. Sometimes I really can not understand Microsoft. They had the mobile OS much before than Apple and Google. I understand they don't have the vision of Apple so they failed to built a competitive one but even Google built one from sketch after that and they still can not improve theirs. I wonder if this is a plot for Gates. Is he planning to return and rescue just like once Jobs did in Apple? Well if so please hurry. Anything positive about Microsoft in 2009? Well i do not know what is it good for but they opened a cafe in Paris, named the Windows cafe. In 2010 most probably internet explorer will become less popular against chrome and firefox, windows mobile will be buried against iPhone and android. A new wave of tablet from apple or netbook (with chromeOS) reveloution may wipe out windows from that market.

Oracle; bought Sun and Larry was on stage at JavaOne keynote. Oracle became having 3 major application server, 2 major database, offering 2 competitive IDEs. Lately they announced that they will not kill MySQL to get approval of EU for the buy out but I don't think Netbeans would survive like MySQL. Glassfish may also become a victim. The main questions is what will happen to Java, well Larry is smart even if he wants to change everything he would not do it that fast and get anger of the community. So yes I expect to see a JavaOne in 2010 and I think JCP will survive. Actually it would be very encouraging for the community if Oracle give up their chair from JCP and let them survive on their own. Lets see what will oracle bring to Sun in 2010.

Sun, is sold. Everything started with the news of IBM buying Sun. At first I was worried but later I was even more worried when Oracle bought Sun instead of IBM. 2009 was quite full for Java. JavaSE 7 is coming to end, JavaEE6 is already out with Glassfish3. Netbeans had several releases. JavaFX is finally much more stable and usable, with better IDE support and mobile support. If Oracle would insist on JavaFX, i really believe it can compete against Flex and Silverlight. JavaEE6 has quite nice features and is filling every gap JavaEE5 had. EJB3.1, Webbeans, EJB lite are all long waited nice features. JavaSE7 is not a very major update, but still nice to see the progress and also there are some nice enhancements under the project coin, which may really improve the coding style and syntax of the language. All I can expect from 2010 is more investment on JavaFX in terms of features, components, devices, and better IDE integration and support.

For me, 2009 was a bit boring at first half (yeah good guess I was back to JSF that time), but the second half was quite fun. Attented Google I/O (received a free Android HTC Phone) and JavaOne, watched most of the sessions on AdobeMAX, had a presentation and tutorial session at Eclipsist. I was able to play, teach and mentor with Flex, learn some Objective-C and mess with iPhone apps (even released on to App Store), had some Blackberry development, and of course started warming up tours with Flex4. Oh also we doubled the posts on FlexJava this year reaching to 84 countries.
Waiting to see what Santa brought for me for 2010. Merry christmas and a happy ne year!!!!

Thursday, 3 December 2009

Web Service Definition with CXF, Maven, Spring

For a long time I have never designed and implemented a web service. I think for 2 years I have been using Remoting in my projects. Two days ago my company needed a small web service. The web service method would take a collection of entity as a parameter, then operate on the entities and return the operated collection back. I implemented the web service using Eclipse platform's web service tool. I have created an interface and the implementation class. Then I right clicked on the implementation class and selected the Web Service link, then Create Web Service link.

Then a pop up window opened and when I clicked the Next button I received a warning message below.

I recognized that axis needs custom object's definition in the wsdd file. And it does not support List, Set, Vector.. vs types of java. If I would define whole the custom objects to a definition file I would suffer from that.

I searched for web service tools for a while. I found Apache's open source project CXF. I sometimes heard about cxf from my brother. I was new to CXF and I needed a sample Hello World project to see the steps of creating a new project. In general, people type blogs about new technologies, but they don't provide a sample project implementation. I am suffering about this problem. Some of bloggers paste their code blocks but sometimes they are not enough. Yesterday night I have found a blog about CXF from
. Thanks to Benjamin.

Then I created a dynamic web project, enabled maven, enabled spring to the project. I created the operation classes, client class and tested the project. The console made a smile at me. You can download source code of the project. To run the project all you have to do is deploy to Tomcat and run as a java application. Enjoy :)

Microsoft's reply to Apple Stores; The Windows Cafe

This picture was taken, on december 2nd on Boulevard Sebastapol, Paris. I can't find words to describe how suprised I was. So what is Windows Cafe for? specially in Paris which is famous for its cafes.
First of all it has nothing common with a regular Paris Cafe or any Apple Shop. Its a Nespresso Store clone in terms of design, with a bar body guard waiting in front door, with few pcs inside and some windows boxes on the shelves. Probably the body guard is for stopping the apple users going inside.
The idea is really funny, and reminded me the Apple commercial where the windows guy was spending money on ads instead of fixing vista.
I think even Steve Jobs could not imagine to offer such a stupid thing if he had a spy in the board of directors of MS. Or is it someone in Microsoft who enjoys watching the Apple ads making fun of them.
So what next, Office restaurant? Visual Studio hotel?.. hmm may be IBM would also join with a Websphere theme park.
Oh god I never thought i would miss Gates...

Monday, 23 November 2009

Altair; An iTunes MP3 player built with Flex 4

About a month ago when my friend Cenk showed his brand new web site to me, all I had in my mind was to build an iTunes style MP3 player for his work. The site's design was nice but the player he was using was quite ordinary. So I holster my brand new Flex Builder 4 Beta2 and offered to build a better one to him.
I start for searching a coverFlow component so I wouldn't need to code it from strach where I end up with a nice one on Doug McCune's blog. I built some category shelves to support multi coverflow lists, add a regular list and some regular controls.
After several small and serious bugs (after intense testing by Cenk and Sinem) here is Altair with the initial version, which is named after the great game Assasin's Creed. Besides coordinating the coverflow, the list and the mp3 player I also try to recode the existing code (the most i could) with Flex4.
I am going to submit the full code very soon after refactoring and rewriting the rest but still feel free to contact me for the current source code if you need it immediately.

Ladies and gentleman here is Altair performing Cenk's great scores..

Monday, 9 November 2009

FlexJava on 79 countries

It has been quite a while since Yunus and I decided to post here. Later his brother Yusuf also joined us. For the last few months I had been using Google Analytics to watch our visitors. Actually we are not obsessed with visitor counts or bounce rates since we would really prefer quality on quantity but it still nice to see that we had visitors from so many countries so far.
However it is nice to watch the map at analytics. Day by day it had become more green.

This is the map showing the 79 countries we had visitors from. US leading and followed by Turkey, India and France. Thanks everyone hope we could manage to answer some questions of yours or inform about some news..
We will be here and you are always welcome :)

Update: ok its 84 countries, by last time I checked..

Friday, 6 November 2009

J2SE 5.0 End of Service Life Notice

The sky is red, I don't understand,
Past midnight I still see the land.
These are the opening lyrics for the album titled Burn by Deep Purple. It is considered to be one of the most underrated albums of the history just because it was the follower of the famous album titled In Rock.

This came up to my mind just after I read End of Service Life statement about Java5 on Sun's site. Java5 was the follower of most popular and widely accepted version of Java 1.4, even today it is still standart JVM used in many places.
I still remember the presentations introducing JavaSE 5, I attended. Actually with JavaSE 1.4 the JVM was already quite mature so JavaSE 5 aimed to make enhancements and to simplfy the language. However, with SE 5 many new features were also released which made this a major version.

I am sure most of you will list annotations, autoboxing, generics, enhanced (for-each) loops, varargs and enums as the major changes. Some may add Scanners, Formatters and Static imports to that list. For most of the Java developers, even using those changes took a long time (may be even later than JavaSE 6 released) because most vendors took it very slow to move to Java 5. Since the JVM stuck at version 1.4 most of these new APIs and enhancements was burried for a long time.
Actually Java 5 also offered more advanced features to the world but since even the simple ones could not have implemented on most projects tied to Java 1.4, the advanced had even less chance.

Java 5 was much more than bringing enums and generics to the language, Java 5 introduced JSR-166; The Executor framework, Concurrent collections, BlockingQueues, Decks, Atomic Variables, ThreadPoolExecutors and more which are all underrated by the end developers (even though most of the servers, frameworks or libraries already using them under the hood). Java 5 was a big major step and even though the vendors took it very slow to migrate, it changed the whole destiny of Java.

Thank you Java 5, although most of us could not make use of you through whole your "Service Life", still we are aware how important it was to have you...

Thursday, 5 November 2009

Java Developer Diaries; Learning iPhone Development with Objective-C

Few days ago I have seen a tweed from an iPhone developer who I met during a Google meeting in San Francisco. I am quite used to hear comments from Java developers about how complicated Objective-C is, however, this time it was the opposite. She was just out of a Java session and was complaining about Java for too many import statements, not providing built in patterns for ease of development.
This reminded me Episode IV, A New Hope, where Han Salo was making fun of lightsabers and Obi-Wan saying;
This is the weapon of a Jedi Knight. Not as clumsy or random as a blaster. An elegant weapon for a more civilized time.

Don't get me wrong I am not saying Objective-C is elegant where Java is clumsy (actually still I am much more comfortable in Java). I like both Objective-C and Java just like I like both Obi-Wan and Han Solo, but the thing is they are different than each other.

You can't change Java or Objective-C to act like the other. They have different approaches, traditions and ways to do things. Objective-C's roots go back to 1986 which is much older than Java. Objective-C is much tidy and clean when compared too languages of its time.

As Apple built their OS and systems on it, they also provide built in patterns for ease and tidyness of coding. Development for iPhone is not an exception, unlike most other mobile platforms Objective-C forces you to use some built in patterns (such as MVC) even you if you do not realize.

I don't really like hello world tutorials so this post will be a jump start in to iPhone development with Objective-C but I will still try to explain things in Java developers perspective...

Our mission (we should choose to accept) is to built an iPhone app making use of accelarator, GPS and the orientation of the device built on native iPhone UI components. We can build an application displaying our latitude and longitude when the device has shaken and the UI will rotate as we rotate out phone. This application will make use of most of the interesting built in APIs and still will be simple enough for a beginner (hopefully).

To develop iPhone apps you will definitely need the iPhone SDK and the built in IDE provided by Apple, the XCode. I am sure you will find it difficult to adopt to xcode but as you get use to it you are going to like it. Start XCode and click new project.

Picture 29

A new window will popup with several project templates. XCode contains pre defined templates. Choose iPhone from the list on the left and scroll until you see View-based Application on the right pane.

Picture 1This template gives you a single view built on MVC pattern. Click choose and name your project as MyTutorial. As you finish, XCode will create a bunch files. Your project should look like the following;

Picture 2

To summarize quickly, .h files are interfaces and .m files are implemantation classes. The files with .xib subfix are UI objects which are not text based code files. They are real visual design objects and you can tweak them with the Interface Builder tool which comes bundled with XCode. main.m is your manin class where your application is fired up, appDelegate classes are the delegation classes where your view (xib file) and your Controller is put in to action in harmony. You do not need to change the those so lets quicly move to contoller classes where the actual magic occurs.

Objective-C really makes use of interfaces so whatever you are going to built you should start with controller.h file. Click MyTutorialViewController.h once and the lower pane will display the codes. You will notice the interface and the UIKit imports are already defined. Unlike Java, in Objective-C imports are handles as frameworks which is a simpler way to control dependencies. Objective-C also makes heavy use of Delegates (which you should have noticed one already created so far). To add functionality from most of the APIs, you need to add the approciate Delegate, sadly there is no silverbullet here but a bit googleing, some guess and some code assist from IDE should work most of the time. Since we want the functionality from the acceloremeter and the GPS, we need to add the following Delegates to out interface.

@interface MyTutorialViewController : UIViewController

We also need to create some objects. Since location come with to values latitude and longitude, we need two UI objects to display them, also we need a locationManager which lets us to interact with the GPS and lets say an action method which we trigger from UI to clear the values and recheck the location. We need to create the action methods and UI outlets in the interface since our UI (xib) object will only interacts with this one. We also need another import to make use coreLocation libraries. The final code should look like this;


#define kThreshold 1.2
@interface MyTutorialViewController : UIViewController {
CLLocationManager *locationManager;
IBOutlet UITextField *latitude;
IBOutlet UITextField *longitude;
@property (retain, nonatomic) CLLocationManager *locationManager;
@property (retain, nonatomic) UITextField *latitude;
@property (retain, nonatomic) UITextField *longitude;


The first 2 lines are the import statements. Next we define a global constant kThreshold for checking the shake sthresholds. Next we have the CLLocationManager object which provides the GPS interaction. UI objects which are going to be binded to xib file are created with IBOutlet decleration. Here we created two UITextField objects, actually UILabel objects would be perfectly enough but to make use of different UI components I prefer to use editable text fields which we later define as uneditable. Next we need declare the @property lines for all thoe variables. I am not going to go in more detail with this, else this single post would become more complicated than a Objective-C book. Last we need to add the decleration of our action method, since again this would be something interacting with the UI -in this case receiving an action- we mark this with IBAction.

We are done with the .h file but we need to add a framework as a last step, if you expand the frameworks on the left pane you will notice there are some already imported frameworks.

Picture 6

Since we are going to make use of location services, we need to add to the framework associated with it. With a little help from google and some guess you can figure out its called CoreLocation.framework (you can also prefer to open the frameworks folder and try to find through them). Right click to your project, choose add and an existing framework.

Picture 7

Choose CoreLocation.framework, you will notice you can navigate through to see all available frameworks in this pane.

Picture 8and finally click add to add the framework to your project. With SDK 3 the option at the top of the window is dimmed. However if your version lets you to check this be sure that this option is not enabled. This is used to embed the framework which is already a part of the OS to your project (it is like embedding the rt.jar with your java application, simply you really don't need this unless you want to create pain to everyone who downloads your app).

Picture 9

Done, so lets go and finish the implementation, click MyTutorialViewController.m. Lets start with making use of the objects we defined in our interface. Objective-C has a different way to create getters and setters. You need to mark the objects you defined in the interface with the @synthesize keyword.

@implementation MyTutorialViewController

@synthesize locationManager;
@synthesize latitude;
@synthesize longitude;

Using predefined templates also provides some built in methods. If you scroll down you will notice methods which are commented out. most of those are ready to be used as you make them available.

Picture 4One of the most commonly used of them is viewDidLoad which is fired whenever the view associated with the controller is loaded. Uncomment that method and add the following;

- (void)viewDidLoad {
UIAccelerometer *accelerometer = [UIAccelerometer sharedAccelerometer];
accelerometer.delegate = self;
accelerometer.updateInterval = 0.1;

To explain what we did, we kindly ask iPhone to share the accelerometer with us and declare our class (self) as the delegate of that accelerometer. Last we provide an interval value, to tell the accelerometer how frequently we want to be informed about movements. Since accelerometer will think our class as a delegate which can handle the updates, it expects to fint out the methos where the values to be send. Scroll down to bottom of the file and just before the @end statement insert the following method.

- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
if (acceleration.x > kThreshold || acceleration.y > kThreshold || acceleration.z > kThreshold) {
//shaken go and subscribe to location service
self.locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];

didAccelerate methos will be called by the accelerometer with the given interval and an acceleration parameter will be passed. What we do next is to check if any of the coordinates (x,y or z) goes higher than the given threshold. If it does than we initialize our locationManager object and declare our class as the delegate of it. As you should have noticed most of APIs in Objective-C are used via delegates. Last we need tell our locationManager that it can start updating the location info. Objective-C again offers a different syntax to send messages to objects as you see on line 7 (instead of dot notation). Again I am not going to go into detail in this.

To receive the location updates, we need to add the following method which the API is expecting to see in its delegate;

- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {

latitude.text = [[NSString alloc] initWithFormat:@"%g°", newLocation.coordinate.latitude];
longitude.text = [[NSString alloc] initWithFormat:@"%g°", newLocation.coordinate.longitude];

[locationManager stopUpdatingLocation];

didUpdateToLocation will be called and updates (the accuracy and intervals can be given as parameter however its not guaranteed that the GPS will respond those according to coverage) will be send via two parameters the newLocation and the oldLocation. Since what we care is the new location's attitude and longitude. We request those values as a new String object with the desired format and assign the to UI placeholders text values. Last, as we do not need any further updates once we receive the location (keep in mind you are using battery on a mobile devide) we kindly ask the locationManager to stopUpdatingLocation. Since our didAccelerate methos will reregister the location manager if the user shakes the phone.

We already had created an action method to clear the labels. Add the following for this purpose;


We also wanted the user interface to rotate according to changes in the phone's orientation which is also already defined but commented out. Scroll, find shouldAutorotateToInterfaceOrientation method and uncomment it. We should let it return true for orientation changes, just change the return type. The method should look like the following;

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return YES;

Ok finally, we do not have a garbage collector and we are on a mobile platform so we need to collect our own garbage. Scroll to find dealloc method which has already been defined and release all the objects we had created so far.

- (void)dealloc {
[locationManager release];
[latitude release];
[longitude release];
[super dealloc];

We are pretty done with coding now we need to build our interface via drag and drops and make necessary connections. You will be suprised that all of those can be done visually. Double click the MyTutorialViewController.xib to fire up the Interface Builder.

Picture 1Interface Builder consists of 4 different windows, which are consisted of different panes. tabs and options. Again I will not go all in detail just go straight and built the interface.

Picture 11

On the left window in the screenshot above, the window titled view is the view of your application, on the very right you can find the built in components provided for iPhone and in between there is a window where you can tweak the setting of your components you place on your view.

As you have noticed our view is gray, so lets plave a view component from components list. Scroll until you see view and simply drag and drop on top of your view.

Picture 12

Next place two labels, two text fields and a button to the view, you should notice guide lines will appear as you drag items. When you select an item you had replaced, the middle pane changes to properties of that item.

Picture 1

Your view should also be looking something like the image above. When you click on the labels you can change the text property by editing the test on the middle window. As you may have remember, we had used text fields to display the coordinates. However by nature those fields are editable and a default soft keyboard will appear when you focus on them. To stop this we need disable user interaction.

Picture 16

Be sure to uncheck 'User Interaction Enabled' for both of the text fields. You may also prefer to change other properties and see the effects. To check the layout in action you can save and go back to xCode to run your project.

Altough we have done coding and pretty finished visually, still we don't have any connection between them. We need to bind the visual components to IBOutlets we created in code. select the button, right click and drag to File's Owner icon in xib window as shown in the image below.

Picture 18

As you release the button, a popup will appear. You will notice the name of the action method you created before is listed. As you select the method and the visual component will be binded.

Picture 19Alternatively, you can select the button go to the middle window and select the second tab which show all avaible references of this outlet. You can click and drag touch up inside to again file's owner. Since you already did the first step this refernce should already be binded.

Picture 20

Next select View and go back to previous window bind the text fields the same way by dragging the connections to the UI components.Picture 21

If any of the steps, something is missing, can not be connected or unavailable go back and check again although iPhone development is heavily assisted, it is quite easy to skip something and once you skip it is hard to find out why something is missing.

Run the application, if you have chance to deploy it on a real phone do so since it is the only way to test the shake effect.

Picture 25

Actually there is a new shake API which came whith OS 3 and actually easier to implement than the one we did but for the sake of understanding the way Objective-C works I prefered to do it in the old way. Using the old way also gives you opportunity to work on OS 2 devices. However if we had chooe to use the new shake api we could be using the sake option provided with the simulator to test the shake action.

Rotota the phone and hold it in landscape mode, you will notice the screen changes the orientation.

Picture 24

Next if you have chance to deploy the app on a real device, or change the shake method with the new one provided with OS3 and use the shake command on the editor (again this option will not work with code given above but our code works fine on the phone and should give better understanding).

Picture 26For the last step, tap the button to clear the text fields.

It should be a little confusing, if you are new to Objective-C and xCode. Although it might look a bit confusing in the beginning, the structure, syntax and the APIs provided by Objective-C is not that hard and fun to use. Eventhough I didn't mention keep in mind there is talented full debugger built in xCode which can be life saving.

If you have troubles with understanding go and check basic Objective-C tutorials on Apple's site, since this post aims to show you the structure and how to make use of basic APIs of the Objective-C.

Sunday, 1 November 2009

JavaFX; the empire really strikes back?

Year 1996 was the introduction of Java Applets with a dancing duke animation which was something quite unusual for web pages of that time. Very soon many web sites had applets running in them, for menu interactions, forms, animations and much more.. and not very soon after those websites stop using applets because of version and jre plugin problems.

In 2006 I attented an Adobe meeting where I had seen Flex2 beta. The introduction was quite simple Adobe was saying we have Flash player in 98% of the clients which is all you need to run Flex applications. However (as a developer loyal to Java), I was thinking at least that many of the clients should also have JRE on their computers but the reality was different, applets had problems with versioning, plugin upgrade and plugin installiation. Even though Java started the revoluion of Rich Internet Applications, it has been left out of the play.

JavaFX is out to change that, it was first announced under the name F3 and very soon to support it, consumer JRE was announced. JRE was too big to download and to hard to upgrade for an end user which was a main reason for applets to fail. With the new JRE update, Sun let the end users to upgrade and install the JRE in a painless way.

So, what is JavaFX? JavaFX is an expressive scripting language built on Java Runtime. If you are familiar with competitive platforms such as Flex and Silverlight, JavaFX differs in the decleration syntax where others use XML based declerations, JavaFX follows a more CSS style.

With update 1.1 JavaFX also has built in mobile support which is a good plus compared to others. A JavaFX application runs on mobile platforms with the same set of components as long as you don't use wrapped swing components which is a great plus when compared to Flex which has totaly new and different components for mobile development.

If you are new to JavaFX development JavaFX site is a nice one stop source, actually other links you will come up with may contain deprecated packages and class (such as i did before). Also you may prefer to watch a screencast i published long before.

IDE support for JavaFX is still in progress, Currently Netbeans is the best supported and uptodate IDE for JavaFX, however, Eclipse has also became quite stable and usable. On eclipse there are two alternatives, official Sun version of the eclipse plugin can be downloaded from here , also Exadel has a very promising JavaFX plugin for eclipse. Also if you intend to code animations there is a suprisingly successful visual tool to generate JavaFX code just like using Flash CS which can be used as a webstart application. So enough about IDEs lets deep dive into coding...

JavaFX brings a similar approach to Flash-Flex couple with one major difference. Since there is no GUI and design tool like Flash, you have the control of the Flash counterpart of Stage and Timeline directly in the code.

If you create a new JavaFX application in Netbeans or Eclipse, it will create something like the following class;

import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;

Stage {
title: "Application title"
width: 250
height: 80
scene: Scene {
content: [
Text {
font : Font {
size : 16
x: 10
y: 30
content: "Application content"

Stage is your main window where you can declare your properies in CSS like style, the scene property of the stage has Scene object which holds an array of visual contents. The output should be something similar to this;

Picture 1

Suprisingly to run the same application on mobile does not need any further steps than choosing the mobile profile to run;

Picture 2

By deafult JavaFX applications would run on mobile as long as you prefer JavaFX visual components instead of wrapped Swing components.

To animate the text we previously add, drag n drop a timeline after the stage.

Picture 3

The Timeline should not be in the Stage since its not a visual component. Timeline controls the behaviours of the visual components according to time. Timeline's each KeyFrame has a values property where you can declare the changes you want to see on your pomponents properties. The text field we had declared does not have an instance id (since it was created inline). So lets add tweak our code and take the text components decleration out of the stage.

var text=Text {
font : Font {
size : 16
x: 10
y: 30
content: "Application content"
Stage {
title: "Application title"
width: 300
height: 200
scene: Scene {
content: [

By declaring our text property out of the stage, now we have class wide access by instance name. Developers of Flex and Silverlight must have noticed the syntax and approach differences so far. JavaFX syntax targets components and transitions to be handled decleratively since JavaFX mostly targets coders and it does not have a GUI tool like Flash CS. However the result is a platform where you can create transtions and animations easily by decleration.

Lets continue to add more KeyFrames and animate our Text. Just like adding the timeline you can drag and drop KeyFrames in the TimeLine. However its not much diffrent than typing since there is code assist both in eclipse and netbeans. Change the first Keyframe's time to 0 and initial values as translate values. Next add another KeyFrame with time value of 5s and add new translate and scale values. Translate values will be used to move the text object on x and y axis with the value given, where the scale values scale the component with the multiplier of the given value (2 in this case). Notice TimeLine has '.play()' call which starts the animation.

Timeline {
repeatCount: Timeline.INDEFINITE
keyFrames : [
KeyFrame {
time : 0s
values: [text.translateX =>10,
text.translateY =>30]
KeyFrame {
time : 5s
values: [text.translateX =>15,
text.translateY =>60,
text.scaleX =>2,
text.scaleY =>2]

Finally run the JavaFX application and watch your text enlarging while moving. This transitions can be applied to any property of an object. JavaFX also has predefined animations like ScaleTransition, RotateTransition, FadeTransition... etc.

Transitions can be used to create timeline animation on desired effects. Also multiple transactions can be run parallel or sequentially. To add a FadeTransaction on our text component;

node: text
duration: 5s
fromValue: 1
toValue: 0.3
repeatCount: Timeline.INDEFINITE

Run the application and add more keyframes or tweak the values. Animations and transitions is a powerful feature of JavaFX which has out of box compability with mobile applications.

Monday, 19 October 2009

News for Developers from AdobeMax'09

This year AdobeMax was really hot for developers. Even though most of the demos and news rely on beta products, they still offer a lot.
AdobeMax'09 dropped the bombs as with the keynote of the first day. Here are the highlights;

-Flash 10.1 includes mobile support. This is a long waited love story between the mobile world and the flash player. Seems like not much left for them to meet. How would their relation be? well time will tell.. The demonstrations of mobile Flash Player performed on Nokia, Android, Windows Mobile and Palm. Guess which one crashed... ok good guess, seems like Windows is still Windows even it is mobile.
-Flash 10.1 also includes lots of runtime enhanchments. Most of them target Air platform to run with less memory and better integration such as usb support, triggering external applications.

-Ok this one is also another love story, eventhough i didn't start with this one this is the highlight of the show... iPhone running flash applications or should i say flash building applications for iPhone. Since applications built on iPhone are not allowed to execute other codes building a flash player (or JVM) is not permitted. Adobe's approach is totally different but solves the problem. Since they are not allowed to run flash player on iPhone, they convert flash applications into native iPhone code which results installable native apps seperate from flash player. Flash CS5 is needed to achieve this, and it is not even relased as beta yet but it will definetly be a huge impact as it becomes available.

-Mobile movement in Flash also covers flex development. Even though this is not available in public beta of Flex4, Flex will also be available to build mobile apps which include iPhone. Suprisingly the outcome (transitions, layouts) suprisingly looks like native iPhone apps. Flex also lets customizations depending on the platform the application is running on. One important thing is mobile components are different than desktop ones, even though they are used in similar way still you need to design and develop from strach (which JavaFx lets the same components to be used both on mobile and desktop).

-Flex moves to version4, so should the developers.. Flex 4 offers a totaly new namespace "Spark" with still supporting "mx". Using states is much more simplified, new Flash Text Engine is impressive and PixelBender s are amazing. The whole effects and animations library is rewritten (which i plan to write a more deep in detail post). I must admit Chet (the former Java Swing Architect, also author of Filthy Rich Clients) did a great job with that. It is much simpler to take control of the effects with writing custom easing and interpolations using IInterpolator and IEaser. I must tell you Flex is becoming the dream way of a developer to built animations without touching design tools.

-Clouds are the popular topic of the year, so Adobe can not resist to built one and of course by using their server software; The ColdFusion. Coldfusion 9 looks promising, and they also offer an eclipse based CF IDE.
-Livecycle, well if there is a cloud, LC can not be excluded. So here it is LC also comes with cloud support.

All the sessions of AdobeMax is available on AdobeTv. I strongly recommend watching the keynotes, and Chet's Flex session.

Developers has never been so much supported and had available tools from Adobe. Seems like JavaFx, Silverlight and ObjectiveC has broaden the perspective and made Adobe more creative. Lets see when the real products hit the ground!

Saturday, 10 October 2009

Thinking in Flex, local files

Ok, this is not a post related to Bruce Eckel’s hihgly reputed books like C++ or Java, just the title is incluenced from them.

Working with Flex can be a little trickier for regular web developers, specially for the ones who never ever worked with Java Applets. So what flex is and what is flex not, first flex is not a traditional web application and its definitly not a desktop application. Actually flex is a more skilled web application which is pretending to be a desktop application. A widely asked question to me is local filesystem access in Flex, which is something you can't do and also you should not in normal conditions. Since you are developing a web project why would you need to write local files and if you really need this why are you developing a web project instead of a desktop one? I am sure anyone can give pages of reasons but still try to think in Flex, how will you be sure about the security of the file, if its modified externally or what if you rely on that and it just disappears..

However, Flex still offers writing limited local files which are called SharedObjects. First of all SharedObjects are simple, and they should be used for simple tasks in a simple way. Writing to a SharedObject is not like a regular file I/O operation for the developers perspective. You just ask one to be created for you;

var myPrefs:SharedObject = SharedObject.getLocal("MuratsPrefs");

and use it in a simple way by accessing its data object to read or store your values;"Murat";"3.10.2009";"chrome";

simply commit your changes;


or clear whatever it has;


Actually the file is much or less like a cookie and also referred as a Flash Cookie on TechNote of Adobe. This file is limited to 100kb by default and would ask for permission of the file is exceeds. However this is a bit tricky since the user can modify the size, even to 0kb and can also disable the permission popup which would result blocking the whole access.

I couldn't manage to locate the file on Mac. I tried to load the written file from another application which is built as another swf, and could not get any data. Next i tried to load the same file from the same flex application running in a different browser which also failed.

SharedObjects seems a nice and easy to use tool but they can not guarantee the access, if you need the change your application to a new swf the file would be lost, and suprisingly worst if the client decides to change the browser, still your file would not be reachable. So use them at your own risk.

Friday, 9 October 2009

Adobe WorkflowLab

As a software developer if the necessities, project steps are well documented, I can design and develop the new projects in time, maybe in a shorter time. Else whole the workflow is done by the developer. He/she creates the cycle of the workflow of project in his/her mind and starts developing according to that thought or the workflow he/she hears from the manager.

Today I got a newsletter from Adobe Edge. Sometimes I am bored on these kind of periodic mails. But Adobe's mails interest me and I read them (I receive them monthly). At the ends of the mail there was a link to a new project which is a workflow engine project that excited me. It is named as "WorkflowLab". By this application you can design the steps of a project using a user friendly graphical user interface. And creating a task you can define your applications that you will use in this step. This is a good property of the program. But whole the defined programs are Adobe's tools. I could not see an "other" choice and could not define custom tool. But I saw that next year they will provide this capability.

I used several workflow tools and developed a workflow tool for a company during my internship. None of them was fast as this program and none of them uses low disk space. You can find an install the program from and you can find detailed information from . If you are looking for discussions and forum you can use

By the way, the program is lightweighted and uses 2MB of disk space. The program is free of charge.

Thursday, 10 September 2009

Microsoft on OpenSource, CodePlex

As today I heard CodePlex backed and fund by Microsoft is open aiming to enable the exchange of code and understanding among software companies and open source communities, as their own words. It is a great move, not sure clever but a bold one. However, I am not sure if Microsoft really realise what does open source mean. Open source means community, sharing, talking/arguing/agreeing on things. If you don't have your believers behind you open sourcing does not mean anything. You will stand as a Mesiah on your own without any believers.
Several years ago I was working in a bank for a core banking migration project, which consist of mainly java and some .net development. At some stage due to now having anough Java developers, some of the .net folks also asked to join the Java team. One of them who was a good .net developer, took over the socket communication framework which I built. One day I stopped at his desk to ask how he is progressing, which he told me, he was stuck at some point of communication level where he is receiving unexpected data. When I showed him he can as deep as the source codes of Java sockets to debug everything byte by byte he was thrilled.
Microsoft never open sources their main products the operating systems, servers, office stuff. They didn't even open sourced their development products. Now do they really expect people who develop on their platforms to do the opposite?
Why don't they start first, showing they are honest and backing open source community. What about open sourcing their development tools, or at least an old version of Windows which is not on sale now?
Let me give you an example, probably hibernate would not be an open source project if they knew JPA which is build partly on them and became an integral part of JRE would be open source. Its still your turn Microsoft..

Sunday, 30 August 2009

ActionScript is not Java!!

When learning a new language (not programming literally a new language), the best thing is not to compare it with other languages and your native language unless they are really very common. Each language has its own grammar, own way to express things and different prononciation. If you try to learn the new langauge base on another one, you will probably end up speaking french as an english men or vice versa. Languages have their own tradition, heritage and culture, which will greatly differ from one to other.

Programming languages are also same. You may object this saying some of them share the same basics, which I also agree (ex. java and c#) but they still differ. If you move from one to another with your native tradions you will never look like a native speaker on your new platform. Its not wrong to use either camel case or hungarian case depending on your tradion but it will definitely reveal where you come from, and for sure you will seem like some one out of the community. Curly braces are also the same, you can use them just after the declaration or the next line but with other classes or methods written by others around you will definitly seem and english men in new york.
I face this issue when i try to teach Flex to someone from Java or .Net background. It is hard to accept your beloved arrayList to be some else acting a bit different although looking quite same. If you are just playing the language then its fine, but if you are seriously interested then here comes the problem. Actually more serious problems are ahead if you do not realize you are in a new world. Here is a great example from Chet who is a Java and Flex expert..

Basically his examples shows the difference of variable decleration and scopes between java and flex.

What do you think this prints out?

            var i:int;
for (i = 0; i < 2; ++i)
var blah:Object;
trace("blah = " + blah);
blah = i;

Or how about this?

            for (i = 0; i < 2; ++i)
var blarg:Object = null;
trace("blarg = " + blarg);
blarg = i;
In actionscript the scope of the variables blah and blarg is function level, which is diffrent than Java. In Java we would expect the reference to be renewed in each iteration. However in Flex since each iteration refers to the same object it is not null anymore after first loop. Which will result an output of;

The first example prints out:

    blah = null

blah = 0

and the second example prints out:

    blarg = null

blarg = null

More details go and check his post! But you might have already noticed him placing the curly braces in the new line which is not a Java tradition but which is actionscript.
Always try to consume as much the culture of a new language, first it will make you close to be a natuve speaker, second you will understand how it works better and finally being multi cultural will extend your ways to think and remember no language is perfect..

Java's tale on OS locales

As a Java developer who is not living in 'english' locale zone, he first thing I do is to change my locale to english whenever I face a new computer. However this is not a natural born reflex I had. Here is the story, why..

It was the year 2003/4 when I started working as an enterprise Java developer in a bank. My first assignment was to solve a problem where the java code which used to work fine on developer computer, failed to connect a network resource. As someone not familiar with the app, I switched to debug mode and deep dive into. After a while I figured out what was wrong. It was just a small innocent character which acts differently in different locales. The character 'i' becomes 'I' when its in caps although in Turkish locale it becomes a totaly different character of 'İ' which is not good for a network address. I don't remember why the app needs to change the case but its clear that its breaking the system.
Later I realised most of the webspehere/rational tool installs and uninstalls fails because of my locale. The funny thing is, since the error is something very unexpected for a developer not familiar with turkish characters usuallly it is not handled well, just displaying an error message of 'nullPointerException' or sometimes not even that. Also when you google the problem nothing pops up since this is a problem occuring only in your locale which very few people should be facing.
After a while I started working in a media company for building JavaME games. I was free to choose my own IDE, so I checked and decide to try EclipseME. After few attempts to install, I decided to google the problem I'm facing. Strangely the only posts stating the same problem were Turkish guys so I didn't even bother to read the posts. Instead I go in to locale settings and change to english, which let eclipseME install smoothly.
We had a group of friends playing Football Manager online. However none of us able to install and run as Football Manager 4 was released. There were no one on the inernet mentioning such a problem but we couldn't able to play. Later I heard that the installer was written in Java, as you can guess it didn't take long to set up our network to play again the new version, and any one willing to change the locale were welcome.
As I move to my next job in Istanbul Airport, I was enough experienced to check the locale settings when I face a strange problem. I remember fixing at least 3-4 times of localization settings. The worst part is, such problems occur may be only once or at most twice a in 1-2 years which doesnt make you think about checking the locale. I remember colleagues to become very suprised when changing the locale when I ask my help and then telling them to check again in snob way ;)
I remember facing much or less the similar problems on Flex which is quite normal. It has jre under the hood and working on top of eclipse but the latest problem which I faced (actually not me, my locale is english) was quite intresting. In mid June I gave a flex course in a bank, and one of the attendee was saying that the flex builder asks the registration key each time although it accepts the key everytime she enters. After trying few times, I dive into property files and saw that flex was able to write the key to the file, however, on startup the builder was asking again. I decided to unistall and install again. Guess what, the uninstaller quited unexpectedly with a message of null. As anyone read so far can guess I changed the locale, reenter the registration key and it has gone..
The problems with locales such as Turkish, are not daily problems but be sure they will appear the moment you expect the less. Working with or on anything related to Java? either set the locale of your IDE to english or just like me set the locale of your OS. I never had any problems or missed any features because of using english locales so far, either in windows, or linux, or macos..

Friday, 31 July 2009

Head in the clouds...

Just like fashion software world has its own trends, up and downs. SOA, WebServices, had been popular quite a while. Rich Internet applications is another trend which we were introduced to Silverlight and JavaFX last year. While those topics still popular, the latest trend from tailors of silicon valley is the clouds.
It seems like cloud wars not much far. First of all whats cloud computing, the wiki definition is;
Cloud computing is a style of computing in which dynamically scalable and often virtualized resources are provided as a service over the Internet.[1][2] Users need not have knowledge of, expertise in, or control over the technology infrastructure in the "cloud" that supports them.[3]

So what's new in clouds, weren't the approach known for a long time? Why suddenly everbody building their own cloud?

First of all, cloud covers all the range from a individual developer who has a startup project which he/she doesn't want to invest in, to big firms who want scability, power and still want to delegate the administration and maintanence. Different clouds offer very different options varying from zero to full administration, zero to paid startups, own db implementation to your db vendor choice.

Besides that clouds are good choice because even getting a very basic hosting with Java is quite troublesome and expensive when compared to php and .net.
Adding a jar, deploying a new version will probably make u restart the server and ends up all the apps sharing the server with you.

Fine so far but are the clouds safe, will your data be in good hands, will your application be locked in to that environment and you will have headaches when u want to move to another?

Here are some major clouds and what they offer;

Amazon EC2
Amazon is the most mature platform among all the clouds and can offer great flexibility and is the most configurable one. Unlike others amazon lets you take the full control of the servers. EC2 offers shared disk spaces where you can install, configure, run and maintain your choice of softwares on your own virtual machine. It even supports windows, .net and SQL Server. If you want to keep the administration and setup simple they also have out of the box tools such as SimpleDB which is a schemaless db implementation just like Google's BigTable. Amazon also has a built in queue system SQS. Amazon EC2 expects you to built your services as WebServices which is good for compability and portability.
Everything looks great with EC2 including the pricing. The prices are quite standart and actually when you consider what amazon offers it may be the best deal. However, you even need to pay for the startup, which may not be the best option in all situations

Pros; EC2, SQS, SimpleDB, S3 are all great well thought and mature services. Still if you don't find those capable enough you are free to deep dive and install your own db or vendor specific softwares.Your application won't be coupled to Amazon and will preserve portability. Good pricing.
Cons; It is not free to start so not for individual startups (which can be called as tryups :) ) without investing.

Google App Engine (Java)
I didn't even consider trying app engine when it was only supporting python but now java is supported. This is the easiest cloud to work on. Installing, developing, deploying, administring is also so easy. Just go eclipse update site download the plugin and sign up for a app engine account thats it. The plugin comes with a embedded db which is an implemantation of bigtable, and a embedded server which is an implementation of Jetty and both simulate the production environment well (not exactly but well).
App engine also offers good pricing and also its free until the application reaches the quota (which is quite reasonable). So you can even use it for free basic hosting. The biggest drawback is that it is a subset of java and doesn't offer a full relational database. So your application must be designed or modified to be able to run on App engine.
App engine shines on admınistration unless u want to control everything on your own. There is no administration, no maintanence and very little to configure.
Just like SimpleDB of Amazon, Google offers a schemaless datastore, BigTable. BigTable is fast efficient supports JPA/JDO but doesnt support full relational designs. It is a hierarchical datastore and istead of relations you need to understand hierarchical relations between entities and denormalized data. App engine is the hardest part to migrate for a standart Java Developer, however, if you succeed to understand the basics and move on, it offers fast, reliable and easy to maintain datastore. As google says Bigtable is the system which all google apps use internally, so do not need to worry about performance or design issues and better to learn how it works.
Other unsupported features are; : no threads, no network connections, no webservices, no file system writes, no java2d, no native code, no java2d but images api can be used instead. Soon support for async and queue api will be available. Besides those reflection is also limited. Reflection can be used as long as it is used for your own classes, but if your application tries to use reflection on runtime and system classes, app engine does not allow that. Actually the frameworks and librarires I tried which did not work, failed mostly because of reflection. The good side is most of them are getting patched fast to work on app engine, such as BlazeDS, Jersey, Xstream. Many well known libraries work out of the box, such as, guice, spring, aspectj,spring, grails, gwt, tapestry, jruby, jython...etc
Pros; very easy to start, develop and deploy. Great for zero startups, makes no excuse if you have a project idea. It is java!
Cons; Not whole java stack and libraries supported, bigtable needs a different approach to design than relational databases. You may end up leaving your favaourite library because it doesn't work and your application will definitely be tied to app engine.

Microsoft Azure
I would be very suprised if microsoft didn't have one, they even compete with webcam, keyboard and mouse producers. Azure is definetly a .net cloud and offers good and easy integration with visual studio developers. Microsoft is an implementor rather than an innovator for long. They are not doing bad at following Amazon. They offer their own Service bus, support web services and back ground processing.
Pros; well if you are a C#, MSSql developer it will definetly be your choice, other do not offer a lot more to convert you from the dark side (just kidding :) no offense)
Cons; well if you are not than the azure doesn't offer much to convert to dark side.

Sun Cloud
Sun's cloud is really a cloud now, but seems promising. What they plan to built seems promising, full stack java with full support to all Java standarts. They have good experience on OS with Solaris. However they can't even provide developer accounts yet (at least i have been waititng more 1.5 month). Need to wait and see, hope they wont miss the train by that time.
Pros; sun is java, they will have good support with full stack of java.
cons; it is a real cloud now (doesnt exist), and i wonder what oracle plans about it.

Actually there are some other cloud alternatives in the market such as GoGrid and AppNexus. To be honest I personally didn't have much experience on those and frankfully I would consider a big name behind the cloud, since i am going to give them all my data, application and alter my application on that cloud implemtation.
So far it seems Amazon is good for a full java project built on web services which has a budget. However, Google App Engine is great if you have zero startup and no problem on building it on BigTable and it also offers very fast development. Of course Azure is great if you are on .net side...
So there is a cloud for everyone..

Wednesday, 22 July 2009

JAXenter in English!!

..and the day come. JAXenter which used to be an only german site, is available in english now. It is nice to know such a resource is available now. Actually another suprise for me was seeing our article which we wrote with Yunus after the eclipse democamp presentation.
Don't forget to bookmark and start following JAXenter and by the time you stop take a look at our article too which we did not published or plan to publish here.

Thursday, 16 July 2009

Flex Source Code Formatter

From the beginning of my first Flex experiences I was suffering from that there wasn't any source code formatter of Flex Builder. Using Eclipse, I can format the source codes by only one right click.

But I was not able to format the source code of the Flex classes, components, mxmls... etc.
Today I searched about this topic in Google. And I found a plugin which can be plugged into Eclipse and formats the flex source codes.

The process list you should do is below:
1. Download the plugin.
2. Extract the files into the "C:\Program Files\Adobe\Flex Builder 3\plugins" directory. (Or your set up directory)
3. Restart the Flex Builder (or Eclipse if you are using Flex Builder as a plugin)

When the Flex Builder is restarted you will notice that 5 buttons will appear on the Toolbars Menu and two items on right click.

You can find detailed information about this tool at Flex Code Formatter.

In my opinion after formatting the source code, actionscript code segments looks nicer than mxml code segments. (P.S. : I only use it for actionscript codes.).

There isn't much people around me using this kind of tool and I am waiting for your comments after using this tool. I hope it will be a useful tool.

Welcome Incubator Authors :)

I proudly announce our new incubator authors Yusuf and Aytek. Yusuf is Yunus's brother who also has much experience with flex and Aytek is an old friend who is experienced on iPhone and Objective C besides Java.
Welcome everyone looking forward reading your posts...

Tuesday, 14 July 2009

Adobe Flex MenuBar Component

This MenuBar component allows you to create 2-level menu bar in your Flex applications.

The component takes a dataProvider as an argument just like the MenuBar component provided
in Flex platform. But this component just takes dataProvider in XMLListCollection.

In the sample application, menuitem object contains label, requiresLogin and data fields.
  • label field is the displayed text for the given menuitem,
  • requiresLogin field keeps the information whether the given menu item needs login operation or not,
  • data field is used as the id descriptor of the given menu.
When creating a collection of menuitems, give unique data field values for each menuitem.

In the given source code of a sample project, you will see GradientCanvas and GradientHBox components. They are just used to give a gradient for the menubars.

MenuBarEvent keeps the clicked menuitem id, and the information whether the clicked menuitem requires login operation or not to enter that menu.
MenuData, MenuHierarchy, SubmenuData classes are just used for data structure of the menu bar.

Moreover, you will find Gray and Green css files used for the visuality. They are just samples to demonstrate how to give gradients of the menubars, selected menu item color, etc.

Monday, 13 July 2009

Yes, Microsoft produces nice mouses...

I really wonder if that would be all we will be saying about Microsoft in few years time. I have been a computer user since Commodore 64 and all these while Microsoft was a growing company which became a real titan. Didn't they make mistakes, of course they did but every time they know how to strike back. They missed multimedia (commodore amiga had cd drives at the time microsoft didn't have real windows) later they set the multimedia standarts, they missed the internet startup, they hit back with explorer, they missed visuality they hit back with xp, they missed java (actually they just couldn't control) they return with C#, they missed ICQ later dominate with msn, they missed game console era they became the nightmare of sony with xbox (thanks to ease of development and cheap hardware), we can add much more examples such as MS Sql, windows nt... etc. I remember once they even took control of Apple. Microsoft hasn't been the innovator for long but they really know how to observe the trends and strike back. They started producing mouses, keyboards even webcams... anything you can imagine related to computers.
But I have never seen Microsoft loosing blood in many fields that fast. They seem like failing anything they have been doing since Bill went to enjoy his life. I just checked Google Analytics, I know this can not be all exact numbers but still very interesting...
Firefox leading woth 60-65% in browsers and most interestingly second place is Chrome! with about 20% and Explorer comes third with only around 12%. Can you imagine a browser shipped with the operating system (since most people don't even think about installing another) is getting so low usage. In operating systems Microsoft is still dominating around 76% where apple can only get 13% and linux following about 10% (also keep in mind windows has more illegal installed copies than mac os). However the reason is not really because of Windows success. Apple is demanding very high prices, and most pcs are already shipped with Windows installed so most people don't even bother to give a shot to linux. Linux is running fast, they also had a good acceleration with netbooks. My mum who refused to use openOffice a year before is now using a netbook with linux and open office! Microsoft may think the pc vendors are quite happy with the deals but with such a progress in linux world they may start to cancel the deals and once the pandoras box is open nothing can stop it and if Microsoft lose the advantage of bulk vendor licensing not much people will left buying licences from them. They already lost enterprise software development to Java, mobile world to iPhone and internet to google...
What can they do? well Microsoft really needs a premium class OS which can compete with Mac OS in term os visuality, easy of use with features like multi touch support etc...(which i dont think Winows 7 can!!) They may work with PC manufacturers to produce standartized and high quality hardware with great integration and compability woth the OS. Meanwhile they need to have a stripped down version of Xp for daily, business and netbook users who want performance overall everything. This version may be open sourced and even distribute free or cheap so that they can maintain their community. Google is also coming with their OS and there are many easy to use and successfull linux distros. They need to have cheap, open, fast but also a stable OS which Xp can be a candidate.
Microsoft has a great advantage, since Java is now backed with a vendor like Oracle now they can open their development platforms and form their community. They are not alone in the playground any more so they need to accept the rules. They must open their standarts and accept other standarts. Windows mobile is in ruins, they must realise thephone fuctionality is priority and the device should be capable besides that (not like the currecnt heavy unstable OS with poor phone fuctionality).
Google is smart and doing great, they are taking Java into another level and building mant tools, services and facilities for people. While doing that they also make everyone believe they are not evil. They also do things for profit but they know how to make indirect profit which microsoft also needs learn.
If not??? well google and apple will take over the world with new tech OSs, computers, cloud computing, sdks, mobile devices.. and Microsoft, well probably people will say they produce nice mouses...
I am not an enemy of Microsoft, I want them to stay alive so their competitors can keep their quality, so this is a open letter, start innovating and generates less direct revenues..

Friday, 26 June 2009

Welcome Galileo!!!

Another June, another release of Eclipse. Finally downloaded Galileo and give a try. Eclipse is doing an amazing job releasing new versions of a great project set every year. Galileo hosts 33 projects with over 23 million lines of code all around the world and had a development cycle of a year. Just look at the release dates below and see how perfect the cycle goes;
2004 – June 28th (Eclipse 3.0)
2005 – June 28th (Eclipse 3.1)
2006 – June 30th (Callisto)
2007 – June 29th (Europa)
2008 – June 25th (Ganymede)
2009 – June 24th (Galileo)

There are many new features and enhanchments but what i really wonder is what will the next releases name since the Galilean moons are exhausted.
Welcome Eclipse Galileo, thanks to all eclipse community!

p.s. Ok I got the tip from Ian Skerrett next release which will be on june 2010 will be named Helios :)

Saturday, 13 June 2009

JavaOne 2009

I am so sad it is finished and need to wait next year. Just after Google I/O as I was organising my notes, Moscone north&south was dressing up for JavaOne. JavaOne is great! Imagine a conferess where Sun, Oracle, IBM and Microsoft can be on stage. It is the united nations of software world developers who left Sun and join rivals such as Google and Adobe have sessions and they still perform the best ones. Just like someone i really respect told me, if you are going to attend one go to JavaOne...
Everything started on monday at CommunityOne where any one can attend sessions for free and listen the footsteps of JavaOne. There are quite nice sessions in CommunityOne too so i really suggest you to attend even not going to JavaOne. Of course the real fun started on June 2, tuesday. As the doors open Chris Melissinos, this years host welcomed us all. Everyone was expecting to hear some news about the Oracle but it was more than that very soon Larry Ellison was on stage declaring his support on Java, community and specially JavaFX! He even asked the team to rewrite OpenOffice with JavaFX. Larry stated the only going to change in Java world would be the funds they are going to inject, and they will never change the structure of Java. If he is honest i think this deal can be a new age for Java.
As the key note ends we started running to our sessions. Here are some favourite topics from this year;
JavaFX, well after Larry's support everyone can be more focused on JavaFX. Actually i am very suprised to see hot the tools got mature. It seems Netbeans getting much better with JavaFX, the photoshop plugins is ready, Authoring tool which seems amazing is on the way. There was even non Sun tools for JavaFX such as JavaFX Builder from Reportmill which is just web start application and works great! JavaFX may not be all complete and very mature but its definitely going great and the progress lately is worth to mention.
Cloud is everywhere, before i went I had heard San Francisco is called the Fog City but what I saw was a city in cloud. Amazon is hiring people for their EC2, Google is promoting the App Engine and they are quite confident. Finally Sun also introduced their own Cloud which looks very promising but sadly it is just really in the clouds now...
The topics for the enterprise world is of course Spring 3, EJB 3.1, Seam, Servlet 3.0 and of course JPA 2.0.
Here are some more in details from the sessions I joined;

Monday June 1: CommunityOne
OpenSSO seems interesting, I will consoder giving a try if I have chance. Peronally I used CXF more than Metro but always knew they offer the best compability with Microsoft. Metro team mentioned the same thing. Actually they accepted they highlighted the compability so much that people only consider them for MS integration, which is a fault i did too. Well they are also shortlisted.
Jersey is very fun to use and very flexible. I was using it to provide services for a mobile project but I had chance to see much more in detail.
JPA 2 makes the API really complete, now you can really use JPA annotations instead of vendor specific ones, glad to see the changes, well done guys.

Tuesday June 2: JavaOne 1st day
JavaOne started as i mentioned, after watching Larry on stage telling us not to worry but i still wonder what will happen to Netbeans and MySql.
(TS-4605) Enterprise JavaBeans™ 3.1 (EJB™ 3.1) Technology Overview
Ok my first session on JavaOne. EJB 3.1 is quite nice move, the new features choosen in a nice way. EJB lite and removal of local interfaces are nice features and they will provide faster development.
(TS-3790) Java™ Servlet 3.0: Empowering Your Web Applications With Async, Extensibility and More
Servlet 3.0 really makes me excited. Biggest change is the async calls which is a great feature. I think servlet days are definitly back.
(TS-5577) Introduction to the JavaFX™ Technology-Based API (Graphics and Animation)
JavaFX doing great progress in tool support, preparing Flash type time based animations. You may say why to use it since there is flash. Ok here the output is pure JavaFx code and offering good integration with existing Java stuff. Even you prefer to continue Flash, it is very nice to have a competitor and a different approach in case you need.
(TS-5225) Spring Framework 3.0: New and Notable
Spring 3 looks very well planned and organised. Annotation support is at the maximum and the framework evolved in such a good way. They had a very nice presentation showing how to build a project with their web framework. Result is fast, easy to code and very clean. Although i prefer using spring just for backing services, what they can provide is much more than that and i will keep that in mind :). They strongly encourage you not to use XML anymore
(TS-4640) A Complete Tour of the JavaServer™ Faces 2.0 Platform
JSF is getting much much better but to be honest it is still boring when compared spring web, gwt or rich clients like flex and javaFx. If you are a fan of JSF you will definitely be happy, if not then this wont convert you to be a fan.
Actually I as registered for 3 BOF sessions but I was invited to JCP party so missed them. The Java Community Process Party was fun too, saw some friends from google, met some guys from europe and of course had JCP wine. I return back to Moscone and attended 1-2 more sessions. Well if you are interested JavaOne offers you sessions even after party hours.

Wednesday June3:
Second day started with the keynote from Sony Ericsson. Well I can't it is very inspiring. They brought a guy on stage to code a twitter app on Sony Ericsson's platform. It was far from being impressive, they claim he is writing the code on stage but we did not see the whole code so doesnt mean that their platform is very easy, I mean what if he is just a genious writing code like no one else can... then what does this demo mean?? we employ such people.. come on Sont find a better idea. Actually we even barely see him coding since his screen was a small picture in picture image in the main screen. So even he was pasting some code probably we wouldn"t notice. Well the second part was even worse, a guy came up to the stage with a brand new phone with a menu (XMB) stolen from Playstation 3 and PSP and they wanted to show us how they connect from phone to ps3 and watch a video. The thing is they couldn't. They couldn't play, even see anything and I can't really imagine they play games on it. The point is they are 30 cm away from ps3 but can not make it work while they are telling us it work somewhere aroung the cith just on mobile data line and they blame so many people using twitter that the network is down. Come on guys you re building a twitter app then balme twitter for second part... So will u stop everyone twitting when u release the phone???
(TS-4514) Building Rich Internet Applications with the JavaFX™ Programming Language
(TS-4069) JavaFX™ Technology in Action: From Design Tool to Desktop, to Mobile Device
Ok JavaFx again, but must admit it is fun and looks great. Mobile device shows were also fun but I hope sun realises if vendors such as Nokia, Ericsson etc does not want JavaFx on their device there is nothing they can do. Again I must mention, tool support getting much much better on JavaFX side. The generated code is not hard to understand and can be easily modified by hand. Using css based declaration instead of xml based declaration of rivals Flex and Silverlight makes the output in less characters and mostly less confusing. However, sometimes the output can become a bit complicated and harder to follow than xml. Oh one more think another tool for JavaFX, JavaFX Studio Plugin from Exadel... worth to try...
(TS-5217) "Effective Java": Still Effective After All These Years
This is a classic, going JavaOne and not attending is a sin. Oh let me tell you one thing when you watch Joshua on stage you feel like standing next to God of Software, although when you see and talk to him face to face you can' t believe how gentle and modest person he is. He clearly shower great examples to follow and not to follow on stage. When you watch him you really feel like you are a beginner getting lessons. End of session he magically disappeared and apperaed in the bookshop. Of course I wouldn' t mind buying a copy of "Effective Java" to get his sign, eventhough i used to have the book and read it many times before. Next year if you will be there please do not miss him!
(TS-5214) Java Persistence API 2.0: What's new?
What is new? all the missing features seem so complete now. I remember how JPA annotations were not enough and we need to use hibernate specific annotations in previous projects. JPA really become a complete abstraction layer at last. Validation, ordered lists, embeddables, and much much better inheritance mapings are some of the new features. Criterias and Examples are a part of JPA now and it also supports optimistic and pessimistic aproaches.
(TS-5418) Building Commercial-Quality Eclipse Plugins: By the Guys Who Wrote the Book
Well actually should be one of the guy who wrote the book since only Dan Rubel was there. This is also one of the best sessions you can ever watch. It was a very detailed session on commands, how to build the menu contribution, how to save your plugins state on exits, perspectives, handlers... As much can fit in the time. It is so hard to not to buy the book after you watch the session which s available at Java Bookstore (of course if you are not lucky enough to get a free on from him). Dan really showed detailed stuff and gave good information about how plugin engine works, I wish he had more time to show more stuff.
(BOF-1304) Google App Engine: Java Technology in the Cloud
Clouding is one the most popular topics, and GAE is a promising one. Actually if you want to use GAE you must accept some limitations; it uses google stardart apis, limited to 30 sec http requests, no serer push, read only file system, no threads, runs on jetty based server but doesn't supprt jetty specific features, no tework connections, no 2d, no native code, restricted reflection, doesn't have a full relational sql database with joins! Sounds scary, no... Actually it is great all those features are what google label as bad, evil and causes poor performance. They offer alternatives for anythong they don't support. First they ask you to design a denormalised database not relying on joins on BigTable. What they ask makes sense, they say they use this in all google projects runs fast and can be used in this way if you change your design perspective. It doesn't have schema or global transitions but it is naturely partioned, hierarchical datastore with full JPA/JDO support. No threads or server push but they have webhooks, so for example you can callback when an email comes. No java 2d but they have an images API. They support guice, spring, aspectj, blaze (which i had some problems), grails, gwt, tapestry, jrucy, jython with a full servlet 2.5 container and this all comes for free as startup and everything is configured out of the box. Give it a try!

Thursday June 4:
Ok I started feeling sad since we pass the half way. Started posting twitter messages like "Can please someone extend JavaOne" but no one cared... Thursday was an important day in the history of JavaOne. It was the day where Microsoft was on stage for the opening keynote. They try to convince us how they work for compability, how they support open platforms.. etc. I hope they are honest, but i really feel like Microsoft started loosing in all fileds. Everyone in the confrence (not only presenters!) use mac books or linux pcs even on Sun terminals which people use to check mails, do registration people choose to run on ubuntu instead of windows 7 (during boot you given chance to choose between ubuntu 8.04 and windows 7). Microsoft is a key player I hope they just don't fade away... It was nice to see dteails of project Stonehenge, whichs is for interoperability between Java and .net.
(TS-4839) Enterprise Integration Patterns in Practice
This session was much more than I expected. It was about Apache Camel and Project Fuji. While Bruce Snyder showed us how to use Apache Camel and reduce Enterprise Integration codes dramatically, Andreas Egloff recreate the same solution on Project Fuji. Both look nice and easy to use. Apache Camel offers very easy and nice way to script and route messages where Fuji offers a web based UI to draw for similar purpose. I just feel like Camel is a bit more stable but i think easier to do wrong stuff since Fuji offers graphical UI.
(TS-5205) Writing Killer JavaServer Faces 2.0 UI Components
I am not a fan of JSF and the progress made in JSF 2.0 is not enough to convert me as a fan. Frankly I will consider either rich clients like Flex or JavaFX, or will just use GWT. However I must admit JSF going great, the new features are well choosen. This session was ok, but most of the examples didn't work but at least we have seen the error messages are more clear.
(TS-4086) Visual JavaFX Techology Based Design with JFX Builder
Go download and give it a try! It is a web start application (actually a full IDE) which lets you build JavaFX just the way you build Flash and it is free. The generated code is not hard to understand and seems portable. I am very suprised to see such a product from a third party. It is one of the very few icons on my desktop!
(TS-4351) Building Facebook and OpenSocial Applications with Java Technology
Interested in how to build apps for social sites? this was a session for you. Differences between facebook and open social containers, types of datas and actions, how to integrate, use services and buils your UI...
Sadly I missed (BOF-4548), (BOF-4870) to attend After Dark Bash Party at Marrion. The band was nice also the food. Met with some friendly Indian guys who offered me a seat and even their drink tickets.
(BOF-4844) Java and JavaFX technology and the Nintendo Wiimote: Just How Much Fun Can You Have
It was worth leaving the party early to join this session. I've always enjoyed watching sessions of Java Evangelists Angela Caicedo and Simon Ritter, this time it was much more than enjoying. First Simon gave some technical details about the setup. It is very interesting to learn Nintendo's wiimote has a horizontal sensor covering more area on right side than left, wonder if this is racisim against lefties :). Actually I tried to work with wiimote using WiiRemoteJ but of course they went much far than me. Ohh by the way this impressive show was a sneak peak of the following days key note; Gosling's Toy Show...

Friday June 5:
Godfather of Java is on the stage, this is the long waited show by might James Gosling. I have seen him several times during JavaOne but still seeing him that close on the stage is great. This was the best keynote in JavaOne, its is both fun and showing good uses of Java (such as health and education).
(TS-4564) Gaming Package for Java Technology on TV: Solving the Gaming Problem
A session about basics of gaming concepts, actually I was expecting more. Seems like either the presenters or the Java is not really prepared for the new age HD TVs.
(TS-5307) Building Next Generation Web Applications with the Spring 3.o Web Stack
First of all SpringSource Tool Suite is free! and you dont need to have a seperate download just start your eclipse and add the update link. Spring is very inspirational and doing great, I can't imagine where would Entreprise Java be today if they weren't existed. Spring 3.o has great improvements and features and will be available soon. The other news is (which I had been using for a long time) BlazeDS integration. Spring accepts and integrates BlazeDS as a core component which makes Spring as the best choice for Java-Flex integration. It was nice to meet Jeremy who is the project lead of Blaze integration, although did not have much time to talk.
(TS-5485) Case Study: Automating Financial Services, Using a Java Technology-Based Enterprise Server Bus, Flex and PDF
A very interesting session showing how Business Process Management would be with Adobe tools. Integration wirh Flex and PDF offers the most impressive UI both for the user and the development process. Well they promise us to send education DVDs, still waiting.
(TS-4644) Move Your Users: Animation Principles for Great User Experiences
This was the best session I watched at JavaOne. Romain Guy of Google and Chet Haase of Adobe (who used to be in swing team and wrote the great book Filthy Rich Clients) made a great show about how to design and animate user interfaces based on the basic animation rules of Walt Disney. The rules, the slides, the examples and how they present it was just great!
(TS-4062) Building Java Technology-Based Web Apps with Google Open-Source Technology
Thats what they call Googley Java. Google doing great with Java and likes to show off how they do it. Want to build a web application? Use Guice, design with GWT, use runAsync methods for performance (how to use? just watch story of the compiler session at Google I/O) and test with webDriver. Great session also showing how MVC should be.

The bookstore was looking so attractive and charming. The ones I bought? ok here is the list;
Effective Java 2nd edition, Bloch (signed :) )
Essential JavaFX, Anderson Anderson
Eclipse Plugins 3rd edition, Clayberg Rubel
iPhone in Action, Allen Appelcline (actually I was looking for another one, but i always like in action series)
GWT in Action, Hanson Tacy (after so much google and GWT stuff so hard not to buy)
Beginning JSF2 and JBoss Seam, Tong (Gift from Apress, Thanks!)
Web 2.0 Architectures (Gift from Duane Nickull from Adobe, Thankss)
Adobe AIR for Javascript Developers (Gift from Adobe)

Well thats the end... at least for this year. After this session I sit around for a long time and didn't want to leave Moscone. Than I realise people carrying boxes, lcds around and instead of carried out I left the place.
Thanks for the magic show Sun, see ya next year...