Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 13 of 13
  1. #1
    SUF6NEWBIE Guest

    Quick Tip: Bytes to kb -mb -gb

    ..may prove usefull (maybe a built in action in next Update release - hint)

    How to do exact conversion of BYTES to megabytes and so on...

    Calc_const = "1024"; --correct math constant for Windows file systems
    --or just replace any entry using variable: Calc_const with: 1024

    eG Code:

    filesize = "100000000" --bytes (used just to test)

    --now convert to Kilobytes
    filesize_kb = (filesize / Calc_const ); --show all decimal returns
    Dialog.Message("Test Convert: "..filesize.." bytes" , "to Kilobytes: "..filesize_kb);
    --now convert to Kilobytes --return to 1 decimal place only
    filesize_kb = Math.Round((filesize / Calc_const ), 1 ); --to one decimal place
    Dialog.Message("Test Convert: "..filesize.." bytes" , "to Kilobytes: "..filesize_kb);

    --convert to Megabytes
    filesize_mb = Math.Round((filesize_kb / Calc_const ), 1 );
    Dialog.Message("Test Convert: "..filesize.." bytes" , "to Megabytes: "..filesize_mb);
    -- OR:
    filesize_mb = Math.Round(((filesize / Calc_const) / Calc_const) , 1 );
    Dialog.Message("Test Convert: "..filesize.." bytes" , "to Megabytes: "..filesize_mb);
    -- OR:
    filesize_mb = Math.Round((filesize / 1048000), 1 ); --quick (not exact)
    Dialog.Message("Test Convert: "..filesize.." bytes" , "to Megabytes(quick): "..filesize_mb);

    --convert to Gigabytes
    filesize_gb = Math.Round((filesize_mb / Calc_const ), 1 ); -- gigabytes
    Dialog.Message("Test Convert: "..filesize.." bytes" , "to Gibabytes: "..filesize_gb);
    --OR:
    filesize_gb = Math.Round((((filesize / Calc_const) / Calc_const) / Calc_const) , 1 );
    Dialog.Message("Test Convert: "..filesize.." bytes" , "to Gibabytes: "..filesize_gb);
    --OR:
    filesize_gb = Math.Round(((filesize / 1048000) / Calc_const ), 1 ); -- quick
    Dialog.Message("Test Convert: "..filesize.." bytes" , "to Gibabytes(quick): "..filesize_gb);

    --check using system calculator or a 'real one'
    --check a file on the System and compare results
    --if sample code proves to be incorrect feel free to hang me by the toes !!
    Last edited by SUF6NEWBIE; 08-28-2004 at 05:04 PM.

  2. #2
    Join Date
    Jun 2002
    Location
    Southeast USA
    Posts
    1,804
    Hey, cool script! I was thinking of doing something along those lines myself whenever I scared up some free time, which is becoming increasingly difficult. Thanks for that code - that should make it a lot easier.
    Eric Darling
    eThree Media
    http://www.ethreemedia.com

  3. #3
    SUF6NEWBIE Guest
    Ta ERIC,

    Couple more file size "limits". --bytes

    Fat16 max filesize limitation: 2147483648 (less than)
    Fat32 max filesize limitation: 4294967296 (less than)
    NTFS essentially No limitation


    Storage Media "safe size" limits:

    74 min Cd-Rom (650mb) = 681574400
    80 (703mb) = 737148928
    120 Dvd-R (4464mb)= 4680843264

    ..std dvdrom media stating "4.7 gig" is misleading
    as the lead in and lead out space required gobbles
    some of this..so the 'common consensus' out there
    is make max write space limit the 4464 megabytes for Std Dvd Media

    Anyone who wishes to add to this list or 'clarify' ..please do so...
    for example some 'fully tested" ZIP DRIVE safe storage space limits

    BTW for 'maximum compatibility' for data access on 'old' cdrom drives
    if burning to 703mb media --keeping the burnt space to under 650meg
    on this media type will often enable old drive-old firmware to read the
    data correctly...
    Last edited by SUF6NEWBIE; 08-30-2004 at 01:36 PM.

  4. #4
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Just wanted to stop in and say thanks!

    I put these code snippets in my Code Keeper software!

    Thanks again!

    Very Sincerely,
    Intrigued

  5. #5
    Join Date
    Jun 2002
    Location
    Southeast USA
    Posts
    1,804
    Quote Originally Posted by SUF6NEWBIE
    ..std dvdrom media stating "4.7 gig" is misleading
    as the lead in and lead out space required gobbles
    some of this..so the 'common consensus' out there
    is make max write space limit the 4464 megabytes for Std Dvd Media
    Well, "4.7" refers to binary Gigabytes, which is accurate. If you are using what everyone (including drive manufacturers) refer to as a "Gigabyte," DVD-R media is 4.37 approx. So, as long as you know what flavor of GB people are talking about, you're all set.

    I've built a Windows app using AMS that will do conversions for file sizes. It's especially helpful for those of us who produce video and audio files commonly bound for optical media and the web. Basically, it's pretty hard to do a bits - megabytes conversion on the fly in your head unless you're a math savant. So, I've always had to go to the web to use PHP scripts that run these calculations for me. I got tired of that, especially when one of those sites I use went down. So, I built my own - accuracy is verified: It's called
    Bitrate Calc 1.0, and available for download at that link.
    Eric Darling
    eThree Media
    http://www.ethreemedia.com

  6. #6
    SUF6NEWBIE Guest
    no problemo Intrigued..

    tks for reminding me about BRETT's codekeeper..must start taking
    advantage of it...hope the "shop" is do'in well for you...

  7. #7
    SUF6NEWBIE Guest
    Tks for the headsup Eric...downloaded your Bitratecalc...many thanks
    for sharing your code - time All the best with your BIZ..also

    Martin
    Last edited by SUF6NEWBIE; 08-30-2004 at 02:06 PM.

  8. #8
    Join Date
    Jun 2002
    Location
    Southeast USA
    Posts
    1,804
    Actually, that's just the executable - if anyone wants the source code, just snap me an e-mail. And more than welcome, Martin - always glad to be able to give back whenever it's possible. This community has been very helpful and actually has truly saved my keester a couple of times!
    Eric Darling
    eThree Media
    http://www.ethreemedia.com

  9. #9
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Quote Originally Posted by SUF6NEWBIE
    no problemo Intrigued..

    tks for reminding me about BRETT's codekeeper..must start taking
    advantage of it...hope the "shop" is do'in well for you...
    The 'shops' going good, thanks.

    eric, that's a cool little application. My wife does not like that I send (but receive is ok, go figure) Paypal payments. If you have a PO BOX... I would be happy to slap a $5'er in the mail for the support of the Bitrate Calc software.

    That's pretty dang cool little application!

    Intrigued
    Intrigued

  10. #10
    Join Date
    Jun 2002
    Location
    Southeast USA
    Posts
    1,804
    Thanks for the kind words - I appreciate it!
    Eric Darling
    eThree Media
    http://www.ethreemedia.com

  11. #11
    Join Date
    Dec 2003
    Location
    Location! Location!
    Posts
    6,137
    Anytime Eric!

    Thanks again,

    Intrigued
    Intrigued

  12. #12
    Join Date
    Jan 2000
    Posts
    2,002
    Eric,

    Just wanted to say congrats on releasing a piece of software. It is cool to see someone like you (non-programmer by trade) create industry-specific software using AMS50. This is exactly the kind of thing that we hoped to see when creating the product. Keep up the good work!

  13. #13
    Join Date
    Jun 2002
    Location
    Southeast USA
    Posts
    1,804
    Quote Originally Posted by Brett
    Eric,

    Just wanted to say congrats on releasing a piece of software. It is cool to see someone like you (non-programmer by trade) create industry-specific software using AMS50. This is exactly the kind of thing that we hoped to see when creating the product. Keep up the good work!
    Thanks, Brett! Yeah - it's something I've been meaning to do more of, but it's been kinda crazy around here what with business and all. This one just made sense because I got fed up with doing calculations by hand, and I figured other folks like me were out there.

    It's a very simple program, and kind of a no-brainer project. I'm sure it could even be coded more efficiently. But it works, and it's accurate. It was so easy - 30 minutes in AMS - I spent more time putting together the HTML to describe what the software does. I still can't believe how easy it is to program using AMS 5. And I love the ease with which I can expand into new functionality.
    Eric Darling
    eThree Media
    http://www.ethreemedia.com

Similar Threads

  1. Quick Tip: 'Pending Reboot Operations'
    By SUF6NEWBIE in forum AutoPlay Media Studio 5.0
    Replies: 0
    Last Post: 08-20-2004, 03:22 PM
  2. Object Plugins 'tool tip' query
    By SUF6NEWBIE in forum AutoPlay Media Studio 5.0
    Replies: 0
    Last Post: 04-28-2004, 10:45 PM
  3. tool tip on the video template buttons
    By charwell in forum AutoPlay Media Studio 5.0
    Replies: 4
    Last Post: 10-28-2003, 10:13 AM
  4. Replies: 2
    Last Post: 10-17-2002, 09:55 AM
  5. How to put a shortcut in quick launch bar?
    By liviolee in forum Setup Factory 6.0
    Replies: 2
    Last Post: 03-19-2002, 09:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts