c++

loss of data when decrypting a file in Python server from CPP client

loss of data when decrypting a file in Python server from CPP client Question: I am trying to send a file from a client written in CPP to a server written in Python. I am using AES encryption on client side to encrypt the file and then send it to the server, the AES key …

Total answers: 2

Microsoft Tick time to Python Datetime

Microsoft Tick time to Python Datetime Question: There’s a lot of answers to my question but mine is a little different in that I’m not entirely sure if its Microsoft’s tick time. The situation is I’m receiving the following from my firms API and they’ve told me its tick time but it doesn’t match with …

Total answers: 1

How to make tcpClient not receive multiple message per each conn.sendall()?

How to make tcpClient not receive multiple message per each conn.sendall()? Question: Python server sender side: soc = socket.socket() hostname="localhost" port=8000 soc.bind((hostname,port)) soc.listen(1) conn , addr = soc.accept() print("device connected") cc = 0 cap = cv2.VideoCapture(0) with mp_hollistic.Holistic(static_image_mode = True ,min_detection_confidence=0.7, min_tracking_confidence=0.7) as holistic: while cap.isOpened(): ret, frame = cap.read() res, f = func(frame) val …

Total answers: 1

create 2 dimension array in C, and every cell with 512 bit size

create 2 dimension array in C, and every cell with 512 bit size Question: I want to create 2d arrays, with dimension of 2 by M, and any cell in the array will have 512 bit. I was think to create something like this: #define M 1024 typedef struct { unsigned char public_key[2][M]; unsigned char …

Total answers: 1

How is that pandas is faster than pure C in the groupby operation?

How is that pandas is faster than pure C in the groupby operation? Question: I have an nparray of x,y pairs with shape (n,2), and knowing for certain that for each x there are multiple values of y , I wanted to calculate the average value of y for each unique x. It occurred to …

Total answers: 1

python ctypes memory read stops at first zero integer

python ctypes memory read stops at first zero integer Question: To all ctypes experts: I am running this code in Python to read 0x400 entries from memory. Unfortunately the returned list only contains ~20 entries. It seems to stop reading at the first entry with the value equal to 0. read_buffer = (ctypes.c_char * buffsize)() …

Total answers: 1

C++ vs Python | Read Memory

C++ vs Python | Read Memory Question: Have working code in C++ and would like to get equivalent results with Python. The idea is to retrieve data from memory using a specific process and a pointer. The result should look like this as it works in C++: Here is the C++ code: hProcess = SOME_HANDLER …

Total answers: 1

Cython: Passing pointer created by Python wrapper class to C function

Cython: Passing pointer created by Python wrapper class to C function Question: I am following the Cython Documentation to define a class that is created from an existing C pointer: # Example C struct ctypedef struct my_c_struct: int a int b cdef class WrapperClass: """A wrapper class for a C/C++ data structure""" cdef my_c_struct *_ptr …

Total answers: 1

Cython: Aliasing function argument name

Cython: Aliasing function argument name Question: I have a C library that I am writing a Python extension for using Cython that includes this function (declared in the library’s header file): #include <stdio.h> #include "zlib.h" int deflate_index_build(FILE *in, off_t span, struct deflate_index **built); I am attempting to create a Cython extension for this function using: …

Total answers: 1

How to mimic rand() function of C in python?

How to mimic rand() function of C in python? Question: I am trying to reverse a logic of a C program with python. Part of the C program is the following : timeVar = time((time_t *)0x0) seed = (uint)timeVar; srand(seed); random_value1 = rand(); random_value2 = rand(); random_value3 = rand(); There is no upper bound given …

Total answers: 3