Useful VB hash code
Useful VB hash code
Have you ever wanted to associate variables with strings, and be able to look them up quickly without searching through thousands of entries?
I've written some useful code that does this, and it's very fast and reliable. I stress-tested it and even with about 1.5 million strings in the database, thousands of lookups can be made per second.
Here is an example of what it does:
addword "This is a sample string", 1337 ' Associate the number 1337 with the string
...
Later on in the code:
'What number did we associate with that string?
number = getdata("This is a sample string")
'number will now contain 1337.
Millions of strings can be added with virtually no speed penalty. It is fast enough so that thousands of words can be added / looked up per second. The only drawback is that words cannot be removed (yet)
Other useful functions:
getword: This returns a string from the database given an "ID" (this ID is actually the end node of a string in radix tree)
The ID of strings can be found with the sub findendnode(string)
for example:
addword "Huge faggot", 100
id = findendnode("Huge faggot")
debug.print getword(id)
This will print the stored string in the database. Note that addword will also return this information, however findendnode will not overwrite the data associated with the string
If anyone wants the code, give me a shout
I've written some useful code that does this, and it's very fast and reliable. I stress-tested it and even with about 1.5 million strings in the database, thousands of lookups can be made per second.
Here is an example of what it does:
addword "This is a sample string", 1337 ' Associate the number 1337 with the string
...
Later on in the code:
'What number did we associate with that string?
number = getdata("This is a sample string")
'number will now contain 1337.
Millions of strings can be added with virtually no speed penalty. It is fast enough so that thousands of words can be added / looked up per second. The only drawback is that words cannot be removed (yet)
Other useful functions:
getword: This returns a string from the database given an "ID" (this ID is actually the end node of a string in radix tree)
The ID of strings can be found with the sub findendnode(string)
for example:
addword "Huge faggot", 100
id = findendnode("Huge faggot")
debug.print getword(id)
This will print the stored string in the database. Note that addword will also return this information, however findendnode will not overwrite the data associated with the string
If anyone wants the code, give me a shout
What was Afterlife programed in? And where the HECK can you get Visual Basic 6.0? I took a class for programming and only got to use Visual Basic 6, and I want the program so that I can use what I learned. I searched MSN, Search.com, Microsoft's site, Officemax's site and Walmat's site, but STILL never saw anything about where to get it!! Where can I get it?!?
x 4

Probably anywhere as a boxed version, just because VB 6 is outdated. The newest version of Visual Basic is ".NET 2003", which you can buy at Amazon.co.uk for example:
http://www.amazon.co.uk/exec/obidos/ASI ... 56-7667656
The only way I know how to get VB 6 is buying a tutorial/crash course book for beginners, where you have "all inclusive", which means into the book you'll find a CD with VB 6.0 Standard. Such books cost about 20-30€.
Although I would still buy the newest version if you want to start with some serious project.
Edit: If you buy the .NET 2003, don't forget to download the .NET framework: http://www.microsoft.com/downloads/deta ... 4d1e7cf3a3
http://www.amazon.co.uk/exec/obidos/ASI ... 56-7667656
The only way I know how to get VB 6 is buying a tutorial/crash course book for beginners, where you have "all inclusive", which means into the book you'll find a CD with VB 6.0 Standard. Such books cost about 20-30€.
Although I would still buy the newest version if you want to start with some serious project.
Edit: If you buy the .NET 2003, don't forget to download the .NET framework: http://www.microsoft.com/downloads/deta ... 4d1e7cf3a3
Last edited by Balloony on October 13th, 2005, 6:36 pm, edited 2 times in total.
"Time flies like an arrow, fruit flies like a banana." -Groucho Marx
Thank you Balloony (And Will!), I appreciate that a great deal. (Though I don't quite plan on a "Serious Project", but merely to make a small game, or something
). A while ago, I made a really good calculator (It had the four basic operations, to the power of, %, and I also added squared) in the Visual Basic section included in Microsoft Word 2002, but I wish that I could make it an .EXE, because that one doesn't let you make .EXEs. 
Anyways, thanks all. I have a few other questions: 1. (For VB programers) How do you set it two do things with a key? I was planning on making a small game sometime, but I can't if I can't use the arrow keys. 2. Is "Visual Studio" like VB? I have seen people talk about it elsewhere. And last: 3.Does Visual .NET 2003 (or whatever
) work a lot like VB 6? Otherwise, I'll make more of an efort to find a bundle like the one you mentioned.
Again, thatnk you. I think I'll go play Afterlife in a bit. I got frustrated and haven't played in 3 and a half weeks.


