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.
13,958
questions
0votes
0answers
19views
how to install binary package from github in R
I have an R binary package in github.
The following code does not work.
Could any one can help me to install this.
devtools::install_github('yikeshu0611/nhanesR',type = 'binary')
Greate tahnks.
1vote
1answer
12views
Binary Rotated Search with 0 and negative nums
I have the binary search for pivot (max) working perfectly fine unless
I add 0 or negative nums to the array provided to function
In some positions of 0 (or neg nums) the code just not returns
Can ...
0votes
2answers
40views
Could someone explain why are arrays are printed the same, if they're stored different
Hello I'm new to C and I'm trying to print a decimal number converted to binary in standard order and in reverse order. I made a two function that accepts a decimal number and fills a dynamically ...
0votes
1answer
14views
Kotlin: encode and decode binary struct data (Kotlin equivalent for Python's struct.pack and struct.unpack)
For a C based embedded hardware module, the configuration structure is made up of several fields in a particular layout, e.g. take this 8-byte struct for example:
Offset
Datatype
Field
0
UInt8
...
0votes
0answers
6views
Binary from app using winston package don't run as linux service
I have a very simple node js application that uses the npm Winston package.
The code is only a loop printing date using the Winston package The app runs just fine. I created a binary using
npm run ...
0votes
0answers
15views
Merge lists with 0 1 encoding
I have the following case in python:
a = [[0,0,1,0],
[0,0,0,1],
[1,0,0,1],
[1,0,1,1]]
b = [[1,1,0,0],
[1,0,0,1],
[0,1,0,0]]
c = [[1,0,1,0],
[0,0,1,0],
[0,1,0,0]]
...
0votes
0answers
14views
Parse timestamp and Hex file in Matlab
I have a txt file that contains a timestamp, hex data, and encoded code.
I need to parse just the hex data and insert it in a file.
Here it is a n example of the file:
15:25:21 0000 04 24 E8 03 04 ...
0votes
0answers
15views
How to output multiple types of binary files in one file (python)
I'm trying to output the DF to a binary file with one line. I'll show you a simple example.(In reality, it consists of hundreds of millions of rows of data.).
A1 should be uint32_t, B2 should be ...
2votes
1answer
28views
stuck on java program converting user input string representing binary number to decimal
Java Program. Eclipse IDE most recent. java 17.0.1.
program should prompt user a string representing a binary number. word must be 8 digits or less and must contain only 1s and 0s. If word is not 8 ...
0votes
0answers
33views
Read binary file and convert to ASCII in Python
I'm working on proprietary software as a side project at work, so I'm unable to share source files. However, I can share my current starting code and its output.
My code:
import os, sys
currentdir = ...
-3votes
0answers
25views
Decimal to binary with Java (Boolean) [duplicate]
Could someone help me solve this algorithm?
Develop an algorithm that converts an integer, positive decimal number into a binary number.
The binary number is to be stored in a Boolean array, the ...
0votes
0answers
46views
Why local variable addresses are different by which program started it?
I ran into a confusion about memory address issue during my experiment to practice CTF pwn questions.
I tried to find the start pointer address of a local array variable to insert shellcode with ...
1vote
1answer
24views
Decimal to Binary based on the logic B[i]*(2)^i Where i=[0,2,3...N-1]
I have a function that takes a binary array and returns a decimal based on the below logic:
1 | -2 | 4 | -8 | 16 | -32 ...
1 | 0 | 0 | 1 | 1 | 1 = 1 + 0 + 0 + (-8) + 16 + (-32)...
0votes
3answers
59views
Convert Decimal Number to Binary without using Array
I want to make a java code that converts any decimal number inputted, into binary number. Although the array method is easy, it doesn't actually prints a number(it prints array), nor does it seem to ...
0votes
1answer
23views
Is there a difference in inserting a txt/csv file or an image into a BLOB column in Oracle?
So I'm writing a Python script with CX_ORACLE which will take about 20K files and upload them into a BLOB column...
They are PDFs,CSVs,TXTs, and JPGs.
I'm just not understanding how I can both put ...
-1votes
1answer
38views
Python - List to Tree (counting the number of internal nodes)
While trying to solve a set of question for an interview in Python, I came across this one which seemed easy at first, but I decided to share it here because I'm stuck on it for a while and I can't ...
-2votes
0answers
33views
How show bash PC/CPU current general calculations in binary? [closed]
I wanted to randomly generate the binary code of the current system work that is impossible to manipulate from the system which I can adjust even then.
If someone hacks and tries to influence the ...
0votes
1answer
47views
Addition of two binary numbers using only logical operators AND, OR
I am new to programming and I want to add up two binary numbers (e.g. '10' and '01') in C but I am not allowed to use:
arithmetic operations +,-,*,/
bitwise operators (<<,^...)
iterations
...
-1votes
0answers
54views
Question about printf and binary in c from a beginner
I am self-learning C and playing picoCTF at the same time.
There is one challenge called Stonks which I have to use format string attack to catch the flag.
I thought that printf("%x") and ...
0votes
0answers
33views
Is it possible to link arm object code to include header files
Im learning reverse engineering in ARM binaries although this is a general question in binary compilation and linking. I have an object file test.o and a header test.h which contains a function and an ...
1vote
1answer
35views
How can I find the big endian key in a message?
I am trying to read a binary message from an ESP32 using a broker; i wrote a phyton script where I subscribe the topic. the message that i actually receive is:
b'\x00\x00\x00?'
this is a float binary ...
0votes
2answers
50views
Flip one random bit in integer
I would like to flip one bit in integer. So I have to convert integer to binary, than flip one random bit and than convert it back to integer. How could i do that?
# what I want to get:
# num = 8 ... ...
-3votes
0answers
32views
Saving chars (or strings) as bit chains in file [closed]
I am writing a program which converts chars to string of 1's and 0's, which will later be saved as bit chains in file. For example the letter "a" is converted to 01100001. I want so that the ...
-4votes
0answers
21views
Can you convert a string to a binary number? [duplicate]
I have a pretty weird question. Let's say that I want to convert the word "HELLO" into binary code using C# so that the output is 01001000 01000101 01001100 01001100 01001111.
Would there be ...
0votes
1answer
27views
Saving a numpy array in binary does not improve disk usage compared to uint8
I'm saving numpy arrays while trying to use as little disk space as possible.
Along the way I realized that saving a boolean numpy array does not improve disk usage compared to a uint8 array.
Is there ...
0votes
2answers
47views
How can I convert a .bmp file into an array of 1s and 0s in C#?
I have a simple black & white .bmp file and i would like to convert it through C# into a series of 0s and 1s, excluding the file headers and padding.
The image is 32x32 pixels and this is what I ...
0votes
0answers
13views
How i can us xor encryption in matlab without getting a special character? Like $ or some unreadable □ by matlab?
Let us say i want to encrypt text says "hello world"
with key is '01011010' using XOR
I converted the text into binary using Dec2Bin function
Then reshape it in way which i can XOR it with ...
0votes
1answer
23views
Own busybox executable in Android via apk
I need to run my busybox from a Java Android app. To do this, I included a tar archive with busybox in apk res and unpack it to /data/data/com.exeample.test/files with permissions 755. But I can't run ...
0votes
0answers
78views
how does this expression " -~x " work in java
i'm learning bits operation but i have one dought in this -~x expression.
i'm following this link and i coudn't able to understand how this expression handle positive case and negative case.
in the ...
0votes
0answers
10views
Read .ftr file from remote server into dataframe?
At the moment I am trying to load in an .ftr file that is located on another server.
I can get the binary through:
binary = subprocess.check_output('sudo ssh server cat file.ftr',shell=True)
this ...
2votes
2answers
32views
replace one value with other value in every units of panel data
i have a panel data. the variable of interest have two values,1 and 0. i would like to replace 0 with 1 by group if 1 is in front of 0 . The data is as follow,
id <- c(1,1,2,2,2,3,3,3,4,4);
burden &...
0votes
1answer
27views
Binary to Decimal 32bit signed with PHP
I currently have a Decimal that is coming through as: 4294960896
This is then converted to Binary with this function:
decbin('4294960896')
Which equals: 11111111111111111110011100000000
I then need ...
0votes
0answers
38views
How to perform division of 2 numbers by inverse multiplication using Bitwise
Here is the code I divide 2 numbers by bit shifting . But I heard there is a faster way, which is to convert division to inverse multiplication.
int divv(int num1, int num2 )
{
bool acc = ...
0votes
1answer
19views
Use fread() to read binary file contents
I want to use fread to read a segment of a binary file. The binary content is 0xf3 0xf 0x1e 0xfa...
But I read and output from fread() 0xfffffff3 0xf... I want to know why 0xf3 becomes 0xfffffff3 0xf ...
-1votes
2answers
36views
Missing sequence number problem solved with XOR
I'm trying to understand how the XOR operation managed to solve the problem PermMissingElem
I know one of the properties of XOR is that:
A ⊕ B = C
C ⊕ A = B
C ⊕ B = A
>>> 3 ^ 4
7
>>&...
0votes
0answers
17views
How Decode chunked response on nodeJS Request
\u0018�\u000f�ʮ6���p\u0000\u0002\u0015!�+Z\u0010�LS�\u001c\"1B���\u0011\u0002E`��\u001c�J�\nG�9Gr�OR�\u0014�82S!{\u0017|B\u0001�\u0017\"��䷒\n\u000b�\b�ؽjjw\r\u0004��S\u001d��ã\u0010x���#\u000b�\u0003��...
0votes
1answer
24views
Apply multiple thresholds to image (tiff) to create exact binary copy, Python
I am working with the following image:
And I would like to make it binary, however, as can be seen in the image, there are different brightness' of grey spots. I would like for all the grey spots to ...
-2votes
0answers
29views
How to decipher this message? (UTF8, binary, ASCII)
I have a string: ĄÐ,∑ЫЭ
which I think equates to a number between 10,000 to 20, 000. (Most likely 20,000)
I’m trying to decipher this string which might be related to UTF8.
I’m not entirely sure if ...
2votes
3answers
62views
The algorithm to generate binary numbers from 1 to n in lexicographical order
Is there any efficient algorithm to do so ,I have tried to produce all binary numbers and store them in an array then sort them, if we can directly generate the binary numbers in lexicographical order ...
0votes
1answer
35views
Assembly MIPS how to check the value bit by bit?
I am creating a program for a user to enter an integer and then check each bit and count how many 1's is in it's binary value. So if I input 4673 I should get "4" as an output because there ...
0votes
0answers
4views
Can protobuf-net serialize / deserialize a field of type "object"?
I have a serialization framework which is based on .NET binary formatter. Now I want to migrate it to protobuf-net. There are a few places in our framework that a field is defined as of type "...
0votes
1answer
30views
Taking byte stream (1s & 0s) and storing them in a uint8_t array
I am trying to take this byte stream of information (1's and 0's) and im trying to store this in a uint8_t array (each index would be a byte long, 8 bits). I am having a hard time grasping how to ...
-2votes
1answer
49views
Why is my for loop increasing the size of my array in C?
I'm trying to make a binary number calculator in c and I'm running into issues of my for loops doubling the size of my second array and adding the first array onto the end. I'm really confused because ...
0votes
2answers
20views
Can We represent -128 in 8-bit notation?
I am wondering how can We represent -128 in 8-bit notation?reason for getting this doubt is -128 representation in binary form is 1000 0000.In this MSB is 1 which is the sign bit and magnitude is 0 ...
-1votes
0answers
88views
Frequency of all possible binary substring of a given decimal number
How to find the frequency of all possible binary substrings of a decimal number? (Binary substring refers to a substring of the binary representation of the decimal number)
Eg.-
Given number 5.
5 = ...
0votes
0answers
14views
Autoencoder architectures for anomaly detection on binary data
I have a data set consisting of features with binary values, which are available as a time series.
In preprocessing, I have divided the time series into smaller windows.
My question is, what types of ...
0votes
2answers
47views
Find sum of bits of a char [closed]
I need a queue of size about 8 booleans. Every push should destroy an item from the tail. This can be achieved by a char in the resource limited application.
However I only care about the sum of those ...
0votes
1answer
14views
HOW does a 8 bit processor interpret the 2 bytes of a 16 bit number to be a single piece of info?
Assume the 16 bit no. to be 256.
So,
byte 1 = Some binary no.
byte 2 = Some binary no.
But byte 1 also represents a 8 bit no.(Which could be an independent decimal number) and so does byte 2..
So how ...
0votes
2answers
41views
I want to get the encoded string as output . But not able to
Input:
101101110
1101
Expected Ouput:
000000000011
My output:
It just keeps on taking the input.and not showing any output.
Please help me . what is wrong with my code. Any help would be aprreciated....
-2votes
0answers
34views
Read a binary file and convert it to a visible binary
To encrypt a photo file, I needed to first write it as a binary and then encrypt it.
But I do not understand why I can make the whole file visible in binary, but only 3 lines of the file are not ...