60 More Ajax Tutorials

As I was searching for an Ajax example of how to accomplish a task that I am working on, I came across a posting by Max Kiesler entitled 60 More Ajax Tutorials, which is apparently a follow-up to an earlier post Round-up of 30 Ajax Tutorials.  In just a cursory browsing over the lists, there appear to be a ton of good examples there, although unfortunately not the scrolling paginated recordset example I need!

Adobe Keynote at CFUnited

Today was a great start to the conference.  After a brief welcome session by Michael Smith, it was Adobe’s turn to take the floor and give their keynote to start things off.  Ben Forta took the stage first and gave a mini-State of ColdFusion, followed by the official announcement (if you weren’t reading blogs at 12:01 last night) of the release of ColdFusion 7.02, Flex 2, and Flash 9.  He then spent a few minutes detailing the highlights of Flex 2, particularly in how it interacts with ColdFusion and how it is superior to its predecessor Flex 1.  And then.. the moment the Flex development community had been waiting for… the price!  Ben prefaced the price announcement by reminding the audience that Adobe has made assurances that it would be under $1000.00.  After a dramatic pause, he went to the next slide triumphantly and unveiled:

$999!

This was met with an obviously underwhelming response as Ben looked on with a grin.  Then in a moment reminiscent of Let’s Make a Deal, Ben went slide by slide at the urging of the audience whittling the price down $100 at a time until it reached:

$499!

This was met with a much more positive response from the audience…as I thought  “Did Ben just pull a used car dealer tactic on us?” :)

After the price announcement, Ben dove a little further into Flex and proceeded to demo some features, such as the Flex Application Wizard, which allows a developer to create a functional database driven Flex application in just a matter of a few clicks.  This is a pretty remarkable tool in that it creates a well formed “best-practices-for-now” MVC sample that immediately gives a new developer a good example to build their Flex applications from, including the creation of Bean and DAO components and the CFCs that Flex actually talks to.  The speed and effortlessness to make that happen is certainly impressive.

Although Ben’s presentation was rock-solid as always, I couldn’t help but recall Tim Buntel and Ben on stage the year before and I briefly wondered if Tim was missing being a part of the show this year.  Little did I know…

At the end of Ben’s presentation, he brought Jason Delmore to the stage, who is Tim Buntel’s replacement as the ColdFusion Product Manager.  Jason discussed the things to look forward to in Scorpio which as many know is the product that will eventually become ColdFusion 8.  He stated that he could not speak in great detail about much of the current development efforts, but he would offer some hints to the future.  He then very ambiguously offered up:

  • More Platforms
  • More Development Tools
  • Leveraging other Adobe Technologies

(shocking!)

One of the only real specifics he shared was a very cool feature, CFPDFFORM.  This tag will allow developers to populate PDF forms directly from their applications.  It also allows extraction of data from PDF forms.  He showed a working demo.  I did’t get all the attributes jotted down, but it looked much like this:

<cfpdfform>
<cfpdfformparam name=”foo” value=”bar” />
<cfpdfformparam name=”morefoo” value=”morebar” />
<cfpdfformparam name=”mostfoo” value=”mostbar” />
</cfpdfform>

Jason also announced the ability to create Breeze presentations on the fly and showed a simple dmonstration of this ability.  The new tag is:

<cfpresentation attributes-a-plenty=”" />

He made the comment that with CFPRESENTATION, there is no need to make screen captures ever again. It will be interesting to see how that plays out in the real world.

Then as things were winding down and Ben appeared to be wrapping up, the doors burst open and two Adobe employees were dragging a blindfolded guy to the stage who was yelling about how there must have been a mistake as his birthday was last month.  They pulled off the blindfold, slapped an Adobe shirt on him and the audience then welcomed Tim Buntel.  After a few moments of explaining how it came to be, Tim announced that he is the new ColdFusion Senior Product Marketing Manager.  Tim has a great energy and is very passionate about ColdFusion.  It is great to see that he is back on the team.

