Loading ...
Sorry, an error occurred while loading the content.

Re: [SpectrumLabUsers] Re: applying ( Spectrum Lab web server Fftlog1.txt data processing php JS

Expand Messages
  • wolf_dl4yhf
    Greetings all, Javascript / JSON experts out there ? How would you format the data for a *complex* FFT, i.e. two components per frequency bin, in a JSON
    Message 1 of 15 , Apr 30, 2013
    • 0 Attachment
      Greetings all,

      Javascript / JSON experts out there ?

      How would you format the data for a *complex* FFT, i.e. two components
      per frequency bin, in a JSON response with the minimum possible
      overhead, when its impossible to have different data type *definitions*
      and the data itself ? (this is one of the things I always missed in
      Javascript... I first want to *declare* a data type (struct in "C" or
      record in Pascal) before using it, but in j.s. / JSON they embed the
      names of the struct (or array) members in the response with the data
      themselves.
      Which is very very unfortunate if you have an array of say 524288
      complex frequency bins, and have to put the NAMES of each component in
      each frequency bin because you cannot declare data types in advance ?
      For example, in "C" (not C++) one would first declare a complex number
      as a struct like this

      typedef struct
      { float re;
      float im;
      } T_Complex;

      and then use it in an array of complex numbers like this:

      T_Complex fft[524288] = { {0.1, 0.2}, {0.1, 0.3}, {0.1, 0.4}, ..... };

      ( the receiver of such a line would of course need to know what
      T_Complex is; since it's unnecessary to pass that in the server response)

      How to form such two-dimensional arrays in JSON, without having to put
      the name of each component in each array element (which would be an
      awful waste of memory / network bandwidth) ?

      Or drop JSON (to read FFTs from SL via its HTTP server) and use a simple
      but flexible, self-defined format instead, which can be parsed in any
      programming language ?

      All the best,
      Wolf .
    • Mark McCarron
      Wolf, You can use an JSON Array. http://www.w3resource.com/JSON/structures.php The format is [Value1, Value2, Value3...etc], or in your case [I,Q,I,Q...etc].
      Message 2 of 15 , May 1, 2013
      • 0 Attachment
        Wolf,

        You can use an JSON Array.

        http://www.w3resource.com/JSON/structures.php

        The format is [Value1, Value2, Value3...etc], or in your case [I,Q,I,Q...etc].  No need for key/value pairs.

        It is also possible to read it as a stream:

        http://stackoverflow.com/questions/444380/is-there-a-streaming-api-for-json

        Regards,

        Mark McCarron


        To: SpectrumLabUsers@yahoogroups.com
        From: dl4yhf@...
        Date: Wed, 1 May 2013 08:52:09 +0200
        Subject: Re: [SpectrumLabUsers] Re: applying ( Spectrum Lab web server Fftlog1.txt data processing php JS

         
        Greetings all,

        Javascript / JSON experts out there ?

        How would you format the data for a *complex* FFT, i.e. two components
        per frequency bin, in a JSON response with the minimum possible
        overhead, when its impossible to have different data type *definitions*
        and the data itself ? (this is one of the things I always missed in
        Javascript... I first want to *declare* a data type (struct in "C" or
        record in Pascal) before using it, but in j.s. / JSON they embed the
        names of the struct (or array) members in the response with the data
        themselves.
        Which is very very unfortunate if you have an array of say 524288
        complex frequency bins, and have to put the NAMES of each component in
        each frequency bin because you cannot declare data types in advance ?
        For example, in "C" (not C++) one would first declare a complex number
        as a struct like this

        typedef struct
        { float re;
        float im;
        } T_Complex;

        and then use it in an array of complex numbers like this:

        T_Complex fft[524288] = { {0.1, 0.2}, {0.1, 0.3}, {0.1, 0.4}, ..... };

        ( the receiver of such a line would of course need to know what
        T_Complex is; since it's unnecessary to pass that in the server response)

        How to form such two-dimensional arrays in JSON, without having to put
        the name of each component in each array element (which would be an
        awful waste of memory / network bandwidth) ?

        Or drop JSON (to read FFTs from SL via its HTTP server) and use a simple
        but flexible, self-defined format instead, which can be parsed in any
        programming language ?

        All the best,
        Wolf .


      • dariusjack2006
        Wolf, Mark, a nice graphical interface to JSON structures http://www.json.org/ To implement interactivity, syntax and JSON structures should be generated
        Message 3 of 15 , May 2, 2013
        • 0 Attachment
          Wolf, Mark,

          a nice graphical interface to JSON structures

          http://www.json.org/

          To implement interactivity, syntax and JSON structures should be generated on-the-fly by http request.

          Header comes first for parsing of data structures in JSON stream.
          Support for time-stamp could let us build network of meteor watching
          stations and have central station processing live data streams on-the-fly, generating graphics.

          Fftlog1.txt is made of header line + data, header line + data loop.
          Updated time stamp can come with header.



          --- In SpectrumLabUsers@yahoogroups.com, Mark McCarron <mark.mccarron@...> wrote:
          >
          > Wolf,
          >
          > You can use an JSON Array.
          >
          > http://www.w3resource.com/JSON/structures.php
          >
          > The format is [Value1, Value2, Value3...etc], or in your case [I,Q,I,Q...etc]. No need for key/value pairs.
          >
          > It is also possible to read it as a stream:
          >
          > http://stackoverflow.com/questions/444380/is-there-a-streaming-api-for-json
          >
          > Regards,
          >
          > Mark McCarron
          >
          > To: SpectrumLabUsers@yahoogroups.com
          > From: dl4yhf@...
          > Date: Wed, 1 May 2013 08:52:09 +0200
          > Subject: Re: [SpectrumLabUsers] Re: applying ( Spectrum Lab web server Fftlog1.txt data processing php JS
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          >
          > Greetings all,
          >
          >
          >
          > Javascript / JSON experts out there ?
          >
          >
          >
          > How would you format the data for a *complex* FFT, i.e. two components
          >
          > per frequency bin, in a JSON response with the minimum possible
          >
          > overhead, when its impossible to have different data type *definitions*
          >
          > and the data itself ? (this is one of the things I always missed in
          >
          > Javascript... I first want to *declare* a data type (struct in "C" or
          >
          > record in Pascal) before using it, but in j.s. / JSON they embed the
          >
          > names of the struct (or array) members in the response with the data
          >
          > themselves.
          >
          > Which is very very unfortunate if you have an array of say 524288
          >
          > complex frequency bins, and have to put the NAMES of each component in
          >
          > each frequency bin because you cannot declare data types in advance ?
          >
          > For example, in "C" (not C++) one would first declare a complex number
          >
          > as a struct like this
          >
          >
          >
          > typedef struct
          >
          > { float re;
          >
          > float im;
          >
          > } T_Complex;
          >
          >
          >
          > and then use it in an array of complex numbers like this:
          >
          >
          >
          > T_Complex fft[524288] = { {0.1, 0.2}, {0.1, 0.3}, {0.1, 0.4}, ..... };
          >
          >
          >
          > ( the receiver of such a line would of course need to know what
          >
          > T_Complex is; since it's unnecessary to pass that in the server response)
          >
          >
          >
          > How to form such two-dimensional arrays in JSON, without having to put
          >
          > the name of each component in each array element (which would be an
          >
          > awful waste of memory / network bandwidth) ?
          >
          >
          >
          > Or drop JSON (to read FFTs from SL via its HTTP server) and use a simple
          >
          > but flexible, self-defined format instead, which can be parsed in any
          >
          > programming language ?
          >
          >
          >
          > All the best,
          >
          > Wolf .
          >
        • dariusjack2006
          Thanks Mike, I run SL under XP Windows, no Perl installed. SL exactly comes with built in http server. Ok, I can install Perl for Windows.
          Message 4 of 15 , May 4, 2013
          • 0 Attachment
            Thanks Mike,

            I run SL under XP Windows, no Perl installed.
            SL exactly comes with built in http server.

            Ok, I can install Perl for Windows.
            http://www.perl.org/get.html

            Windows does not have Perl installed by default.

            "
            Binaries

            Download ActivePerl
            ActiveState Perlexternal link has binary distributions of Perl for Win32 (and Perl for Win64).

            Download Strawberry Perl
            Strawberry Perlexternal link: A 100% Open Source Perl for Windows that is exactly the same as Perl everywhere else; this includes using modules from CPAN, without the need for binary packages. Help is available from other Windows Perl developers on the #win32 irc channel on irc.perl.org (see websiteexternal link for access through a browser).

            Download DWIM Perl
            DWIM Perl for Windowsexternal link: A 100% Open Source Perl for Windows, based on Strawberry Perl. It aims to include as many useful CPAN modules as possible. It even comes with Padre, the Perl IDEexternal link.
            "
            To have perl run server-side , http server should be configured.
            What is a configuration file and how to configure it to read and run perl script ?

            Could you attach your configuration tips and working web page, run on the same computer?
            My web browser is Firefox 20.0.

            darius


            SL supports web audio streams in/out
            http://www.qsl.net/dl4yhf/speclab/webstreams.htm

            --- In SpectrumLabUsers@yahoogroups.com, "vbifyz" <3ym3ym@...> wrote:
            >
            > No, my Perl script runs standalone and issues HTTP GET commands directly to SL (which acts as an HTTP server, again without any other software involved). No browser is involved at all. The goal was to avoid any unnecessary overhead.
            > I don't know of a way to make Perl code to run inside a browser, if this is what you are asking.
            >
            > 73, Mike
            >
            > --- In SpectrumLabUsers@yahoogroups.com, "dariusjack2006" <dariusjack2006@> wrote:
            > >
            > > Mike,
            > >
            > > do you mean running perl script in the browser and no need for cgi, Apache web server or Firefox perl plugin?
            > >
            > > I run Firefox 20.0 + WindowsXP
            > > what is your suggested configuration
            > >
            > > Can you put your perl code into html page to work client side, accessing SL built-in web server?
            > >
            > > darius
            >
          • dariusjack2006
            Hi Mark, Hi Wolf, Is this thread closed, no chance to build on-line network of Spectrum lab based stations ? darius
            Message 5 of 15 , May 16, 2013
            • 0 Attachment
              Hi Mark,
              Hi Wolf,

              Is this thread closed, no chance to build on-line network of Spectrum lab based stations ?

              darius

              --- In SpectrumLabUsers@yahoogroups.com, "dariusjack2006" <dariusjack2006@...> wrote:
              >
              > Thanks Mike,
              >
              > I run SL under XP Windows, no Perl installed.
              > SL exactly comes with built in http server.
              >
              > Ok, I can install Perl for Windows.
              > http://www.perl.org/get.html
              >
              > Windows does not have Perl installed by default.
              >
              > "
              > Binaries
              >
              > Download ActivePerl
              > ActiveState Perlexternal link has binary distributions of Perl for Win32 (and Perl for Win64).
              >
              > Download Strawberry Perl
              > Strawberry Perlexternal link: A 100% Open Source Perl for Windows that is exactly the same as Perl everywhere else; this includes using modules from CPAN, without the need for binary packages. Help is available from other Windows Perl developers on the #win32 irc channel on irc.perl.org (see websiteexternal link for access through a browser).
              >
              > Download DWIM Perl
              > DWIM Perl for Windowsexternal link: A 100% Open Source Perl for Windows, based on Strawberry Perl. It aims to include as many useful CPAN modules as possible. It even comes with Padre, the Perl IDEexternal link.
              > "
              > To have perl run server-side , http server should be configured.
              > What is a configuration file and how to configure it to read and run perl script ?
              >
              > Could you attach your configuration tips and working web page, run on the same computer?
              > My web browser is Firefox 20.0.
              >
              > darius
              >
              >
              > SL supports web audio streams in/out
              > http://www.qsl.net/dl4yhf/speclab/webstreams.htm
              >
              > --- In SpectrumLabUsers@yahoogroups.com, "vbifyz" <3ym3ym@> wrote:
              > >
              > > No, my Perl script runs standalone and issues HTTP GET commands directly to SL (which acts as an HTTP server, again without any other software involved). No browser is involved at all. The goal was to avoid any unnecessary overhead.
              > > I don't know of a way to make Perl code to run inside a browser, if this is what you are asking.
              > >
              > > 73, Mike
              > >
              > > --- In SpectrumLabUsers@yahoogroups.com, "dariusjack2006" <dariusjack2006@> wrote:
              > > >
              > > > Mike,
              > > >
              > > > do you mean running perl script in the browser and no need for cgi, Apache web server or Firefox perl plugin?
              > > >
              > > > I run Firefox 20.0 + WindowsXP
              > > > what is your suggested configuration
              > > >
              > > > Can you put your perl code into html page to work client side, accessing SL built-in web server?
              > > >
              > > > darius
              > >
              >
            • wolf_dl4yhf
              Reading FFT data via web browser is still in the pipe. But there are too many other things to do at the moment, with a higher priority. Cannot comment on Perl
              Message 6 of 15 , May 16, 2013
              • 0 Attachment
                Reading FFT data via web browser is still in the pipe.
                But there are too many other things to do at the moment, with a higher priority.
                Cannot comment on Perl since I have absolutely no experience with it.

                Cheers,
                  Wolf .

                Am 16.05.2013 14:28, schrieb dariusjack2006:
                 

                Hi Mark,
                Hi Wolf,

                Is this thread closed, no chance to build on-line network of Spectrum lab based stations ?

                darius

                --- In SpectrumLabUsers@yahoogroups.com, "dariusjack2006" <dariusjack2006@...> wrote:
                >
                > Thanks Mike,
                >
                > I run SL under XP Windows, no Perl installed.
                > SL exactly comes with built in http server.
                >
                > Ok, I can install Perl for Windows.
                > http://www.perl.org/get.html
                >
                > Windows does not have Perl installed by default.
                >
                > "
                > Binaries
                >
                > Download ActivePerl
                > ActiveState Perlexternal link has binary distributions of Perl for Win32 (and Perl for Win64).
                >
                > Download Strawberry Perl
                > Strawberry Perlexternal link: A 100% Open Source Perl for Windows that is exactly the same as Perl everywhere else; this includes using modules from CPAN, without the need for binary packages. Help is available from other Windows Perl developers on the #win32 irc channel on irc.perl.org (see websiteexternal link for access through a browser).
                >
                > Download DWIM Perl
                > DWIM Perl for Windowsexternal link: A 100% Open Source Perl for Windows, based on Strawberry Perl. It aims to include as many useful CPAN modules as possible. It even comes with Padre, the Perl IDEexternal link.
                > "
                > To have perl run server-side , http server should be configured.
                > What is a configuration file and how to configure it to read and run perl script ?
                >
                > Could you attach your configuration tips and working web page, run on the same computer?
                > My web browser is Firefox 20.0.
                >
                > darius
                >
                >
                > SL supports web audio streams in/out
                > http://www.qsl.net/dl4yhf/speclab/webstreams.htm
                >
                > --- In SpectrumLabUsers@yahoogroups.com, "vbifyz" <3ym3ym@> wrote:
                > >
                > > No, my Perl script runs standalone and issues HTTP GET commands directly to SL (which acts as an HTTP server, again without any other software involved). No browser is involved at all. The goal was to avoid any unnecessary overhead.
                > > I don't know of a way to make Perl code to run inside a browser, if this is what you are asking.
                > >
                > > 73, Mike
                > >
                > > --- In SpectrumLabUsers@yahoogroups.com, "dariusjack2006" <dariusjack2006@> wrote:
                > > >
                > > > Mike,
                > > >
                > > > do you mean running perl script in the browser and no need for cgi, Apache web server or Firefox perl plugin?
                > > >
                > > > I run Firefox 20.0 + WindowsXP
                > > > what is your suggested configuration
                > > >
                > > > Can you put your perl code into html page to work client side, accessing SL built-in web server?
                > > >
                > > > darius
                > >
                >


              Your message has been successfully submitted and would be delivered to recipients shortly.