Find broken links in your cfml sourcecode

For a client which is migrating from a Windows environment to Linux, I needed to check if the source code contained broken links, due to case sensitivity on Linux. So I wrote this script, which goes through all your source files, and checks all links inside href="..." and src="..." to see if they exist.

5 Comments

Calling inner class of a Java Class in Railo

Thanks to the Railo documentation on Github, I finally found the answer I was searching for...

Question: how to call an inner Java class of a Java class with Railo?

Answer: use a $ sign: createObject("java", "main.java.class$innerClass")

Long version: I was busy implementing the javaEWSApi (MS Exchange Web Services API) into a new mobile project, but got stuck on getting the unread-count for the user’s Inbox. An example online showed ...

No Comments

Railo Log analyzer bugfix update: v2.2.0

For anyone using the Railo log analyzer, there is an update out!

Update 2.2.0 contains:

  • Added View option, to view the log file inline in the admin.
  • Fixed a bug with Railo 4.0.x, which prevented the display of log files. Reason: cfdirectory filter attribute doesn't respect pipe character as delimiter anymore.
  • Updated the styling, so tables and other layout looks normal again.

Check the Log analyzer page for more details, or go to the Railo extension store.

 

No Comments

Decoding a \unicode-escaped string in CFML

I needed to incorporate a news feed from yammer.com, which was pretty easy using their API. The return format is JSON, so all looked great. Except for the "rich text" they sent back:

Unicode escapes example cfdump

As you can see, there are a lot of "\u00.." occurences in the rich text. I searched Google for a standard CFML solution to convert these character sequences, but found nothing for CFML. So I wrote the following function, which tries to convert the string as fast as possible:

<cffunction name="unicodeEscape" returntype="string" output="no">
<cfargument name="s" type="string"/>
<!--- If no unicode-escapes present in the string: return --->
<cfif not find('\u', arguments.s)>
<cfreturn arguments.s />
</cfif>
<!--- If % is present in the string: url-encode it. Otherwise, urlDecode would choke on it --->
<cfif find('%', arguments.s)>
<cfset arguments.s = replace(arguments.s, '%', urlEncodedFormat('%'), 'all') />
</cfif>
<!--- Ascii characters (\u0000 - \u00FF) can be translated as %00-%FF --->
<cfset arguments.s = replace(arguments.s, "\u00", "%", "all") />
<!--- Higher characters (\u0100 - \uFFFF) can be translated as %01%00 - %FF%FF.
Only do this regex if there is something to replace. --->
<cfif find('\u', arguments.s)>
<cfset arguments.s = rereplace(arguments.s, "\u([0-9A-F][0-9A-F])([0-9A-F][0-9A-F])", "%\1%\2", "all") />
</cfif>
<cfreturn urldecode(arguments.s) />
</cffunction>

If there is a built-in way in CFML to decode unicode-escapes, then please leave a comment. I'd be happy to learn :)

2 Comments

Dutch CFUG networking event on March 22, 2013

I recently joined the CFUG-NL team, which had been a bit silent for the last few years. To start off, and hear about your ideas for upcoming CFUG meetings, we would like to invite you all to a networking event on March 22, 2013 in Utrecht.

Please see www.cfugnl.nl for full details, and don't forget to register. See you at Cafe Olivier!

 

No Comments

assurance