Wednesday, June 29, 2005

Another JavaOne Trip Report

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.


Greg Murray and I gave a talk on AJAX yesterday. They're tracking the attendance numbers for all technical sessions at JavaOne and as of this morning it was in the top 10! It has probably dropped down a couple of notches by now though... The talk went well and I've only received positive feedback, so I think this is a technology a lot of people are excited about.



A couple of people have already tried the AJAX component library for Creator and have asked where the other AJAX components are. The component library only contains my auto completion textfield so far; the other components written by Greg (Murray), Ed Burns, Roger Kitain etc. have not yet been adapted for Creator - we really should do that ASAP but we've all been too tied up with JavaOne. I'll post something once it's ready. And we desperately need that JSR for component metadata, so we can directly embed designtime metadata in the same files already used to generate component classes!






I had a fun challenge this morning. During the launch of the new Ultra 20 computer, I was challenged to code up an application using our tools as fast as possible. I had roughly an hour. While I was coding away, there was a panel discussion followed by some presentations. I was listening to my own music so I wouldn't get distracted. A couple of times I caught myself tapping with my feet - hope I didn't distract the nearby journalists! My screen was visible though so they could see that I wasn't "cheating" (e.g. just pulling up previously created content). I had planned in advance roughly what to build, but hadn't tried it - after all what fun is a challenge if it isn't actually challenging? However, thanks to this I got to get pretty stressed! My plan was to build a translation web service, by first pulling down a free dictionary word map (English to Spanish and vice versa), then read the words into a map, then build a Creator web app which takes pasted text, splits it into words and calls the web service to generate a translated text segment. Plus various web controls to convert the translation direction etc.



Well, I started out with NetBeans to create the web service. I knew this would be most of the job. I looked at the format of the data file - a perfect job for the new JDK 5.0 Scanner API, so I wrote some methods to parse the data files using it, storing it all in typed Maps (using generics). Ah, what a delight it is to use the new JDK 5.0 features - the code is so much cleaner. By now it was definitely time to deploy the web service - I had used up half of my time already (but I knew I could do the Creator part really quickly). So I hit Deploy, and .... disaster!! I got an error message from the ant file responsible for deploying the web service. What's going on??? And at this point they stopped the
briefing and asked me for status... uh oh... "I have another half hour, right? Right? Phew". I've done a web service before - a couple of weeks ago I did a simple dictionary lookup one (the one shown in the AJAX keynote), so I thought this should work. The only significantly different thing is that I had used JDK 5.0 apis this time - the format of the datafiles, maps etc. couldn't matter - so I decided to cut my losses, not try to debug it and just rip out the generics and rewrite the scanner portion to just do simple String iteration instead (e.g. iterate over the String, look for the first tab, that's the English/Spanish delimiter, then look for the first comma or newline, that's the first translation word, etc.)






Done... ahh....








That strategy worked - another ten minutes I had a working web service, and twenty minutes later I had built a Creator web app with dropdowns for choosing Spanish to English, English to Spanish, and English to Spanish to English. I also modified the output to be HTML for the text such that I could mark up any nonmatched words (which I left untranslated) in a light red background color. When it came time to report what I had done, I opened the browser, cut & pasted Sun's mission statement (from our web site), and translated it from English to Spanish and back to English. With the poor dictionary and complete lack of heuristics, the result was a pretty interesting Mission Statement - one I hope we won't adopt!



I realized right after the demo what the problem with deploying my original web service had been: Even though App Server 8.1 is capable of running JDK 5.0 code, I had started it from Creator (so it was using Creator's VM, JDK 1.4!) instead of NetBeans' (JDK 5.0). Doh!!



By the way, those new Ultra 20's are just fantastic. Deploying my app takes just a couple of seconds! I thought my existing W2100z opteron workstation was fast, but my, I want one of these!



Later this morning I went and attended the vendor panel on JSF components. That was really interesting - I got to see great demos of JSF components. ESRI and SoftwareFX showed components tightly integrated into Creator, which is always a proud moment since I wrote the code which renders their components on the screen :) Otrix showed some really powerful components - but only in the browser, which surprised me a bit since I'm sure they work in Creator (Stephane, Otrix' CEO who gave the talk, has provided a lot of great feedback to us over the last year). Craig McClanahan showed the new Creator builtin components. The Theme Switch feature appeared not to work but what had happened was that there were multiple projects open, and the theme switch was applied to a different project than the one for the current page!



I have a lot more to say about JavaOne, but I'm running out of time - I have some more people to meet this evening, and tomorrow morning I go on vacation! Just for 4-5 days but it's going to be great - I haven't taken much vacation the last 2-3 years and after the Early Access milestones followed by the JavaOne buildup followed by the JavaOne events I'm quite ready for it.



