Is it safe to use -1 to set all bits to true?
I've seen this pattern used a lot in C & C++. unsigned int flags = -1; // all bits are true Is this a good portable way to accomplish this? Or is using 0xffffffff or ~0 better? ...
I've seen this pattern used a lot in C & C++. unsigned int flags = -1; // all bits are true Is this a good portable way to accomplish this? Or is using 0xffffffff or ~0 better? ...
I am learning Ruby and thought of making a Binary->Decimal converter. It gets a binary string and converts to decimal equivalent. Is there a way to keep track of the current iteration step in ruby so that the variable 'x' can be removed? def convert(binary_string) decimal_equivalent = 0 x=0 binary_string.reverse.each_char...
Consider the set of strings S that contains the binary representation of the numbers 0 to 99. What is the shortest string T such that every element of S is a substring of T? ...
Hello, Is it possible to check remotely (no local/FTP access) a URL to see if the webpage (file) was uploaded/created as binary or ascii? Thanks, Roy. ...
I have 3 base representations for positive integer numbers: Decimal, in unsigned long variable (e.g. unsigned long int NumDec = 200). Hex, in string variable (e.g. string NumHex = "C8") Binary, in string variable (e.g. string NumBin = "11001000") I want to be able to convert between numbers in all 3 representations in the most effici...
I am trying to parse some .txt files. These files serve as containers for a variable number of 'children' files that are set off or identified within the container with SGML tags. With python I can easily separate the children files. However I am having trouble writing the binary content back out as a binary file (say a gif or jpg). ...
I have barely squeaked by my last cs class and now I am in data structures. I am building a binary tree structure from scratch and I am a little confused on how the iterator will work. I understand how they work in double linked lists, but am not sure how this one will work................ thanks. ...
Say I want to count in binary until I have the highest number a set number of bytes will hold, how could I do that? It feels like there should be a pretty simple way, I just don't know it. I googled but was surprised to not find any examples. For example, if I wanted to count to 1 byte I'd start with 00000001 add 1 and get 00000010, add...
Hello, I have a binary file with variable length record that looks about like this: 12 economic10 13 science5 14 music1 15 physics9 16 chemistry9 17 history2 18 anatomy7 19 physiology7 20 literature3 21 fiction3 16 chemistry7 14 music10 20 literature1 The name of the course is the only variable length record in the f...
I am writing a C++ application and I was wondering what the C++ conventional way of storing a byte array in memory. Is there something like a string, except specifically made for binary data. Right now I am using a *unsigned char** array to store the data, but something more STL/C++ like would be better. ...
I'm interested in precisely extracting portions of a PCM WAV file, down to the sample level. Most audio modules seem to rely on platform-specific audio libraries. I want to make this cross platform and speed is not an issue, are there any native python audio modules that can do this? If not, I'll have to interpret the PCM binary. Whi...
Our Delphi 7 development team stores form files (dfm) in text mode, and uses a source control system (Subversion) to track changes. Sometimes, we noticed that a form file returned to binary format between revisions, causing diff tools like TortoiseMerge to complain. Using the Subversion change log, I can see that the DFM file was store...
I need a function that returns the ASCII value of a character, including spaces, tabs, newlines, etc... On a similar note, what is the function that converts between hexadecimal, decimal, and binary numbers? ...
How to check if the binary representation of an integer is a palindrome? ...
Was wondering what is the correct protocal for responding to an app rejection follow up through email. I've included my response with my argument that states their "reasons" for rejection are wrong via email. I also made sure that i made the necessary changes to the app, to 1) ensure there are no more bugs and 2)make sure it's 3.0 compl...
I am thinking of executing multiple instances of same java binary (a socket application) with different configuration files (As a command line parameter). Does the JVM correctly handles this situation? In other words If I haven't any common resources (Files that can be locked etc.) will this approach make any problems? If so what are thi...
I have a chunk of fairly random binary data. I want to find where that chunk exists in a file, how many times it occurs, and at what byte (or sector) offsets. Any ideas on how to do that? Thanks, Justin ...
I'm writing a JUnit test for some code that produces an Excel file (which is binary). I have another Excel file that contains my expected output. What's the easiest way to compare the actual file to the expected file? Sure I could write the code myself, but I was wondering if there's an existing method in a trusted third-party library (...
Similar to how you can define an integer constant in hexadecimal or octal, can I do it in binary? I admit this is a really easy (and stupid) question. My google searches are coming up empty. ...
Hi, Could somebody point me in the right direction of how I could read a binary file that is defined by a C struct? It has a few #define inside of the struct, which makes me thing that it will complicate things. The structure looks something like this: (although its larger and more complicated than this) struct Format { unsigned lon...