buffer

HTML5 load a png buffer into a canvas (for streaming purpose)

旧城冷巷雨未停 提交于 2019-12-12 07:38:07
问题 Through a websocket, I retrieve a binary buffer of an image in a PNG format (something like that). I want to load this PNG buffer into a canvas, and then read the different pixels to read the uncompressed data. I managed to do it but it is stupid: function onBinaryMessage(/*ArrayBuffer*/ input) { input = new Uint8Array(input); var str = ''; for (var i = 0; i < input.byteLength; i++) str = str + String.fromCharCode(input[i]); var image = document.getElementById("image"); image.src = 'data

Java bounded non-blocking buffer for high concurrent situation

我怕爱的太早我们不能终老 提交于 2019-12-12 07:33:13
问题 Basically I need a data structure to store the temporary chatting messages on the server side. It should be: bounded: because I don't need store too many messages, the client will send request to get the new messages every second. I think the bound size should be the max. mount of concurrent requests in one second. When the buffer is full, the old messages will be removed. suitable for high concurrent access: I don't want to use the data structure like Collections.synchronizedXXXX, because

Reading a binary file into ArrayList in Java

≡放荡痞女 提交于 2019-12-12 06:12:17
问题 I want to read binary file in java. I have 153(1.bin, 2.bin...153.bin) bin file. I must read that. I thought that I must use ArrayList for buffering. But I could not do that. How can I do this ? After some research, I found that way in this title(Reading a binary input stream into a single byte array in Java). There is code like below in this title. StringBuilder sb = new StringBuilder(); String fileName = "/path/10.bin"; byte[] buffer; try { buffer = Files.readAllBytes(Paths.get(fileName));

Need an aclaration about the console buffer and console outputs

筅森魡賤 提交于 2019-12-12 05:47:44
问题 When using API techniques to retrieve the console buffer in .NET using the 'ReadConsoleOutput' function, that means what I can have in the same output (buffer) the Standard output, Input output, and also Error output all together? Or in other words: If we normally need to start a process and redirect by separated the StandrdOutput/ErrorOutput/InputOutput output into a total of 3 outputs, then if we use a technique to read the console buffer instead redirecting 3 outputs, we can have those 3

Understanding the buffering argument of the io.open() method in Python 2.7

故事扮演 提交于 2019-12-12 05:46:53
问题 I am trying to understand the the buffering argument of the io.open() method in Python 2.7. I execute in the Python interpreter: import utils buffer_size = 4000 file = open('test.txt','w', buffer_size) file.write('\n'.join(map(str, range(10000)))) then I look at the test.txt file to see how many lines got written, even though I haven't called file.close() yet, and didn't do any manual file.flush() myself. If buffer_size = 4000 , I see that 9822 lines got written. However, buffer_size = 8192 ,

telnetlib and “buf = self.sock.recv(50)” error

为君一笑 提交于 2019-12-12 04:45:24
问题 I am using telnetlib for simple telnet script to Juniper switch. Below is my code: import telnetlib HOST = raw_input("Enter host IP address: ") USER = raw_input("Enter Username: ") PWD = raw_input("Enter Password: ") TNT = telnetlib.Telnet(HOST, 23, 10) TNT.read_until("login:") TNT.write(USER.encode('ascii') + "\n") TNT.read_until("Password:") TNT.write(PWD.encode('ascii') + "\n") TNT.write("set cli screen-length 10000\nconfigure\nshow\nexit\n") print (TNT.read_all().decode('ascii')) TNT

Unable to access buffer data after screen capture

折月煮酒 提交于 2019-12-12 04:42:58
问题 We are trying to develop a solution where a Desktop screen from a Windows XP machine needs to be monitored remotely. From our experience, we have identified that GDI based approach is faster than that of DirectX front buffer capture. In GDI we are getting the handle to the screen as follows. // Get the Desktop windows handle and device context hDesktopWnd=GetDesktopWindow(); hDesktopDC=GetDC(hDesktopWnd); // Get the handle to the existing DC and create a bitmap file object HDC hBmpFileDC

Icecast relay stream can buffer a progressive audio stream

偶尔善良 提交于 2019-12-12 04:37:09
问题 After reading the documents of icecast, I have two questions: 1) I'm not sure the icecast server can buffer audio streams, if It does can, How about using relaying? 2) If i have many dynamic relay servers to proxy, How to config the config file? I mean I have to change the config file dynamicly, since i have not sean that icecast supports the regular expression such as /realtime(\d+) to match all the realtime stations. 回答1: Icecast does buffer streams. When a client connects, the buffer data

OpenGL: glAccum error 1282 (Invalid Operation)

社会主义新天地 提交于 2019-12-12 04:19:31
问题 Edit: added some error checking code and found error '1282' is being thrown when I do glAccum(..) Edit2: I've tried the exact same code on a different computer, it works perfectly there. Edit3: 'Solution' ATI HD4xxx and up cards dont support accumulation buffers anymore :*( So it doesn't work on Windows 7 64bit with a HD4850 and up-to-date drivers It does work on Windows 7 32bit with an Intel series 4 IGP. (GL_ACCUM_RED_BITS = 16). I also tried it really really quick on a Linux based machine

C++ - Buffer combining adding extra empty values

不羁的心 提交于 2019-12-12 04:08:47
问题 I am trying to fill two buffers, an index buffer object and a vertex buffer object in C++. // Create the IBO and VBO data GLushort* iboData = new GLushort[polyProcessed * 3]; Vertex* vboData = new Vertex[vertProcessed]; int iboPos = 0; int vboPos = 0; // Create the VBO and IBO for(int i = 0; i < fragMap[0x36]; i++) { // Copy the data to the IBO memcpy(iboData + iboPos, zmeshes[i].indices, zmeshes[i].numPoly * 3 * sizeof(GLushort));//sizeof(*zmeshes[i].indices)); // Advance the position iboPos