old code

Build a List of Hours (Classic ASP)

You could need a list of "Hours" for any number of reasons, for a select box, checkboxes, radio buttons, etc. In the following example, I create a list of "Hours" to run along the top of a table. What strikes me interesting about this code is that although it was written in 2001, its very adaptable to generating hour lists today.

Function BuildHourList()
	Dim i, iOffSet
	For i = 8 to 20
		' ---- if past 12 noon, 
		If i > 12 Then iOffSet = -12 
		Response.Write "" & iOffset + i & ":00"
	Next
End Function

The Beauty of a Complicated Function Comment Header (Classic ASP)

Without boring you with details, I wrote an application back in 2003 for a medical billing company. Their team was extremely small, so when I left the project, I made sure they had some very clear documentation. The function headers were my favorites. Here's an example.

Well written comments that are clear and easy to read is very important to code maintenance and reducing technical debt incurred as old applications lose their orriginal developers.

keywords: 

Formatting Hours and Minutes (Classic ASP)

And another old code segment, this time formatting "Hours" and "Minutes". The trick for the minutes is to return one of the quarter hours. If the minutes evaluate to "0", then "00" will return instead.

keywords: 

Searching a Very Long String - Efficiently (Classic ASP)

When it comes to string handling, ASP isn't the most efficient. The easiest code to write is simply instr(1,ucase(search),ucase(find)), and then check the result for > 0. The problem comes with extremely long strings. I needed to search a very long string of values from each line of CSV. It was actually much faster to split each line into its individual elements and search one cell at a time. Here is the code.

Removing Tag Attributes from HTML - Classic ASP

When parsing a string of HTML to enterrogate for data, sometimes the HTML attributes would create unneeded headaches. I wrote this function to take a string of HTML and remove all tag attributes.

keywords: 

Parsing HTML Text - Removing Unneeded Tags (More Classic ASP)

This little function was a nifty way to remove unneeded HTML tags from a string. Used this to clean up "screenscrapes" of reports generated in HTML before parsing the content.

keywords: 

Convert HTML table into ASP Array

At some point, I was parsing HTML text and needed to convert a table to an Array. The code basically strips any attributes, then cycles through all of the cells and returns an array. I used this code when converting reports from another system (that emitted HTML) to be used in data aggregation functions.

keywords: 

Using the FileSystemObject to Retrieve Text From a File - Classic ASP

Another section of old ASP code from 10+ years ago. This example retrieves the contents of a text file. With the security placed on most web hosting companies now, its unlikely this code will work in a hosted environment.

Subscribe to RSS - old code