I made a promise to myself a while ago. Every time I do something stupid, I’d blog it. Not to impress people with the depths of my ineptitude, but to remind my friends that simple mistakes don’t stop happening no matter how long you develop. (Well, at least for me.)
Daryl Banttari pinged me earlier today to mention that the Twitter feed for ColdFusionBloggers (http://www.twitter.com/cfbloggers) was screwing up the links. The title would say X, yet when you clicked you ended up on Y, some completely different title.
Turned out to be a completely simple mistake. I had run a test on my dev machine earlier in the day. The code that sent messages to Twitter ran just fine on my local machine and “polluted” the live feed.
This is just one more reminder of keeping in control of the code that impacts stuff outside your web server. Mail stuff is another example of course. That’s a bit easier to handle since normally your local dev environment won’t be running a mail server.
My fix was rather simple. I just added a check in Application.cfc/onApplicationStart to see if it was running on the local server.
<cfif findNoCase("dev2", cgi.server_name)>
<cfset application.localserver = true>
<cfset application.localserver = false>
p.s. The dev2 comes from me using dev2 locally for the second version of ColdFusionBloggers.org.