Tuesday, February 24, 2009

GWT-EXT - FitLayout

Anyone who are using FitLayout should aware of this.

Extract from GWT-EXT Java Doc

public class FitLayoutextends ContainerLayout

This is a base class for layouts that contain a single item that automatically expands to fill the layout's container.

FitLayout does not have any direct config options (other than inherited ones). To fit a panel to a container using FitLayout, simply set layout to FitLayout on the container and add a single panel to it. If the container has multiple panels, only the first one will be displayed.

My experience is, if you did not conform to this criteria, your remaining layout within the FitLayout panel will go crazy (Especially, grid component)

Thursday, February 19, 2009

Free Online SVN

I have found a cool online SVN service provider.

Beanstalk is a hosted Subversion system, making it easy to setup, browse, and track Subversion. Beanstalk has built-in integration with your favorite tools such as Basecamp, FogBugz, Campfire and more.

It rather impressive and it is free for limit usage. One core feature is Beanstalk allow permission setting for free user. Many of others online SVN service does not provide that. Another feature is Beanstalk create a personalize domain for your SVN project.

So for, in my test environment, it performs well and tortoiseSVN works with it perfectly.

Wednesday, February 18, 2009

SVN - Authentication

Setting up Authentication for SVN is not tough too.

First, stop Apache server - net stop apache2.2

Second, create a htpasswd file with the following command
htpasswd -cm svn-auth-file your-name

Third, in httpd.conf, add the following to Module path

LoadModule authz_svn_module modules/mod_authz_svn.so

Fourth, in httpd.conf, add the following to Location tag


DAV svn
SVNPath "C:\svn_repository"
AuthType Basic
AuthName "Subversion repository"
AuthUserFile "C:\Program Files\CollabNet Subversion Server\httpd\conf\svn-auth-file "
Require valid-user


Lastly, restart Apache server.

That all, you will required to use username/password to retrieve your documents.

SVN - Window Setup

Subversion is a good version controlling system

Setting up Window SVN server is rather easy with the following steps
  1. Download Collabnet SVN server
  2. Download Python 2.5
  3. Download Subversion Python 2.5 binding
  4. Install Python 2.5
  5. Install Python 2.5 binding
  6. Install Callabnet SVN server
  7. While installing Callabnet, follow the wizard. Make sure you install viewVC when you are asked to install Apache2.2 server.
  8. Restart the machine (very important, if not, mod_dav_svn.so will not be able to load by Apache server)
  9. After the restart, restart Apache server by net start apache2.2
  10. Go to any browser and type http://ip:port/. If you see a web response, you have successfully installed SVN

For a svn window client, I highly recommand Tortise SVN. It has a simple and nice window interface for checking out content from given respository

Monday, February 16, 2009

Eclipse + JS at GWT public folder = Slow

As recommanded by GWT-EX Wiki, you have to put js/ext folder into module's public folder. So, during GWT compile, it will automatically copy these js files as a package to the output folder.

This really give automation. But when you have many modules under a single project, this will pose a problem.

  1. Eclipse will be slow when it does auto-build on workspace, this is the major issue
  2. You will have to include js folder at each public folder.

My observation is you do not need these js files for compilation. GWT compiler helps to copy these files to output folder.

Using at gwt.xml won't work as it is only applicable to child folders.

So, the best solution so far use Ant task

  1. Create an ant task to perform GWT compile
  2. On compile success, use ant to copy js folder into the output folder

This way will kind of save Eclipse from busy copying js to its build folder.

Sunday, February 15, 2009

JavaFX, GWT, Adobe Flex and OpenLaszlo

A search on Google trend on the popularity of JavaFX, GWT, Adobe Flex and OpenLaszlo reveal the following graph





It seems that GWT is a very popular API in UI development currently.

This is just a show in search term regarding the 4 UI API language. Base on the data, OpenLaszlo does not show a good adaption by developer and it is on a decline.

I do have some experience in OpenLaszlo vs GWT

  • Debugging OpenLaszlo application is really a pain. No step debugging provided
  • Comparing to OpenLaszlo, GWT is a winner here. It has the best developer companion (Step Debugging).
  • Also, if you are a Java and Eclipse inclined developer, you will love GWT environment.

Java XML Mapping

Recently, Castor has release a Castor 1.3 version. Castor is a great Java-XML mapping project and it gives more.


But, if you only need simple XML parsing, Java DOM (Document Object Model) is good enough.


Below is a sample to parse all xml element and value to a HashMap



Refer to the Java API

Friday, February 13, 2009

Java Keytool Command

Tips for Java Keytool Command
  • View KeyStore => keytool -list -keystore -storetype . The above command will prompt you for password if any. If password is correct, it will list all available keys in the key store

