I'm writing a client for a binary socket protocol in PHP, and it's a pain. I'm currently using pack to convert numbers into binary strings, but it's lacking. Two options pack has are:
Write a signed 32 bit integer in machine byte order
Write an insigned 32 bit integer in big endian byte order
But I need to write signed 32 bit integer...
I'm reading 8 bytes from a socket in PHP, and want to transform them into a 64 bit signed integer.
How can I do this in 64 bit PHP? unpack doesn't support 64 bit numbers
In 32 bit PHP, is there a way to make it into a string that can be used by BCMath?
...
Have you guys ever saved your information with binary masks to improve performance? This is my case and I am also using mongodb with rails to store and retrieve it.
I've used a pair of scopes using '&' and '|' to retrieve users with specific roles, but each time I run those scopes I get all the users regardless the roles... how could I ...
I've seen lots of examples of sending serialized data over sockets in Java, but all I want is to send some simple integers and a string. And, the problem is I'm trying to communicate these to a binary written in C.
So, bottom line: how can I just send some bytes over a socket in Java?
...
Hi Guys,
I have two G729 encoded files, i took the pcm version of them. i want to measure the similarity between these two files. these files are binary files so how one can measure the similarity between binary files, i wrote a code in C that takes patterns from the first one and search for similar ones in the second one, but i want to ...
I have a custom schema with my own object classes and custom attributes defined. I have some sample data imported in to OpenDS based on this schema and am facing a weird issue. One of the optional attributes for my object class is "File" which is of type "binary". When i try and manually add a file to any of the entries using the "edit" ...
Using six-bit one's and two's complement representation I am trying to solve the following problem:
12 - 7
Now, i take 12 in binary and 7 in binary first.
12 = 001100 - 6 bit
7 = 000111 - 6 bit
Then, would I then flip the bit for two's complement and add one?
12 = 110011 ones complement
+ 1
-------
001101
7 ...
I just cloned an old repository containing some linux kernel modules (don't ask).
If I clone on a linux machine, everything is fine. On my Mac however, someone (presumably Mac OS X) makes binary changes to the modules. I already disabled autocrlf.
Here's the output of git diff -p --stat directly after clone:
.../kernel/net/ipv4/netfil...
I want to split data to chunks of let's say 8154 byte:
data = Zlib::Deflate.deflate(some_very_long_string)
What would be the best way to do that?
I tried to use this:
chunks = data.scan /.{1,8154}/
...but data was lost! data had a size of 11682, but when looping through every chunk and summing up the size I ended up with a total s...
I'm going to make a computer in Minecraft. I understand how to build a computer where it can make binary operations but I want the outputs to be displayed as standard integer numbers. How you "convert" the binaries into standard digits? Is there any chart for that? And the digits will be shown like in old calculators; with 7 lines.
--
...
Consider an ASP.NET page with this code:
while (read)
{
Response.OutputStream.Write(buffer, 0, buffer.Length);
Response.Flush();
}
The application should be highly performance-tuned and handle thousands on concurrent requests and the main purpose is transferring huge binary file to clients over high speed connections. I can do t...
Hi, I'm going to write System.Data.Linq.Binary value to MemoryStream and perform some manipulations, then re-write new values from MemoryStream to Binary! how to do?
Thanks in advance ;)
...
I am trying to learn Binary Multiplication, 2's complement negative numbers.
-10
x 3
I know there is a simple way of doing this. Like sign extension and initial partial product.
-10 0110 twos complement
x 3 x 0011
---- ------
000000 (initial partial product) with sign extension at the MSB
10110...
Given a file (binary or textual), what is the fastest or most elegant way in C++ to count the ones and zeros in the binary representation of that file?
...
I know base 13 is not practical. However, i was checking out The Hitchhiker's Guide to the Galaxy again because todays date is 10/10/10 = 42 in binary. (you know, the answer to the ultimate question of life, the universe, and everything) It takes Deep Thought 7½ million years to compute and check the answer, which turns out to be 42. U...
hi, my question is can directsound play raw binary sound file witout a wav. header
the thing is i took a binary file encoded in U-law ive decoded(PCM) it and now i need to play it.
it lacks a header so can a directsound play the decoded file.
...
Well my question is simple and straightforward.
Is there any way we can use hex values like in c++?
I am going to write binary files, but for that i will have to define certain characters like this for example.
\x00\x00\x11\x22\x33\x00\x00
I would first need to convert stuff like this to a byte array, and then write it to a binary te...
I am reading the book art of assembly language. There I came across this paragraph.
If the H.O. bit is zero, then the number is positive and is stored as a
standard binary value. If the H.O. bit is one, then the number is
negative and is stored in the two’s comple-ment form. To convert a
positive number to its negative, two’s co...
I am reading a book on assembly languages. I came across these sentences in that book.
Consider the value “-64”. The eight bit two’s complement value for this number is
0C0h. The 16-bit equivalent of this number is 0FFC0h.
I can't understand these two sentences. Can anybody show me how -64's eight bit 2's complement is 0c0h? And how ...
I was trying to learn more about bits, and I came across this example.
How does this code work to count the bits? (My C is very rusty, by the way).
unsigned int v; // count the number of bits set in v
unsigned int c; // c accumulates the total bits set in v
for (c = 0; v; v >>= 1)
{
c += v & 1;
}
...