Skip to main content

gsporar's Blog

New Address

Posted by gsporar on June 24, 2008 at 2:40 PM PDT

How many weblogs does one person need? Blogging at java.net has been great, but I am moving my blogging activity. Check out this post for more info. and please update your RSS readers. Thanks.

Comments

Hello Mr. Sporar, I am a sutdent at CIU(Cyprus International University). I have a term project on java.In this project, the users should connect GPRS by their phone. And they can do their applications. The project is about Smart House simulation. They can turn the lights on or off. After a little search on the internet I saw your tutorial about Netbeans Mobility. The title of this is "Visual Mobile Designer and Web Services in NetBeans IDE 6.0" .I download the NetBeans I implement the what you show but I faced a problem "WSDL". I dont know anything about WSDL or XML (I know something but not enough). In the beginning of this project , I created a database and I implement a JFrame application on Eclipse that connects to database and retreiving data from my localhost. It successfully works.. But I could not find a solution for mobile system. I have to use java for this project. Now, Would you like help me about this subject??? And would you like to send me that wsdl file for an example?? And one more question... I can retreive data by this mobile system from mysql database??? And send also..... Thank you for wasting time for me.. Thanks & Regards, Tansu USLU..

Hi Gregg, I am new to CVS & Net Beans. I have set up CVSNT and we are going to use Net Beans only for development work. I am facing some problem in importing the existing code into CVS repository. Whenever I try to import the directory structure into the repository, I notice that empty direectories are not getting imported. Can you please provide me some help in this regard? Thanks & Regards, Gaurav E-mail: messagegc@gmail.com

JavaOne 2008 Recap: Houston

Posted by gsporar on May 28, 2008 at 8:54 PM PDT

Jim Bethancourt
, president of the Houston Java Users Group (HJUG) invited
me to sit on a panel at their May meeting to discuss JavaOne 2008.

It was a good dicussion.
The other panelists were James Velasco, Steven Reynolds, and Dan Sline.
Dan started things off with a discussion of some proposed changes:
closures, annotations for fields, etc.

I then did some demos. I did the BTrace,
GChisto,
and
VisualVM
demos that Jarda and I did during our technical session. The
coolest demo I did, though, was Ken Russell's applet plugin demo. I
dragged an applet out of the browser onto the desktop, closed the browser,
and the applet kept running.

After that, Steven took over and talked about some of his favorite sessions,
which included Gavin King's
session on Web Beans and Mikael Grev's
session on the MiG layout manager.

James wrapped things up with a neat approach: a JavaOne "index" that
showed which trends were on their way up, and which were on their way down.
Among those on the way up: NetBeans and
JavaFX. Among those on their
way down: SOAP-based web services.

Slides from the presenters are available here. A photo of the speakers
is below. James and Dan are in front, that's Steven and me in the back row.



DSCN4111.JPG

TS-6000 : Improving Application Performance with Monitoring and Profiling Tools

Posted by gsporar on May 28, 2008 at 2:30 PM PDT

Last year I made a change that I really enjoyed: I did not
blog during JavaOne. The event alone is enough of an exercise
in endurance, so I decided to drop the blogging in favor
of additional sleep. :-)

I did a
technical session
this year with Jaroslav Bachorík (who sometimes blogs
here). Our goal was
to do an overview of some of the tools available for tracking down
performance and memory problems in Java applications. So the talk was
broad, not deep - we covered 12 different tools and did demos of 3
of those.

It seemed to be well received, based on initial reviews. The room holds
about 800 and was packed,
so we did the session a second time late on Friday afternoon (not as large
a crowd the second time, of course).

The slides are available
here.
There are several links to online resources, which I have reproduced
below.



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

Posted by gsporar on April 27, 2008 at 7:02 PM PDT

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


Comments

Hello Greg, how are you? I met you in Sun stand at fisl9.0 and asked more info around PermGen problems, etc. I found your article "Brain Drain in Your Java Apps" in http://stpmag.com/issues/stp-2007-04.pdf, but could not found the other one... is it called "It's not just the younger generation"? Do you have a link?
Thank you very much,
Bruno Ghisi

Thank you very much for your visit to CEJGU :) The side-effect of your demos and tips continues to propagate in our mailing lists.

Hey Greg, thank you very much! I did not noticed that was an issue next.
Thanks!
Bruno Ghisi

Hello Felipe - it was great visiting Fortaleza!

Hello Bruno - if you download the May 2007 issue: http://stpmag.com/issues/stp-2007-05.pdf, you will find that article on page 26.

- Gregg

Return to Big D

