Decoding/reading data from a binary file into (an) array(s)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin Knorpp

    Decoding/reading data from a binary file into (an) array(s)

    Hello.

    I need to be able to extract the data from the attached file (or any file in
    the same format) so that I can work with the data in PHP. I'm fairly
    comfortable with using PHP with databases, arrays, etc. but have not worked
    with binary data files.



    click on "Download Performance".

    The good news is that I know at least most of the information the file
    contains b/c the program that created the file will export to a csv file
    (included at the bottom of this message).

    Please help. I tried to read using HHD hex editor, but failed to be able to
    make anything of it. I do know that the data is not encrypted, but it is
    obviously encoded somehow so I primarily need to figure out how to decode or
    have someone decode it for me. Please help.

    Thanks in advance. The csv file text follows:

    [USER DATA]
    Ray
    AGE=44
    WEIGHT=85.7 kg
    LOWER HR=60
    UPPER HR=221
    [END USER DATA]

    number of records = 913


    ms speed watts rpm hr ss lss rss lpwr rpwr miles wind grade load

    " 0"," 0.00"," 0"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0000"," 0","
    0.00"," 0"
    " 374"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
    0"," 0.00"," 0"
    " 541"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
    0"," 0.00"," 0"
    " 559"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
    0"," 0.00"," 0"
    " 593"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0002","
    0"," 0.00"," 0"
    " 629"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
    0"," 0.00"," 0"
    " 646"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
    0"," 0.00"," 0"
    " 680"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0004","
    0"," 0.00"," 0"
    " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0004","
    0"," 0.00"," 0"
    " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0005","
    0"," 0.00"," 0"
    " 769"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0005"," 0",
    " 0.00"," 0"


  • CountScubula

    #2
    Re: Decoding/reading data from a binary file into (an) array(s)

    here is one way, there is also some csv functions too

    $aryFile = file("the_file_ name.csv");
    // loop line by line
    foreach ($aryFile as $line)
    {
    $line = trim($line);
    $line = str_replace("\" ","",$line) ;

    list($ms,$speed ,$watts,$rpm,$h r,$ss,$lss,$rss ,$lpwr,$rpwr,$m iles,$wind,$gra d
    e,$load) = explode(",",$li ne);

    // do whatever here

    }

    --
    Mike Bradley
    http://www.gzentools.com -- free online php tools
    "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
    news:aTwVb.2071 11$nt4.979457@a ttbi_s51...[color=blue]
    > Hello.
    >
    > I need to be able to extract the data from the attached file (or any file[/color]
    in[color=blue]
    > the same format) so that I can work with the data in PHP. I'm fairly
    > comfortable with using PHP with databases, arrays, etc. but have not[/color]
    worked[color=blue]
    > with binary data files.
    >
    > http://www.performancecentral.net/C...3Loop/3Loop.php
    >
    > click on "Download Performance".
    >
    > The good news is that I know at least most of the information the file
    > contains b/c the program that created the file will export to a csv file
    > (included at the bottom of this message).
    >
    > Please help. I tried to read using HHD hex editor, but failed to be able[/color]
    to[color=blue]
    > make anything of it. I do know that the data is not encrypted, but it is
    > obviously encoded somehow so I primarily need to figure out how to decode[/color]
    or[color=blue]
    > have someone decode it for me. Please help.
    >
    > Thanks in advance. The csv file text follows:
    >
    > [USER DATA]
    > Ray
    > AGE=44
    > WEIGHT=85.7 kg
    > LOWER HR=60
    > UPPER HR=221
    > [END USER DATA]
    >
    > number of records = 913
    >
    >
    > ms speed watts rpm hr ss lss rss lpwr rpwr miles wind grade load
    >
    > " 0"," 0.00"," 0"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0000","[/color]
    0","[color=blue]
    > 0.00"," 0"
    > " 374"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
    > 0"," 0.00"," 0"
    > " 541"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
    > 0"," 0.00"," 0"
    > " 559"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
    > 0"," 0.00"," 0"
    > " 593"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0002","
    > 0"," 0.00"," 0"
    > " 629"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
    > 0"," 0.00"," 0"
    > " 646"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
    > 0"," 0.00"," 0"
    > " 680"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0004","
    > 0"," 0.00"," 0"
    > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0004","
    > 0"," 0.00"," 0"
    > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0005","
    > 0"," 0.00"," 0"
    > " 769"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0005","[/color]
    0",[color=blue]
    > " 0.00"," 0"
    >
    >[/color]


    Comment

    • Kevin Knorpp

      #3
      Re: Decoding/reading data from a binary file into (an) array(s)

      Thanks for the reply. I got that part down and can probably figure out how
      to read the binary file itself. What I'm struggling with is decoding the
      binary file format structure. Any ideas? Thanks.

      "CountScubu la" <me@scantek.hot mail.com> wrote in message
      news:ufxVb.2270 4$g83.9523@news svr25.news.prod igy.com...[color=blue]
      > here is one way, there is also some csv functions too
      >
      > $aryFile = file("the_file_ name.csv");
      > // loop line by line
      > foreach ($aryFile as $line)
      > {
      > $line = trim($line);
      > $line = str_replace("\" ","",$line) ;
      >
      >[/color]
      list($ms,$speed ,$watts,$rpm,$h r,$ss,$lss,$rss ,$lpwr,$rpwr,$m iles,$wind,$gra d[color=blue]
      > e,$load) = explode(",",$li ne);
      >
      > // do whatever here
      >
      > }
      >
      > --
      > Mike Bradley
      > http://www.gzentools.com -- free online php tools
      > "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
      > news:aTwVb.2071 11$nt4.979457@a ttbi_s51...[color=green]
      > > Hello.
      > >
      > > I need to be able to extract the data from the attached file (or any[/color][/color]
      file[color=blue]
      > in[color=green]
      > > the same format) so that I can work with the data in PHP. I'm fairly
      > > comfortable with using PHP with databases, arrays, etc. but have not[/color]
      > worked[color=green]
      > > with binary data files.
      > >
      > > http://www.performancecentral.net/C...3Loop/3Loop.php
      > >
      > > click on "Download Performance".
      > >
      > > The good news is that I know at least most of the information the file
      > > contains b/c the program that created the file will export to a csv file
      > > (included at the bottom of this message).
      > >
      > > Please help. I tried to read using HHD hex editor, but failed to be able[/color]
      > to[color=green]
      > > make anything of it. I do know that the data is not encrypted, but it is
      > > obviously encoded somehow so I primarily need to figure out how to[/color][/color]
      decode[color=blue]
      > or[color=green]
      > > have someone decode it for me. Please help.
      > >
      > > Thanks in advance. The csv file text follows:
      > >
      > > [USER DATA]
      > > Ray
      > > AGE=44
      > > WEIGHT=85.7 kg
      > > LOWER HR=60
      > > UPPER HR=221
      > > [END USER DATA]
      > >
      > > number of records = 913
      > >
      > >
      > > ms speed watts rpm hr ss lss rss lpwr rpwr miles wind grade load
      > >
      > > " 0"," 0.00"," 0"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0000","[/color]
      > 0","[color=green]
      > > 0.00"," 0"
      > > " 374"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
      > > 0"," 0.00"," 0"
      > > " 541"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
      > > 0"," 0.00"," 0"
      > > " 559"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
      > > 0"," 0.00"," 0"
      > > " 593"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0002","
      > > 0"," 0.00"," 0"
      > > " 629"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
      > > 0"," 0.00"," 0"
      > > " 646"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0001","
      > > 0"," 0.00"," 0"
      > > " 680"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0004","
      > > 0"," 0.00"," 0"
      > > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0004","
      > > 0"," 0.00"," 0"
      > > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0005","
      > > 0"," 0.00"," 0"
      > > " 769"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0005","[/color]
      > 0",[color=green]
      > > " 0.00"," 0"
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • CountScubula

        #4
        Re: Decoding/reading data from a binary file into (an) array(s)

        Sorry, I must be missing something, what binary file are you refering too?

        --
        Mike Bradley
        http://www.gzentools.com -- free online php tools
        "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
        news:ZvyVb.2004 78$Rc4.1668277@ attbi_s54...[color=blue]
        > Thanks for the reply. I got that part down and can probably figure out[/color]
        how[color=blue]
        > to read the binary file itself. What I'm struggling with is decoding the
        > binary file format structure. Any ideas? Thanks.
        >
        > "CountScubu la" <me@scantek.hot mail.com> wrote in message
        > news:ufxVb.2270 4$g83.9523@news svr25.news.prod igy.com...[color=green]
        > > here is one way, there is also some csv functions too
        > >
        > > $aryFile = file("the_file_ name.csv");
        > > // loop line by line
        > > foreach ($aryFile as $line)
        > > {
        > > $line = trim($line);
        > > $line = str_replace("\" ","",$line) ;
        > >
        > >[/color]
        >[/color]
        list($ms,$speed ,$watts,$rpm,$h r,$ss,$lss,$rss ,$lpwr,$rpwr,$m iles,$wind,$gra d[color=blue][color=green]
        > > e,$load) = explode(",",$li ne);
        > >
        > > // do whatever here
        > >
        > > }
        > >
        > > --
        > > Mike Bradley
        > > http://www.gzentools.com -- free online php tools
        > > "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
        > > news:aTwVb.2071 11$nt4.979457@a ttbi_s51...[color=darkred]
        > > > Hello.
        > > >
        > > > I need to be able to extract the data from the attached file (or any[/color][/color]
        > file[color=green]
        > > in[color=darkred]
        > > > the same format) so that I can work with the data in PHP. I'm fairly
        > > > comfortable with using PHP with databases, arrays, etc. but have not[/color]
        > > worked[color=darkred]
        > > > with binary data files.
        > > >
        > > > http://www.performancecentral.net/C...3Loop/3Loop.php
        > > >
        > > > click on "Download Performance".
        > > >
        > > > The good news is that I know at least most of the information the file
        > > > contains b/c the program that created the file will export to a csv[/color][/color][/color]
        file[color=blue][color=green][color=darkred]
        > > > (included at the bottom of this message).
        > > >
        > > > Please help. I tried to read using HHD hex editor, but failed to be[/color][/color][/color]
        able[color=blue][color=green]
        > > to[color=darkred]
        > > > make anything of it. I do know that the data is not encrypted, but it[/color][/color][/color]
        is[color=blue][color=green][color=darkred]
        > > > obviously encoded somehow so I primarily need to figure out how to[/color][/color]
        > decode[color=green]
        > > or[color=darkred]
        > > > have someone decode it for me. Please help.
        > > >
        > > > Thanks in advance. The csv file text follows:
        > > >
        > > > [USER DATA]
        > > > Ray
        > > > AGE=44
        > > > WEIGHT=85.7 kg
        > > > LOWER HR=60
        > > > UPPER HR=221
        > > > [END USER DATA]
        > > >
        > > > number of records = 913
        > > >
        > > >
        > > > ms speed watts rpm hr ss lss rss lpwr rpwr miles wind grade load
        > > >
        > > > " 0"," 0.00"," 0"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0000","[/color]
        > > 0","[color=darkred]
        > > > 0.00"," 0"
        > > > " 374"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
        0.0001","[color=blue][color=green][color=darkred]
        > > > 0"," 0.00"," 0"
        > > > " 541"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
        0.0001","[color=blue][color=green][color=darkred]
        > > > 0"," 0.00"," 0"
        > > > " 559"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
        0.0001","[color=blue][color=green][color=darkred]
        > > > 0"," 0.00"," 0"
        > > > " 593"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
        0.0002","[color=blue][color=green][color=darkred]
        > > > 0"," 0.00"," 0"
        > > > " 629"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
        0.0001","[color=blue][color=green][color=darkred]
        > > > 0"," 0.00"," 0"
        > > > " 646"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
        0.0001","[color=blue][color=green][color=darkred]
        > > > 0"," 0.00"," 0"
        > > > " 680"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
        0.0004","[color=blue][color=green][color=darkred]
        > > > 0"," 0.00"," 0"
        > > > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
        0.0004","[color=blue][color=green][color=darkred]
        > > > 0"," 0.00"," 0"
        > > > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
        0.0005","[color=blue][color=green][color=darkred]
        > > > 0"," 0.00"," 0"
        > > > " 769"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
        0.0005","[color=blue][color=green]
        > > 0",[color=darkred]
        > > > " 0.00"," 0"
        > > >
        > > >[/color]
        > >
        > >[/color]
        >
        >[/color]


        Comment

        • Chung Leong

          #5
          Re: Decoding/reading data from a binary file into (an) array(s)

          Reverse engineering a file format is not easy. Basically, there's two ways
          the records could be stored: fixed-size or variable size. With a hex editor,
          try to figure out the size of different records. Variable size records
          usually store its length at the first byte or word.

          It looks like some of the data is stored as floating points. Here's a couple
          function that show the binary representation of single and double precision
          floats:

          function ieee_double($f) {
          $f = (double) $f;
          $b = pack("d", $f);
          $hex = "";
          for($i = 0; $i < strlen($b); $i++) {
          $c = ord($b{$i});
          $hex .= sprintf(" %02X", $c);
          }
          return $hex;
          }

          function ieee_float($f) {
          $f = (float) $f;
          $b = pack("f", $f);
          $hex = "";
          for($i = 0; $i < strlen($b); $i++) {
          $c = ord($b{$i});
          $hex .= sprintf(" %02X", $c);
          }
          return $hex;
          }

          Uzytkownik "Kevin Knorpp" <kevinknorpp@in sightbb.com> napisal w wiadomosci
          news:ZvyVb.2004 78$Rc4.1668277@ attbi_s54...[color=blue]
          > Thanks for the reply. I got that part down and can probably figure out[/color]
          how[color=blue]
          > to read the binary file itself. What I'm struggling with is decoding the
          > binary file format structure. Any ideas? Thanks.
          >
          > "CountScubu la" <me@scantek.hot mail.com> wrote in message
          > news:ufxVb.2270 4$g83.9523@news svr25.news.prod igy.com...[color=green]
          > > here is one way, there is also some csv functions too
          > >
          > > $aryFile = file("the_file_ name.csv");
          > > // loop line by line
          > > foreach ($aryFile as $line)
          > > {
          > > $line = trim($line);
          > > $line = str_replace("\" ","",$line) ;
          > >
          > >[/color]
          >[/color]
          list($ms,$speed ,$watts,$rpm,$h r,$ss,$lss,$rss ,$lpwr,$rpwr,$m iles,$wind,$gra d[color=blue][color=green]
          > > e,$load) = explode(",",$li ne);
          > >
          > > // do whatever here
          > >
          > > }
          > >
          > > --
          > > Mike Bradley
          > > http://www.gzentools.com -- free online php tools
          > > "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
          > > news:aTwVb.2071 11$nt4.979457@a ttbi_s51...[color=darkred]
          > > > Hello.
          > > >
          > > > I need to be able to extract the data from the attached file (or any[/color][/color]
          > file[color=green]
          > > in[color=darkred]
          > > > the same format) so that I can work with the data in PHP. I'm fairly
          > > > comfortable with using PHP with databases, arrays, etc. but have not[/color]
          > > worked[color=darkred]
          > > > with binary data files.
          > > >
          > > > http://www.performancecentral.net/C...3Loop/3Loop.php
          > > >
          > > > click on "Download Performance".
          > > >
          > > > The good news is that I know at least most of the information the file
          > > > contains b/c the program that created the file will export to a csv[/color][/color][/color]
          file[color=blue][color=green][color=darkred]
          > > > (included at the bottom of this message).
          > > >
          > > > Please help. I tried to read using HHD hex editor, but failed to be[/color][/color][/color]
          able[color=blue][color=green]
          > > to[color=darkred]
          > > > make anything of it. I do know that the data is not encrypted, but it[/color][/color][/color]
          is[color=blue][color=green][color=darkred]
          > > > obviously encoded somehow so I primarily need to figure out how to[/color][/color]
          > decode[color=green]
          > > or[color=darkred]
          > > > have someone decode it for me. Please help.
          > > >
          > > > Thanks in advance. The csv file text follows:
          > > >
          > > > [USER DATA]
          > > > Ray
          > > > AGE=44
          > > > WEIGHT=85.7 kg
          > > > LOWER HR=60
          > > > UPPER HR=221
          > > > [END USER DATA]
          > > >
          > > > number of records = 913
          > > >
          > > >
          > > > ms speed watts rpm hr ss lss rss lpwr rpwr miles wind grade load
          > > >
          > > > " 0"," 0.00"," 0"," 0","100"," 99"," 99"," 99"," 50"," 49"," 0.0000","[/color]
          > > 0","[color=darkred]
          > > > 0.00"," 0"
          > > > " 374"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
          0.0001","[color=blue][color=green][color=darkred]
          > > > 0"," 0.00"," 0"
          > > > " 541"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
          0.0001","[color=blue][color=green][color=darkred]
          > > > 0"," 0.00"," 0"
          > > > " 559"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
          0.0001","[color=blue][color=green][color=darkred]
          > > > 0"," 0.00"," 0"
          > > > " 593"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
          0.0002","[color=blue][color=green][color=darkred]
          > > > 0"," 0.00"," 0"
          > > > " 629"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
          0.0001","[color=blue][color=green][color=darkred]
          > > > 0"," 0.00"," 0"
          > > > " 646"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
          0.0001","[color=blue][color=green][color=darkred]
          > > > 0"," 0.00"," 0"
          > > > " 680"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
          0.0004","[color=blue][color=green][color=darkred]
          > > > 0"," 0.00"," 0"
          > > > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
          0.0004","[color=blue][color=green][color=darkred]
          > > > 0"," 0.00"," 0"
          > > > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
          0.0005","[color=blue][color=green][color=darkred]
          > > > 0"," 0.00"," 0"
          > > > " 769"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
          0.0005","[color=blue][color=green]
          > > 0",[color=darkred]
          > > > " 0.00"," 0"
          > > >
          > > >[/color]
          > >
          > >[/color]
          >
          >[/color]


          Comment

          • Kevin Knorpp

            #6
            Re: Decoding/reading data from a binary file into (an) array(s)

            You can get the file via this link. Click on Download Performance. Thanks
            again.
            [color=blue][color=green][color=darkred]
            > > > http://www.performancecentral.net/C...3Loop/3Loop.php
            > > >
            > > > click on "Download Performance".[/color][/color][/color]

            "CountScubu la" <me@scantek.hot mail.com> wrote in message
            news:KSyVb.2279 0$OU3.11798@new ssvr25.news.pro digy.com...[color=blue]
            > Sorry, I must be missing something, what binary file are you refering too?
            >
            > --
            > Mike Bradley
            > http://www.gzentools.com -- free online php tools
            > "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
            > news:ZvyVb.2004 78$Rc4.1668277@ attbi_s54...[color=green]
            > > Thanks for the reply. I got that part down and can probably figure out[/color]
            > how[color=green]
            > > to read the binary file itself. What I'm struggling with is decoding[/color][/color]
            the[color=blue][color=green]
            > > binary file format structure. Any ideas? Thanks.
            > >
            > > "CountScubu la" <me@scantek.hot mail.com> wrote in message
            > > news:ufxVb.2270 4$g83.9523@news svr25.news.prod igy.com...[color=darkred]
            > > > here is one way, there is also some csv functions too
            > > >
            > > > $aryFile = file("the_file_ name.csv");
            > > > // loop line by line
            > > > foreach ($aryFile as $line)
            > > > {
            > > > $line = trim($line);
            > > > $line = str_replace("\" ","",$line) ;
            > > >
            > > >[/color]
            > >[/color]
            >[/color]
            list($ms,$speed ,$watts,$rpm,$h r,$ss,$lss,$rss ,$lpwr,$rpwr,$m iles,$wind,$gra d[color=blue][color=green][color=darkred]
            > > > e,$load) = explode(",",$li ne);
            > > >
            > > > // do whatever here
            > > >
            > > > }
            > > >
            > > > --
            > > > Mike Bradley
            > > > http://www.gzentools.com -- free online php tools
            > > > "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
            > > > news:aTwVb.2071 11$nt4.979457@a ttbi_s51...
            > > > > Hello.
            > > > >
            > > > > I need to be able to extract the data from the attached file (or any[/color]
            > > file[color=darkred]
            > > > in
            > > > > the same format) so that I can work with the data in PHP. I'm fairly
            > > > > comfortable with using PHP with databases, arrays, etc. but have not
            > > > worked
            > > > > with binary data files.
            > > > >
            > > > > http://www.performancecentral.net/C...3Loop/3Loop.php
            > > > >
            > > > > click on "Download Performance".
            > > > >
            > > > > The good news is that I know at least most of the information the[/color][/color][/color]
            file[color=blue][color=green][color=darkred]
            > > > > contains b/c the program that created the file will export to a csv[/color][/color]
            > file[color=green][color=darkred]
            > > > > (included at the bottom of this message).
            > > > >
            > > > > Please help. I tried to read using HHD hex editor, but failed to be[/color][/color]
            > able[color=green][color=darkred]
            > > > to
            > > > > make anything of it. I do know that the data is not encrypted, but[/color][/color][/color]
            it[color=blue]
            > is[color=green][color=darkred]
            > > > > obviously encoded somehow so I primarily need to figure out how to[/color]
            > > decode[color=darkred]
            > > > or
            > > > > have someone decode it for me. Please help.
            > > > >
            > > > > Thanks in advance. The csv file text follows:
            > > > >
            > > > > [USER DATA]
            > > > > Ray
            > > > > AGE=44
            > > > > WEIGHT=85.7 kg
            > > > > LOWER HR=60
            > > > > UPPER HR=221
            > > > > [END USER DATA]
            > > > >
            > > > > number of records = 913
            > > > >
            > > > >
            > > > > ms speed watts rpm hr ss lss rss lpwr rpwr miles wind grade load
            > > > >
            > > > > " 0"," 0.00"," 0"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
            0.0000","[color=blue][color=green][color=darkred]
            > > > 0","
            > > > > 0.00"," 0"
            > > > > " 374"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
            > 0.0001","[color=green][color=darkred]
            > > > > 0"," 0.00"," 0"
            > > > > " 541"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
            > 0.0001","[color=green][color=darkred]
            > > > > 0"," 0.00"," 0"
            > > > > " 559"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
            > 0.0001","[color=green][color=darkred]
            > > > > 0"," 0.00"," 0"
            > > > > " 593"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
            > 0.0002","[color=green][color=darkred]
            > > > > 0"," 0.00"," 0"
            > > > > " 629"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
            > 0.0001","[color=green][color=darkred]
            > > > > 0"," 0.00"," 0"
            > > > > " 646"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
            > 0.0001","[color=green][color=darkred]
            > > > > 0"," 0.00"," 0"
            > > > > " 680"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
            > 0.0004","[color=green][color=darkred]
            > > > > 0"," 0.00"," 0"
            > > > > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
            > 0.0004","[color=green][color=darkred]
            > > > > 0"," 0.00"," 0"
            > > > > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
            > 0.0005","[color=green][color=darkred]
            > > > > 0"," 0.00"," 0"
            > > > > " 769"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
            > 0.0005","[color=green][color=darkred]
            > > > 0",
            > > > > " 0.00"," 0"
            > > > >
            > > > >
            > > >
            > > >[/color]
            > >
            > >[/color]
            >
            >[/color]


            Comment

            • Kevin Knorpp

              #7
              Re: Decoding/reading data from a binary file into (an) array(s)

              Thanks, Chung. I'm afraid this might be over my head. Can you recommend
              where I might go for more hands on help? I may need someone to write the
              code for me to read the data from the file into an array or a database
              table. I'm good with arrays and database tables, but binary and floating
              point data is way out of my comfort zone. Any ideas? Do you have any idea
              how many hours it would take to do? Many thanks in advance.

              "Chung Leong" <chernyshevsky@ hotmail.com> wrote in message
              news:NOmdnf7lTc iFTrvdRVn-gg@comcast.com. ..[color=blue]
              > Reverse engineering a file format is not easy. Basically, there's two ways
              > the records could be stored: fixed-size or variable size. With a hex[/color]
              editor,[color=blue]
              > try to figure out the size of different records. Variable size records
              > usually store its length at the first byte or word.
              >
              > It looks like some of the data is stored as floating points. Here's a[/color]
              couple[color=blue]
              > function that show the binary representation of single and double[/color]
              precision[color=blue]
              > floats:
              >
              > function ieee_double($f) {
              > $f = (double) $f;
              > $b = pack("d", $f);
              > $hex = "";
              > for($i = 0; $i < strlen($b); $i++) {
              > $c = ord($b{$i});
              > $hex .= sprintf(" %02X", $c);
              > }
              > return $hex;
              > }
              >
              > function ieee_float($f) {
              > $f = (float) $f;
              > $b = pack("f", $f);
              > $hex = "";
              > for($i = 0; $i < strlen($b); $i++) {
              > $c = ord($b{$i});
              > $hex .= sprintf(" %02X", $c);
              > }
              > return $hex;
              > }
              >
              > Uzytkownik "Kevin Knorpp" <kevinknorpp@in sightbb.com> napisal w wiadomosci
              > news:ZvyVb.2004 78$Rc4.1668277@ attbi_s54...[color=green]
              > > Thanks for the reply. I got that part down and can probably figure out[/color]
              > how[color=green]
              > > to read the binary file itself. What I'm struggling with is decoding[/color][/color]
              the[color=blue][color=green]
              > > binary file format structure. Any ideas? Thanks.
              > >
              > > "CountScubu la" <me@scantek.hot mail.com> wrote in message
              > > news:ufxVb.2270 4$g83.9523@news svr25.news.prod igy.com...[color=darkred]
              > > > here is one way, there is also some csv functions too
              > > >
              > > > $aryFile = file("the_file_ name.csv");
              > > > // loop line by line
              > > > foreach ($aryFile as $line)
              > > > {
              > > > $line = trim($line);
              > > > $line = str_replace("\" ","",$line) ;
              > > >
              > > >[/color]
              > >[/color]
              >[/color]
              list($ms,$speed ,$watts,$rpm,$h r,$ss,$lss,$rss ,$lpwr,$rpwr,$m iles,$wind,$gra d[color=blue][color=green][color=darkred]
              > > > e,$load) = explode(",",$li ne);
              > > >
              > > > // do whatever here
              > > >
              > > > }
              > > >
              > > > --
              > > > Mike Bradley
              > > > http://www.gzentools.com -- free online php tools
              > > > "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
              > > > news:aTwVb.2071 11$nt4.979457@a ttbi_s51...
              > > > > Hello.
              > > > >
              > > > > I need to be able to extract the data from the attached file (or any[/color]
              > > file[color=darkred]
              > > > in
              > > > > the same format) so that I can work with the data in PHP. I'm fairly
              > > > > comfortable with using PHP with databases, arrays, etc. but have not
              > > > worked
              > > > > with binary data files.
              > > > >
              > > > > http://www.performancecentral.net/C...3Loop/3Loop.php
              > > > >
              > > > > click on "Download Performance".
              > > > >
              > > > > The good news is that I know at least most of the information the[/color][/color][/color]
              file[color=blue][color=green][color=darkred]
              > > > > contains b/c the program that created the file will export to a csv[/color][/color]
              > file[color=green][color=darkred]
              > > > > (included at the bottom of this message).
              > > > >
              > > > > Please help. I tried to read using HHD hex editor, but failed to be[/color][/color]
              > able[color=green][color=darkred]
              > > > to
              > > > > make anything of it. I do know that the data is not encrypted, but[/color][/color][/color]
              it[color=blue]
              > is[color=green][color=darkred]
              > > > > obviously encoded somehow so I primarily need to figure out how to[/color]
              > > decode[color=darkred]
              > > > or
              > > > > have someone decode it for me. Please help.
              > > > >
              > > > > Thanks in advance. The csv file text follows:
              > > > >
              > > > > [USER DATA]
              > > > > Ray
              > > > > AGE=44
              > > > > WEIGHT=85.7 kg
              > > > > LOWER HR=60
              > > > > UPPER HR=221
              > > > > [END USER DATA]
              > > > >
              > > > > number of records = 913
              > > > >
              > > > >
              > > > > ms speed watts rpm hr ss lss rss lpwr rpwr miles wind grade load
              > > > >
              > > > > " 0"," 0.00"," 0"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color][/color]
              0.0000","[color=blue][color=green][color=darkred]
              > > > 0","
              > > > > 0.00"," 0"
              > > > > " 374"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
              > 0.0001","[color=green][color=darkred]
              > > > > 0"," 0.00"," 0"
              > > > > " 541"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
              > 0.0001","[color=green][color=darkred]
              > > > > 0"," 0.00"," 0"
              > > > > " 559"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
              > 0.0001","[color=green][color=darkred]
              > > > > 0"," 0.00"," 0"
              > > > > " 593"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
              > 0.0002","[color=green][color=darkred]
              > > > > 0"," 0.00"," 0"
              > > > > " 629"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
              > 0.0001","[color=green][color=darkred]
              > > > > 0"," 0.00"," 0"
              > > > > " 646"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
              > 0.0001","[color=green][color=darkred]
              > > > > 0"," 0.00"," 0"
              > > > > " 680"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
              > 0.0004","[color=green][color=darkred]
              > > > > 0"," 0.00"," 0"
              > > > > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
              > 0.0004","[color=green][color=darkred]
              > > > > 0"," 0.00"," 0"
              > > > > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
              > 0.0005","[color=green][color=darkred]
              > > > > 0"," 0.00"," 0"
              > > > > " 769"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
              > 0.0005","[color=green][color=darkred]
              > > > 0",
              > > > > " 0.00"," 0"
              > > > >
              > > > >
              > > >
              > > >[/color]
              > >
              > >[/color]
              >
              >[/color]


              Comment

              • CountScubula

                #8
                Re: Decoding/reading data from a binary file into (an) array(s)

                link doesnt work for me, sorry error 404

                --
                Mike Bradley
                http://www.gzentools.com -- free online php tools
                "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
                news:f3CVb.2011 43$Rc4.1672212@ attbi_s54...[color=blue]
                > You can get the file via this link. Click on Download Performance.[/color]
                Thanks[color=blue]
                > again.
                >[color=green][color=darkred]
                > > > > http://www.performancecentral.net/C...3Loop/3Loop.php
                > > > >
                > > > > click on "Download Performance".[/color][/color]
                >
                > "CountScubu la" <me@scantek.hot mail.com> wrote in message
                > news:KSyVb.2279 0$OU3.11798@new ssvr25.news.pro digy.com...[color=green]
                > > Sorry, I must be missing something, what binary file are you refering[/color][/color]
                too?[color=blue][color=green]
                > >
                > > --
                > > Mike Bradley
                > > http://www.gzentools.com -- free online php tools
                > > "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
                > > news:ZvyVb.2004 78$Rc4.1668277@ attbi_s54...[color=darkred]
                > > > Thanks for the reply. I got that part down and can probably figure[/color][/color][/color]
                out[color=blue][color=green]
                > > how[color=darkred]
                > > > to read the binary file itself. What I'm struggling with is decoding[/color][/color]
                > the[color=green][color=darkred]
                > > > binary file format structure. Any ideas? Thanks.
                > > >
                > > > "CountScubu la" <me@scantek.hot mail.com> wrote in message
                > > > news:ufxVb.2270 4$g83.9523@news svr25.news.prod igy.com...
                > > > > here is one way, there is also some csv functions too
                > > > >
                > > > > $aryFile = file("the_file_ name.csv");
                > > > > // loop line by line
                > > > > foreach ($aryFile as $line)
                > > > > {
                > > > > $line = trim($line);
                > > > > $line = str_replace("\" ","",$line) ;
                > > > >
                > > > >
                > > >[/color]
                > >[/color]
                >[/color]
                list($ms,$speed ,$watts,$rpm,$h r,$ss,$lss,$rss ,$lpwr,$rpwr,$m iles,$wind,$gra d[color=blue][color=green][color=darkred]
                > > > > e,$load) = explode(",",$li ne);
                > > > >
                > > > > // do whatever here
                > > > >
                > > > > }
                > > > >
                > > > > --
                > > > > Mike Bradley
                > > > > http://www.gzentools.com -- free online php tools
                > > > > "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
                > > > > news:aTwVb.2071 11$nt4.979457@a ttbi_s51...
                > > > > > Hello.
                > > > > >
                > > > > > I need to be able to extract the data from the attached file (or[/color][/color][/color]
                any[color=blue][color=green][color=darkred]
                > > > file
                > > > > in
                > > > > > the same format) so that I can work with the data in PHP. I'm[/color][/color][/color]
                fairly[color=blue][color=green][color=darkred]
                > > > > > comfortable with using PHP with databases, arrays, etc. but have[/color][/color][/color]
                not[color=blue][color=green][color=darkred]
                > > > > worked
                > > > > > with binary data files.
                > > > > >
                > > > > > http://www.performancecentral.net/C...3Loop/3Loop.php
                > > > > >
                > > > > > click on "Download Performance".
                > > > > >
                > > > > > The good news is that I know at least most of the information the[/color][/color]
                > file[color=green][color=darkred]
                > > > > > contains b/c the program that created the file will export to a[/color][/color][/color]
                csv[color=blue][color=green]
                > > file[color=darkred]
                > > > > > (included at the bottom of this message).
                > > > > >
                > > > > > Please help. I tried to read using HHD hex editor, but failed to[/color][/color][/color]
                be[color=blue][color=green]
                > > able[color=darkred]
                > > > > to
                > > > > > make anything of it. I do know that the data is not encrypted, but[/color][/color]
                > it[color=green]
                > > is[color=darkred]
                > > > > > obviously encoded somehow so I primarily need to figure out how to
                > > > decode
                > > > > or
                > > > > > have someone decode it for me. Please help.
                > > > > >
                > > > > > Thanks in advance. The csv file text follows:
                > > > > >
                > > > > > [USER DATA]
                > > > > > Ray
                > > > > > AGE=44
                > > > > > WEIGHT=85.7 kg
                > > > > > LOWER HR=60
                > > > > > UPPER HR=221
                > > > > > [END USER DATA]
                > > > > >
                > > > > > number of records = 913
                > > > > >
                > > > > >
                > > > > > ms speed watts rpm hr ss lss rss lpwr rpwr miles wind grade load
                > > > > >
                > > > > > " 0"," 0.00"," 0"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color][/color]
                > 0.0000","[color=green][color=darkred]
                > > > > 0","
                > > > > > 0.00"," 0"
                > > > > > " 374"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color]
                > > 0.0001","[color=darkred]
                > > > > > 0"," 0.00"," 0"
                > > > > > " 541"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color]
                > > 0.0001","[color=darkred]
                > > > > > 0"," 0.00"," 0"
                > > > > > " 559"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color]
                > > 0.0001","[color=darkred]
                > > > > > 0"," 0.00"," 0"
                > > > > > " 593"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color]
                > > 0.0002","[color=darkred]
                > > > > > 0"," 0.00"," 0"
                > > > > > " 629"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color]
                > > 0.0001","[color=darkred]
                > > > > > 0"," 0.00"," 0"
                > > > > > " 646"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color]
                > > 0.0001","[color=darkred]
                > > > > > 0"," 0.00"," 0"
                > > > > > " 680"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color]
                > > 0.0004","[color=darkred]
                > > > > > 0"," 0.00"," 0"
                > > > > > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color]
                > > 0.0004","[color=darkred]
                > > > > > 0"," 0.00"," 0"
                > > > > > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color]
                > > 0.0005","[color=darkred]
                > > > > > 0"," 0.00"," 0"
                > > > > > " 769"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color]
                > > 0.0005","[color=darkred]
                > > > > 0",
                > > > > > " 0.00"," 0"
                > > > > >
                > > > > >
                > > > >
                > > > >
                > > >
                > > >[/color]
                > >
                > >[/color]
                >
                >[/color]


                Comment

                • André Næss

                  #9
                  Re: Decoding/reading data from a binary file into (an) array(s)

                  Kevin Knorpp:
                  [color=blue]
                  > Hello.
                  >
                  > I need to be able to extract the data from the attached file (or any file
                  > in the same format) so that I can work with the data in PHP. I'm fairly
                  > comfortable with using PHP with databases, arrays, etc. but have not
                  > worked with binary data files.
                  >
                  > http://www.performancecentral.net/C...3Loop/3Loop.php
                  >
                  > click on "Download Performance".
                  >
                  > The good news is that I know at least most of the information the file
                  > contains b/c the program that created the file will export to a csv file
                  > (included at the bottom of this message).[/color]

                  Why don't you simply use the csv file? If you want to decode the binary
                  file, ask the people who supply it.

                  André Næss

                  Comment

                  • Kevin Knorpp

                    #10
                    Re: Decoding/reading data from a binary file into (an) array(s)

                    Sorry about that. Here:



                    "CountScubu la" <me@scantek.hot mail.com> wrote in message
                    news:UCKVb.1079 0$xA6.950@newss vr29.news.prodi gy.com...[color=blue]
                    > link doesnt work for me, sorry error 404
                    >
                    > --
                    > Mike Bradley
                    > http://www.gzentools.com -- free online php tools
                    > "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
                    > news:f3CVb.2011 43$Rc4.1672212@ attbi_s54...[color=green]
                    > > You can get the file via this link. Click on Download Performance.[/color]
                    > Thanks[color=green]
                    > > again.
                    > >[color=darkred]
                    > > > > > http://www.performancecentral.net/C...3Loop/3Loop.php
                    > > > > >
                    > > > > > click on "Download Performance".[/color]
                    > >
                    > > "CountScubu la" <me@scantek.hot mail.com> wrote in message
                    > > news:KSyVb.2279 0$OU3.11798@new ssvr25.news.pro digy.com...[color=darkred]
                    > > > Sorry, I must be missing something, what binary file are you refering[/color][/color]
                    > too?[color=green][color=darkred]
                    > > >
                    > > > --
                    > > > Mike Bradley
                    > > > http://www.gzentools.com -- free online php tools
                    > > > "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
                    > > > news:ZvyVb.2004 78$Rc4.1668277@ attbi_s54...
                    > > > > Thanks for the reply. I got that part down and can probably figure[/color][/color]
                    > out[color=green][color=darkred]
                    > > > how
                    > > > > to read the binary file itself. What I'm struggling with is[/color][/color][/color]
                    decoding[color=blue][color=green]
                    > > the[color=darkred]
                    > > > > binary file format structure. Any ideas? Thanks.
                    > > > >
                    > > > > "CountScubu la" <me@scantek.hot mail.com> wrote in message
                    > > > > news:ufxVb.2270 4$g83.9523@news svr25.news.prod igy.com...
                    > > > > > here is one way, there is also some csv functions too
                    > > > > >
                    > > > > > $aryFile = file("the_file_ name.csv");
                    > > > > > // loop line by line
                    > > > > > foreach ($aryFile as $line)
                    > > > > > {
                    > > > > > $line = trim($line);
                    > > > > > $line = str_replace("\" ","",$line) ;
                    > > > > >
                    > > > > >
                    > > > >
                    > > >[/color]
                    > >[/color]
                    >[/color]
                    list($ms,$speed ,$watts,$rpm,$h r,$ss,$lss,$rss ,$lpwr,$rpwr,$m iles,$wind,$gra d[color=blue][color=green][color=darkred]
                    > > > > > e,$load) = explode(",",$li ne);
                    > > > > >
                    > > > > > // do whatever here
                    > > > > >
                    > > > > > }
                    > > > > >
                    > > > > > --
                    > > > > > Mike Bradley
                    > > > > > http://www.gzentools.com -- free online php tools
                    > > > > > "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
                    > > > > > news:aTwVb.2071 11$nt4.979457@a ttbi_s51...
                    > > > > > > Hello.
                    > > > > > >
                    > > > > > > I need to be able to extract the data from the attached file (or[/color][/color]
                    > any[color=green][color=darkred]
                    > > > > file
                    > > > > > in
                    > > > > > > the same format) so that I can work with the data in PHP. I'm[/color][/color]
                    > fairly[color=green][color=darkred]
                    > > > > > > comfortable with using PHP with databases, arrays, etc. but have[/color][/color]
                    > not[color=green][color=darkred]
                    > > > > > worked
                    > > > > > > with binary data files.
                    > > > > > >
                    > > > > > > http://www.performancecentral.net/C...3Loop/3Loop.php
                    > > > > > >
                    > > > > > > click on "Download Performance".
                    > > > > > >
                    > > > > > > The good news is that I know at least most of the information[/color][/color][/color]
                    the[color=blue][color=green]
                    > > file[color=darkred]
                    > > > > > > contains b/c the program that created the file will export to a[/color][/color]
                    > csv[color=green][color=darkred]
                    > > > file
                    > > > > > > (included at the bottom of this message).
                    > > > > > >
                    > > > > > > Please help. I tried to read using HHD hex editor, but failed to[/color][/color]
                    > be[color=green][color=darkred]
                    > > > able
                    > > > > > to
                    > > > > > > make anything of it. I do know that the data is not encrypted,[/color][/color][/color]
                    but[color=blue][color=green]
                    > > it[color=darkred]
                    > > > is
                    > > > > > > obviously encoded somehow so I primarily need to figure out how[/color][/color][/color]
                    to[color=blue][color=green][color=darkred]
                    > > > > decode
                    > > > > > or
                    > > > > > > have someone decode it for me. Please help.
                    > > > > > >
                    > > > > > > Thanks in advance. The csv file text follows:
                    > > > > > >
                    > > > > > > [USER DATA]
                    > > > > > > Ray
                    > > > > > > AGE=44
                    > > > > > > WEIGHT=85.7 kg
                    > > > > > > LOWER HR=60
                    > > > > > > UPPER HR=221
                    > > > > > > [END USER DATA]
                    > > > > > >
                    > > > > > > number of records = 913
                    > > > > > >
                    > > > > > >
                    > > > > > > ms speed watts rpm hr ss lss rss lpwr rpwr miles wind grade load
                    > > > > > >
                    > > > > > > " 0"," 0.00"," 0"," 0","100"," 99"," 99"," 99"," 50"," 49","[/color]
                    > > 0.0000","[color=darkred]
                    > > > > > 0","
                    > > > > > > 0.00"," 0"
                    > > > > > > " 374"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","
                    > > > 0.0001","
                    > > > > > > 0"," 0.00"," 0"
                    > > > > > > " 541"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","
                    > > > 0.0001","
                    > > > > > > 0"," 0.00"," 0"
                    > > > > > > " 559"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","
                    > > > 0.0001","
                    > > > > > > 0"," 0.00"," 0"
                    > > > > > > " 593"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","
                    > > > 0.0002","
                    > > > > > > 0"," 0.00"," 0"
                    > > > > > > " 629"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","
                    > > > 0.0001","
                    > > > > > > 0"," 0.00"," 0"
                    > > > > > > " 646"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","
                    > > > 0.0001","
                    > > > > > > 0"," 0.00"," 0"
                    > > > > > > " 680"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","
                    > > > 0.0004","
                    > > > > > > 0"," 0.00"," 0"
                    > > > > > > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","
                    > > > 0.0004","
                    > > > > > > 0"," 0.00"," 0"
                    > > > > > > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","
                    > > > 0.0005","
                    > > > > > > 0"," 0.00"," 0"
                    > > > > > > " 769"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50"," 49","
                    > > > 0.0005","
                    > > > > > 0",
                    > > > > > > " 0.00"," 0"
                    > > > > > >
                    > > > > > >
                    > > > > >
                    > > > > >
                    > > > >
                    > > > >
                    > > >
                    > > >[/color]
                    > >
                    > >[/color]
                    >
                    >[/color]


                    Comment

                    • Kevin Knorpp

                      #11
                      Re: Decoding/reading data from a binary file into (an) array(s)

                      Good question. The binary file is created by a SW program that runs on an
                      ergometer that is used to train competitive cyclists. The company who makes
                      the SW also makes another SW that will create a .csv file from the binary
                      file. The problem is that it is inconvenient for users to have to launch a
                      second program to export the data. The company that makes the SW is not
                      willing to supply the code, but is OK with anyone who can figure it out for
                      themselves. Please help.




                      "André Næss" <andrena.spamre allysucks@ifi.u io.no> wrote in message
                      news:c088m0$t4f $1@maud.ifi.uio .no...[color=blue]
                      > Kevin Knorpp:
                      >[color=green]
                      > > Hello.
                      > >
                      > > I need to be able to extract the data from the attached file (or any[/color][/color]
                      file[color=blue][color=green]
                      > > in the same format) so that I can work with the data in PHP. I'm fairly
                      > > comfortable with using PHP with databases, arrays, etc. but have not
                      > > worked with binary data files.
                      > >
                      > > http://www.performancecentral.net/C...3Loop/3Loop.php
                      > >
                      > > click on "Download Performance".
                      > >
                      > > The good news is that I know at least most of the information the file
                      > > contains b/c the program that created the file will export to a csv file
                      > > (included at the bottom of this message).[/color]
                      >
                      > Why don't you simply use the csv file? If you want to decode the binary
                      > file, ask the people who supply it.
                      >
                      > André Næss[/color]


                      Comment

                      • André Næss

                        #12
                        Re: Decoding/reading data from a binary file into (an) array(s)

                        Kevin Knorpp:
                        [color=blue]
                        > Good question. The binary file is created by a SW program that runs on an
                        > ergometer that is used to train competitive cyclists. The company who
                        > makes the SW also makes another SW that will create a .csv file from the
                        > binary
                        > file. The problem is that it is inconvenient for users to have to launch
                        > a
                        > second program to export the data. The company that makes the SW is not
                        > willing to supply the code, but is OK with anyone who can figure it out
                        > for
                        > themselves. Please help.[/color]

                        Do they regard the encoding as some sort of industrial secret? In that case
                        they are just stupid. In either case their behavior sounds rather strange
                        to me :P

                        Anyway, have a look at pack()/unpack(). You will just have to try to guess
                        wildly at what the file contains so it's gonna be a painful job.

                        André Næss

                        Comment

                        • Kevin Knorpp

                          #13
                          Re: Decoding/reading data from a binary file into (an) array(s)

                          I think I can figure out how to deal with the binary file, but I definitely
                          need help to reverse engineer the file format.

                          "CountScubu la" <me@scantek.hot mail.com> wrote in message
                          news:rr0Wb.1106 6$tK6.8620@news svr29.news.prod igy.com...[color=blue]
                          > Oh, you want to reverse engineer the file format, or do you know the[/color]
                          format,[color=blue]
                          > and just not know how to deal with the binary file?
                          >
                          >
                          > --
                          > Mike Bradley
                          > http://www.gzentools.com -- free online php tools
                          > "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
                          > news:C2VVb.1210 5$032.41479@att bi_s53...[color=green]
                          > > Sorry about that. Here:
                          > >
                          > > http://www.performancecentral.net/Co...Loop/3Loop.php
                          > >
                          > > "CountScubu la" <me@scantek.hot mail.com> wrote in message
                          > > news:UCKVb.1079 0$xA6.950@newss vr29.news.prodi gy.com...[color=darkred]
                          > > > link doesnt work for me, sorry error 404
                          > > >
                          > > > --
                          > > > Mike Bradley
                          > > > http://www.gzentools.com -- free online php tools
                          > > > "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
                          > > > news:f3CVb.2011 43$Rc4.1672212@ attbi_s54...
                          > > > > You can get the file via this link. Click on Download Performance.
                          > > > Thanks
                          > > > > again.
                          > > > >
                          > > > > > > > http://www.performancecentral.net/C...3Loop/3Loop.php
                          > > > > > > >
                          > > > > > > > click on "Download Performance".
                          > > > >
                          > > > > "CountScubu la" <me@scantek.hot mail.com> wrote in message
                          > > > > news:KSyVb.2279 0$OU3.11798@new ssvr25.news.pro digy.com...
                          > > > > > Sorry, I must be missing something, what binary file are you[/color][/color]
                          > refering[color=green][color=darkred]
                          > > > too?
                          > > > > >
                          > > > > > --
                          > > > > > Mike Bradley
                          > > > > > http://www.gzentools.com -- free online php tools
                          > > > > > "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
                          > > > > > news:ZvyVb.2004 78$Rc4.1668277@ attbi_s54...
                          > > > > > > Thanks for the reply. I got that part down and can probably[/color][/color]
                          > figure[color=green][color=darkred]
                          > > > out
                          > > > > > how
                          > > > > > > to read the binary file itself. What I'm struggling with is[/color]
                          > > decoding[color=darkred]
                          > > > > the
                          > > > > > > binary file format structure. Any ideas? Thanks.
                          > > > > > >
                          > > > > > > "CountScubu la" <me@scantek.hot mail.com> wrote in message
                          > > > > > > news:ufxVb.2270 4$g83.9523@news svr25.news.prod igy.com...
                          > > > > > > > here is one way, there is also some csv functions too
                          > > > > > > >
                          > > > > > > > $aryFile = file("the_file_ name.csv");
                          > > > > > > > // loop line by line
                          > > > > > > > foreach ($aryFile as $line)
                          > > > > > > > {
                          > > > > > > > $line = trim($line);
                          > > > > > > > $line = str_replace("\" ","",$line) ;
                          > > > > > > >
                          > > > > > > >
                          > > > > > >
                          > > > > >
                          > > > >
                          > > >[/color]
                          > >[/color]
                          >[/color]
                          list($ms,$speed ,$watts,$rpm,$h r,$ss,$lss,$rss ,$lpwr,$rpwr,$m iles,$wind,$gra d[color=blue][color=green][color=darkred]
                          > > > > > > > e,$load) = explode(",",$li ne);
                          > > > > > > >
                          > > > > > > > // do whatever here
                          > > > > > > >
                          > > > > > > > }
                          > > > > > > >
                          > > > > > > > --
                          > > > > > > > Mike Bradley
                          > > > > > > > http://www.gzentools.com -- free online php tools
                          > > > > > > > "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
                          > > > > > > > news:aTwVb.2071 11$nt4.979457@a ttbi_s51...
                          > > > > > > > > Hello.
                          > > > > > > > >
                          > > > > > > > > I need to be able to extract the data from the attached file[/color][/color]
                          > (or[color=green][color=darkred]
                          > > > any
                          > > > > > > file
                          > > > > > > > in
                          > > > > > > > > the same format) so that I can work with the data in PHP.[/color][/color][/color]
                          I'm[color=blue][color=green][color=darkred]
                          > > > fairly
                          > > > > > > > > comfortable with using PHP with databases, arrays, etc. but[/color][/color]
                          > have[color=green][color=darkred]
                          > > > not
                          > > > > > > > worked
                          > > > > > > > > with binary data files.
                          > > > > > > > >
                          > > > > > > > > http://www.performancecentral.net/C...3Loop/3Loop.php
                          > > > > > > > >
                          > > > > > > > > click on "Download Performance".
                          > > > > > > > >
                          > > > > > > > > The good news is that I know at least most of the[/color][/color][/color]
                          information[color=blue][color=green]
                          > > the[color=darkred]
                          > > > > file
                          > > > > > > > > contains b/c the program that created the file will export[/color][/color][/color]
                          to[color=blue]
                          > a[color=green][color=darkred]
                          > > > csv
                          > > > > > file
                          > > > > > > > > (included at the bottom of this message).
                          > > > > > > > >
                          > > > > > > > > Please help. I tried to read using HHD hex editor, but[/color][/color][/color]
                          failed[color=blue]
                          > to[color=green][color=darkred]
                          > > > be
                          > > > > > able
                          > > > > > > > to
                          > > > > > > > > make anything of it. I do know that the data is not[/color][/color][/color]
                          encrypted,[color=blue][color=green]
                          > > but[color=darkred]
                          > > > > it
                          > > > > > is
                          > > > > > > > > obviously encoded somehow so I primarily need to figure out[/color][/color]
                          > how[color=green]
                          > > to[color=darkred]
                          > > > > > > decode
                          > > > > > > > or
                          > > > > > > > > have someone decode it for me. Please help.
                          > > > > > > > >
                          > > > > > > > > Thanks in advance. The csv file text follows:
                          > > > > > > > >
                          > > > > > > > > [USER DATA]
                          > > > > > > > > Ray
                          > > > > > > > > AGE=44
                          > > > > > > > > WEIGHT=85.7 kg
                          > > > > > > > > LOWER HR=60
                          > > > > > > > > UPPER HR=221
                          > > > > > > > > [END USER DATA]
                          > > > > > > > >
                          > > > > > > > > number of records = 913
                          > > > > > > > >
                          > > > > > > > >
                          > > > > > > > > ms speed watts rpm hr ss lss rss lpwr rpwr miles wind grade[/color][/color]
                          > load[color=green][color=darkred]
                          > > > > > > > >
                          > > > > > > > > " 0"," 0.00"," 0"," 0","100"," 99"," 99"," 99"," 50"," 49","
                          > > > > 0.0000","
                          > > > > > > > 0","
                          > > > > > > > > 0.00"," 0"
                          > > > > > > > > " 374"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50","[/color][/color][/color]
                          49","[color=blue][color=green][color=darkred]
                          > > > > > 0.0001","
                          > > > > > > > > 0"," 0.00"," 0"
                          > > > > > > > > " 541"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50","[/color][/color][/color]
                          49","[color=blue][color=green][color=darkred]
                          > > > > > 0.0001","
                          > > > > > > > > 0"," 0.00"," 0"
                          > > > > > > > > " 559"," 2.76"," 4"," 0","100"," 99"," 99"," 99"," 50","[/color][/color][/color]
                          49","[color=blue][color=green][color=darkred]
                          > > > > > 0.0001","
                          > > > > > > > > 0"," 0.00"," 0"
                          > > > > > > > > " 593"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50","[/color][/color][/color]
                          49","[color=blue][color=green][color=darkred]
                          > > > > > 0.0002","
                          > > > > > > > > 0"," 0.00"," 0"
                          > > > > > > > > " 629"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50","[/color][/color][/color]
                          49","[color=blue][color=green][color=darkred]
                          > > > > > 0.0001","
                          > > > > > > > > 0"," 0.00"," 0"
                          > > > > > > > > " 646"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50","[/color][/color][/color]
                          49","[color=blue][color=green][color=darkred]
                          > > > > > 0.0001","
                          > > > > > > > > 0"," 0.00"," 0"
                          > > > > > > > > " 680"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50","[/color][/color][/color]
                          49","[color=blue][color=green][color=darkred]
                          > > > > > 0.0004","
                          > > > > > > > > 0"," 0.00"," 0"
                          > > > > > > > > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50","[/color][/color][/color]
                          49","[color=blue][color=green][color=darkred]
                          > > > > > 0.0004","
                          > > > > > > > > 0"," 0.00"," 0"
                          > > > > > > > > " 733"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50","[/color][/color][/color]
                          49","[color=blue][color=green][color=darkred]
                          > > > > > 0.0005","
                          > > > > > > > > 0"," 0.00"," 0"
                          > > > > > > > > " 769"," 7.08"," 4"," 0","100"," 99"," 99"," 99"," 50","[/color][/color][/color]
                          49","[color=blue][color=green][color=darkred]
                          > > > > > 0.0005","
                          > > > > > > > 0",
                          > > > > > > > > " 0.00"," 0"
                          > > > > > > > >
                          > > > > > > > >
                          > > > > > > >
                          > > > > > > >
                          > > > > > >
                          > > > > > >
                          > > > > >
                          > > > > >
                          > > > >
                          > > > >
                          > > >
                          > > >[/color]
                          > >
                          > >[/color]
                          >
                          >[/color]


                          Comment

                          • Kevin Knorpp

                            #14
                            Re: Decoding/reading data from a binary file into (an) array(s)

                            Even if I know what the data is when it's decoded?

                            "André Næss" <andrena.spamre allysucks@ifi.u io.no> wrote in message
                            news:c0a8or$6cu $1@maud.ifi.uio .no...[color=blue]
                            > Kevin Knorpp:
                            >[color=green]
                            > > Good question. The binary file is created by a SW program that runs on[/color][/color]
                            an[color=blue][color=green]
                            > > ergometer that is used to train competitive cyclists. The company who
                            > > makes the SW also makes another SW that will create a .csv file from the
                            > > binary
                            > > file. The problem is that it is inconvenient for users to have to[/color][/color]
                            launch[color=blue][color=green]
                            > > a
                            > > second program to export the data. The company that makes the SW is not
                            > > willing to supply the code, but is OK with anyone who can figure it out
                            > > for
                            > > themselves. Please help.[/color]
                            >
                            > Do they regard the encoding as some sort of industrial secret? In that[/color]
                            case[color=blue]
                            > they are just stupid. In either case their behavior sounds rather strange
                            > to me :P
                            >
                            > Anyway, have a look at pack()/unpack(). You will just have to try to guess
                            > wildly at what the file contains so it's gonna be a painful job.
                            >
                            > André Næss
                            >[/color]


                            Comment

                            • CountScubula

                              #15
                              Re: Decoding/reading data from a binary file into (an) array(s)

                              "Kevin Knorpp" <kevinknorpp@in sightbb.com> wrote in message
                              news:q0BWb.9999 $yE5.45075@attb i_s54...[color=blue]
                              > I think I can figure out how to deal with the binary file, but I[/color]
                              definitely[color=blue]
                              > need help to reverse engineer the file format.
                              >
                              > <<< Big-Huge-O-Snip >>>[/color]

                              I do not know your skill level, but always start with known data and files.

                              Take a couple files of known data with little changes (from what ever
                              program or devices creates them) and compare the binary files, look for
                              differences, and how they equate to the original data.

                              Or, what I like to do, is just call tech support, weasel around, and pay off
                              the guy who wrote the file format.

                              --
                              Mike Bradley
                              http://www.gzentools.com -- free online php tools


                              Comment

                              Working...