July 2006

Wish lists

There’s been much rubbing of magic lamps and wishing of wishes over what features we should throw into ColdFusion 8 aka Scorpio. Sean has the roundup of comments from Simon Horwith, Brian Kotek and Brandon Harper. Which will be granted? Only Damon can tell… ;-) Loudmouth that I am, I can’t help but add my own 2 paisa to the debate.

CFML is a simple language. Joe/Jane developer can get up and running building a CF application in a fraction of the time it would take with practically any other technology. At heart, CFML is a language rooted in tags. There’s no need to digest half a dozen reference books to dive into CFML - you can just pick the tags you need and go from there.

Adding new language features to parallel those available elsewhere (Java, Ruby, whatever) does not detract from this power - it adds to it. Your applications can be as simple or as complex as you want them to be. But even when they’re complex, the complexity can be isolated at a layer of abstraction above the actual business logic, because the business logic is still largely composed of simple, powerful tags. The key, of course, is to ensure that the features we add do not mess with CFML’s essential simplicity; if there’s one thing the CF team is paranoid about, this would be it.

But addition of any new feature is tempered by the time we have available to release, and the number of other features in queue. Prioritisation is a hard task, especially when we have you, our vociferous users, to answer to. Some features will make it, and others won’t - you know how the game is played. So you’ll see some new features that will enrich the CF language, allowing more object oriented behaviour and what-not. And you’ll soon see others like CFPRESENTATION and CFPDFFORM, which Jason showed off at CFUNITED, that will continue in the CF tradition of making hard things easy.

Some have asked whether CF should ship a framework to help define how to build applications. I would have to disagree. Each framework brings its own architectural philosophy to the table, and each is valid in its own space. Today we have frameworks that are great for building web applications. But what about frameworks for applications with Flex front ends? What if someone were to build a framework to enable CF as a data integration hub, using all the rich network interfaces that are available? Each of these will have their own specific requirements - no framework is sufficiently generic to address all needs.

CF goes far enough to make things easy, but at the same time stops short of defining how you should build your applications. That little detail, we leave to you…

coldfusion
technology
whatever

Comments (3)

Permalink

WHENTO: Evaluate() and Iif()

Bert brought up a rather interesting scenario where he needed to force templates to be reloaded into the template cache, since he was generating bits of CFML code at runtime. I suggested that he might also want to take a look at the evaluate() function, since that would probably allow him to solve his problem in a simpler manner.

As has been noted often enough, evaluate() and iif() are not the most performant of functions, since they do need to dynamically compile the expressions that they’re being asked to process.

Evaluate() simply processes the string passed to it as if it were an expression. Iif() is the CF implementation of the Java ternary operator “?” which is exactly what it calls to do its work; this is faster than using <cfif><cfelse></cfif> to achieve the same effect. Once iif() has figured out which expression to evaluate, it simply delegates control to evaluate() to actually process the expression.

Continue Reading »

code
coldfusion
technology
whatever

Comments (0)

Permalink

The Land of the Free

Bloggers Against CensorshipWelcome to India, the land of the free, where the government blocks access to bits of the Internet whenever it gets in that techno-bashing mood. What, you haven’t heard? If you’re in India and you get your news from Typepad or Blogspot, of course you haven’t! Heaping stupidity upon lunacy, only Typepad and Blogspot have been blocked - LiveJournal and WordPress are still available.

We are told that terrorists use blogs to communicate; that this is merely a security measure. Well, terrorists use telephones, email, plain old vocal chords and sign language too… So let’s see now - I’m a blogger, I have a telephone, I have email, the ol’ vox box seems to be in working order and all ten fingers wiggling happily. Ergo, I’m a terrorist?

pkblogs.com For info on circumventing the block, see this. Interestingly enough, one of the sites helping bypass the block, pkblogs.com, was originally setup to allow Pakistani bloggers freedom of expression when they had access to blogs blocked.

This police action is particularly worrisome in the light of the media and communications bill currently wending its way through the Lok Sabha. I haven’t had the time to read the full text of the bill yet, but I understand that it would, amongst other things, allow the government full control of media outlets when they see fit. Newspaper exposes nasty corruption scandal? No worries, shut ‘em down! Not a happy state of affairs at all.

On the subject of government and media control elsewhere in the world, the Stevens Bill is another monster to look out for. Check out the DPS Project for proposals to preserve net neutrality. Think this doesn’t affect you? Verizon’s new routers already have the capability for preferential routing built in. Big Brother is not only watching, he’s deciding where you should go, what you should do, and he ain’t letting on that you’re suddenly cruising his private payola version of the Internet.

internet/society
whatever

Comments (0)

Permalink

HOWTO: get scopes by name

I recently had a mail exchange with someone who wanted to get scopes by name, and was using undocumented methods on the PageContext to achieve his purpose. While this will work, there is an easier way…

