Wednesday Feb 06, 2008

NetBeans tooling for Eclipse developers?

Who would have thought that NetBeans will be building tooling for the Eclipse developer community? Runtime tooling that is. I'll explain shortly. The two communities have been engaged in a healthy competition for the hearts and minds of developers at large, however the focus has been the "design time". One could consider one of the new NetBeans projects as a play for a much broader audience, including developers that are still using Vi/Emacs for their development and are not currently using an IDE.
 

[Read More]

Wednesday Nov 14, 2007

A thread dump worth a 1000 bug reports

The old proverb: "a picture is worth a thousand words", has an interesting mapping in the world of programming. On the Java platform one has a few facilities that enable a developer to get a stack trace that can point to the cause of a UI freeze, slow down in an application performance, etc. A thread dump can save a developer a lot of time in troubleshooting tough problems. In the old days one could start the application and a terminal and call CTRL + Break on the Windows platform or kill -QUIT pid on the Unix platform. Of course if one has access to the sources you can force the application to show you the call stack by doing something "un-natural" such as Thread.getCurrentThread().dumpStack(). Keep in mind that this will crash you application, so don't do it on production code. This wiki entry has more details on how to, gently :-), get a Thread dump.

In a recent conversation with Tor I learned some more details. For instance, on the Windows platform, using Java 6 one could employ the jps -ln command to get the process id of Java application and then use the jstack command on that process id (jstack pid) to get a thread dump. Nice documentation can be found here.

If you really in the mood to experiment, take a look at the Visual VM project that was just launched on java.net. You'll find a cool tool, based on the NetBeans platform, that helps monitor and profile Java applications. It only runs on top on Java 6, however it can work on applications based on JDK 1.4.2 or later.
 

Wednesday Oct 31, 2007

Centering components in a (visual) web form

One of the typical requirements for a web application developer is to build a secure, identity enabled web application. NetBeans supports this usecase either by employing the bundled JavaServer Faces components, or a combination of JSP & HTML. On the backend the user can either use container based authentication, a database or some custom authentication mechanism.

Let's explore what one would have to do to build the a login page in NetBeans. In order to speed up the development, one can choose the visual application features (File | New Project | web | ... "Next" in the first page of the wizard | check the "Visual JSF" option and voila you have a page and a palette full of useful components that you can just drag and drop them in the form (page).

Further my requirement will be to center the group of components in the page. This turned out to be a little tricky so here are some steps that one can follow to work around this NetBeans shortcoming:

1. Select the page in the designer and in the property pane switch to Flow Layout
2. Remove style attribute.
3. In the JSP view of the page, use  <center> and <br> tags to adjust layout.

This works at both design time and run time. Here is an example of the a form that uses a couple of labels, textfields and button to submit the form.

<webuijsf:form binding="#{Page1.form1}" id="form1">
                       <center>
                           <webuijsf:label binding="#{Page1.label1}" id="label1"  text="Label"/>
                           <webuijsf:textField binding="#{Page1.textField1}" id="textField1" />
                           <br/>
                           <br/>
                           <br/>
                           <webuijsf:label binding="#{Page1.label2}" id="label2"  text="Label"/>
                           <webuijsf:textField binding="#{Page1.textField2}" id="textField2" />
                           <br/>
                           <br/>
                           <br/>
                           <webuijsf:button binding="#{Page1.button1}" id="button1"  text="Button"/>
                       </center>
                       <br/>
                   </webuijsf:form>

Many thanks to Jayashri for helping me work out a solution.

Perhaps in a the next installment I'll talk more about authentication and how to deploy on an https port using the Glassfish application server.

About

octav

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
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
   
       
Today