[ZendTo] Feature request: optional units on some preferences

Massimo Forni Massimo.Forni at turboden.it
Thu Dec 10 18:04:24 GMT 2020


Hi again.

Php.ini uses M for megabyte as an example…
I suspect there is already a php function for this …


From: Jules <Jules at Zend.To>
Sent: giovedì 10 dicembre 2020 17:55
To: Massimo Forni <Massimo.Forni at turboden.it>; ZendTo Users <zendto at zend.to>
Subject: Re: [ZendTo] Feature request: optional units on some preferences

Hi Massimo,

Fair point.
Sadly they are also supposed to be powers of 10 and not 2.
And I never realised that Z was smaller than Y and not the other way round. That's bonkers!

Will people always get the case right, even when they never read the instructions?
Or do I only insist on "m" and "M" having the right case, and ignore the case on all the others?
Bit awkward. Only other option is to infer whether it's a byte count or a time duration from the name of the setting (/bytes/i ==> byte count, rules like that).

Cheers,
Jules.
On Thu 10/12/20 16:49, Massimo Forni wrote:
Hi,

Just to point out that in the SI the Mega, Giga, etc are all capital letters, this way you can still use ‘m’ for minutes
https://en.wikipedia.org/wiki/International_System_of_Units#Prefixes<https://urldefense.com/v3/__https:/en.wikipedia.org/wiki/International_System_of_Units*Prefixes__;Iw!!BYEqwblc0Q!gEqsGtNmXcVA4cxJ5hsQzzbxdmh9PFV3jKOiWF3vXaA4Bj1AUSaK4G3Ak6XQA1FWjFqPnA$>

best regards


From: ZendTo <zendto-bounces at zend.to><mailto:zendto-bounces at zend.to> On Behalf Of Jules via ZendTo
Sent: giovedì 10 dicembre 2020 17:42
To: ZendTo Users <zendto at zend.to><mailto:zendto at zend.to>
Cc: Jules <Jules at Zend.To><mailto:Jules at Zend.To>
Subject: Re: [ZendTo] Feature request: optional units on some preferences

John and others,

I didn't ignore this, I just mentally added it to the list without remembering to reply to you about it! :-/

I should be able to do hours and days and stuff like that too.
So that it matches with what happens in the code already, can we agree to use 1024, 1024^2, 1024^3 etc as the K, M and G multiples?
For times I could allow s, h, d, w.

So the multipliers would be (ignoring case):
k = 1024
m = 1024*1024
g = 1024*1024*1024
s = 1
h = 60*60
d = 60*60*24
w = 60*60*24*7

Are there any I have missed (I'm avoiding minutes in favour of megs).

The syntax would have to change in the preferences.php file where you chose to use a suffix, as
    'maxBytesForDropoff' => 24G,
is not valid PHP, it would need to be
    'maxBytesForDropoff' => '24G',
but you would only need the quotes round ones where you chose to use a suffix.

Sound okay to everyone?

Cheers,
Jules.
On Tue 17/11/20 19:13, John Thurston via ZendTo wrote:
Computers are good at doing math. Can we have the option of including units on some preferences?

I'm thinking, particularly, about:
  maxBytesForDropoff
  maxBytesForFile
  maxBytesForChecksum
  maxBytesForEncryption

These are currently specified in bytes. This is generally a long number which is hard to read and easy to stumble over. May we have the default continue to be "number of bytes" but have it accept an optional unit-suffix? For example:
  'maxBytesForDropoff'   => 25769790582,
could be specified as:
  'maxBytesForDropoff'   => 24G,

Old preferences would continue to work, and new preferences would be easier to read.



Jules



--

Julian Field MEng CEng CITP MBCS MIEEE MACM



'Solutions nearly always come from the direction you least expect, which

 means there's no point trying to look in that direction because it won't

 be coming from there.' - Douglas Adams



www.Zend.To<https://urldefense.com/v3/__http:/www.Zend.To__;!!BYEqwblc0Q!l_3Xh-M3c--tvHTHlq-niGgIEc-pV3wpQyfvDam175ZKztr9j6iy7_WgYUXfPxIlOXs1Pw$>

Twitter: @JulesFM

--

Massimo Forni
ICT Infrastructure Manager

Mobile: +393474110278

________________________________

Turboden S.p.A. I via Cernaia 10 I 25124 Brescia I Italy
t. +39 030 3552001 I f. +39 030 3552011
www.turboden.com<http://www.turboden.com>


Confidentiality notice: this message, together with its attachments, may contain strictly confidential and/or legally privileged information and it is destined solely to the intended addressee(s), who only may use it under his/their responsibility. Opinions, conclusions and other information contained in this message, that do not relate to the official business of this firm, shall be considered as not given or endorsed by it. If you have received this communication in error, please notify us immediately by responding to this email and then delete it from your system. Any use, disclosure, copying or distribution of the contents of this communication by a not-intended recipient or in violation of the purposes of this communication is strictly prohibited and may be unlawful.




Jules



--

Julian Field MEng CEng CITP MBCS MIEEE MACM



'If I were a Brazilian without land or money or the means to feed

 my children, I would be burning the rain forest too.' - Sting



www.Zend.To<https://urldefense.com/v3/__http:/www.Zend.To__;!!BYEqwblc0Q!gEqsGtNmXcVA4cxJ5hsQzzbxdmh9PFV3jKOiWF3vXaA4Bj1AUSaK4G3Ak6XQA1HQt6VUFw$>

Twitter: @JulesFM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jul.es/pipermail/zendto/attachments/20201210/9b6f0652/attachment-0001.html>


More information about the ZendTo mailing list