Randomize Array Keys

I want to do something that should be simple, it is in php, but i can't seem to find any array functions in asp to do this. I have an array with x number of items (the x may change, could be 10/50/etc.) that will start with 1 and end with x.

For example (excuse my poor syntax):
myArray[0] = 1
myArray[1] = 2
myArray[2] = 3
myArray[3] = 4
etc.

What I want is to call a function and randomize the array as a new array, so for example:
randArray[0] = 3
randArray[1] = 1
randArray[2] = 4
randArray[3] = 2

View Replies


ADVERTISEMENT

Randomize All Records

I was asked to create a test with 50 questions using MS Access (that's all we can afford). All question will load then show in random order (no duplicates, plus a link for the next question) then provide a "Thank you!" page at the end. This is so even when two people take the test they will have all 50 questions but each in a different order.
I've found several samples, some would let display the questions but in the same order everytime, while others would randomize them but with duplicates and I would'nt know when I got to the end because it would keep randomizing all day long.

View Replies View Related

Randomize Pages

how can i randomize pages ?
Eg. when a user login and he click on a link, he will come to a start page(start.asp) and when he click on the button continue (take_test.asp), he will get the randomized page (question_1.asp or question_4.asp...question_3.asp etc)

View Replies View Related

Randomize Records

I am veiwing a set of records from Microsoft Access in asp. The records are in alphabetical order but I would like them to be randomized.

This is my code as it is at the moment. The Database is called tourguides.mdb and the table is called Cat1. I hope this is enough information. Code:

View Replies View Related

Randomize Function Problem

I'm using a randomize function to display a different featured product, but there are certain items that I want to omit. Here's the code I'm using:

<%
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "Driver={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/theDB.mdb")
randomize
rdm=int(rnd*15)+246

sql = "SELECT * FROM kbs WHERE kbs.id = " & rdm & " AND kbs.subject NOT IN (20,21)"
set rs=conn.execute(sql)
%>

It's selecting a range of product IDs and it's s'posed to exclude all IDs whose subject is either subjectID 20 or 21. It works fine except when it comes to items with those subjects and then it displays this error message:

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

View Replies View Related

Generate Randomize Number

i trying to generate randomize number between in the range of 1 to 9999 using the below code. DNum* is between 1 - 9

RandValue = CLng((2^7*(ID1Num1))+(2^6*(ID1Num2))+(2^5*(ID1Num3 ))+(2^4*(ID1Num4))+(2^3*(ID1Num5))+(2^2*(ID1Num6)) +(2^1*(ID1Num7))+min1+min2+sec1+sec2)

then i put the randvalue where is usually generate number between 400-to-1500 into the below formula, any suggestion on how to improve the below code?

num_pmax = Int((9999 * Rnd) + 1)
num_pmin=1
value1 = Int((Num_pmax-Num_pmin+1)*Rnd+Num_pmin + RandValue)

View Replies View Related

Generate Randomize Numbers Based On A String Of Text

i trying to randomize a string of text inc. number and alpha. e.g. 024053J

what is the approach to generate a few integer numbers from this string "024053J" ?

i tried to this way of randomize but not very efficient as in sometimes the user will get the same numbers back when the page is refresh.

So i thought to use a string of text to generate the randomize numbers.

randomize()
num_pmax=100
num_pmin=1
r2=Int((num_pmax-num_pmin+1)*rnd+num_pmin)

View Replies View Related

Shortcut Keys

I am designing Admin pages for my web site.I am using HTML frames, VBscript, Javascript, ASP , Microsoft Access as database etc.

I want when any Administrator put focus on any perticular frame and press some shortcut keys (like CTRL+A) then in the same frame one link called 'Admin' should be visible and active which then drive Administrator in Admin area to make necessary changes.For the rest user this Admin section would not be visible at all.

View Replies View Related

Primary Keys

Does anyone know how I can open up an entry in a microsoft access database table using its primary key through asp?

View Replies View Related

Trapping F1, F2, F3, F4, Etc. Keys

Is there a way to trap F1, F2, F3, F4 etc. keys on ASP and have our own
codes to do whatever necessary for each of those keys ?

View Replies View Related

Ascertain Primary Keys

