Questions tagged [binary-data]

3

votes
1

answer
16

Views

Is there a way to convert binary data into a data type that will allow ActiveStorage to attach it as an image to my User model

I am hitting an api to get an image that they have stored and use it as the profile pic for our application's users. I'm using Ruby on Rails and ActiveStorage with AWS to attach and store the image. What they send back is this: {'status'=>'shared', 'values'=>[{'$objectType'=>'BinaryData', 'data'=>'/...
Alex Gonzalez
1

votes
1

answer
116

Views

Is it necessary to convert a data to binary set to calculate similarity (jaccard index)?

I need to calculate jaccard similarity to dataframe below: df = data.frame( a=c('1', '1', '1', '1', '2', '2', '2', '3', '3', '4', '4', '4', '4'), b=c('100', '101', '111', '25841', '111', '101', '106', '101', '108', '100', '30256', '108', '112')) Is necessary i convert data to binary set? How do thi...
16

votes
4

answer
31.1k

Views

Fortran unformatted file format

I don't understand the format of unformatted files in fortran. For example: open (3,file=filename,form='unformatted',access='sequential') write(3) matrix(i,:) outputs a column of a matrix into a file. I've discovered that it pads the file with 4 bytes on either end, however I don't really understan...
Andrew Spott
1

votes
0

answer
36

Views

How to send & handle image properly between ruby & node.js image-size

Try to send file (image) over http request from ruby client (using RestClient) to node.js server Client (Ruby) code Image file is a tempfile that read to payload parameter as binary like so: tf = open('http://via.placeholder.com/220x220') tf.binmode response = JSON.parse( RestClient::Resource.new(ur...
Juriy
1

votes
0

answer
69

Views

Count numbers with Hamming distance less than or equal than given k from a given set of integers

I admit that this problem is part (although small) of school programming assignment, but I wasn't able to find much of a hint online and my solutions are very slow so far. Here is my problem defined more precisely: Given a vector of integers v and integer k, count how many integers exist such that...
Karlos K.
1

votes
1

answer
107

Views

Receiving binary data via http request in node js server

I am trying to receive an image binary data in a node js express app. The data is sent by the following python script: import requests import shutil from time import sleep def uploadFile(url,filename): url = 'http://208.97.169.108:3000' files = {'photo':open('C:/EmojifyMe/downloadedImage.jpg','rb')}...
1

votes
1

answer
93

Views

What are the security implications of passing binary data to a non-binary-safe function?

In PHP, the term 'binary-safe' sounds to me like a security feature to help defend against binary exploitation such as a buffer overflow, etc. I'm also aware that some functions have 'multi-byte aware' alternatives that are prefixed with mb_. For example, substr and mb_substr. These functions are ab...
jamieweb
1

votes
0

answer
42

Views

Xcode Swift binary data showing in email instead of image

I'm producing an IOS App that has the ability to send an email from within it. Within the email methods I'm using the following: let imageString = returnEmailStringBase64EncodedImage(image: ImageView.image!) let mail = MFMailComposeViewController() mail.mailComposeDelegate = self as MFMailComposeVie...
Lexter
0

votes
0

answer
3

Views

How to process binary data from API Gateway in Lambda and vice-versa?

I'm currently have the following setup: 1. S3 Bucket 2. API Gateway with GET/POST resource 3. Two Lambda Functions (one for getting data from s3, one for storing data to s3) For example the GET Resource, i pass a key parameter, which is used in the lambda function to get the object from s3 bucket. t...
Moritz Büttner
1

votes
0

answer
93

Views

Jmeter not POSTing binary data correctly

I am trying to post protobuf data with JMeter. I have a Sampler HTTP Request setup with the body as: b'' This should simply be an empty protobuf object, but JMeter is actually sending some wrapped version of this: b'b''' I have used Content-Type to be both application/protobuf and application/octe...
Tyrick
1

votes
1

answer
329

Views

JPEG decompression in python3

I am currently creating a TIFF file reader. For that, I need to implement JPEG decompression, so I can display the JPEG-Compressed image. I have been looking for libraries for python3 to do this, but I couldn't seem to find anything. This is my code: zipped_image_data = read(image_tags[279][0]) #com...
Ian Rehwinkel
1

votes
2

answer
36

Views

binary data image conversion does not equal jpg of the same image

I am trying to compare an embedded image located in a MP3 file with the exact same image saved as a JPG. If the images are identical then I would like to perform some further processing, however, when I compare the 2 images (RGB comparison) I keep getting false. I am sure that the images are identi...
oznomal
1

votes
0

answer
83

Views

Is there an emacs mode (or other editor) for editing binary records?

I'm looking for a way to view and edit files of fixed-length binary records with fields consisting of various raw data types like integer, string, etc. There is no way to directly infer the format, but one could have a simple printf-like format descriptor like: '%12d: (%d, %f)\n' to parse and print...
Christopher Crawford
1

votes
0

answer
60

Views

Load Binary C structs from File into Swift structs

I have been given a binary file that has been generated by a system designed to support embedded hardware. The file was generated using C. I have a spreadsheet that outlines the format of said file. I would probably be able to load this file using C, although it's been quite some time since I've h...
Brandon M
1

votes
1

answer
35

Views

Custom Newline in Binary Stream using Hex Array in WPF

I have a binary file I am reading and printing into a textbox while wrapping at a set point, but it is wrapping at places it shouldn't be. I want to ignore all line feed characters except those I have defined. There isn't a single Newline byte, rather it seems to be a series of them. I think I foun...
Alan
1

votes
0

answer
38

Views

Regex on binary data in python 3.6 shows weird behaviour

I'm trying to write a small script that reads binary data from a file before processing it further, with e.g. regex for simplifying some steps. During the regex I'm seeing some weird behavior I just can't figure out of. Code basically goes like this (heavily stripped down to just include the relevan...
ritualmagick
1

votes
0

answer
16

Views

Azure PolyBase external table from binary blob data?

I have several million image blobs stored in a Azure storage container. The blobs have a predictable name ([unique key].jpg.) Examples: 1234.jpg, 230.jpg & so on. If possible, how can I create an external table using this data which can be retrieved using a Sql statement? Select PK, IMAGE_CONTENT...
jujiro
1

votes
0

answer
95

Views

Binary Data from PHP to Angular 6 via http

the goal is to make a http request (empty) from Angular 7 to PHP to receive binary data in Angular for the use with protobuf3. More specifically, the binary data (encoded like described here: https://developers.google.com/protocol-buffers/docs/encoding) in PHP (source) is encapsulated in a string, w...
JFFIGK
1

votes
0

answer
14

Views

Checking whether an array is a suffix array for any binary string

I'm currently trying to figure out whether a given array, which is a permutation of the numbers 1 to n, is a suffix array of any binary string. For example for n = 3, A = {2, 1, 3} is valid, since there exists the binary string [101] with [01] < [1] < [101] (using lexicographical ordering). However...
ntldr
1

votes
1

answer
31

Views

Python stops binary reading of file after getting byte 0xa or 0xd

I want to read some binary file. It is a big file so i use maximalOffset variable to stop reading after getting to it. But reading is always ends at one offset - 8199. The last byte i get is 0xa. In xxd it is the part of byte 0a0d. I am using Ubuntu 18 and Python 3. I found some info about 0x1A in W...
DenisNovac
1

votes
0

answer
20

Views

Unpack binary data got require string argument error

I'm trying to unpack binary data from .txt and the code is following import struct with open('example.txt','rb') as file : fileContent = file.read() var = struct.unpack('dd',fileContent) print var then I got an error says struct.error: unpack requires a string argument of length 16 My code of wri...
whtitefall
1

votes
1

answer
1.4k

Views

Set binary data using setblob in mysql connector/c++ causes crash

I tried to use setBlob() as follows: class DataBuf : public streambuf { public: DataBuf(char * d, size_t s) { setg(d, d, d + s); } }; char b[20]; DataBuf buffer((char*)b, 20); istream stream(&buffer); PreparedStatement* s = con->PrepareStatement('insert into mytable (mybin) values (?)'); s->setBlob(...
1

votes
3

answer
1.5k

Views

Reading/writing binary structures: how to simplify this code?

I'm writing a network app, which sends and receives a lot of different kinds of binary packets, and I'm trying to make adding new kinds of packets to my app as easy as possible. For now, I created a Packet class, and I create subclasses of it for each different kind of packet. However, it isn't as c...
mik01aj
1

votes
2

answer
1.6k

Views

Passing Binary Data to a Stored Procedure in SQL Server 2008

I'm trying to figure out a way to store files in a database. I know it's recommended to store files on the file system rather than the database, but the job I'm working on would highly prefer using the database to store these images (files). There are also some constraints. I'm not an admin user, an...
Joe Majewski
1

votes
1

answer
2.5k

Views

use vbscript to get 32 bit floating point into binary byte or word representation

I don't know how to do two somewhat related task within vbscript (not vb) -I need to break a 32 bit floating point into it's 4 byte binary representation. -I need to break a 32 bit floating point into it's 2 word(aka16bit) binary representation. For example, 65535.0 in format binary is 100011101111...
jmc
1

votes
1

answer
189

Views

Oracle and programming

I just wanted to know how I can store a picture in oracle data base ;
Aidin
1

votes
1

answer
2.6k

Views

JPA - Update binary data

I am new to JPA and hibernate. I am using HSQLDB 2.0 and hibernate-JPA to insert image into BINARY column. I have annotated as follows @Lob private byte[] profileImage; I can insert the image into the database. I am retrieving the entity from database along with the binary column and converting the...
Niranjan
1

votes
1

answer
741

Views

Storing IPv4 & IPv6 in an RDBMS (MySQL)

I've seen a number of questions floating around here (and have read them) regarding storing both IPv4 and IPv6 addresses in an RDBMS (typically MySQL, not unlike my case) Anyways, if (and I've read differently too, so advise if this is incorrect or officially deprecated) IPv4 address are zero-padded...
Dan Lugg
1

votes
4

answer
1.8k

Views

write a binary string as binary to file

I want to write a string consisting of only zeroes and ones to a output file where the output file literally only contains the zeroes and ones in the order given by the string. At the moment I am trying to write the char to a size 1 bit #include #include #include #include int main(int argc, char...
user986152
1

votes
1

answer
1k

Views

Wrapping a binary data file to self-convert to CSV?

I'm writing custom firmware for a SparkFun Logomatic V2 that records binary data to a file on a 2GB micro-SD card. The data file size will range from 100 MB to 1 GB. The format of the binary data is in flux as the board's firmware evolves (it will actually be dynamically reconfigurable at run-time)...
BobC
17

votes
3

answer
850

Views

How should I replace vector<uint8_t>::const_iterator in an API?

I've been given the task of polishing the interface of a codec library. We're using C++17, and I can only use the standard library (i.e. no Boost). Currently, there's a Decoder class that looks roughly like this: class Decoder : public Codec { public: struct Result { vector::const_iterator new_buffe...
splicer
1

votes
1

answer
316

Views

how to optimize data load from binary file

I have a binary file encoded with little endian and containing ~250.000 values of var1 then another same number of values of var2. I should make a method that reads the file and returns a DataSet with those values in the columns var1 and var2. I am using the library: miscutil mentioned here in SO mu...
Davide Piras
1

votes
1

answer
1.4k

Views

How do I serve a binary data from Tornado?

I have a numpy array, that I want to serve using Tornado, but when I try to write it using self.write(my_np_array) I just get an AssertionErrror. What am I doing wrong? File 'server.py', line 28, in get self.write(values) File '/usr/lib/python2.7/site-packages/tornado/web.py', line 468, in write chu...
AME
1

votes
1

answer
1.5k

Views

How to read binary protocol from InputStream?

I try to read a binary protocol from my serial port in Java. I use the RXTX library to read from the serial port. The protocol is the SiRF binary protocol for GPS receivers. The structure is: first two bytes are 0xA0 and 0xA2, which define the beginning of a data frame next two bytes are the payloa...
htz
1

votes
1

answer
174

Views

assigning new observation to a cluster

Suppose I have a user/item feature matrix in Mahout and I have derived the users' loglikelihood similarity and have identified three user clusters. Now I have a new user with a set of items (same format and same set of items), how can I assign the new user one of these three clusters without recalcu...
user1848018
1

votes
1

answer
728

Views

STAX API reading Binary data

I am using STAX event API to read the binary data that is received from a SOAP call and would like to stream the same to a consumer. The XML payload from the SOAP call is something like this: ......... PHNvYXAtZW52OkVudmVsb3BlIHhtbG5zOnNvYXAtZW52PSJodHRwOi8vc 2NoZW1hcy54bWxzb2FwLhm9yZy9zb2FwL2VudmVs...
mithrandir
1

votes
2

answer
3k

Views

Free tool to send binary data to IP address and port?

I'm using windows 7. There is application that is listening to an ip address and port. It waits for binary data to come and process it. Currently, I'm testing the application now. Is there a free tool that I can use to send binary data to an ip address and port? I had tried using telnet to connect t...
null
1

votes
1

answer
247

Views

Convert a byte to something human-readable

I've got a file consisting of a bunch of 'rows' of data (not actually on separate lines). As far as I can tell from the description (PDF), each 'row' has forty bytes precisely, as follows: 4 bytes I can ignore. 2 bytes that are the byte representations of the (decimal) integer 240 or 241 — that is...
msh210
1

votes
2

answer
2.9k

Views

How do I convert NSData back to NSArray

So first I have this code to convert the NSArray into NSData: NSArray *myArray = [[NSArray alloc] initWithObjects:[NSNumber numberWithInt:3], nil]; NSData* encodedArray = [NSData dataWithBytes:myArray length:1]; Now I want to convert it back to an NSArray but I don't know how to do it. This is how I...
Arbitur
1

votes
2

answer
6.1k

Views

Viewing 8 bit RAW image file in openCV

I have a raw file which contains a header of 5 bytes containing the number of rows and columns in first two bits each . The 5th byte contains the number of bits for each pixel in the image which is 8 bits in all cases. The image data follows after that. Since I am new to openCV, i want to ask how to...
user2035996

View additional questions