binary

SQL Server numeric format

When I do the following: DECLARE @x float SET @x = 1234.5 SELECT CONVERT(varbinary, @x) What is the returned format? I need to get the original number back from .net somehow, and I only have the binary value available. Clarification: The statement above returns (no column name) 0x40934A0000000000 Somehow, I must get the value 123...

Binary Counting : How many values can be represented w/ 9 bits?

I fear that I may be over thinking this homework question that I have for my assembly course. It reads: How many different values can be represented in 9 binary digits (bits)? My thinking is that if I set each of those 9 bits to 1, I will make the highest number possible that those 9 digits are able to represent. Therefore, the highest...

Black-box counting to 19 with only 2 bits, and only toggleable?

Some student asked this on another site, but got no answers. I had a few stabs at it, but found it pretty tricky. Doing it with just the switches would require a 9:1 compression ratio, so I guess the trick is very much in the rules you assign to students. Perhaps every student needs a different set of rules? I've thought about allowin...

How to output the Binary value of a variable in C++

I've got a homework assignment in my C++ programming class to write a function that outputs the binary value of a variable's value. So for example, if I set a value of "a" to a char I should get the binary value of "a" output. My C++ professor isn't the greatest in the whole world and I'm having trouble getting my code to work using th...

Crating dictionary with binary search tree and hashing

I’m about to create a "smart" dictionary that could generate similar words if the word from the user is not in the dictionary. The dictionary starts with reading a file with words, the word should be added to the binary tree and a hash table. The hash table is used to determine if the word or similar word is in the dictionary, the hash ...

How to read the C++ CLI .obj files (result of compilation of a single file).

I have a small (<300 lines) C++ file in a C++ CLI project in Visual Studio 2010. I have crafted some macros which do different things depending on the Debug/Release configurations. I would like to be able to look at the resulting .obj files (when I compile in Debug and Release) and be able to compare the two. The hard part is that files...

does order of members of objects of a class have any impact on performance?

May order of members in binary architecture of objects of a class somehow have an impact on performance of applications which use that class? and I'm wondering about how to decide order of members of PODs in case the answer is yes since programmer defines order of members via order of their declaraions ...

Array to Hex Representation

I am writing a program that needs to take an array of size n and convert that into it's hex value as follows: int a[] = { 0, 1, 1, 0 }; I would like to take each value of the array to represent it as binary and convert it to a hex value. In this case: 0x6000000000000000; // 0110...0 it also has to be packed to the right with 0's t...

Why Does C++ Support Hex Assignment, But Lack Binary Assignment? How best to store flags?

I have a set of bit flags that are used in a program I am porting from C to C++. To begin... The flags in my program were previously defined as: /* Define feature flags for this DCD file */ #define DCD_IS_CHARMM 0x01 #define DCD_HAS_4DIMS 0x02 #define DCD_HAS_EXTRA_BLOCK 0x04 ...Now I've gather that #defines for constant...

Binary trees in C++ using references

I wish to implement a binary tree using references instead of using pointers (which is generally what you tend to find in every book and every website on the internet). I tried the following code: class tree_node { private: tree_node& left; tree_node& right; data_type data; public: void set_left(tree_node&); // ... o...

Redrawing Binary Tree Using Given Traversals

Hello, I am not understanding how to draw a Binary Tree give traversals. Could someone explain to me inorder, preorder, and postorder traversals in a more efficient way? For example: Reconstruct the exact BINARY tree given the following traversals: Inorder: 9, 2, 10, 6, 5, 8, 3, 1, 4, 7 Post order: 9, 10, 2, 6, 8, 3, 7, 4, 1, 5 Any h...

a single C function to write data as text or binary

Hi all, I have a C function that writes some data to a text file. The data consists of floats, ints and strings. it looks something like this: writeAsTextFile( mystruct_t* myStructWithIntsFloatsAndStrings , const char* fileName); for doing this I use calls to fprintf; Now I would like to write the same data but as binary. I could...

Understanding Java bytes

So at work yesterday, I had to write an application to count the pages in an AFP file. So I dusted off my MO:DCA spec PDF and found the structured field BPG (Begin Page) and its 3-byte identifier. The app needs to run on an AIX box, so I decided to write it in Java. For maximum efficiency, I decided that I would read the first 6 bytes ...

How do you output binary representation of floats?

Hello, I am new to programming, I've done web development, but I am currently trying to learn real programming. The question I have is already answered here. union ufloat { float f; unsigned u }; ufloat u1; u1.f = 0.3f; What I don't get is how it works. What does the 0.3 part do? I couldn't find it in my text. And how does this ...

Does anyone know an efficient way to rotate a 32 * 32 bit matrix by 90 degrees in C#?

Possible Duplicate: How do you rotate a two dimensional array? I have 32 Int32's. Picture this as a block of 32 * 32 bits. I need to rotate this block of bits 90 degrees clockwise. What's the most efficient way to do this in C#? ...

Library for Graphing Binary Heaps?

I am doing research with the graphs of binary heaps, and could really use an effective library that can graph binary heaps. I have found a couple different pieces of software (not libraries) that can do this, but some had display problems with large numbers of elements and others could not handle large numbers of elements at all. I wou...

How can I get the function sinatures from a jar file?

In Eclipse or NetBeans, when you "control + click" into a function, you can at least see its entire signature, even if it's in a jar file. I am wonderging if it's possible to write a tool to pull out all the function signatures from a jar file. Is there any API for this? I know jDepend seems to offer functions for this. However, I beli...

Ruby string to raw binary

Hey everyone, in PHP there is the hash() function that can return raw binary data. http://de2.php.net/manual/en/function.hash.php I want to do the same in Ruby. How do I do that? I generate the hash with: h = Digest::SHA2.new(512) << "hashme" PHP generates 32 byte of "raw binary output". ...

How should binary operators be defined in bison?

I'm writing a parser in C with bison, and while it appears to work correctly in all circumstances I've tried so far, I get a bunch of shift/reduce warnings on my binary operators (and one on my unary NOT operator as well). binary_op : PLUS { } | MINUS { } | TIMES { } | SLASH { } | POWER { } | AND { } ...

Run native binary CGI on lighttpd

Hello, I'm trying to set up lighttpd to run binary CGI app (not PHP script or smth, but a binary file, compiled from C++ source). I actually have server.modules = ( ... "mod_cgi" ... ) uncommented, have myApp.exe in htdocs/app, and also cgi.assign = ( "myApp.exe" => "myApp.exe" ) Then, to make all the stuff work by accessing, say, ...