
August 24th, 2008 by

Lincoln Baxter III
A4J:Form is missing several specified ajax functions
(
View this issue on the JBoss tracker here. Keep reading, there is a fix… download fix)
The issue:
When using the a4j:form component, the
data=”#{managedBean.property}” the properties defined in the
data element list are supposed to be available after the a4j event in the
data JavaScript variable; however, with <a4j:form> the attribute is not correctly causing the JavaScript
data variable to be populated.

August 17th, 2008 by

Lincoln Baxter III
Tutorial Chapter 2 – Easier Development and Maintenance
Tired of wiring in an
id,
version, and
timestamp field into all of your Hibernate objects? There’s an easy way to solve this pain once and for all of your classes. Avoid code-repetition: today’s article focuses on using Hibernate Annotations to map common fields into one mapped superclass.
If you have not done so already, and need to get a bare bones hibernate application up and running,
this guide should get you up and running in a few minutes.

August 1st, 2008 by

Lincoln Baxter III
Today’s subject is a well commented square root approximation method. Imagine that this method is buried deep in a very messy Java class. How can we make sure that this code is reusable and that our comments don’t become out of date as our code changes?
/**
* Approximate the square root of n, to within the specified tolerance,
* using the Newton-Raphson method. This method takes two arguments:
* @param Double n The number to be square-rooted
* @param Double tolerance the error tolerance
* @return Double result of square root operation
*/
public Double approximateSquareRoot(Double n, Double tolerance)
{
Double root = n / 2;
while (Math.abs(root - (n / root)) > tolerance)
{
root = 0.5 * (root + (n / root));
}
return root;
} |
/**
* Approximate the square root of n, to within the specified tolerance,
* using the Newton-Raphson method. This method takes two arguments:
* @param Double n The number to be square-rooted
* @param Double tolerance the error tolerance
* @return Double result of square root operation
*/
public Double approximateSquareRoot(Double n, Double tolerance)
{
Double root = n / 2;
while (Math.abs(root - (n / root)) > tolerance)
{
root = 0.5 * (root + (n / root));
}
return root;
}