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

Convert Blob data to Raw buffer in javascript or node

I am using a plugin jsPDF which generates PDF and saves it to local file system. Now in jsPDF.js, there is some piece of code which generates pdf data in blob format as:- var blob = new Blob([array], {type: "application/pdf"}); and further saves…
Kamaldeep Singh
  • 765
  • 2
  • 8
  • 28
15
votes
3 answers

Difference between 0x0A and 0x0D

I was studying about bluetooth and I was trying to write the code to keep listening to the input stream while connected and i came across this following code snippet: int data = mmInStream.read(); if(data == 0x0A) { } else…
Rasik Suhail
  • 206
  • 1
  • 2
  • 8
15
votes
3 answers

Android AudioTrack buffering problems

Ok so I have a frequency generator which uses AudioTrack to send PCM data to the hardware. Here's the code I'm using for that: private class playSoundTask extends AsyncTask { float frequency; float increment; float angle =…
JCL
  • 241
  • 1
  • 2
  • 4
15
votes
6 answers

Example of a buffer overflow leading to a security leak

I read many articles about unsafe functions like strcpy, memcpy, etc. which may lead to security problems when processing external data, like the content of a file or data coming from sockets. This may sound stupid, but I wrote a vulnerable program…
Tomaka17
  • 4,832
  • 5
  • 29
  • 38
15
votes
4 answers

How to effectively draw on desktop in C#?

I want to draw directly on the desktop in C#. From searching a bit, I ended up using a Graphics object from the Desktop HDC (null). Then, I painted normally using this Graphics object. The problem is that my shapes get lost when any part of the…
Lazlo
  • 8,518
  • 14
  • 77
  • 116
15
votes
5 answers

resample audio buffer from 44100 to 16000

I have audio data in format of data-uri, then I converted this data-uri into a buffer now I need this buffer data in new samplerate, currently audio data is in 44.1khz and I need data in 16khz, and If I recorded the audio using RecordRTC API and if…
Mahendra Garg
  • 516
  • 1
  • 9
  • 27
15
votes
1 answer

SSIS - The value is too large to fit in the column data area of the buffer

I'm passing a column of Json data to the script component to process. It went fine until I had a Json data that contains over 600,000 length, then the follow error occurs. I did change the MaxBuffer size to 10MB, and my data is only around 600K…
user3268139
  • 352
  • 2
  • 3
  • 16
15
votes
3 answers

Tell Emacs to open new buffer in specific window

If an Emacs frame is split in several windows and a new buffer is opened, is there a possibility to tell Emacs in which window to open the buffer. Especially, if one window contains a dired buffer and I want to tell Emacs in which of the other…
Hypnotoad
  • 173
  • 1
  • 6
15
votes
2 answers

Golang: Does logging into file using log.Println takes care of concurrent access

I have hundreds of subroutines writing into log file using log.Println() I am using log.Println to write into error.log file. func main() { e, err := os.OpenFile("error.log", os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0666) if err != nil { …
Rahul Prasad
  • 8,074
  • 8
  • 43
  • 49
15
votes
3 answers

base64 JSON encoded strings in nodejs

How do I create a base64 JSON encoded strings in nodejs? I tried this and it didn't work. var buff = new Buffer({"hello":"world"}).toString("base64"); Is this it? var buff = new Buffer(JSON.stringify({"hello":"world"})).toString("base64");
ThomasReggi
  • 55,053
  • 85
  • 237
  • 424
15
votes
5 answers

What is the difference between flush() and sync() in regard to fstream buffers?

I was reading the cplusplus.com tutorial on I/O. At the end, it says fstream buffers are synchronized with the file on disc Explicitly, with manipulators: When certain manipulators are used on streams, an explicit synchronization takes place. These…
cjcurrie
  • 624
  • 1
  • 4
  • 15
15
votes
1 answer

Use streambuf as buffer for boost asio read and write

I'm using this code for reading socket_.async_read_some(boost::asio::buffer(data_, max_length), boost::bind(&session::handle_read, this, boost::asio::placeholders::error, …
user1307957
  • 541
  • 3
  • 8
  • 19
14
votes
3 answers

How can I get the compilation buffer on the bottom rather than on the right in Emacs 23?

I've installed Emacs 23 and have found that the compilation buffer (when using M-x compile) appears in a different position than it did in Emacs 22. The currently open buffer appears on the left and the compilation buffer on the right. How to I…
Jonathon Watney
  • 20,248
  • 9
  • 38
  • 40
14
votes
4 answers

buffer-local function in elisp

I would like to redefine an existing function foo, but for a specific buffer only. (defun foo () (message "Not done:(")) I was hopping this will do: (make-local-variable 'foo) (fset 'foo #'(lambda () (message "Done!"))) But it does not. Any…
VitoshKa
  • 8,387
  • 3
  • 35
  • 59
14
votes
4 answers

Javascript - How to convert buffer to a string?

This is example of converting String to a Buffer and back to String: let bufferOne = Buffer.from('This is a buffer example.'); console.log(bufferOne); // Output:
Joe
  • 11,983
  • 31
  • 109
  • 183