DAT file compilation

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

    #1

    DAT file compilation

    Is there a way through python that I can take a few graphics and/or
    sounds and combine them into a single .dat file? If so, how? And how
    can I access the data in the .dat file from inside the python script?

  • Diez B. Roggisch

    #2
    Re: DAT file compilation

    Jay schrieb:
    Is there a way through python that I can take a few graphics and/or
    sounds and combine them into a single .dat file? If so, how? And how
    can I access the data in the .dat file from inside the python script?
    Use a zip-file. See the zipfile-module.

    Diez

    Comment

    • Jay

      #3
      Re: DAT file compilation

      That's one solution, but I'd rather a file format the end-user can't
      easily mess around with.
      Diez B. Roggisch wrote:
      Jay schrieb:
      Is there a way through python that I can take a few graphics and/or
      sounds and combine them into a single .dat file? If so, how? And how
      can I access the data in the .dat file from inside the python script?
      >
      Use a zip-file. See the zipfile-module.
      >
      Diez

      Comment

      • James Stroud

        #4
        Re: DAT file compilation

        Jay wrote:
        That's one solution, but I'd rather a file format the end-user can't
        easily mess around with.
        Require the program to be installed as root and installation to be in a
        read-only directory--or serve the resources to your program from a cgi
        script somewhere, only to be downloaded when needed. This way, the user
        would at least have to reverse engineer your program to see where the
        resources were coming from so they could plug the appropriate query in
        their web browser.

        James


        --
        James Stroud
        UCLA-DOE Institute for Genomics and Proteomics
        Box 951570
        Los Angeles, CA 90095


        Comment

        • Jay

          #5
          Re: DAT file compilation

          That cgi idea is really cool, but I don't have any web space to host
          the files. Plus the bandwidth required would be deadly. I think I'll
          just have to stick to the zip file idea. The problem with the
          read-only is that this program is aimed at a Windows audience.

          James Stroud wrote:
          Jay wrote:
          That's one solution, but I'd rather a file format the end-user can't
          easily mess around with.
          >
          Require the program to be installed as root and installation to be in a
          read-only directory--or serve the resources to your program from a cgi
          script somewhere, only to be downloaded when needed. This way, the user
          would at least have to reverse engineer your program to see where the
          resources were coming from so they could plug the appropriate query in
          their web browser.
          >
          James
          >
          >
          --
          James Stroud
          UCLA-DOE Institute for Genomics and Proteomics
          Box 951570
          Los Angeles, CA 90095
          >
          http://www.jamesstroud.com/

          Comment

          • MonkeeSage

            #6
            Re: DAT file compilation

            Jay wrote:
            Is there a way through python that I can take a few graphics and/or
            sounds and combine them into a single .dat file? If so, how? And how
            can I access the data in the .dat file from inside the python script?
            How about in a sqlite database? Sqlite has built-in bindings in python
            2.5 and is available as a third-party extension in previous versions.
            It's also pretty easy to use, but makes you data harder to tamper with
            by an average windows user.

            http://docs.python.org/lib/module-sqlite3.html (See also the "See Also"
            section ;) ).

            Regards,
            Jordan

            Comment

            • Nick Vatamaniuc

              #7
              Re: DAT file compilation

              You can always use pickle. Have a script that reads your folder with
              the media, insert the images and sounds into arrays or your own special
              classes then use pickle to dump them to a .dat file. The user gets just
              one .dat file.

              When your program runs, it reads the object with the data from the
              disk, no need to translate from a special data format, instantiate
              objects, fill those objects with data and so on, because your "frozen"
              Python objects are good to be used as soon as they are loaded. Note:
              this might speed up things a little during initialization of your
              program.

              Also, you can use cPickle for a much faster pickle (but check out the
              constraints imposed by cPickle in the Python documentation).

              Hope this helps,
              -Nick Vatamaniuc



              Jay wrote:
              Is there a way through python that I can take a few graphics and/or
              sounds and combine them into a single .dat file? If so, how? And how
              can I access the data in the .dat file from inside the python script?

              Comment

              • James Stroud

                #8
                Re: DAT file compilation

                Jay wrote:
                That cgi idea is really cool, but I don't have any web space to host
                the files. Plus the bandwidth required would be deadly.
                I think you are overestimating the cost of bandwidth. By the time it
                becomes an issue, you've sold so many units of software, and people are
                using your program so much, that you'll probably be able to go ahead and
                buy your own hosting company. One python hosting company offers 50GB/mo
                bandwidth for $7.50/mo. Google "python hosting" and you'll find them.
                That's hella usage of a program.

                James


                --
                James Stroud
                UCLA-DOE Institute for Genomics and Proteomics
                Box 951570
                Los Angeles, CA 90095


                Comment

                • Steve Holden

                  #9
                  Re: DAT file compilation

                  Jay wrote:
                  That cgi idea is really cool, but I don't have any web space to host
                  the files. Plus the bandwidth required would be deadly. I think I'll
                  just have to stick to the zip file idea. The problem with the
                  read-only is that this program is aimed at a Windows audience.
                  So don't call it something.zip. Since most Windows users rely on the
                  registry to discern filetypes from extensions you will probably find in
                  practice that very few actually poke about with your ".dat" file that's
                  actually a zip.

                  regards
                  Steve
                  --
                  Steve Holden +44 150 684 7255 +1 800 494 3119
                  Holden Web LLC/Ltd http://www.holdenweb.com
                  Skype: holdenweb http://holdenweb.blogspot.com
                  Recent Ramblings http://del.icio.us/steve.holden

                  Comment

                  • Roger Upole

                    #10
                    Re: DAT file compilation

                    On Windows NTFS file systems, you can add data to a file using named streams.
                    The extra streams aren't visible from Explorer so the average end-user won't
                    even know they're there.

                    Roger


                    "Jay" <jaysherby@gmai l.comwrote in message news:1159576888 .862008.286980@ m73g2000cwd.goo glegroups.com.. .
                    That cgi idea is really cool, but I don't have any web space to host
                    the files. Plus the bandwidth required would be deadly. I think I'll
                    just have to stick to the zip file idea. The problem with the
                    read-only is that this program is aimed at a Windows audience.
                    >
                    James Stroud wrote:
                    >Jay wrote:
                    That's one solution, but I'd rather a file format the end-user can't
                    easily mess around with.
                    >>
                    >Require the program to be installed as root and installation to be in a
                    >read-only directory--or serve the resources to your program from a cgi
                    >script somewhere, only to be downloaded when needed. This way, the user
                    >would at least have to reverse engineer your program to see where the
                    >resources were coming from so they could plug the appropriate query in
                    >their web browser.
                    >>
                    >James
                    >>
                    >>
                    >--
                    >James Stroud
                    >UCLA-DOE Institute for Genomics and Proteomics
                    >Box 951570
                    >Los Angeles, CA 90095
                    >>
                    >http://www.jamesstroud.com/
                    >



                    ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
                    http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
                    ---= East/West-Coast Server Farms - Total Privacy via Encryption =---

                    Comment

                    • Steve Holden

                      #11
                      Re: DAT file compilation

                      Roger Upole wrote:
                      On Windows NTFS file systems, you can add data to a file using named streams.
                      The extra streams aren't visible from Explorer so the average end-user won't
                      even know they're there.
                      >
                      I hadn't realised how easy it is to access alternate data streams from
                      Python. A filename of the right form ("basefile.ext: alternatename")
                      works just fine, it appears.

                      Unfortunately you then have the problem of how to create it, since there
                      is no way to carry it around outside an NTFS filesystem, so some sort of
                      post-install script would be required.

                      There's also the issue that alternate data stream of any significant
                      size will be regarded with great suspicion by forensic examinations and
                      similar tests.

                      regards
                      Steve
                      --
                      Steve Holden +44 150 684 7255 +1 800 494 3119
                      Holden Web LLC/Ltd http://www.holdenweb.com
                      Skype: holdenweb http://holdenweb.blogspot.com
                      Recent Ramblings http://del.icio.us/steve.holden

                      Comment

                      • Roger Upole

                        #12
                        Re: DAT file compilation


                        "Steve Holden" <steve@holdenwe b.comwrote in message news:mailman.10 07.1159638448.1 0491.python-list@python.org ...
                        Roger Upole wrote:
                        >On Windows NTFS file systems, you can add data to a file using named streams.
                        >The extra streams aren't visible from Explorer so the average end-user won't
                        >even know they're there.
                        >>
                        I hadn't realised how easy it is to access alternate data streams from Python. A filename of the right form
                        ("basefile.ext: alternatename") works just fine, it appears.
                        >
                        Unfortunately you then have the problem of how to create it, since there is no way to carry it around outside an NTFS
                        filesystem, so some sort of post-install script would be required.
                        >
                        There's also the issue that alternate data stream of any significant size will be regarded with great suspicion by forensic
                        examinations and similar tests.
                        >
                        regards
                        Steve
                        --
                        Another drawback is that you have to be careful how you move the files
                        around. shutil.copyfile doesn't pick up alternate streams. Also, there's
                        no way from stock python to enumerate the streams. (but that could be a
                        plus for the OP)

                        Roger




                        ----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
                        http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
                        ---= East/West-Coast Server Farms - Total Privacy via Encryption =---

                        Comment

                        • Nick Craig-Wood

                          #13
                          Re: DAT file compilation

                          Jay <jaysherby@gmai l.comwrote:
                          Diez B. Roggisch wrote:
                          Jay schrieb:
                          Is there a way through python that I can take a few graphics and/or
                          sounds and combine them into a single .dat file? If so, how? And how
                          can I access the data in the .dat file from inside the python script?
                          Use a zip-file. See the zipfile-module.
                          >
                          That's one solution, but I'd rather a file format the end-user can't
                          easily mess around with.
                          Just don't give it a .zip extension. Works for java and .jar, and
                          openoffice and all of its many extensions.

                          If you are feeling really paranoid then encrypt it.

                          --
                          Nick Craig-Wood <nick@craig-wood.com-- http://www.craig-wood.com/nick

                          Comment

                          Working...