The Source for Java Technology Collaboration
User: Password:



Gregg Sporar's Blog

Gregg Sporar Gregg Sporar has been a software developer for over twenty years, working on projects ranging from control software for a burglar alarm to 3D graphical user interfaces. He has been using Java since 1998 and his interests include user interfaces, development tools, and performance profiling. He works for Sun Microsystems as a Technical Evangelist on the NetBeans project.



If it's Tuesday, this must be Brasília

Posted by gsporar on April 27, 2008 at 07:02 PM | Permalink | Comments (4)

The ninth annual FISL conference was April 17-19 in the city of Porto Alegre, which is the capital city of the Brazilian state of Rio Grande do Sul. I was fortunate enough to have my memory leaks talk selected, so I asked my co-worker Bruno Souza if he could set up some user group meetings and/or university visits in the days immediately before the conference.

This is sort of like asking if it would be possible to get another slice of grilled meat at a churrascaria; his answer was: "Of course!" :-)

In Brazil, everyone who knows Java knows Bruno - and even people who don't know Java know Bruno, including the president, as shown in this photo.

So Bruno said to me: "How busy do you want to be?" I responded: "Very." I'll think twice before I say that to him again.... :-D

I did presentations for the following Java users groups: SouJava, Java Noroeste, Java do Sertão, and ceJug. And I did a presentation at Universidade Católica de Brasília. The end result: within my first few days in the country, I traveled almost as many miles within Brazil as I had flown to get to Brazil.

But it was worth it. The food was excellent, the events were well-attended, and the best part (as usual) was getting to meet so many nice people. I was very well cared for in Brazil.

One of my goals was to show folks some of the new features coming in NetBeans IDE 6.1 (which is due out this week). One of the most important new features is powerful support for JavaScript. The support is built on what was put into the 6.0 release to support Ruby. As a result, powerful code-completion is included.

Now I'm not a JavaScript guru and have only played around with it a bit. Luckily, my co-worker Brian Leonard put together a very nice demo script that highlights the most important features. So I had been using that and had even managed to impress some hardcore JavaScript users with the editor's features at the first couple of events.

In Sertão, however, the code completion support did not work. Anyone who does as many live software demos as I do has been in this situation before - all the sudden, everything that worked great just moments before stops working:

noworkjs.png

I was stumped. Since it was the end of the final presentation of a long day, I went ahead and kept going and wrapped up my presentation without continuing that demo.

Immediately after I finished, one of the attendees rushed up to me and asked: "How can the editor provide JavaScript support outside of a <script> tag?" That's when it hit me like a ton of bricks: "Doh! I was adding JavaScript code into an .html file without a <script> tag. No wonder the editor did not work!"

So this is one of the few instances where one of my demos failed because of the presenter, instead of the software. In my defense, over the previous 80 hours I had only had about 12 hours of sleep, so I was a little off-balance. Nevertheless, the question made me realize what I was doing wrong, so I did the demo for a small group of folks who crowded around my laptop; the first feature of which is to show one of the flavors of code completion:

worksjs.png

Photos from the Java Noroeste, Java do Sertão, and ceJug events are below.

WeAll.png

daniel.png

fortaleza.png



Return to Big D

Posted by gsporar on March 14, 2008 at 05:06 PM | Permalink | Comments (1)

In March 2007 the nice folks at the Java Metroplex Users Group (MUG) in Dallas let me speak to them about NetBeans.

They had noticed that I had talked about memory leaks to the Houston Java Users Group back in October and they asked me to do the same presentation for them.

So I drove up on March 12 and it was a great time. I got to chat briefly with Pete Carapetyan, who I had met last year; Pete has his own review of my presentation here. We had a good crowd: over 50 people. The slides are available here.

There were several really interesting comments and questions. One attendee commented on how the problem I demonstrated with a PermGen memory leak would not have happened if the application had not been repeatedly undeployed and redeployed to the web server. While that is certainly true, it led another attendee to comment: "Once I give them the .war file, I have no control over what they do with it." In other words, in an ideal world applications do not get repeatedly undeployed and redeployed, but in the real world things do not always work out that way....

There was also a question about cyclic object references. The Heap Walker in the NetBeans IDE provides annotations to indicate just those sorts of relationships. Cyclic references are shown with two green arrows that form a circle:

