The Dev Pages

A knowledge base for web applications development (and beyond)

Archive for July, 2008




So if you’re using jQuery UI dialogs, you may run into issues with IE 7. Apparently the value of a usually ‘undefined’ javascript variable can get set to ‘NaNpx’ in IE7. I had to change the jQuery base code to get a dialog ui component to work.

I was getting the following runtime error: “Line: 1102 Error: invalid argument.”

This error comes from code around line 1101 in jquery-1-2-6.js.

So I think my version of jQuery had already been modified or comes from an older or different source. My code follows, but the most recent 1-2-6 jQuery script has code that is like the comment Dom left (thanks – that code looks more like the most recent release of jQuery).


/* MODIFIED 7/31/08 BY NATE
* WAS THIS, but IE7 was throwing an error
if ( value != undefined )
elem[ name ] = value;
*/
if ( value != 'NaNpx' && value != undefined)
elem[ name ] = value; //NATE - Sometimes the value would come up as NaNpx in
IE and causes an error

jquery runtime error for dialog




So I had an image that was not loading, and could not figure out why, in Firefox 3. Turns out it was a plugin, mos tlikely adBlock plus. When all plugins were disabled, the image loaded fine. Here were the URLs which the plugins blocked, and the one it let by.  Looks like the plugin blocks certain URLs based on specific words.

Always worked:

test

Only worked with plugins disabled:

test
test




So if you have

<cfmail to=””

an error occurs

but apparently when you have

<cfmail to=” ”

It just completes successfully without sending an email to anyone and doesn’t throw errors




I’ve noticed a lot of confusion about the acronym CFML (Coldfusion Markup Language) in connection with the other well-known acronym CMFL (Cambodian Midget Fighting League). The CMFL had an incident where an African lion defeated, and killed many of 42 midget fighters in a government sanctioned fight, which resulted in an increased status in the already popular league. Consequently, many coldfusion developers should be aware to use the proper tags and extensions that use CFM and not CMF, as such similar and popular acronyms are bound to clash often. I have already come across such errors often in my limited dev experience.

Summary: CF developers, don’t let the CMFL take precedence in your mind over CFML.

http://www.lionvs40midgets.uk-directory.com/lionvsmidgets.htm




If you try and set the style attribute of a DOM element with Javascript, the following code WON’T WORK IN IE:

yourelement.setAttribute('style','left:150px; top:150px;');

Instead use:

yourelement.style.cssText = 'left:150px; top:150px;';

Thanks to Rob on this page

http://www.quirksmode.org/bugreports/archives/2005/03/setAttribute_does_not_work_in_IE_when_used_with_th.html

http://blog.throbs.net/




For finding scroll height while being cross-browser compatible. This site was perfect for what I was doing.

http://www.codehouse.com/javascript/articles/scroll_area/




This may be one of those things where I am the real cause of this error is totally unrealted to how I perceive the problem, but right now it seems like the folder name ‘bin’ causes problems with webDAV folders.

With a virtual folder on an IIS server that uses webdav, if you create a folder called ‘bin’ you get the following error when trying to access the folder or modify.

'Documents in this folder are not available. The folder may have been moved or deleted, or network problems may be preventing a connection to the server. There is a problem with the webserver. Please try again later or contact the server administrator.'

Many other folder names worked fine. May be related to the following issue:

http://kbalertz.com/895248/receive-folder-error-message-folder-hosted-Internet-Information-Services.aspx




You CAN’T throw an error or errors from a cfscript without defining your own throw function. But this is pretty easy to do. Somewhere else in your code, just write a <cfunction name=”throw” etc. and in this function just put a <cfthrow tag that throws the error you want to be thrown. A good practice would be to include a throw function in a utility cfc that you could invoke wherever you needed to throw an error in a cfscript.

See the example code below. Note the interesting syntax for catching in a cfscript where you do catch(ERRORTYPE CFCATCHVARIABLE). So catch(database e), catch(any e) would be some common ones. And then you could access e.Message, e.Detail, etc.

try
{
//nothing below the throw would execute in this example.
//But I left the rest for syntax reference.
somethingWrong=true;
if(somethingWrong){
throw("ExampleErrorType","Example Error message.");
}
//save the reactor record without interfering with custom transaction
template1.save(useTransaction=false);
}
catch (database err)
{
//if the save fails and the error is a database error, return the error detail.
//otherwise this error will need to be caught by the code calling this code.
return err.Detail;
}

If you want to do a rethrow, the following article has a great example.
http://www.coldfusionjedi.com/index.cfm?mode=entry&entry=3089633C-9FA0-606B-3F540AE9642A795F