Navigation | Category » ColdFusion

November 4, 2010

SQL Coalesce

Have you guys ever seen the Coalesce command in SQL? I'd never heard of it til today, and it looks really useful. Say you have a table of business contact information and you want to contact a user from it; but some of the businesses don't have specific contacts, just a position; and some don't [...]

Filed by JC at November 4th, 2010 under ColdFusion, SQL
No comments on this post yet

September 16, 2010

Data truncated at ~32k… how to get CLOBbered

It was the strangest thing. A query using Coldfusion to a SQL 2005 server, extracting among other things, a large chunk of XML which needed to be parsed and transformed with XSL. It worked fine most of the time… but occasionally there would be very large XML strings, and they would get cut off at [...]

Filed by JC at September 16th, 2010 under ColdFusion
No comments on this post yet

December 17, 2009

Proper Ordered List Hierarchy

In case I ever need it again, this is the CSS to force a "proper" ordered list hierarchy all the way to 6 layers deep. (pro tip – if it's 6 layers deep, you're doing something wrong) <style type="text/css">   OL { list-style-type:upper-roman }   OL OL { list-style-type:upper-alpha }   OL OL OL { [...]

Filed by JC at December 17th, 2009 under ColdFusion, Random
No comments on this post yet

February 19, 2009

Coldfusion: DNS Reverse Lookup

I have no idea why this information was so difficult to find, but I'm posting it here in case I ever need it again. To do a reverse lookup in coldfusion: <cfscript> rawIP = createObject("java", "java.net.InetAddress").getByName('#ipaddress#').getAddress(); hostname = createObject("java", "java.net.InetAddress").getByAddress('#rawIP#').getHostName(); chostname = createObject("java", "java.net.InetAddress").getByAddress('#rawIP#').getCanonicalHostName(); </cfscript> Note — this is slow. If you're doing them in [...]

Filed by JC at February 19th, 2009 under ColdFusion
3 persons have commented this post

Distance in CF — Mostly useless, but fun

Assumption: table named locations that has a location name and the location's latitude & longitude as a single field, with lat and lon comma separated, both in signed degrees format. This is an intentional cartesian join… so if you have a lot of locations, use with care. <cfquery datasource="MyDSN" name="getDist"> SELECT DISTINCT        a.latlon AS [...]

Filed by JC at February 19th, 2009 under ColdFusion
No comments on this post yet

June 27, 2008

CFDBinfo — What can you see?

A month or so ago I had to throw together a script to help with some forensics, it strikes me that it might come in handy for other people, so I'm going to post it here. Just edit the first bit and provide it with your datasource name, and run it. You might need to [...]

Filed by JC at June 27th, 2008 under ColdFusion
No comments on this post yet

June 4, 2008

Assorted Coldfusion stuff I need occasionally and always forget.

I keep this in a file on my desktop.. may as well put it here, too… maybe it'll help someone someday. CRLF: cfset crlf = #chr(13)#&#chr(10)# Variable Variables: cfset varvar = "MyVarName" cfset "#varvar#" = "whatever" #evaluate(varvar)# outputs "whatever", #varvar# outputs "MyVarName" Existence/Type Test: StructKeyExists() IsDefined() (isDefined fails on complex vars with[], use dot notation) [...]

Filed by JC at June 4th, 2008 under ColdFusion, Web Stats
3 persons have commented this post

March 31, 2008

CF8 change gotcha

Here's a little thing I ran across today that might be worth noting — in CF8 there were apparently some changes in how a couple of the system commands work. I had an old snippet of code set up as a custom tag, it dumped out the last modified date of the file at the [...]

Filed by JC at March 31st, 2008 under ColdFusion
No comments on this post yet