Can I have someone take a look at this code and let me know if you see any problems with it... In terms of efficiency, error control, etc... :) Thank you! This is my first completely self created Function. -
<%
-
Function WebTracking(sTracking)
-
Dim shipArray(2)
-
shipArray(0)="<a href=""http://www.fedex.com/Tracking?tracknumbers="
-
shipArray(1)="<a href=""http://www.calover.com/trackres.asp?tracking_number="
-
shipArray(2)="<a href=""http://wwwapps.ups.com/WebTracking/processInputRequest?AgreeToTermsAndConditions=yes&tracknum="
-
-
If IsNull(sTracking) Then
-
LenTracking = 0
-
Else
-
LenTracking=Len(sTracking)
-
End If
-
-
Select Case LenTracking
-
Case 12 'Fedex length
-
WebTracking = shipArray(0) & sTracking & """>" & sTracking & "</a>"
-
Case 15 'California Overnight / FedEx Ground Length
-
If UCase(Left(sTracking,1)) = "C" Then 'California Overnight
-
WebTracking = shipArray(1) & sTracking & """>" & sTracking & "</a>"
-
Else 'FedEx Ground
-
WebTracking = shipArray(0) & sTracking & """>" & sTracking & "</a>"
-
End If
-
Case 18 'UPS Length
-
WebTracking = shipArray(2) & sTracking & """>" & sTracking & "</a>"
-
Case 20 'Fedex Ground
-
WebTracking = shipArray(0) & sTracking & """>" & sTracking & "</a>"
-
Case Else
-
WebTracking = sTracking
-
End Select
-
End Function
-
%>
-
I stored the values in an array to hopefully speed up processing. I haven't seen any slowed down pages from this new script... Again, my very first Function, let me know! :) I'll be adding some comments in the code as well later on.
5 1365
Looks fine to me... you could try wrapping all concatenations with parenthesis. You might get a millisecond or two out of it :D
What do you mean wrapping in Parenthesis? I've not heard of this before... -
sWebTracking = (sWebTracking & "something " & sSomethingElse)
-
???
Yeah, pretty much exactly what you have there.
I've heard it makes things speedier, given ASP VBScript's concatenation efficiency (of which I have no benchmarks to show you or tell you about.) It's just one of those lores you hear thrown about. But, maybe you'll be the one to debunk it :D
I'd love to debunk it.. Perhaps you know of some code to capture information in milliseconds? I believe the "Now()" returns only seconds... Better yet, I'll just provide the code I found at: http://classicasp.aspfaq.com/general...-asp-code.html -
<%
-
' get timer before task begins:
-
-
starttime = Timer()
-
-
' do some task, e.g.:
-
-
Do While z < 350000
-
z = z + 1
-
Loop
-
-
' get timer after task completes:
-
endtime = Timer()
-
-
' display results:
-
Response.Write "The task completed in " & endtime-starttime & " s"
-
Response.Write " (" & (endtime-starttime)*1000 & " milliseconds)."
-
%>
-
Eh, this won't give you the exact measure of milliseconds, because all your doing is multiplying by 1000. Multiplying by 1000 only provides the exact data, but represented by a different unit of measurement.
1 second will always = 1000 milliseconds
20 seconds will always = 20,000 milliseconds.
I say this because I believe that, when a time measurement is called, VBScript supplies only the nearest whole second, i.e. you'll never get 21.2 second measurements.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Stefan Richter |
last post by:
Hi, after coding for days on stupid form validations -
Like:
strings (min / max length), numbers(min / max value), money(min / max
value), postcodes(min / max value), telefon numbers,
email adresses and so on.
I thought it might be a better way to programm an automated, dynamic
form validation that works for all kinds of fields, shows the
necessary error messages and highlights the coresponding form fields.
|
by: wumingshi |
last post by:
Hi,
When validating an XML instance, sometimes the schema is not enough to
expression the validation rules. Additional validation rules may be
expressed in an application-specific way. For example, using XPath or
Java method. So is there a concept and/or standard for post-schema
validation or application validation? Is there any hook in XML
standards that allow me to hook up with my customized validation?
Additionally and more...
|
by: Tim Meagher |
last post by:
I am trying to use both validation controls and to add submit button
attributes, but when I add the button attributes, the javascript fpr the
validation controls is no longer created for the page. How can I use both?
Thank you,
Tim Meagher
|
by: Matt |
last post by:
I want to know if ASP.NET Web Forms Validation Controls are Server-Side or
Client-Side form validation? Since I think each validator control can select
either 1) JavaScript based error dialog or 2) show the error message next to
the control. For example, if the text field is empty with RequiredField
Validator control, it can show the value in ControlToValidate property in
two ways as I mentioned.
Please advise. Thanks!
|
by: Stephen |
last post by:
Hi,
the validation controls dont work on Netscape or Mozilla and only on
Internet Explorer
why? How do i correct this problem?
Thanks
| |
by: Ryan Ternier |
last post by:
We're running a site that has required field validation on the login page.
It works fine on our development / test machines. However, when I upload
this site to our live server i get this error.
In IE, the validation works, but no form ever gets submited. It doesn't even
process the click event of the button. In mozilla, it works 100% (this is
weird because it's usually the oposite).
Any thoughts?
|
by: Chris |
last post by:
Based upon some prevoius postings on what to do for adding a 'add' row to a
datagrid I utilize the footer to create the 'add' row. The only issue is that
I have it sharing the 'UpDate_Command' and I use an argument to difference
between an 'edit' vs. and 'add. But since I have field validation on both
'footer' and 'edit' columns I can't submit my edits since the footer
validation kicks in.If I take the validation off then the both work fine...
|
by: David Colliver |
last post by:
Hi all,
I am having a slight problem that hopefully, someone can help me fix.
I have a form on a page. Many items on the form have validation controls
attached.
Also on this form are linkbuttons which must not cause validation. I have
found a setting "causeValidation" to disable the validation.
Also on the page, I have a datagrid that I will edit lines on. I can click
|
by: dustbort |
last post by:
I recently had a problem where my required field validator stopped working.
But, the page still posted back and tried to insert a record into the
database without performing server-side validation. I discovered that there
was no aspnet_client folder in the root of my IIS Web site, and when I ran
"aspnet_regiis -c", client-side validation was working again. However, what
I don't understand is why the required field validator did not...
|
by: Jon Paal |
last post by:
validation doesn't fire
what's missing ?????
/////// ---- code -----///////////////////////////
Sub btnSubmit_Click(sender As Object, e As System.Web.UI.ImageClickEventArgs) 'Handles btnSubmit.Click
If page.isValid then
.....
end if
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |