Coldfusion

Friday, April 01, 2011

CFX_GZIP - compress and decompress gz libraries with Coldfusion

CFX_GZIP is custom tag written in C++ as a DLL for the Windows Platform.  I recently needed a way to decompress some .gz files on my server and this did the trick for sure.  This article is about how to install it because the documentation does not include this part.  Installing CFX Tags is very easy as you will soon find out.

Step 1.  Go to the Coldfusion Exchange on adobe.com, here.

Step 2. Download the zip file. (You may have to login with your adobe username/password. This extension is free.)

Step 3. Extract the contents of the zip file. (You should have 1 .DLL file and 1 index.cfm file.)

Step 4. Next you’ll need to place the .DLL file on your server. Either use remote desktop or ftp to upload it.  I used Remote Desktop and dropped the .DLL into the C:\ColdFusion8\cfx\ folder on my server.

Step 5. You’ll need to access the Coldfusion Administrator, Click the Extension, Click CFX tags.

Step 6. Click Register C++ CFX.

Step 7: In the Tag Name field type “cfx_gzip”.

Step 8. In the Server Library .dll field, copy and paste the path to the DLL file. My path was C:\ColdFusion8\cfx\CFX_GZIP.DLL.

Step 9. I opted to note mess with Procedure or Description and i kept the checkbox “checked”.

Step 10. Press Submit.  And you’re all set to start using the tag.

Posted by robbiegod on 04/01 at 06:15 PM
Coldfusion • (0) Comments • (46) TrackbacksPermalink

Friday, March 26, 2010

Force download of media files

Excellent Article

Posted by robbiegod on 03/26 at 04:43 PM
Coldfusion • (0) Comments • (77) TrackbacksPermalink

Friday, March 19, 2010

Coldfusion Tips-03-19-2010

I got two simple coldfusion tips for you.

1. Tip #1: See my previous post about Coldfusion issue when if you use SELECT * in your cfquery and then say you add a row to that table. That changes the query because you have now added another row for CF to grab. Apparently, CF doesn’t like that at all. It throws an error. All you have to do to fix the issue is Restart Coldfusion and then your site should be back up. I know it sucks, i shouldn’t have to restart CF when i add a new column to my table. Seems silly. And, I know SELECT * is not the correct or best way to write your query. You should always write out all of the columns and rows from all of the tables you are querying. The reason I am using SELECT * is because I want this query to work across multiple sites under different domains. I don’t want to have to go back and change every single query when i add a new column.  That’s why i am doing it this way.  One other added piece of information i should add here is that the error from coldfusion only occurs when you use cfqueryparam in your queries.  CF must cache the query.

2. Tip #2: IF you have a Thankyou page that appears after you submit a form and you want to lock the page down be sure to add this little snippet of code at the top of your page. Say you have a form that accepts FirstName, LastName and EmailAddress.  All of these are required. Pick one (or more) of the fields.  At the very top of your page put this code:


<cfif NOT IsDefined(‘form.FirstName’)>
<cflocation url=“index.cfm” addtoken=“no”>
</cfif>

IF someone comes to the page and they try to see what you got without submitting your form they will get redirected to your homepage.  Also, wrap the form.FirstName variable in single quotes.  You need those. If you don’t use those, you will get a coldfusion error.

Hope this helps someone out there.

Posted by robbiegod on 03/19 at 06:56 PM
Coldfusion • (0) Comments • (13306) TrackbacksPermalink

Saturday, March 06, 2010

Coldfusion Error: Value can not be converted to requested type.

Have you ever encountered this error? Well I did today. It wasn’t the first time either.  In my SELECT statement I was using “SELECT * FROM tblname WHERE ID =

Seems coldfusion has a problem with this after I added a new column to the table i was querying.

The solution is when you write your SELECT statement you should not use *. Instead consider listing out each and every column name in your query.  This will prevent the error from occuring, but if you ever add another column to your table you have to rewrite that query. That kinda sucks.

You can also remove the cfqueryparam from your SELECT statement and that will fix it too (actually this is what I think is the root of the problem because the query runs perfectly without cfqueryparam - it only breaks when i’m using cfqueryparam and i modify the table.)

Read this article on this error:
http://www.bennadel.com/blog/194-ColdFusion-Query-Error-Value-Can-Not-Be-Converted-To-Requested-Type.htm

enjoy.

Posted by robbiegod on 03/06 at 04:41 AM
Coldfusion • (0) Comments • (40) TrackbacksPermalink
Page 1 of 1 pages