Archive for August, 2007

Published by Fabian on 31 Aug 2007

Eclipse Rich Ajax Platform (RAP) – Proof of Concept

Today we concluded our one month evaluation of Eclipse RAP. I try not to disclose anything which I am not allowed to, but really want to share my experience.

RAP is quite a unusual AJAX framework. Actually it was created many years before the term AJAX was invented, but got speed in the recent years. It has a clear focus on web applications, rather than on webpages or sites, and it has one very interesting promise:

A Eclipse RAP application can run as is also in Eclipse RCP.

How can that work? Actually RAP is a reimplementation of SWT and JFace. The two APIs that you use to create standalone Java UIs. It also has a adoptet Eclipse RCP stack which provides a lot of services, including services to create windows and manage them as we know it from a typical IDE and the eclipse typical plugin and extension point concepts.

When you look at the RAP demo it looks a bit boring, it looks like a Eclipse running in a VMware or Citrix. The user experience is also not 100%good, it feels sometimes a bit sluggish. But that exactly is the promise (no that sluggishness not, they want to fix that :-) ). The application shall behave and feel the same as a standalone Eclipse RCP would feel. And that goal is pretty much achieved. The only disturbing thing is, that I as a User Know that I am running in a web browser, so I get fooled a bit. Perception already improves when running the browser in full screen mode, which hides some bars that suggest you that you are running in web. But anyway, this is not a “iPhone-web2.0-gradient-roundcorner webtoolkit”, but targets clearly business use cases (at least for now).

In that context we did evaluate RAP, but with a important difference: We wanted to have the promise the other way around:

A Eclipse RCP application can run as is also in Eclipse RAP.

As we do have a Eclipse based standalone Java client this would be very good. But unfortunately this is not possible, due to some very plausible reasons:

  • You have less control over the “window” your application is running in
  • You have no local file system
  • You have no very fast event loop, which eliminates e.g. MouseMove events
  • You have different memory model.

So what RAP decided to do is to implement a subset of the SWT and JFace API, as well of the Eclipse services. This keeps their original promise, but faces us with a challenge. We have to make our application running on RAP. So thats what we did:

  1. Get a workspace with very latest RAP CVS and load all UI plugins into it
  2. Create a Facade plugin
  3. Change dependencies from org.eclipse.ui.* to org.eclipse.rap.ui.* and add a dependency to the Facade plugin
  4. Compile

the result of this was a miles long error list. that is because of RAP having no empty implementations. What they do not support they do not have in the API. The RCP client we are talking about has all in all about 200k LOC. So that large number was pretty expected. But the first surprises came pretty soon. We discovered that there are large groups of problems which basically are all the same. Here is how the Facade Plugin comes into play:

  1. Locate all occurences of a certain compile error. Lets assume PlatformUI.getHelpSystem() [noSuchMethod]
  2. Create a Facade: PlatformUIHelper with a method getHelpSystem() and move the original code (here a single line into it)
  3. change all occurences to PlatformUIHelper.getHelpSystem() instead

The result is that a) the compile errors “move” to the Facade plugin and b) reduce from n-occurrences to only one.

After doing this for about 3 days, all compile errors were gone from our UI plugins. About 20 Helper and util classes have been created in the facade project. Unfortunately we are still unable to run the Application because there are still compile errors. But there is a simple solution for this. So in 10 Minutes, all compile errors were.. err… resolved…. Okay commented out :)

Everything compiling. Now the trial of fire. What will we see….

….

NullPointerException

:-(

But that was pretty likely. We changed a lot of code form returning something useful to return null.

In an iterative mode we created dummy implementations instead of null’s and passed them back. That was more successful and after a few tries we got to see our UI in a web browser. Powered by RAP. Wow.

We expected to see a lot ugly misplaced objects totally nonfunctional, but were heavily disappointed. It was really astonishing how much really worked out of the box. The UI looked a lot like the RCP one, just a few minor graphical mixups. Perspectives, views, context menus and all that fancy stuff was working.

Looking into details revealed some more issues. Partly our RCP code was using wrong API, and also code existed which was not actually following RCP design patterns. Of course also most stuff were we created dummy implementations for was not working right (but at least no throwing runtime exceptions).

We created a list with about 40 items. Those 40 items need to be resolved in one or the other way for the production version. But bugs we did only find one in RAP. We found some missing functionality and sent some patches (which were pretty fast included, thank you RAP team) and opened a few bugs in Bugzilla. Keeping in mind that RAP is still pre 1.0 release this is even more fascinating.

I never have dreamed that it is so easy to port a Eclipse application to RAP. The whole UI part is really working as promised. It was so good and convincing that people asked in demos about some decorative lines that were not where they should be, but totally forgot that we had absolutely nothing to implement to make the application to run in a web browser.

But of course there is work to do. The whole architecture was only designed to work in a different distributed scenario as it is in web. It could hog onto a desktop PCs memory. now we have to save some memory as the server will be shared. We have to revisit our thread implementations. We have to implement caches and make sure that singletons are changed (on a desktop you don’t care, you are alone in a JVM, on the server you are not and might share data you don’t want) . Still much work to be done. But this always would have been extra to creating a whole UI framework. That we do not need; that is provided by the RAP team.

RAP successfully passed our proof of concept! – Well done RAP! – Looking forward to your 1.0 release!

I am looking forward to our press release when we make the decision final :-)

The bottom line for you, dear reader, if you made it that far, is that you really, really should consider RAP as first choice for doing web&desktop application based on a single sourcecode in java.

Published by Fabian on 26 Aug 2007

lets get … technical – symfony: Propel export and import data

Okay, the intention of this blog was to share also thoughts and tips about software development. So here something I worked with the last two day:

Exporting and importing data with propel as ORM layer.
I read already sometime about problems with exporting and importing data. I can see that the functionality behind that is not that elaborated as it is only a side task. However, I wanted to achieve two things:

  1. test all forms in our web application
  2. save that data as fixtures for future reuse.

Up to now our fixtures were like “hello world” & “dummy 123″ which works for most functionality, but doe snot work for other things, e.g. layout. But there is no good way to generate the data. So I took the hard way, which actually allowed me to user test ALL forms in one go. Normally we had tested them when we created them, but I had to notice that some changes broke some behavior (nothing critical, also a lot of cosmetical things). So I fixed those, and created tons of data. So whats next:

(new sfPropelData())->dumpData(SF_ROOT_DIR . '/data');

Hangs, out of memory, or just stops, with no data generated. The script is very silent, and the code of the 1.0 version not very telling, so I checked the latest version from trac, which had undergone a major overhaul by Fabien.

My initial guess was right, and an added echo in fixOrderingOfForeignKeyData() proved that this was hanging in an endless loop.
Why? because the sfPropelData resolves FK based on tables, not on rows. Which means that between two tables there should be FK’s only in one direction. We had two. An Entity belonged to a Section, and a Section should be also an Entity. This led to that Propel class always changing order of those two tables. Of course a row in Section could reference an Entity that does belong to no, or a different Section and this would not loop, but on table level this is a loop.

I resolved this by removing the FK from Section to Entity and doing the lookup in code myself. After that and a patch I made to the SfPropelData (sent to Fabien and included) it worked great and produced a lot of fixture data. There was still another problem with a null FK, but I also resolved that and sent patch to Fabien (in that case, an Entity not belonging to a section would render following YAML: section_id : Section_ ). Trac issues will follow. I should take all my accounts with me, but I didn’t, so it have to look it up at home.

So the message is: if you have problems with importing and exporting with 1.0.x of symfony and Propel, go ahead and check out the latest trunk version of the propel addon classes.

Published by Fabian on 26 Aug 2007

My first Baseball game

Tonight I watched my first Baseball game (IRL, not on TV). Milwaukee Brewers were at San Francisco Giants. The ballpark in SF is pretty neat. I sat in one of the cheap high seats (called view reserve) but I enjoyed seeing the whole field and the bay and the screen. Pretty good for 26 bucks. Baseball as such is interesting, although it has everything a boring sport needs, it is quite entertaining. From a neutral point of view most of the time one guy trys to throw a ball to his mate, but one with a bat stands inbetween and tries to hit. Sometimes that guy hits and then one of the guys that just stand around jumps and catches it. Then teams swap positions.

Tonights game was not that action packed. I hoped for a Barry Bonds homerun, but was disappointed. He was swapped even end of 6th inning. Once the pitcher avoided him and pitched 4 balls, so he could walk to first base. For those not deep into baseball strategies. This is called a Intentional base on balls, which might be a valid strategy, but I really would have liked to see another Bonds homerun.

Giants won 6-2, which was basically decided after the first inning where they could run 4 players home.

What I really disliked was the 30$ ripp-off for parking on a improvised parking lot. I decided to turn around and drove 3 blocks where I parked for free in a street.

Have a good night or day

Published by Fabian on 23 Aug 2007

Officially more in plane than home

Your current status: Frequent Traveller
Status validity until: February 2010

Silvercard will arrive soon. Besides that a more or less boring day with meaningless meetings :) I used the time to refactor some spaghetti code I wrote in php. Uh how could I ever write something like that. I spent now 6 hours on this. Now its quite okay. The code evolved to have ifs for about 8 cases, which are now narrowed down to 2 :)

Published by Fabian on 22 Aug 2007

Flying Business :-)