I've met several people at JavaOne who stopped by and said they read my blog and encouraged me to keep it up (a few even said to blog more). I appreciate that. It's very hard to get any kind of reliable statistics on blog readership - the page counts could be almost entirely due to search engine crawlers, and on the other hand RSS news aggregators completely hide the true number of readers. So getting actual thumbs up from people is great encouragement. And now that Creator 2 is out I have a lot of new things to talk about so once I'm back I'll get back into it!


Tuesday, June 28, 2005

Confessions of a Demo Dollie

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.






As promised, here's my "trip report" from my keynote demo yesterday - click on the images to
view larger versions.



Preparations started
on Sunday with an afternoon rehearsal. Here's most of the Creator crew involved - Val Lipman,
me, and from marketing David Folk, Shar Chander, and
Dan Roberts. Keynote demos are serious
marketing vehicles!
The keynote demo was limited to three minutes, and I needed to show both the new Creator 2
highlights as well as the new AJAX work - and fitting that into the time slot required quite
a bit of planning; boiling down everything you need to say into a couple of essential
messages to get across, and ensuring that the demo has broad appeal to the audience.














The rehearsal took several hours. On the left you can see a crane in operation; on the right
is
Chris Webster
and
Charles Beckham
from the Enterprise tool team setting up their machine. My machine is
the one to their left. The machine is one of the new Ultra 20's Sun announced during the
opening keynote. I had played with the system on Friday, installing the demo bits
and testing them out - and wow, I've never seen Creator deploy a project so quickly. So
I was shocked to hear the price - $900! Granted, the system I was demoing on was a higher
configuration, but the technical specs aren't all that different.









Here's Adam Leventhal
from the Solaris kernel group preparing for his DTrace + Java demo.
I got some great tips from him afterwards on how to be able to connect into the Sun
intranet using Solaris 10 on x86, so I'll be checking that out after the show.



This picture also gives you a sense of the size of the stage, and the giant projection screen!











Here's the action backstage. The giant center screen is just amazing - it's huge yet
is also extremely sharp. Notice how the image is reverse - this is where there are giant
projectors sitting on towers projecting onto the screen that the audience is seeing from the other
side. There's also an unbelievable amount of hardware here - computers driving all
kinds of effects, slides, video clips and audio shown on the projector, and all kinds
of other stuff that I don't know anything about. Backstage is generally dark except
from the glow of the monitors (all facing away from the projection screen). Thus it would
be easy to trip on a wire and cause what can only be described as a career limiting move.
However, that's solved by having various "paths" through the jungle carved out by white
tape indicating the routes - including little arrows guiding you out to the stage.








And now it's suddenly Monday morning, and time for the keynote. I needed to check in at
7am. Luckily I have one of the "All Access" passes which can get you anywhere in the
conference. Gets you right past that long lineup outside of Moscone in the morning! However,
they're very hard to get - unless you're crew or part of the keynote you can't get one
because obviously if you're part of the rehearsals you'll hear announcements before they're
ready to be made public.



It's time to get anxious... the picture shows the countdown counter on the stage monitors
that are visible from the stage. 20 minutes to go... time to get some coffee!






The buildup to the keynote is really fun. They play great music and combined with the adrenaline
and excitement it's just a very good feeling. I didn't even realize that this time, it was
a live band -- Magnetic Poetry! I walked up and snapped the picture on the right.








I then ran out and got a coffee -- there's a Peet's Coffee stand outside that had a double shot
latte. Eight packs of sugar and I'm all set! You can see Tim Cramer's back,
Bob Brewin next to me,
and Jeff Jackson's leather jacket!



When the show started, John Gage listed some statistics. They did not exactly make me calmer...
8,000 people in the audience, plus several overflow rooms. A quarter of a million viewers tuned
in to the simultaneous web cast. You can see a recording of the web cast yourself
here.







And finally, the moment is here -- the Creator demo!! I got up on stage, talked a little bit
about Creator 2, showed some of the new rich components I had just mentioned, and then showed
the new AJAX autocompletion component. I'll blog about that separately since people have asked
for more details, so stay tuned.









After the software demos, there was a Happy Birthday to Java segment, since Java is 10 years old
this year. After the band had played they dropped confetti. Seated near the front I was actually
under the confetti being dropped, so it was unreal - confetti raining all around me. I
shot another picture - note how there are large blocks of confetti falling right in front of
the lens!









