binary

How do you use Binary conversion in Python/Bash/AWK?

I am new in binary conversion. I use Python, Bash and AWK daily. I would like to see binary conversion's applications in these languages. For example, I am interested in problems which you solve by it at your work. Where do you use binary conversion in Python/Bash/AWK? I would like to see examples of codes. ...

Why no dynamic bit pattern in function argument?

I am experimenting with bit pattern matching in Erlang: -module(test). -export([test/2]). %test(P,<<X:P,0:1>>) -> % X. test(P,X) -> <<Y:P,0:1>> = X, Y. when compiling the commented out version of test/2 i get a complaint that "variable 'P' is unbound". Is there any good reason for not allowing the first version to work th...

How to extend the "less" command behavior?

In normal cases, I suppose everyone only uses the "less" command to read the content of plain text files. But on Gentoo, it seems that the less command line is a little more powerful than the one I use on other Linux distributions, or Cygwin, Mac OS X... the less command on Gentoo is able to list the content of compressed archive files,...

How to automatically detect and release DLLs that have really changed ?

Whenever we recompile an exe or a DLL, its binary image is different even if the source code is the same, due to various timestamps and checksums in the image. But, our quality system implies that each time a new DLL is published, related validation tests must be performed again (often manually, and it takes a significant amount of time...

Java: Why doesn't binary OR work as expected (see code below)?

I don't understand the output from the following code: public static void main(String[] args) { int i1, i2, i3, i4; byte b; i1 = 128; b = (byte) i1; i2 = (int) b; i3 = 0 | b; i4 = 1 << 7; System.out.format("i1: %d b: %d i2: %d i3: %d i4: %d\n", i1, b, i2, i3, i4); } Output: i1: 128 b: -128 ...

When casting a small integer type to a wider one, is it safe to rely on &ing with a mask to remove the sign?

I have code that stores values in the range 0..255 in a Java byte to save space in large data collections (10^9 records spread over a couple hundred arrays). Without additional measures on recovery, the larger values are interpreted as being negative (because the Java integer types use two's complement representation). I got this helpf...

Problem writing int to binary file in C

I need to write data to a binary file using C's I/O functions. The following code causes a runtime exception : #include "stdio.h" int main(int argc,char* argv[]) { FILE *fp = fopen("path_to_file.bin","wb"); if(fp == NULL) { printf("error creating file"); return -1; } int val = 4; fwrite((const void*)val,s...

Php exec and return binary

Hello, I am trying to run the following in php $test = svn cat .... Now the output of $test is basically a binary file returned by svn. How do I make this binary file available as a download. Am trying to put the following: $test = `svn cat ....` header("Content-Disposition: attachment; filename=" . urlencode($filename)); header("Con...

Linking Two Multi-Dimensional arrays using pointers

I need to basically merge a Binary Heap, and Linear Probing Hashtable to make a "compound" data structure, which has the functionality of a heap, with the sorting power of a hashtable. What I need to do is create 2 2 dimension arrays for each data structure (Binary Heap, and Hash) then link them to each other with pointers so that when ...

how can I decode the REG_BINARY value HKLM\Software\Microsoft\Ole\DefaultLaunchPermission to see which users have permission?

Hello, I am trying to find a way to decode the REG_BINARY value for "HKLM\Software\Microsoft\Ole\DefaultLaunchPermission" to see which users have permissions by default, and if possible, a method in which I can also append other users by their username. At work we make use of DCOM and for the most part we always give the same users pe...

serialize and deserialize SQL query

I'm having an embedded device which keeps a list of inner tables. I would like it to synchronize this table's state with some outside database for debugging purposes. That is whenever I add an element to a certain struct array I wish the device to issue an "INSERT INTO ..." command. However I'm sending the data over an RS232 serial cabl...

Should I use PostgreSql, MySql, Oracle or SqlServer for storing documents / binary files ?

Should I use PostgreSql, MySql, Oracle or SqlServer for storing documents / binary files ? Are there any performance benefits of using one or the other? Are there any advantages/disadvantages? Documents stored will be mainly excel files, image files, pdf's and images. ...

What does the oauth guide mean by "8 bit array"?

The beginners guide for oauth says the following: Binary data is not directly handled by the OAuth specification but is assumed to be stored in an 8bit array which is not UTF-8 encoded. I don't understand what is meant by this? How do you store binary in an 8bit array? The wikipedia article on bit array didn't help me. ...

Is two's complement notation of a positive number the same number?

Is two's complement notation of a positive number is same as its binary representation? ...

C#/.NET - Custom Binary File Formats - Where to Start?

I need to be able to store some data in a custom binary file format. I've never designed my own file format before. It needs to be a friendly format for traveling between the C#, Java and Ruby/Perl/Python worlds. To start with the file will consist of records. A GUID field and a JSON/YAML/XML packet field. I'm not sure what to use as de...

Code golf - hex to (raw) binary conversion

In response to this question asking about hex to (raw) binary conversion, a comment suggested that it could be solved in "5-10 lines of C, or any other language." I'm sure that for (some) scripting languages that could be achieved, and would like to see how. Can we prove that comment true, for C, too? NB: this doesn't mean hex to ASCI...

Efficient storage of binary files in a git repository

I would like to have a git repository that consists mainly of binary files. I need to keep track of the changed, added and removed files to the repository, but I don't want for git to version the content of the files themselves. In other words, I just need for git to keep track of changes (change log), but not the content. Is this ev...

Entropy encoding of a binary stream

I want to compress a binary stream. I know that after each '1' there is an higher probability of finding a '0', and after each '0' there is an higher probability of finding a '1'. How should I encode it? I was thinking about Rice codes, but I didn't get so far... Thanks in advance for any reply. ...

How do I build an xcode project for the itunes store??? Please help!!

Ok, I'm abit of a newbe...need some help... I've got my apps running on my iphone, great..however, to list on the itunes store I need the "universal binary" thing... I've tried finding answers, but I can't seem to find a concise useable explanation to doing this in xcode...I alwase get errors when I try to build a binary...So PLEASE, ca...

What breaks a .net binary (dll) interface

Consider two .net dlls. The first, "application.dll" contains the main business logic and data access code. The second, "webservice.dll" consists mostly of WebMethods that link to objects and methods with application.dll for the purpose of providing webservice calls to existing code. What changes (e.g. add new classes, add a new field o...