Entries for month: December 2010
E-mail Obfuscation
Posted by Ryan Heldt in ColdFusion on December 28, 2010
I needed a quick and dirty way to obfuscate e-mail addresses from the various harvesters of doom out there, so I came up with the following. Enjoy!
Example 1: #obfuscateEmail("someone@special.com")# Returns an obfuscated e-mail address.
Example 2: #obfuscateEmail("someone@special.com",true)# Returns an obfuscated e-mail address wrapped inside a mailto: link.
<cffunction name="obfuscateEmail" access="public" returntype="string" output="false">
<cfargument name="email" type="string" required="true" />
<cfargument name="generateLink" type="boolean" required="false" default="false" />
<cfscript>
var strReturn = "";
var strMailTo = "&##109;&##97;&##105;&##108;&##116;&##111;&##58;";
var intIndex = 0;
for (intIndex=1; intIndex lte len(arguments.email); intIndex++) {
strReturn = strReturn & "&##" & asc(mid(arguments.email,intIndex,1)) & ";";
}
if (arguments.generateLink) {
strReturn = "<a href=""" & strMailTo & strReturn & """>" & strReturn & "</a>";
}
</cfscript>
<cfreturn strReturn />
</cffunction>
Autotune the SQL
Posted by Ryan Heldt in SQL , ColdFusion on December 19, 2010
While doing development for my employer, I work primary locally – except for the database. For that I connect remotely to their development SQL Server box. The setup has been working famously for some time now, despite an occasional hiccup. However, more recently things started to slow down to a snails pace. 30 seconds to run a page pace. This was noticeable not only in ColdFusion but also though SQL Management Studio. Very simple queries would take in excess of 5 secs to run. After confirming the server was fine, I started doing some digging. After various tweaks and experiments, I discovered that Windows 7 has some sort of network auto-tuning feature which was the root of the problem. All I needed to do was run the following at the command line:
netsh interface tcp set global autotuninglevel=normal
After a reboot for good measure, my SQL connections are slick and quick again. I have to credit the following article for this find. http://social.msdn.microsoft.com/Forums/en-US/sqldataaccess/thread/be6fc3c4-5c70-480d-9175-0d95a898a41c/