technology

technology

Ajax: The Basics And Get

I've been working with some aspects of the Ajax group of technologies lately. It sounds complicated and difficult to learn, but it really isn't. It uses the XMLHttpRequest object supported by many browsers. My current development requires I code for IE and Firefox, although it seems to be functional in Netscape.

To use the XMLHttpRequest object, I put together two simple functions and put them in a file named SimpleAjax.js. Here are the functions:

MS SQL: Using A Case Statement In A View

Here is a neat trick for using conditional processing in a view.

I needed to create a view that contained an employee id and employee name amongst other data. The original view included two joins, but for the sake of simplicity, I have altered the view. This view uses a case statement to determine which "full name" to show, the full name using the first name or the full name using the nickname if the employee has one.

SQL: Totaling A Column Containing Varying Values

I have been doing quite a few surveys recently and one of the tasks involved is mining the responses for data. Here's a neat trick I learned for totalling and counting responses using sql rather than programmatically on the front end.

Let's say you have a table of customers (tblCustomers) that houses the name of each person and the flavor of ice cream each customer prefers:

Detecting A Secure Server Using ColdFusion

I needed a quick tag to detect if the page the tag resided in was called using a secure URL. Unfortunately, the CGI function was not easily found, so here it is.

<cfif CGI.HTTPS EQ "off">

<cfset NewLink = "https://" & #CGI.HTTP_HOST# & #CGI.PATH_INFO#>

<cfif #CGI.QUERY_STRING# NEQ "">
<cfset NewLink = NewLink & "?" & #CGI.QUERY_STRING#>
</cfif>

</cfif>

Spell Check In SQL

I was tasked yesterday with writing a spell checker for an up-and-coming application. I completed the meat of the functionality today, done in sql. It's actually very acurate, pulling most words within the first 15 suggestions, but many within the first 5. It uses a table comprised of 62,070 words (a dictionary I imported from a flat file word list), which speaks to the procedure's accuracy as there are many names, cities, acronyms, etc., with the corresponding soundex values.

Some IP Parsing Fun Using ColdFusion

I know some of you have been dying for code (yeah, right) so here's a small function I made for parsing an IP address. I needed the last byte to determine if the machine calling the page was a developer's machine or not.

<cfoutput>
<cfset BegPos = 1>
<cfset EndPos = 1>
<cfset ip = #CGI.REMOTE_ADDR#>
<cfset ByteArray = ArrayNew(1)>

<cfloop index="i" from="1" to="4">
<cfset EndPos = #FIND(".", ip, BegPos)#>
<cfif EndPos GT 0>
<cfset ByteArray[i] =