Anyways, thanks all. I have a few other questions: 1. (For VB programers) How do you set it two do things with a key? I was planning on making a small game sometime, but I can't if I can't use the arrow keys. 2. Is "Visual Studio" like VB? I have seen people talk about it elsewhere. And last: 3.Does Visual .NET 2003 (or whatever

Again, thatnk you. I think I'll go play Afterlife in a bit. I got frustrated and haven't played in 3 and a half weeks.

Yeah, the interface in Word is only intended for macros (small routine applications) as far I know. You can't compile them to executables.Thank you Balloony (And Will!), I appreciate that a great deal. (Though I don't quite plan on a "Serious Project", but merely to make a small game, or something ). A while ago, I made a really good calculator (It had the four basic operations, to the power of, %, and I also added squared) in the Visual Basic section included in Microsoft Word 2002, but I wish that I could make it an .EXE, because that one doesn't let you make .EXEs.
Btw, Check out Winfunktion or Mapple, there you get a really good calculator

1. No clue, I'm only a bit used to PHPI have a few other questions: 1. (For VB programers) How do you set it two do things with a key? I was planning on making a small game sometime, but I can't if I can't use the arrow keys. 2. Is "Visual Studio" like VB? I have seen people talk about it elsewhere. And last: 3.Does Visual .NET 2003 (or whatever ) work a lot like VB 6? Otherwise, I'll make more of an efort to find a bundle like the one you mentioned.

2. Yes and no. It is an extended version of VB with lots of functions you'll never need. That's also why it is not intended for avocation game programming or somewhat nonprofessional application. It's only used by pro's and developers, which do programming as their job.
3. Yes, I think so. Because its just the newest version of the same application with some slighty improved cosmetics and extended functions. It is well possible that you need some time to get used with but there shouldn't occur any major problems.
For more informations just ask Will. He knows a lot more about that stuff

Greetz
Balloony
Edit: Sorry, the newest version is .NET 2005 not 2003!
"Time flies like an arrow, fruit flies like a banana." -Groucho Marx
Sorry for double post, but:
I GOT VB.NET!! W00T! I need help, too...hehe...Anyways, is there a way to make anything in between 2 numbers? 'Cuz I need to make it a value to a value which is used in an IF statment...
2. Uh...How do you make it so that if a textbox has letters or not a number it will detect it? (Also in combination with an IF statment...)?
3. Last, how do I make a key have an action?
And I made a prog too.
I will upload...Here is a link:
EDIT: Dang, user files don't support EXE's! I will upload in a .zip...
http://www.rjbsoftware.uk/userfiles/ ... yseven.zip
Please inform me of any bugs/cheats/etc.!
I GOT VB.NET!! W00T! I need help, too...hehe...Anyways, is there a way to make anything in between 2 numbers? 'Cuz I need to make it a value to a value which is used in an IF statment...
2. Uh...How do you make it so that if a textbox has letters or not a number it will detect it? (Also in combination with an IF statment...)?
3. Last, how do I make a key have an action?
And I made a prog too.

