20 questions
0
votes
1
answer
762
views
How to send an image as binary string in Flutter using Http package?
I have to send a png/jpg image to the server in the binary string form. It is also specified in the Swagger that content-type of the request has to be "multipart/form-data".
I select images ...
2
votes
2
answers
924
views
IterTools product in Julia
I would like to produce lists of 0 and 1 in Julia using IterTools.
For example, in Python I can do:
for bits in itertools.product([0, 1], repeat=5):
print(bits)
This will produce
(0, 0, 0, 0, 0)
(...
1
vote
3
answers
738
views
Long.parseLong throws NumberFormatException for binary string
we have byte string s = "1111000000000111000000000001000000000010010000000000000000000000"(this value equal -1150951111012646912), if we use Long.parseLong(s, 2), we got "
java.lang....
-2
votes
2
answers
81
views
Python: Access elements of a binary string as if there are no spaces between
I have a list of couple like this ('01 0 00 0',key0), ('01 0 11 0',key1), ('01 0 11 1',key2) and I would like to pick the elements with only the third and fourth bit equal to 1. So for example in this ...
0
votes
1
answer
73
views
does casting to a str decode a bitwise string
observe the following
signature = rsa.sign(str(message), private_key, 'SHA-1')
see how message is being casti to a str
would that decode a bit wise string?
why I ask.
the code snippet above is being ...
0
votes
1
answer
1k
views
Vlang - convert int, u32, u64, f32, f64, etc. to array of bytes in LittleEndian format
I have various variables of different numeric datatypes(int,u32,u64,f32,f64, etc) and want to convert them to an array of bytes.
For example:
a := 120 // int datatype
a_bytes = some_function(a) // ...
0
votes
2
answers
2k
views
How can I upload a file that is a binary string to Amazon S3 using a signed URL and JavaScript?
I am not having any trouble getting the signed URL, and the file is actually getting uploaded to S3, but when I download the file I can't open it. I have tried PDF and image files.
I get the file ...
0
votes
1
answer
334
views
parameter substitution in a binary string in python
Python 3
I want to send a binary string over a socket. I am using
socket.send(b"Hello from {0}",client_id)
however I find the it is not properly substitution clientid.
what am I doing wrong? ...
1
vote
1
answer
2k
views
Given a string which contains only ones and zeros, return the number of substrings with ones more than zeros
Suppose that S is a string containing only 0 and 1. I would like to count the number of not null substrings of S in which the number of 0s is less than the number of 1s.
Using brute-force method given ...
5
votes
4
answers
2k
views
Reduce binary string to an empty string by removing subsequences with alternative characters
This was a question asked in the coding round for NASDAQ internship.
Program description:
The program takes a binary string as input. We have to successively remove sub-sequences having all characters ...
0
votes
1
answer
115
views
Check boxes values returned and added to string
I am trying to take a row of checkboxes in a table and for each TD in the table it needs to check if the checkbox is ticked, is so it is a 1 and else its 0.
I need a for loop where I will be able to ...
5
votes
2
answers
6k
views
How do I convert an array of integers to binary?
for (int i = 0; i < n; i++) {
arr[i] = scanner.nextInt();
}
String[] bin = new String[n];
for (int i = 0; i < n; i++) {
bin[i] = Integer.toBinaryString(arr[i]);
}
The above code will ...
1
vote
1
answer
3k
views
search for a binary string in binary file with python
Hi all am searching for a binary string in binary file using the python
my binary file looks like a as follows.
I want to find the bold text below.
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ...
1
vote
1
answer
1k
views
Python: Given 2 binary strings s and t, print minimum number of adjacent swaps to convert s to t
For example if s = "1000000111" and t = "0111000001" the output should be 11. Below is my solution but it gives a time limit exceeded error so I am looking for a faster method. The ...
-2
votes
2
answers
1k
views
2 binary strings. The function will multiply these two arguments and return the result as a binary string
And Write a JS function that takes 2 arguments: 2 binary strings. The
function will multiply these
two arguments and return the result as a binary string.
Note_: A binary string is a ...
0
votes
0
answers
577
views
How do I solve the below problem without reverse engineering the sample test cases
I solved the problem below Binary String Problem in Hackerearth the problem which says "Given four integers x,y,a and b. Determine if there exists a binary string having x 0's and y 1's such that the ...
0
votes
1
answer
63
views
NumberFormatExceprion for binary string
I'm trying to get int from String "11010001110011000000000111111110" with code:
int n = Integer.parseInt("11010001110011000000000111111110", 2);
but i get an error:
Exception in thread "main" java....
0
votes
1
answer
555
views
PHP: How to save binary string in MySQL 5.7
How can I convert this binary string:
b"iphonée@3,;= ÑÑñe x"
To normal string?
I really need to have that string as a normal string, and not as a binary string.
I am having problems saving in MySQL ...
0
votes
1
answer
467
views
PHP: How to convert binary string into normal string in order to avoid MySql "Illegal mix of collations" error
I am having lot of problems processing CSVs with ñ,é, and all of those non ASCII chars, and saving those words in MySQL.
In order to solve this I created a CSV that contains in one cell this data:
...
-2
votes
1
answer
1k
views
Uniformly randomly sample binary strings of length N when N is large
I wish to generate a random binary string of length N such that each of the possible 2^N strings is uniformly randomly chosen. Note that choosing 1 or 0 with equal probability to build a string doesn'...