[ZendTo] Feature request: optional units on some preferences

Jules Jules at Zend.To
Tue Jan 26 13:04:10 GMT 2021


John,

As the preferences.php file is executable PHP, you could put settings in 
like
     'maxBytesForDropoff' => 24*1024*1024*1024,
at which point you can see exactly what it means.

Just a thought.

Cheers,
Jules.

On Thu 10/12/20 16:42, Jules via ZendTo wrote:
> 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
> Twitter: @JulesFM
>
> _______________________________________________
> ZendTo mailing list
> ZendTo at zend.to
> http://jul.es/mailman/listinfo/zendto

Jules

-- 
Julian Field MEng CEng CITP MBCS MIEEE MACM

The current UK shipping forecast:
Trafalgar: West or southwest 3 to 5, becoming variable 2 to 4 later. Moderate
or rough, becoming slight or moderate in southeast. Drizzle, fog patches.
Moderate or good, occasionally very poor.

www.Zend.To
Twitter: @JulesFM

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://jul.es/pipermail/zendto/attachments/20210126/83dc57ae/attachment.html>


More information about the ZendTo mailing list