Combine and compress your javascript files: Scriptalizer.com
ColdFusion, Internet, Web Development, JavascriptAfter creating a custom tag and minifier component (using YUICompressor) I decided it would be a pretty neat service to offer to everybody. Last night I scrounged up a website and called it Scriptalizer.com.
If you want to test what cf_scriptalizer does to your javascript before you actually use the tag, you can try out the generated script provided by Scriptalizer.com.
NOTE: All source files uploaded is immediately deleted once generated.
Problem: WAY too many javascript files. Solution: cf_scriptalizer
ColdFusion, Internet, Web Development, JavascriptWe all know JQuery is awesome right? That should be common knowledge by now. But, if you have ever created an app that makes use of several of the fantastic plugins available for JQuery, then you are going to end up with multiple
So, why is this a problem?
First of all, there is a little bit of bloat going on in this scenario. One could easily end up with over 200Kb of javascript in an assortment of these files. The other thing to consider is that the browser can only make so many concurrent connections to the web server (each external javascript file is one connection by the way) so add all of these files, a bunch of images, a couple .css files and we are making that user wait longer than really necessary.
Lets reduce the number of browser - to - server connections.
That seems easy enough. Instead of multiple external script calls:
<script type="text/javascript" src="/js/jquery/jquery.js"></script> <script type="text/javascript" src="/js/jquery/jquery.form.js"></script> <script type="text/javascript" src="/js/jquery/jquery.jqModal.js"></script> <script type="text/javascript" src="/js/jquery/jquery.history_remote.pack.js"></script>
We could combine them all into one big javascript file and reference it:
<script type="text/javascript" src="/js/myBigScript.js"></script>
Well what happens when you want to make a change to one of the source js files? Or you need to change the order of how the files are included? Or maybe the javascript files needed vary based off of where you are in your app and you don't want to include ALL of the files every time? Thats where I think I can help...
I have just recently (as in today) finished up a custom tag to do just that. For lack of a better name I called it
<cf_scriptalizer filePrefix="myscript" scriptalizerDirectory="/js" scriptFileList=" /js/jquery/jqModal.js, /js/jquery/jquery.js, /js/jquery/jquery.MultiFile.js, /js/jquery/jquery.blockUI.js, /js/jquery/jquery.corner.js, /js/jquery/jquery.form.js, /js/jquery/jquery.history_remote.pack.js, /js/jquery/jquery-dom.js " reload="true" >
- filePrefix (optional): prefix of the generated javascript file. "scriptalizer" by default
- scriptalizerDirectory: relative path to the desired output location
- scriptFileList: list of js files in the order you would include them
- reload (optional) - scriptalizer will inspect each js file for changes made since last access
More about reload: When/if you pass reload=true, <cf_scriptalizer>
Now that we have reduced the number of connections for external javascript files down to just one for this request, what can we do about reducing the size.
<cfset minifier = CreateObject("component","com.cfyuiminifier.cfYUIMinifier").init(path="/com/cfyuiminifier")/>
<cf_scriptalizer
filePrefix="myscript"
scriptalizerDirectory="/js"
scriptFileList="
/js/jquery/jqModal.js,
/js/jquery/jquery.js,
/js/jquery/jquery.MultiFile.js,
/js/jquery/jquery.blockUI.js,
/js/jquery/jquery.corner.js,
/js/jquery/jquery.form.js,
/js/jquery/jquery.history_remote.pack.js,
/js/jquery/jquery-dom.js
"
minifierObject = #minifier#
reload="true"
>As you can see, I am passing in the object "minifier" that contains the method minify() that accepts a string of all of the comibined javascript and returns a string of the minified javascript.
This additional component was abstracted from the custom tag itself just in case the user has some issue with YUICompressor or wants to implement his/her own solution to compress/clean/minify/etc the source javascript.
In this example, the combined jquery files resulted in a 123.1 KB javascript file (pre-minification). But, once cfyuiminifier.minify() was run on the source, we ended up with a combined javascript file that was only 79.7 KB!
CAVEATS:
I have not yet run this on any live sites.
This is brand new code from my scribble pad, so please be aware you may encounter some bugs!
This was developed on my Linux machine and haven't tested it anywhere outside of this environment.
DOWNLOADS:
If anybody has any specific requests for features, or would like to contribute please let me know. I wrote this in an attempt solve a specfic need for some applications I have been working on, and ended up with something I thought might be beneficial to others. Please report back with any successes (or failures) with this tool...I am very interested in hearing about your experience(s).
InstantSpot.com is open for business!
InstantSpot News, ColdFusion, Marketing, InstantSpot 2.0
You might have noticed, ever since our Version 2.0 release, InstantSpot account creation has only been available for those with a valid invitation code.
Well, that is a thing of the past.
Thanks to all of our testers/users for helping us sort through any bugs encountered along the way. As always, if any issues are encountered please feel free to contact me directly or use the link in the control panel to report problems.
So what are you still doing here??! Go create your 'Spot now!
Create a custom pod with Sproutbuilder
ColdFusion, Internet, Technology, InstantSpot 2.0
Sproutbuilder is a new application that recently rolled out in a beta status. Basically it allows you to create widgets in a pretty nice Flex interface.
From their howitworks page:
Building a sprout is easy. Choose from dozens of pre-built templates or start from scratch. Drag-and-drop shapes, text, images, video, and more. Then add components such as slideshows, jukeboxes, and countdown clocks, as well as interactive services such as chat (Meebo), phone (Ribbit), fundraising (ChipIn), and more. Once you’ve got your content in place, use advanced editing and navigation tools to perfect your sprout.
Ultimately you end up with an embed code, like this
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="180" height="171" id="sUAAKe0cDAJqAatXf"><param name="wmode" value="transparent" /><param name="align" value="middle" /><param name="bgcolor" value="#ffffff" /><param /><param name="movie" value="http://farm.sproutbuilder.com/17661/load/UAAKe0cDAJqAatXf.swf" /><embed type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="http://farm.sproutbuilder.com/17661/load/UAAKe0cDAJqAatXf.swf" width="180" height="171" wmode="transparent" align="middle" bgcolor="#ffffff" /></object> <img style="visibility:hidden;width:0px;height:0px;" border=0 width=0 height=0 src="http://counters.gigya.com/wildfire/CIMP/Jmx*PTEyMDE3OTA5NTUxMDcmcHQ9MTIwMTc5MDk1NTY5MSZwPTEyMDc*MSZkPTE4MjgyJm49.jpg" />
Now, to add it to your InstantSpot site...gotta tie that in right :)
Log in to the control panel and click on the Widgets section.

