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
0
votes
2 answers

How to find the size of data (samples) of the .wav file?

I have to normalize .wav audio file. Succeeded to get metadata (the first 44 bytes) from the file (ChunkID, ChunkSize, Format, fmt and so on.) so I can find out how many channels are there (NumChannels) or BitPerSaple etc. Now I have to copy all…
yulian
  • 1,601
  • 3
  • 21
  • 49
0
votes
3 answers

Can't copy the beginning (first 64 bytes) of one .wav to an empty one

I have to copy first 64 bytes from input file in.wav into output file out.wav. (I've downloaded a program which shows .wav file's header (chunks): first 44 bytes and first 20 bytes of data_subchunk) My code fills out.wav file with some values, but…
yulian
  • 1,601
  • 3
  • 21
  • 49
0
votes
1 answer

Create new column with binary data based on several columns

I have a dataframe in which I want to create a new column with 0/1 (which would represent absence/presence of a species) based on the records in previous columns. I've been trying this: update_cat$bobpresent <- NA #creating the new column x <-…
Cat
  • 1
  • 3
0
votes
1 answer

binary data manipulation in java

I spent the better part of a day chasing down a binary reconstruction bug, and want to understand why: the specific line of code looked like this (dataBuffer is an array of bytes): short data = (short) ((short)dataBuffer[curPos + 3] << 8 |…
kolosy
  • 3,029
  • 3
  • 29
  • 48
0
votes
1 answer

libuv - How to use binary protocol

I have client-server application when communicotion by simple binary protocol. The binary protocol have 12 byte header (see code) when four byte is length of data [datasize] and data block size of datasize. struct header { int32_t…
user1514692
  • 60
  • 1
  • 8
0
votes
1 answer

What is the pack template for a sequence of floats?

I have N number of floats in each line of the input text file. I'm trying to convert them into binary format (sequence of four-byte floats). Sample line from input: -12.391 -5.301 -12.854 0.438 8.499 4.862 -2.481 3.962 I'm using the Perl…
user13107
  • 3,239
  • 4
  • 34
  • 54
0
votes
1 answer

Using ReadFile() function to read Binary data in Windows

I have two programs: program A (in FORTRAN) and program B (in C++). They are connected through pipe with each other. Program B should read binary data directly from console of program A but for some reason I can not do that: Following is the…
VecTor
  • 83
  • 3
  • 13
0
votes
2 answers

how to store preloaded image from a form in mySQL using PHP

I have a need to store an image which is preloaded in a form in a blob filed in MySQL database. Here is the form code:
Yogi Yang 007
  • 5,147
  • 10
  • 56
  • 77
0
votes
1 answer

Java: Reading a file containing both text and binary data

I'm having a problem with a new file format I'm being asked to implement at work. Basically, the file is a text file which contains a bunch of headers containing information about the data in UTC-8, and then the rest of the file is the numerical…
DementedDr
  • 177
  • 2
  • 15
0
votes
1 answer

Is it safe to convert a mysqlpp::sql_blob to a std::string?

I'm grabbing some binary data out of my MySQL database. It comes out as a mysqlpp::sql_blob type. It just so happens that this BLOB is a serialized Google Protobuf. I need to de-serialize it so that I can access it normally. This gives a compile…
Runcible
  • 7,006
  • 12
  • 42
  • 62
0
votes
0 answers

Stream output with javascript

I have a page that needs to give some file for download based on enetered parameters. Binary file is generated on webservice and I use following way to generate it and give to user. document.location.href = MyServiceUrl?req=someAction That works…
Roman
  • 391
  • 2
  • 4
  • 17
0
votes
1 answer

Stripes and Enumerate Java classes in drop down menus

When using a drop down menu with a Java enumerate, then Stripes returns some sort of binary content rather than the actual string that should represent the enumerate. In more details, please see how the following 2 drop down menus get converted in…
TPPZ
  • 4,447
  • 10
  • 61
  • 106
0
votes
0 answers

javascript: blob data to file

I have a code: var FReader = new FileReader(); FReader.onload = function(evnt){ console.log(evnt.target.result); //How can I convert `evnt.target.result` back into a file and save it? } FReader.readAsBinaryString(file); Please do not offer me…
Vitalii Maslianok
  • 1,601
  • 1
  • 14
  • 16
0
votes
1 answer

Working with .PGM files?

I need to do some number crunching in .PGM image files. I'll use MatLab for that. Now some files (apparently "P2" type) are plain-text and everything is straightforward because they look like this P2 256 256 255 203 197 197 186 181 181 182 170 165…
Pranasas
  • 597
  • 6
  • 22
0
votes
1 answer

convert binary data to image cURL GET request

I am trying to access a web service that returns a jpeg image. It requires two variables, time_sent and user_id, in the URL## Heading ##. Here is my code: $ch = curl_init(); $options = array( CURLOPT_URL =>…
OneSneakyMofo
  • 1,305
  • 2
  • 19
  • 33