Forwarding instead of Redirecting in Form Handlers

Typically how an ATG form handler handles form submissions is that if the form submission has any errors it redirects to an error or failure URL, otherwise it redirects to the success URL. It does this when you call the form handler’s method checkFormRedirect.

However by redirecting you are creating a new request and you will lose all the information in the current request. If you want to keep them you can do this by forward instead of redirecting.

To specify that a form handler use forward instead of redirect you can either

  1. set the request parameter “atg.formHandlerUseForwards” to “true” (case insensitive) OR
  2. set the boolean property useForwards to true, either in the properties file of the form handler or using a hidden input in the JSP/JHTML form

None of this as far as I can tell is documented, probably because instead of using forwards ATG would probably prefer developers make a form handler session scoped if information needs to be preserved over multiple requests. Regardless this is all documented in the source code for atg.droplet.GenericFormHandler which is available in the ATG install location under DAS/src/Java/.

Note that if you call the response’s method sendLocalRedirect you bypass the flexibility of possibly using forwards. Instead it is preferable to call the form handler’s method redirectOrForward.

How to Retrieve Oracle Version Information

When you start SQLPlus you should see the Oracle version information. For example:

$ sqlplus fkim/fkim@example

Connected to:
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production

Also you can execute SQL to retrieve the version information.

SQL> select * from v$version where banner like 'Oracle%';

BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production

Describing Tables and Constraints in Oracle

Stone Table | Flickr

Stone Table by WorldWanderlust

To get the table definition.

describe foo;

Or simply

desc foo

To get the constraints of a table.

select * from user_constraints where table_name='foo';

Similarly to find the table for a constraint.

select table_name from user_constraints where constraint_name='bar';

To find all the tables that have foreign key constraints for a given table you can use this query.  It first find the name of the unique and/or primary key constraints in the given table.  Then it finds all the constraints in other tables that reference this constraint. Note that the table names are usually uppercase.

select owner,constraint_name,constraint_type,table_name,r_owner,
r_constraint_name
from all_constraints
where constraint_type='R'
and r_constraint_name
in (select constraint_name
from all_constraints
where constraint_type in ('P','U')
and table_name='BAZ');

A simpler way which also constrains the owner would be like this.

select table_name,constraint_name
from all_constraints
where constraint_type='R'
and owner='FRANK'
and r_constraint_name
in (select constraint_name
from all_constraints
where constraint_type in ('P','U')
and table_name='BAZ');

For further reading please see Finding Foreign Key Constraints in Oracle and Oracle Constraints.

Problematic Adobe Photoshop Elements 4.0 Card Reader

Adobe Photoshop Elements 4.0 has a small utility called the Card Reader. Whenever you connect a camera USB or insert a card in a USB card reader the Card Reader pops up and allows you to download the photos onto your local hard drive and be added to the Photoshop Elements catalog.

However unlike with previous versions this Card Reader has proved to be problematic. It does not respond properly to the Windows close event so you have to manually close it when you are hibernating or logging off or shutting down.

Also the Card Reader for reasons unclear to me prevents certain applications from installing. Again the only way to get around this problem is to close the Card Reader.

In the end the convenience of the Card Reader was not worth the problems so I turned it off. It’s my impression as well as many others (see the reviews for 4.0 and 5.0 on Amazon.com) that Adobe is continually degrading the quality and functionality of the Photoshop Elements product in every subsequent version.

HOWTO Stop Being Prompted For Password in TortoiseSVN

Just as you can setup the Subversion client to not prompt for a password every time you communicate with the Subversion server in a similar but not so secure way you can do this with TortoiseSVN.

The easiest way to do this is to right click in Windows Explorer, select Tortoise > Settings. Then in the Settings window select Network. Then in the SSH client set use the Tortoise SSH client, TortoisePlink, to use your username and password. For example:

D:\TortoiseSVN\bin\TortoisePlink.exe -l foo -pw bar

Moving Quicken 2005 From One Computer to Another

  1. Backup Quicken data file. Copy files (there should be five) to a temporary, e.g. My Documents\quicken_bak.
  2. Install Quicken 2005. Note if you have to reinstall you might want to delete C:\Documents and Settings\All Users\Application Data\Intuit\Quicken to reset the installation.
  3. When asked, download updates.
  4. When asked, run Quicken.
  5. Select the “I am new to Quicken” option because using the other option and trying to restore from backup doesn’t work.
  6. Select the “I want to choose a different name and location.” option and select My Documents\quicken\my_money.qdf or something like that.
  7. Exit the Quicken Setup.
  8. If you’re not asked to register then go to Help > Register but this is important, create a new Quicken.com account for this installation, otherwise you won’t be able to synchronize with your bank accounts. See this article for more information.
  9. Select File > Restore Backup File and choose the QDF file you downloaded before in Step 1. When asked if you wish to overwrite your current file say yes.

Installing the Microsoft Loopback Adapter

If you want to install Oracle, that great big beast, the computer you intend to install must have a static IP address. However for many people their IP address is dynamic, that is it comes from a DHCP server. To get around this restriction you can install the Microsoft Loopback Adapter which creates a virtual static IP.

To install the Microsoft Loopback Adapter follow these instructions. You should be able to start the Add Hardware Wizard by selecting Add Hardware in the Control Panel.  In Windows XP if you cannot find Add Hardware in the Control Panel then you can start the Add Hardware Wizard by selecting Printers and Other Hardware in the Control Panel. You should see an Add Hardware entry on the top of the left column.

After installing the Microsoft Loopback Adapter go to the Control Panel, select Network and Internet Connections and then Network Connections. Select the Local Area Connection that is a Microsoft Loopback Adapter (usually Local Area Connection 2). Select the Internet Protocol (TCP/IP in Windows XP, TCP/IPv4 in Windows Vista) and then press the Properties button. Next select Use the following IP address and enter an IP address that should not conflict with your LAN. I use 192.168.1.200 and set the Subnet Mask to 255.255.255.0.

After you set the IP address you can use the Windows host file to assign a friendly address to this IP address. For example add this entry to C:\WINDOWS\system32\drivers\etc\hosts.

192.168.1.200 cool.example.com

ATG does not allow property values with commas for String[] properties

Typically when you have a property of Strings, either an array or a collection, you would set them like this:

foos=hello,good-bye,this is a test

In the above example if the foos property is of type String [], then ATG initializes foos to { “hello”, “good-bye”, “this is a test” }.

However if one of the String’s has a comma in it then this method won’t work because ATG will treat the comma as a delimiter. For example if foos is configured like this:

foos=hello,good-bye,this is a test\, a big test

then foos is initialized to { “hello”, “good-bye”, “this is a test”, “a big test” }

To get around this apparent limitation, which is documented in Bug #29380, ATG provides a class called atg.core.util.StringList. If you set the type of the foos property to StringList and configure it like this:

foos=hello,good-bye,this is a test,, a big test

then fools will be initialized to { “hello”, “good-bye”, “this is a test, a big test” }. Note that “,,” is the method for escaping commas when using StringList.

Eclipse Serial Version UID Bug

Currently there is a bug with Eclipse and generating the serial version UID. When attempting to generate a serial version UID you will see a dialogue window which says “Computing serial version ID….” and “Starting virtual machine…”. Unfortunately this hangs and you are forced to kill your Eclipse IDE. I started seeing this bug after installing some JDBC plugins and the GEF plugin, I’m not sure if it’s related to that. I tried disabling the plugins but I still see the problem. Before I wasn’t having this problem.

I noticed that I haven’t encountered this problem on other installations of Eclipse, even w/ the JDBC plugins, so could just be that I have a bad build of Eclipse.