loop.png

My thanks to Lisa Danzer for coordinating my visit to Dallas and (as always) to Aaron Houston for sending some books and t-shirts that we could use as prizes.

And many thanks to Erik Weibust of the MUG for inviting me up and running the meeting. I did not get to meet Erik last year because he was unable to attend that meeting. Turns out he is a great guy and for those of you in the area, he is one of the organizers of an interesting one-day conference: Dallas TechFest. It is on May 3 and the price cannot be beat: free!

I would consider driving up to attend, but I will be in California that day getting ready for NetBeans Day at JavaOne.



Is That Shortcut in Use?

Posted by gsporar on March 09, 2008 at 05:20 PM | Permalink | Comments (4)

How can I find out whether a particular keyboard shortcut is assigned to an action in the NetBeans IDE? That question was posted by davenull in a comment on my blog entry last month about Hippie Completion.

I will admit up front: the answer I provider here is a hack. As Brian Leonard points out in this IssueZilla entry, the IDE should have better support for this feature.

Let's say you are wondering whether or not Ctrl+Shift+Period is assigned to an action. Select Tools > Options > Keymap. You will see a list of the types of actions:


k1.png

In order to find out whether Ctrl+Shift+Period is assigned, you need to attempt to assign it to an action. The easiest way to do this is to try to assign it to an action that does not currently have a keystroke assigned.

Expand the entry for Help and select the entry for About and click the Add button:


k2.png

That brings up the Assign Shortcut dialog, where you can type in Ctrl+Shift+Period. If the keystroke combination you type in is already in use, the IDE will tell you to which action it is assigned. In my installation, that keystroke combination is already assigned:


k3.png

Are Applets Back?

Posted by gsporar on March 09, 2008 at 05:08 PM | Permalink | Comments (5)

As I described back in December, Sun ordinarily sponsors the annual holiday party of the Austin Java Users Group (AJUG). This is something that Albert Leigh and I help coordinate. When the opportunity to sponsor an additional AJUG meeting in February became available, we jumped at the chance to bring Ken Russell to town. This blog entry is my belated report on the end result. Special thanks to Samuel Terry of Sun's Field Marketing office for providing the funding and to Aaron Houston for the swag that we used as prizes.

Ken is the architect of the next-generation Java Plug-in and the project lead for JOGL, the Java binding to OpenGL.

Ken started his presentation with a couple of quotes, one from Ben Galbraith and another from the Java Posse, both of which can be summed up as: "Applets really suck." He then talked about the many reasons why, with a focus on problems in the Java browser plug-in.

In Ken's view, the newly rewritten Java browser plug-in changes everything. The problems with browsers hanging and crashing are gone. In addition, the deployment model for applets will be the same as for Web Start and the integration with JavaScript has improved. More details are in Ken's presentation slides, but just reading through them will not provide you with Ken's enthusiasm or the cool demos that he did.

The new browser plug-in is part of JDK 6 Update 10, which has also been referred to as the "Consumer JRE." It is also known as JDK 6 Update N, because originally they were not sure what update number to assign to it.

It all seemed to strike a chord with the audience - there were many questions. Rob Ratcliffe, one of the AJUG board members, wrote this in his recap email:

Ken gave a great talk on the new capabilities of the redesigned Java Plug-in. I'm excited that there may be a rebirth of embedded rich swing-based applications over the slightly unwieldy mix of DHTML, Javascript, Ajax, etc.. (Although, it appears that applets and Javascript will play well together in the new plug-in.)



NetBeans on OpenSolaris

Posted by gsporar on February 27, 2008 at 06:32 PM | Permalink | Comments (0)

A while back I wrote a blog entry about how I have been primarily using Ubuntu.

Meanwhile, the OpenSolaris folks continue to make progress on creating a desktop-friendly version of Solaris. I recently got a nice new Sony laptop, so after I got Windows Vista and Ubuntu working on it I decided to try installing OpenSolaris.

Unfortunately, it would not install. I think the problem is this bug, but I am not certain. I tried the work around described in the bug, but it did not work for me. Bottom line was that even after getting considerable help from some very nice OpenSolaris gurus, I could not get the install to work with the partition that I had set aside on the laptop's hard disk.

