Questions tagged [buffering]

Buffering is a process of temporarily storing data while it is being moved from one place to another.

Buffering is a process of temporarily storing data while it is being moved from one place to another. A buffer often adjusts timing by implementing a queue (or FIFO) algorithm in memory, simultaneously writing data into the queue at one rate and reading it at another rate.

Use this tag for programming questions related to data buffer and the process of buffering.

Source: Wikipedia

493 questions
30
votes
5 answers

PHP CLI: How to read a single character of input from the TTY (without waiting for the enter key)?

I want to read a single character at-a-time from the command line in PHP, however it seems as though there is some kind of input buffering from somewhere preventing this. Consider this code: #!/usr/bin/php
dansimau
  • 1,155
  • 1
  • 8
  • 11
28
votes
4 answers

Should I buffer the InputStream or the InputStreamReader?

What are the differences (if any) between the following two buffering approaches? Reader r1 = new BufferedReader(new InputStreamReader(in, "UTF-8"), bufferSize); Reader r2 = new InputStreamReader(new BufferedInputStream(in, bufferSize), "UTF-8");
bdkosher
  • 5,753
  • 2
  • 33
  • 40
27
votes
6 answers

Setting smaller buffer size for sys.stdin?

I'm running memcached with the following bash command pattern: memcached -vv 2>&1 | tee memkeywatch2010098.log 2>&1 | ~/bin/memtracer.py | tee memkeywatchCounts20100908.log to try and track down unmatched gets to sets for keys platform wide. The…
David
  • 17,673
  • 10
  • 68
  • 97
25
votes
4 answers

Why does printf() not print anything before sleep()?

I'm just learning C with Kernighan and Ritchie's book; I'm in the basics of the fourth chapter ("Functions and Program Structure"). The other day I became curious about the sleep() function, so tried to use it like this: #include #include…
John Woods
25
votes
5 answers

HTML5 Video buffered attribute features

I am designing a custom HTML5 video player. Thus, it will have its own custom slider to mimic the video progress, so I need to understand the entire buffering shebang of a HTML5 video. I came across this article: Video Buffering. It says that the…
SexyBeast
  • 7,913
  • 28
  • 108
  • 196
24
votes
7 answers

How to buffer stdout in memory and write it from a dedicated thread

I have a C application with many worker threads. It is essential that these do not block so where the worker threads need to write to a file on disk, I have them write to a circular buffer in memory, and then have a dedicated thread for writing…
NickB
  • 1,471
  • 4
  • 14
  • 20
24
votes
3 answers

Python sockets buffering

Let's say I want to read a line from a socket, using the standard socket module: def read_line(s): ret = '' while True: c = s.recv(1) if c == '\n' or c == '': break else: ret += c return…
Bastien Léonard
  • 60,478
  • 20
  • 78
  • 95
23
votes
6 answers

Buffered RandomAccessFile java

RandomAccessFile is quite slow for random access to a file. You often read about implementing a buffered layer over it, but code doing this isn't possible to find online. So my question is: would you guys who know any opensource implementation of…
marcorossi
  • 1,941
  • 2
  • 21
  • 34
21
votes
8 answers

Creating a DSP system from scratch

I love electronic music and I am interested in how it all ticks. I've found lots of helpful questions on Stack Overflow on libraries that can be used to play with audio, filters etc. But what I am really curious about is what is actually hapening:…
Ed Ayers
  • 1,342
  • 1
  • 11
  • 24
21
votes
5 answers

Audio stream buffering

I need to play live audio stream, actually it is radio. The problem is that I also need to manage 20 minute buffer for streaming. As far as I understand it's not easy to implement with android. Firstly I checked MediaPlayer, but it doesn't provide…
Eugenious
  • 291
  • 1
  • 2
  • 5
21
votes
2 answers

PHP - nested output buffering

I have function that has : ob_start(); //Include of some files $content = ob_get_contents(); ob_end_clean(); Now in those includes is another function that uses the same code, and they seem to conflict. Is it possible to use them like this?
somerandomusername
  • 1,993
  • 4
  • 23
  • 55
20
votes
3 answers

Stop audio buffering in the

I am currently working in using the HTML5 audio player to provide a audio stream (24/7 radio stream) via the (mobile) browser. Loading in the stream and playing it works fine. The major problem is that the HTML5
Ruben
  • 1,427
  • 3
  • 17
  • 25
19
votes
1 answer

Rx IObservable buffering to smooth out bursts of events

I have an Observable sequence that produces events in rapid bursts (ie: five events one right after another, then a long delay, then another quick burst of events, etc.). I want to smooth out these bursts by inserting a short delay between events. …
Dan Kroymann
  • 282
  • 2
  • 9
16
votes
2 answers

Haskell default io buffering

Yesterday I wrote a little xinetd exercise for my students: make a reverse echo program. To learn something new, I tried to implement a Haskell solution. The trivial main = forever $ interact reverse does not work. I went through this question and…
pasja
  • 365
  • 4
  • 10
15
votes
3 answers

Why doesn't print output anything on each iteration of a loop when I use sleep?

Today in my college a teacher asked me a question. He wrote this code on the paper and said "What will be the output of this code?" use warnings; for (1 .. 20) { print "."; } I found it easy and said that it will loop 20 times and at each…
Chankey Pathak
  • 21,187
  • 12
  • 85
  • 133
1
2
3
32 33