I am an application developer, database administrator, technical writer, and Java evangelist. Frequent this blog to learn from my experiences in Java, JavaEE, PL/SQL, and Python/Jython development. Follow my tweets @ http://twitter.com/javajuneau
Tuesday, March 27, 2007
JPC
Check out the attached link...the JPC project offers computer virtualization in Java. Although I have only briefly reviewed the project, it looks to be very interesting and useful. Have a look...
Thursday, March 08, 2007
Just a Quick Note on FireBug
I have to blog about FireBug...the web development FireFox add-on. This tool is excellent, and it has helped me to find my javascripting bugs in a minimal amount of time. No more guessing which javascript line caused the bug, or using alert messages to find errors...Firebug allows one to traverse the javsscript while it is executing. This debugger is very similar to most IDE debuggers, and you can use it on any web page!
Love FireBug...if you have not tried it then I suggest downloading it now!
Love FireBug...if you have not tried it then I suggest downloading it now!
Jython Monthly Articles Needed
I am the editor and distributor of the Jython Monthly newsletter. Part of the monthly routine for ensuring an effective distribution is to obtain articles and blogs which are worth reading. I hate to throw together a newsletter full of garbage and waste the expensive time of the readers.
One of the reasons I started the Jython Monthly newsletter was to begin generating a more complete article library for Jython. I had hoped to obtain at least one or two articles per month for distribution with the newsletter. This worked well for a while, but we seem to have fallen into a slump as of late. Since the new year has begun, I've received very few articles for distribution with the newsletter. Therefore, I hope to see another spark in the community for generating useful Jython resources. We need more Jython articles!
If anyone has an article that they would like to contribute for this month or any coming month, please visit Jython Monthly Articles to get started. Anyone can contribute, so feel free to post any and all Jython related content.
Thanks for the help, and I look forward to reading your Jython Monthly article in the near future!
One of the reasons I started the Jython Monthly newsletter was to begin generating a more complete article library for Jython. I had hoped to obtain at least one or two articles per month for distribution with the newsletter. This worked well for a while, but we seem to have fallen into a slump as of late. Since the new year has begun, I've received very few articles for distribution with the newsletter. Therefore, I hope to see another spark in the community for generating useful Jython resources. We need more Jython articles!
If anyone has an article that they would like to contribute for this month or any coming month, please visit Jython Monthly Articles to get started. Anyone can contribute, so feel free to post any and all Jython related content.
Thanks for the help, and I look forward to reading your Jython Monthly article in the near future!
Friday, March 02, 2007
Old Buggy Details
I was reviewing an issue involving a record modification form within a PL/SQL web application yesterday. This modification form is basic...it displays the data which already exists within a database record and allows an end-user to modify that data within different text fields on the form.
The issue was that some of these text fields were not updating as expected. After some initial review, I saw that the records having this issue had been submitted without any data in the fields that were not updating. Furthermore, I checked the database and all varchar2 fields which were not updating as expected had NULL values within them. Ahh...the old NULL value comparison issue!!!
As it turns out, upon submitting a modified record, the PL/SQL application checks each field within the database to see if it's contents match the previously submitted data. If not, then the field and new content are added to the update statement so that the resulting modifications are submitted successfully. However, the comparison being used was not allowing for NULL values to be compared. The result was a false positive result which was prohibiting the data to be updated.
For example, the data is compared such as:
if cursor_rec.old_value != incoming_new_value then
update_text := update_text || ' my_field = ''' || upper(incoming_new_value)
|| ''';
end if;
The issue is that the above IF statement is never true if the varchar2 value contained within the incoming_new_value variable is NULL. You must always compare a varchar2 against a non-null value for obtaining a valid result in such cases. Therefore, the use of the Oracle nvl function comes into play.
The updated code which repairs the issue simply replaces a NULL value with a character so that comparisons will function as expected.
if cursor_rec.old_value != nvl(incoming_new_value, '*') then
update_text := update_text || ' my_field = ''' || upper(incoming_new_value)
|| ''';
end if;
An oldie but goodie to remember!!!
The issue was that some of these text fields were not updating as expected. After some initial review, I saw that the records having this issue had been submitted without any data in the fields that were not updating. Furthermore, I checked the database and all varchar2 fields which were not updating as expected had NULL values within them. Ahh...the old NULL value comparison issue!!!
As it turns out, upon submitting a modified record, the PL/SQL application checks each field within the database to see if it's contents match the previously submitted data. If not, then the field and new content are added to the update statement so that the resulting modifications are submitted successfully. However, the comparison being used was not allowing for NULL values to be compared. The result was a false positive result which was prohibiting the data to be updated.
For example, the data is compared such as:
if cursor_rec.old_value != incoming_new_value then
update_text := update_text || ' my_field = ''' || upper(incoming_new_value)
|| ''';
end if;
The issue is that the above IF statement is never true if the varchar2 value contained within the incoming_new_value variable is NULL. You must always compare a varchar2 against a non-null value for obtaining a valid result in such cases. Therefore, the use of the Oracle nvl function comes into play.
The updated code which repairs the issue simply replaces a NULL value with a character so that comparisons will function as expected.
if cursor_rec.old_value != nvl(incoming_new_value, '*') then
update_text := update_text || ' my_field = ''' || upper(incoming_new_value)
|| ''';
end if;
An oldie but goodie to remember!!!
Subscribe to:
Posts (Atom)