binary

Convert IP address string to binary in Python

As part of a larger application, I am trying to convert an IP address to binary. Purpose being to later calculate the broadcast address for Wake on LAN traffic. I am assuming that there is a much more efficient way to do this then the way I am thinking. Which is breaking up the IP address by octet, adding 0's to the beginning of each oct...

UNIX—ASCII files appear to be binary

I've just tried to hg diff some C source files and was told that they are binary. So, my question is: How can I convince UNIX and Mercurial that these files are, in fact, ASCII? Thanks in advance for your help. ...

Changing checksum of a binary

How to modify checksum of a binary? Specifically, I want to edit embedded checksum in a dll/exe. Are there any tools available? ...

What is the fastest way to do division in C for 8bit MCUs?

I am working on the firmware for a device that uses an 8bit mcu (8051 architecture). I am using SDCC (Small Device C Compiler). I have a function that I use to set the speed of a stepper motor that my circuit is driving. The speed is set by loading a desired value into the reload register for a timer. I have a variable, MotorSpeed that ...

Convert a raw string to an array of big-endian words with Ruby

Hello, I would like to convert a raw string to an array of big-endian words. As example, here is a JavaScript function that do it well (by Paul Johnston): /* * Convert a raw string to an array of big-endian words * Characters >255 have their high-byte silently ignored. */ function rstr2binb(input) { var output = Array(input.lengt...

printing double in binary

In 'Thinking in C++' by Bruce Eckel, there is a program given to print a double value in binary. (Chapter 3, page no. 189) int main(int argc, char* argv[]) { if(argc != 2) { cout << "Must provide a number" << endl; exit(1); } double d = atof(argv[1]); unsigned char* cp = reinterpret_cast<unsigned char*>(&...

CORE Keygen Problem

Hi, after fighting several versions of the CoreKeyGen created by some "minamoto" guy, a new version has appeared. This version is particularly sophisticated and seems to modify the actual binary itself, using a dylib known as libbassmod.dylib (this is in the keygen's mac os folder). Has anyone ever come across this & can give me advic...

How do you read data from a ADODB stream in ASP as byte values?

I have an ASP routine that gets a binary file's contents and writes it to a stream. The intention is to read it from the stream and process it st the server. So I have: ResponseBody = SomeRequest (SomeURL) ; var BinaryInputStream = Server.CreateObject ("ADODB.Stream") ; BinaryInputStream.Type = 1 ; // binary BinaryInputStream.Open ; ...

Getting access to a binary response byte-by-byte in classic asp/JScript

I asked this question a few days ago but it seems to have gone cold fairly quickly. What I want to do is pretty simple and I can't believe someone hasn't figured it out. Solution needs to be JScript classic ASP. I am reading a file from a remote server and I want to process that (binary) file on my server and spit the results back to ...

division by 2 in Binary Signed digit (Redundant Binary representation)

How can I do division by 2 in Binary Signed digit (Redundant Binary representation) ? Shifting won't work right ? ...

Comparison in Redundant binary representation RBR

How can I compare two numbers in the form of Redundant binary representation RBR ? Any Idea ? ...

Binary file email attachment problem

Hi there, Using Python 3.1.2 I am having a problem sending binary attachment files (jpeg, pdf, etc.) - MIMEText attachments work fine. The code in question is as follows... for file in self.attachments: part = MIMEBase('application', "octet-stream") part.set_payload(open(file,"rb").read()) encoders.encode_base64(part) part...

How would I convert decimal into binary?

All I really know is PHP and I used the decbin function etc, It was fairly easy to do. In this C++ program I want to do the same thing, just a simple number or string how would I do this? ...

Output integral to ostringstream as binary?

I just realized that one can use bitset to output binary data to a stream based on the (fixed) size of the bitset. What's the least-extra-syntax way to output binary data to a stream using integrals? To show what I mean, here's a program and its output. I'd like the second line of output from this program to be identical to the first li...

How do I convert decimal numbers to binary in Perl?

I am trying to make a program that converts decimal numbers or text into binary numbers in perl. The program asks for user input of a character or string , and then prints out the result to the console. How do I do this? My code I have been working on is below, but i cannot seem to fix it. print "Enter a number to convert: "; chomp($dec...

C syntax or binary optimized syntax?

Let's take a simple example of two lines supposedly doing the same thing: if (value >= 128 || value < 0) ... or if (value & ~ 127) ... Say 'If's are costly in a loop of thousands of iterations, is it better to keep with the traditional C syntax or better to find a binary optimized one if possible? ...

binary operator "<"

Consider this expression as a "selection" control structure on integer "x": 0 < x < 10, with the intention that the structure returns TRUE if "x" is in the range 1..9. Explain why a compiler should not accept this expression. (In particular, what are the issues regarding the binary operator "<"? Explain how a prefix operator could be ...

I need an efficient protocol between webservices that are more or less supported by all major languages

Hey all. I am looking for a fast and efficient protocol that can be used between different web services to send text-data (not binary data). Doesn't matter if the protocol is binary or text base. Some conditions: I has to be more "efficient" than normal XML which adds a lot of extra data and the tools to read/write is too heavy It h...

binary files writing/reading problems...

Ok i have problem with my code for reading binary file... First i will show you my writing code: void book_saving(char *file_name, struct BOOK *current) { FILE *out; BOOK buf; out = fopen(file_name, "wb"); if(out != NULL) { printf_s("Writting to file..."); do { if(current != NUL...

How to use gcc 4.5?

http://gcc.gnu.org/install/binaries.html This page has the binaries. Which one would work for Fedora? ...