Submitted by Joe Lippeatt on Thu, 10/07/2010 - 16:56
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.
Dim i, iOffSet
For i = 8 to 20
' ---- if past 12 noon,
If i > 12 Then iOffSet = -12
Response.Write "" & iOffset + i & ":00"
Submitted by Joe Lippeatt on Thu, 10/07/2010 - 16:50
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.
Submitted by Joe Lippeatt on Thu, 10/07/2010 - 16:34
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.
Submitted by Joe Lippeatt on Thu, 10/07/2010 - 14:36
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.
Submitted by Joe Lippeatt on Thu, 10/07/2010 - 14:29
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.
Submitted by Joe Lippeatt on Thu, 10/07/2010 - 14:26
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.
Submitted by Joe Lippeatt on Thu, 10/07/2010 - 14:22
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.
Submitted by Joe Lippeatt on Thu, 10/07/2010 - 14:07
Having written code for as long as I have, there's quite a bit of "old" garbage that is completely useless today. Believe it or not, I still get search-engine hits on my original site (lippeatt.com) for older "classic" asp code examples, so I hate to throw anything away.