buffer

Reading serial data in linux byte-for-byte at 56K reliably

假如想象 提交于 2019-12-26 12:23:40
问题 I'm trying to create a function with the most minimal delay possible that checks to see if the serial port has data and if it does, it reads every single byte and prints each byte in hex format until no more bytes are available. If there is no data, the function must return right away. This is my code: int fd=open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_SYNC); // Trying to set correct options here struct termios o; tcgetattr(fd,&o); cfsetispeed(&o,57600); cfsetospeed(&o,57600); /* 8 bits, no

How to choose the right buffer to draw and stop it from swapping continuously

假装没事ソ 提交于 2019-12-25 19:05:19
问题 Please tell me if the question's vogue, I need the answe as soon as possible for more information about the problem you can refer to this. I just didn't understand how to manage buffers properly. A red rectangle drawn on 2D texture disappears right after being drawn Being in the last stages of customizing the class COpenGLControl: I have created two instances of the class in my MFC Dialog: whenever the extent of zoom is changed in the bigger window, it is drawn as a red rectangle on the

boost::asio double buffering

微笑、不失礼 提交于 2019-12-25 18:56:14
问题 I am trying to implement double buffering for my network server when it sends to clients. The idea came from boost::asio::async_write - ensure only one outstanding call Unfortunately, as great as it looks, I am getting an error when I try to run it. AFAIK, I am not using any iterators, so I assume the async_write is when it attempts to complete, but I don't know what is really causing the problem. The error occurs after the first async_write is posted. The error is "vector iterator not

Bytes to file, are they miswritten?

喜你入骨 提交于 2019-12-25 08:18:31
问题 Env: Windows 7, java 1.8, default OS encodings I'm trying to read a byte stream of currency market data from a socket to a file, and then play that file back to simulate the market over a fixed period; however, the file has a few malformed bytes, seemingly at random. Below, I outline the problem with metacode, where the notation "..." indicates skipped irrelevant or boilerplate code. Bytes are coming over the socket, and I'm reading them with a non-blocking NIO selector, then writing to disk

How does OpenGL fill buffers and read them back?

扶醉桌前 提交于 2019-12-25 07:39:35
问题 I was using an OpenGL buffer with a bunch of GLfloats as a vertex buffer and all was well. The format of the GLfloats being [x1, y1, z1, x2, y2, z2, ...] . But then, while following this tutorial, it tells me to use glm::vec3 instead: glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(GLfloat), &vertices[0], GL_STATIC_DRAW); glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(glm::vec3), &vertices[0], GL_STATIC_DRAW); Now this code is valid, and I wonder how would OpenGL know how to

java.lang.OutOfMemoryError: Direct buffer memory when invoking Files.readAllBytes

喜夏-厌秋 提交于 2019-12-25 07:29:03
问题 I've got the following code which is designed to read a directory and compress it into a tar.gz archive. When I deploy the code onto the server and test it with a batch of files, it works on the first few test batches, but after the 4th or 5th batch, it starts consistently giving me java.lang.OutOfMemoryError: Direct buffer memory even though the file batch size stays the same and the heap space looks fine. Here's the code : public static void compressDirectory(String

Sending packets from wireshark to audio decoder: Is .raw file array of RTP packets?

泪湿孤枕 提交于 2019-12-25 06:05:06
问题 I have captured RTP packets and need to decode the packets/sesssion with G.729.1 Decoder. In wireshark, I filtered the RTP packets, analyzed and saved the session as .raw file. I am using c# streamdecoder for decoding. Its sample provides example how the speech is encoded, saved in buffer and decoded packet by packet. This is the point I am stuck: const Codec usedCodec = Codec.G7291; const int usedSampleRate = 8000; const int usedBitrate = 12200; var dec = new SpeechDecoder(); dec.SetCodec

OpenGL sending vertex pointers or generating buffers

ⅰ亾dé卋堺 提交于 2019-12-25 05:35:52
问题 I just started OpenGL for iPhone, using GLKit. My programming background is almost just java and objective c with little,little experiences with C, C++ over ten years ago. All what remained is a remote memory of how I struggled with pointers - and I think I failed. Now it seems as if it all comes back to me ... I went to some iterations of the great, great tutorial series of Ian Terrel, which really helped me (Thanks!!!). This question is about the following parts of the code (which is mostly

File buffer flushing and closing in Python with variable re-assign

一个人想着一个人 提交于 2019-12-25 04:39:20
问题 Had an interesting experience with Python's file buffering and wanted to know that I understand it correctly. Given [Python 2.7 shell] ... model = (really big Numpy model) f = open('file.out','w') pickle.dump(model, f) (pickle.dump() finishes while I'm doing other things) [Bash shell] $ ls -l -rw-r--r-- 1 john staff 270655488 Dec 6 21:32 file.out [Return to Python shell] model = (different really big Numpy model) f = open('newfile.out','w') pickle.dump(model,f) (pickle.dump() finishes) [Bash

PHP Complete list of functions and statments that can output

一笑奈何 提交于 2019-12-25 04:13:07
问题 Note: "output" is meant to meant to data that streams out of php; Eg, stdout, output buffer, data that is returned to an incomming web request. "Output" is not to mean, the value that a functions that returns. Note: "function and statements" is meant to refer to anything that a php script can do ; What could approximately be referred to as a callable, or a statement; Or that PHP Docs refer to as a Language Construct. Or anything else that can in some way, make php output something somewhere.