You can do this using the StructGet function. StructGet attempts to gets a value from a named variable path which may traverse several nested structures, for example “my.dog.food”, where both “my” and “dog” are of type Struct; this may even be applied to scopes - “session.dog.food”. As the documentation notes, this function can be dangerous since it will create a path down to a variable if it doesn’t find it, but used carefully it can be incredibly useful.

In this case, the problem can be solved simply by passing the scope name to StructGet:

<cfset myscopename="server">
<cfset myscope=StructGet(myscopename)>

There you go, an abstract technique for getting scopes by name!

Update: The “someone” is none other than Jared, who has blogged about this too.

code
coldfusion
technology
whatever

Comments (2)

Permalink

Mumbai Blasts

India was again the victim of brutal terrorist attacks on Tuesday, 11th July. I would have, and probably should have, posted about this earlier, but somehow could not bring myself to do it. It really is easier to live in denial of violence rather than to accept the reality of its existence. Let me add my voice to the chorus already commiserating with the victims and their families and condemning the attack.

It is a tribute to the people of Mumbai that the aftermath of the blasts was not marred by communal violence, in a city that has already seen too much of it. The operative word in Islamic terrorist is terrorist. The same goes for any other group promoting violence as a means to their own ends. The communities that these terrorists may claim to be representing are largely peaceful folks just trying to get on with their lives.

Violence begets violence. Acting violently against terrorists or, more importantly, against their perceived consituencies only creates young men and women growing up in fear and anger, ripe for recruitment. Mumbai knows this, and so, her many disparate communities keep the peace amongst themselves that the city might be a safer place to live, that they can represent the plural society that India is. There is much we can learn from their example.

whatever

Comments (0)

Permalink

Tangled in the Template Cache

I started writing responses to all the great comments I got from my last post, but those rapidly grew so large and… ummm… tangled that it just seemed more manageable to just write a new post to address all of them!

Continue Reading »

coldfusion
technology
whatever

Comments (22)

Permalink

Tangling with the Template Cache

The ColdFusion template cache is an interesting beast; one which taught me a great deal about caching. I’ll be discussing the design of the template cache in this post, along with the rationale behind the approach that was taken, and some explanation of interesting behaviours that the template cache exhibits. Before we venture further, please do read An Introduction to Caching - you’ll need that information to understand the rest of this post.

What is the template cache?

For those who don’t know, the template cache is where ColdFusion stores compiled CFM and CFC templates in memory. When a template is executed for the first time, it is compiled to Java bytecode, and then stored in the template cache. Subsequent requests for the template use the compiled form of the template stored in the template cache, saving the overhead of having to read a file from disk, or even having to recompile a template. Templates are typically recompiled only when the CFM or CFC is modified, though if you’ve configured CF to not store compiled templates to disk, they will be recompiled any time they’re not found in the template cache.

Template cache configuration is managed from the ColdFusion Administrator under Server Settings > Caching. You can manage cache size and a couple of other settings, which I’ll get to later, on this page.

Continue Reading »

coldfusion
java
technology
whatever

Comments (17)

Permalink

Hear ye, hear ye!

Having finally got our own web space seems to have persuaded Anasuya to enter the blogosphere; it’s been a wonder watching her go from tentative first steps to absolute glee at seeing her work online. She’s a committed feminist who’s dedicated to combating injustice wherever it might be, and in my own (admittedly biased) view, a very original and balanced voice within the womens’ movement. Check her out!

anything else
whatever

Comments (3)

Permalink

CFUNITED 2006 Retrospect

I’ve been away on holiday the last week, after an intense few days at CFUNITED 2006. This was my first brush with the CF community, and I have to say that it was most rewarding - from the sessions to the informal hallway chats to those who came up to talk to us at the booth, it was an amazing experience.

Continue Reading »

coldfusion
technology

Comments (4)

Permalink

Memory-sensitive Caching for CF

After my introduction to caching post, Doug Hughes asked whether it would be possible to wrap CFCs in soft references to create a memory-sensitive cache for use in CFML. I answered that it should, in theory, be possible, but that an implementation would have to take care of a few common design issues that occur when dealing with soft references.

Having said that, I sat down to write my own implementation to fill the dull hours between CFUNITED sessions…

Here’s softcache.cfc, a soft reference cache that you can drop into your applications. I have not tested this extensively; which is not to say that I haven’t tested it at all! If you do find any bugs, leave your comments here, and I’ll see what I can do about them. I’ve tried to comment the code as thoroughly as possible, but if there’s any particular point that is unclear, do leave a comment and I’ll try to explain it further.

Disclaimer: I spend most of my time writing Java code - if the CFML I write could be optimized further, do let me know.

Continue Reading »

code
coldfusion
technology
whatever

Comments (18)

Permalink