ColdFusion has never satisfactorily removed whitespace from generated content, however, removing this whitespace can dramatically improve your website’s performance. Take a 100KB page for example. If 20% of the page is made up of whitespace, that is 20% that is unneccessary and 20% bandwidth cost that can be saved.

Currently there are two main ways a ColdFusion developer can prevent whitespace; via the ColdFusion Administrator and by including certain tags in their code:

1. ColdFusion Administrator

Under the Server Settings > Settings menu item there is a checkbox called ‘Enable Whitespace Management’. This checkbox should always be checked. According to the description, checking this checkbox “reduces the file size of the pages that ColdFusion returns to the browser by removing many of the extra spaces, tabs, and carriage returns that ColdFusion might otherwise persist from the CFML source file.” I am yet to be convinced, but it is worthwhile enabling it.

2. ColdFusion Tags

<cfsetting enablecfoutputonly="true"></cfsetting>

The cfsetting tag controls aspects of page processing, such as the output of HTML code in pages (inside and outside the cfsetting tag body). If enablecfoutputonly is set to true, HTML output is blocked if it is not wrapped in a cfoutput tag. Therefore, this tag ‘can’ be used to minimise the amount of generated whitespace.

<cfsilent></cfsilent>

The cfsilent tag supresses output produced by CFML within a tag’s scope. Therefore, you simply need to wrap the tag around anything you don’t want to output to the browser. As it does not return anything from with in it, so you have to be a little be careful when debugging.

<cfprocessingdirective supresswhitespace="true"></cfprocessingdirective>

One of the cfprocessingdirective’s purposes is to remove excess whitespace from ColdFusion generated content in the tag body. However, it does not affect any whitespace in HTML code. You can nest the tags and toggle supresswhitespace on and off, not that I ever identify a good reason to do so.

But there is a little known third way, using a servlet filter called Trim Filter.

Servlet filters are tools available to web application developers. They are designed to be able to manipulate a request and response (or both) that is sent to a web application.

Trim Filter lets you decrease the size of file your server will send to all clients. The filter removes extra spaces and line breaks from outputted documents. This can be especially useful for WAP/WML developers working with mobile devices, where the size for transferred documents is limited.

Setting up the servlet filter in ColdFusion

Using the Trim Filter servlet filter found at the following URL:

http://www.servletsuite.com/servlets/trimflt.htm

  • Download the trimflt.jar
  • Save trimflt.jar in the WEB-INF/lib folder in the ColdFusion Server wwwroot.
  • Edit the web.xml file in the WEB-INF folder in the ColdFusion Server wwwroot with the following code:

Trim Filter

  • Restart the ColdFusion Service

And now, when a ColdFusion page is invoked, the whitespace is suppressed and wow does it do a good job.

The term Web 2.0, first coined by Tim O’Reilly back in 2004, describes a cluster of web-based services with a social collaboration and sharing component, where the community as a whole contributes, takes control, votes and ranks content and contributors. Web 2.0 services include social networking sites, wikis, communication tools, weblogs, social bookmarking, podcasts, RSS feeds (and other forms of many-to-many publishing), social software, and folksonomies. Central to this new Web is the idea of tagging — the adding of keywords to a digital object (e.g. a website, picture, audiofile or videoclip) to categorise it. This activity is effectively subject indexing but generally without a controlled vocabulary.

The following list provides examples of sites which include some form of user-based tagging:

Blogs
Technorati: http://technorati.com
Bookmarks
Delicious: http://del.icio.us
Books
Librarything: http://www.librarything.com
Emails
Gmail: http://mail.google.com
Events
GoingToMeet: http://www.goingtomeet.com
People
Tagalag: http://www.tagalag.com
Pictures
Flickr: http://www.flickr.com
Podcasts
Odeo: http://odeo.com
Videos
YouTube: http://www.youtube.com

Folksonomic Websites

Tagging of course is not a new concept, especially to librarians, indexers and classification professionals. What is new is that the tagging is being done by everyone, no longer by only a small group of experts, and that the tags are being made public and shared. This is the concept of Folksonomy.

A folksonomy is a user-generated taxonomy used to categorize and retrieve web content such as Web pages, photographs and Web links, using open-ended labels called tags. Typically, folksonomies are Internet-based, but their use may occur in other contexts. The folksonomic tagging is intended to make a body of information increasingly easy to search, discover, and navigate over time. A well-developed folksonomy is ideally accessible as a shared vocabulary that is both originated by, and familiar to, its primary users.

In contrast, in the realm of the Web, taxonomy can be defined as:

the laws or principles of classification;

controlled vocabulary used primarily for the creation of navigation structures for websites

The development of the Internet and the Web, and of search engines, led to users doing their own searching. In the Web 2.0 environment users are now also doing their own content creation and information management.

Because folksonomies develop in Internet-mediated social environments, users can often discover who created a given folksonomy tag, and see the other tags that this person created. In this way, folksonomy users often discover the tag sets of another user who tends to interpret and tag content in a way that makes sense to them. The result is often an immediate and rewarding gain in the user’s capacity to find related content. Part of the appeal of folksonomy is its inherent subversiveness: when faced with the choice of the search tools that Web sites provide, folksonomies can be seen as a rejection of the search engine status quo in favour of tools that are created by the community.

Folksonomy creation and searching tools are not part of the underlying World Wide Web protocols. Folksonomies arise in Web-based communities where special provisions are made at the site level for creating and using tags. These communities are established to enable Web users to label and share user-generated content, such as photographs (e.g. Flickr), or to collaboratively label existing content, such as Web sites (e.g. Technorati), books (e.g. LibraryThing), works in the scientific and scholarly literatures, and blog entries (e.g. WordPress).