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
5
votes
1 answer

How to speed Haskell IO with buffering?

I read about IO buffering in the "Real World Haskell" (ch. 7, p. 189), and tried to test, how different buffering size affects the performance. import System.IO import Data.Time.Clock import Data.Char(toUpper) main :: IO () main = do hInp <-…
azaviruha
  • 896
  • 1
  • 7
  • 14
5
votes
2 answers

Problems with sys.stdout.write() with time.sleep() in a function

What I wanted is printing out 5 dots that a dot printed per a second using time.sleep(), but the result was 5 dots were printed at once after 5 seconds delay. Tried both print and sys.stdout.write, same result. Thanks for any advices. import…
philipjkim
  • 3,999
  • 7
  • 35
  • 48
5
votes
3 answers

Why isn't my IO executed in order?

I got a problem with IO not executing in order, even inside a do construct. In the following code I am just keeping track of what cards are left, where the card is a tuple of chars (one for suit and one for value) then the user is continously asked…
HaskellElephant
  • 9,819
  • 4
  • 38
  • 67
5
votes
3 answers

Android MediaPlayer.OnBufferingUpdateListener - Percentage of buffered content is negative

I have a service that uses MediaPlayer to stream internet radio: public class MediaPlayerService extends Service implements MediaPlayer.OnPreparedListener, MediaPlayer.OnBufferingUpdateListener { private MediaPlayer mMediaPlayer; …
5
votes
0 answers

Android MediaPlayer freezes after seeking a new video position

I load a .mp4 on a VideoView, all things go fine until I drag the seekbar point to a new position, so the MediaPlayer starts to buffering and then the app freezes (not crash, just freeze) with an error message: "Can't play video" This is the…
WildChild
  • 93
  • 7
5
votes
3 answers

Processing instrument capture data

I have an instrument that produces a stream of data; my code accesses this data though a callback onDataAcquisitionEvent(const InstrumentOutput &data). The data processing algorithm is potentially much slower than the rate of data arrival, so I…
Cattus
  • 147
  • 6
4
votes
2 answers

Why does python keep buffering stdout even when flushing and using -u?

$ cat script.py import sys for line in sys.stdin: sys.stdout.write(line) sys.stdout.flush() $ cat script.py - | python -u script.py The output is right but it only starts printing once I hit Ctrl-D whereas the following starts printing…
Patrick B
  • 68
  • 1
  • 6
4
votes
2 answers

How is printf getting flushed before scanf is executed?

I have recently read a lot about standard output buffering. I'm aware that printf is buffered but so far I thought that its buffer only gets flushed when a new line is read into the buffer or fflush(stdout)is called or the process that called…
user13024289
  • 71
  • 1
  • 5
4
votes
4 answers

Using Dynamic Buffers? Java

In Java, I have a method public int getNextFrame( byte[] buff ) that reads from a file into the buffer and returns the number of bytes read. I am reading from .MJPEG that has a 5byte value, say "07939", followed by that many bytes for the jpeg. The…
LJWolfe
  • 43
  • 1
  • 3
4
votes
1 answer

Does recv remove packets from pcaps buffer?

Say there are two programs running on a computer (for the sake of simplification, the only user programs running on linux) one of which calls recv(), and one of which is using pcap to detect incoming packets. A packet arrives, and it is detected by…
Benubird
  • 18,551
  • 27
  • 90
  • 141
4
votes
1 answer

Python is not working in unbuffered mode

I'm stuggeling with an issue with python. I used Python 2.7.13 and Python 3.6.0 on Red Hat Enterprise Linux Server release 7.1 (Maipo). In order to monitor the proccesses output, I want to use tail -f to take a live look into the STDOUT and STDERR.…
fwillo
  • 77
  • 1
  • 8
4
votes
1 answer

Getting buffering progress value in HTML5 video player

In Firefox, when I see the simple video element in this example, it has default browser controls. Right after the page is loaded the video starts to load; I see how the buffering (loading) line is moving to the right side of the default browser…
Nik Sumeiko
  • 8,263
  • 8
  • 50
  • 53
4
votes
5 answers

Perl: avoid greedy reading from stdin?

Consider the following perl script (read.pl): my $line = ; print "Perl read: $line"; print "And here's what cat gets: ", `cat -`; If this script is executed from the command line, it will get the first line of input, while cat gets…
Jonas Wagner
  • 358
  • 3
  • 10
4
votes
1 answer

How to *continuously* detect if a page is fully loaded with JS?

There are tons of ways to detect if a page is loaded. However I want to do this continuously and couldn't find a way that is working. To explain what continuously mean, let me give an example. In a page, user clicks somewhere and request a new…
user3722246
  • 151
  • 4
4
votes
5 answers

Close connection in PHP but keep executing script

Anyone know how to close the connection (besides just flush()?), but keep executing some code afterwards. I don't want the client to see the long process that may occur after the page is done.
Kristopher Ives
  • 5,838
  • 7
  • 42
  • 67