Variable Length & Generate Variables On-The-Fly
-
Enternal
- Posts: 1175
- Joined: 10 Jan 2012 18:26
Variable Length & Generate Variables On-The-Fly
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?
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
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
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.
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...
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
Hm, confirmed, interesting number, does not ring a bell. I'll check this later.
FAQ | XY News RSS | XY X
-
Enternal
- Posts: 1175
- Joined: 10 Jan 2012 18:26
Re: Variable Length & Generate Variables On-The-Fly
Hmm... interesting! On the other hand, I just decided for the lolz used StrRepeat("0", "100000000000"); and that worked!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.
-
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
If I count it right you're over 32 bitEnternal wrote:Hmm... interesting! On the other hand, I just decided for the lolz used StrRepeat("0", "100000000000"); and that worked!
(OK: XY should have noticed?
-
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
Code: Select all
StrRepeat("0", "100000000000");FAQ | XY News RSS | XY X
-
Enternal
- Posts: 1175
- Joined: 10 Jan 2012 18:26
Re: Variable Length & Generate Variables On-The-Fly
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! 
EDIT: It's now working again.
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?
EDIT: It's now working again.
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
It's 135 million characters 
FAQ | XY News RSS | XY X
-
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
Fine!admin wrote:throws error 6 (overflow) here.Code: Select all
StrRepeat("0", "100000000000");
-
Enternal
- Posts: 1175
- Joined: 10 Jan 2012 18:26
Re: Variable Length & Generate Variables On-The-Fly
Oh. Reading it wrong. Ok 135 is MOOOORE than enough.admin wrote:It's 135 million characters
-
Enternal
- Posts: 1175
- Joined: 10 Jan 2012 18:26
Re: Variable Length & Generate Variables On-The-Fly
PeterH wrote:Fine!admin wrote:throws error 6 (overflow) here.Code: Select all
StrRepeat("0", "100000000000");
Oh. Reading it wrong. Ok 135 million is MOOOORE than enough.admin wrote:It's 135 million characters
-
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
Two replies are also more than enough.

FAQ | XY News RSS | XY X
-
SkyFrontier
- Posts: 2341
- Joined: 04 Jan 2010 14:27
- Location: Pasárgada (eu vou!)
Re: Variable Length & Generate Variables On-The-Fly
The problem overflowed on him so he's overflowing himself, now. 
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...
Want a new XYperience? XY MOD - surfYnXoard
-coz' the aim of computing is to free us to LIVE...
XYplorer Beta Club