binaryfiles

what is wrong with this binary file transfer (corrupting docx files)?

女生的网名这么多〃 提交于 2019-12-02 00:34:08
I've been trying to resolve this issue for over a week and could really do with some help. We are using a httprequest to post files to an api. Most files come out ok, but docx files end up corrupted. After much research I'm pretty sure that I'm doing something wrong in the binary post that is adding extra data / bytes to the file. Streams are being closed and I think I've got the boundries and headers right.... Are there any obvious mistakes in the code below? Or would anybody be able to point me in the right direction for a fix. Why is extra data being added to this file? Are http headers the

Many binary files synchronization

ぃ、小莉子 提交于 2019-12-02 00:16:39
问题 I have about 100 000 files on office server (images, pdf's, etc...) Each day files count grows about 100-500 items, and about 20-50 old files changes. What is the best way to synchronize Web-server with these files? Can any system like Mercurial, GIT help? (On office server, I'll commit changes, and web-server periodically do updates)? Second problem is, that on Web-server I have user-generated-content (binary-files) (other files). Each day this users upload about 1000-2000 new files. Old

Youtube-API: Upload binary captions file (ebu-stl)

耗尽温柔 提交于 2019-12-01 23:34:00
Youtube supports some binary caption file formats, such as ebu-stl. I've got an *.stl file that uploads and processes just fine when I upload it via the web interface. But when I try to upload it via the API v2 with a POST request, it does not seem to recognize the file format properly. The POST request looks like this : POST /feeds/api/videos/VIDEO_ID/captions HTTP/1.1 Host: gdata.youtube.com Content-Type: application/vnd.youtube.timedtext; charset=UTF-8 Content-Language: en Slug: Title of caption track Authorization: Bearer ACCESS_TOKEN GData-Version: 2 X-GData-Key: key=DEVELOPER_KEY

Fortran unformatted output with each MPI process writing part of an array

萝らか妹 提交于 2019-12-01 22:46:24
问题 In my parallel program, there was a big matrix. Each process computed and stored a part of it. Then the program wrote the matrix to a file by letting each process wrote its own part of the matrix in the correct order. The output file is in "unformatted" form. But when I tried to read the file in a serial code (I have the correct size of the big matrix allocated), I got an error which I don't understand. My question is: in an MPI program, how do you get a binary file as the serial version

Embedding binary data in a script efficiently

*爱你&永不变心* 提交于 2019-12-01 22:22:44
I have seen some installation files (huge ones, install.sh for Matlab or Mathematica, for example) for Unix-like systems, they must have embedded quite a lot of binary data, such as icons, sound, graphics, etc, into the script. I am wondering how that can be done, since this can be potentially useful in simplifying file structure. I am particularly interested in doing this with Python and/or Bash. Existing methods that I know of in Python: Just use a byte string: x = b'\x23\xa3\xef' ... , terribly inefficient, takes half a MB for a 100KB wav file. base64, better than option 1, enlarge the size

Many binary files synchronization

陌路散爱 提交于 2019-12-01 20:55:24
I have about 100 000 files on office server (images, pdf's, etc...) Each day files count grows about 100-500 items, and about 20-50 old files changes. What is the best way to synchronize Web-server with these files? Can any system like Mercurial, GIT help? (On office server, I'll commit changes, and web-server periodically do updates)? Second problem is, that on Web-server I have user-generated-content (binary-files) (other files). Each day this users upload about 1000-2000 new files. Old files don't change. And I need to backup these files to local machine. Can any system like Merurial, GIT

file reading: feof() for binary files

旧巷老猫 提交于 2019-12-01 20:48:13
I am reading a binary file. and when it reaches the end. it seems it is terminated by feof() function. is it because there is no EOF character for binary files? if so how can i solve it. currently my code is using a while loop while (!feof(f)) when it reaches the end of file at position 5526900. it doesn't stop. it just keeps trying to read, and i am stuck at the loop. can anyone tell me why and how to solve it. Thanks You should not use feof() to loop on - instead, use the return value of fread() - loop until it returns zero. This is easy to see if you consider reading an empty file - feof()

Fortran unformatted output with each MPI process writing part of an array

99封情书 提交于 2019-12-01 20:08:32
In my parallel program, there was a big matrix. Each process computed and stored a part of it. Then the program wrote the matrix to a file by letting each process wrote its own part of the matrix in the correct order. The output file is in "unformatted" form. But when I tried to read the file in a serial code (I have the correct size of the big matrix allocated), I got an error which I don't understand. My question is: in an MPI program, how do you get a binary file as the serial version output for a big matrix which is stored by different processes? Here is my attempt: if(ThisProcs ==

Reading/Writing Binary files

给你一囗甜甜゛ 提交于 2019-12-01 17:09:02
I'm just trying to read/write from a binary file. I've been following this tutorial, and it works... except it seems to be writing things to a txt file. I named the file test.bin when testing it, but notepad can open it and display it properly, so I don't think it's actually a binary file. I've told it that it's a binary file with "wb" and "rb" right? if arg[1] == "write" then local output = assert(io.open(arg[2], "wb")) output:write(arg[3]) --3rd argument is written to the file. assert(output:close()) elseif arg[1] == "read" then local input = assert(io.open(arg[2], "rb")) print(input:read(1)

Java loading binary files

只愿长相守 提交于 2019-12-01 14:46:40
Please show me the best/fast methods for: 1) Loading very small binary files into memory. For example icons; 2) Loading/reading very big binary files of size 512Mb+. Maybe i must use memory-mapped IO? 3) Your common choice when you do not want to think about size/speed but must do only thing: read all bytes into memory? Thank you!!! P.S. Sorry for maybe trivial question. Please do not close it;) P.S.2. Mirror of analog question for C#; For memory mapped files, java has a nio package: Memory Mapped Files Check out byte stream class for small files: Byte Stream Check out buffered I/O for larger