Article 4Q34 CodeSOD: Waiting for File IO…

CodeSOD: Waiting for File IO…

by
Remy Porter
from The Daily WTF on (#4Q34)

Trisha had the misfortune to inherit some old Cold Fusion code. One particular block needed to see if a file existed before it continued, and apparently the original developer really wanted to be patient and make sure the file was there, so they wrote this:

<cfif not fileExists(tPath)> <cfset CountR = 0> <cfloop index="ii" from="1" to="1000000"> <cfset CountR = CountR + 1> </cfloop> <cfif not fileExists(tPath)> <cfset CountR = 0> <cfloop index="ii" from="1" to="1000000"> <cfset CountR = CountR + 1> </cfloop> <cfif not fileExists(tPath)> <cfset CountR = 0> <cfloop index="ii" from="1" to="1000000"> <cfset CountR = CountR + 1> </cfloop> <cfif not fileExists(tPath)> <cfset CountR = 0> <cfloop index="ii" from="1" to="1000000"> <cfset CountR = CountR + 1> </cfloop> <cfif not fileExists(tPath)> <cfset CountR = 0> <cfloop index="ii" from="1" to="1000000"> <cfset CountR = CountR + 1> </cfloop> <cfelse> <cfset Good2Go = "Yes"> </cfif> <cfelse> <cfset Good2Go = "Yes"> </cfif> <cfelse> <cfset Good2Go = "Yes"> </cfif> <cfelse> <cfset Good2Go = "Yes"> </cfif><cfelse> <cfset Good2Go = "Yes"></cfif>
inedo50.png[Advertisement] BuildMaster is more than just an automation tool: it brings together the people, process, and practices that allow teams to deliver software rapidly, reliably, and responsibly. And it's incredibly easy to get started; download now and use the built-in tutorials and wizards to get your builds and/or deploys automated! TheDailyWtf?d=yIl2AUoC8zA3Y_dFsPpas8
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments