CFIMAGE generates java error

Posted At : August 5, 2008 8:24 AM | Posted By : Dave
Related Categories: ColdFusion

While doing some image work this morning with watermarking I came across this strange error:

Error Occurred While Processing Request
General CMM error517

Here is part of the stack trace:

java.awt.color.CMMException: General CMM error517
   at sun.awt.color.CMM.checkStatus(CMM.java:127)
   at sun.awt.color.ICC_Transform.<init>(ICC_Transform.java:89)
   at java.awt.color.ICC_ColorSpace.fromRGB(ICC_ColorSpace.java:197)
   at java.awt.image.ComponentColorModel.getDataElements(ComponentColorModel.java:1560)

After doing a quick search (the internet is cool huh?), I was able to find this: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6444360. This issue that I ran into is apparently a recorded bug in JAVA. The bug was reported 2 years ago and it apparently has not been corrected.

The issue is with the jpg file I was trying to use. It apparently has a corrupt color profile and java can't handle it. I did check the properties of the file and noticed that the color representation property was set to uncalibrated. I was able to open the file in Fireworks and saved it as a new file and the new file works fine.

I have not found a way around it yet. The error happened when I tried to paste a one image onto another using ImagePaste.

Till next time...

--Dave

CFSAVECONTENT generates JAVA heap space error

Posted At : January 27, 2008 4:53 PM | Posted By : Dave
Related Categories: ColdFusion

I found this little gem while working on some code for my upcoming presentation to the CF online user group. I was working to crate a text file that contained a million lines of text. The code ran perfectly while doing test runs generating only 10 lines. When I ran it to create the million lines it failed out.

Here is the code I wrote:

<CFPROCESSINGDIRECTIVE SUPPRESSWHITESPACE="YES">
<CFSAVECONTENT VARIABLE="theRes">
<CFLOOP INDEX="i" FROM="1" TO="1000000"><CFOUTPUT>#i#</CFOUTPUT>: Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec libero. Suspendisse bibendum. Cras id urna. Morbi tincidunt, orci ac convallis aliquam, lectus turpis varius lorem, eu posuere nunc justo tempus leo. Donec mattis, purus nec placerat bibendum, dui pede condimentum odio, ac blandit ante orci ut diam.
</CFLOOP>
</CFSAVECONTENT>
</CFPROCESSINGDIRECTIVE>

<CFFILE ACTION="WRITE" FILE="#expandPath('.')#\textfile.txt" OUTPUT="#theRes#" NAMECONFLICT="OVERWRITE">

The error was not even a CF error message but a JRun servlet error.

ROOT CAUSE:
java.lang.OutOfMemoryError: Java heap space


javax.servlet.ServletException: ROOT CAUSE:
java.lang.OutOfMemoryError: Java heap space

It appears that there may be a memory max to CFSAVECONTENT. So, I got curious and starting playing with the code. After a bunch of trial and error I was able to figure out the max loop count I could run without error was 294712. This generated a 92mb text file. So, without figuring it out to the byte I would assume that the max is in that area.

Till next time...

--Dave

CFDocument pdf generation broke after CF8 upgrade

Posted At : January 11, 2008 8:24 AM | Posted By : Dave
Related Categories: ColdFusion

I just did an upgrade to a system a couple days ago from CF7 to CF8. I received a report from users that a section of the system that generates pdf reports was breaking. I found this strange since this section of the system is used daily and we have not touched the code in over a year. I figured at this point that the upgrade had something to do with it. After some investigating I was able to figure out that it was in fact a CF8 specific issue. The code for the pdf generation worked in CF7 but breaks in CF8.

[More]

Altering CSS to style ColdFusion 8 UI - Good Idea?

Posted At : October 19, 2007 6:48 AM | Posted By : Dave
Related Categories: ColdFusion

The new UI features of ColdFusion 8 are pretty amazing. They have made it possible for anyone to easily take their web applications to the next level. These new features allow you to do away with old style design. For example CFWINDOW instead of a pop-up window or using CFLAYOUT tabs to load different data onto the same screen without page refreshing.

The downside of all this is changing how the UI elements look. You can apply CSS styles to elements to change their look but not everything is exposed. There are a ton more styling that could be done once you look under the hood. Using Firefox with the FireBug plugin you can see all the different styles and classes used in the UI elements. With this information you can start to get creative styling the UI.

The question comes in as to whether it is a good idea. While you can get in and alter just about everything in the UI; all this extra, under the hood, stuff is undocumented. There are many inherent dangers in playing with undocumented items. Things are usually undocumented for a reason. There is no guarantee that they will remain the same from version to version. It is possible that the class used for an item may not be the same class in the next version.

I have posted a bunch of different ways to alter the CSS for ColdFusion 8 UI items. I personally don't think it is a bad idea. But I do think that the developer needs to be careful of what they modify. I have gone as far as to keep a list of modified CSS styles and classes. I also try and centralize the changes in a single CSS doc. This way when a new version comes out making sure my alterations still work will be easier.

Hopefully in the future more styling options will be exposed. But until then, if you choose to alter styles in this fashion just be careful and diligent in your coding. Doing so will save you many headaches during upgrade time.

--Dave

CFDJ out SLDJ in?

Posted At : September 10, 2007 6:26 AM | Posted By : Dave
Related Categories: General,ColdFusion

On the off chance you just got out of hibernation lets recap. Sys-Con has decided to drop CFDJ and replace it with SLDJ (SilverLight Developers Journal). Now, just in case you have seriously been out of touch. SilverLight is supposed to be the Flash killer from Microsoft (Draw your on conclusions here).