I have so many notes to translate to my blog from the day, but that about wraps my take on the Adobe keynote.

Dear Adobe, I want Flex too

I have been proudly exclaiming for the past month or so how I am a newly converted ex-Windows guy.  I haven’t found the need to run any Windows applications, but if I get in a pinch, I can run things like Photoshop using Crossover Office Pro.  Today is the first day that I really ran into a problem.  The problem is with lack of support for Linux by Adobe when it comes to Flash and Flex.   Like many of the other developers in the community I am really chomping at the bit to play with the official Flex 2 Builder (the price of which was announced during Adobe’s keynote this morning… $499!) and tie into ColdFusion 7.02.   In addition to the announcement of ColdFusion 7.02 and Flex 2 today, one of the quieter announcements was the official release of Flash 9.  “Great!” I thought…. I will go directly to that since Adobe never released a version 8 for Linux and I am still using 7.   It appears though, that once again Adobe is not releasing this version for Linux (at least at the time of this posting).   The best option for Linux users is still 7.

Now, in theory I can install the Windows Firefox under COO and then Install Flash 9  under COO as well and (I repeat… in theory) be able to access Flex apps.  I don’t know if this is true, but I suppose it is something I will  have to try.  But that solution is hardly the optimal way to go.

So… viewing Flex applications would be a start, but what about building them?  Flex Builder is only available for the Windows platform.  There is nothing for Macs and nothing for Linux.

After lunch I am going to drop by the Adobe booth and see if they have any insight on what we should expect as far as future supporting Linux (and Macs for that matter).  If I get any information of substance, I will update this evening.

EDIT:  I just found this post …… Early 2007?!?!??! <sigh>

CFUnited update

Today was my second and last day of pre-conference classes, and the conference officially kicks into high gear tomorrow.  I just wanted to give a quick update on what my experience has been so far.  This will certainly be a long post so I will bold the main topics so you can skim over any parts you are not interested in.

ME BITCHING
(you are really going to read this part?)  Just to get it out of the way, the travel experience getting here was absolutely unbelievable.  I was supposed to land at 9pm, but the airport was entirely closed for a couple of hours Sunday night.  We ended up sitting on a runway in Norfolk, VA with the engines off for a couple of hours waiting for things to open back up so we could make the 150 mile trip.  Upon reopening the airport, all of those planes that had been holding for hours on end arrived at the same time… a little after midnight.  I have rarely experienced the kind of chaos that I did in baggage claim that night.  In hindsight though, if I had to pick one highlight from the evening, it would have to be Thrifty Car Rental giving away my reserved car (“You were supposed to be here 4 hours ago.”).  After trying my hardest not to completely lose my cool, I convinced the guy behind the counter to give me one that was awaiting an oil change.  The people in line behind me were up a creek.

So, since arriving at the hotel at 3:00am that night….

EVERYTHING IS AWESOME
The first two days of classes have been really enjoyable. I have gotten to match a few faces to names, and have seen a few familiar ones as well. There have been probably close to 100 people here taking the pre-conference classes, but starting around lunch today many more people have started showing up… mostly popping up near the bar for some reason. At 8:30am tomorrow Adobe will give the opening keynote and the sessions will kick off. I will be starting with a 3 hour session “ColdFusion/Flex Coding Kitchen” which I am really looking forward to given my underwhelming amount of Flex knowledge.

PRE-CONFERENCE CLASSES
Day 1 -
Yesterday  I attended the “Testing ColdFusion” class from John Paul Ashenfelter.  He shared his presentation with the creator of cfcUnit, Paul Kenney, who gave a nice demonstration of how to go about unit testing your code using cfcUnit.  Until I really saw it in practice, I always understood how unit testing could be of value, but never had a good plan for implementing it in my development cycle. I actually put what I learned into practice immediately last night in the hotel room and found a bug in one of my components that is currently under development.  Very good stuff.