I thought I was out of luck, and then came the announcement that Sun is planning to acquire Innotek (the deal has since been finalized). I had looked at VirtualBox briefly several months ago but I did not have an immediate need for it, so I had never installed it.

Once the announcement came out, several people started experimenting with it and blogging about it. So I tried it and it worked - I am typing this blog entry into an .html file using NetBeans IDE 6.0.1, running on OpenSolaris Developer Preview 2 (herein after referred to as OSDP2), which is running in a VirtualBox VM on Windows Vista.

Click the screen snapshot for a full-size version and you will see that NetBeans looks the same as it does on any other GNOME desktop (I do not know if OpenSolaris offers KDE or not...):

vbThm.png

There were some rocks in the road. Read on for the full details....

I am using VirtualBox version 1.5.6. The first problem that I ran into was that OSDP2 would not install onto a fixed size VirtualBox virtual drive. I think that is because of a known issue in VirtualBox version 1.5.4, which is what I was using initially. The workaround is simple: I installed onto a dynamic virtual drive instead.

There were two significant problems after I installed: no network access and I could not set the video resolution of OSDP2 to anything higher than 1024x768. Alan Burlison has the solution for both problems in this blog entry. Note that by default, OSDP2 does not have an xorg.conf file - it does automatic configuration. So if you want to use the xorg.conf file that Alan provides, you will not be overwriting an existing xorg.conf - you will instead just be placing the file into /etc/X11.

Also note that in order to get the instruction that Alan provides for running the VBoxManage command to work, I had to not only shutdown the guest VM, but also the VirtualBox user interface itself.

Now comes the big question: Can I use this as my every day environment? I don't think so - not yet, anyway. The lag time as I type is very noticeable and using the mouse can be a bit frustrating. I am hoping those are just video/mouse driver problems. VirtualBox has guest operating system "Guest Additions" that help solve some of these issues. Unfortunately, there are no "Guest Additions" available for Solaris yet. Hopefully that will soon change.

In the meantime, it is good enough that I can use it to experiment with things such as the NetBeans DTrace plugin. :-)



Hidden Hippie

Posted by gsporar on February 05, 2008 at 03:44 PM | Permalink | Comments (5)

This has been written about before - Tor Norbye wrote a blog entry on this topic, as did Charles Ditzel. It is mentioned in a tutorial by Randahl Fink Isaksen, and perhaps in other spots. With more and more folks trying out the NetBeans IDE, however, I continue to see this discussed out on the nbusers email list so it is worth repeating because this feature is one of those that almost seems hidden - even though it is listed on the IDE's top level Source menu.

Tor pointed out that the name "hippie completion" originated with the feature in XEmacs. Wherever the name came from, the concept is simple: in response to a control key combination, the editor fills in the nearest matching string. So for example, using NetBeans 6.0, on line 21 of this source file:

h1c.png

I have typed in myBi as the parameter to System.out.println(). If I then press Ctrl-K the editor will search backwards through the edit window for the nearest match and will then fill in the rest of the string for me:

h2c.png

Note that the match is done without any sort of context knowledge. That is an important point because it means that hippie completion is not smart, at least not in comparison to a standard code completion feature. The upside though is that it is faster than code completion.

If I had instead pressed Ctrl-Shift-K then the editor would have searched forward in the edit window and would have wrapped around to the beginning of the file and continued searching until it found myBig:

h3c.png

Some things to note:

  • Press Ctrl-K (or Ctrl-Shift-K) repeatedly to have the editor suggest other strings that match.

  • You don't have to type anything before invoking the feature - if you do not give it anything to match then the editor will just suggest the string that is closest to the cursor position.

  • As mentioned, when it does its search the editor wraps around when it reaches the end of the file. It also wraps when it reaches the beginning. As a result, I always just use Ctrl-K, even when I want to insert a string that is further down in the file from where I am currently editing.

  • The editor searches all open editor windows for a match, not just the window for the file that currently has focus.

  • NetBeans has had this feature for years and years and prior to version 6.0 the keybindings were Ctrl-K to search backward and Ctrl-L to search forward. The addition of so many new features in NetBeans 6.0 required modifying the default keymap and the default forward search keybinding got changed from Ctrl-L to Ctrl-Shift-K.

  • The official names for these features are "Insert Previous Matching Word" (Ctrl-K) and "Insert Next Matching Word" (Ctrl-Shift-K). But I prefer to use the term "Hidden Hippie." :-)



