Dynamic Component Path

I moved a CMS application from one server to the other (which was almost a good replica of the production server) and CF couldn’t find my components again. Since I don’t have a ready access to the webroot to store my components I had to look for a way to dynamically pass the component path to the CreateObject function.

It is actually very simple:<br/>
<cfset componentPath="com.somewhere.component">
<cfset myObj=CreateObject("component","#componentPath#")>

Sony is not OK at all

Seems everyone knows what Sony has been up to. The company is not better than those evil hackers that write terrible vira except that it is big and very mean. From now on, I wouldn’t be found dead within a mile of a Sony; it has gone too far, it has broken public trust and the d**ned company ain’t even contrite!

Everyone should boycott Sony, it should be taught a lesson.

What .Com can do to your brain!

An ambitious yuppie finally decided to take a vacation. He booked himself on a Caribbean cruise and proceeded to have the time of his life… until the boat sank! The man found himself swept up on the shore of an island with no other people, no supplies… Nothing. Only bananas and coconuts.After about four months, he is lying on the beach one day when the most gorgeous woman he has ever seen rows up to him. In disbelief he asks her: “Where did you come from? How did you get here?”

“I rowed from the other side of the island,” she says. “I landed here when my cruise ship sank.”

“Amazing,” he says. “You were really lucky to have a rowboat wash up with you.”

“Oh, this?” replies the woman. “I made the rowboat out of raw material that I found on the island; the oars were whittled from gum tree branches; I wove the bottom from palm branches; and the sides and stern came from a Eucalyptus tree.”

“But-but, that’s impossible,” stutters the man. “You had no tools or hardware. How did you manage?”

“Oh, that was no problem,” replies the woman. “On the south side of the island, there is a very unusual strata of alluvial rock exposed. I found that if I fired it to a certain temperature in my kiln, it melted into forgeable ductile iron. I used that for tools and used the tools to make the hardware.

The guy is stunned.

“Let’s row over to my place, ” she says.

After a few minutes of rowing, she docks the boat at a small wharf. As the man looks onto shore, he nearly falls out of the boat. Before him is a stone walk leading to an exquisite bungalow painted in blue and white. While the woman ties up the rowboat with an expertly woven hemp rope, the man can only stare ahead, dumb-struck.

As they walk into the house, her beautiful breasts bouncing with each step, she says casually, “It’s not much, but I call it home. Sit down please; would you like to have a drink?”

“No thank you,” he says, still dazed. “Can’t take any more coconut juice.”

“It’s not coconut juice,” the woman replies. “I have a still. How about a Pina Colada?”

Trying to hide his continued amazement, the man accepts, and they sit down on her couch to talk.

After they have exchanged their stories, the woman announces, “I’m going to slip into something more comfortable. Would you like to take a shower and shave? There is a razor upstairs in the cabinet in the bathroom.”

No longer questioning anything, the man goes into the bathroom. There, in the cabinet, is a razor made from a bone handle. Two shells honed to a hollow ground edge are fastened onto its end, inside of a swivel mechanism. “This woman is amazing,” he muses.

“What next?”

When he returns, she greets him wearing nothing but vines and a shell necklace-strategically positioned-and smelling faintly of gardenias.

She beckons for him to sit down next to her.

“Tell me,” she begins suggestively, slithering closer to him, “we’ve been out here for a very long time. You’ve been lonely. I’ve been lonely. There’s something I’m sure you really feel like doing right about now, something you’ve been longing for all these months? You know… ” She stares into his eyes.

He can’t believe what he’s hearing. His heart begins to pound. He’s truly in luck: “You mean…”, he gasps, “…I can actually check my e-mail from here??”

ColdFusion White Space Reduction

I just finished our new website (my place of work). Now, I live in Nigeria and most of our customers are resident in Nigeria too. However, because of our local Internet infrastructural constraints, most visitors would have narrowband connections.For them to enjoy visiting the website, optimizing code for fast download became imperative. Actually, it was one of the highlight of the new website.

White space has always been one of the issues with ColdFusion application. For enterprise apps, bandwidth is usually not an issue but by the time you want to scale your app across the web to narrowband users, every single count.

While developing the new website (using NWWX CMS), I tried configuring white space management in the CF Admin but it didn’t do much so I hit the internet. I discovered a lot more people had same issue.

Too bad I couldn’t find a pre-cooked strategy so I ended up creating mine. This is what I did.

  • I set <cfsetting enablecfoutputonly="yes">
  • Wrapped all my component invocations in <cfsilent>
  • Now, all the index.cfm (a dynamic website with just 1 template and a bunch of components) code is wrapped within a <cfsavecontent variable="the_web">
  • Now the fun part. I got a very terribly cool function,  HtmlCompressFormat, from cflib.org which I rewrote into standard cffunction and included in my library components
  • <cfset html = library.HtmlCompressFormat(the_web,3)>
  • <cfoutput>#html#</cfoutput>

The result was awesome. I got as much as 40% size reduction on some pages and it worked fine. I only had issues with some buttons which were staying too close. I simply added &nbps; to separate them.

If you have other methods, especially something sexier, kindly share.