0

Coldfusion Debug and Heap Space Errors

Coldfusion, Railo

I was writing a quick script today to clean up some data for an import using Coldfusion 8.  It runs a single query and then loops over the results updating a different table.  Now before you roll your eyes I know this is not the best way to do this, but I needed it done quickly.  When I would run the page it would stop with a 500 Heap space error and Coldfusion would die.  I couldn't figure it out so I decided to try it on a development copy of Railo.  The page didn't finish, but I got a Debug out of memory error.  Which pointed me in the right direction.  I added in <cfsetting showdebugoutput="false"> and the page ran perfectly in Coldfusion 8 and Railo.

This is a good reason you should never have debug turned on in Production :).  Extra kudos for the Railo guys though.  Railo stayed up and working and also give me the debug information I need to figure out what the heck was going on.

 

0

MYSQL Slow Subquery using IN

Coldfusion, mySQL

I finally found the correct information today to figure out why some kinds of subqueries take forever to come back in mysql. If you are using a subquery with a MYSQL IN() like this:

select o.ack,o.product
from orders o
where o.ack in (
select distinct ack
from 	orders
where  	status in ('Shipped','Cancelled')
group by ack
having 	DATE_ADD( DATE_SUB( now( ) , INTERVAL DAYOFMONTH( now( ) ) - 1 DAY ) , INTERVAL -3 MONTH ) > max(status_date))
)
order by o.ack, o.line

 

It takes a few minutes to return a result. If you take the same query and reorder it to put the subquery in the from with a join it comes back almost instanty :

select o.ack,o.product
from orders o
inner join (select distinct ack
from 	orders
where  	status in ('Shipped','Cancelled')
group by ack
having 	DATE_ADD( DATE_SUB( now( ) , INTERVAL DAYOFMONTH( now( ) ) - 1 DAY ) , INTERVAL -3 MONTH ) > max(status_date)) old_o
on o.ack = old_o.ack
order by o.ack, o.line

It's interesting on MSSQL that the IN() subquery syntax is much faster.

Here's a link to the bug report:

bugs.mysql.com/bug.php (Thanks Jeremy Pointer :) )

tags:
MySQL, Subquery, Slow
0

Mysql Joined Updates

Coldfusion, mySQL

I can never seem to remember the mySQL syntax for JOINED updates when I need them and the mysql documentation on their site doesn't help a whole lot. Then I always forget what the exact phase to google for. (Joined updates, multi-table updates, updating from one table to another, etc..)  I found some great examples over on the electictoolbox that makes it dead simple.

So I am posting it here as a reminder later on , and in case someone else was wondering how to do it and couldn't find it.

ELECTRICTOOLBOX JOINED UPDATE EXAMPLES

 

0

Coldfusion Hates the New Macbook Pro

Coldfusion

I was very excited my New Mac Book Pro got here yesterday. It is so much faster than my old G4 Powerbook :). My old laptop wrote a lot of great code and it will be fondly remembered.

I was rolling along getting my music and mail copied over ( important stuff first :) ) and having a grand time with the new multi-touch track pad. That I thought I would brave the install of Coldfusion on Leopard.

I figured since there were posts going back to OCT 2007 I'd be safe, by getting my laptop now. How wrong I was. After 7 hours of not working and trying all of the blog posts and suggestions the web had to offer I had almost given up. When I came along this blog post with a video :

www.flashalisious.com/2007/12/14/installing-coldfusion8-on-leopard-using-mamp/

Well that worked after many hours of frustration so kudos for figuring this out and saving the day.

On a side note the weakest part of coldfusion since they have switched to java has been the installer. Even on linux systems they do offically support. I think it really hurts us as a developer community. It's fine if Adobe doesn't support every operating system in th world but it should at least install and function for development. And they do support OS X just not this version. I would have expected them to have had a fix for this by now. It's a huge barrier to developers even more so than the costs associated with buying the server. My New Mac came already working with PHP ....

Oh well off to setup CFECLIPSE :)

*Update 3/19/2008 - I got an email from Adobe for the Beta Test of CF8 Beta 1 waiting to get the download.

0

Fun with Dabble, S3 and Coldfusion

Coldfusion

Well another project done and set live today. We just released a new site for one of our furniture manufacturing clients: Solutions .

What's noteable and kinda fun is the technology behind this one. Our customer wanted a web presence quickly to showcase their products. The only information they had were EXCEL spreadsheets ( everything is always in excel :) ).

So what do you do?

We decided to try out some cool web based services to help them out.

Step 1: Imported all the product information into Dabbledb.

Step 2: Edited the products in Dabbledb and add any missing information.

Step 3: Used CFJSON and CFHTTP to pull the product information into MYSQL.

Step 4: Used the Amazon S3 component and a simple CF interface to resize images and store them in S3 based on product information.

STEP 5: Code the Screens using Coldfusion and Fusebox.

We decided to pull the information out of dabble and store it in MySQL to run the site so we could write the queries for the site in plain SQL. Dabbledb is really powerful for manipulating spread sheet data and saved us the time and our customers the cost of building a front end for marinating product information. We are using a custom script I wrote for ImageMagick for resizing the images. The java ones never seem to resize small thumbnails very well. Although i haven't played with the CF8 ones yet.

This project reminds me how great a community we have of CF developers. CFJSON,S3 and Fusebox are all thanks to them.

tags:
ColdFusion
0

Our First Reactor Site

Coldfusion

We'll we finished our first Reactor based website. It was a flat HTML site we upgraded to Coldfusion/Fusebox/Reactor/MYSQL with some basic CMS updates for links and content.

Before

After

It went pretty well. I wish the documentation for Reactor was more up to date. maybe if I have time this week I'll post about a few things I learned to help out others. I'm deep into my next reactor project already.

This project was the first one we used JQUERY on also. I have no idea how I got along so long without it. It is pretty fantastic and has really good documentation.

EDIT: For a test we used JQUERY for the Mouseovers on the main page. We were going from an premade FLASH design to HTML. So we made the Animated Gifs and swap them with the black and white images. The text on the main page is also swapped with JQUERY. Most of the JQUERY stuff is in the administrative section of the site to help manage the forms and links.

Since JQUERY lets you bind events to objects when pages load I have changed the architecture of our fusebox sites to include a dsp_jsp.cfm file for each page. This is included in the $(document).ready() section of the page via content variables. It's much better than all the JS cluttering up the HTML in our displays. In the future I might try and do something slick to have it as an include instead of stuck at the top of the page.

 

tags:
ColdFusion

Search

Jeff   Roberson