Re: File Size

2018-01-15 Thread Keith Culotta via 4D_Tech
Today I saw that somewhere around 1997 the answer to this 6÷2(1+2) changed from 
1 to 9, also because of techno-cultural influences.

Keith - CDI

> On Jan 15, 2018, at 2:10 PM, Tim Nevels via 4D_Tech <4d_tech@lists.4d.com> 
> wrote:
> 
> On Jan 15, 2018, at 2:00 PM, Wayne Stewart wrote:
> 
>> I'm trying to create a method that will return a file size as a string,
>> similar to how the Finder does.
>> 
>> Although I get "a result" it's not the "same result" as reported in the
>> Finder :(
>> 
>> It turns out that in the Finder KB are 1000 bytes, MB are 1000 KB etc.
>> 
>> I wasted a fair bit of time on this !
> 
> 
> Yes, a kilobyte is 1,024 bytes and it used to be if you saw “K” that was a 
> kilobyte. I guess now the standard is a “K” is 1,000. I remember learning 
> this in college back in the 80’s. And a MB was 1,024 * 1,024 back then too.
> 
> Didn’t this also have something to do with how hard drive manufacturers were 
> reporting drive sizes. People thought they were getting ripped off for some 
> bytes when it was really just a terminology issue. Then Apple decided to 
> change to match what the hard drive people were doing. Does anyone else 
> remember it like this?
> 
> https://discussions.apple.com/thread/3071175
> 
> Tim
>   
> Tim Nevels 
> timnev...@mac.com 
> Innovative Solutions
> 785-749-3444
> 
> 
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **

**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: File Size

2018-01-15 Thread Tim Nevels via 4D_Tech
On Jan 15, 2018, at 2:00 PM, Wayne Stewart wrote:

> I'm trying to create a method that will return a file size as a string,
> similar to how the Finder does.
> 
> Although I get "a result" it's not the "same result" as reported in the
> Finder :(
> 
> It turns out that in the Finder KB are 1000 bytes, MB are 1000 KB etc.
> 
> I wasted a fair bit of time on this !


Yes, a kilobyte is 1,024 bytes and it used to be if you saw “K” that was a 
kilobyte. I guess now the standard is a “K” is 1,000. I remember learning this 
in college back in the 80’s. And a MB was 1,024 * 1,024 back then too.

Didn’t this also have something to do with how hard drive manufacturers were 
reporting drive sizes. People thought they were getting ripped off for some 
bytes when it was really just a terminology issue. Then Apple decided to change 
to match what the hard drive people were doing. Does anyone else remember it 
like this?

https://discussions.apple.com/thread/3071175

Tim

Tim Nevels 
timnev...@mac.com 
Innovative Solutions
785-749-3444


**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: File Size

2018-01-15 Thread Chip Scheide via 4D_Tech
file size should be real - due to the fact that files (and/or folders) can be 
far larger then max longing


> 
>> Le 15 janv. 2018 à 08:15, Arnaud de Montard via 4D_Tech 
>> <4d_tech@lists.4d.com> a écrit :
>> 
>> I use this (french "octet" stands for "byte")
> 
> unit tests… 
> 
> ASSERT(Num_bytesToStr (MAXLONG^2)="4611,7 Po")
> ASSERT(Num_bytesToStr (MAXLONG*1000)="2,1 To")
> ASSERT(Num_bytesToStr (MAXLONG)="2,1 Go")
> ASSERT(Num_bytesToStr (512110190592)="512,1 Go")
> ASSERT(Num_bytesToStr (436867119528)="436,9 Go")
> ASSERT(Num_bytesToStr (MAXINT)="32,8 Ko")
> ASSERT(Num_bytesToStr (1550)="1,6 Ko")
> ASSERT(Num_bytesToStr (2^8)="256 o")

Hell is other people 
 Jean-Paul Sartre
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: File Size

2018-01-14 Thread Arnaud de Montard via 4D_Tech

> Le 15 janv. 2018 à 08:15, Arnaud de Montard via 4D_Tech 
> <4d_tech@lists.4d.com> a écrit :
> 
> I use this (french "octet" stands for "byte")

unit tests… 

ASSERT(Num_bytesToStr (MAXLONG^2)="4611,7 Po")
ASSERT(Num_bytesToStr (MAXLONG*1000)="2,1 To")
ASSERT(Num_bytesToStr (MAXLONG)="2,1 Go")
ASSERT(Num_bytesToStr (512110190592)="512,1 Go")
ASSERT(Num_bytesToStr (436867119528)="436,9 Go")
ASSERT(Num_bytesToStr (MAXINT)="32,8 Ko")
ASSERT(Num_bytesToStr (1550)="1,6 Ko")
ASSERT(Num_bytesToStr (2^8)="256 o")

-- 
Arnaud de Montard 




**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: File Size

2018-01-14 Thread Arnaud de Montard via 4D_Tech

> Le 15 janv. 2018 à 02:27, Wayne Stewart via 4D_Tech <4d_tech@lists.4d.com 
> > a écrit :
> 
> Hi,
> 
> I'm trying to create a method that will return a file size as a string,
> similar to how the Finder does.


I use this (french "octet" stands for "byte")

//Num_bytesToStr (nombre_r) -> txt
//http://forums.4d.fr/Post/FR/14504984/1/14504985#14504985 

C_TEXT($0)
C_REAL($1)

C_LONGINT($base_l)
C_LONGINT($expo_l)
C_REAL($in_r)
C_REAL($nbre_r)
C_REAL($seuil_r)
C_TEXT($nmc_t)
C_TEXT($out_t)
C_TEXT($unit_t)

If (False)
C_TEXT(Num_bytesToStr ;$0)
C_REAL(Num_bytesToStr ;$1)
End if
//_
$nmc_t:=Current method name
$out_t:=""
ASSERT(Count parameters>0;$nmc_t+" $1 number missing")
$in_r:=$1
//$base_l:=1024  //Kio
$base_l:=1000  //Ko
$expo_l:=5  //on commence aux pétaoctets
Repeat
$seuil_r:=$base_l^$expo_l
If ($in_r>=$seuil_r)
//$unit_t:=Choisir($expo_l;"io";"Kio";"Mio";"Gio";"Tio";"Pio")  
$unit_t:=Choose($expo_l;"o";"Ko";"Mo";"Go";"To";"Po")
$nbre_r:=$in_r/$seuil_r
$out_t:=$out_t+String(Round($nbre_r;1))+" "+$unit_t
$expo_l:=0
End if
$expo_l:=$expo_l-1
Until ($expo_l<0)
$0:=$out_t
//_

-- 
Arnaud de Montard 



**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: File Size

2018-01-14 Thread Wayne Stewart via 4D_Tech
Thanks Keisuke

> The unit was established by the International Electrotechnical Commission
 (IEC)
in 1998

My computer science degree predated that and I've never struck it before!
You learn something new every day.


Regards,

Wayne


[image: --]
Wayne Stewart
[image: http://]about.me/waynestewart



On 15 January 2018 at 13:59, Keisuke Miyako via 4D_Tech <
4d_tech@lists.4d.com> wrote:

> KB = 1000 bytes
>
> KiB = 1<<10 bytes
>
> https://en.wikipedia.org/wiki/Kibibyte
>
>
>
> **
> 4D Internet Users Group (4D iNUG)
> FAQ:  http://lists.4d.com/faqnug.html
> Archive:  http://lists.4d.com/archives.html
> Options: http://lists.4d.com/mailman/options/4d_tech
> Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
> **
**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**

Re: File Size

2018-01-14 Thread Keisuke Miyako via 4D_Tech
KB = 1000 bytes

KiB = 1<<10 bytes

https://en.wikipedia.org/wiki/Kibibyte



**
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**