Solved

infinite range a..z..0..9

Posted on 2004-08-30
6
174 Views
Last Modified: 2010-04-05
Hi! im a kylix developer and i just want to know how to make a infine range with numbers and letters.
sorry about my English, im a portuguese :p
thank you.
0
Comment
Question by:Terramoto
  • 3
  • 2
6 Comments
 
LVL 13

Accepted Solution

by:
BlackTigerX earned 125 total points
ID: 11935777
you're looking for something like this:

http://forums.about.com/ab-delphi/messages?msg=9532.2

procedure TForm1.Button1Click(Sender: TObject);

  Procedure display(atext : String); //you might want to change this function to redirect the output somewhere else
  Begin
    listbox1.Items.Add(atext);
  End;

  Procedure outputperms(maxsize : Integer; lastperm : String; alphabet : Array Of char);
  Var
    j : Integer;
    newperm : String;
  Begin
    For j:= 0 to 25 do
    begin
      newperm := lastperm + alphabet[j];
      display(newperm); //you may not want this line, but something else to re-direct the "output"
      If (length(newperm) < maxsize) then
        outputperms(maxsize, newperm, alphabet);
    End;
  End;

var
  alphabet : Array [0..25] Of char;
  j : Integer;
  permsize : Integer;
begin
  //build alphabet
  For j := 0 to 25 Do begin
    alphabet[j] := chr(65 + j);
  End;


  permsize := strtoint(edit1.Text);

  outputperms(permsize, '', alphabet);

end;
0
 
LVL 45

Expert Comment

by:aikimark
ID: 11937491
Terramoto,

Do you want to create a base36 or base62 numbering system?
0
 

Author Comment

by:Terramoto
ID: 11938330
base36 dont understand :\
but is the code that BlackTigerX posted :) thank you! :p
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 13

Expert Comment

by:BlackTigerX
ID: 11942863
base36 or baseX refers to how many digits you use, for example:

binary is base 2, there are only 2 digits 0 and 1 (you can say binary=base2)
decimal is base 10, there are 10 digits, from 0 to 9 (you can say decimal=base10)

base36 would be 36 digits, so in that case you would use all the numbers and all the letters to get 36 different digits

there are others very used, like octal (8 digits, from 0 to 7) and hexadecimal (16 digits, from 0 to F)
0
 
LVL 45

Expert Comment

by:aikimark
ID: 11943236
...and in base62, you use all the digits as well as the lower case letters and the upper case letters.

0...9abc...xyzABC...XYZ

 10  +  26    +   26       =62

~~~~~~~~~~~~~
On some URL links you may see, they are using more characters (=~%^ etc.) which provides an even larger base than 62.  I've created and used such an alphabet in one of my applications.  In this case, randomly selected (printable) ASCII characters and stored them in an array.  Then I used the record's (long integer) autonumber record key (setting the ID's value selection to random) as a random number seed.  I looped through a fixed number of times (30), generating a random number and using that random number as an index in my 'alphabet' array and concatenating the selected character (for that iteration) to the hyperlink we emailed.  The character string was also placed in the record for later retrieval.  

This was done to prevent hackers from supplying sequential numbers to our web site an view someone's data or enter their data under the guise of someone else's ID.
This resulted in a MUCH larger number of key values than actually existed:
2^32   = 4.295E+09 <= number of possible long integer values
62^30 = 5.912E+53 <= number of possible generated character strings
0
 
LVL 45

Expert Comment

by:aikimark
ID: 11943311
In your case, 25 characters of base62 would result in 6.453E+44 possible combinations.

25 characters of base36 would result in 8.0828E+38 possible combinations.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Convert Jpg /PNG To GIF 5 118
Create Database on Android via Delphi dbExpress 3 78
Dynamically Created Query 3 49
Delphi and Access based Enumeration 9 44
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
A short film showing how OnPage and Connectwise integration works.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now