CodeSOD: Classic WTF: Logical Tiers? That Makes No Sense!
It's that time of year when we take a short summer break, and that means we reach back into the archives for some classic WTFs that remind us of when things were better. Or worse. So much worse. Today, we find out where checkboxes come from. Original --Remy
Some developers just don't believe in "standards." I should know, I used to work with some of them. They had their own way of doing things, from reinventing the database to changing the web paradigm. I always found it ironic that these folks have a pretty good knowledge of the tools, but could never seem to figure out how to use 'em. Like Chris' predecessor, who seems to have done the equivalent of tightening screws with a voltammeter.
[Advertisement] Continuously monitor your servers for configuration changes, and report when there's configuration drift. Get started with Otter today!Ok, so I had to port over an ASP app to Coldfusion MX. It was a simple set of search pages so I didn't think it would take too long. Problem was, I couldn't find anywhere in the code where the HTML for one of the select boxes was. Silly me, I should have checked inside the SQL Server stored procedure first! And of course, this is just the tip of iceberg on this site. There were stored procedures that were used to build the actual HTML for the dynamic navigation as well.
CREATE PROCEDURE GetDepartmentDropDownASIF ((SELECT COUNT(*) FROM Staff_DepartmentLink) > 0)BEGIN CREATE TABLE #HTML (src varchar(1000)) INSERT #HTML (src) Select '<SELECT name="DepartmentID">' INSERT #HTML (src) SELECT '<option value="-1" SELECTED>(None Selected)</option>' INSERT #HTML (src) SELECT DISTINCT '<option value="' + CONVERT(varchar(6), DeptID) + '">' + DepartmentName + '</option>' As src FROM StaffDepartments INNER JOIN Staff_DepartmentLink ON StaffDepartments.DepartmentID = Staff_DepartmentLink.DeptID ORDER BY src INSERT #HTML (src) SELECT '</SELECT>' SELECT src As 'rowsrc' FROM #HTML DROP TABLE #HTMLENDELSE Select '<i>No Departments Defined</i>' As rowsrc