I'm going to end this photo blog with a picture from New Energy's theater presentation that I
mentioned yesterday. In this picture Neal is describing his Shrek architecture model: layers
and layers and layers!




Monday, June 27, 2005

Live From the Show Floor

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.


Hi there - I'm posting this from one of the SunRay terminals on the show floor at JavaOne in the pavillion. It's been a great show so far. It started with NetBeans day yesterday. The event was packed - in fact hotel staff was getting concerned (and got involved) when they thought we'd exceed the allowed limit (for safety issues). I thought the keynote addresses by Tim Cramer, Jonathan Schwartz and Rick Ross were very good as well. We then broke into individual sessions, and I gave an hour demo of Creator. Since less than half of the audience had seen Creator I did a lot of Creator 1.0 things, such as showing the basic JSF web event driven programming model. I showed some of the new powerful components, such as the table, and the file upload component. I was working up to a REALLY cool demo with the file upload component, but unfortunately I ran into a bug - and couldn't get file upload to work. It turns out that the component doesn't work right when you both have installed the app server in a directory with spaces AND you're using Internet Explorer to do the upload! Unfortunately we didn't discover that that was the problem until the demo was over. All in all though I think the attendees got a feel for what WYSIWYG web development with Creator is like.



This morning I demoed Creator in Jonathan Schwartz' keynote, in Jonny Loiacano's software segment. I started out showing Creator 2, and then showed the new AJAX component. You can find this component library on the Creator Early Access site. I will blog about that demo separately - and I have LOTS of pictures from the show and backstage that I want to share with you. When I get to a place where I can upload my pictures I'll post another entry.



I JUST went to a really fabulous presentation in the pavillion theater by Neal Tisdale from New Energy, and his lead engineer, Dick Wall. They were presenting their experiences using Creator (1.0) on a time crunched project and their experiences. The presentation was really great, especially because it made use of humor. And after a while there was a whole crowd gathered behind the theater listening in.



It's time to head over the the Ask The Experts tables where I'll be fielding Creator questions. Check back tomorrow for event pictures!


Saturday, June 25, 2005

It's Out!!

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.








Creator 2 Early Access is now available. I'll be showing it at NetBeans Day tomorrow and several times during JavaOne this week, so if you're coming to the conference you'll have plenty of chances to see it and find out what we've been up to. The rest of you should download the bits and start reporting bugs, feature requests and anything else we should know about.



I'm taking off in a few minutes to head in to San Francisco and will spend the whole week there for JavaOne. I hope to meet many of you after some of the talks or by the Creator booth in the pavillion -- I don't have booth duty but will stop by several times and observe the action and hopefully strike up interesting conversations as in previous years.



I'm bringing a digital camera so hopefully I can get network access and blog occasionally from the conference!


Friday, June 24, 2005

Positive Creator Review

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.


Check out
this review of Creator in InfoWorld.



The review is covering Creator 1.0. I'll be demoing Creator 2 on Sunday at NetBeans Day - be the first to see it! Sign up here. And of course see all the new cool things coming in NetBeans. I personally cannot wait for the
new GUI builder!


The Rave Room

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.









Part of the Rave room, taken on Marco's cell phone yesterday.


Picture of the Rave room




Roumen, one of the NetBeans engineers in Prague,
blogged
about his trip
to the U.S. For JavaOne, and mentioned that he's heard about the
infamous Rave room here in Menlo Park:


I've heard that there is some special huge office with 12 Creator developers on one place and it's interesting to see how they work together (I cannot imagine how this works, I need relative silence to be able to work efficiently).


Rave was the project name for the tool that eventually was named
Sun Java Studio Creator. When we started out, we had an extremely
aggressive schedule. (Some things never change...)
The project was unlike any I had worked in, or even heard about,
at Sun before. We had a small, very focused team that worked
like a small startup company. The team has since grown, but
we still hold on to some of the core aspects started two and
a half years ago.



The team is too large to fit in the Rave room now. But I still
spend all my office time there. In fact, I'm one of those Sun
engineers who have given up their regular offices. I figured
it was time to do that when I hadn't been in it for over a year!
I come in to the office twice a week, and on the other two
(actually, four :) I work at home.










My corner. Back off! Hey, who took my good chair?


Picture of my corner



When I'm in the office,
I sit in my Corner Office. This is a spot I've had since the
very beginning, so nobody dares to challenge me for it...
In the picture, you can see a Viking guarding my corner,
and the Dukie award I got two years ago for my

demo trouble
.



