Blog Projects
Escape Keys
A ColdFusion and Web Development Blog by Tom de Manincor
 
YUICompressor CFC v0.1 Released

If you are looking for ways to minify, optimize, and compress your CSS and Javascript with ColdFusion, this is an all-in-one solution based on the YUI Compressor Java library.

It's simple but powerful.

The project and code: YUICompressor CFC @ RIAForge

There is some sample code included with the download package.

project: YUICompressor CFC
author: Tom de Manincor
version: 0.1.1
date: 2/18/2010

-overview-
This CFC allows you to use the YUI Compressor Java library.

"The YUI Compressor is a JavaScript compressor which, in addition to removing
comments and white-spaces, obfuscates local variables using the smallest
possible variable name. This obfuscation is safe, even when using constructs
such as 'eval' or 'with' (although the compression is not optimal is those
cases) Compared to jsmin, the average savings is around 20%.
The YUI Compressor is also able to safely compress CSS files. The decision
on which compressor is being used is made on the file extension (js or css)"


This CFC adds some more flexibility. It accepts an input string or a file, as long as its valid JS or CSS.
You can also choose to return the compressed results back as a string or a file.

It is using the YUI components for both CSS and JS.
For more information on the YUI library visit:
http://developer.yahoo.com/yui/compressor/

-requirements-
ColdFusion 7 or Higher
JavaLoader (optional)
YUI Compressor Java Library (version 2.4.2 included)

-usage-
The constructor (init method) is required if using inheritance (ClassLoaderAdapter).

Since this is dependent upon the YUI Java library,
I have integrated a ClassLoaderAdapter that allows you to toggle between JavaLoader
or the CF native ClassLoader that will use libraries found in your CF class path.
Remember, if you are not going to use JavaLoader then make sure you put the yuicompressor-2.4.2.jar in your CF class path.
If this is the approach you choose you also have the option to discard the ClassLoaderAdapter.
Instead of using the YUICompressor.cfc and the ClassLoaderAdapter.cfc, rename and use the included YUICompressor_noinheritance.cfc.

-note-
Do not use the additional libraries that are bundled with the base jar. String Index out of range errors may occur.

-credits-
Joe Roberts

0.1 -INITIAL RELEASE- 2/18/2010
-JS and CSS compression supported
-auto detect input type
-allow input files or string
-output to file or string

I finally had the chance to install the latest Railo CFML Engine on my Centos 5.4 VirtualBox VM. I found a few good resources online, but still came across a few kinks, so I'd thought I would put together a recap including the work arounds.

Before you begin, you must have a Java 6 JDK installed. If you don't already you can get it from the Sun Java Download Page

Note the installation path. For this example, I will be using:

/opt/jdk1.6.0_17

There are a few Linux dependencies. I never like to install things I don't need, so I avoided the suggestion to install all 'Development Tools' from the Centos Add/Remove Software feature. Instead I used yum to install the noted packages. Later, adding to that list as I dealt with errors during the installation.

My compiled list so far: automake autoconf binutils gcc libtool httpd-devel openssl-devel lynx

I may have had others already installed, so if you find any that are not on the list, please post them.

Here is the command line to install them all:

yum install automake autoconf binutils gcc libtool httpd-devel openssl-devel lynx

Once yum has done it's thing and all packages have been installed or updated, our system is prepared. Let's get Railo installed.

First, we need to extract our installation package. If you haven't downloaded one already, they are available at the Railo Download Page.

For this example, I have moved the tarball into the opt directory, where I will be installing Railo.

tar -xzf /opt/railo*.tar.gz

Clean up and remove the unused files:

rm railo*.tar.gz
cd railo
rm -rf httpd.exe install-service.bat remove-service.bat setup.exe win32
cd ..

The next part is a matter of preference. You can leave the Railo folder name as is, create a symbolic link, or just rename it.

In some situations, you may require multiple versions of Railo running but prefer one as the default. Symbolic links work nice there.

ln -s railo-3(hit tab to auto complete folder name) railo

#version specific
ln -s railo-3(hit tab to auto complete folder name) railo3

Another option is a Simple rename:

mv railo-3(hit tab to auto complete folder name) railo

#version specific
mv railo-3(hit tab to auto complete folder name) railo3

Railo is now unpacked, and just needs to be integrated with Apache Web Server. It has a few scripts that do the heavy lifting. We need to configure and build the connector module Apache will use. This is where most of the earlier described linux dependencies are involved, so keep an eye out for any error messages.

cd railo3
./configure --with-java-home=/opt/jdk1.6.0_17 --with-apxs=/usr/sbin/apxs

