Questions tagged [buffer]

A buffer is an area of memory set aside for temporary storage of data while it is being moved from one place to another. This is typically done to speed up processes with significant latency, such as writing to a disk, printer or other physical device. The output is ready to be sent to the device before the device is ready to accept it, so it is moved to the buffer so that the sending program does not have to continue waiting.

A may be used when moving data between processes within a computer. This is comparable to buffers in telecommunication. Buffers can be implemented in a fixed memory location in hardware—or by using a virtual data buffer in software, pointing at a location in the physical memory. In all cases, the data stored in a data buffer are stored on a physical storage medium. A majority of buffers are implemented in software, which typically use the faster RAM to store temporary data, due to the much faster access time compared with hard disk drives. Buffers are typically used when there is a difference between the rate at which data is received and the rate at which it can be processed, or in the case that these rates are variable, for example in a printer spooler or in online video streaming.


References

7035 questions
2
votes
1 answer

Streaming music over WebRTC cutting in and out

We would like to be able to play music in another tab (say YouTube, Spotify, Soundcloud, etc) and then stream that over a WebRTC connection to other peers. We are doing this through the screenshare and it's mostly working, but the music will…
Leo
  • 21
  • 3
2
votes
1 answer

PHP buffered output depending on server setting?

I'm using the following code to produce buffered output on a db maintenance script: function flush_buffers($string){ echo $string; ob_end_flush(); ob_flush(); flush(); ob_start(); } While this works as expected on my local Wamp…
Riccardo
  • 2,054
  • 6
  • 33
  • 51
2
votes
1 answer

Read cmd to stream to BSON in Julia

I have curl command, whose input I want to load using BSON. For performance reason, I want to read the curl output directly to memory, without saving it to file. Also, I want to close the curl as soon as possible, so I want to read data from curl…
Matěj Račinský
  • 1,679
  • 1
  • 16
  • 28
2
votes
3 answers

How to upload image to firebase storage for Editor.js?

I am trying to add image upload functionality in Editor.js by using backend file uploader endpoint. In the backend, I am uploading this file to firebase storage. But actually I am able to extract the file. I tried many ways but it didn't work Is…
Sachin Kumar
  • 366
  • 1
  • 6
  • 20
2
votes
1 answer

Weird characters from Buffer when reading text file directly from Google Cloud Storage

Weird characters from Buffer when reading text file directly from Google Cloud Storage I've been trying all kinds of encoding and sending out headers through express.js but I can't figure it out. My problem is that there are always a few characters…
2
votes
4 answers

Copying specific number of characters from a string to another

I have a variable length string that I am trying to divide from plus signs and study on: char string[] = "var1+vari2+varia3"; for (int i = 0; i != sizeof(string); i++) { memcpy(buf, string[0],…
servedc0ld
  • 49
  • 5
2
votes
2 answers

Understanding the Size of Byte Arrays

I was reading this popular stack overflow question Creating a byte array from a stream and wanted to get some clarification on how byte arrays work. in this chunk of code here: byte[] buffer = new byte[16 * 1024]; using (MemoryStream ms…
izzyk
  • 105
  • 1
  • 8
2
votes
2 answers

How can I clear the input stream in c++?

When I write a program, and use the - cout << "A:"; cin >> string_var; cout << "B"; cin >> string_var2; If there is a space in between the two inputs on the keyboard (for ex. If the console displayed: A:_ (waiting for input) and I typed a a,…
someguy
  • 443
  • 3
  • 8
  • 13
2
votes
1 answer

Same registers for different VIM tabs

I'm trying to make a copy paste from 1 file I have opened in a tab to another file I have opened in another tab. So I use the visual block to get my selection, yank it, but when I switch to other tab, it doesn't paste, it says: Nothing to…
JTL
  • 21
  • 1
2
votes
1 answer

c++ stream buffer and flush

#include #include #include using namespace std::chrono; int main() { std::cout << "hello"; std::this_thread::sleep_for(2s); std::cout << "world"<
Aayush Neupane
  • 1,066
  • 1
  • 12
  • 29
2
votes
1 answer

Passing a base64 image string to a Firebase callable cloud function that calls the Cloud Vision API

I'm implementing a web app the uses the Cloud Vision API to detect text on user-generated images. I'm using React and Firebase cloud functions. The flow is the following: User gets image from Gallery or Camera, crops it using react-image-crop…
2
votes
1 answer

Buffer chaining and decorative principle Java I/O

Yes I know what buffer is. But watch this: BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter("file.txt")); How does buffering actually work here? The way I see it, we are buffering data in FileWriter buffer and not in BufferedWriter…
Ana Maria
  • 475
  • 2
  • 11
2
votes
2 answers

Is it possible to count the frequency of a word in a file precisely using two buffers in C?

I have a file of size 1GB. I want to find out how many times the word "sosowhat" is found in the file. I've written a code using fgetc() which reads one character at a time from the file which is way too slower when it comes for a file of size 1GB.…
2
votes
1 answer

Node.js: Sharp package unable to install

I'm trying to install the Sharp package to compress buffers for images. Now when I install the package via npm install sharp --save, and try to use this line of code: const sharp = require('sharp'); I get the following error:…
HimmDawg
  • 97
  • 10
2
votes
2 answers

Is repetitively creating buffers on the stack in a loop in C bad practice?

The title of this post is very similar to what I searched in relation to this. Every result I came across was about buffer overflows, and that isn't what I'm after. I have my function iterating through each filename in a dirent structure I've…
topal
  • 151
  • 6