Fusioncube

The online journey of a technophile, by Steve Brownlee

Archive for September, 2006

Enhanced ColdFusion Server Scope

Tuesday
Sep 19,2006

My previous post about a ColdFusion Server scope enhancer provided a chunk of code that you could include somewhere in your application to provide much more detailed information about the state and properties of your Java application server.

In an effort to clean up that code and make it perform slightly faster, I created a Java library that you can now include in your ColdFusion web application’s WEB-INF\lib directory.
Scope Enhancer Location

This makes the code much more simple to read and maintain. Here’s an example call to enhance your Server scope.

<cfscript>
runtime = createobject("java", "java.lang.Runtime");
enhancer = createobject("java", "orbwave.ScopeEnhancer");
mgmtFactory = createobject("java", "java.lang.management.ManagementFactory");
sys = createobject("java", "java.lang.System");

memoryPoolBean = mgmtFactory.MemoryPoolMXBeans;

server.jvm = StructNew();
server.jvm.memory = StructNew();
server.jvm.memory.pools = enhancer.memoryPools();
server.jvm.memory.free = runtime.getRuntime().freeMemory();
server.jvm.memory.max = runtime.getRuntime().maxMemory();

server.jvm.arguments = mgmtFactory.RuntimeMXBean.getInputArguments();
server.jvm.threads = enhancer.serverThreads();
server.jvm.properties = enhancer.systemProperties();

server.os.environmentVariables = enhancer.environmentVariables();
</cfscript>

There is one major difference between using the ColdFusion code version and the new Java library, and that is that the jvm.memory.pools and jvm.threads keys were queries in the CF version but are now structures in the Java version.

One addition was made in the new library and that is the os.environmentVariables key that holds all of the environment variables of your operating system.
evars.gif

Steps to install

  1. Download enhancer.jar library
  2. Put the enhancer.jar file in your web application’s WEB-INF\lib directory.
  3. Restart your Java application server
  4. Copy the code shown above into application (for example, your onApplicationStart event in Application.cfc)

Now all of the information is available for your use. Once again, you’ll need to be running at least the 1.5 JDK for this to work.

Death by Canoe

  • Filed under: errata
Monday
Sep 18,2006

I thought it would be fun to go out on a canoe trip with my brother, Mark, since he lives near a major river – the Delaware. We had canoed many times when we were younger because my father’s side of the family owns 100+ acres in northern PA right along the Clarion River. Beautiful area and we spent many a Memorial Day weekend going as far as we could up and down river, exploring.

Well, I’m here to tell you that the Clarion River is nothing like the Delaware River, especially since it had been raining in his area for a few days. We’re traveling along on Saturday morning towards our remote launch point and he keeps making comments like, “Wow, the river looks really fast.” and “I think it might be a little dangerous out there.” and my favorite, “We might not be doing the smartest thing by going out on the river today.”

Again, I ignore that little voice inside my head saying “Don’t do this”.

Ok, so now I’m a little freaked, but us both being experienced canoers, I figured we could handle it. We finally haul the canoe down to the river… and it’s BOOKING. Rivers normally flow at 2-3 miles per hour. The Delaware was flowing at 4-5 that day. It may not sound like a big deal, but it makes all the difference in the world. It’s also about 5 feet above flood level. Again, I ignore that little voice inside my head saying “Don’t do this”.

We decided that we wanted to be on the river about 6 hours that day. Just float along and talk and enjoy nature. Ok, so we go about 23 miles upstream, that should last us all day – if the river was flowing normally. We get in the river and start our trip and it starts out very nice. The river is fast, but it’s also pretty calm… for a while. I’ve been on rivers for a large part of my life until I was about 30 years old. I feel comfortable traveling them in canoes or rafts and know how to handle bad situations.

I did not feel comfortable when we reached the first “rough spot” on the river for three reasons.

  1. The river was moving twice as fast as normal
  2. The river was about 30% wider than any one I’d ever been on
  3. The river was about 10-20 feet deeper than any one I’d ever been on

By now I’m going through my mental checklist of “Ways My Life Might Be In Danger And How To Prevent Death By Canoe”.

Start getting nervous or panicky and it’s all over

However, I’ve learned through experiences like this that the best solution is to be smart and to be calm. Start getting nervous or panicky and it’s all over, so I remain calm, but also extremely alert.