It was mentioned to look for "checking for JNI in /opt/soft/java/include/linux ... found". That being an indicator of a successful build. Unfortunately, this is one of the areas, I had a number of errors, and even saw the correct JNI message. Hopefully, the list above of dependencies covers it, and you don't see anything unexpected here. I was able to get away with a AC_PROG_LIBTOOL undefined error. I checked to make sure libtool was installed, and it was. Everything worked beyond this point, if you see this don't be alarmed.

The next step, is to actually build the module file and have it installed with the other Apache modules. Before we can do this, we need to create a few symbolic links to take care of an installation bug.

cd /opt/railo3/modules/c/src
ln -s resin resin_os
ln -s resinssl resin_os
cd /opt/railo3

Now create the file using the distributed automake files:

make

The Apache integration is automated, as well:

make install

I had to make a few changes to my Apache configuration files, since I also have Adobe CF 8 and CF 9 running on the same machine. If you don't this will still work, and is a good practice. It keeps Railo isolated, and the more familiar you are with Apache the more you will see how flexible this approach is.

Open the Apache conf file /etc/hettpd/conf/httpd.conf. Look for the lines:

#
# mod_caucho Resin Configuration
#
LoadModule caucho_module /usr/lib/httpd/modules/mod_caucho.so
ResinConfigServer localhost 6800
CauchoConfigCacheDirectory /tmp
CauchoStatus yes

I created a virtual host for Railo and moved the added lines into it:

<VirtualHost *:80>
ServerName centos54r3
DocumentRoot /mnt/dev/src
LoadModule caucho_module /usr/lib/httpd/modules/mod_caucho.so
ResinConfigServer localhost 6800
CauchoConfigCacheDirectory /tmp
CauchoStatus yes
<Location /caucho-status>
SetHandler caucho-status
</Location>
</VirtualHost>

Keep in mind, a few of these values are specific to my setup. The ServerName and the DocumentRoot will vary.

I also added the Caucho Status location. It's a nice reference, and also a good test page.

Almost there...

Let's update our Railo instance so that it is in sync with our virtual host. Edit the /opt/railo3/conf/resin.conf. You can add your own host definitions in here, but for now I just updated the default host entry. It now points to the DocumentRoot of my Apache virtual host.

<host id="" root-directory=".">
<web-app id="/" root-directory="/mnt/dev/src"/>

One last step before we can start up the resin server. We need to add a few values to the start up script. Open up /opt/railo3/bin/httpd.sh in a text editor and add your JAVA_HOME and RESIN_HOME paths after the initial comments or anywhere before the beginning of the script.

JAVA_HOME="/opt/jdk1.6.0_17"
RESIN_HOME="/opt/railo3"

Now it's time to fire up the Resin server:

/opt/railo3/bin/httpd.sh start

To test your installation open the Admin URL from your client browser: http://virtualhostname/railo-context/admin.cfm For example, http://centos54r3/railo-context/admin.cfm

** Virtual hosts require entries in hosts file for the URLs to resolve. If you are not familiar with Virtual Hosts, please check the Apache docs.

Thanks to the Railo team for the initial resources:

Railo, Resin, Apache, and Linux PDF

Installing Railo on CentOS

I wrote an article awhile back, No More WAR, demonstrating how to set up CF 7 and 8 without using the WAR files. Instead, I used CF in stand-alone mode and Apache's Virtual Host configurations to create separate environments, that could run side by side.

I wanted to see if anything had changed with the JRun config that this technique depends on in CF 9. Fortunately, things remain the same in that department. The method is still applicable, and I am currently running: CF 7, 8, and 9 on both Linux and Windows platforms running Apache Web Server.

Why stop there? Let's add Railo 3.1 to that list. For instructions on how to integrate Railo with Apache, check out this post.

Bringing the power of drop.io to ColdFusion.

drop.io is a handy cloud collaboration tool.

To quote drop.io:

"Use drop.io to privately share your files and collaborate in real time by web, email, phone, mobile, and more."

"With the drop.io API, your app can leverage our core web-services to share what you want, with whom you want, how you want. Anything you can do with the drop.io interface, you can do via the API, so you can develop powerful extensions to the drop.io service, or cherry pick specific functionality from drop.io for your apps."

Check out their web interface drop.io.

To use drop.io with ColdFusion, I've posted the project DropIO CFC @ RIAForge.

The download package includes a sample application, as well.

To find out more about working with drop.io check out the developer page.

Project 'readme.txt':

project: DropIO CFC
version: 0.1
date: 2/5/2010

-overview-
This CFC allows you to connect and work with drop.io's API.