In addition to unit testing, John covered “site testing” from the perspective of the browser. He introduced us to Selenium, which is an extremely impressive testing tool. Using a plugin for Firefox, you can click through a site, and record things that you wish to test for (eg. “the title of this page should be ‘Dave Shuck’”). This will build a script…well it’s actually just HTML tables… that Selenium can then use to traverse through the test as a user and report errors. This is an extremely valuable tool that I will certainly be implementing quickly.

The third section of the class revolved around systems level testing, specifically with a demonstration of Grinder emulating the load of 100 users on his site. The only other load testing tool I have worked with previously was OpenSTA, and I found Grinder to be much more intuitive and helpful

If anyone is interested I will post my notes from this class.

Day 2 – Today I took Rob Gonda’s “Ajax for ColdFusion” class. In case you are not aware, he is the creator of AjaxCFC, which is a nicely implemented Ajax framework available for ColdFusion. About 30 people attended the sold out class, and Rob shared a ton of his knowledge of the world of Ajax. After a nice introduction about the basics of Ajax and a demonstration of the most simple XMLHttpRequest transaction that underlies the majority of Ajax frameworks, we went over code samples of a number Ajax frameworks and JavaScript libraries, including AjaxCFC, DOJO, JSON, Prototype, and Spry. I picked up a number of goodies and good ideas that I can immediately start dropping into existing code to quickly improve the user experience. Considering that I have been working with AjaxCFC about a week or two, it was nice to be able to see the creator of it demonstrating its use, and I picked up a couple of things that I could be doing more gracefully. He finished up the class by demonstrating the ModelGlue and MachII support that it now offers so. Even though Rob is a he is a strong advocate of Unity (not uncommon at this conference!), he actually walked through the MachII pieces as well. :)

So far so good. I will give an update after the official Day 1.

Off to CFUnited

I am leaving DFW for DC this afternoon.   If anyone is looking for me, I will be staying in the conference hotel tonight through Friday night.  Tomorrow I will be taking the “Testing ColdFusion” class from John Paul Ashenfelter, and  Rob Gonda’s “Ajax Intensive for ColdFusion Developers” on Tuesday, followed by the rest of the week’s goodness.   Hope to see some of you there!

Take time to get to know your framework

The more that I work with Reactor the more that I realize it has built in mechanisms to do many of the things that I instinctively try to hand roll around it.  Case in point is the iterator.  I have to admit that I never really took the time to look inside the iterator.cfc to see what it was doing.  When I did this, I realized that I had wasted some time in reinventing the wheel in a number of places.  On the one piece of code that prompted this post, I was trying to modify/save data on one particular element in the iterator.   Knowing that this was a small iterator, I took the approach of looping through it until I found the matching object ID, modify that and save.  As I was digging through the iterator.cfc, I found that this had amply been covered (and other things I was reinventing as well).  Now that I have seen it, my new code is much less verbose:

// create a reference to the iterator
StuffIterator = TopLevelObject.getStuffIterator();
// this returns an array of matching name value pairs
thisStuffArray = StuffIterator.get(StuffId=event.getArg(“StuffId”));
// since we passed a PK value we know we are dealing with the first (and only element)
thisStuff = thisStuffArray[1];
thisStuff.setName(“I am the name”);
thisStuff.setDescription(“I am all about Stuff”);
// and with the beauty of cascading saves…
TopLevelObject.save();

That is just ridiculously cool! :)

So the moral of the story is to take time to really get to know your framework so that you can not only save yourself time in the end, but build on top of tested methods that someone has already worked really hard at perfecting.

Big Gigantic Props to Webapper