Is it possible to ascertain which fields are the primary keys from an Access table just using asp? If so how?

View Replies View Related

Secure Session Keys

I would like to implement user authentication and session management for my
applications. I've been using solution 1 (below) for most of my
applications in the past since the target audience is mostly intranet based.

Now that I'm creating a more global application, I want to use a method that
does not require cookies, yet maintain a farily high level of security and
fault tolerance.

Is there a better way to handle this problem? What method does the big
Internet shopping companies use?

Scenario:

A user is authenticated and is given a session key. The session key is
passed to the user in an HTML page and returned to the server using a query
string. The user then copies the URL and gives it to his friend to see.
Since the URL now contains the session key, how does the server distinguish
between the authenticated user and his friend?

Solution 1:

Use an ASP session variable to store the session key between page requests.
This solution requires that the client have session cookies enabled. If the
session is not encrypted (i.e. SSL), the ASP session id is still passed via.
clear text, and is vulnerable.

Solution 2:

Use a session key that identifies the location (IP address) of the user. If
the submitted session key doesn't match the user's location, then the
session key is invalid. The session key can be passed as part of the URL
and does not require cookies. This method is vulnerable to IP spoofing, and
breaks if the user is behind a NAT server, or web caching server that masks
the true IP address.

Solution 3:

Have the session key returned to the server via an HTTP POST request. This
method does not require cookies, but is clear text and vulnerable if the
session is not encrypted. The session key is lost if the user navigates to
a page manually issuing an HTTP GET request.

View Replies View Related

Get Remote Registry Keys

Is it possible to get a key from the registry if a remote machine?We have three print servers (tin) serving an ERP application for different areas of the business.Currently someone has to logon and check to see if the servers are still running each morning.

However while they are running they increment a key in the registry once every second each time they poll. If I can get ASP to read this value, I should be able to setup a
webpage to monitor the situation.I've found RegObj.dll on the Microsoft site, but this
doesn't seem to work in ASP.

View Replies View Related

Creating Primary Keys

creating a script that will create a primary key base on the date today and a number ( ex. 1124204-1, 112404-2) with the last number increasing by one. the script should automatically increase the number if the key has already been used.

View Replies View Related

Accessing Keys In The AppSection Of Web.Config

I am trying to store some information (like application paths) in the web.config file of my ASP C# project. To that end I did the following: Code:

View Replies View Related

Inserting Into Table With Foreign Keys (asp)

I'm trying to insert into a table with foreign keys. The statement works in query analyzer but not when I do it in asp to insert the data from a form. Code:

View Replies View Related

Remove/Delete Keys From Cookie

I'm using cookies to maintain a shopping cart. I can find plenty of tutorials and articles on deleting a cookie, but only deleteing a single key within a cookie is harder to find...

Surely there is a more efficient way to remove a cart item from my cookie than setting it equal to "", isn't there?

I mean, technically the cookie will still hold the text cartitem1 = "", right? Which takes up unnecessary space...

View Replies View Related

Function Keys To Post A Form

I have disabled the function keys (F1-F12). I would like each funtion key to submit a form. I'm not quite sure how to tell each function key to submit (post) for me.

View Replies View Related

Insert Problem With Primary And Foreign Keys

Microsoft OLE DB Provider for ODBC Drivers (0x80040E14)
[Sybase][ODBC Driver]Integrity constraint violation: no primary key value for foreign key 'MemberCode' in table 'PersonMember'
/admin/Member_New-Sybase.asp, line 39

What i am doing is first i have added a record to my persons table the next step is i need to add this person id to the PersonMember table with a new MemberCode and then finally add more information to a membership table. Code:

View Replies View Related

Rebuilding Of An Array From An Existing Array

I dump the entire recordset into an array:

If not rs.EOF Then
aEmp = rs.GetRows()

Contents of the array are in this order:

EmpID,EmpName,Indent,Sub_ID,Lft,Rgt,MgrID, LastName

This query sort on the basis of Lft and Rgt columns.

The name of the array is: aEmp.

My question here is how can I get only the LastName from the aEmp array into another array so that I can sort the names alphabetically and then display the employees in the alphabetical order.

