binary

Help with JavaScript self-extending bit adder

Hey guys, today i was inspired by a 16 bit ALU made in Mincraft to try and make my own self-extending adder. I literally started JavaScript today, and have been playing around with logic gates over the past couple days. So I am very new to this. Here is my code so far. <html> <body> <script type="text/javascript"> funct...

Binary Tree Depth Problem

I read a few other articles on here that looked similar, but didn't quite answer my problem. I've been given a question for an assignment to assign every node in a binary tree its respective depth. I just can't quite get it. For reference this is my code: struct treeNode { int item; int depth; treeNode *left; treeNode *right...

How to sign a binary as part of post build step using sn.exe from Windows SDK?

Hi all, I am a totally unfamiliar in this C# Visual Studio programming environment but I am required to finish a task. I am sorry if my question seems silly. But I really could not understand what other posts on this site or other site on the net explaining. I need a step by step guide to do this final step to accomplish my task. I h...

How could I encode a string of 1s and 0s for transport?

For a genetic algorithm application, I'm using a whole load of binary strings. Most of the time they literally take the form of 01001010110, so that they can be mated, mutated and "crossed-over". For transport and storage however, this seems wasteful. What's the simplest way to encode this as a shorter string? I'm guessing this is pret...

binary sequences and floating point IEEE 754 what???

I HAVE NO IDEA what this means please help anyone? With 32-bit binary sequences x = 0100 0110 1101 1000 0000 0000 0000 0000 and y = 1011 1110 1110 0000 0000 0000 0000 0000 representing single precision IEEE 754 floating point numbers, perform following arithmetics and show the results in both normalized format and IEEE 754 sin...

Binary operation, need help

Hi I am about to create a function for a program, this is part of a program and is meant to be a bitmap that holds controls of which memory address is free for use (this has nothing to do with this function to do). The bitmap is bit[64] which holds 8 x 64 bits, the function under is taking a parameter number that is the number of data b...

binary to NAND gate - boolean algebra

I am taking a digital logic class and i am trying to multiply this binary number. I am not sure what a carry in is and a carrry out. the teachers slides are horrbile. It appears he used a truth table to do this but its confusing. X1X0 + Y1Y0 ---- Z2Z1Z0 I think thats how its set up! Now, for the multiplication part 1 ca...

Reading and interpreting data from a binary file in Python

Hi, i want to read a file byte by byte and check if the last bit of each byte is set: #!/usr/bin/python def main(): fh = open('/tmp/test.txt', 'rb') try: byte = fh.read(1) while byte != "": if (int(byte,16) & 0x01) is 0x01: print 1 else: print 0 ...

What's a sensible way to represent a binary genome for a genetic algorithm?

My previous question belied my inexperience and was based on an assumption. Now I am much wiser. (Put 1s and 0s in a string? Pah! I laugh at the suggestion!) My question is then, how should I encode my genomes? On paper, they look like this: 01010011010110010 17 bits that encode (in some cases singly and in some cases as groups) the...

Reading a Java Object in PHP from a file created with ObjectOutputStream.

I'm trying to read a file that was created in a Java-based game using ObjectOutputStream in PHP. The data is a serialized object written in a binary format. I've been using fopen and fread to get the binary data, but I have absolutely no idea what to do with it. ...

How can I efficiently convert a large decimal array into a binary array in MATLAB?

Here's the code I am using now, where decimal1 is an array of decimal values, and B is the number of bits in binary for each value: for (i = 0:1:length(decimal1)-1) out = dec2binvec(decimal1(i+1),B); for (j = 0:B-1) bit_stream(B*i+j+1) = out(B-j); end end The code works, but it takes a long time if the length of th...

Bitmap in C, binary operations

Hi I am about to create a bitmap that holds control of 512 bits, all 512 bits should be 0 to indicate that the bit is free when the program starts. Function occupyDataBlocks(int number) should find free bits put the position of the bit in the array int data_blocks[] and set the occupied bit to 1. Under is some code that does some of t...

How to convert float number to Binary?

Hello, Can anyone please tell me how can I convert this float number: 12,25 to binary? I know how to convert the "12" but not the 0.25 Any help is much appreciated. Thanks ...

C Program - Build an index file from another file

I have a .bin file that contains records in CSV format what I want to do is assign each record in the bin file a sequence number. So the first record in the bin file would be assigned 0 and so on. These will be placed into a bianry index file such as (username, seq #). If I have the bin file already created with records in it, how d...

Sign extending from a constant bit width in C#

Guys, I have a value thats 5 bits in length. 4 bits determine the number and the 5th bit determines the sign, there by holding any value between -16 and +15. How can I accomplish sign extending from a constant bit width in C#? I know in C, I can use something like the follow to accomplish this: int x; // convert this from using 5 bits ...

Can we submit dual binary file ( of the same app) to apple app store, one for OS 3.x and another for IOS 4.x?

Hello, Can we submit two binary files of a same iphone application to App store? One specific to OS 3.x and another specific to iOS 4.x. Thanks in advance. ...

Reversing an old file format Inbox X

I’m trying to reverse engineer an old medical imaging format called Stentor for interoperability. It was designed by a company of the same name who was subsequently bought by Phillips. But Phillips has forgotten how to read Stentor files. I have a windows program which exports JPEG from Stentor files but it’s closed source. I’d like to a...

Distributing a RubyQt app

I've written a simple ruby application with Ruby Qt. I recently read about distutils in python, and now I'm trying to figure out how to do something similar in ruby. I do not need to distribute on any OS besides linux, but I'm trying to figure out the best way to do that. Should I figure out how to build a .deb? If so how do deal with t...

Download server with ASP.NET how to accomplish long running synchronous requests ?

My ASP.NET application is a download application (no pages) which reads huge binary files (1-2 GB -> over 1 hours download time with resume support) from local network and stream them to web clients (each request -> one large binary response, so there's no text/html response at all). I use a HTTP Handler (.ashx) instead of a (.aspx) page...

What are some good resources for learning binary and using PHP with binary?

I want to learn to parse certain files (such as MPQ) and I need to learn binary and how to handle it with PHP. Could you guys please kindly suggest me resources for learning such things ( books, anything)? Edit: I have tried unpacking the file before, but all the numbers just looks like gibberish to me and I do not know how to comprehen...