473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

DAT file compilation

Jay
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?

Sep 29 '06 #1
12 2051
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
Sep 29 '06 #2
Jay
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
Sep 29 '06 #3
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/
Sep 30 '06 #4
Jay
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/
Sep 30 '06 #5
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

Sep 30 '06 #6
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?
Sep 30 '06 #7
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

http://www.jamesstroud.com/
Sep 30 '06 #8
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

Sep 30 '06 #9
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" <ja*******@gmail.comwrote in message news:11**********************@m73g2000cwd.googlegr oups.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 =---
Sep 30 '06 #10
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

Sep 30 '06 #11

"Steve Holden" <st***@holdenweb.comwrote in message news:ma***************************************@pyt hon.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 =---
Sep 30 '06 #12
Jay <ja*******@gmail.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 <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Oct 2 '06 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Luc Saffre | last post by:
Hello, I had a strange problem when freezing (using either py2exe or McMillan installer) a script that imports reportlab (which imports PIL (which imports FixTk))). - Python 2.3.3c (also with...
0
by: Bill Burwell | last post by:
I am converting a VB6 WebClass application to VB.Net. Used the VB upgrade tool to do the conversion - and it left me a lot of little code things to do. Did those code things and got my app to...
11
by: Michael Gaab | last post by:
Compilation in c generally has four phases 1. Preprocessing 2. Compilation 3. Assembly 4. Linking. If I use a flag that will not link the code, order of compilation is not an issue,...
7
by: Steve Bugden | last post by:
Hi, I am trying to reference an html page from an aspx file. The intention is that the html file will contain the content for my web site and the aspx will contain the navigation, logo etc. Then...
10
by: bienwell | last post by:
Hi, I have a question about file included in ASP.NET. I have a file that includes all the Sub functions (e.g FileFunct.vb). One of the functions in this file is : Sub TestFunct(ByVal...
5
by: Mikael S. H. | last post by:
Header file compilation I'm coding a small irc bot, and I've noticed that compilation takes very long when I add certain header files (compared to compilation time without). I've tried to find...
2
by: antonyliu2002 | last post by:
I am testing AJAX. I've downloaded the AJAX Extension and the CTP December package and installed on BOTH my development machine and the production server. Then I created a very very simple web...
6
by: silverburgh.meryl | last post by:
Hi, In one A.cpp file, I have defined a static array of JSFunctionSpec, like this: static JSFunctionSpec JProfFunctions = { {"JProfStartProfiling", JProfStartProfiling, 0, 0, 0 },...
8
by: =?Utf-8?B?RGF2aWQgVGhpZWxlbg==?= | last post by:
Hi; I copied a new set of files over to my ASP.NET dir (and subdirs) on our test server. This replaced every file for the app. When I first then tried to bring it up, I got the below error. ...
0
by: Steve | last post by:
Hello- Your assistance with this issue is greatly appreciated. Environment: - Load-balanced IIS 6.0 servers (Win2003) - web servers point (via UNC path) to a Microsoft File Cluster on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.