Blog

Blog Archives - 103 Record(s)

Remove Filter Year: '2008'

ColdFusion, JSON, and Booleans

Posted by Brad Wood
Sep 10, 2008 08:17:00 UTC
Last night I found myself wrestling with the behavior of ColdFusion's JSON serializing where the strings "yes" and "no" are converted to a Boolean and come out the other side as "true" and "false". This happens when variables are passed through SerializeJSON(), or a CFC is called with returnFormat="json". Nathan Mische pointed out not too long ago that 1 and 0 are NOT converted to Booleans, which is interesting. I have a feeling the logic goes something like this: If string can be converted to a number Treat it as a number Else if it can be converted to a Boolean Treat it as a Boolean Else Treat it as a string 1's and 0's probably get picked off early that way. As annoying as it is though, I'm not sure what the better solution would be. Unfortunately, in a loosely typed language the server has to make guesses for you that can be kind of un-forgiving when you translate them to a strictly typed language. In my case, I was passing back a result set to be bound to a cfgrid, so I didn't really have much control of how it displayed once it left the server. I needed it to come back from the server in the correct format. My solution was to add a space before or after each word such as "yes " and "no ". It's not quite optimal, but it works. The results were left as string and made it safely back to the browser. As far as a work-around from Adobe, I had originally thought of adding an additional setting called strictBooleanParsing or something, but what worked for one person would probably never work for someone else. In the end, it might have been best for them to ONLY accept "true" and "false" as Booleans. I don't think that would be too much to ask programmers to do. I mean, it's nice that you can be all loosey-goosey inside of ColdFusion with your data types, but I wouldn't expect that same kind of freedom when I want to convert my data to a less forgiving format. This might never be changed though given the backwards compatibility issue. There is probably code out there now that depends on "yes" and "no" turning Boolean. What would your solution be?

How to axe your transaction log

Posted by Brad Wood
Sep 06, 2008 00:36:00 UTC
If you are using MS SQL Server and ever want to just obliterate your transaction log, you can use the following SQL (where your database name is "foo"): BACKUP LOG foo WITH TRUNCATE_ONLY DBCC SHRINKFILE(foo_log,2) Don't ever do this to a database you care about like, say, production. I wanted this because I am screwing around creating rainbow tables of SHA-1 hashes. The Cartesian product of joining a table to itself on 1=1 is very handy for producing all possible combinations of a set of characters. Inserting a few million records can put a lot of crap in your transaction log though.

ColdFusion SQL Color Coder

Posted by Brad Wood
Sep 03, 2008 21:41:00 UTC
A while back while building a monitoring tool for running processes on SQL Server 2005 I encountered the desire to color code SQL in the same manner of MS Query Analyzer (Or Management Studio) for HTML output. I hit up the CF-Talk list and Google for an existing ColdFusion implementation but got crickets. Not being one to give up, I created my own.

Academic ColdFusion finally available.

Posted by Brad Wood
Sep 03, 2008 09:03:00 UTC
Hallelujah! According to Kristen Schofield's blog (ColdFusion Product Marketing Manager), the academic version of ColdFusion is now available for educational institutions teaching ColdFusion. http://www.webbschofield.com/index.cfm/2008/9/2/ColdFusion-8-Now-Available-to-Students-and-Educators-for-Free

XML-RPC: Alive, yes; but still kicking?

Posted by Brad Wood
Aug 30, 2008 18:31:00 UTC
I've built and consumed SOAP web services. I've consumed REST web services. It wasn't until a couple days ago I got a chance to consume an XML-RPC web service. I'll readily admit, I'm still a little unsure of the exact differences between the two, but the more I Google, the clearer it is becoming.

Radio doesn't Shack like it used to

Posted by Brad Wood
Aug 29, 2008 03:57:00 UTC
I was working on a friend's multi-meter today and found myself needing to run to RadioShack. I'd rather not elaborate why I needed to fix my friend's multi-meter. It involves a test lead in the Ohms plug, 120 Volts AC, 2 blown fuses, 1 smoked capacitor and me. Suffice it to say I set out to fetch a new ceramic capacitor with radial leads, measuring 82 pico farads that wasn't shorted out.

Delay Evaluation: What does the de() function do anyway?

Posted by Brad Wood
Aug 28, 2008 09:10:00 UTC
If you have ever used the iif() (inline if) function in ColdFusion you have probably found yourself using the de() (delay evaluate) function as well. I remember using that function for quite some time without ever really understanding when I needed it and exactly what it did. I found myself explaining it to someone last week and thought it would be an interesting topic to blog.

Installed SQL Server 2005 Express

Posted by Brad Wood
Aug 25, 2008 19:06:00 UTC
I installed SQL Server 2005 Express today on my home PC. For the most part it was painless, but there were a couple snags. First, it took me a couple tries to find the right download page. A bunch of the links on Microsoft's site kept redirecting me to the 2008 page. Still other pages wouldn't even mention 2005.

JavaScript Error at feeds.adobe.com

Posted by Brad Wood
Aug 25, 2008 06:09:00 UTC
Have I been the only person constantly annoyed by the JavaScript error that pops up on EVERY SINGLE page at feeds.adobe.com? Apparently you only get the message in IE. It is related to some site tracking code called SiteCatalyst and apparently doesn't run for Firefox. I kept assuming Adobe would fix it, but it's been weeks, so I finally fired up MS Fiddler to have a look.

ColdFusion Academic Version: Curriculum Needed

Posted by Brad Wood
Aug 20, 2008 05:41:00 UTC
Adobe announced their free academic version of ColdFusion at CFUnited this year that would be available to educational institutions teaching ColdFusion. The release has been plagued by delays, but they promise it is coming soon. During a discussion today on the CF-Talk list about it, the topic of textbooks for teaching ColdFusion came up. I bugged Ben Forta about it and he stated that while they would love to release official teaching materials with it, they haven't received approval for it from the Adobe big cheese yet and he's not holding his breath.

Site Updates

Entries Search