Questions tagged [binary-data]

0

votes
0

answer
13

Views

EmguCV read 8 bit image from byte array

I have a byte array which contains the data of PNG8 (Color palette and indexes of colors). I need to create Image (or at least simply Bitmap) from my byte array. I haven't problems with PNG24 or PNG32: byte type; int height, width; byte[] data; ... // Initializing type, height, width and data with B...
Vlad i Slav
1

votes
2

answer
207

Views

Why are all of my images getting cut off when I pull the binary out of a SQL Server DB?

I'm using PDO in PHP 7 on an Amazon Linux AMI to connect to a SQL Server DB running on Amazon RDS. Thus far, I've been able to extract all of the data out of the DB just fine except for one column in one table. The column is of the type image and contains binary data. When I attempt to use PDO in PH...
HartleySan
1

votes
1

answer
215

Views

unit testing java servlets with binary data

I'm attempting to write a Java Servlet unit test to send binary data http requests to the servlet and receive a binary response. Usually I use the jetty ServletTester and HttpTester to unit test servlets, but HttpTester doesn't seems to support binary requests yet. Any ideas how can I unit test a bi...
eldad levy
1

votes
2

answer
1.1k

Views

Finding major axis/image orientation of binary image in R

I have a high res binary image which looks something like: I'm trying to compute the major axis which should be slightly rotated to the right and eventually get the axis of orientation of the object A post here (in matlab) suggests a way of doing this is computing the covariance matrix for the datap...
by0
1

votes
2

answer
102

Views

Store setting in mysql

I have an app that I am building and I have to save settings for some of the pages. I've decided to save it in mysql in binary data format. I got a lot of checkboxes. So let's say i have this kind of form I have 10 pages that have settings page similar to this one. I think that I can write this dat...
melanholly
1

votes
1

answer
390

Views

Can't find mp3 frame header sync bits in node stream

