Both of you have the last version? I don't get an error here (downloaded it fresh again)...fxm wrote:I get the same error as Makoto WATANABE.
(my previous remark is still valid in my opinion)
Dictionary Class
Re: Dictionary Class
Re: Dictionary Class
I downloaded it today on https://github.com/glasyalabolas/fb-dictionary
Re: Dictionary Class
I have not re-tested it but I now see on the same site that the IDictionary type no longer has Let operator declared in its protected section (or elsewhere).
Re: Dictionary Class
Let me double check it. Seems like and old branch of it got mixed.
EDIT: Nope. In light of your last answer, seems like you're using the previous header, like Makoto. Updating the header with the one found in the repo should solve the issue. Also, the offending class is the reference implementation (the Dictionary class proper), which I also updated recently.
EDIT: Nope. In light of your last answer, seems like you're using the previous header, like Makoto. Updating the header with the one found in the repo should solve the issue. Also, the offending class is the reference implementation (the Dictionary class proper), which I also updated recently.
Re: Dictionary Class
Of course. I simply stated why I did things the way I did. Code like this, altough valid, doesn't really make any sense:fxm wrote:(my previous remark is still valid in my opinion)
Code: Select all
dim as collections.IDictionary myDic = collections.IDictionary()
-
- Posts: 231
- Joined: Apr 10, 2010 11:41
- Location: Japan
- Contact:
Re: Dictionary Class
Dear paul doe;
> What are you trying to accomplish, concretely?
I simpley want to try your examples.
Only the following version is fail with compilation.
fb-dictionary-master20180511\fb-dict-example-1.bas
The following past versions were compiled correctly and worked as expected.
fb-dictionary-master20180503\fb-dict-example.bas
fb-dictionary-master20180505-1\fb-dict-example.bas
fb-dictionary-master20180505-2\fb-dict-example.bas
> What are you trying to accomplish, concretely?
I simpley want to try your examples.
Only the following version is fail with compilation.
fb-dictionary-master20180511\fb-dict-example-1.bas
The following past versions were compiled correctly and worked as expected.
fb-dictionary-master20180503\fb-dict-example.bas
fb-dictionary-master20180505-1\fb-dict-example.bas
fb-dictionary-master20180505-2\fb-dict-example.bas
Re: Dictionary Class
Hi Makoto,Makoto WATANABE wrote: I simpley want to try your examples.
Only the following version is fail with compilation.
fb-dictionary-master20180511\fb-dict-example-1.bas
The following past versions were compiled correctly and worked as expected.
Did you remember to update the header and/or libs? If you copied the code (or the libraries) to your fbc installation, remove them. Then, assuming that you downloaded the code from the repository and extracted it as-is (without changing the folder name, which is by default 'fb-dictionary-master'), copy all the '.lib' files of the 'fb-dictionary-master/inc' folder to the folder where the examples are (in this case, that would be the 'fb-dictionary-master' folder), and then run the examples again. They should work (they do, I checked it again just now).
I'm very sorry for the inconvenience. Soon I'll finish it (I only need minor changes) and be done, so the code can be considered 'closed'. Perhaps the 'release early-release often' mantra of Open Software isn't for me after all =D
-
- Posts: 231
- Joined: Apr 10, 2010 11:41
- Location: Japan
- Contact:
Re: Dictionary Class
Dear paul doe;
Thanks for your quick reply.
Sorry I can not find the '.lib' files in the 'fb-dictionary-master/inc' folder at your repository GitHub.
https://github.com/glasyalabolas/fb-dictionary
Thanks for your quick reply.
Sorry I can not find the '.lib' files in the 'fb-dictionary-master/inc' folder at your repository GitHub.
https://github.com/glasyalabolas/fb-dictionary
Re: Dictionary Class
'.lib' files are '.a' files in FreeBASIC.
Re: Dictionary Class
You're welcome.
I modified the repo. Just extract the folder and run the examples from there. They should work fine.
I modified the repo. Just extract the folder and run the examples from there. They should work fine.
Re: Dictionary Class
Hey paul doe,
I am trying to evaluate if your "Dictionary Class" could be useful to any of my projects but am still unsure to what it does.
Does it store things like, name1 = 15, name2 = 20, name3 = 25?
Thank you.
I am trying to evaluate if your "Dictionary Class" could be useful to any of my projects but am still unsure to what it does.
Does it store things like, name1 = 15, name2 = 20, name3 = 25?
Thank you.
Re: Dictionary Class
Hi Provoni,
Dictionaries (aka hash tables) map key-value pairs, so yes, it can store anything, using any key you desire (be it a string, a number, anything you want).
Check the examples in the repository to 'get a feel' on how this is done (especially the first and second ones, that map string keys to objects and function pointers, respectively). If you need further explanations on how to code your own dictionary (using this implementation as a base), just ask. Glad you find it useful.
Dictionaries (aka hash tables) map key-value pairs, so yes, it can store anything, using any key you desire (be it a string, a number, anything you want).
Check the examples in the repository to 'get a feel' on how this is done (especially the first and second ones, that map string keys to objects and function pointers, respectively). If you need further explanations on how to code your own dictionary (using this implementation as a base), just ask. Glad you find it useful.
Re: Dictionary Class
Thank you paul doe,
I am looking for something that can store gigabytes of information, as RAM allows, with fast retrieval. The key will be a number smaller than a 64-bit signed integer and the stored value will be a number smaller than a unsigned byte. The storing will be done only once and then it will function as a lookup table. Given that the size will be a couple of gigabytes, how much retrievals per second would your "Dictionary Class" achieve?
Thanks
I am looking for something that can store gigabytes of information, as RAM allows, with fast retrieval. The key will be a number smaller than a 64-bit signed integer and the stored value will be a number smaller than a unsigned byte. The storing will be done only once and then it will function as a lookup table. Given that the size will be a couple of gigabytes, how much retrievals per second would your "Dictionary Class" achieve?
Thanks
Re: Dictionary Class
In that case, this is the ideal data structure to use. Have a look at 'fb-dict-example-6.bas', it should give you an idea. The code runs until it reaches 5,000,000 million entries, but you'll probably run out of memory before that (or out of patience, if you don't comment out the prints). On my machine (a crappy Celeron laptop), it's about ~65000 retrievals per second, but this number is constant and doesn't depend on the size of the data the dictionary holds.Provoni wrote:I am looking for something that can store gigabytes of information, as RAM allows, with fast retrieval. The key will be a number smaller than a 64-bit signed integer and the stored value will be a number smaller than a unsigned byte. The storing will be done only once and then it will function as a lookup table. Given that the size will be a couple of gigabytes, how much retrievals per second would your "Dictionary Class" achieve?
By the way, note that the dictionary stores pointers to data, not data itself. Ergo, you can use it to address the data directly from disk (no need to fit it to memory; only a small descriptor could be used), provided you can implement it (ask if you can't).
Re: Dictionary Class
paul doe,
The speed seems good. How much memory would your "data structure" use with 500,000,000 entries if each entry is a unique 64-bit integer key holding a ubyte value?
Thanks
The speed seems good. How much memory would your "data structure" use with 500,000,000 entries if each entry is a unique 64-bit integer key holding a ubyte value?
So it can not be used to store information? Can it store the number 34 to key 208827064571 so that later on key 208827064571 can be used to retrieve the number 34?paul doe wrote: By the way, note that the dictionary stores pointers to data, not data itself. Ergo, you can use it to address the data directly from disk (no need to fit it to memory; only a small descriptor could be used), provided you can implement it (ask if you can't).
Thanks