[thelist] OT - do programmers/designers know *everything*?

Chris Blessing webguy at mail.rit.edu
Thu Jul 25 09:00:01 CDT 2002


Damn I was hoping to escape unscathed...

<tip author="Chris Blessing" type="using constants to define
multidimensional array indexes in ASP">
When using multidimensional arrays in ASP, it's very helpful (code-wise) to
use constants for index values.

Example: you have an array customers(3,x) (where x = any number of "rows" in
this array)
customers(0,x) is the userid for your customer's account in your db
customers(1,x) is the first name of the customer
customers(2,x) is the last name of the customer

Instead of using numbers to access the "columns" of the array (the first
dimension), why not setup constants at the top of the page (or better yet,
in your universal include that you have setup for db connections, etc.)
which define said column indexes?

const useridIndex = 0
const fnameIndex = 1
const lnameIndex = 2

Now you can use these constants instead of the numbers, and hopefully they
will give you some insight as to what the hell you wrote earlier.

Example:

for i=0 to ubound(customers,2)
	customers(useridIndex,i) = userid
	customers(fnameIndex,i) = fname
	customers(lnameIndex,i) = lname
next
</tip>

Chris Blessing
webguy at mail.rit.edu
http://www.330i.net

> -----Original Message-----
> From: thelist-admin at lists.evolt.org
> [mailto:thelist-admin at lists.evolt.org]On Behalf Of Steve Cook
> Sent: Thursday, July 25, 2002 9:47 AM
> To: 'thelist at lists.evolt.org'
> Subject: RE: [thelist] OT - do programmers/designers know *everything*?
>
>
> As Aardvark pointed out earlier...
>
> "to everyone posting on this thread, if you're talking about liquor or
> age, or small puppies, then your posts are off-topic and require a
> <tip>... and not just a sissy <tip>, but something that has some
> value to you, or at least a newbie...
>
> so, <tip> away, folks..."
>
> Or alternatively, move the thread to "The Chat" list.
>
> ... and while we're at it, it is recommended that you trim your
> posts on The
> List.
>
>
> .steve
>
> <tip type="error handling in ASP">
>
> If you want to use "on error resume next" in only a section of
> your code you
> have two possibilities. You can move the code to a subroutine or function.
> If you declare "on error resume next" within a sub or function it
> will apply
> only for that particular routine and return to normal bahaviour
> when exiting
> the routine.
>
> Alternatively you can turn off the behaviour with the following less wll
> known statement:
> 	on error goto 0
>
> This can be very useful if you just want the ability to catch errors in a
> small piece of code.
>
>
> </tip>
>
>
>
> -------------------------------------
>  Cookstour - http://www.cookstour.org
> -------------------------------------
>
>
> > -----Original Message-----
> > From: Chris Blessing [mailto:webguy at mail.rit.edu]
> > Sent: den 25 juli 2002 15:29
> > To: thelist at lists.evolt.org
> > Subject: RE: [thelist] OT - do programmers/designers know
> > *everything*?
> >
> >
> > Oh believe me, go we to Canada quite a bit!  Niagara is about
> > 50 minutes
> > away, TO about 3 hours.  It's been my only legal outlet for the last 3
> > years. :D
> >
> > Chris Blessing
> > webguy at mail.rit.edu
> > http://www.330i.net
> >
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of thelist go to:
> http://lists.evolt.org Workers of the Web, evolt !




More information about the thelist mailing list