Questions tagged [binary]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
51 votes
3 answers
80k views

Why is 2^16 a "special" number? [closed]

OK, I feel stupid asking this - but in Jeff's article: Getting the Interview Phone Screen Right and originally stated in the 5 essential phone screen questions: They shouldn't stare blankly at you ...
javamonkey79's user avatar
43 votes
3 answers
97k views

What are binaries? [closed]

I see very often people using term binaries in different context. What are binaries? Collection on binary files, installation files, .dll files or what? Or is it just an general term for some ...
jrara's user avatar
  • 595
42 votes
12 answers
6k views

Is there an alternative to bits?

Is there an alternative to bits as the smallest unit of data? Something that won't be only 0 or 1, but actually hold many possible states in between? Wouldn't it be more natural to store floats like ...
Dokkat's user avatar
  • 567
36 votes
5 answers
23k views

Does storing plain text data take up less space than storing the equivalent message in binary?

As a web developer I have very little understanding of binary data. If I take the sentence "Hello world.", convert it to binary, and store it as binary in an SQL database, it seems like the 1s and ...
john doe's user avatar
  • 1,007
32 votes
3 answers
5k views

Why aren't "fat binaries" more widely used for cross-platform applications?

As far as I know, so-called "fat binaries"--executable files that contain machine code for multiple systems--are only really used on Apple PCs, and even there it seems like they only used them because ...
Ixrec's user avatar
  • 27.8k
28 votes
22 answers
24k views

Why learn hexadecimal? [closed]

I've taken quite a few intro programming classes in my day, mostly just to get my feet wet in every different kind of programming I find. Not surprisingly, just about every class runs through the ...
24 votes
3 answers
2k views

Optimize a git repo, containing large binary files

Our project is about 11GB, 10 of which are binary data (.png images). Consequently, a git diff or git status operations take up more than a minute. Fortunately all data files are separated into a ...
Vorac's user avatar
  • 7,129
22 votes
6 answers
30k views

Is machine language always binary? [duplicate]

I know absolutely nothing in low-level stuff, so this will be a very newbie question. Please excuse my ignorance. Is machine language - the series of numbers to that tell the physical computer ...
Aviv Cohn's user avatar
  • 21.4k
18 votes
4 answers
13k views

Why can't native machine code be easily decompiled?

With bytecode-based virtual machine languages like Java, VB.NET, C#, ActionScript 3.0, etc., you hear sometimes about how easy it is to just go download some decompiler off the Internet, run the ...
Panzercrisis's user avatar
  • 3,173
15 votes
3 answers
62k views

Is there something special about the number 65535?

2¹⁶-1 & 2⁵ = 2⁵ (or? obviously ?) A developer asked me today what is bitwise 65535 & 32 i.e. 2¹⁶-1 & 2⁵ = ? I thought at first spontaneously 32 but it seemed to easy whereupon I thought ...
Niklas Rosencrantz's user avatar
14 votes
3 answers
5k views

What are the complexities of a binary search?

I recently asked a question on CodeReview SE where using a binary search was recommended, and the author of the answer proved that it was faster than my implementation. During my research on the topic,...
Hazel へいぜる's user avatar
12 votes
3 answers
14k views

Compiling vs using pre-built binaries performance?

Will performance be better (quicker) if I manually compile the source for a software component for the actual machine that it will be used on, compared to if the source was compiled on another ...
Niklas Rosencrantz's user avatar
11 votes
5 answers
10k views

How do you debug a binary format?

I would like to be able to debug building a binary builder. Right now I am basically printing out the input data to the binary parser, and then going deep into the code and printing out the mapping of ...
Lance's user avatar
  • 2,605
9 votes
4 answers
446 views

File naming convention for images stored in version control?

My application has an icon file which is stored in version control. Now tomorrow I might decide to change the icon. I'm debating between two possible naming conventions for the icon file: Keep the ...
User's user avatar
  • 1,551
8 votes
4 answers
1k views

Is it allowed to embed an LGPL command-line tool?

I want to sell a closed-application that depends upon a certain command line tool. Am I allowed to distribute my software including this command line tool? For example, as a separate binary ...
Nick Russler's user avatar
8 votes
4 answers
3k views

What separates text files from binary files, considering they are stored in binary?

There are text files and there are image, video, and music files. Why are image, video, and music files considered binary files, and why are text files not?
Luis Javier's user avatar
7 votes
9 answers
3k views

Is it any good to use binary arithmetic in a C++ code like "C style"?

