binaryfiles

Git checking out problem [fatal: early EOFs]

狂风中的少年 提交于 2019-11-26 14:47:51
问题 I'm running a Ubuntu (9.10) server with Git (latest from Ubuntu package manager) installed. Access to the Git is via SSH. On windows machines, I'm using Cygwin to push/pull code. I can push my project code onto the server but when I do a clone or pull, it returns a [fatal: early EOFs] error at about 75-80%. Upon further investigation, it seems like textual data has no issue when pulled/cloned but when the jar files and images are pulled from Git, the error will occur. Any suggestion/advice

C write in the middle of a binary file without overwriting any existing content

给你一囗甜甜゛ 提交于 2019-11-26 14:45:13
Today's problem is that I need to write an array of numbers in a binary file at a starting position. I have the position where it should start, and I don't want to overwrite values after that, just want to insert the array at the starting position in the file. E.g: 12345 Let's push 456 at position 2: 12456345 I know that probably I'll have to implement it by myself, but I want to know what's your opinion on how to implement that as efficiently as possible. Jonathan Leffler Here's a function extend_file_and_insert() that does the job, more or less. #include <sys/stat.h> #include <unistd.h> enum

Serializing a class which contains a std::string

久未见 提交于 2019-11-26 14:42:20
I'm not a c++ expert but I've serialized things a couple of times in the past. Unfortunately this time I'm trying to serialize a class which contains a std::string, which I understand is pretty much like serializing a pointer. I can write out the class to a file and read it back in again. All int fields are fine but the std::string field gives an "address out of bounds" error, presumably because it points to data which is no longer there. Is there a standard workaround for this? I don't want to go back to char arrays but at least I know they work in this situation. I can provide code if

Add binary distribution to github&#39;s download link

懵懂的女人 提交于 2019-11-26 14:28:42
问题 Github has this download link on the repositories. How can I add binary distributions to this list? I cannot find any info on help.github, so a link to some documentation would be helpful. 回答1: On Dec 11, 2012 "Upload Releases" functionality aka "Downloads" was deprecated. https://github.com/blog/1302-goodbye-uploads Update : On July 2, 2013 GitHub team announced a new "Releases" feature as a replacement for "Downloads" https://github.com/blog/1547-release-your-software 回答2: There is a new

Why is the binary output not equal when compiling again?

允我心安 提交于 2019-11-26 14:14:36
问题 I'm using a build script to compile several C# projects. The binary output is copied to a result folder, overwriting the previous version of the files, and then added/committed to subversion. I noticed that the binary output of the compilation are different even when there was no change to the source or environment at all. How is this possible? Isn't the binary result supposed to be exactly equal for the same input? I'm not intentionally using any kind of special timestamps anywhere, but does

Searching for a sequence of Bytes in a Binary File with Java

ぐ巨炮叔叔 提交于 2019-11-26 13:05:27
问题 I have a sequence of bytes that I have to search for in a set of Binary files using Java. Example: I\'m searching for the byte sequence DEADBEEF (in hex) in a Binary file. How would I go about doing this in Java? Is there a built-in method, like String.contains() for Binary files? 回答1: No, there is no built-in method to do that. But, directly copied from HERE (with two fixes applied to the original code): /** * Knuth-Morris-Pratt Algorithm for Pattern Matching */ class KMPMatch { /** * Finds

How to read / write a struct in Binary Files?

亡梦爱人 提交于 2019-11-26 12:59:47
问题 I am facing a small problem. I have a struct, which has a vector. Note that the vector is dynamic per every iteration. Now, in a particular iteration, how do I store the struct which contains a vector of size n to a binary file? Also, when retrieving, assume that I know how the size of the vector, how to I retrieve from the binary file, the struct variable containing the vector of all the stored elements? I am able to store something to the binary file (as I can see the size increasing when

Getting binary content in Node.js using request

吃可爱长大的小学妹 提交于 2019-11-26 11:40:30
I was trying to GET a binary data using request , and had something like: var requestSettings = { method: 'GET', url: url, }; request(requestSettings, function(error, response, body) { // Use body as a binary Buffer } But body was always a few bytes different from expected. After further investigation I found out that request assumed body is string and replaced all non-unicode bytes. I tried to add encoding: 'binary' to requestSettings but it didn't help. How can I get the binary data? OK, after a lot of digging, I found out that requestSettings should have: encoding: null And then body will

Tell git not to merge binary files but to choose

霸气de小男生 提交于 2019-11-26 11:07:57
问题 When the binary files, swfs, jars and flvs are changed locally, and I try to pull in changes, git tries to merge them and reports conflict. And then, I branch to a temporary branch, and commit the local changed binary files, and merge them back after the pull with recursive theirs strategy. -- Too much work. Is there a way to tell git, not to attempt merging binary files and ask me which one of these versions to use. 回答1: You could set up a merge drive in a .gitattributes file (only for a

Unsuccessful fread() of int stored in binary file, segmentation fault [closed]

核能气质少年 提交于 2019-11-26 10:52:39
There seem to be of the order of 10 questions and (mostly) successful answers solving segmentation faults cause by misused fread()'s in C. That being said, I am having such a problem but have not found a solution. I have a binary file containing an int (call it nbins ) and an array of float s (of size nbins ). When I try to read this file, it successfully opens and points to the file handle, but then gives a segmentation fault error when reading the nbins int . Here is a minimal example: #include <stdio.h> #include <stdlib.h> #include <string.h> #define BPATH "/path/to/file" int main(int agrc,