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
241
votes
15 answers

An algorithm for inflating/deflating (offsetting, buffering) polygons

How would I "inflate" a polygon? That is, I want to do something similar to this: The requirement is that the new (inflated) polygon's edges/points are all at the same constant distance from the old (original) polygon's (on the example picture they…
Igor Brejc
  • 18,714
  • 13
  • 76
  • 95
103
votes
2 answers

Buffered vs unbuffered IO

I learned that by default I/O in programs is buffered, i.e they are served from a temporary storage to the requesting program. I understand that buffering improves IO performance (maybe by reducing system calls). I have seen examples of disabling…
sud03r
  • 19,109
  • 16
  • 77
  • 96
98
votes
5 answers

How to make output of any shell command unbuffered?

Is there a way to run shell commands without output buffering? For example, hexdump file | ./my_script will only pass input from hexdump to my_script in buffered chunks, not line by line. Actually I want to know a general solution how to make any…
bodacydo
  • 75,521
  • 93
  • 229
  • 319
84
votes
2 answers

What is the alternate of HttpRequest.EnableRewind() in ASP.NET Core 3.0?

BufferingHelper.EnableRewind(); Above is an extension method for HttpRequest object in ASP.NET Core 2.2. It is no more there in ASP.NET Core 3.0 (atleast with this name). I want to know it's alternate in ASP.NET Core 3.0. I am not sure…
74
votes
7 answers

Can you upload to S3 using a stream rather than a local file?

I need to create a CSV and upload it to an S3 bucket. Since I'm creating the file on the fly, it would be better if I could write it directly to S3 bucket as it is being created rather than writing the whole file locally, and then uploading the file…
inquiring minds
  • 1,785
  • 2
  • 15
  • 16
68
votes
3 answers

Why use endl when I can use a newline character?

Is there a reason to use endl with cout when I can just use \n? My C++ book says to use endl, but I don't see why. Is \n not supported as widely as endl, or am I missing something?
Moshe
  • 57,511
  • 78
  • 272
  • 425
47
votes
12 answers

Response Buffer Limit Exceeded

I am running a simple query to get data out of my database & display them. I'm getting an error that says Response Buffer Limit Exceeded. Error is : Response object error 'ASP 0251 : 80004005' Response Buffer Limit Exceeded …
Samir
  • 605
  • 3
  • 9
  • 14
43
votes
10 answers

Is list better than vector when we need to store "the last n items"?

There are a lot of questions which suggest that one should always use a vector, but it seems to me that a list would be better for the scenario, where we need to store "the last n items" For example, say we need to store the last 5 items…
Rahul Iyer
  • 19,924
  • 21
  • 96
  • 190
43
votes
1 answer

Wrong IO actions order using putStr and getLine

I have the following code: main = do putStr "Test input : " content <- getLine putStrLn content When I run it (with runhaskell) or compile it (ghc 6.10.4) the result is like this: asd Test input : asd Why is Test input : asd being…
QWRp
  • 528
  • 4
  • 6
41
votes
15 answers

How can I check if my AVPlayer is buffering?

I want to detect if my AVPlayer is buffering for the current location, so that I can show a loader or something. But I can't seem to find anything in the documentation for AVPlayer.
vrwim
  • 13,020
  • 13
  • 63
  • 118
40
votes
3 answers

file.tell() inconsistency

Does anybody happen to know why when you iterate over a file this way: Input: f = open('test.txt', 'r') for line in f: print "f.tell(): ",f.tell() Output: f.tell(): 8192 f.tell(): 8192 f.tell(): 8192 f.tell(): 8192 I consistently get the…
nigp4w rudy
  • 525
  • 1
  • 5
  • 9
38
votes
6 answers

Android - How to tell when MediaPlayer is buffering

I've got to be missing something obvious here, but I can't seem to find anything to allow me to determine when MediaPlayer is buffering audio. I'm streaming internet audio and I want to display a buffering indicator, but nothing I've tried allows…
Daniel
  • 1,151
  • 1
  • 9
  • 15
35
votes
6 answers

What does "select((select(s),$|=1)[0])" do in Perl?

I've seen some horrific code written in Perl, but I can't make head nor tail of this one: select((select(s),$|=1)[0]) It's in some networking code that we use to communicate with a server and I assume it's something to do with buffering (since it…
paxdiablo
  • 854,327
  • 234
  • 1,573
  • 1,953
34
votes
2 answers

Understanding Ruby and OS I/O buffering

How does IO buffering work in Ruby? How often is data flushed to the underlying stream when using the IO and File classes? How does this compare to OS buffering? What needs to be done to guarantee that given data has been written to disk, before…
jrdioko
  • 32,230
  • 28
  • 81
  • 120
33
votes
6 answers

Haskell: read input character from console immediately, not after newline

I've tried this: main = do hSetBuffering stdin NoBuffering c <- getChar but it waits until the enter is pressed, which is not what I want. I want to read the character immediately after user presses it. I am using ghc v6.12.1 on Windows…
Steves
  • 2,798
  • 21
  • 21
1
2 3
32 33