Print Page | Close Window

Some suggestions for improvement

Printed From: Web Wiz Forums
Category: Web Wiz Web App Support Forums
Forum Name: Web Wiz Forums Suggestions
Forum Description: Do you have any ideas for applications or content on Web Wiz? Then leave your suggestions here.
URL: https://forums.webwiz.net/forum_posts.asp?TID=13754
Printed Date: 29 March 2026 at 10:15am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Some suggestions for improvement
Posted By: Taka
Subject: Some suggestions for improvement
Date Posted: 10 February 2005 at 11:31am
My boss bought this application, and now wants me to create some enhancements. So i am working on that.

I must say that there is some room for improvement of the code. To give you a few suggestions:


sign_up.asp
-----------
1. Checking if an email address is on the "banned" list does not require to get all banned email addresses in a recordset, and then looping through it, and check for each record if it is equal with the submitted email address. Since long there is a way to let the database do that selection job. It is called SQL, and it looks like this:

SELECT fieldnames FROM table WHERE condition

Where the "condition" is the crux. It saves a lot of performance to let the database do the selection on the criteria, because the database is designed to do that. Especially if you put an index of the column "Email" (which it hasn't when installed). ADODB Recordsets are not. Even though there have a Filter property which also can be used (and which is faster then just looping through the complete recordset)

* Just below that, I see code that is to update the users information (or to insert a new user). Here the code uses the same procedure: get all records from all users and loop through it to see if one matches the current user (as defined by email address). It is just way too much overhead to create a recordset with all users that are subscribed. Again, let the database do the selection. SQL is the solution.

I am afraid that without changing these examples the application will rapidly decrease in performance with a larger number of subscribers.


functions_hash1way.asp
----------------------
I see many functions that do what VBScript can do standard. Some examples:

* BinaryAND(), BinaryOR().
The VBScript "AND" and "OR" operators are capable of handling bitwise comparing. From the VBS-helpfile:

"The And operator also performs a bitwise comparison of identically positioned bits in two numeric expressions and sets the corresponding bit in result according to the following table: ......"

(comparable text for operator "OR").

So there is no need to have (slow) self-defined functions for this.

* getDecHex().
Dito, it equals native VBScript function Hex().

With some thinking all functions in this include could be much faster.


I hope you don't mind that i am pointing to things like this. To be honest, I will probably gradually rewrite the complete code. When I am done, I'll send you a copy, ok?



Replies:
Posted By: Taka
Date Posted: 10 February 2005 at 12:05pm
Another example, I just rewrote a function

==================================
Function hexValue(ByVal intHexLength)

    Dim intLoopCounter
    Dim strHexValue

    'Randomise the system timer
    Randomize Timer()

    'Generate a hex value
    For intLoopCounter = 1 to intHexLength

        'Genreate a radom decimal value form 0 to 15
        intHexLength = CInt(Rnd * 1000) Mod 16


        'Turn the number into a hex value
        Select Case intHexLength
            Case 1
               strHexValue = "1"
            Case 2
               strHexValue = "2"
            Case 3
               strHexValue = "3"
            Case 4
               strHexValue = "4"
            Case 5
               strHexValue = "5"
            Case 6
               strHexValue = "6"
            Case 7
               strHexValue = "7"
            Case 8
               strHexValue = "8"
            Case 9
               strHexValue = "9"
            Case 10
               strHexValue = "A"
            Case 11
               strHexValue = "B"
            Case 12
               strHexValue = "C"
            Case 13
               strHexValue = "D"
            Case 14
               strHexValue = "E"
            Case 15
               strHexValue = "F"
            Case Else
               strHexValue = "Z"
        End Select

        'Place the hex value into the return string
        hexValue = hexValue & strHexValue
    Next
End Function
==================================

to

==================================
Function hexValue(ByVal intHexLength)
    Dim i
    Randomize Timer()
    For i = 1 to intHexLength
        hexValue = hexValue & Hex(CInt(Rnd * 1000) Mod 16)
    Next
End Function
==================================

From 43 lines (not counting empty lines and comments) to 7 lines, and with exactly the same functionality.


Posted By: Mart
Date Posted: 10 February 2005 at 5:26pm
IIRC that include is not actually made by WWG


Posted By: Taka
Date Posted: 11 February 2005 at 4:12am
IIRC that include is not actually made by WWG

I don't know what to say. It is part of the application which is being sold by WWG. In the license WWG claims copyright on the complete code. Does it mean that you are not allowed to change that code?


Posted By: wistex
Date Posted: 22 February 2005 at 7:29pm
Originally posted by Taka Taka wrote:

IIRC that include is not actually made by WWG

I don't know what to say. It is part of the application which is being sold by WWG. In the license WWG claims copyright on the complete code. Does it mean that you are not allowed to change that code?
 
No, you are allowed to change the code.  I think what he is trying to say is that what you modified was probably not written by the author of this software.  It may be part of a mod (modification) that someone else wrote that was somehow included in your installation.  There are a lot of mods out there, and some are better than others.
 
I have version 7.7a installed on one of my sites (I know I'm late upgrading) and it didn't come with the file you mentioned.  So it's probably not an original file.  But then again, I haven't downloaded the latest version yet.
 
But I'm sure your suggestions are welcome.  Bruce Corkhill (-boRg-), the author of the software, is always trying to increase its performance, and has done a wonderful job doing so.


-------------
http://www.wistex.com" rel="nofollow - WisTex Solutions
http://www.caribbeanchoice.com/forums" rel="nofollow - CaribbeanChoice Forums



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net