Ankündigung

Einklappen
Keine Ankündigung bisher.

HS logic: basic question about file management

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

    HS logic: basic question about file management

    Hi,

    I've a basic question about file management.
    What would be the HS equivalent of the classic loop:
    while not EOF
    read line
    do something
    end while
    I understand, if the data is < 10K, no problem, it fits at once in a single 14Byte var, and from then on, one can work on it with memory var.
    But if I want to work on the HS Login List (32K text, 98K html), how can I exploit the file?
    If there are 500 lines in the file, I'm going to write 500 modules ? No I guess

    As an aside: is it possible to call an "external" application ? and eventually re-import the data into the HS ?

    Thank you in advance for your patience with a newbie
    Raymond



    PS: sorry if the topic has alreaddy been discussed, but can't find it in the old forum (not sure about the keywords for search)

    #2
    Zitat von Warichet Beitrag anzeigen
    I understand, if the data is < 10K, no problem, it fits at once in a single 14Byte var, and from then on, one can work on it with memory var.
    But if I want to work on the HS Login List (32K text, 98K html), how can
    This is not true! The webpage query reads up to 500.000 bytes = ~ 488 kBytes!
    Only 14-byte Textobjects can hold 10k only. This means that you are able to query a webpage with 98 k HTML but if you try to put more than 10k into a single 14-byte Textobject you will loose some data.
    Gruss aus Radevormwald
    Michel

    Kommentar


      #3
      Zitat von Michel Beitrag anzeigen
      This is not true! The webpage query reads up to 500.000 bytes = ~ 488 kBytes!
      Thank you for putting me right

      Kommentar


        #4
        Zitat von Warichet Beitrag anzeigen
        What would be the HS equivalent of the classic loop:
        while not EOF
        read line
        do something
        end while
        I see no answer here, so I conclude it is not possible
        It is said that the HS logic is Python. OK, but Python does support file management
        Zitat von Warichet Beitrag anzeigen
        is it possible to call an "external" application ? and eventually re-import the data into the HS ?
        Any hint about this ?

        Greetings from Midi-Pyrénées
        Raymond

        Kommentar


          #5
          No, actually not possible via HS-Logic
          Gruß Matthias
          EIB übersetzt meine Frau mit "Ehepaar Ist Beschäftigt"
          - PN nur für PERSÖNLICHES!

          Kommentar


            #6
            The only way, and so I did with hs2wav and wetter2hs, is to send an IP telegram to your external application, make some calculations and deliver the result back the same way.
            Gruß Matthias
            EIB übersetzt meine Frau mit "Ehepaar Ist Beschäftigt"
            - PN nur für PERSÖNLICHES!

            Kommentar


              #7
              I dont want to fight another Windows against Linux war. But with misterhouse it would be possible, no doubt about.

              MH uses perl and you could (as an example) be able to read a file containing caller ids from one file

              Code:
              01234567 Peter
              987654321 Anne
              ...
              Read that with a view lines of perl
              Code:
              my %cid2name;
              open(<CID>,"/where/ever/the/file/is") die "could not open file!";
              while($line = <CID>) {
                ($id, $name) = split(/ /,$line);
                $cid2name[$id] = $name;
              }
              And than use this data with a line like that
              Code:
              print_log sprintf("%s is calling from %s", $cid2name[$cid], $cid);


              or react on the callername like



              Code:
              if ($cid2name[$cid] eq "Peter") {
                set $Garagedoor OPEN;
              }
              KR

              Kommentar


                #8
                Zitat von MatthiasS Beitrag anzeigen
                send an IP telegram to your external application, make some calculations and deliver the result back the same way.
                @Matthias
                Thank you, I'll give it a try, but, hum, it's not so trivial. I guess you talk about application to application programming, via ports ?

                @RaK
                I'm pretty convinced about Perl, but when all you have got is Python....
                "quand on n'a pas ce qu'on aime,
                faut aimer ce qu'on a"
                Loosely translated as:
                "when you don't have what you love,
                love what you have".
                Tell this to your wife tonight, and tell us the reaction

                Greetings from Midi-Pyrénées
                Raymond

                Kommentar


                  #9
                  Zitat von Warichet Beitrag anzeigen
                  I'm pretty convinced about Perl, but when all you have got is Python....
                  Don't confound Python with the HS function files (.hsl). Basically the HS only allows you to use python expressions to compute your figures. It does simply not allow you to use full python language. So you are limitted by the hsl syntax, not by Python.

                  Not to start a "religious" discussion, but python is more or less replacing perl nowadays, so don't believe that Python would be weaker then Perl

                  Cheers,
                  Gaston

                  Kommentar


                    #10
                    And don't believe, that todays limited access to python inside hs will be limited the same way forever!
                    Gruß Matthias
                    EIB übersetzt meine Frau mit "Ehepaar Ist Beschäftigt"
                    - PN nur für PERSÖNLICHES!

                    Kommentar


                      #11
                      Zitat von Gaston Beitrag anzeigen
                      Don't confound Python with the HS function files (.hsl). Basically the HS only allows you to use python expressions to compute your figures. It does simply not allow you to use full python language.
                      OK, that's something I recently discovered (the hard way). It's not obvious when you read about the HS and it's possibilities. Anyway, I'm convinced I made the right choice, just a bit frustrated by an annoying limitation.
                      Zitat von MatthiasS Beitrag anzeigen
                      And don't believe, that todays limited access to python inside hs will be limited the same way forever!
                      Oh gosh, if this could be true
                      I'm sure I'll will be flamed, knocked ans sacked (in that sequence, please ) for this, but...mmm. I found this Python logic a crummy way of programming. Of course, the big plus is the grahic part of the logic editor , but I would happily give it up in favour of a standard scripting language. I know, we are not really on "computers" but a standard scripting tool would benefit to everyone (except maybe to the fellows which have invested so much of their time in the currently available HS libraries)

                      Best regards
                      Raymond

                      Kommentar


                        #12
                        Raymond,

                        please be so kind (in this case), to wait for the release of the release after the soon coming up!
                        First, it will be a overwhelming one, and be sure, that the beta.testers are pushing hard to realize new features in addition to the coming ones!
                        Gruss aus Radevormwald
                        Michel

                        Kommentar


                          #13
                          Zitat von Michel Beitrag anzeigen
                          please be so kind to wait for the release
                          Patience is not in my best skill .... but ... OK ...
                          Zitat von Michel Beitrag anzeigen
                          it will be a overwhelming one



                          !!!

                          Kommentar


                            #14
                            Zitat von Michel Beitrag anzeigen
                            Heute, 04:01
                            Your clock goes berzek ? or are you posting at 04:01 ?

                            Kommentar


                              #15
                              Zitat von Warichet Beitrag anzeigen
                              Your clock goes berzek ? or are you posting at 04:01 ?
                              Always at your service!
                              Gruss aus Radevormwald
                              Michel

                              Kommentar

                              Lädt...
                              X