Or is there is another way I could this by using the same array while keeping the lft and rgt sort of the query? If I sort based at the SQL query level, I can see the names sorted by the lft, rgt and lastname, but since the lastname is at the end of the sort list - it does not appear alphabetically.

View Replies View Related

Array Integers Vs Array Variables

In working with arrays, I have found that I am unable to dimension and array
with a variable that has an integer value but I can redimension one this
way. I haven't see any information that tells me if this is a requirement,
although it appears to be because I get an error if I try it.

Ex.

Dim b
b = 10
Dim a(b) ' this errors out but
Dim a() ' this
Redim a(b) ' works

Code:

View Replies View Related

Create A New Array From An Array

I want to create a new array called arrNames2 and copy contents of arrNames to arrNames2.

I then want to loop through my db and add more names (while going through the loop) to arrNames2. What is the best way to do this? Do I have to keep redim the array wehn I add more names?

View Replies View Related

Array In Sql

i want to excute given logic

select * from Product_Table where Product_Code in

ARRAY

i.e i want to select Product_Code from VB array and not from a query
is it possible.

View Replies View Related

Array

I know I can do this programatically using a loop but I thought there might be
some easier or more effective way.

I am trying to invert an array.

i.e.

array1 = 1,2,3,4,5

but I want to get

array2 = 5,4,3,2,1

Is there something like array2 = invert(array1)?

View Replies View Related

Array

I have to following code:Code:

dim arrRes(9),getal,som
arrRes=Array(4,4,4,4,4,5,5,5,5,5)
for getal=0 to 9
som=som+arrRes(getal)
next
response.write("Het klasgemiddelde is " &som/10)

I get a type not match error on the second line

View Replies View Related

ASP Array?

I have a page in my admin system where the user can edit products they
have added. The problem I am having is with Related Products. These are
all listed in a multiple list. What I need to do is have those selected
when the product was added, already be highlighted in the multiple list
on the product edit page. Here is my post from another forum.

Code:

View Replies View Related

Array

For some reason, when I try to run the following array, I'm getting an
error:

dim cat(0)

cat(0)="0407"
cat(1)="0102"

'I will be adding more to this array, but just trying with two for
starts.

for counter = 0 to 1

itno=cat(counter)

'I get an error when it runs through this function

Function rightvar(theVar,lengthNeeded)
Dim sResult
sResult=theVar
if Len(theVar)< lengthNeeded then sResult= String(lengthNeeded -
Len(theVar)," ")& theVar
rightvar=sResult
End Function

Can someone help me understand why?

View Replies View Related

Array

The problem is that in my 5 years of programming in various languages i have never really understood arrays (DUMB @$${lol})
What i want to do is offer an advanced search of a database table on my website. I currently offer the functionality so that the whole of the database can be viewed within the web page so that it doesn't need to be downloaded/need access to view it.
What i need to do is run a script that takes all of the column headings that i have and put them into an array. Then with the array i need to output each element into a drop down box.

View Replies View Related

Asp Array

Ok what I have is a little script which runs through my stock compares how many of one item we have compared to what we need and displays the out come.

What id like to do is make an array with the item name so lets say If how many is needed is greater then 0 then add the name of that consumable to an array and move on until the end.

Then I want to use the arry to display each consumable on an order form. Anyone have any idea how to do this in ASP or can give me any advice on a better way to do it?

View Replies View Related

Array

I am doing the following:
Code:

dim n
n=4'ubound(arrsequences)
response.write "n:" & n
dim arrproductNames(n)
dim arrproductSeq(n)

and getting the following error:
Microsoft VBScript compilation error '800a0402'
Expected integer constant
process.asp, line 33
dim arrproductNames(n)

View Replies View Related

Add Something To An Array

How can I add something to an array, e.g
[VBS]
Dim MyArray

MyArray = Array("Item 1", "Item 2", "Item 3")

'Do some code here

'I now want to add another item to my array, how?
[/VBS]

View Replies View Related

An Array

Is there a way of determining whether or not a value or values are present in an array.
Is there something nice and easy as with php's

if(in_array($SomeValue,$myArray)){
echo "The value is here";
}
else{
echo "The value is not here";

View Replies View Related

ASP Array

how to store request multiple value(Select box) in an array.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved