Friday, March 27, 2009

IE7 Bug: <option> element has empty initial value

Author: Jared Beck
Date: 3/27/2009

Regarding the initial value of option elements, W3C HTML Spec Section 17.6 says:

"[The value] attribute specifies the initial value of the control. If this attribute is not set, the initial value is set to the contents of the OPTION element."

Example: <option>foobar</option> should have the initial value "foobar". IE7 fails to set the initial value correctly. IE returns the empty string.

Solution: Developers should explicitly set the value attribute for all option elements.

Tuesday, February 3, 2009

TortoiseSVN, .exe, and TrendMicro OfficeScan

While building out a staging server for a client, we encountered a strange situation in which TortoiseSVN was unable to check out a working copy of the application. It was getting an "Access is denied" message while trying to write some of the metadata files (in .svn) for an .exe file that was part of the project. The permissions on the folder looked fine. We eventually determined that the TrendMicro OfficeScan real-time virus scanner was causing the problem. After disabling it, we were able to check out the working copy. Subsequent updates with the virus scanner on have worked fine, but we haven't made any changes to .exe files, so we can't say if it's just a checkout issue or if it affects updates too.

Wednesday, July 2, 2008

IE bug: Image buttons do not submit value

Author: Jared
Date: July 2, 2008
Keywords: IE input type="image" button submit submission post not defined undefined value

Symptom: Your form has a image button named Z (an input with type="image"). Your form handling page expects Z to be defined. Z is not defined. You are using Internet Explorer. It works fine in Firefox.

Check this: Using IE still, see if Z.x and Z.y are defined. They are, right? But Z is not defined!

Cause: Internet Explorer doesn't define Z. It just doesn't.

Does IE's behavior match the HTML spec? No. Under section 17.13 "Form submission" the spec says "Every successful control has its control name paired with its current value as part of the submitted form data set" (HTML 4.01 Specification)

Will this be fixed in IE? Maybe IE8 beta does, I haven't checked.

Monday, January 7, 2008

Stored Procedure Information In PostgreSQL

All information for procedures and triggers in PostgreSQL is stored in the pg_proc table in the system catalog. Here is how to get some of the more useful information.

While working with a PostgreSQL recently I needed to find all the information on stored procedures that had been written. pgAdmin has a great SQL pane that it generates for stored procedures with pretty much all the information needed, but only one at a time. The goal was to get the information on all the procedures. The best I could do in pgAdmin was run a backup creating just the DDL statements, but this used pg_dump, and didn't provide all the information that pgAdmin so kindly displayed nicely formatted. Plus there was no way to just get stored procedures, you get EVERYTHING. Almost 700k worth of DDL creation statements.

pgAdmin is open source, so what better way to figure out how they generate all that wonderful information than reading how they did it. After finding the code that handles the functions (pgFunction) and the GetSQL function that returns the nice and clean information in the SQL pane, it was clear that there was no simple command to get all the information we wanted easily from the database with just a simple dump command. I investigated further into where pgAdmin got the information and found that all the information was pulled mostly from the pg_proc table of the database, a table holding information on all the functions, including triggers in the database which are just a type of function. That includes the functions defined by PostgreSQL. We knew that already that it was stored in a table, but not all the details. Using the SQL in the pgAdmin code as a basis to get the information made things pretty easy. All that is needed is the OID of the schema with the procedures, which I will represent as in the SQL.

SELECT * from pg_proc proc JOIN pg_type typ ON proc.prorettype = typ.oid WHERE typ.typname <> 'trigger' AND proc.pronamespace = AND proc.proisagg = false ORDER BY proc.proname

This gives all the information on the procedure and the type of the procedure. Scale to your liking. Using the OID of the schema limits it to functions that are not defined by PostgreSQL and are specific to that schema. To remove triggers, which are a type of function, remove all with the type (typname) "trigger". Using the proisagg flag will show aggregate functions (true) or non-aggregate functions (false).

Monday, December 10, 2007

A better debugging template for ColdFusion 6+

Way back when ColdFusion MX 6 came out, I quickly switched to the "dockable.cfm" debug template. Then, almost as quickly, I was driven close to madness by its incessant popping up every time a page was loaded. I made a simple change to prevent that auto-popping up, and the modified debug template has been an indispensable part of my CF toolkit ever since.

Today I saw a post regarding "re-assembling" a SQL string that had been separated into the SQL code and the bind variable values. This reminded me of the other nice change I made to my debug template. I was also a fan of copy-and-pasting queries from the CF debug window into my database front-end, and I created what I think is a pretty elegant solution to the loss of copy-and-paste-ability that comes with using CFQueryParam. The bind variables are inserted into the SQL string, but are colored blue to identify them as bind variables.

In the interest of improving the lives of CF developers everywhere, Singlebrook Technology is happy to share our wonderful doesntsuck.cfm debug template with you. Just download, unzip, and pop it in the "debug" folder inside your ColdFusion directory. Then you can select it as your debug template in the CF Administrator and I bet you'll never go back!

This template is compatible with ColdFusion 6.x, 7, and 8.

Monday, October 29, 2007

No more data available to read / 4096

Yes, ColdFusion MX 6.1 is old, but some of our customers are still running it, and we're here to support them. A particular large select query against a SQL Server 2000 database was erroring out with either "No more data available to read" or "4096" errors. The stack trace indicated that the 4096 error was in fact a "java.lang.ArrayIndexOutOfBoundsException: 4096" error.

We upgraded the client's database drivers to version 3.3, restarted CFMX, and the error went away. My Googling didn't turn up any solutions, so I figured I'd blog it and hopefully save someone else a few minutes of headache!

Wednesday, October 17, 2007

Identity Insert in Access

Keywords

Equivalent of Identity Insert in Access
AutoNumber Insert
Access 2007

Problem

You are copying rows from one table in Access to another. The destination table has an AutoNumber column which ignores the ids from your source table. You need Identity Insert, as in SQL Server, but where is that option?!

Solution

Don't copy and paste! Use an Append Query. (In Access 2007, look under Create -> Query Design) The Append Query will respect your ids.