EDIT: Dang, user files don't support EXE's! I will upload in a .zip...
http://www.rjbsoftware.uk/userfiles/ ... yseven.zip
Please inform me of any bugs/cheats/etc.!
Hmm...I will take out the clock (I have NO idea why I put one in...) as it seems to cause problems. And I have HEAVILY updated. 
Some new features are Secrets (:D) and a wins/losses counter. Not much in secrets yet, though...
Re-download it please for the newest version.
If anyone wants the password (And/or what it does (If you didn't already guess :roll:)) PM me.
@Balloony: Heh, I have no idea why that would be happening. Re download and tell me what happens. (And thanks for informing me
)

Some new features are Secrets (:D) and a wins/losses counter. Not much in secrets yet, though...
Re-download it please for the newest version.
If anyone wants the password (And/or what it does (If you didn't already guess :roll:)) PM me.
@Balloony: Heh, I have no idea why that would be happening. Re download and tell me what happens. (And thanks for informing me

It still displays a dialog box with the content I wrote above@Balloony: Heh, I have no idea why that would be happening. Re download and tell me what happens. (And thanks for informing me )

"Time flies like an arrow, fruit flies like a banana." -Groucho Marx
Sorry for double post, but updated again. One new addition to the secrets menu...Sorta. I found some COMPLETELY useless code. (:P) wich has been deleted. And, I made a file option that sends you to the d/l link. What I need is small page or something to keep a list of new features/changes and an official download link (So I don't have to link to Ryan's link and to the forums for the changes :roll:).
Any suggestions?


Actually I prefer to be able to run such programs without downloadingAloshi wrote:Hmmm...I am not too good with errors.
Maybe try installing the .NET framwork if it isn't already? (You can do a search for it)
I will try a debugging version and see if I get any problems...
other stuff.
In addition, I'm pretty sure that you can do this independently to the framework. Just take Ryan's progs as an example, where you only need libraries that are avaible in default OS

"Time flies like an arrow, fruit flies like a banana." -Groucho Marx
Well they need VB Runtime libraries (already avaible in XP basic config) and your proggy needs the NET-Framework (must be downloaded additionally)Aloshi wrote:Heh, don't quite understand what you mean about Ryan's progs though...
Btw, as it runs now, a little design tip: change the bet and the cash number colors from grey/black to white. dark colors on dark colors aren't very well visible

In other respects it's quite nice

"Time flies like an arrow, fruit flies like a banana." -Groucho Marx
Thanks for design tip, glad it works now too. 
And 95%, or so, by me. All the tutorial had was the name (Which I may change soon, any suggestions?) and just the picture showing code and how to detect if you won. I got the pic from a google search. I am thinking about making a sound for when you win...
The bet, win/lose counter, money system,The thing that says you won, the password stuff, secrets, and the entire file menu and secrets menu, etc. are all by me! Lots added from original, eh? 

And 95%, or so, by me. All the tutorial had was the name (Which I may change soon, any suggestions?) and just the picture showing code and how to detect if you won. I got the pic from a google search. I am thinking about making a sound for when you win...


I think this should be cut off from the Hash code thread so you can present your little proggy in an own topic 

And for the name, what about "Aloshi's Lucky Seven"
Btw, the digit display is now legiblier, although I feel if I spotted a small bug: In first round (when you've just started the prog) you got 15$ basic cash. As soon as you loose and have to start over, you'll get only 10$. Is this meant to be in that way.

Gratulations, this is quite a lot for a first projectAnd 95%, or so, by me. All the tutorial had was the name (Which I may change soon, any suggestions?) and just the picture showing code and how to detect if you won. I got the pic from a google search. I am thinking about making a sound for when you win... The bet, win/lose counter, money system,The thing that says you won, the password stuff, secrets, and the entire file menu and secrets menu, etc. are all by me! Lots added from original, eh?

And for the name, what about "Aloshi's Lucky Seven"

Btw, the digit display is now legiblier, although I feel if I spotted a small bug: In first round (when you've just started the prog) you got 15$ basic cash. As soon as you loose and have to start over, you'll get only 10$. Is this meant to be in that way.
"Time flies like an arrow, fruit flies like a banana." -Groucho Marx
Another new update! Small, only to ver 1.7.2, but an update. Features: You can now use all in bet to bet all your money. And I also fixed some code for all this. 
Big question to prevent errors: Anyone have an idea how to make it so words other that all will be a statment? So that errors cannot be made by entering words other than all in the box?

Big question to prevent errors: Anyone have an idea how to make it so words other that all will be a statment? So that errors cannot be made by entering words other than all in the box?