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
26
votes
4 answers

Unable to have the reverse of Ctrl-O in Vim

I want to have the reverse of Ctrl+O to be Shift+Ctrl+O The original reverse is Ctrl+I How can you remap the reverse of CTRL+O in Vim to be Shift+CTRL+O?
Léo Léopold Hertz 준영
  • 134,464
  • 179
  • 445
  • 697
26
votes
4 answers

Display number of current buffer

I have a simple requirement: I want to display the number of the buffer I'm currently editing. I don't want to type :buffers (or equivalent) but have this number show up in my status bar thingy along with the file name, current column information…
Daniel
  • 263
  • 1
  • 3
  • 4
26
votes
2 answers

Difference between Buffer & Stream in C#

I read that Buffer is a sequence of bytes. But I also read that Stream is also a sequence of bytes. So what is the difference between Stream & Buffer?
Neel Maheta
  • 329
  • 1
  • 4
  • 13
26
votes
1 answer

What's the right way to clear a bytes.Buffer in golang?

I'm trying to clear a bytes.Buffer, but there's no such function in the document Maybe I should just renew the buffer? What's the right way to do it? buffer = bytes.NewBufferString("") buffer.Grow (30000)
daisy
  • 22,498
  • 29
  • 129
  • 265
26
votes
3 answers

Another: Force Chrome to fully buffer mp4 video

I've seen a few threads about this, but with no answers, so I thought I'd add another to the grave yard of polluted youtube related pages. I've got a 100MB mp4 video that needs to be fully downloaded by the browser, However theres no event that…
owenmelbz
  • 6,180
  • 16
  • 63
  • 113
26
votes
3 answers

Strange BufferStrategy issue - Game runs fast only on Intel GPUs

I ran into a very strange problem, I tried searching for an answer for days and days. My game just got a new particle system, but was too slow to be playable. Unfortunately, BufferedImage transformations are very slow. The explosion effect consists…
Simon Tamás
  • 281
  • 3
  • 8
25
votes
3 answers

Pre-Load or Pre-Buffer .mp4 video in android app development

I am building an app that is successfully displaying an MP4 video file onButtonClick. I want to pre-buffer or preload the video's URI (remote url) so that it doesn't delay the playing of the video once the button is clicked. I want it to click and…
Nuwud
  • 251
  • 1
  • 3
  • 6
25
votes
3 answers

How to convert a Javascript Object to a Node Buffer?

I'm using Buffer on my node server and Buffer on my Javacript client. For the purposes of saving bytes, I'm looking to send my data to the server through websockets as binary as opposed to JSON. So, if I had the Javascript object of [ 5, false, 55,…
Lawrence Douglas
  • 667
  • 1
  • 7
  • 15
25
votes
4 answers

Make ipython notebook print in real time

Ipython Notebook doesn't seem to print results in real time, but seems to buffer in a certain way and then bulk output the prints. How can I make ipython print my results as soon as the print command is processed? Example code: import time def…
patapouf_ai
  • 17,605
  • 13
  • 92
  • 132
25
votes
3 answers

Is there any way to peek at the stdin buffer?

We know that stdin is, by default, a buffered input; the proof of that is in usage of any of the mechanisms that "leave data" on stdin, such as scanf(): int main() { char c[10] = {'\0'}; scanf("%9s", c); printf("%s, and left is: %d\n",…
Mike
  • 47,263
  • 29
  • 113
  • 177
24
votes
8 answers

How do you flush a buffered log4j FileAppender?

In log4j, when using a FileAppender with BufferedIO=true and BufferSize=xxx properties (i.e. buffering is enabled), I want to be able to flush the log during normal shutdown procedure. Any ideas on how to do this?
Amos
  • 1,403
  • 2
  • 13
  • 19
24
votes
1 answer

Looping over Protocol Buffers attributes in Python

I would like help with recursively looping over all attributes/sub objects contained in a protocol buffers message, assuming that we do not know the names of them, or how many there are. As an example, take the following .proto file from the…
Toby
  • 517
  • 1
  • 5
  • 15
24
votes
1 answer

Save real time video recording to sd-card using Local Socket in Android - Video not playable

Trying to capture a video and save it to sd card in Mp4/3gp formats using local socket. Being able to write bytes by bytes to sd card but the video file is not playable.I have gone through many examples…
neoengg88
  • 241
  • 2
  • 5
24
votes
5 answers

Byte array with padding of null bytes at the end: how to efficiently copy to smaller byte array

Have: [46][111][36][11][101][55][87][30][122][75][66][32][49][55][67][77][88][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0][0] Want: [46][111][36][11][101][55][87][30][122][75][66][32][49][55][67][77][88] I have an array of…
Atomix
  • 2,440
  • 8
  • 36
  • 48
23
votes
6 answers

How many chars can be in a char array?

#define HUGE_NUMBER ??? char string[HUGE_NUMBER]; do_something_with_the_string(string); I was wondering what would be the maximum number that I could add to a char array without risking any potential memory problems, buffer overflows or the like.…
user666010
  • 231
  • 1
  • 2
  • 4