2010/09/27

Password quality meter in GWT

A simple password quality meter is part of the gwt-aux project.
It has a very simple API and implementation, but it is very easy to use as well:

// Minimum password length is 6

final int passwordMinimumLength = 6;

// Create password field

final PasswordTextField passwordField = new PasswordTextField();
passwordField.addValidator(new MinLengthValidator(passwordMinimumLength));
addAndReplaceElement(passwordField, "passwordField");

// Create validation result panel

ValidationResultPanel passwordValidationResultPanel = new ValidationResultPanel(passwordField);
addAndReplaceElement(passwordValidationResultPanel, "passwordValidationResultPanel");

// Create password quality meter

final PasswordQualityMeter passwordQualityMeter = new PasswordQualityMeter(passwordMinimumLength);
addAndReplaceElement(passwordQualityMeter, "passwordQualityMeter");

// Validate field and update password quality meter on every key press

passwordField.addKeyUpHandler(new KeyUpHandler()
{
 @Override
 public void onKeyUp(KeyUpEvent event)
 {
  passwordQualityMeter.setPassword(passwordField.getFieldValue());
  passwordField.forceAndVisualizeValidation();
 }
});

Resources:

2010/09/22

Lazy scrolling panel in GWT

Google reader displays blog entries in a lazy scrolling panel, which means initially only a few entries are displayed, but if the user scrolls near the bottom, the next entries are loaded automatically. Implementing such a component in GWT is very simple.

Negative progress using Subversive :)

Recently I ran into I/O performance problems using Subclipse, so I decided to give a try to the "another" SVN plugin for Eclipse, Subversive. Although I miss some minor features (eg. tagging/branching in the repository is a little bit comfortable in Subclipse) and sometimes merging has unusual results, but I can say I'm satisfied with it.

One funny thing I noticed when sharing a project was a negative percent value in the progress bar:

Anyway, the sharing operation completed as expected, so who cares if it takes "more than 100%" :)

2010/02/06

Efficient GWT development with Eclipse-Maven integration

In this article I present an efficient GWT development environment based on Eclipse and Maven, with tight integration between them.

Goals
  • Maven-friendly Eclipse project
  • easy development using Eclipse and WTP
  • ability to build the entire project using Maven (eg. for deployment or nightly builds)
It should be noted that there are many ways for efficient integration of the given technologies, I present here only one of them.
If you want to skip the 'boring' step-by-step explanation, simply check out the project from SVN :)

2010/01/28

GWT 2 "Debugging and Compiling" FAQ missing

The GWT compiler has several options that can be used to customize the build process. There are two trivial ways to get the option list:
  • by running the com.google.gwt.dev.Compiler class without arguments
  • reading the Debugging and Compiling part of the offiicial documentation
I naively thought that the second would be easier but surprisingly it isn't :)

2010/01/13

Eclipse may freeze if console output is not limited

I have an application which continually generates a large amount of log. During development the log was written to the Eclipse console. In order not to lose any log output, I turned off the limit console output feature:



I started the application but I had to go away from my computer. When I got back I saw a message about memory is out, and it is recommended to restart the workbench. To tell the truth, I didn't have a choice: all functions of Eclipse became unusable.

It's very minor issue - and probably an expectable behaviour - but it's good to know that Eclipse takes this setting literally, and there is no protection against OutOfMemoryExceptions :).

2010/01/11

Experimenting with Datanucleus JPA

I have been using Hibernate for a very long time, and I'm more or less satisfied with it. When I saw that Google App Engine uses the JPA/JDO implementation of Datanucleus for high level persistence, I decided to create a sample JPA project with it.

Incremental average calculation

To calculate the average of some numbers, we can use the following simple formula:
It works in most cases, but let's suppose that we would like to know the average of a fast growing set of numbers.