buffer

triple buffer heavy flickering

拟墨画扇 提交于 2019-12-21 23:12:08
问题 Shouldn't triple buffering and Canvas be an optimal solution for passive rendering? I've just wrote this java code that displays a circle. If I leave bufferstrategy to 3, it flickers so much. If I turn it down to 2 or 1 it's ok. Maybe I'm doing something wrong? public void run(){ while (running){ update(); draw(); } } public void update(){ } public void draw(){ BufferStrategy bs = getBufferStrategy(); if (bs==null){ createBufferStrategy(3); return; } Graphics g = bs.getDrawGraphics(); g

What is buffer? What are buffered reads and writes?

落爺英雄遲暮 提交于 2019-12-21 22:01:42
问题 I heard the word buffer after a long time today and wondering if somebody can give a good overview of buffer and some examples of how it matters in today's world. 回答1: A buffer is generally a portion of memory that contains data that has not yet been fully committed to its intended device. In the case of buffered I/O, generally there is a fast device and a slow device. The devices themselves need not have disparate speeds, but perhaps the interfaces between them differ or perhaps it is more

Inline <video> large file with buffer

▼魔方 西西 提交于 2019-12-21 21:29:56
问题 I'm trying to build a site using HTML5's video tag so that I can share some movies I have made. Their sizes are pretty big (>500 MB), and when I watch them from outside my network, it seems like it's trying to download the whole thing before showing it. I'm wondering how I can make it so that they can be downloaded and watched at the same time. I'm using php and javascript to build the site, although if there are libraries or techniques available in other languages, I'm more than happy to

C - Read Directly From the Keyboard Buffer

只谈情不闲聊 提交于 2019-12-21 20:16:05
问题 This is a question in the C programming language. How do I directly read the data in the keyboard buffer? I want to directly access the data and store it in a variable. Of what data type should the variable be? I need it for an operating system our institute is currently developing. It's called ICS-OS and I am not quite sure about the specifics. It runs on x86, 32-bit machines (we run it on QEMU in a Linux box). Here is the link for the Google Code http://code.google.com/p/ics-os/. I hope

How to send EOF to Python sys.stdin from commandline? CTRL-D doesn't work

自闭症网瘾萝莉.ら 提交于 2019-12-21 17:22:21
问题 I am writing to my Python process from the commandline on unix. I want to send EOF (or somehow flush the stdin buffer, so Python can read my input.) If I hit CTRL-C, I get a KeyboardError. If I hit CTRL-D, the program just stops. How do I flush the stdin buffer? 回答1: Control-D should NOT make your program "just stop" -- it should close standard input, and if your program deals with that properly, it may perfectly well continue if it needs to! For example, given the following st.py : import

Capturing Camera2 preview frames returns empty buffer

徘徊边缘 提交于 2019-12-21 16:48:08
问题 I've been working on a simple Android app designed to pass streaming camera frames from the Android Camera2 API pipeline to my algorithm. I've made several applications already that faithfully do this using the Android Camera1 API, but even after checking (Google docs, forums) to confirm correct coding, I am unable to capture any real data from the ImageReader in onImageAvailable(). Please note the following relevant code: Setting up the ImageReaders: private void setUpCameraOutputs(int width

Node.JS Big-Endian UCS-2

妖精的绣舞 提交于 2019-12-21 13:08:38
问题 I'm working with Node.JS. Node's buffers support little-endian UCS-2, but not big-endian, which I need. How would I do so? 回答1: According to wikipedia, UCS-2 should always be big-endian so it's odd that node only supports little endian. You might consider filing a bug. That said, switching endian-ness is fairly straight-forward since it's just a matter of byte order. So just swap bytes around to go back and forth between little and big endian, like so: function swapBytes(buffer) { var l =

Default input and output buffering for fopen'd files?

。_饼干妹妹 提交于 2019-12-21 11:07:47
问题 So a FILE stream can have both input and output buffers. You can adjust the output stream using setvbuf (I am unaware of any method to play with the input buffer size and behavior). Also, by default the buffer is BUFSIZ (not sure if this is a POSIX or C thing). It is very clear what this means for stdin / stdout / stderr , but what are the defaults for newly opened files? Are they buffered for both input and output? Or perhaps just one? If it is buffered, does output default to block or line

Default input and output buffering for fopen'd files?

老子叫甜甜 提交于 2019-12-21 11:06:21
问题 So a FILE stream can have both input and output buffers. You can adjust the output stream using setvbuf (I am unaware of any method to play with the input buffer size and behavior). Also, by default the buffer is BUFSIZ (not sure if this is a POSIX or C thing). It is very clear what this means for stdin / stdout / stderr , but what are the defaults for newly opened files? Are they buffered for both input and output? Or perhaps just one? If it is buffered, does output default to block or line

UnsupportedOperationException with converting byte[] to float[]

别说谁变了你拦得住时间么 提交于 2019-12-21 10:17:51
问题 I'm trying to convert a byte[] to a float[] by putting the byte[] in a ByteBuffer, converting this to a FloatBuffer ( .asFloatBuffer ), and then converting this to an array. private static float[] toFloatArray(byte[] bytes) { ByteBuffer buffer = ByteBuffer.wrap(bytes); return buffer.asFloatBuffer().array(); } However running: byte[] bytes = {14,32,26,21}; toFloatArray(bytes); Gives me a java.lang.UnsupportedOperationException at java.nio.FloatBuffer.array(Unknown Source) . I believe the