Then, once you are there, you can click to add a pod, reorder, deactivate, etc...

Then, on to the end result...go look at your Spot.

CFUNITED 2007: Step One - Get There
ColdFusionEarly Morning
The alarm clock goes off at 4:30 AM Tuesday morning. There I am, for a moment wondering what must have caught on fire for me to be awake at that terrible hour. but then I realized I had to be at Park Central Surgical Center at 5:45 AM in order for my son to have surgery! After several hours there (everything went perfectly btw) it was time to go home and get ready to head to the airport.
Getting There
My flight to Dulles was scheduled to depart at 4:15pm and touch down around 8:15pm, where I would be picked up by Enterprise and delivered to my rental car. I usually like to get to the airport a couple hours before take off, just to be sure I don't have any issues parking, getting through security, etc. So, around 2pm I roll through security with no issues (small blessings right?) and start waiting. And waiting. Apparently mother nature didn't like the plan, and proceeded to bring the pain on DFW.
I think somewhere around 200 flights were cancelled Tuesday night, luckily mine was not one of them. My flight was just delayed from taking off until around 7:40pm, placing me on the tarmac at Dulles around 11pmish. By the time I got my bag, and found the place where Enterprise was supposed to pick me up it was near Midnight. I waited and watched the Avis, Dollar, Alamo, National, Hertz, and Thrifty shuttles come and go over and over...for about an hour. It was then when I started realizing Enterprise wasn't really coming. Just as a last ditch effort I tried calling them...ALL of them! World Wide numbers, local numbers, road side assistance even! and I never could actually talk to a human.
I decided to just go ahead and get a cab to the hotel, it was a good 30 minute drive but I was tired and all of the other rental car companies were sold out anyways. So, lucky me I pulled the short straw and got the nice young Ethiopian taxi driver who was either drunk or very tired. And we embarked on a "thrill ride" swerving across lanes, speeding up to 80mph then dropping down to 50mph at no predictable interval. I wonder if he realized that I wasn't really interested in where he came from, but the only things I could try to talk to him about (to keep him awake!) was about Ethiopia (their form of currency is called a Birr, did you know that?) :|
Luckily, I made it here in one piece. Got a little bit of sleep. And made it to the key note speech only a few minutes late.
Thanks to Todd Sharp for giving me a ride to the conference!!!
It Was Worth It
Yes, it was worth the trouble getting here. Afterall, that is just something that can happen when you travel and after today's sessions (Wednesday) and getting to meet a few of the people I email with/read their blog/etc it has been a great experience.
Get to the Good Stuff
I have some notes that I took during my sessions today, and since its way too late to be first (thanks to Todd and Matt W.) :) I will do some summary posts for each day.
ColdFusion MX 7.0.2: Hot fix for IllegalStateExceptions in ModuleTag
ColdFusionGreat news to those of us who have been experiencing the illegalStateExceptions and the related corrupted/truncated cfquery calls. Adobe just released a hotfix for ColdFusion MX 7.02.
Get the fix here: http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=kb401830
***EDIT*** New Link (thanks for the new link Rich): http://kb.adobe.com/selfservice/viewContent.do?externalId=kb402002&sliceId=1
This was issued to resolve the strange behavior I blogged about here: Corrupted queries in ColdFusion MX 7
(Issue documentation from Adobe.com)
Issue
Adobe has resolved an issue with IllegalStateExceptions thrown intermittently by ModuleTag. The stacktrace generated is similar to the following:
java.lang.IllegalStateException
at coldfusion.tagext.lang.ModuleTag.doAfterBody(ModuleTag.java:439)
at cfindex2ecfm842540228.runPage(C:\InetPub\wwwroot\IllegalStateException\index.cfm:18)
at coldfusion.runtime.CfJspPage.invoke(CfJspPage.java:152)
at coldfusion.tagext.lang.IncludeTag.doStartTag(IncludeTag.java:349)
at coldfusion.filter.CfincludeFilter.invoke(CfincludeFilter.java:65)
at coldfusion.filter.ApplicationFilter.invoke(ApplicationFilter.java:219)
at coldfusion.filter.RequestMonitorFilter.invoke(RequestMonitorFilter.java:51)
...The scenario where this problem occurs typically includes the following items:
- Use of an application framework.
- Use of Application.cfc and OnRequestEnd or OnSessionEnd method.
- Calling methods on ColdFusion Components stored in shared scopes, often the application scope.
- The use of custom tags.
Secondary issues caused by the IllegalStateException are often resolved by application of the patch. These issues have included query truncation and invalid parameter binding errors with cfquery and cfqueryparam.





Loading....