Questions tagged [binary-string]

21 questions
0
votes
1 answer

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.lang.NumberFormatException: For input string:…
0
votes
1 answer

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 this binary string. If the CSV that I decode does…
Joaquin Colella
  • 142
  • 1
  • 1
  • 11
0
votes
1 answer

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: iphonée@3,;= ÑÑñe x I know that if I can save this…
Joaquin Colella
  • 142
  • 1
  • 1
  • 11
-2
votes
2 answers

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 case I'll get ('01 0 11 0',key1) and ('01 0 11…
-2
votes
2 answers

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 sequence of bytes, such as `"1001001100"` …
rupesh raj
  • 17
  • 5
-3
votes
1 answer

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't work because with high probability the string…
Peaceful
  • 4,920
  • 15
  • 54
  • 79
1
2