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


ADVERTISEMENT

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 Random Numbers Between 10 And 1,000,000

I am trying to create a random value between 10 and 1,000,000. I am using the following code but it is creating numbers between 10,000 and 999,999. How can I fix it.

<%
Highest=1000000
Lowest=10
Randomize
Val_Rand=CStr(CLng((Highest-Lowest+1)*Rnd+Lowest))
response.write(val_rand)
%>

The code never gives small numbers like 10, 15 500, 250, 257 etc.

View Replies View Related

Random Numbers Based On Points

I have this situation:

each user has some amount of points, for example:

table:users
user_id --- user_name --- points
1 --- user1 --- 100
2 --- user2 --- 100
3 --- user3 --- 100
4 --- user4 --- 200
5 --- user5 --- 500
-------------------
total points: 1000

I want to generate random selection of user, according to their points respectively, so the more points he has, the more likely he will be selected:

user1 in 10% cases
user2 in 10% cases
user3 in 10% cases
user4 in 20% cases
user5 in 50% cases

this percentage is respective to their points; I put some rounded numbers in the example - so total points of 1000 equals 100% - but they can have any amount of points: 1, 200, 3672 etc.

View Replies View Related

Generate Query String

i have designed a website that is using an asp shopping cart script and has a flash header which i have designed to display different content depending on the query string that gets passed to it in the page url. now my problem is that my script has a lot of pages and there are many ways of going from one page to another.

what i im wondering is if ther is away that i can make an asp page directly append a query string to the url when the server generates the page and sends it to the browser.

So basically if say i had a page called home.asp when i opened this page a some code in the page make the page serve as home.asp?page=home&content=logo which would make my flash script display content according to the query string it has received.

View Replies View Related

Generate Random String

I need to be able to create some license keys for an application. Ideally
these wouldn't be too long in length (ie, easier to remember/type in), but I
would like them to be auto generated and a check made to see whether or not
that key has already been used, something which could generate up to about
10000 keys (or more if the string doesnt have to be too long) would be very
useful.

A combination of letters, numbers, upper and lower case is needed.

I could sit here and start plugging away at this, an array for numbers, an
array for letters, a random test for uppercase/lowercase etc, but it occured
to me that I'm probably just reinventing the wheel a bit here, someone must
have done this before!

Has anyone produced anything similar to this in the past?

View Replies View Related

Get Numbers In A String

Lets say i have these examples:

Example1: text12345.asp
Example2: text321.asp
Example3: text214412311123.asp

How do i get the number in the string.

In example 1, the output should be: 12345
In example 2, the output should be: 321
In example 3, the output should be: 214412311123

View Replies View Related

Identify If Numbers Only In A String

in one part of my application i have some kind of user and password form. it asks for e-mail and a costumer id (as password), the costumer id must be a number, it's an INT in the SQL table. i tried to use a javascript checking method, but this kind of checking method seems not to work at all in firefox, so i'll do the checking via asp. what i need to know is how to check if a some VAR got anything except numbers in it?

View Replies View Related

Generate Unicode Text File

Is it possible to get information from a database and generate it to
unicode text files using ASP?
Is there any product/COM out there that can do this? If not, is there
any other solutions? It doesn't have to be ASP, but it would be nice.

View Replies View Related

Numbers Instead Of Text

I'm using the follwoing code to retrieve some values from an Access database:

<%
Dim PageStr
PageStr=Request.Querystring("PageStr")
SQL="SELECT * FROM images WHERE page = '" & Replace(PageStr, "'", "''") & "'"
set conn = server.createobject("ADODB.Connection")
conn.open "ContentDBase"
set img=conn.execute(SQL)
%>

This works fine. However, I want to change the 'page' field from a string to a number (i want to filter by the primary key rather than the description), but using the existing code I'm told I have a 'type mismatch' or something. I'm guessing I need to modify the code slightly to deal witha number field as opposed to a text field?

View Replies View Related

Numbers And Text Fields

I have a form where you input year (number) and a Ref (number) and a section (char) and then submit to output a record, i added an if with a messageto prevent the eof and bof , and it is working if i inputed wrong numbers, but if i input text in the year or the ref, he will give the following message, how to prevent users from entering text into numbers fields, because in the database they are numbers, or what else could i do.

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/iri_site/Importer/auth.asp, line 27

View Replies View Related

Creating A String Based Upon Textbox Value

I wish to have an ASP page that displays a predetermined date in the
middle of a string. I wish this date to be set in a seperate control
panel type page. eg ...

A page called "Confirm.asp" has text ... "These prices are valid until
28th Feb 2006". I currently have to go and hard code the date in
whenever there is a need to change it.

I would like to be able to set this date from another page (eg
"SetDate.asp"), where I type the date in a textbox, click on an "OK"
button, then whenever "Confirm.asp" is opened in the future it picks up
the entered date.

Most form type of code I have found seems to want to email the value in
the textbox somewhere ... which is obviously not what I am after.

View Replies View Related

Redirecting Based On Query String

I want to do something which must be very simple. If I open default.asp, it creates my frameset and opens my home page. This is what I want to happen.

However, if I create an URL along the lines of
http://www.domain.com/default.asp?r..._page=page2.asp, then I want it to open
page2.asp, but still within the frameset.

Is this possible?

View Replies View Related

Displaying Text To Describe Numbers

I'm creating a record display page but one of the fields I need to display is stored as a number. Each number designates a different name (i.e. text). I know this is totally easy, but I can't figure out how to make the text displayed match the number its associated with.