Wednesday, February 11, 2009

GWT-EX Module XML

Tip:

This is an exmple of a GWT-EX and GWT-EX-UX module xml.

GWT - Ant Task for GWTComiler

Tips for Ant task on GWTCompiler

Do the following



Note:

  • ${module} is the location of the module file, ie, XXX.gwt.xml.

  • ${GWT_HOME} is the home path of GWT folder
  • ${lib} is the path where you store your jar files, ie, gwtext.jar
  • GWT Compiler Reference

GWT-Ext and GWT-Ext-UX

Cool GWT-EXT and GWT-EXT-UX. It provide more extra UI components for GWT. The components are slick. They can be easily adoptable by Java programmer. Very similar to Java AWT.

Also, the code can be minimal. For example, to use GWT-EXT-UX's File Upload component. All you needs is

public void onModuleLoad()
{

Panel panel = new Panel();
Button button = new Button("Upload File", new ButtonListenerAdapter()
{
public void onClick(final Button button, EventObject e)
{

UploadDialog dialog = new UploadDialog();

dialog.setUrl(url);

dialog.show();

}

});
panel.add(button);

RootPanel.get().add(panel);

}

Cool isn't it?

Tuesday, February 10, 2009

GWT



It is very exciting toolkit. Java developer will like it as it can cross-complile Java to JavaScript. Develop in Java, result in JavaScript. Also, it has the most important debugging tool - Step through debugging

Extract from GWT.

With Google Web Toolkit (GWT), you write your AJAX front-end in the Java
programming language which GWT then cross-compiles into optimized JavaScript
that automatically works across all major browsers. During development, you can
iterate quickly in the same "edit - refesh - view" cycle you're accustomed to
with JavaScript, with the added benefit of being able to debug and step through
your Java code line by line. When you're ready to deploy, GWT compiles your Java
source code into optimized, standalone JavaScript files. Easily build one widget
for an existing web page or an entire application using Google Web Toolkit.


Cypal Eclipse Plugin

There is an existing Eclipse plugin for GWT. That is an awesome new for developer who frequently use Eclipse for development.

GWT-Ext

Also, there is a GWT-Ext Widget library available. It provides many UI extension. Pretty exciting.

OpenLazslo Drawback

Although OpenLazslo provide a good API, especially version 4.2 that has a awesome compiler, it is still a pain in debuging OpenLazslo development.
  1. There is no Debug Line Stepping
  2. If error occurs in the swf, the application will hang without any debugging information stated in the debug window
  3. Minimal support information for version 4.2

Also, some important stuff are not well documented in the changeset from 4.1 to 4.2.

Some examples:

  • 4.2 requires the use of passthrough for importing AS3 library. However, it is not stated anywhere.
  • Some Laszlo tag elements are seemingly removed. I had experience on . The application hangs when name attribute exists.

Monday, February 9, 2009

Laszlo 4.2 - Call Flash 9.0 API

One main different in Laszlo 4.1 and Laszlo 4.2 is the way it calls Flash API. In Laszlo 4.2, extra steps are needed to be taken when importing Flash API

2 ways




A full Laszlo example of File Upload by Flash API for Flash 9.0

OpenLaszlo - A Really Cool Flash UI API

OpenLaszlo is an open source platform for the development and delivery of rich Internet applications. It is released under the Open Source Initiative-certified Common Public License.

Especially 4.2, it is the recommended platform for all application development in the SWF8, SWF9, and DHTML runtimes. The major new feature in OpenLaszlo 4.2 is the introduction of the SWF9 runtime, which can offer significant performance gains.

Main site:

http://www.openlaszlo.org/

Documentation:

http://www.openlaszlo.com/lps4.2/docs/

Forum:

http://forum.openlaszlo.org/

Java Reflection API

Java Reflection is a powerful tools to dynamically instantiate objects. It is especially helpful and reduce the amount of code to be written. Fields, Methods and Constructors are the members of the reflectors.

Sample codes from Java

http://java.sun.com/docs/books/tutorial/reflect/member/fieldModifiers.html

http://java.sun.com/docs/books/tutorial/reflect/member/methodModifiers.html

http://java.sun.com/docs/books/tutorial/reflect/member/ctorModifiers.html

Java Tips:

The Class.getField() and Class.getFields() methods return the public member field(s) of the class, enum, or interface represented by the Class object. To retrieve all
fields declared (but not inherited) in the Class, use the Class.getDeclaredFields() method.

But, one note is that

An IllegalAccessException may be thrown if an attempt is made to
get or set the value of a private or otherwise inaccessible field or to set the
value of a final field (regardless of its access modifiers).

The same goes to Method. This is kind of a setback.

http://java.sun.com/docs/books/tutorial/reflect/TOC.html