You may wonder how one can get any work done surrounded by
so many people. The key to that is that most of us
only work there twice a week. Those are days when you
schedule meetings, or work out technical issues on one of
the boards, or just get the pulse of the product and find
out what's going on by talking to people or overhearing
conversations. Of course there have been times when I need
to get some coding done at the last minute for a milestone build.
That's when I wear my noise cancelling head phones and
crank up some suitable coding music to drown out the
background conversations. Those who want peace and quiet
tend to disappear, probably to their offices, or for those
like me without one, to one of the flexible offices.



Having a shared space like this makes it easier to have
a team culture. For example, we have various artifacts
spread throughout the room - such as early marketing
posters, or award trophies and diplomas. There's even
a picture on the wall from the JavaOne 2003 keynote demo
when the product was launched. And, when we get near
a code freeze, we write the number of days left until
code freeze on the door.



Speaking of that, let me go see how many days we
have left...

<voice type="panic" pitch="high" volume="high" >AAAAAAARGH!<voice>


Sunday, June 19, 2005

How to Write a JSF Component

WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.


As JSF is gaining popularity, more JSF components are being written. In fact
TopCoder
is running a competition on writing components. (Sun is a
sponsor.)



However, some of the components written work, but do not work well in tools
like Creator, or do not work well when used in conjunction with CSS. In this
blog entry I will provide some hints that will make sure your components do
not fall in that category.


How to actually write a JSF component is covered in many places; it's
not hard. You need to write 3-4 classes, plus write a .tld file and
a faces-config file with some information about your component.




Here's
a document which takes you through this process.



However, there are some additional Rules You Should Follow when
you write your component.



These rules serve two purposes:


  • They ensure that your component will work right when it is
    sized and positioned using CSS properties.

  • They ensure that your component will work well at designtime
    in a tool like Creator.




Here they are:


  1. First and foremost, you MUST use the
    ResponseWriter's
    startElement,
    endElement and writeAttribute methods. Do NOT
    write out markup by simply streaming out HTML bytes linearly using the
    write method. There is one minor exception to this rule: some components
    need to emit HTML provided by the user, such as the HtmlOutputText
    component when its Escape property is set to false. In this limited
    scenario you should use write.


  2. Always pass in a component reference to the startElement method on the
    ResponseWriter. E.g. if your UIComponent is a PanelGrid,
    and you want to emit <table><tr><td>... you would
    use

    writer.startElement("table", gridpanel);
    writer.startElement("tr", gridpanel);
    writer.startElement("td", gridpanel);




  3. Every component should have a style property, which will render
    to a style attribute on the rendered HTML markup.
    This will allow tools like Creator to position and size the component (using CSS).
    It is vital that you remember to replicate this style attribute on your top level
    rendered HTML tag. However, there are some complications...

    1. In the normal case, you render a single top level HTML element (possibly with
      children) from the JSP tag. In this case, simply duplicate the value of the
      JSP tag's style attribute to the top level HTML tag attribute. For example,
      if you have <h:commandButton style="width: 100px"/> in the
      JSP, you would render <input type="submit" style="width: 100px"/>


    2. If you need to render multiple top level HTML tags, but only one of them is visual,
      duplicate the style attribute on the one visual tag. For example, your component
      may want to render a <script> tag before it renders its one visual
      element, <table>, and then perhaps another non visual element, an
      <input> of type hidden.
      In this case, simply emit the <script>, then emit the
      <table> with the style property value from the JSF component,
      and finally emit the hidden <input>.


    3. If you need to render more than one visual element as siblings at the top level, you
      need to wrap these in a single container component, such as a <span>
      or a <div>. (Use span only if all the children being rendered are
      inline elements.) The style property should be placed only on this outer, wrapping
      <span> or <div>.



  4. Don't throw exceptions from your renderer! Even if for example value is a required
    property, don't throw a configuration exception just because it's null when you're rendering!
    If you really want your component to alert the user to the problem, I suppose it's okay to
    throw an exception when the component is used at runtime, but at designtime, it's quite normal
    for a component not to be correctly configured yet - after all, the user may just have dropped
    the component and is about to configure it. If necessary, you can have code in your renderer which
    checks if the component renderer is being used at designtime:

    if (java.beans.Beans.isDesignTime()) {
    // Designtime - better render error handling here
    ...
    } else {
    // Runtime - throw your exceptions if you must
    ...
    }

    One thing you might consider doing is having the component render exactly the problem message
    to the user. As an example, in Creator, if you drop the Message component, it will
    tell you if it is not bound to anything (since the for property is null, so the
    component is not yet configured.)





Once you have written your component you should package it up such that it can easily be
imported into Creator and used out of the box by your users. That is also covered in
the component library article I linked to earlier.



Please let me know if you develop components that work well with Creator!