At the company I work for, we are forced to live with and support a legacy application built on a framework that I personally just despise.  It is a homegrown framework that breaks every rule of what a framework should be.  Not only does it do far more than a framework should do in my opinion, it does it with *terrible* inefficiency.  To make matters worse, this application has remote DSNs (and I mean *remote* all over the internet) which make troubleshooting a real chore.  Since its deployment it has been a dog, with page loads sometimes taking 4-5 seconds for work that certainly shouldn’t take that long.  We recently added a customer with about 40,000 users and it pushed us way over the ledge.  Sometimes the application will just dive into an unrecoverable tail spin with threads filling up and never clearing out.  We have tried countless attempts to correct the application the best we knew how including tuning the JVM based on lots of research and looking though stack traces, etc., but have never gotten it quite right.  Yesterday as the application crashed we finally recognized that we just weren’t getting the job done and needed to call the experts.  We have been following the Reactor email list and have noted the help that Mike Brunt from Webapper has offered in regards to some performance issues.  I decided to give Mike a call and see if we could contract them to help us find the killers.  He put me in contact with Patrick Quinn who I spoke with at length regarding their approach and services, and he was able to line up one of his sharp shooters named Daryl Banttari within a couple of hours.  Daryl immediately installed SeeFusion (which we are purchasing today no doubt) and went to work troubleshooting.  He found a number of issues and within 4 hours had the system stabilized.  As traffic ramped up again this morning he worked with us again and even tweaked a bit further and it is now running stable and remarkably faster than it ever has.  We are watching the threads come and go now without ever getting close to the max and watching the garbage collection work better than we could have ever achieved on our own.  This was by far the best money that we have ever spent on any kind of consulting whatsoever, and the guys at Webapper are a real pleasure to work with.  If you ever find yourself in this position, I urge you to contact them as I am fairly certain they are as talented as anyone in the business at doing performance tuning of ColdFusion applications.

Installing CFMX7 & Apache2.2.2 on Ubuntu 6.06

One week into being an Ubuntu convert and I still have ZERO complaints.  This distro of Linux is so comfortable to use that not once in the past week have I thought “Man, if I was just using Windows!”.   This weekend, I setup CFMX7 Developer edition with Apache 2.2.2 which just became officially supported by Adobe a couple of weeks ago.

There were a few tricks to setting up ColdFusion with Apache though so I thought I might write about it to save someone else a few minutes if they follow the same path.

