Variable Length & Generate Variables On-The-Fly

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
Enternal
Posts: 1175
Joined: 10 Jan 2012 18:26

Variable Length & Generate Variables On-The-Fly

Post by Enternal »

Does it state anywhere the maximum length a variable can be? Approximately 32,000? I want an exact number if possible.

The reason is that I realized that my Selection Store script will have issue if someone decides to add thousands of files to it and if the names are really long, the script would probably break since it won't be able to deal with the length of the variable. So that comes to my next question and is it possible to generate variables on the fly? Like automatically generating a new variable with base $Variable_# and the # will automatically increment?

Enternal
Posts: 1175
Joined: 10 Jan 2012 18:26

Re: Variable Length & Generate Variables On-The-Fly

Post by Enternal »

Hmm... okay. So maybe my fear is unfounded. I was pretty sure XYplorer had an issue before when the variable was too long but right now... it's at 180,419 double bytes character and is still working as expected. Going to stress it some more and see if it ever crash haha.

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Variable Length & Generate Variables On-The-Fly

Post by SkyFrontier »

135.561.197 seems to be the magic number, unfortunately.
But this is not a generic number: readfile() stucks around 60-70 MB files, afaicr, for instance, leaving you with the impression that it's a variable storage limit. Not good for log management.

$a = strrepeat("0", "135561198"); writefile ("test.txt", "$a"); beep; echo done; // error on v13.80.0128

$a = strrepeat("0", "135561197"); writefile ("test.txt", "$a"); beep; echo done; // last valid value

+1 for the dynamic variable attribution: http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=10382 , http://www.xyplorer.com/xyfc/viewtopic. ... 13#p101213 plus another older one I can't locate for the time being.
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

admin
Site Admin
Posts: 66360
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Variable Length & Generate Variables On-The-Fly

Post by admin »

Hm, confirmed, interesting number, does not ring a bell. I'll check this later.

Enternal
Posts: 1175
Joined: 10 Jan 2012 18:26

Re: Variable Length & Generate Variables On-The-Fly

Post by Enternal »

SkyFrontier wrote:135.561.197 seems to be the magic number, unfortunately.
But this is not a generic number: readfile() stucks around 60-70 MB files, afaicr, for instance, leaving you with the impression that it's a variable storage limit. Not good for log management.

$a = strrepeat("0", "135561198"); writefile ("test.txt", "$a"); beep; echo done; // error on v13.80.0128

$a = strrepeat("0", "135561197"); writefile ("test.txt", "$a"); beep; echo done; // last valid value

+1 for the dynamic variable attribution: http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=10382 , http://www.xyplorer.com/xyfc/viewtopic. ... 13#p101213 plus another older one I can't locate for the time being.
Hmm... interesting! On the other hand, I just decided for the lolz used StrRepeat("0", "100000000000"); and that worked! :shock:

PeterH
Posts: 2828
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Variable Length & Generate Variables On-The-Fly

Post by PeterH »

Enternal wrote:Hmm... interesting! On the other hand, I just decided for the lolz used StrRepeat("0", "100000000000"); and that worked! :shock:
If I count it right you're over 32 bit :whistle:

(OK: XY should have noticed? :bug: ?)

admin
Site Admin
Posts: 66360
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Variable Length & Generate Variables On-The-Fly

Post by admin »

Code: Select all

StrRepeat("0", "100000000000");
throws error 6 (overflow) here.

Enternal
Posts: 1175
Joined: 10 Jan 2012 18:26

Re: Variable Length & Generate Variables On-The-Fly

Post by Enternal »

Lol. It was working before... I don't know but now it's throwing an overflow error just like Don said. On the other hand, strrepeat("0", "135561197") now gave me "out of string place" and stopped working like before. It's weird! :shock:

EDIT: It's now working again. :shock:

On the other hand, I think 13 million characters should be enough room. At that range, I highly doubt anyone is going to run into it without causing XYplorer to slow down like crazy. Besides, even after trying to add many many files to the variable, I only went up to around 280,000. I guess in general, we're fine then. But this is still an interesting experiment. I'm sure Don even had some fun here right?

admin
Site Admin
Posts: 66360
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Variable Length & Generate Variables On-The-Fly

Post by admin »

It's 135 million characters :)

PeterH
Posts: 2828
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Variable Length & Generate Variables On-The-Fly

Post by PeterH »

admin wrote:

Code: Select all

StrRepeat("0", "100000000000");
throws error 6 (overflow) here.
Fine! :appl:

Enternal
Posts: 1175
Joined: 10 Jan 2012 18:26

Re: Variable Length & Generate Variables On-The-Fly

Post by Enternal »

admin wrote:It's 135 million characters :)
Oh. Reading it wrong. Ok 135 is MOOOORE than enough. :)

Enternal
Posts: 1175
Joined: 10 Jan 2012 18:26

Re: Variable Length & Generate Variables On-The-Fly

Post by Enternal »

PeterH wrote:
admin wrote:

Code: Select all

StrRepeat("0", "100000000000");
throws error 6 (overflow) here.
Fine! :appl:
admin wrote:It's 135 million characters :)
Oh. Reading it wrong. Ok 135 million is MOOOORE than enough. :)

admin
Site Admin
Posts: 66360
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Variable Length & Generate Variables On-The-Fly

Post by admin »

Two replies are also more than enough. :P ;)

SkyFrontier
Posts: 2341
Joined: 04 Jan 2010 14:27
Location: Pasárgada (eu vou!)

Re: Variable Length & Generate Variables On-The-Fly

Post by SkyFrontier »

The problem overflowed on him so he's overflowing himself, now. :biggrin:
New User's Ref. Guide and Quick Setup Guide can help a bit! Check XYplorer Resources Index for many useful links!
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...

Post Reply