919 - 926 - 9847

So how did you get started in ColdFusion?

My journey to ColdFusion stared in 2001. I was working at getting a BA in order to escape the inability to break into the "computer" world. As part of my internship for school, I got to choose where I got the privilege of paying $300 to work for free (yay education system), and that place was EXTOL International Inc. in Pottsville, PA. My in-laws worked as AS400 developers there (still do), and it seemed like a great place to start out. At any rate, it was a "foot in the door" situation that I couldn't pass up, and just 15 minutes up the road.

I started work under Mark Dempshey, the then current product manager and webmaster, and was given the task of learning about ColdFusion and the network in general. So for 40 hours a week, which was double the requirement, I spent 9 weeks working full time (for free) learning the ropes in the computer world, as well as my 3-11 paid job. It was a challenge, but well worth it as I was able to translate that internship into a paid position.

We started out on ColdFusion 4.01 and Access (good lord, why??), and when I left in 2006 we had moved to ColdFusion MX 6.1 against MSSQL. We grew from a home grown, gnarly CMS, to the FarCry CMS. I've discovered that I have no real ambition to EVER work under the NJ/NY mind-set again (you didn't read my mind and make that webform already?? We sent it to print!! We'll send you a graphic soon). Sadly they've since moved to a hosted solution that's either ASP or PHP, but that's just the way the ball bounces sometimes. There really wasn't anywhere to go "up", so I had to leave PA in order find better prospects. Still, they kept me on for 9 months as a consultant. I miss the area, but the opportunities presented in the Triangle area should keep me covered for a good number of years to come.

Where would I be without ColdFusion? Probably as a java/php/asp developer. I personally like being a CF dev and wouldn't change it for the world.

Whoops, error in that last post

I modified a block of code to check that "attributes.return" is true as well as exists.

