binary

Coverting String Decimal to Binary and Hexa in Assembly 8086

陌路散爱 提交于 2021-01-29 16:14:29
问题 I'm trying to convert a string I read with this code to binary and hexa. READ_STRING: MOV DX, offset buffer MOV AH, 0Ah INT 21h MOV SI, 1d MOV AX, 0 XOR CX, CX MOV CL, buffer[SI] INC SI LOOP_1: MOV DX, 10 MUL DX MOV DL, buffer[SI] SUB DL, 30h MOV DH, 0 ADD AX, DX INC SI LOOP LOOP_1 RET So far I have this code for binary output but it always prints "1001" (9 in decimal): NEXT: XOR AX, AX XOR BX, BX XOR CX, CX MOV CL, 2 MOV AL, byte ptr[nombre] MOV DI, offset binaire ; DIV : divide AX by CL.

Why my levenshtein distance calculator fails with PDF file?

时光怂恿深爱的人放手 提交于 2021-01-29 09:44:14
问题 I'm trying to create a program that calculate edit distance between two files. I read with the funcution fread and I use the code to read binary ("rb"). I put in input two PDF files and during the debug I found out that when I try to fill the matrix of the Levenshtein distance algorithm I get a "SIGSEGV (Segmentation fault)" at char n° 1354 of the first file and the program exit with: Process finished with exit code -1073741819 (0xC0000005) I controlled and char n° 1354 is \n . The code that

How to represent a 5 digit decimal value as a 24 bit value?

走远了吗. 提交于 2021-01-29 09:20:26
问题 I'm trying to convert a 5 digit decimal value (ranging from 00001 to 99999) and somehow represent it as a 24-bit value split into 3 bytes but have tried every conversion and bitshift tactic I know, but keep getting stuck :/ Example: decimal value is 12345, and I need to send 3 hex values [aa][bb][cc], which would consist of: [aa] - least significant | [bb] - middle | [cc] - most significant I'm hoping I'm not in over my head and that there is a simple answer, thanks in advance! 回答1: Try

Reading serial interface with Python returns distorted data

核能气质少年 提交于 2021-01-29 09:19:49
问题 I am trying to read binary serial port using Python. Each source message consists of 3 floating point values, 12 bytes in total. Using the Python code shown below, I was expecting to get a 12-byte bytearray message. However, running the code I found out it is not always 12 bytes and sometimes it is gibberish. What am I doing wrong here or why is it so? Pyhon code: #!/usr/bin/env python import serial import time serialPort = 'COM3' serialBaud = 921600 dataNumBytes = 4 numData = 3 rawData =

Reading serial interface with Python returns distorted data

不想你离开。 提交于 2021-01-29 09:07:44
问题 I am trying to read binary serial port using Python. Each source message consists of 3 floating point values, 12 bytes in total. Using the Python code shown below, I was expecting to get a 12-byte bytearray message. However, running the code I found out it is not always 12 bytes and sometimes it is gibberish. What am I doing wrong here or why is it so? Pyhon code: #!/usr/bin/env python import serial import time serialPort = 'COM3' serialBaud = 921600 dataNumBytes = 4 numData = 3 rawData =

Append numpy matrix to binary file without numpy header

你离开我真会死。 提交于 2021-01-29 09:01:09
问题 I continously receive new data as numpy matrices which I need to append to an existing file. Structure and data type of that file are fixed, so I need python to do the conversion for me. For a single matrix, this works: myArr = np.reshape(np.arange(15), (3,5)) myArr.tofile('bin_file.dat') But suppose I'd want to keep appending the existing file with more and more arrays, then numpy.tofile will overwrite any content it finds in the file, instead of appending. I found that I could also keep

SQL Server : how to convert binary back to int

家住魔仙堡 提交于 2021-01-29 07:57:44
问题 Admin of our IS stored 8 flags like '00010000' (only true and false) to SQL Server as binary(2) . In this format data has values like '0x1000'. Is possible to convert this binary back to '00010000' ? Convert , Cast , Substring don't work. 回答1: Query returns hexadecimal number (0x... - it is hexadecimal) as its bit mask CREATE TABLE #Temp( Test VARBINARY(2) ) INSERT #Temp VALUES (0x1001), (0x3001), (0x5000), (0x6000), (0xf000), (0xf250) SELECT *, REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE

Make Eclipse generate C++ executable file

妖精的绣舞 提交于 2021-01-29 05:21:49
问题 Using latest MinGW and C++ Eclipse. If I create an "Executable Hello World" project, build it and run it, everything works as expected. If I create an "Executable Empty Project", then create a main.cpp file, build and run, I get the error message "Launch failed. Binary not found." How can I make empty project generate binary files? I looked everywhere in the project properties but I must have missed it. 回答1: For me the solution was this: select your project and goto "project"-menu/properties

Write vtk file in binary format

假如想象 提交于 2021-01-29 03:54:19
问题 I am trying to write a vtk file from my C++ code. I have two versions, one ASCII and the other binary. The ASCII version works well. I want to do something similar to this post : Error writing binary VTK files Here is my code : std::ofstream file; if(is_binary) file.open("test.vtk", std::ios::out | std::ios::binary); else file.open("test.vtk"); file << "# vtk DataFile Version 2.0" << std::endl << "Comment if needed" << std::endl; if(is_binary) file << "BINARY"<< std::endl << std::endl; else

binary search on a single linked list

泄露秘密 提交于 2021-01-28 20:29:10
问题 How do I perform a binary search on a single linked list headed ? Also it can do it , if there is any particular method. The EP can not tell in advance how many elements of that list , I have to search and enter a cell between q > prox and p . 回答1: Typically this is not possible, since binary search requires random access, and a singly-linked list can only provide forward sequential access. Without being able to jump around in memory and look at some nth element (either through direct random