*Info you need to know before I continue. Mark is used to canoing with his wife or my sister – each weighing approximately 110 pounds. I tip the scale, easily, at 265. I’m also in the front of the canoe.

So with my observations, we hit some pretty rough spots, but we also avoid disasters by me providing him with important information such as, “Killer rock ahead.” and “Tree of Drowning to our right, you might want to steer clear.” He has to work pretty hard to steer the boat properly and I have to provide information well ahead of time to avoid such pitfalls.

We avoided all Man-Eating Islands, Bone Crushing Boulders and Sneaky Trees of Death for the first 5 hours of the trip. We stopped once to portage past a particularly nasty looking, half-mile long stretch of rapids, stopped once to scour a glacial rock deposit, and once more to replenish our supply of water.

We were about an hour away from where we parked my truck, and I was very tired, and I did something very bad: I lost my focus on the river. I was stretching my back, taking a drink of water and looking at the beautiful trees along side the river and then looked ahead to see the tell-tale signs of a large boulder dead ahead of us. It wasn’t sticking out of the water, but it was only 2 feet down and causing a large enough wake to be avoided.

I did something very bad: I lost my focus on the river.

Too late.

We were about 40-50 yards away when I noticed it. The speed at which we were moving, we weren’t going to miss it. We gave it our best shot, but we didn’t have a chance. I quickly hunkered down – as I’m sure Mark did – to prevent tipping over, but we ended up going over the wake just the slightest bit sideways. That’s all it takes.

Two seconds later we were in the river.

The strangest thing, too. I remember not thinking much of anything about it – I guess my “survival instinct” kicked in. I quickly came up to the surface to see where the canoe was so I could avoid being nailed by it and also, hopefully, snag the life jackets before they got away from me. Luckily, the boat was only about 4 feet to my right so I quickly grabbed the jackets and gave one to Mark. We both grabbed an end of the canoe and started the looooooong process of trying to push it towards one of the shores. Meanwhile we had to avoid the trees and boulders to avoid getting caught and drowned or breaking a bone.

So we start kicking. We kicked and kicked and swam and kicked, and then kicked some more. Patience and vigilance are the *only* virtues in this situation. We slowly inched towards the left shore as our muscles starting becoming more exhausted with every push; our clothes and shoes weighing us down. I’m going to guess that this lasted about 15 minutes.

I came up with a plan that, looking back now, was quite ingenious

Then we see one of the islands coming up and all I knew is that I did not want to face that. The idea of being caught in the branches of dozens of trees that are almost completely underwater made our current situation seem almost pleasant. I came up with a plan that, looking back now, was quite ingenious. Using the last of what little strength I had left, I grab my end of the canoe and shove it towards the shore, then slowly swim back in position, and give it another huge shove.

Finally, we start making some real progress. After my 10th shove, we’re close enough to shore that the speed of the water was vastly slower and Mark was in a position to grab a stationary log and stop us. Luckily I was able to push us to shore before that was necessary. Almost completely exhausted, we right the canoe, gather our things and slowly head back out. The final tally of things lost was:

  • My Steelers Super Bowl XL hat
  • My backup pair of glasses
  • One oar
  • 30 pounds of really cool rocks we had gathered

We make it back to the truck about 20 minutes later, and I happily change into the dry set of clothes I brought and offer Mark a dry shirt that happened to be in the back. The next day we found the place where we picked up our cool rocks – with the help of Google Maps – and were able to replace them with even cooler ones since we had time to look around.

I’ll not be revisiting the Delaware River on a canoe again.

Adoption Update: The Wait is Over!

  • Filed under: adoption
Wednesday
Sep 13,2006

She’s finally here! We got the call tonight from our agency that there is now a little girl in Guatemala anxiously awaiting us to come pick her up. Of course, 6 months of beaurocratic red tape needs to be taken care of, but who cares!

Her name will be Sabrina Kelly Brownlee, and her birth name is Elvia Eunice O Puac. Here’s what she looks like:

Sabrina

We’re ecstatic that the Big Wait is finally over, and now the next Wait is starting. Which will be harder? Only time will tell. I want to go get her now!!

More info on my wife’s blog

Wednesday
Sep 13,2006

A recent discussion with a colleague in San Diego led me to realize that, while I have a lot of seperate snippets of how to setup CF/JBoss, I never published a nice comprehensive, step-by-step post to show how to do it from start to finish.