I can do this easily with a drop-down menu, but I need normal text that can't be edited or anything. In other words, the field is 1, 2, 3, or 4. But it's entered by a drop-down where 1=name1, 2=name2, etc. Now I need to display those numbers in the database as the text they are supposed to be.

View Replies View Related

Text Color Based On DB Value

I am using dreamweaver to make an ASP page. I have a table of data
from a MSSQL database that is currently showing on the ASP page. I
want the ability to change the color based on a priority number that's
in the MSSQL database (same recordset that the data comes from).

I
don't have the priority field out on the page but can put it out if
need be. I have 3 different priority numbers and if the first row is
priority 1 I want the font to be red and if the second row is priority
2 I want the color to be yellow and so on.

View Replies View Related

Pull Data Based On Text Box Info

I'm looking to display information pulled from a database based on
information the user puts into a text box. The user will enter their
sales rep number and I want to hit a table and return their name as
soon as they tab off of the text box. Any ideas or help would be
appreciated

View Replies View Related

Change Text Field Based On Menu Selection

ASP/javascript with a drop down populated by an access database. The drop down works fine but I cant figure out how to get it to change a value of a text field.

I want the value in the text field to change to reflect the data in another column in the table, same row. Code:

View Replies View Related

Populating Text Fields Based On Drop Down Box Selection

I am working on a small application for senior users, so I want to limit the option for incorrect input whatsoever. I have a drop down box that is populated from a query and I want to make it so that when an option is selected, the pertinent text fields are populated based on the selection.

All the info I need is already being extracted from the query so its just a matter of displaying the right info based on the selection. I have been looking for examples of code but they all seem to use javascript. I am not too strong in javascript so I kinda avoided those. if there is a pure asp example, that would be fine!

View Replies View Related

CDONTS Text Based Email Message Not Working

I'm trying to send email through a form I created and everything works except the email portion. It's not sending the text message. Code:

View Replies View Related

Text String To A Interger String

I am pulling info from a sql server By default the query pulls back the inforamtion as text.Therefore when I go to calculate some figures its giving me a type mismatch error.
Is there a function in can call to convert a text string to an integer string using

rstSearch.Fields("name").Value .To pull back the info in a for loop

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch

View Replies View Related

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

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 View Related

Cannot Get Xml String From XmlDom.xml, But Text

I have the following code which I try to load an xml file, but in browser, I
only get text value for each node, not whole xml string. I expect to see
something like:

<name firstName="betty" lastName="Smith">I am at home</name>
But I only see text "I am at home"
did I do something wrong?
Set xmlDom=CreateObject("Microsoft.XMLDOM")

XMLDom.async =False

xmlDom.load Server.MapPath("0925SelectTest.xml")

DataToSend = "xmlValue="& xmlDom.xml
Response.Write DataToSend
Response.End

View Replies View Related

Only Display Text In String Once

K i have a string which is

id1, id2, id3, id3, id3

ive split them and put them into an array and only want to show each item once Like:

id1
id2
id3

instead of showing:

id1
id2
id3
id3

View Replies View Related

Getting Text Inside A String

Could anyone tell me how to select the first three characters in a string, then put inside into another string.

View Replies View Related

Update String Text

I try to update a text field into Access database. When I click Update button script updates only first word of the phrase excluding other words. How can I fix it. Code:

View Replies View Related

Parsing A String Of Text

Let's say that I have the string below:

<title>Partly Cloudy and 73 degrees F at Pitt-Greenville Airport, NC</title>

In an ASP file, how would I get the three characters before the word "degrees"? In this particular case, it would be "73 ". Obviously, I'm trying to extract the degrees from this weather string (which is from the National Weather Service, in case anyone is wondering). If anybody knows a better way to get the degrees information from this string.

EDIT: Nevermind. I found that the National Weather Service also offers an XML version that has the degrees totally separated. (The one above is from an RSS feed rather than straight XML.) Having it in this form makes it much easier to parse.

View Replies View Related

Convertion Of Text String To Date In ASP

i have a date format d/m/yyyy h:m:s which users pick from a date picker into a text field in a form. But i want to format the contents into this form - d/m/yyyy.

Pls is there a function i can use to achieve this . I tried format(date_field) but it didn't work.

View Replies View Related

English Numbers Into Arabic Numbers

I'm working on asp project, access 2000 at backend.I can write arabic text and arabic
numbers in textbox and save them in database.but if i see these records, arabic text and arabic numbers,it is ok,if my computer is arabicenable.

If my computer is not arabic enable then it show arabic number into english numbers.
how can i show arabic numbers instead of english numbers if my computer is not arabic
enable.i'm working on a project i have to complete it.How can i convert english numbers that are coming from database and convert that numbers in arabic for show.

I have use

<meta http-equiv="Content-Type" content="text/html; charset=windows-1256">
I shall be very thankful to you for this purpose.

View Replies View Related

Altering A Text String For An Indexserver Query

I am trying to alter a text string to create a valid boolean query for
an index server search.

At the moment because the text string is created using combo boxes it
can have 2 or more 'AND's in succession.

Like This (strInput):
"Company AND Credit AND AND London AND AND Richmond Short Term AND AND
Intercompany AND Investment Bank AND Covertible AND AND "

what I want to do is change the above string to (strOutput2):

"Company AND Credit AND London AND Richmond AND Short Term AND
Intercompany AND Investment Bank AND Covertible"

I am trying to do it with the code below:

However this code produces problems as I loop through the various
search items.

It works fine in VB but fails when I try to port it to ASP. Code:

View Replies View Related







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