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.

The Heart of Men

Someone came around to pick some mails in my office. While signing for the mails, I saw that he’s a Joseph. I jokingly asked him if his wife was Mary and his son Jesus? You can guess his reply?He said he ain’t Joseph the Carpenter but Joseph the Prime Minister.

My Verdict? It is more interesting to be rich and powerful than to be the father of King of Kings. Duh!

Wedding Prisoner

On their wedding night, the bride told her husband:

“Honey, am a virgin and I don’t know anything about sex,
Can you explain it to me first so I don’t embarrass you?”
OK, sweetheart. Putting it simply we will call your part “the prison” and call mine “the prisoner”.
So what we do is put the prisoner in the prison. As simple as that.And so they made love for the first time.
The bride found it pleasurable and soon both were tired, lying facing the ceiling, smiling with satisfaction.
Suddenly the bride giggled and came closer with a suggestion: “Honey the prisoner seems to have escaped.”
Turning to her side he replied: “Then we will have to re-imprison him”
After the second time they lay exhausted. But just as the guy was reaching out for his towel to visit the bathroom the bride had another observation: “Honey, the prisoner is out again.”

The man turned and faced her with a surprise look.
“What did you say”
“Honey the prisoner escaped again.”
He couldn’t believe it. He had married a machine. He found himself yelling at her;
“Hey girl let him escape. Nobody said this was going to be a life imprisonment.”

A fool for life

A guy gets home early from work and hears strange noises coming from the bedroom.

He rushes upstairs to find his wife naked on the bed, sweating and panting. What’s up? he asks
 “I am having a heart attack” cries the woman. 

He rushes downstairs to grab the phone, but just as he was dialing, his 4 year-old son comes up and says, ” daddy! daddy!! uncle ted is hiding in your wardrobe and he has no clothes on!”

The guy slams the phone down and storms upstairs into the bedroom, past his screaming wife and rips open the wardrobe door. Sure enough, there is his brother totally naked, cowering on the wardrobe floor.

“You jerk” yells the husband, ” my wife is having a heart attack and > all you can do is run around with no clothes on scaring the kid”