snow leopard ate my apache config files

Being a Mac Geek, I purchased Snow Leopard and did the upgrade this past Sunday night. I did not get a chance to make sure everything worked after the upgrade, but I assumed it did.

Today, however, I tried to start up one of my ColdFusion instances and then went to a site. I got the big "Forbidden You don't have permission to access / on this server." error message in my browser. After doing some digging and working with Phil, our Mac god, we found that the httpd.conf file was modified. Around line 173 of that file, there is a block of code that was changed to this:

<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
</Directory>

That last line is the key. I changed "Deny" to "Allow" (case sensitive without the quotes). Then I restarted Apache.

Once that was done, I got the "Not Found The requested URL / was not found on this server." error. We used named servers in Apache. Well, I looked in the httpd-vhosts.conf file, and it has wiped out my entire file! This is where I had all of my servers set up. I had to find an old copy and get one from a coworker (thanks Asha!) to get back up and running.

So, before you upgrade to Leopard, make sure to back up your httpd.conf file and any of the files in the apache2/extra directory!

I did find that in the apache2/users directory there was a file entitled myusername.conf which has what was the original of the code posted above. So the upgrade knew enough to save this off, just not the other stuff.

the importance of the de function

Today I was adding some functionality to a file upload tool. It rips through a comma separated file provided by clients and then based on what is in that file, inserts data into the database.

Because of some legacy database column types and some flexibility that is needed, we could possibly put a date in a varchar field. This date must be formatted correctly, or the string to string comparison will not work.

Here is the code I was using to check for a date within a cfprocparam tag:

<cfprocparam cfsqltype="CF_SQL_VARCHAR" type="in" value="#iif(isDate(arguments.uploadFile.getField2(),dateFormat(arguments.uploadFile.getField2(),"mm/dd/yyyy"),arguments.uploadFile.getField2())#">

So, what it did, was instead of taking the value I wanted in there, it evaluated it out and it did the math of (1/1/1965) and put a huge decimal into the database. I couldn't figure it out until one of my coworkers said, you forgot the de() function! If you don't add the de() function in there you get some weird results. If you have a dynamic ColdFusion variable you want to use in an iif() you need the de() function. My solution was this:

<cfprocparam cfsqltype="CF_SQL_VARCHAR" type="in" value="#iif(isDate(arguments.uploadFile.getField2(),de(dateFormat(arguments.uploadFile.getField2(),"mm/dd/yyyy")),de(arguments.uploadFile.getField2()))#">

coldfusion tip of the day

I am trying to blog more often. So, to help with that I am going to try to start doing a "Tip of the Day", even though it might not be every day. See, I am already trying to get out of it.

I was looking at some code today, and could not figure out why something was not displaying. Here is the if statement I was looking at:

<cfif isQuery("variables.myQuery")>
Show something here.
</cfif>

Do you see it? I didn't at first either. ColdFusion is treating variables.myQuery as a string. The solution I used was to remove the quotes, and everything worked. You could also put pound signs around variables.myQuery inside the quotes.

BlogCFC was created by Raymond Camden. This blog is running version 5.7.002.