Well, it’s on Labs, so the general public can get at it. I’ve been on the Beta tester programme and have been fortunate enough to already play around with it. I haven’t even touched the surface of all the new features yet, but I can say this at least – this version i’ve found to very quick indeed. Go download and enjoy!
“With great power comes great responsibility”
It was noted today in TechCrunch that a posting by Engadget (normally one of the Top 5 “Technorati” rated blogs) knocked a staggering $4 billion dollars of the Apple inc share price by posting news of a delay to the iPhone and Leopard OS: the news source was supposedly the Mac Mail servers, but confirmed quickly as a fake.
The share price has now returned to normal, but I’m left dumbstruck by the power of the internet blog once again: Engadget is generally seen as an authoritive source of techno information and gossip – one slip like this, and it can have devastating effects.
Faced two problems whilst looping over some database entries today (with data coming from many RSS feeds, so essentially data which could contain anything).. which I can imagine other people stumbling into on occasion.
Problem One: XHMTL Which doesn’t validate due &’s in a non web format
Problem Two: Title attributes in href tags closing too early due to double quotes in the string
<a href=“#Link#” title=“Go to: #title#”>#title#</a>
Link = http://www.somedomain.com/foo.cfm?id=1&somevar=2
title = John Doe on “Why Should I”
Then you’d end up with the following:
<a href=“http://www.somedomain.com/foo.cfm?id=1&somevar=2“ title=“John Doe on “Why Should I“”>John Doe on “Why Should I”</a>
This has two issues: the
should be written
and the browser sees the title attribute as
“John Doe on”
and then has no idea with the rest, which it assumes is your attempt as an invalid attribute in XHTML.
How to fix: Use HTMLEDITFORMAT() to escape the &’s automatically, and RegularExpression Replace – REREPLACE() – to replace the double quotes in the string with single ones.
<a href=“#htmlEditFormat(Link)#” title=“Go to: #REReplace(title,”[""]“,”‘“,”ALL“)#”>#Title#</a>
Sometimes you may find the need to output a trail of breadcrumbs which simply reflect the directory structure of where you are in the site, including the current template (.cfm file).
By looping over the cgi.script_name variable, we can cut up the various paths into individual entries which we can then output.
NB, remember to escape those URL variables.
<cfscript> //Start a new query which we can fill qBreadcrumbs=QueryNew("url,title", "varchar,varchar"); //The starting link link="/"; </cfscript> <cfloop list="#cgi.SCRIPT_NAME#" delimiters="/" index="i"> <cfscript> // Add a row to our query QueryAddRow(qBreadcrumbs, 1); // Set the row with URL QuerySetCell(qBreadcrumbs, "url", link & i); // Set the row with the title: If '.cfm' exists, remove it, and replace underscores with spaces // You could also use the TitleCase() function (see http://lab.artlung.com/coldfusion-titlecase/ ) to auto capitalise QuerySetCell(qBreadcrumbs, "title", "#replace(replace(i, '_', ' ', 'all'), '.cfm', '', 'all')#"); //Update the link location for the next loop link=link & i & '/'; </cfscript> </cfloop> <cfoutput> <div id="breadcrumbs"><cfif qBreadcrumbs.recordcount GT 1><p><a href="/" title="Home">Home</a> <cfloop query="qBreadcrumbs"> <cfoutput> <cfif title NEQ "index"> » <a href="#url#" title="#title#">#title#</a></cfif> </cfoutput> </cfloop> </p></cfif> </div> </cfoutput>
This very odd behaviour hit me the other day when querying an existing query which was in a scope (i.e request.query):
The query should look like this:
<cfquery dbtype="query" name="getReltrans"> SELECT * from request.translations WHERE ComposerID LIKE '%#somevar#%'; </cfquery>
But it throws an error. The reason is, when querying a query object, you need to tell Coldfusion not to return NULL values.
<cfquery dbtype="query" name="getReltrans"> SELECT * from request.translations WHERE (ComposerID IS NOT NULL AND ComposerID LIKE '%#somevar#%'); </cfquery>
Thanks to Ben Nadel for the heads up!
Blog re-organisation time: essentially, I’ve moved http://www.oxfordalto.co.uk to https://www.oxalto.co.uk. Part of me couldn’t be bothered typing in those extra characters each time :)
If there’s something you can’t find let me know! I’ll be updating the style and layout of this installation in the next few days…
This was done as another experiment using the Sony HDR HC7E: This is one run through, with a few extra shots – a total of about 9 minutes of footage to do a 7 minute piece!
chchchoir.org has been redesigned!