Would return the following constants:
#PreferenceKeyInteger
#PreferenceKeyLong
#PreferenceKeyFloat
#PreferenceKeyDouble
#PreferenceKeyQuad
#PreferenceKeyString
When ExaminePreferenceKeys() is executed.
PreferenceKeyType()
- RichAlgeni
- Addict
- Posts: 935
- Joined: Wed Sep 22, 2010 1:50 am
- Location: Bradenton, FL
Re: PreferenceKeyType()
The ini file is text and does not contain information about the data type. You can treat any data as any type of data. If you read the given as a string, then it will be a string. If you read the data as a number, it will be a number.
Alternatively, use XML, which contains data type information.
Alternatively, use XML, which contains data type information.
- RichAlgeni
- Addict
- Posts: 935
- Joined: Wed Sep 22, 2010 1:50 am
- Location: Bradenton, FL
Re: PreferenceKeyType()
Excellent point!!!
Never mind!
Never mind!
Re: PreferenceKeyType()
You can also easily put a bit of binary data in preference as a string - Base64 encoded. It's not memory effective but small useful things like a ciphered text/password or cipher-/software keys it's not an overkill. But I wouldn't store larger things, not even a little icon image of 1-2 kb, as it would result in very long lines.
Most used hash functions have a hexadecimal human readable representation (MD5, SHA1, SHA2, SHA3), this is less effective than Base64. You could convert those hashes to binary and then store them as Base64; that would be an "exception" to the rule of base64 making things longer. Sending or storing hash values in binary format instead of human readable code better hides their nature, especially when they are embedded in a longer stream of bits (since the key lengths have standard sizes, and human readable hash keys very often use hexadecimal coding which is self-revealing); except for the programer nobody can guess that there's a hash at position X in the bitstream. Transmitting those hash in binary format reduces the memory/transfer footprint by 50%. Just an idea I have to try out one day...

Most used hash functions have a hexadecimal human readable representation (MD5, SHA1, SHA2, SHA3), this is less effective than Base64. You could convert those hashes to binary and then store them as Base64; that would be an "exception" to the rule of base64 making things longer. Sending or storing hash values in binary format instead of human readable code better hides their nature, especially when they are embedded in a longer stream of bits (since the key lengths have standard sizes, and human readable hash keys very often use hexadecimal coding which is self-revealing); except for the programer nobody can guess that there's a hash at position X in the bitstream. Transmitting those hash in binary format reduces the memory/transfer footprint by 50%. Just an idea I have to try out one day...

Re: PreferenceKeyType()
If you have created the preferences yourself, you also know what type the entries are.
But I switched to XML myself, because you can simply save and load structures.
But I switched to XML myself, because you can simply save and load structures.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
- RichAlgeni
- Addict
- Posts: 935
- Joined: Wed Sep 22, 2010 1:50 am
- Location: Bradenton, FL
Re: PreferenceKeyType()
What I am working on is to have system defaults in the Registry, and overrides in an ini file. I have a map that contains the Registry/PreferenceKeyNames, with each having an array telling the program what type it is, the length, etc.. I thought having a preference type might make things a bit easier. Bit of a blonde moment!!!
Thanks all!
Thanks all!