Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Some suggestions for improvement
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Some suggestions for improvement

 Post Reply Post Reply
Author
Taka View Drop Down
Newbie
Newbie


Joined: 10 February 2005
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Taka Quote  Post ReplyReply Direct Link To This Post Topic: Some suggestions for improvement
    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?
Back to Top
Taka View Drop Down
Newbie
Newbie


Joined: 10 February 2005
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Taka Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 10 February 2005 at 5:26pm
IIRC that include is not actually made by WWG
Back to Top
Taka View Drop Down
Newbie
Newbie


Joined: 10 February 2005
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote Taka Quote  Post ReplyReply Direct Link To This Post 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?
Back to Top
wistex View Drop Down
Mod Builder Group
Mod Builder Group


Joined: 30 August 2003
Location: United States
Status: Offline
Points: 877
Post Options Post Options   Thanks (0) Thanks(0)   Quote wistex Quote  Post ReplyReply Direct Link To This Post 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.


Edited by wistex - 22 February 2005 at 7:31pm
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.