Questions tagged [binary]
Binary, the base-2 numeral system, represents numbers using two symbols: 0 and 1. For compiled computer programs, use the "executable" tag instead.
14,596
questions
0
votes
0
answers
4
views
Binary image and find its center
(https://i.stack.imgur.com/lLBC5.png)
I want to read image_data directly, but I can't binarize it, I can only cv2.imread(file name)
If I store image_data as a picture, after binarizing the picture to ...
0
votes
2
answers
21
views
Pandas convert column with strings comma separated to binary
in Pandas I have an excel file (called Data) with 12 columns, in the 7th column (called Operations) I have many strings for each line (some repeated) separated by comma and space but there's some ...
0
votes
1
answer
20
views
How to store attributes from a node in a binary tree by doing in-order traversal
private void searchAndStore(Node node, String s) {
if (node == null) {
return "";
}
searchAndStore(node.getR(), s);
System.out.println(node....
0
votes
1
answer
14
views
Creating a cell array with 2 rows; 1st row for characters and 2nd for their related 5 bits using dec2bin function in matlab
I am trying to make a 2*32 cell array in matlab. The first row are the characters 'a' to 'z' , space, period, comma, exclamation Point, semicolon and quotation (32 chars).
The second row must be '...
0
votes
1
answer
7
views
Binary Conditional Formatting
I'm using Excel 365 and I need help with the following problem regarding conditional formatting with Binary values.
I would like if a certain cell is larger than 0, for another cell to return the ...
1
vote
1
answer
39
views
Create a rand binary string of variable length
So I am using 2 rand features, the first is a rand that generates a 4 to 19 value for how many bits there will be in the second one.
the second one needs to then create a random binary string (in a ...
0
votes
0
answers
57
views
Write content of a variable into binary file in C++
I'm trying to create a "toy" database engine and I just stuck at the file writing...
This is my code so far:
dbengine.hpp:
#pragma once
#include <iostream>
#include <fstream>
#...
-4
votes
0
answers
42
views
How the computer understand binary is negative or positive [duplicate]
Can someone explain how the computer know the given binary is negative or positive? Example I have binary digit like this 11100111. It's positive value is 231 negative value is -25, also how can I ...
2
votes
1
answer
47
views
Convert decimal number provided in String to the binary
I want to convert a decimal number which is in the String format to the binary. For example I want to read 2 and output 10.
I tried :
Scanner input = new Scanner(System.in);
String dec;
dec = input....
1
vote
1
answer
43
views
How can I convert a number (of type std::string) to its binary representation in std::vector<bool> in C++ without external libraries?
I'm trying to convert a string (like "12345") to its binary representation held in a boolean vector (so it would be {1,1,0,0,0,0,0,0,1,1,1,0,0,1} but the current attempt only works for ...
1
vote
1
answer
87
views
Calculating Maximum Hamming Distance between N Strings for Each String
I am trying to write a program which takes n binary strings of equal length and outputs the maximum hamming distance for each string when compared to the rest. My current solution uses a nested for-...
0
votes
1
answer
42
views
How to check if ANY of a given set of bits is set
How can I compare 2 values A and B and if ANY of the bits that is SET in A is also SET in B, I get back a 0, and if ALL the bits that are SET in A are CLEAR in B I get a 1 (or some other non-zero ...
0
votes
1
answer
33
views
Calculate mean of groups for a binary (0/1) database
I have a database containing the presence (1) or absence (0) of cells in different growth stages (enlarging, thickening and maturing) for different trees during many years. I collected data every ...
-3
votes
0
answers
33
views
Reading .dat file with Python [closed]
Is there anyone can read .dat file attached ?
Is there anyone can read .dat file attached ?
äþ" ±‹v¸ ”v€‹v«ªÍ 0ý ¸þ" ³ªÍÄÿ" }ä‹vÇÕdûþÿÿÿ€‹v äþ" ±‹v¸ ”v€‹v«ªÍ ...
0
votes
0
answers
14
views
Funtions to open, process, and write file in chunks (binary)
OK, I know this should be easy, but I'm rusty at coding C++.
I need a function to read an input file in 256-bit chunks. On every call, a 256-bit chunk needs to be returned to main. From main, a chunk ...
0
votes
0
answers
17
views
how to get assembly file from binary compiled with IAR
I was wondering how to get .s file from .bin compiled with IAR. Trying the gdb and objdump without success.
Looking in IAR project option page, but didn't find nothing consistent to create .s at ...
0
votes
0
answers
11
views
In R: How can I loop through all possible "omitted categories" in a regression with indicator variables?
I want to run the regression as follows:
mylogit1 <- glm(MyDepVar ~ 10indicators * 3indicators , data = data, family = "binomial")
summary(mylogit1)
plot_model(mylogit1, type = "...
1
vote
0
answers
23
views
R sockets, reading binary message of arbitrary size
I am trying to establish R socket binary connection. The idea is that it will do direct data transfer, and the ultimate goal will be using Arrow's binary format. But as of now, I am struggling with ...
-1
votes
0
answers
23
views
how to get an output of an object not in binary? [duplicate]
I had created a class in python, once I ran the program, I was expecting to get the returned output of the functions I created inside the class. Insead I got in the terminal the class's object in a ...
0
votes
1
answer
57
views
Assembly LC-3 Print stars from user input 0-49
This LC-3 program is designed to ask the user to enter a number between 0-49. The program then prints out stars correlating to the number entered. Additional details inclue, that when the user enter &...
0
votes
0
answers
7
views
Image data is highly imbalanced for CNN
I want to do binary image classification using CNN approach but my dataset is highly imbalanced such that it contains only 100 images of 0th class and 30000 images of 1st class.dataset look like this:...
0
votes
0
answers
15
views
How can i directly code in binary ? Is there any editor?
I just want to know that can i code directly code in binary. Definitely there should be a way... if not how would the earliest programmers coded softwares? Please tell me the name of the editor? Also ...
0
votes
0
answers
36
views
Reading binary file and storing instructions in buffer
I have the following code in C I am trying to do two things
First I want to store the contents of the binary file in my blob.instruction_memory buffer
Second, I want to print the contents of the ...
0
votes
2
answers
62
views
Pandas - New columns based on a list and populate them with 1 or 0 based on values
I have a column (called codes) with different repeated values separated by comma, I have to create as many columns as the unique values are and, for each row, put 1 in the column of the value present ...
0
votes
0
answers
26
views
Python rational number to binary converter
I made a rational number- binary converter for positive numbers, but how do I do it for rational numbers?
# Python3 program to convert a
# decimal number to binary number
# function to convert
# ...
1
vote
1
answer
41
views
How to read a file of compressed binary into an array of integers
I have a binary file of 5 bit numbers in a row that I need to read into an array of unsigned integers where each array value is one 5 bit binary number. I know you can use fread when the values are 1 ...
0
votes
0
answers
46
views
Reading a binary file in C and accessing a range of bits
I have the following C code, that reads a binary file and outputs the file in big endian binary format
Now I have a program counter that begins at 0 and reads each instruction and increments the ...
-1
votes
0
answers
18
views
Finding the unique, weight N, arrangements of a binary array?
I'm working on an implementation of the SHAP algorithm, which explains a blackbox model by testing feature combinations and using the result to predict the Shapley values.
The feature combinations are ...
-2
votes
0
answers
31
views
How to make binary image using python and openCV for this image?
I am trying to create a binary mask of the following image, where the rock sample should belong to the white pixel and everything else should belong to the black pixel. I am not quite sure how to do ...
0
votes
1
answer
19
views
Trying to figure out what those bytes are
I've got 6 arrays of bytes, that I'm trying to interpret.
Here they are :
1st array : 72B45CAA466333A5CC5AA6ADC3CF1279D1EC8
2nd array : 72B45CAA466336E4933314330BC656FB05418
3rd array : ...
-1
votes
0
answers
22
views
Construct a truth table from a diagram
Pls I need to know how to convert a diagram into a truth table. I already know how to convert a truth table into a diagram.
See the diagram and question below:
a) For EACH of the FIVE gates G1, G2, ...
0
votes
0
answers
15
views
Python read binary file of unsigned 16 bit integers (see data)
I must read a binary file in Python. I use this code:
import struct
import numpy as np
fileName = "continuous.dat"
with open(fileName, mode='rb') as file:
fileContent = file.read()
...
-2
votes
1
answer
31
views
Convert Binary to Decimal in MASM32
Convert decial to binary in MASM32. Help me
include \masm32\include\masm32rt.inc
.code
start:
call main
exit
main proc
LOCAL var1: DWORD
LOCAL dem: DWORD
mov var1, sval(input("...
0
votes
1
answer
44
views
How to de-interleave bits (un-Mortonize) the "Obvious way" ? (In 3D)
I know a similar question has already been asked. However, I have some trouble manipulating bits and can't adapt/understand the solution.
First of all I used the Interleave bits the obvious way to get ...
0
votes
0
answers
39
views
How to read more that 1 byte from a binary file into a value in java?
I have a binary file with 3 different lines, each line contains non spaced prime numbers. the first one contains primes from 2 - 251 (the ones that can be fit into 1 byte), the second one starts from ...
1
vote
2
answers
115
views
How do I read a binary file in C
How do I read a binary file line by line and store the contents in C
I have a binary file called add_num.mi.
Now I am able to inspect the contents of the file by running the command
xxd -c 4 add_nums....
1
vote
2
answers
35
views
Not getting binary value in databricks
First i created a table in databricks with binary datatype
CREATE TABLE binary(binary_col BINARY);
The above query created a table in databricks now I inserted a value to it using query:
INSERT INTO ...
0
votes
0
answers
5
views
what is the data type of picture in loopback4
@property({
type: 'Binary',
length: 65535,
generated: 0,
mysql: {columnName: 'picture', dataType: 'blob', dataLength: 65535, dataPrecision: null, dataScale: null, nullable: 'Y', generated: 0},
})
...
0
votes
0
answers
12
views
Choosing optimal Hyperparameters for DBSCAN in a binary (yes or no) clustring
in a short terms, i have this labeled dataset to test an approach of unsupervised learning with DBSCAN Algorithm,i need to validate this approach to use it in another unlabled dataset, so i need to ...
0
votes
0
answers
22
views
Repair a corrupt file to original mp4 file using hex editor
I have a corrupt file which is .rsv file that my Sony camera produced. I have other reference files in format .mp4 which work correctly.
I have some IT knowledge and decided to inspect the two files ...
2
votes
3
answers
82
views
Sideways addition of bit pairs modulo 4
Interpreting a uint32 as a sequence of 16 pairs of bits (the imaginary type uint2), is there a more efficient algorithm to add these mod 4 than the following?
(x + (x>>2) + (x>>4) + (x>&...
-1
votes
0
answers
35
views
How to efficiently count all powers of 2 in a given set of numbers in vb.net?
Every number can be expressed in powers of 2. You know this as the binary system
Assume you are given a set of k numbers >0 <2^n.
You want to decide for this set whether every integer power of 2 ...
-1
votes
0
answers
15
views
use one or more bitwise operators to determine the number of 1 bits contained in a 32-bit representation
Provide an algorithm in pseudocode for solving the problem above.
The algorithm should get a value from the user. It is assumed that the user enters a value that can be represented using 32 bits. ...
2
votes
3
answers
101
views
How to implement multiplication in fixed-point
I want to implement multiplication in C and in fixed-point with scalable fraction bitwidth (i.e. from 1 bit to 30 bit), I know the simplest way is like this:
typedef int32_t fixedpt;
typedef int64_t ...
1
vote
0
answers
20
views
GSF to XTF conversion Python
I'm trying to create a python script that takes binary GSF and converts it to XTF (eXtended Triton Format)
import os
from gsfpy import open_gsf
from xtf import XTFFile, XTFPingHeader, ...
0
votes
1
answer
43
views
How to add machine code at the end of an executable file on Windows(PE) or Linux(ELF)?
Detail
I know that it is possible to add code in the famous 'code caves', but they are limited in terms of space, so I would like to add codes in this file without using these spaces, and for that I ...
0
votes
2
answers
67
views
How to handle binary search in Rust when dealing with 'usize' variables?
I'm trying to understand what is the best way to deal with 'overflow' and 'underflow' when using usize/u32 variables. For instance, I was trying to implement Binary Search in Rust and came up with a ...
0
votes
0
answers
22
views
PyTorch memory training overflow
The task is to generate new binary data using a binary generator neural network trained on a dataset of XML SVG files. The SVG files are read and converted into binary data, and then fed into the ...
0
votes
1
answer
23
views
Mysql UNHEX return weird characters
I am trying to use function to convert UUID to binary for database storage efficiency using this code I got from this thread :
DELIMITER $$
CREATE FUNCTION BIN_TO_UUID(b BINARY(16), f BOOLEAN)
...
1
vote
1
answer
44
views
C++ (Arduino) BIN is working, but where is it documented? What is this thing called?
I coded this (BIN) into my Arduino sketch, and it's working (binary as expected), but I don't see it documented anywhere, so I don't know how to use it better, find others like it, and use it ...