Altair 8800 data and instructions

Recently I have been playing around a little with a Altair 8800 emulator to understand the basics of computing, and I was wondering how does the processor "know" if a byte is an instruction or data?The processor doesn't know if a byte is an inst

Reading binary data in std :: string c ++

I am trying to read data from binary file to an std::string.Here is what I have tried at first. #include <iostream> #include <string> #include <fstream> using namespace std; int main(int argc, char const *argv[]) { fstream file("out

How to convert extracted LSB data to text or binary to text

UPDATE*********************** For reference I included the program I made for opening a PPM image - embedding a message into the image and then saving out a new image with the embedded text. With the function below I'm hoping to extra that message, (

C ++ convert a long hexadecimal string to binary

I found similar solution here: Missing punctuation from C++ hex2bin and use that answer: std::string hex2bin(std::string const& s) { std::string sOut; sOut.reserve(s.length()/2); std::string extract; for (std::string::const_iterator pos = s.begin();

Binary and point decimal conversion to loop on IP addresses

I am trying to loop over the ip addresses in a subnetwork to print them along with the DNS names of hosts. I have the network mask and an ip address that belongs to it. Since I need to use some "networking functions: inet_addr, and gethostbyaddr"

Subtraction in assembly 8086 sets erroneous flags

I am trying to do a simple math calculation. Here is my code: mov al, 128 sub al, -128 I need to know which flags are set by the sub instruction. My calculations are like this. Starting with the idea that sub is the same as +(- your number). Starting

Matlab vector to its binary representation

I have a vector like A: 1 3 7 8 I would like to construct a binary vecor such as B (1 2 3 4 5 6 7 8) (1 0 1 0 0 0 1 1)You can use just indexing: B = zeros(1, max(A)); B(A) = 1; Or use sparse: B = full(sparse(1, A, 1)); These approaches don't require

Output Error: Binary in Decimal Java

The aim of my code was to convert binary numbers(String)n to decimal form This program segment compiled succesfully but the output is coming way bigger than expected. Need some help.Thanks in advance public class bindecstr { public static void main(S

binary search from the text exercise

Write a program the reads whole numbers from a text file and then sorts the numbers. Then using the binary search algorithm from your notes (week6) Ask the user to enter a number and display what position the number is or not found if the number is n

Reveal the entire binary in jquery

I would like to know how is it possible for jquery to show the whole binary of a number and not take away the leading zeros. Take a look at the code: In HTML: <input id="input" type="text" size="20"> <input id="

How to quantitatively evaluate the binary difference?

I know some binary diff tool like VBinDiff and others. Currently I have a large number of binary, around 500. So I am looking for a binary tool to quantitatively evaluate the difference of binaries.. Like evaluate the difference of binary 10 and bina

how to insert a hexadecimal value into a char hex array

I have a loop let say from 1 to 32. 1 to 32 are decimal in this case. I have to insert the hex value of 1 to 32 in an unsigned char array and then perform send. My code looks like this char hex[3]; unsigned char hexunsigned[3]; int dec; int i=0; do {

Exporting Files - Strange Characters

I've been asked to replicate a file sent by the following Excel VBA code. The problem is with the export of the data contained within the "for" loop. The quantity ".111" is being written in the export file as "øSã=", ".2

How to convert a binary! to a chariot! in Rebol 2?

It's easy to convert a char to a binary: >> c: #"^(52)" == #"R" >> type? c == char! >> b: to-binary c == #{52} But what if I want to go the other way? >> c: to-char b ** Script Error: Invalid argument: #{52} **

Python 3.3 binary to the hexadecimal function

def bintohex(path): hexvalue = [] file = open(path,'rb') while True: buffhex = bufflen = len(buffhex) if bufflen == 0: break for i in range(bufflen): hexvalue.append("%02X" % (ord(buffhex[i]))) I am making a function that will r

How could I write & ldquo; hi world & rdquo; in binary?

Suppose I wanted to write a program to display "hello world", and I wanted to write it in binary. How could I do this? I have some idea that: I'd need to determine what chip architecture I'm using I'd need to find out what kind of binary it uses

Erlang and binary with Cyrillic

I need to be able to use binaries with Cyrillic characters in them. I tried just writing <<"абвгд">> but I got a badarg error. How can I work with Cyrillic (or unicode) strings in Erlang?If you want to input the above expression in e

How to solve this bizarre multiple loop scenario (Java or C #)?

I've got this - possibly trivial - loop/combinations problem similar to binary combinations. I don't know how to approach it efficiently. Consider this scenario, I need unique loop to pass through all these combinations in a sequence: Round ABC 01. 0

Binary representation in C

In C why is there no standard specifier to print a number in its binary format, sth like %b. Sure, one can write some functions /hacks to do this but I want to know why such a simple thing is not a standard part of the language. Was there some design

Understanding the javascript binary analyzer

In looking at this question I was trying to figure out this function _shl: function (a, b){ for (++b; --b; a = ((a %= 0x7fffffff + 1) & 0x40000000) == 0x40000000 ? a * 2 : (a - 0x40000000) * 2 + 0x7fffffff + 1); return a; } I figured out the javascri

PHP reads the binary file in real binary

I searched google for my problem but found no solution. I want to read a file and convert the buffer to binary like 10001011001011001. If I have something like this from the file bmoov���lmvhd�����(tF�(tF�_� K�T���������������������������������������

How can I send data in binary form on a Java socket?

I've seen lots of examples of sending serialized data over sockets in Java, but all I want is to send some simple integers and a string. And, the problem is I'm trying to communicate these to a binary written in C. So, bottom line: how can I just sen

How to encode a binary file in JPG format?

I would like to be able to take a stream of 1's and 0's and convert it to a format that jpg can read, I.E. suppose I wrote a program and compiled and got an exe, then took and ran the 1's and 0's from the exe through said program, it would produce a

Binary Plist Serialize / Deserialize Using C #

I have an iPhone client talking to a Windows server written in C#.The data from the device is sent as a binary plist.I am looking for a framework in C# that understands the binary plist and converts it into a dataset. On googling, I ran into plutil b