After the code block (don't forget the if)


<!--- Return to the objectadmin --->
<cfif structKeyExists(attributes, "Return") AND attributes.return EQ 'true'>
<cfset attributes.exit = true />
<cfset stLocal.onExitProcess = structNew() />
<cfset stLocal.onExitProcess.Type = "Return" />
<cfset stLocal.onExitProcess.Content = "" />
</cfif>

Been awhile. New FarCry hack for the objectadmin

Under the new 6.x builds of FarCry, and object edit overlay (which is quite handy at times) always pops up on object edit. However, this can be tedious at points. Want to change that behavior? Well, here's one way to do so.

1. Create an edit.cfm for your content type, in this case mdwArticles. In this code have a process form that looks like this (note the return="true"):


<ft:processform action="Save" exit="true" return="true">
<ft:processformobjects typename="mdwArticles" />
</ft:processform>

2. Modify (or make a copy in your project being the better answer) /farcry/core/tags/formtools/processform.cfm:

Add the webskin tag


<cfimport taglib="/farcry/core/tags/webskin" prefix="skin" />

Add a new attribute


<cfparam name="attributes.Return" default="false"><!--- Return to objectadmin --->

After the code block (don't forget the if)


<!--- Return to the objectadmin --->
<cfif structKeyExists(attributes, "Return") AND attributes.return EQ 'true'>
<cfset attributes.exit = true />
<cfset stLocal.onExitProcess = structNew() />
<cfset stLocal.onExitProcess.Type = "Return" />
<cfset stLocal.onExitProcess.Content = "" />
</cfif>

And finally, you need a case to handle the return ()


<cfcase value="Return">
<cfif structKeyExists(stLocal.stOnExit, "Content")>
<skin:onReady>
<cfoutput>

parent.$fc.objectAdminActionDiv.dialog('close');
</cfoutput>
</skin:onReady>
</cfif>
</cfcase>

You learn something new every day!

I had to complete a disaster recovery project this week. We do this annually for one of our clients (yay for preparedness!) for one of their ColdFusion sites. I've got a run book and all that and was prepared to reinstall ColdFusion and copy in their EAR to redeploy the application. Until I had a conversation with a coworker: Him> Did they restore your data yet? Me> Yep, I'm just getting ready to reinstall ColdFusion and- Him> Re-install? Isn't everything already there? Me> Well, yeah, but. Wait... huh. I bet I could just run the jrunsvc command, and..

So it turns out, if you don't need search, .NET, LiveCycle or ODBC services, you can just restore ColdFusion from a a backup to your file system. All you really need (minus those other pieces) is to run the jrunsvc command to install a new ColdFusion service in the the services console and to run the wsconfig.jar to connect IIS to JRun (or, if you restore the website from a file, all of that is already there). My runbook went from something like 30 steps down to about 4. Color me happy. And when you think about it, it makes sense. Since it's all built atop Java (minus the other services) there's no reason to go through the installer. You can probably install those other components but I don't really need them, so I don't care to find out how at present. But still, this is a handy little tid bit.

FarCry 5.2 + Railo 3.1.0.16 + Resin + Apache + MySQL + CentOS - Addendum 1

I had an "Ah HA!" moment when I got home tonight. I copied in my FarCry core folder from my known good Ubuntu Railo/FarCry install over to my CentOS install and still had issues. I tried several iterations of this, and then I had a think. I pulled up the Railo admin on my Ubuntu install, and noticed I had it at .012. And then it hit me... I was actually in a discussion about this with others on the google groups. I thought I had tried it at 3.1.0.016, but I think I did not complete the upgrade step.

So, I copied the .012 install of Railo over to the CentOS box and it worked! Huzzah! So, it appears that .012 remains the most supported version at this point in time. I'm hosting a copy of this file on my site, but please be gentle! I don't want to hear it from my host that ya'll are killing my server. You can grab the file here.

FarCry 5.2 + Railo 3.1.0.16 + Resin + Apache + MySQL + CentOS - Part 3

In this installment we're going to be installing FarCry, and tweaking our Apache settings a bit. To let ya'll know upfront, there's still a few issues with FarCry and functions that are named the same as internal Railo functions. I know these changes were placed into trunk at one point, but it doesn't seem like they migrated over to the 5.1.6 release. That's OK, I've got a fairly stable pull of the core trunk files from a few weeks back that I'll be linking on the site this evening. I'll verify that this fixes the odd "function cannot be named" stuff going on. The current trunk files are not allowing the overview page to come up, but then again this is trunk we're talking about... life on the bleeding edge sometimes leads to a paper cut ;).

[More]

FarCry 5.2 + Railo 3.1.0.16 + Resin + Apache + MySQL + CentOS - Part 2

Right... part 2. We're going to install Railo in this section. It's going to be a much smaller ride than part 1 ;). But first, some knowledge.

I've learned that:

  • I'm not a fan of CentOS. I prefer the debian distros. Why? I've not really ever had a need to play with SELinux, or IPTables. Why does that matter? Both of these things have caused me grief whilst putting this together as both are enabled by default in both the _64 and i386 builds of 5.3.
  • You must turn off IPTables on each boot of the system. I'm sure there's a way to make this automatic, but I really haven't tracked it down yet. Yes, it would not be an issue if I just set it up... surely this will be a blog posting down the line, but I don't require it for now.
  • I had originally done the write up for part 1 with an _64 build. Everything was great until I got to the point where I needed to build mod_caucho. I could not find a way to successfully build that, and it appeared to be an issue with apsx. I didn't really want to spend my entire day chasing down rabit holes, so I switched to the i386 build. It's at this point that I learned that SELinux was preventing Apache from talking to Caucho. Again, not wanting to chase my tail endlessly, I just disabled SELinux for now.
  • Use PUTTY! I can never get copy/paste to play nice between my VM command line screen and windows. So, I'll just minimize the VM and use PUTTY to terminal (over SSH) into virtual box. In this way, you can also keep several screens up at one time.

[More]

FarCry 5.2 + Railo 3.1.0.16 + Resin + Apache + MySQL + CentOS - Part 1

Woah... not such a catchy title, but it's descriptive, non?

This all began as a quest to be able to provide a VPS solution to the lowest bidder situation. Their host provides CentOS machines at a fairly reasonable price, but that price would not include the cost of a ColdFusion license. My framework of choice is FarCry, and lately the Daemonites have taken great strides in keeping the framework compatible with Railo. This is the thorny path towards creating a Linux virtual machine with FarCry, MySQL, Railo, and Apache (oh... and SES URLs).

We'll start by just getting the basics of the system running and in place.

  • Everything I'm doing is as the root user... yes, not cool, but this just development. Typically, you should really use sudo to do all of this.
  • Grab a VMware image of CentOS 5.2. You can find one here: http://www.vmware.com/appliances/directory/1309. VMplayer can be found here: http://www.vmware.com/download/player/
  • Turn off IPTABLES for testing... yes, not the best idea for production, but this is development. I could not figure out why the heck Apache wasn't serving pages outside the local install, and it was the firewall blocking it. In production, you should really turn this feature on. I'm not addressing how to do so for this excercise.

    • /etc/init.d/iptables save
      /etc/init.d/iptables stop
  • Enable RPMforge packages. This will allow us to install phpMyAdmin through yum.
    • http://wiki.centos.org/AdditionalResources/Repositories/RPMForge (source)
    • Download either i386 or _64 RPM dependant on your OS type version
      • http://apt.sw.be/redhat/el5/en/i386/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
      • http://apt.sw.be/redhat/el5/en/x86_64/RPMS.dag/rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm
    • Import GPG key
      rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
    • Install it (replace the RPM with the name)
      rpm -i rpmforge-release-0.3.6-1.el5.rf.*.rpm
  • We need to install apache (well, not NEED, but we're not using Tomcat here)
    • http://www.railo.ch/blog/index.cfm/2008/11/12/Installing-ResinRailo-on-CentOS (source)
    • yum install httpd httpd-devel openssl-devel
  • We need to install MySQL
    • http://www.ozzu.com/unix-linux-forum/centos-and-apache-php-mysql-t69484.html (source)
    • vi /etc/yum.repos.d/CentOS-Base.repo
    • change enable=1 for centosplus
    • yum install mysql-server mysql
  • I installed PHP/PHPmyadmin - just for DB administration
      yum install php php-mysql phpmyadmin
      cd /usr/share/phpmyadmin/
      vi config.inc.php
    • enter a value in $cfg['blowfish_secret'] = '<something>';
    • vi /etc/httpd/conf.d/phpmyadmin.conf
    • change the allow line to (yes, yes... but this is a test environ) to Allow from all
  • We need to install a JVM... this part just sucks. Unlike other distros, no precompiled version really meets our needs.
    • http://j2eeinaction.blogspot.com/2009/02/install-java-6-on-centos-52.html (source)
    • Go to http://java.sun.com/javase/downloads/index.jsp (grab the JDK!). You can browse to a download link and post that into your VM as something like the following
    • wget http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-6u14-linux-x64-rpm.bin?BundledLineItemUUID=CXFIBe.pePAAAAEioR0Hk1t8&OrderID=CgtIBe.pcWUAAAEilh0Hk1t8&ProductID=tPxIBe.oz2IAAAEhmh0zLjfT&FileName=/jdk-6u14-linux-x64-rpm.bin
    • rename that long ugly file to jdk.rpm.bin
    • mv <stupid long name> jdk.rpm.bin
    • chmod 700 jdk.rpm.bin
      ./jdk.rpm.bin
      /usr/sbin/alternatives --config java
  • Start Apache and MySQL at reboot
      /sbin/chkconfig httpd --level 2345 on
      /sbin/chkconfig mysqld --level 2345 on

And that's it. You have Apache serving pages at http://yoursite/ and phpMyAdmin at http://yoursite/phpmyadmin. Next up on the chopping block, adding Railo into the mix.

Fedex interactions... you are a bleeding pain

There has been some talk on CF-Talk lately about interacting with the Fedex WSDL/services. There's not really much in the way of examples that I could easily find on how to use this WSDL... and I've still not gotten over my hate of working with CFHTTP and authorize.net. I was hopping to not have to deal with that pain again, and it seems I won't!

So, we have this link to a most excellent (and free!) CFC here. You'll still need to step through the hoops to get a developer code from Fedex, but once you do...


<cfinvoke component="fedex" method="getRates" returnvariable="fedex"
shipperAddress1 =     "474 N Centre St"
shipperCity =         "Pottsville"
shipperState =         "PA"
shipperZip =         "17972"
shiptoAddress1 =     "79 TW Alexander Dr"
shiptoCity =        "Durham"
shiptoState =         "NC"
shiptoZip =         "27709"
pkgWeight =            "3"
pkgValue =             "100"
myKey =    "<your value>"
myPassword="<your value>"
myAccountNo="<your value>"
myMeterNo="<your value>"
>


<cfdump var="#fedex#">
    <cfoutput>
    <select name="shipping">
            <cfloop from="1" to="#arraylen(fedex.rate)#" index="n">
                <option value="#fedex.rate[n].cost#">#fedex.rate[n].type# - #DollarFormat(fedex.rate[n].cost)#</option>
            </cfloop>
    </select>
    </cfoutput>
This example (provided by the original author) includes a handy select box. This is great for me, and saves a TON of time playing with the XML.

PS.... I forgot to close the code block... I'm thinking BlogCFC could use a rich text editor.

Google brought down my house of cards

For almost three years now we've been running ColdFusion (well, really JRun) session based replication and failover on all of our hosted ColdFusion environs. Things were great! And then, we let google in the door to index our content. Things went from "great", to "why is this always down??". I spent far too much time looking at JVM settings, JRun settings, etc., but never really came up with a concrete answer as to what was happening. Ultimately, we'd see a deluge of errors about the failure of session replication in the log files and a complete breaking of failover and sometimes even the JRun -> IIS connector.

Whilst searching for the session replication errors, I came across Sean Corfields postings across various blogs that replication just does not scale well, and that it remains a broken feature. Up until a few months ago, I'd argue this to be untrue. However, it appears that replication works... if you can manage to keep the amount of crap you throw into shared memory scopes down to a minimum.

It's been 4 days since I've disabled session replication, and my servers have remained standing for an equal amount of time. We've been getting indexed by google (and others), and things are sailing along with nary a blip. Next stop, creating a guide for users that want/need session based failover that can be accomplished in code. Otherwise known as, "Help me Sean Corfield, you're my only hope!" ;).

More Entries