Wednesday, February 20, 2013

ColdFusion Invalid Image Format Solution

For those who have gotten the following error:
"java.awt.color.CMMException: Invalid image format" and tried
the solutions posted here with no avail.

We are going to use the power of Java's JAI (Java Advanced Imaging) library to tackle this one.

//path to image
imagePath = "pathToImage";

//create java file object, passing in path to image
imageFile = createObject("java","").init(imagePath);

//create a FileSeekableStream, passing in the image file we created
fss = createObject("java","").init(imageFile);

//create ParameterBlock object and initialize it (call constructor)
pb = createObject("java","java.awt.image.renderable.ParameterBlock").init();

//pass in FileSeekableStream

//create JAI object that will ultimately do the magic we need
JAI = createObject("java","");

//use the JAI object to create a buffered jpeg image using the parameter block we just created
buffImage = JAI.create("jpeg", pb).getAsBufferedImage();

//pass the buffered image to the ColdFusion imagenew() method.
New_Image = imagenew(buffImage);

//make sure we close the stream, or you'll pay for it later

From what I could find CF/Java chokes on some jpeg's due to their format.
Specifically speaking, the EXIF format vs. the JFIF format.
Read this for more information on these two standards.

Some cameras only add the EXIF segment to the file header of the jpeg and images from those cameras are the ones I see issues with.
To see some samples of this, check out the images on this website.
Download some of those images and see if your image processing code can handle them!

To get more information on your images check out this page and it will tell you all about it, including if the image has JFIF or EXIF segments added.

If anyone has questions about the above code, please don't hesitate to ask.

Hope this helps some of you, since I could not find any solution out there.

Friday, November 16, 2012

Show hidden files on Mac

To make hidden files visible in Finder, run this command in Terminal
defaults write AppleShowAllFiles -bool true
To hide hidden files again in Finder, run this command in Terminal
defaults write AppleShowAllFiles -bool false
Run this command to restart Finder, so that either one of the above commands will take effect ( Don't worry, Finder should restart with all of your previous windows open again )
killall Finder

Wednesday, May 11, 2011

Fixing DNS issue on MacBook Pro

This may be an issue with 10.6(Snow Leopard) altogether or just with the MacBook Pros, but every once in a while the internal DNS settings get hung up or crap out or just stop working!

You're connected to the internet, you've checked the connections, you've got on other devices , you've asked co-workers if they are having issues with the internet, you've pulled your hair out, banged your head against the wall, you get my drift.

Whatever you do or try your $2000 MacBook Pro will not do one simple thing CONNECT TO THE INTERNET!!

Hopefully this solution will work for some of you and save the hair on your head.
Run these commands from terminal(copy command from sudo to plist):

sudo launchctl unload /System/Library/LaunchDaemons/


sudo launchctl load /System/Library/LaunchDaemons/

and bingo bango everything is just peachy again!

Wednesday, April 20, 2011

CFBuilder 2 Tour comes to Nashville this week!

WHEN: Thursday, April 21st, 2011 at 6:00pm CDT

WHERE: Russ Carroll Financial Peace Conference Center,1749 Mallory Lane, Brentwood, Tennessee 37027
Map of Location

SPEAKER: Greg Wilson - Adobe evangelist for AIR, ColdFusion, Flex and LiveCycle ES

WHAT: Greg Wilson from Adobe will be here to talk about CFBuilder 2, ColdFusion, and even some Flex on mobile stuff, including Flex on iPad/iPhone! We are SUPER excited to have the opportunity to get the surrounding ColdFusion and Flex communities together for this event. Greg Wilson is an AIR, ColdFusion, Flex, and LiveCycle ES evangelist at Adobe, and many of you may remember him from the ColdFusion 9 tour a couple of years ago.

HOW: Register at the Nashville ColdFusion User Group site.
RSVP for this meeting ...

Tuesday, August 18, 2009

Flex getItemAt() function vs Array Notation

Just a quick tip I found while doing some debugging on a Flex project I am working on.

myArray.getItemAt(0).firstname and
return the same value, the getItemAt() function will save you ten steps. By ten steps I mean that 10 steps after the compiler hits the line that says myArray[0].firstname, it will run the getItemAt() function anyway. It is doubtful that you will see any significant performance gains out of this.

So, it may take more time to type out the getItemAt() function over array notation, but it processes quicker.

Tuesday, June 9, 2009

Adobe ColdFusion tour coming to Nashville!

WHO:Greg Wilson (an AIR, ColdFusion, Flex, LiveCycle ES evangelist      at Adobe)

WHAT: Greg will be discussing new features in ColdFusion, how      ColdFusion integrates with other Adobe technologies like AIR, Flex      and LCDS.

     Also, Greg will be showing some demo's of the new features that      are going to be in the next ColdFusion release.

     There will be food, drinks and of course prizes/giveaways that you      don't want to miss.(<cfhint = you have to be registered to be      eligible for giveaways!>)

WHERE: Russ Carroll Financial Peace Conference Center,1749 Mallory      Lane, Brentwood, Tennessee 37027
     Map of Location

WHEN:Thursday, June 18, 2009 at 7:00pm CDT

HOW: Register at the Nashville ColdFusion User Group site.

Wednesday, March 25, 2009

Try/Catch in OnError function of Application.cfc

So you're stoked that you switched to application.cfc and you wont have to see those hard ColdFusion errors since app cfc has the OnError function? Sorry to bust your bubble, but what if your OnError function throws an error(referencing a variable that isn't present for example)? Then what? That's right, a hard ColdFusion error will be shown and hopefully you were smart and turned off the Robust Exception option in the ColdFusion Administrator! :)

To remedy this situation you could add in a try/catch block right there in the OnError function. A more generic process could be put in the catch block that perhaps should never throw an error, something very simple that doesn't reference any variables that may not be present.