Questions tagged [binary-data]

Binary-data is information stored using a two character alphabet (typically written using 0 and 1)

Binary Data is information which is stored using a two character alphabet. For example, the number 42 could be stored as its base-2 representation: 101010.

In modern computers, almost all data is ultimately represented in binary form.

To be useful, the writer and reader of binary data must have a pre-agreed format (e.g. a file consisting of a 32-bit, two's compliment integer followed by three IEEE 754 floating point numbers).

The term is usually used to distinguish data stored in this way against data stored using a textual encoding. For example, the digits of 42 in base-10 (4 and 2) may be represented using ASCII as 00110100 and 00110010. Whether this is considered binary data or not depends on the task at hand; a chat client would consider messages as textual data, but the communication protocol it is built on may consider the same messages as arbitrary binary data.

1585 questions
5
votes
3 answers

Convert an image to binary data (0s and 1s) in java

I want to read an image from a url and convert it into binary data. Please help me.. byte[] data = null; ByteArrayOutputStream bas = null; try { URL u = new URL( …
skmaran.nr.iras
  • 8,152
  • 28
  • 81
  • 116
5
votes
1 answer

CouchDB Attachments Cannot be Opened

I start with a document located at localhost:5984/categories/Jan with the following data: { "_id": "Jan", "_rev": "4-2c0b1c27daca6d2a3c375b0f879a8967", "name": "Jan", } I want to upload a pdf to this document, so I give the following curl…
David J.
  • 1,753
  • 13
  • 47
  • 96
5
votes
3 answers

How to write large binary data fast in Java?

I am writing an STL file which consists of an 80 byte header, a 4 byte integer, and then records of 50 bytes each consisting of floats and a short integer. Using a RandomAccessFile I can easily write the data, but it's horribly slow. This uses the…
Dov
  • 8,000
  • 8
  • 46
  • 75
5
votes
2 answers

PHP - Mysql: storing images in DB - escaping special characters

I read this tutorial about storing images in DB. In the tutorial, the author escapes special characters in the binary data before inserting: http://www.phpriot.com/articles/images-in-mysql/7 ( using addslashes although mysql_real_escape_string is…
JP19
5
votes
4 answers

Write large 4 byte integer as an unsigned, binary

I have integers which floats between values: 4000000000-4294967000 (which is less than int max for a 4 byte unsigned int) and i want to save it to file, and then re-read value $f = fopen($fileName, 'wb'); fwrite($f, pack('I', $value)); It is…
canni
  • 5,737
  • 9
  • 46
  • 68
5
votes
3 answers

Exclude records with empty binary column data

I have a column with type binary(16) not null in a mysql table. Not all records have data in this column, but because it setup to disallow NULL such records have an all-zero value. I want to exclude these all-zero records from a query. So far, the…
helion3
  • 34,737
  • 15
  • 57
  • 100
5
votes
4 answers

How to open and present raw binary data in Python?

This seems to be the type of question that should have a lot of duplicates and plenty of answers, but my searches have led only to frustration and no useable solutions. In Python (preferably 3.x), I would like to know how I can open a file of an…
X-Mann
  • 327
  • 2
  • 5
  • 15
5
votes
0 answers

Spire.PDF Load Binary PDF Data into PdfDocument

I'm working in C# with Spire.PDF. Specifically, my goal is to load binary PDF data from a database into a Spire.Pdf.PdfDocument object. According to this documentation, I should be able to use the LoadFromStream() method or some unspecified method…
Scotty H
  • 6,432
  • 6
  • 41
  • 94
5
votes
1 answer

Binary recommendation algorithms

I'm currently doing some research for a school assignment. I have two data streams, one is user ratings and the other is search, click and order history (binary data) of a webshop. I found that collaborative filtering is the best family of…
DutchGuy
  • 51
  • 1
  • 5
5
votes
1 answer

How to convert binary into data?

I have been attempting to convert binary data I get from an API in R, but it is not parsing and converting the values correct. Here is a sample of the binary: 00 00 00 01 00 04 53 42 55 58 00 00 00 25 c8 42 9b cc cd 42 9c 8a 3d 42 9b b8 52 42 9c 23…
Bryan Nice
  • 53
  • 3
5
votes
0 answers

Spatial auto-correlation test for binary data in R

I want to test a species' presence / absence records for spatial autocorrelation. My data contain >130,000 grids in GIS and with about 700 species' presence records. I have read that the normal Moran's $I$ can't deal with this kind of data, but…
Archer
  • 63
  • 6
5
votes
0 answers

Performance of reading big binary arrays from IndexedDB is low in Javascript

I’m using IndexedDB for storing images and MP3 files as binary arrays but it doesn’t seem to be blazingly fast. Reading one MP3 file takes about 0.5-1 sec and it’s actually quite slow compared to streaming from server where delay is not noticeable.…
Lapsio
  • 6,384
  • 4
  • 20
  • 26
5
votes
4 answers

Any .NET implementation of Concise Binary Object Representation(CBOR)?

I'm on the look-out for any implementations of this new binary data representation.
redcalx
  • 8,177
  • 4
  • 56
  • 105
5
votes
0 answers

Categorical Features in Distance Matrix

I'm calculating the cosine similarity between two feature vectors and wondering if someone might have a neat solution to the below problem around categorical features. Currently i have (example): # define the similarity function cosineSim <-…
5
votes
7 answers

How to display binary data from curl in php

I'm writing simple php proxy and I have trouble displaying png file, the output is and it should be: The images are opened in Notepad++. My php curl code look like this: $ua = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.13)…
jcubic
  • 61,973
  • 54
  • 229
  • 402