Please note, new blog at http://www.acheron.org/darryl/

Utility methods with application.cfc (updated)

I was mucking around with the application.cfc the other day, and I found the following to be true. If you use the onRequest method, and CFINCLUDE the target page, every method you define within the application.cfc will be copied into the variables scope of the included template. This feature of course has been around for ages (reintroduced with one of the MX updaters I believe). Just recently, Sean Corfield posted a link on the CFCDEV list to the LiveDocs, which explained it in more detail:
If your Application.cfc implements the onRequest method, any utility functions that you define in Application.cfc are also directly available in to the target page, because Application.cfc and the target page share the Variables scope. If your application requires utility functions that are used by multiple pages, not just by the methods in Application.cfc, and you do not use an onRequest method, Macromedia recommends that you put them in a separate CFC and access them by invoking that CFC. As with other ColdFusion pages, Application.cfc can access any CFC in a directory path that is configured on the ColdFusion MX Administrator Mappings page. You can, therefore, use this technique to share utility functions across applications....

Google acquires Urchin

Google has acquired Urchin, producers of Web Analytics software which they claim is the world's most widely deployed. Do you think that Google will release it for free? They did it with Picassa...

Mozilla Firefox @ 40,000,000 downloads

For over a month the Firefox download counter has been offline, and a new counter has been promised shortly. However, spreadfirefox.com has just posted an update for those of us who just can't wait! The count is now up to 40,000,000 downloads. They are also working on a way to report the average usage measurement, which should be a whole lot more interesting.

Why are people still using MAC IE?

Came across an interesting problem today. Users of Macintosh Internest Explorer were receiving a "Security Failure: Data decryption error" alert box when trying to view a SSL encrypted Web site. After doing a quick search on Google, I found that there is a bug in how MAC IE implements SSLv3. This error of course does not ocurr on Firefox or Safari. This begs two questions: 1. How many ecommerce sites out there are losing transactions because of this bug? 2. Why do people keep using Internet Explorer on the Macintosh after it was discontinued by Microsoft two years ago?!

Powerful log parser tool

Just thought I'd share a tool called Log Parser 2.0 with the rest of you. I haven't used it myself, but I worked with a guy a while ago who loved this tool.
Log Parser 2.0 is a powerful, versatile tool that makes it possible to run SQL-like queries against log files of almost any format and produce the desired information either on the screen, in a file of any desired format or into a SQL database. Log Parser is available as a command-line tool and as a set of scriptable COM objects.

New IE7 feature details come to light

Microsoft Watch is running an article on some of the new features we can expect from IE7. It is not a surprise that Microsoft are focusing much of their attention on security. What is surprising is the inclusion of tabbed-browsing. Seems like someone is playing catchup.

SQL Server: Clustered indexes vs. non-clustered indexes

Today I learned some golden rules of indexes in SQL Server 2000. It seems I've been doing a bit of SQL Server stuff today! Clustered indexes Non-clustered indexes

SQL Server: Table variables vs. temporary tables

I just learned about table data types in SQL Server from some posts in the CFAUSSIE mailing list (via Scott Thornton). It looks like table data types are meant to replace temporary tables in SQL Server 2000, and have a very similar syntax. Temporary table CREATE TABLE #tmpTable(Col1 int, Col2 int) Table variable DECLARE @tmpTable TABLE(Col1 int, Col2 int) I did some searching, and one of the first results was this site. Interesting read, even though it was only the first part of a subscription only article. It turns out that table data types are slower than temporary tables for large sets of data, because SQL Server doesn't maintain statistics for queries on table variables.

A ColdFusion blog on blogger.com??

I guess it's a valid question. Why is a ColdFusion-related blog using blogger instead of a ColdFusion-based blogging application? Well, the answer is pretty easy. I've been trying to recover the registry key/password for my domain name, acheron.org, since I left my previous job. As soon as I get that domain name back, and a ColdFusion host, I'll probably move the blog over. For now, I'm using the free service provided by Google. I'll probably use Ray Camden's Blogging tool (its almost the defacto standard these days!)

CherryOS released

CherryOS, the controversial MAC emulator for Windows, has been released. One of my previous posts on MossyBlog spoke of the plagerism allegations against Maui Xstream, the Hawaii-based developer of the $50 product. According to Wired:
"Dave Schroeder, a senior systems engineer at the University of Wisconsin-Madison, looked at both October's preview release and Tuesday'srelease and did not like what he found. "
Essentially what this supports are the wide claims that the software has "stolen" (or used) code from the established open-source PearPC. Under the GNU license, Maui Xstream is entitled to use the code, but they must also make their own codebase freely avaiable to anyone that asks for it. This looks doubtful given that they are wholly denying any wrongdoing.

It always pays to explain yourself

I must have been working on the same piece of code for 1/2 a day yesterday -- trying to figure out why a certain method was not returning the correct results. I eventually went to a coworker of mine and started to explain the problem I was having. I went through the hierarchy of method calls that lead to the offending method, and then it hit me.... I was calling a method like this: methodName(argumentName=sUsername) That method I was calling was a wrapper method for another component's method, and it looked like this: <cffunction name="methodName"> <cfreturn oAnotherComponent.methodName(arguments=arguments)> </cffunction> Spot the error? Yup, should have been argumentCollection=arguments. I must have looked at that code dozens of times, but it didn't click until I explained the problem to someone else. Moral of the story - if you're having a problem, explain it to someone else. It always seems to work better if you not at your computer and at their computer.. Go figure.

Netscape 8.0 Beta out

The Netscape v8.0 beta browser is now out. The new browser is based on Mozilla Firefox. I've had a play with it, and honestly, I prefer Firefox. The interface just looks plastic, and there is too much happening on screen for their target audience (which I assume is AOL users).

Yahoo turns 10 years old

Wow! Time flies.. Yahoo has been around for 10 years. To celebrate this, Americans can download a free ice cream voucher from the site... Us poor Aussies miss out. Yahoo have also placed a "netrospective" of 100 moments from the last 10 years of the Web. It's cool that Firefox made it into the 100.

XML semantics

There is something that has been bothering me for quite some time. It is bad XML semantics. Take this for example: <book> <chapter1> </chapter1> <chapter2> </chapter2> </book> To me, this is badly written XML for a number of reasons: 1. It semantically makes no sense. 2. It is hard to parse. The reason I think that this is not semantically correct is an XML document should describe the structure of the information, not the information itself. The node should really be a node, because it does represent something meaningful. Try parsing the above XML into something that is useful. What happens if you had another chapter to the XML document? Could you programatically tell me how many sections were in the document? In my view, this is a semantically correct XML document: <book> <chapter name="introduction" number="1"> <title /> <body /> </chapter> <chapter name="chapter2" number="2"> <title /> <body /> </chapter> </book>

Why Interfaces are not in CFMX7

I just read, via Sean Corfield's Blog, a review of ColdFusion MX 7 by Brian Kotek. The thing that interested me is that he wondered why features such as Interfaces (blue-prints for objects) and a CFIMAGE tag were not included in the release. Interfaces have been a point of discussion a number of times in my workplace, and we could have really used them on a number of occasions (especially with growing developer numbers). Macromedia ColdFusion MX 7 product manager, Dave Gruber, replied to the article with Macromedia's reasons for not including them. I can see his point, but hopefully the features won't always be left on the scrap heap with future releases. Within the next release, I would also like to seei mproved and updated CFSCRIPT syntax.

CFSAVECONTENT vs. concatenation

I've been mucking around with generating CSV files over the last couple of days, and testing the difference between CFSAVECONTENT and good old concatenation. A lot of people know this already, but using CFSAVECONTENT like this: <cfsavecontent variable="local.sData"> <cfoutput query="local.qData">#chr(34)##local.qData.col1##chr(34)#, #chr(34)##local.qData.col2##chr(34)##chr(13)##chr(10)# </cfoutput> </cfsavecontent> is a LOT quicker than: <cfset local.sOutput = ""> <cfoutput query="local.qData"> <cfset local.sOutput = local.sOutput & chr(34) & local.qData.col1 & chr(34)> <cfset local.sOutput = local.sOutput & chr(34) & local.qData.col2 & chr(34)> <cfset local.sOutput = local.sOutput & chr(34) & local.qData.col3 & chr(34)> <cfset local.sOutput = local.sOutput & chr(13) & chr(10)> </cfoutput> In this example, concatenating the string together can take up to 1 second. Using CFSAVECONTENT, the same string can take only 90 milliseconds to create (even with heaps more data).

Singletons dramatically improve performance

I've just spent the last couple of days working on improving the speed of an application. One of the biggest bottlenecks we discovered was the continuous creation of objects (business logic) that do not hold their own instance data. We solved the problem by creating them all as singletons! A singleton is an object that is only created once - only one instance of it exists in memory. In ColdFusion, you essentially achieve this in ColdFusion by checking to see if an object already exists in a particular scope, and if it does, then use it, otherwise, create it. We created a core method to create singletons, and placed our singletons in application or session scope, with the key being the full component path (e.g. applicatiom["com.foo.bar.componentName"]). I think a lot can be learned from J2EE patterns.