***DISCLAIMER*** I am not a long-time Linux guy.  I do not claim to be doing things the “right” way.  I realize there are likely other more efficient ways to achieve the things I am doing, but I don’t know about them! :)   That said…

  • Installing Apache 2.2.2 – One of the painless things about setting up new software in Ubunutu (and other Debian distros) is the apt-get command.  For intance if you want to install Apache, just open a command propmet and type in:

    >$ sudo apt-get install apache2

    Then in a few minutes you have an instance of Apache running.   ***HOWEVER***….. this is not what you want to do in this case.  By doing apt-get, you (read “I”) do not have the ability to recompile it to suit your needs.  I found that when I tried to use the ColdFusion connector tool, it failed due to the installation type of Apache that I had.  So, to remove this I did:

    >$ sudo apt-get remove apache2

    I then removed the startup scripts from /etc/init.d.  Once this was complete found that there were a few prerequisites I needed as I went through the Apache compile/install.

    1. Make sure you have GCC installed, which was not installed on my system.  To do this run:
      >$ sudo apt-get install gcc
    2. You also need a C compiler installed.  I am not sure this is the most efficient method, but what worked quite simply for me was to install Build Essential like this:
      >$ sudo apt-get install build-essential
    3. I also found that I needed ZLib installed.  I pulled down the source from the ZLib project page and did the following:
      • extract tar to a directory and terminal into it.
      • run >$ sudo ./configure
      • run >$ sudo make
      • run >$ sudo make install
    4. Once these prerequisite steps are taken, you are ready to install Apache.  Do the following:
      • Download the UNIX source here
      • Extract the tar file into a working directory and terminal into it.
      • run >$ sudo ./configure –prefix=/usr/local/apache2 –enable-mods-shared=all
      • run >$ sudo make
      • run >$ sudo make install

      You can start Apache now by running >$ sudo /usr/local/apache2/bin/apachectl start and test your installation by pulling up http://localhost/.

  • Installing ColdFusion MX7 – Now that Apache is intalled we can install ColdFusion.  Pull down the latest ColdFusion binary from www.adobe.com.  There is nothing exceptionally tricky during the installation process except for a couple of key points.
    • During the pre-installation checklist you may get a warning regarding a missing C++ compatability pack.  This is used for C++ custom tags, and I believe for Verity as well.  I disregarded this warning and moved on.  I did choose to install “Search Services” when prompted however, and will address that issue in the near future with a Verity project that I have on the horizon.  When I do that I will come back and update this post.
    • Another point to note is that I chose the multi-server installation.  I am not sure how the server configuration might differ from these steps.
    • Lastly, when you get to the point of choosing which webserver you would like to use, choose the internal webserver that ships with ColdFusion.
  • Once the installation is complete and you start the ColdFusion server by running:
    >$ sudo /opt/jrun4/bin/jrun start cfusion
    … and then testing your installation by going to http://localhost:8300/CFIDE/administrator/
  • Now it is time to connect ColdFusion to Apache.  You need to have the updated wsconfig.jar that was released in May 2006, and can be downloaded here.  Make a backup of /opt/jrun4/lib/wsconfig.jar ($> sudo mv wsconfig.jar wsconfig.jar.bak) and replace it with the wsconfig.jar in that zip file.
  • Stop and start the jrun process so that it picks up the new wsconfig.jar.
  • Now open the connecter by running: >$ sudo /opt/jrun4/bin/wsconfig.  Once it opens make the following changes:
    1. For “Web Server” choose Apache
    2. For configuration directory, choose: /usr/local/apache2/conf
    3. Check the box for “Configure webserver for ColdFusion MX applications”
    4. Click OK and accept the prompt to restart the webserver.
  • Copy the CFIDE directory into your webroot so that you have access to the ColdFusion administrator.  Run the following:
    >$ sudo cp -R /opt/jrun4/servers/cfusion/cfusion-ear/cfusion-war/CFIDE/ /usr/local/apache2/htdocs/

At this point you should be able to log into the ColdFusion administrator by going to:

http://localhost/CFIDE/administrator/index.cfm.

Have fun!

Using CFEclipse on Ubuntu 6.06

I converted (upgraded) from Windows 2003 to Ubuntu on my laptop this week.  I am completely enamoured with my new setup and will be blogging about this soon.  The only thing that has bothered me is that when running CFEclipse the processor would start pegging out as I was typing.  I felt that this might have to do with Tag Insight that happens as you type.  I tried setting the insight delay to 9999ms, which means that you have to pause in typing for almost 10 seconds before the tag insight is queried.  Changing this did nothing at all, and I also found that the problem was much worse as files grew in size.  When working in a template over 300 lines the lag made the editor unusable.  Considering how much I have loved everything so far about Ubuntu, I was really worried that this might end up being a show stopper.  After posting the issue out to my local CFUG, Mike Kelp contacted me and gave me some pointers.  He suggested that make sure that I am using the most current JRE.  I had already installed JRE1.5, but Eclipse was still pointing to JRE1.4.2.  I tried starting it with with the new JRE like this:

./eclipse -vm /usr/lib/jvm/java-1.5.0-sun-1.5.0.06/jre/bin/java

When I did this, the Eclipse loaded literally about 3 times faster and the issue with the processor pegging as I typed disappeared.  Big thanks to Mike!

SeeStack online stack trace tool

I spent far too much of my day yesterday pouring through stack traces and metrics dumps and trying to find something that has been killing the performance on one of our applications. In the process, I came across a really (and I mean REALLY) cool online stack trace parser called SeeStack, offered by Webapper, the guys behind SeeFusion. You can either upload or paste in your stack trace and it gives you back a nicely parsed and formatted report that makes it very easy to spot threads that have not budged since the previous stack. Using this tool we were quickly able to spot some trouble spots with the application (or as it turned out, the database….).

For a quick sample of how this works, try uploading this file.