This post is going to cover how to set up your server to run the JBoss Application Server – parsing ColdFusion code in its web apps. Future posts will cover how to set up JBoss AS/Apache/ColdFusion, and JBoss AS/JBoss WS/ColdFusion.

Step 1: ColdFusion Installer

The first thing you need to do is download and/or run the ColdFusion installation package. During the installation wizard, ensure that you choose to install the J2EE/WAR installation type. When the installer is done, go to the installation directory in which you will see a cfusion.war file.

A WAR file (Web Application aRchive) is simply a ZIP archive, which means you can use whichever program you have for unzipping files. Simply unzip the archive into any location you choose. When done, you will have three directories:

  • META-INF
  • WEB-INF
  • CFIDE

The only two you will be interested in are the WEB-INF and CFIDE directories. You can safely delete the META-INF directory.

Step 2: Install JBoss

Now you can download and install the version of JBoss that you want to run your applications. Installation is as easy as unzipping the downloaded ZIP file to the directory from which you want to run JBoss. When done, you’ll have the following directory structure:
JBoss directory structure

Step 3: Creating Your Application Structure

Notice the SAR and WAR directories under the deploy directory. You need to create one for your new web application. For example, if your application is the website for www.widgets.com, simply create a widgets.war directory.
Create widgets.war directory

Remember the WEB-INF and CFIDE directories you unpacked previously, well now we need them. Copy them from their current location to your new widgets.war web application directory. Amazingly, you are almost done! These two directories are all that is needed to get a JBoss web app to parse ColdFusion files.
JBoss app enabled

Step 4: Telling JBoss You’re Alive

Now, here’s where you need to determine how JBoss is going to serve your Widgets application. This is done by creating a jboss-web.xml file inside the widgets.war\WEB-INF directory.
Jboss-web.xml file

If the Widgets application is the only application you want to server from JBoss, or it is going to be your root application – in both cases, what you want served when someone hits www.widgets.com – you specify this application as the root application. This is what the jboss-web.xml file would look like.
Jboss web root

However, if you want this application to be a subdirectory off of your root, you would specify that subdirectory name in the jboss-web.xml file.
Jboss web subdir

Step 5: Serving Your Application

The last thing you might need to do – if JBoss is functioning as your main web server – is change the port on which JBoss is listening. For this, you need to look inside the deploy\jbossweb-tomcat50.sar\server.xml file.
Jboss tomcat file

The very first setting in this file is the port on which Tomcat is listening for HTTP requests. The default value is 8080, but if JBoss is your default web and application server, you will need to change the port attribute value to 80.
tomcat_server_file.jpg

Conclusion

This is the most basic configuration for JBoss / ColdFusion. After completing these steps, you can start your JBoss instance and hit your designated URL and ColdFusion files will light up.

For more advanced configurations of JBoss, here are some links to other relevant posts.
Running multiple ColdFusion instances
Securing your JBoss web applications
Hosting multiple domains in JBoss
Flexible ColdFusion deployment – serving from anywhere

Adoptioneer Picnic

  • Filed under: adoption
Sunday
Sep 10,2006

My wife and I went to the local Guatemalan adoption picnic today. Just a group of people in the area who get together who have all shared the experience of adopting from Guatemala, and a chance for the kids to be around families just like theirs. It was nice. There were about 130 people there and we talked to several nice people. Not too many took the opportunity to approach us since they were all busy playing games with their kids, but I tried to spark up a couple of conversations and it paid off.

It was nice to see so many success stories since we’ve been feeling bleak lately, so my hopes are back up, and my patience has been restored. Next year, we’ll be busy with our daughter, but I’ll make sure I take time to welcome any couples who are still waiting so they feel more at home than we did.

My wife posted some of pictures we took at the event.

Latest Tweets

  • Watch video on this page to see a quick shot my family's biz and a heapin' helpin' of Pittsburghese - http://bit.ly/aMxuLN
  • Ever wonder how insignifcant the Earth is on a cosmic scale? http://bit.ly/PV4o
  • How did I miss this highlight??? Hasek takes out Gaborik http://su.pr/1KZtN2
  • Rooted & upgraded my HTC Hero w/#Froyo. Holy shit is it faster and have improved features. Painless, too. http://bit.ly/cBjvuH #fusprint
  • @Antipimp You will do what Father Jobs tell you to do, peon.