Boy, what a travel. Filled with tons of strange and nice things. Something to remember.
My employer is generous, we get Economy flight tickets but first class train tickets.
So I started this morning my trip from Düsseldorf to Frankfurt. I was standing in Section E of the train station waiting for the fast train.
Then the announcement: The train coaches are reversed today. First class coaches in A & B.
Among some other people I started my walk down the platform. Just to see that when the train arrived the first class coaches rushed past me.
Okay turn around and try to get as much train walking done outside on the platform. Inside it is always bumping into seats and people with your luggage.
Finally at Frankfurt airport I checked the Lost&Found for my book. Lufthansa had mailed me that the FraPort lost and found office handles all items.
Well that was not exactly right :) So they directed me to Lufthansa Lost and Found. Okay I lost the book, but nobody found it so far. So I claim it officially as lost.
I checked in my luggage, surprisingly no queue at check-in. I made my way down passed security and was just in time for preboarding.
A really long line and a very short one. Last time I flew (that flight always departs from A65 at Frankfurt) they had three lines.
I wonder what they tell the people, I never have been there in time to hear it. But the basic principle of the three lines is: the leftmost will check if you have “API OK” on your boarding card. Which means that the Advance Passenger Information is OK.
If its not you are redirected to line 2 or 3. Line 3 ends at a desk, you cannot board from there. It seems that there the codeshare airlines do their API collection.
Afterwards people get redirected to the first line. The second line is collecting the API for Lufthansa.
An odd setup and it seems that it is more wasting time of all people than being efficient.
As the Lufthansa API line was 5 people long, and the first check line about a hundred, I just stood in that line. The lady saw the API OK printing on my boardingpass and said
“have a nice flight”, and I could go in. The worst thing that can happen to you there is that you go in the first line, are redirected to the third, and from there back to the first.
I prefer sitting and reading newspaper in that time.
I was already a bit annoyed, as there were at least 3 babies around which were constantly crying. Boarding call. ah.
“We are Bording Economy… by seat numbers.. calling by… First and Business every time… Families with children can board ahead”
80% of the people jump up and rush to the plane. Okay, I can wait. of course, no rows were called. Before I boarded I was asked a few questions by a typical interviewer-student.
But she was nice and I had anyway only time to waste, so I answered here alll questions. She said quickly, so thats what I did, quite a rush :)
I sat down in row 51, seat H. A fact that will become important very soon. A lady is sitting at 51 K, window seat. Then two people arrive.
One has 51 J, but the other has: 51 K. No you are on my seat blaming, they both had seat 51 K. So the guy went to the flight attended to get this clarified.
I was joking to him: “I can go for you to business if you want to sit with your friend” The issue got clarified. The lady was seated accidentally there she should be seated somewhere else.
The guy took the window seat. Then another man popped up. He had also a seat that was taken: 51 H, he had my seat. He was worried if he would get this flight, as he was rebooked only yesterday to Lufthansa because American had to cancel a flight.
The FA got called back: “Who is Fabian Lange?” “Me” “You are the lucky one: 25G”
Thats right, here the reason for the title of this post. I was upgraded to business class. It is as if you enter a totally different world.
14 people sitting on room that is taken by 30-40 people in economy. A very great meal with great red wine. The seat was great, 4 buttons to change it position + massage feature. You can ly nearly flat.
However the buttons never really did what I wanted to, but I never sat so comfortable and could sleep so good in a plane.
Only a small minus: my seating neighbor was snoring like a pigeon. I never ever heard somebody making sounds like that. It was not really annoying, but so strange, that it woke me up some times.
It seems that my Thinkpad T43 consumes too much power. I tried both power outlets on the seat and neither was making my battery charge.
As Fortuna wanted, the In Flight Entertainment system in Economy was not working during the flight. But in Business everybody has his/her own one, so that worked fine. Entering US was surprisingly easy this time, perhaps because I was here last week.
Getting my bagging was more complicated, took nearly an hour to get it. Kind of slow, isn’t it?
I am only physically present in the meetings this afternoon, hope I survive the first night :)
See ya

Published by Fabian on 20 Aug 2007

San Jose Part 2 and Amersfoort

Tomorrow morning I will start my second 2 week trip to San Jose again. With that trip I qualified for Frequent Traveller Silver card from Miles and More. So now I am officially more in a plane than home? Food seems to be better on Lufthansa for FRA-SFO, but on the way back I’ll see if I can get ATC radio on the United Flights. I read that you can get them on channel 9.

After I come home, there will be the next event for me. Ill participate on the Symfony Camp. I’ll go there with my friend Carsten, so that we can enhance our symfony knowledge and meet other symfony folks.

Any special wishes for my IT tour? I try now to complete that wikipedia list and find even some others.

Ready for take of, see you in another timezone.

Next »