More Ruby Tuesdays

Posted by gsporar on January 30, 2008 at 03:02 PM | Permalink | Comments (0)

Since my last blog entry on this topic, I have done two additional talks to Ruby developers. On January 9th I spoke to the Atlanta Ruby Users Group and on January 15th I did a presentation for the Austin on Rails group. The Austin on Rails meeting got mentioned in an article in the local newspaper. If you look closely at the third photo, you can see the NetBeans IDE on the screen. :-)

As always, there were many questions. Some I could answer, some I could not. For those that I could not answer, I did some asking around and Tor Norbye and Martin Krauskopf were kind enough to fill in the blanks for me.

Some of the highlights:

  • What is the business model here? In other words, how is Sun going to make money on Ruby/Ruby on Rails development tools?
    We have a saying around here: "Volume drives value." Which means, in part, get the developer's attention up front and the money will come later. Specifically, at deployment time. I spoke with a number of attendees in Atlanta who are very interested in deploying Rails applications to GlassFish. And if they want a support contract on that runtime, Sun can provide that.

  • What is the story on the lengthy scan times at startup?
    When the IDE creates a project it scans the source files and the libraries you have installed and caches some information. On a restart it will do a quick scan of your source to make sure the cache is still valid. But there are some problems in this area. I cannot reproduce the behavior under Windows or Linux, but others can. There is an IssueZilla (IZ) entry; see also this entry. And finally, some recent comments from Tor are worth reading.

  • Is there support for HAML/SASS?
    Yes, but the last time I checked, it only works with NetBeans 6.0 - it does not work with development builds of NetBeans 6.1. More information here.

  • Turning off the "Show Logical Project View" option is helpful, but not quite good enough because even with that option off, the vendor subdirectory of a Rails project is still not shown in the Projects window. Is there any plan to change that?
    As of December 7, in the 6.1 development builds the vendor subdirectory is shown in the Projects window.

  • On large projects the code completion list is overwhelming - there is just too much stuff that shows up in the list. Is there any way to control this?
    The response I got from Tor was:

    The typical strategy for that is to type more before asking for completion. Don't try completion on empty context, or just one character. You do that when you really don't know what you're looking for - and in that case completion should probably show you what it knows about so you can go hunting.

    But if you type 3-4 chars it's no longer that long is it?

    Something I've been thinking of doing is to truncate searches at 50 matches. If there are more than 50 matches I will abort the search and insert a magic (unselectable) item in the completion list saying "Too many matches, result truncated." or something to that effect. That should make completion snappier and probably won't affect people too much since nobody really scrolls through 800 items looking for something anyway, you keep typing until what you're looking for shows up in the visible list.

    On a somewhat related note, there has recently been a discussion about this on one of the NetBeans Ruby email lists.

  • If the vendor subdirectory for a project contains the Rails source then it gets indexed and that slows things down - is there any plan to fix this?
    Yes, that is fixed in the development builds, as Tor wrote: "... in 6.1 I've decoupled things a bit so that [the vendor subdirectory] is now shown in the projects view etc. but is still indexed differently than user sources."

  • How does the IDE actually start the debugger?
    This is what I got from Martin:

    Instead of rdebug (standard Fast debugger for Ruby) we start rdebug-ide which is part of debug-commons project on RubyForge.

    [The] rdebug-ide script is executed with a another ruby script (debuggee) as a parameter. Currently only use case since rails is just another Ruby script.

    The rdebug-ide, in short:

    - starts the server to which a frontend connects and communicates through it
    - registers debug event hook in Ruby runtime
    - loads the debuggee (after 'start' command is received from the frontend)

    As events are happening they are sent through socket to the frontend and at the same time server is listening to the frontend (for commands like 'add breakpoint', 'do step', ...).

  • Is there any way to get to a Ruby debug console while using the debugger?
    Currently, no. But Martin is aware of this request; there is an IZ entry for it.


April 2008
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      


Search this blog:
  

Categories
JavaOne
Archives

April 2008
March 2008
February 2008
January 2008
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005

Recent Entries

If it's Tuesday, this must be Brasília

Return to Big D

Is That Shortcut in Use?



Powered by
Movable Type 3.01D


 Feed java.net RSS Feeds