Posted by gsporar on March 14, 2008 at 5:06 PM PDT

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.

Comments

Hi Greg, please, let me get you email . I think I got I bug on netbeans! Please. do not ask me to submit a bug at bugzila cause it's my first time using netbeans, so I'm not comfortable doing that. bye.

Is That Shortcut in Use?

Posted by gsporar on March 9, 2008 at 5:20 PM PDT

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

Comments

you mean Netbeans doesn't fully support that yet? JBuilder had it way back around the year 2000...

I mean, shortcut search feature ...

it seems clear the shortcut feature is a next feature this popup should contain ;)

Try this module to explore the shortcut to action bindings - forward and reverse.

Are Applets Back?

Posted by gsporar on March 9, 2008 at 5:08 PM PDT

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.)

Comments

All we're doing is applying the existing applet security model in the context of JNLP. Applets can pull code from multiple web servers. Each piece of code is granted the permission to connect back to the host from which it came. This has been true for years. If you have multiple pieces of untrusted code from different origins on the stack, according to the Java 2 Security Model, the intersection of their permissions is the empty set and they don't receive permission to explicitly open for example a socket connection to any server.

Definitely a big step forward. The next big step missing from both applets and Webstart is improving handling of signed and unsigned applications. I still find that the vast majority of applications in the wild request unlimited permissions for tasks that really shouldn't require it. Can this be improved?

Interesting that you should point out that applets have new life with the latest plug-in. Personally, I'm a believer...but I think the battle is uphill from here. The perceptions that applets are difficult, slow, unresponsive, too heavy, etc, etc are still alive and well -- despite the reality.

In a recent blog, I point out just such a perception problem that I recently faced. Thanks for getting the word out on another great reason to keep working with Java applets.

One improvement we're in the process of making is removing artificial restrictions in the JNLP spec that limit what unsigned applications can do -- for example, pull in extensions from other web servers. These improvements have already been made in the Java Plug-In. Hopefully this should reduce the need to sign at least some applications and applets.

In terms of finer-grained requesting of security privileges, this is a known area that needs work. I believe there are already RFEs against the JNLP spec to expand the "security" tag. Note that with the JNLP services an unsigned application can get finer-grained access to individual files, persistence, etc. With the new JNLP support in the Java Plug-In (present in 6u10 build 13, documentation coming soon) applets can access JNLP services as well.

One improvement we're in the process of making is removing artificial restrictions in the JNLP spec that limit what unsigned applications can do -- for example, pull in extensions from other web servers. These improvements have already been made in the Java Plug-In.

Whoa! Are you saying that an applet can connect to other hosts without permission? Bad, real bad.

Please let's hear more about this.

NetBeans on OpenSolaris

Posted by gsporar on February 27, 2008 at 6:32 PM PST

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 5, 2008 at 3:44 PM PST

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." :-)

Comments

Believe it or not, in my opinion this is one of the most important features of NetBeans. Actually it's one of the reasons why I'm using NetBeans, since it allows very fast code completion with this feature. Since it's not very smart, you can use it anywhere such as comments or plaintext files.

Hi Gregg, as an aside, for a given key combination, how can I found out what it does? In emacs, one does Ctrl-h k for help on any key combination. What's the analog in NetBeans?

Related, is there any way to get a listing of what all non-obvious keys do (where "obvious" would be e.g. that typing "a" inserts "a"). I have the NetBeans 6.0 Keyboard Shortcuts & Code Templates, but it's organized by function, and I'd like a lexicographic listing.

TIA, Dave

Hi Felipe!

Thanks for the comment - NetBeans IDE has had for a while now support for keybindings from other tools, specifically emacs and Eclipse. Just go to Tools > Options > Keymap and select the Profile you want.

FYI, there are some bugs in the Eclipse profile, but the fix will be in the M2 milestone build of NetBeans IDE 6.1.

HTH,
Gregg

Hi Gregg,

I don't know if it is possible, but NetBeans team can reuse the same shortcuts used by Eclipse to the migration or at least shared use of NetBeans by Eclipse users - the majority of all IDE user in the Java world.

Nothing to do with quality or comparison, just a chance to a more comfortable migration from one platform to another. Other brilliant feature would be to give the user a chance to select which set of shortcuts he want to use (Eclipse, NetBeans, IntelliJ, etc..)

cheers......

davenull -

It took me a while, but I have finally written a blog entry that answers your first question.

For your second question, you might want to try this plugin from Sandip Chitale.

HTH, Gregg

More Ruby Tuesdays

Posted by gsporar on January 30, 2008 at 3:02 PM PST

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.