I like the fact that the C language lets you use binary arithmetic in an explicit way in your code, sometimes the use of the binary arithmetic can also give you a little edge in terms of performance; ...
user827992's user avatar
  • 1,175
7 votes
1 answer
12k views

Benefits of Java ByteArrayInputStream vs byte array?

I have a scenario where my Java process will be receiving a stream of binary data: public class DataHandler { public void handleData(DATA data) { // TODO: Do something with data } } ...
herpylderp's user avatar
  • 2,027
7 votes
1 answer
6k views

Extracting color profile information from JPEG files

I'm trying to look up info about reading JPEG's color profile info and to my surprise there's very little open specific how-to information on that regard, but rather lots of general explanation on ...
Igor K.'s user avatar
  • 173
6 votes
0 answers
155 views

Rounding floats after modf()

I am trying to make an effective modf() function that uses floats instead of doubles. An embedded application I am working on only supports the float type. My modf() function works as expected with ...
user264480's user avatar
5 votes
4 answers
9k views

Why does division and multiplication by 2 use the shift operator rather than division operator?

While looking at the code in C for division/multiplication by 2, it is found that shift operator is used rather than division operator. What is the advantage of using shift over division operator?
user5507's user avatar
  • 243
5 votes
2 answers
4k views

Why do binary files load quicker than alphanumeric text files?

I've noticed that when I load/store large data files in a binary format, the program runs much faster than if I load data from an ASCII encoded file. Why is this the case? The data in my case is ...
William's user avatar
  • 213
5 votes
2 answers
1k views

How to prove that given binary files are compiled from provided source code?

Let's assume I want to use an open-source software, the developer says that the software is open-source and provides the source code. Now my question is, how can I be 100% sure that the given binary ...
Harun's user avatar
  • 61
5 votes
2 answers
16k views

binary representation in Python and keeping leading zeros

I wanted to use the base64 Python library to encode a sequence of binary digits into base 64. Would it be possible to do it without converting to a string? If not, what is the best way to do it, ...
user60143's user avatar
5 votes
1 answer
17k views

Representing a number in 12 Bit 2's Complement Fixed Point

The original question is as follows: Consider a 12-bit two's complement fixed point representation, with 8 bits for the integer part and 4 bits for the fraction. What is the binary encoding of ...
dirk1212's user avatar
4 votes
4 answers
3k views

Binary data formats, how to make ensure you can read different format versions?

On our project we have this data format that we use to process and record data on. As of late our application changed so that many of the data formats parameters have become obsolete. Currently we ...
Krupip's user avatar
  • 1,300
4 votes
4 answers
572 views

How much is modern programming still tied to underyling digital logic? [closed]

First of all: I've got no academic background. I'm working primarily with Java and Spring and I'm also fond of web programming and relational databases. I hope I'm using the right terms and I hope ...
user avatar
4 votes
3 answers
4k views

Data format for binary data transfer

I have to make an oscilloscope. Ideally, the oscilloscope connects to a probe. This probe should be another program, and could get the data locally or from a network. This data are numbers, floats and/...
cauchi's user avatar
  • 1,202
4 votes
2 answers
1k views

Understanding physical address

I'm reading this article, Low Level Programming of the Raspberry Pi in C, which explains how to access the raspberry pi on a low level. It states that the virtual gpio address is 0x7E200000. ...
xhallix's user avatar
  • 151
4 votes
3 answers
170 views

Restricted randomization of a binary vector

Suppose I have a binary vector of sample size N with each of the two possible values (e.g., 0 and 1 occurring equally often). For example, if N=10, the binary vector is: 0 0 0 0 0 1 1 1 1 1 Suppose ...
Bart's user avatar
  • 51
3 votes
5 answers
3k views

Why is the bitwise AND of 1 and any even number equal to 0?

I’m curious as to why the bitwise AND of any even number with 1 is equal to 0? I’ve looked at the binary representations of an odd number and 1, and have found that the following is always true for ...
p32094's user avatar
  • 187
3 votes
1 answer
946 views

How do you set and check a single bit in a programming language that does not support bitwise operations?

I'm using a programming language (more a scripting language) that does not support any bitwise operators like AND, OR, XOR, NOT (and shift as well). Common arithmetic and logical operations like + - *...
tigrou's user avatar
  • 269
3 votes
1 answer
254 views

Can we create a GPL application that has a payware advertisement on it?

We've been thinking of using GPL components to make a GPL application, and freely give it away. We then want to use that as a loss-leader. In that free application, where even the source code is ...
Volomike's user avatar
  • 253
3 votes
2 answers
368 views

Preferred way to put drawings into Git repo

In order to visualize some concepts in a Git repo for other developers, I want to put there some vector drawings. Of course they should not be binary. If minor changes occur, the file change should be ...
mcocdawc's user avatar
  • 139
3 votes
3 answers
5k views

What exactly is "Binary Form"?

I am asking in the context of the licenses on code that one sees all over the place. Typically, they say something along the lines of "if you release a product containing this in binary form, it must ...
William Jockusch's user avatar
3 votes
1 answer
4k views

Best method for Pattern Matching on Binary String?

I need to search a long string of binary string data (couple of megabytes worth of binary digits) for patterns of binary digits. There are about 100 000 different patterns to search for. Each is a ...
user289944's user avatar
3 votes
1 answer
777 views

What is meant by binary compatibility? What is its importance during serialization/deserialization in a language like Java that deals in byte code?

In computing what is meant by binary compatibility? I read about it in context of serialization/deserialization that this process of serialize/deserialize should be binary compatible. What does it ...
Geek's user avatar
  • 5,187
3 votes
2 answers
1k views

How should I structure a C# application that reads & writes binary data?

I have to read and write binary "chunks" of approximately 1Mb each. The data can come in the form of a stream or a in-memory byte[]. Normally I would use a Struct with a fixed layout, but there are ...
makerofthings7's user avatar
3 votes
1 answer
155 views

What does "windowed streaming" stand for?

So I was asking around the Mercurial development mailing list about binary diffing and patch handling and I got the following examples: whole file approaches (classic diff, bsdiff, Mercurial's ...
dukeofgaming's user avatar
3 votes
1 answer
451 views

What's the best approach for using Git for a project containing a largish binary database (4 GB, 4000 files)?

The codebase consists of 190 Fortran 95+ source files, and directory of binary coefficient files required for the use of the code. The binary directory contains about 4000 files, some of which are ...
Ben's user avatar
  • 159
3 votes
1 answer
527 views

Conveniently sorting and (binary?) searching an array of pairs of numbers?

So I have an array of distinct pairs of positive integers. That is, my array looks something like this (for instance): { (1,5) , (6,4), (5,3), (2,3), (2,4) } And my task is, for a given pair (a,b) ...
Nu Nunu's user avatar
  • 131
3 votes
0 answers
598 views

Optimal data structure for binary data/Java

I have several input formats mostly restricted to geotiff and some proprietary binary formats. I import them into my program and then need to export them into various other data formats (also binary) ...
user avatar
3 votes
2 answers
3k views

How exactly does a program (executable image) and library (pre-compiled image) "link" together?

I know very well of the difference of static versus dynamic linking. What I want to know is, when linking statically (with a library like Winmm.lib on Windows), how does the linker "link" the pre-...
user avatar
2 votes
3 answers
875 views

Can you decipher this binary [closed]

Thought I post this to the best community of programmers I know. David Johnston, the new Governor General, has the digital world confused. Just what is the meaning of that 33 character-...
Richard Stelling's user avatar
2 votes
4 answers
6k views

Understanding binary numbers in terms of real world objects [closed]

When I represent a number in the decimal system, I have an intuitive knowledge of what it amounts to. For example take the number '10': I understand that it means 10 apples or 10 people... i.e I can ...
Kaushik's user avatar
  • 1,195
2 votes
1 answer
8k views

Bitwise operation on uppercase ASCII character turns to lowercase. Why?

I came across this in the http_parser library of node.js implementation. When I bitwise-OR an ASCII capitalized character code, it converts into its lowercase version. The lowercase version remains as ...
Showkat Ali's user avatar
2 votes
2 answers
5k views

What is a Relocatable Binary?

What is a Relocatable Binary? I tried doing some search on Google, but I am still confused. Also: what is the difference between an Executable and a Relocatable Binary?
Hemang Bhogayata's user avatar
2 votes
2 answers
419 views

Which numeral systems are useful in computer science?

I am wondering which numeral system different programmers are using, or would use if their language has support for them. As an example, in C++ we can use: Octal by prefixing with 0 (e.g. 0377) ...
authchir's user avatar
  • 380
2 votes
5 answers
463 views

Shortening a boolean AND with third operand

I'm trying to calculate the sum of 2 bits using basic binary arithmetic and currently, I'm doing this: function Add(bool a, bool b, bool carry) { return { Result: a ^ b ^ carry, ...
DumbButterly's user avatar
2 votes
2 answers
1k views

Why directly edit binary files?

This may be a naive question, but I wonder when and why (non-research) developers would directly edit a binary file. It seems like the only good reason to use one is to create a kludge when you need ...
William's user avatar
  • 213