binary

How to check code generated by C++ compiler?

Hi, just like in topic - is there any software to open (what?) and here I don't even know what to open - file with object code or exe? My today's questions (if only todays ;)) may seem bit odd but I'm going through excersises in "The C++ Programming Language" by B.S. and sometimes I'm just stuck on particular question. I'm sometimes bit ...

Question on converting decimal to binary to hex

I'm a little confused here: I'm trying to reverse engineer the ASCII value 65. In the book I am reading it says: Decimal: 65 Hex: 41 Octal: 101 But 65 in its binary representation is: 0010 0001 And 0010 in hex is 2, while 0001 is 1, which indicates that the hex value "should" be: 21. Where did I go wrong? ...

Dictionary not deserializing

I'm having a problem where one Dictionary in my project is either not serializing or not deserializing. After deserializing, the data I serialized is simply not in the object. Here's the relevant snip of the class being serialized: class Person : ISerializable { private Dictionary<Relation,List<int>> Relationships = new Dictionary<...

Writing binary files using C++: does the default locale matter?

I have code that manipulates binary files using fstream with the binary flag set and using the unformatted I/O functions read and write. This works correctly on all systems I've ever used (the bits in the file are exactly as expected), but those are basically all U.S. English. I have been wondering about the potential for these bytes to ...

Convert PHP file to binary

Is it possible to convert a PHP file to binary and deploy it on a webserver.......... ...

Manipulate .NET bytecode - JIT regeneration?

Is it possible to manipulate the bytecode of a (signed) .NET program at runtime? E.g. by forcing the JIT to re-evalutate the IL? ...

Generate all binary strings of length n with k bits set

What's the best algorithm to find all binary strings of length n that contain k bits set? For example, if n=4 and k=3, there are... 0111 1011 1101 1110 I need a good way to generate these given any n and any k so I'd prefer it to be done with strings. ...

How to calculate decimal and hex values of one and two's complmement binary representation?

For an example, assume an initial value of: 0100 0011 What is this in hex and what is it in decimal if using two's complement? Similarly, what is it in hex and decimal if using one's complement? More generally, how do you work out the hex and decimal values of both forms of binary representation? ...

search a Binary search tree

I am trying to find a name within a key. I think it is retrieving it fine. however, its coming up as not found. maybe my code is wrong somewhere? if (database.retrieve(name, aData)) // both contain the match in main() static void retrieveItem(char *name, data& aData) { cout << ">>> retrieve " << name << endl << endl; if (database.re...

C++ binary file I/O to/from containers (other than char *) using STL algorithms

I'm attempting a simple test of binary file I/O using the STL copy algorithm to copy data to/from containers and a binary file. See below: 1 #include <iostream> 2 #include <iterator> 3 #include <fstream> 4 #include <vector> 5 #include <algorithm> 6 7 using namespace std; 8 9 typedef std::ostream_iterator<double> oi_t; 10 typed...

Problem searching a Binary Search Tree - Array Based

I am trying to search for a word using a key value recursively. In retrieve function: Problem is the index goes from 0, 1,3,7, to 15.... it suppose to go 0,1,3,7,8 and so forth I have the insert working as expected. I have the inorder, preorders, all working. Can someone please help me figure out this problem? I have been working on this...

why unsigned int 0xFFFFFFFF is equal to int -1?

perhaps it's a very stupid question but I'm having a hard time figuring this out =) in C or C++ it is said that the maximum number a size_t (an unsigned int data type) can hold is the same as casting -1 to that data type. for example see http://stackoverflow.com/questions/1420982/invalid-value-for-sizet Why?? I'm confused.. I mean, (t...

Need help with Binary Search Tree in C++

I'm trying to make a BST and need to print it inorder, postorder, and preorder The thing am not sure about is how to create this tree in my main() function. struct Tree_Node { Tree_Node *right; Tree_Node *left; int info; }; class bTree { private: Tree_Node *root; public: bTree(); void bTree::Insert(Tree_Node*& ...

Java: confirm method Binary division and find remainder is correct?

I am parsing binary files and have to implement a CRC algorithm to ensure the file is not corrupted. Problem is that I can't seem to get the binary math working when using larger numbers. The example I'm trying to get working: BigInteger G = new BigInteger("11001", 2); BigInteger M = new BigInteger("1110010000", 2); BigInteger R = M.r...

Algorithm for assigning a unique series of bits for each user?

The problem seems simple at first: just assign an id and represent that in binary. The issue arises because the user is capable of changing as many 0 bits to a 1 bit. To clarify, the hash could go from 0011 to 0111 or 1111 but never 1010. Each bit has an equal chance of being changed and is independent of other changes. What would you...

Why don't we send binary around instead of text on http?

It seems that binary would be more compact and can be deserialized in a standard way, why is text used instead? It seems inefficient and web frameworks are forced to do nothing more than screwing around with strings. Why isn't there a binary standard? The web would be way faster and browsers would be able to load binary pages very fas...

hex number of length 128 which is to be converted to binary in c#

private static string GetSHA512(string strPlain) { UnicodeEncoding UE = new UnicodeEncoding(); byte[] HashValue, MessageBytes = UE.GetBytes(strPlain); SHA512Managed SHhash = new SHA512Managed(); string strHex = ""; HashValue = SHhash.ComputeHash(MessageBytes); foreach (byte b in HashValue) { ...

Having trouble using the BinaryDerive.hs Script, for generating Binary instances

I'm trying to run the BinaryDerive.hs script as per the instructions in the Data.Binary doc, which states: To derive the instance for a type, load this script into GHCi, and bring your type into scope. Your type can then have its Binary instances derived as follows: $ ghci -fglasgow-exts BinaryDerive.hs *BinaryDeri...

How to Convert NSInteger or NSString to a binary (string) value

Anybody has some code in objective-c to convert a NSInteger or NSString to binary string? example: 56 -> 111000 There are some code in stackoverflow that try do this, but it doesn´t work. Thanks ...

How to parse a binary file using Javascript and Ajax

I am trying to use JQuery to pull a binary file from a webserver, parse it in Javascript and display the contents. I can get the file ok and parse some of the file correctly. How ever I am running into trouble with one byte not coming out as expected. I am parsing the file a byte at a time, it is correct until I get to the hex value B6 ...