Their reasoning for dropping ... err ... relaunching CFDJ as SLDJ is just dumb and makes no sense. They claim that there is a move away from ColdFusion for AJAX, FLEX, and SilverLight. Well apparently they have no idea what these all are. ColdFusion is a back-end solution where as the others are user interface (RIA) items. Also, how can you relaunch something when the new content is completely different subject matter than the old?

I have not been a fan of CFDJ for some time now. The content has been nothing but lackluster for some time. They were always behind. They even tried to cover it up by not putting the month on the magazine cover anymore. Beyond that the article content was behind as well. The latest issue has the lead story on test driving CF8 beta. But, when I received it CF8 was out of beta and in full release.

For me personally, I am glad to see it go. It was doing ColdFusion a dis-service as a developers journal. I would rather read more current things from blogs and online articles that are covering current issues.

The huge bright side in all this is that I don't have to go to sys-con's pos website anymore. That site should be on the list of the top 5 worst web sites ever.

--Dave

CFSCRIPT incorrect error

Posted At : August 22, 2007 7:04 AM | Posted By : Dave
Related Categories: ColdFusion

Well, it took about 20 minutes of digging through code to find the code error. However, if the error message would have been accurate it would have taken about 5 seconds. In a cfc I was working on there are 5 functions in it. Each function contains a cfscript block. Some are a couple hundred lines each. CF was giving me this error:

The start tag must have a matching end tag. An explicit end tag can be provided by adding </CFSCRIPT>. If the body of the tag is empty, you can use the shortcut <CFSCRIPT .../>.

However, this error is inaccurate. The actual issue was that there was a missing ";" at the end of a line inside the cfscript. I checked the same code against CF7 and CF8 and the error message was the same.

So, the moral of the story is... I have no idea. But, keep an eye on your code and remember that the error reporting in CF can, at times, be wrong.

--Dave

Coldfusion is dead, again

Posted At : July 19, 2007 9:04 PM | Posted By : Dave
Related Categories: ColdFusion

Well, some idiot is at it again. I seriously want to know where these people get their research. I seriously think that they may just pull this stuff out of a hat and then find a way to include it.

http://www.softwaredeveloper.com/features/ghosts-in-machine-071207/

Here is a link to the digg entry http://digg.com/programming/Ghosts_in_the_Machine_12_Coding_Languages_That_Never_Took_Off

Here is a good blog entry about it from Adam Fortuna http://www.adamfortuna.com/2007/07/20/coldfusion-never-made-it-then-it-died

--Dave

Effortless porting of CF7 site to CF8

Posted At : July 19, 2007 9:22 AM | Posted By : Dave
Related Categories: ColdFusion

A couple days ago I took a extremely large and complex system and got it running on CF8. I was very skeptical about doing it be as CF8 is not yet released but I wanted to make sure the application would run on CF8 without any major issues. To make sure I had no issues with upgrading I uninstalled CF7 first. I then installed CF8 and went through the configuration. Once done I tried to run the application.

I was pleasantly surprised to see the application ran without issue. I have been continuously testing all aspects of the system and have found no issues to this point. I have also noticed the large performance gain that is being reported.

Overall this process was completely effortless. I spend the majority of the time doing the cfadmin setup. I did not have to make any code changes or any alterations to the application.

--Dave

ColdFusion 8: CFWINDOW caches content

Posted At : June 5, 2007 5:54 AM | Posted By : Dave
Related Categories: ColdFusion

Well, I knew it would happen eventually. I knew it was only a matter of time that I would find a new feature of CF8 that would just tick me off. I finally found this in CFWINDOW. While the concept and intention is great I think that the implementation is crap.

First off lets start with the fact that it caches the content. If you call the window with a source it gets the source on first open. If the window is closed and then opened again the window does not get new content.

Next, if you want to load it based on a link using bind you have to use CFFORM. You can not just use an html form. By using CFFORM you add excessive bloat.

Resizing of the window is all messed up as well. You would think that when opening the window it would size and position itself based on the the settings. Well this is not the case 100% of the time. When the window is opened the size and positioning is based on how it was on last open. If it is the first open than every thing is fine. But if you open it, move it, change the size then close it on the next open it will look like it did when it was closed. Also, if you change the size of the browser the window will not recenter itself so it is possible you can loose it off the top of the browser.

If anything is corrected with this it should be the caching of the content. Everything else I could live but without better way to handle getting the source this tag is useless to me. I had tons of uses for CFWINDOW. However, I dont think that it was intended to be used in a dynamic environment.

--Dave

ColdFusion 8: CFPDF, tumbnails and tooltips

Posted At : June 4, 2007 7:05 AM | Posted By : Dave
Related Categories: ColdFusion

I have been checking out the ability to thumbnail pdf files. Currently I am very impressed with the accuracy and speed. I was able to thumbnail every page of a 27 page pdf in only 4 seconds. While I was working on checking all this out Ray Camden blogged about the new tooltip function. This got me to thinking, could I couple the pdf thumbnailing with a tooltip?

[More]

ColdFusion 8: thread sleep

Posted At : May 31, 2007 1:29 PM | Posted By : Dave
Related Categories: ColdFusion

Ok, now this is one of the reasons I love CF. I love it when something I have been doing the long way for ever instantly becomes easy. Sleeping a thread is one of those things. I have been using the java method since CF6 to pull this off. Now it is a simple function. For example...

Old School sleep method:

<CFSCRIPT>
thisThread = CreateObject("java", "java.lang.Thread");
thisThread.sleep(1000);
</CFSCRIPT>

New School sleep method (there are 3):
<CFSCRIPT>
sleep(1000);
</CFSCRIPT>
or
<CFSET sleep(1000)>
or
<CFTHREAD ACTION="SLEEP" DURATION="1000">

Making our lives easier. Just another reason to love CF.

--Dave

More Entries