I am almost at the end of my rope on this one. I am attempting to parse out mp3 frame data, but I am having a bear of a time locating any frames. I am using Node 0.10 and trying to make use of the newer stream api (although it doesn't work with the old one either) I am looping through the buffer loo...
monastic-panic
1

votes
1

answer
2.6k

Views

python unhexlify not working as expected

Whenever a program opens a file it sees the file as binary data. It translates it to a higher interpretive language i.e. octal, hex, ascii , etc. In this case it displays hexadecimal in the LH pane and ansi (windows 7 so it should be CP1252) in the RH pane. The 3 pictures below illustrate the origin...
Gary Washington
1

votes
3

answer
507

Views

How to fill side of a binary image in opencv?

I have a binary image. and I want to fill some of its section completely black and remaining white. what i want can be best explained here-http://www.roborealm.com/tutorial/Obstacle_Avoidance/slide020.php explanation-I start from bottom right and go reach to top left. If i find any non-black pixel,a...
Shubham
1

votes
2

answer
3.3k

Views

Stata: code binary variable conditional on key words in string variable

Is there any way to code a binary variable dependent on keywords being present in a given string variable? Simple example: I have a string variable that describes various meals and a dummy variable that denotes if a given meal is breakfast or not. Is there any way to code breakfast = 1 if meal== [t...
kathystehl
1

votes
1

answer
198

Views

Elixir: what is the binary printed in the repl after module definition?

I wrote a simple module in the repl: iex(26)> defmodule Adder do ...(26)> def add(a \\ 0, b \\ 0) do ...(26)> a+b ...(26)> end ...(26)> end {:module, Adder, , {:add, 2}} What is the binary printed out after the module definition?
tldr
1

votes
2

answer
646

Views

Read integers from binary <8 bits in R

In R, I am trying to convert binary data to integer values, but instead of 1 value being stored in 1 byte, multiple values are stored within and across bytes. I know there are 12 integer values stored across 64 bits (8 bytes). The 12 integers have the following bit count: 5,6,5,5,4,7,5,6,5,5,4,7 Af...
habd
1

votes
2

answer
276

Views

PER encoding without tag and length info

Using asn1 PER encoding, is there some way to encode data using only content bits i.e without tag and length information? I am trying to fit a legacy binary protocol onto an asn1 specification, and that would only be possible if there was an encoding that contains the content bits alone.
Ajoy
0

votes
1

answer
21

Views

Decoding binary data from serial port

I am trying communicate with a Simplebgc board via serial on my Raspberry Pi. I am writing commands to the board which seems to be working but I need help decoding the binary response. Why am I getting 23 byes when the guide seems to add to 18? I am new to both C and binary. void sendCommand() { i...
bakalolo
3

votes
1

answer
58

Views

How to receive floating point data over a websocket in typescript

I understand that there is no way to easily send and receive floats the same way there is for strings. However, if I setup my websocket like this: ws = new WebSocket(address); ws.binaryType = 'blob'; I should be able to convert the incoming bytestrings into floats. Converting floats into bytestrings...
Eben Cowley
1

votes
1

answer
2.8k

Views

Writing binary data from a Nodejs buffer to a blob on Meteor client

I'm trying to create a CSV file that will be saved with UTF-16LE encoding on the server and then pass the result to the client. This is what I do, in Coffeescript: Meteor.methods { iconv: (data, from="UTF-8", to="UTF-16LE") -> Iconv = Meteor.require('iconv').Iconv iconv = new Iconv(from, to) res = i...
seb
2

votes
3

answer
4.4k

Views

Gray code to binary conversion

Given a gray code for a number, find the binary code for the number. Gray code is a binary numeral system where two successive values differ in only one bit. For Example two bit gray code is: 0 - 00 1 - 01 2 - 11 3 - 10 Binary is: 0 - 00 1 - 01 2 - 10 3 - 11 Provide an algorithm to convert the gray...
sunmoon
2

votes
1

answer
1.3k

Views

VB/VBScript - Comparing a binary value in a WHERE statement (SQL Server)

I'm getting a type mismatch error when I try to run an SQL statement like this: Dim s s = "test" "SELECT id FROM mytable WHERE sha1bin = " & SHA1bin(s) Here's my SHA1bin function: Private Function SHA1Bin(s) Dim asc, enc, bytes Set asc = CreateObject("System.Text.UTF8Encoding") Set enc = CreateObjec...
HK1
2

votes
1

answer
1.3k

Views

Reading unformatted data into 4D array in Matlab (vs IDL)

I have a .img file of unformatted (I think binary) data that I want to read as floats into a 4D array in Matlab. I noticed that the 'fread' function in Matlab used to read binary data can only read into 1D or 2D arrays automatically, so I tried something like this: function fileArr4D= load4DFile(dim...
Marvin
37

votes
11

answer
37.9k

Views

Would you store binary data in database or in file system? [closed]

This is a question which has been asked before (large-text-and-images-in-sql) but mainly for data which will be changed. In my case the data will be stored and never changed. Just seems sensible to keep everything together. Are there any reasons why I should not store static binary data in a databa...
paul
2

votes
1

answer
154

Views

Determine Compression Algorithm from Input and Output Bytes

I'm trying to determine the algorithm used to compress a series of bytes... I have no idea what algorithm it is or how it works. What I do know is what the contents of the data are, both before and after its compressed. Is there a program I can use to determine this, is the answer obvious from these...
Pluto
17

votes
6

answer
38.3k

Views

Storing PDF files as binary objects in SQL Server, yes or no?

I have to find a design decision for the following task: I have a SQL Server database and it contains a table of orders. PDF documents will be uploaded by users through a simple file upload from a web page and assigned to an order. There is not more than one document per order (perhaps no document,...
Slauma
168

votes
9

answer
67.4k

Views
1

votes
1

answer
137

Views

First 1000 bytes of a variable

Is this usage of unpack correct if I would like to try this guessing subroutine with the variables first 1000 bytes? #!/usr/bin/env perl use warnings; use 5.10.1; my $var = ...; my $part = unpack( 'b1000', $var ) ; sub is_binary_data { local $_ = shift; ( tr/ -~//c / length ) >= .3; } if ( is_bin...
sid_com
2

votes
1

answer
769

Views

How do I store arbitrary binary data in a binary serialized class?

Using C#/.NET for my application, I've got a series of classes in my main data model that represent "binary" (as opposed to text) content. I've got a inheritance setup like this: Basically, the abstract class BinaryContent contains a MemoryStream that stores arbitrary binary data. That data is read...
Benny Jobigan
18

votes
8

answer
32.8k

Views

How to convert integer number into binary vector?

How to convert an integer number into binary vector using R? For example : number
Qbik
1

votes
3

answer
2.3k

Views

How to Create a Single Dummy Variable with conditions in multiple columns?

I am trying to efficiently create a binary dummy variables (1/0) in my data set based on whether or not one or more of 7 variables (col9-15) in the data set take on a specific value (35), but I don't want to test all columns. While as.numeric is ideal usually, I can only get it to work with one colu...
km5041
2

votes
1

answer
2.9k

Views

Creating a binary file from an IntelHex in C#

I'm trying to create a binary file from a intelHex file. Iside the intelHex file I have data and address to which I should write the data inside the binary file. IntelHex file looks like that :10010000214601360121470136007EFE09D2190140 :100110002146017EB7C20001FF5F16002148011988 :10012000194E7923462...
Allek
1

votes
2

answer
3.4k

Views

Python writing a long int as a binary value to a file

I have been trying to take a long int (m39 prime) and store it as a binary file. When I attempt to write the bin value to a file it is written as a string. >>> m39 = bin(2**13466917-1) >>> open('m39', 'wb').write(m39) [email protected]:~/Desktop$ xxd m39 | head 0000000: 3062 3131 3131 3131 313...
MadSc13ntist
2

votes
3

answer
3.8k

Views

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 arbitrary type, read the bytes that are stored on disk...
X-Mann
6

votes
4

answer
384

Views

Prolog - handling binary data with DCGs

It seems to me one ought to be able to process binary data with DCGs on a list of bytes. To make it work generally, though, one has to use bitwise operations which means is/2 is involved, which means instantiation order is an issue, which may confound using DCGs to both parse and generate. The idea...
Daniel Lyons
5

votes
1

answer
2.1k

Views

How to best get a byte array from a ClientResponse from Spring WebClient?

I'm trying out the new WebClient from Spring 5 (5.0.0.RC2) in a codebase that uses reactive programming and I've had success mapping the JSON response from an endpoint to a DTO in my app, which works very nice: WebClient client = WebClient.create(baseURI); Mono dto = client.get() .uri(uri) .accept(M...
Nils Breunese
6

votes
4

answer
4k

Views

Overcoming .NET problem of displaying binary columns in a DataGridView

If a DataSet contains a column that is a timestamp or other binary value, its associated DataGridView throws an ArgumentException, when displaying any data in that column. That is, assume you have some table containing a binary column such as: CREATE TABLE [dbo].[DataTest]( [IdStuff] INT IDENTITY(1,...
Michael Sorens
37

votes
11

answer
37.8k

Views

Would you store binary data in database or in file system? [on hold]

This is a question which has been asked before (large-text-and-images-in-sql) but mainly for data which will be changed. In my case the data will be stored and never changed. Just seems sensible to keep everything together. Are there any reasons why I should not store static binary data in a databa...
paul
5

votes
1

answer
88

Views

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 command: curl -vX PUT 'http://localhost:5984/categories/Jan/...
David J.
3

votes
1

answer
8.8k

Views

C++ read binary file and convert to hex

I'm having some problems reading a binary file and converting it's bytes to hex representation. What I've tried so far: ifstream::pos_type size; char * memblock; ifstream file (toread, ios::in|ios::binary|ios::ate); if (file.is_open()) { size = file.tellg(); memblock = new char [size]; file.seekg (...
DevelRoot
2

votes
4

answer
1.7k

Views

Human-readable binary data using Python

My work requires that I perform a mathematical simulation whose parameters come from a binary file. The simulator can read such binary file without a problem. However, I need to peek inside the binary file to make sure the parameters are what I need them to be, and I cannot seem to be able to do it....
Escualo
5

votes
1

answer
1.1k

Views

What data type is suitable to handle binary data in ActiveX method?

I'm writing an ActiveX control for my friend, that should encapsulate encryption routines. It will be used from VB6 primarily. What data type should I choose for binary data like encryption key, initialization vector, input and output data so that it would be convenient for my friend to use it from...
Vladislav Rastrusny
5

votes
2

answer
2.9k

Views

Serving binary files from the database with compojure

I have the following routes definition: (require '[compojure.core :as ccore] '[ring.util.response :as response]) (def *main-routes* (ccore/defroutes avalanche-routes (ccore/GET "/" [] "Hello World 2") (ccore/GET "/images/:id" [id] (get-image-response id)))) In this example, requesting / works like a...
Pieter Breed
4

votes
2

answer
1.4k

Views

Java convert bytes to binary safe string

I have some data in bytes, and I want to put them into Redis, but Redis only accepts binary safe string, and my data has some binary non-safe bytes. So how can I convert these bytes into binary safe string so that I can save them to Redis? Base64 works for me, but it makes data larger, any better i...
jiluo
2

votes
3

answer
1.4k

Views

How to open or run unknown file converted into byte[]

I use to store document/file in byte[] in database, and I want user can view/run that file from my application.
BreakHead

View additional questions