-requirements-
ColdFusion 7 or Higher
drop.io API Key (free - http://api.drop.io/)

-usage-
The constructor (init method) is required.
There is a dependency on Javascript libraries for file transfers.
See the included js folder and code examples for integration.

To setup the code samples provided,
place your drop.io API Key in the createObject call in the onApplicationStart method of the Application.cfc
Follow the instructions on the page.

-note-
drop.io Developer Page: http://dev.drop.io/

0.1 -INITIAL RELEASE- 2/5/2010
-supports the following drop.io API methods:
createComment
createDrop
createFile
createLink
createNote
deleteAsset
deleteComment
deleteDrop
getAsset
getAssetEmbedCode
getAssetList
getComment
getCommentList
getDrop
getUpload
sendAsset
updateAsset
updateComment
updateDrop
uploadFile
uploadResponse

SalesForceCFC has been stable, but there is always room for improvement. This version includes a few tweaks and clean up.

Download the code @ RIAForge

I would also like to put out a 'Call for Features' to put on the roadmap for 1.0

Some already suggested:
-support for SOQL sub/nested queries
-asynchronous HTTP calls

Please post your suggestions on the Forums @ RIAForge or just leave a comment here.

In addition, I will be including a base unit test collection to provide stability for future releases and customization. Along with improved documentation and code samples.

I'd like to thank Daniel Llewellyn and Pete Freitag for their contributions, as well.

0.7 -CHANGE LOG- 1/24/2009
- enhancement - added support for batch save
- enhancement - added support for AssignmentHeader
- enhancement - added support for EmailHeader
- enhancement - added result size to query return data
- enhancement - updated typing and case of component
- enhancement - increased default SOAP timeout
- deprecated - unnecessary setters (setServerURL,setSessionId,setLastLogin)

Speaking at NL CFUG - Battle of the Frameworks

Debating over the popular Coldfusion frameworks always leads to some interesting discussion.

Today, Model-Glue, Fusebox, and Coldbox will be facing off.

To introduce the code and theory, as well as the practicality each framework brings to the table, we will be presenting them with an application walkthrough.

Letting attendees see what's in the pudding and leave with the proof.

Check the NL CFUG Homepage for more information.

Location: Adobe HQ, Hoogoorddreef 54-A, Amsterdam

13:00 - 13:30 Binnenkomst
13:30 - 14:15 Coldbox - Tom de Manincor
14.15 - 15.00 Fusebox - Erik-Jan Jaquet
15:00 - 15:30 Pauze
15:30 - 16:15 ModelGlue - Jochem van Dieten
16.15 - 17.00 Discussie frameworks
17:00 - 18:00 Borrel / Netwerken

With a week left before the Coldbox 101 + Workshop here in Amsterdam, we have decided to extend the Early Bird pricing and offer a DISCOUNT, as well.

Early bird tickets are 1200 Euro ($1755 USD) and will be available until October 21st.

Use the discount code: CB_AMS_LM and receive a 200 Euro discount ($300 USD).

Where else can you get a 2 day training and a 1 day hands on workshop for 1000 Euro?

Not to mention, you will leave inspired and with plenty of resources and materials that will help you continue to expand your skill set indefinitely.

I apologize to those who have already registered, but we will also offer a retroactive discount for referrals. If you know someone who may be interested, now is the time to push. Have them mention your name and get 10% of their final ticket price. That applies to each referral. Yes, they are allowed to use the discount code above, but remember the kick-back is 10% of their ticket price.

UPDATE: Coldbox 101 Amsterdam

Registration issues have been resolved. Due to issues accepting payments with PayPal, and hosting an international event, tickets must be sold in USD and processed with Google Checkout.

The registration page has been updated: Coldbox 101 Amsterdam @ eventbrite

More news about the event:

Luis Majano, the creator of Colbox, will be joining us via Video Conferencing for a Meet and Greet. He will also talk about what's new in the latest version.

Each attendee will receive a Coldbox Training Manual (over 300 pages), along with an Exercise Booklet (just under a 100 pages), and some nice schwag (bag,t-shirt,etc).

UPDATE: Coldbox 101 Amsterdam

If you have tried to purchase tickets, but run into errors when checking out using PayPal, please bare with me. The alternate payment methods are also not functioning. I have been working with EventBrite and PayPal to determine the cause and find a solution...

I apologize for the inconvenience, and appreciate your patience.

In the meantime, it will be a manual process. To reserve your seat use the contact form and specify the attendees full names and email address.

You will receive an EventBrite ticket and a Paypal Invoice.

I am happy to announce the location of our first ColdBox Europe training here in Amsterdam.

Thanks to Ernst van der Linden, of Team Coldbox and BehindThe.net, along with the crew at RemuNet Services for offering to host the event.

The facility is in the heart of town, and has the real Amsterdam feel.

You can check it out on Google Maps:
Keizersgracht 83A
Amsterdam 1015 CG

The affiliation has also allowed us to offer the 3 DAY course for a discounted rate of 1200 Euros (early bird - before Oct.14th) and 1500 Euros after the 14th.

So spread the word and sign up soon, seating is limited.

Registration and Event Info at cboxams.eventbrite.com

More Entries