buffer

how to garbage collect a direct buffer java

I have a memory leak that I have isolated to incorrectly disposed direct byte buffers. ByteBuffer buff = ByteBuffer.allocateDirect(7777777) The GC collects the objects that harbor these buffers but does not dispose of the buffer itself. If I instantiate enough of the transient objects containing buffers I get this encouraging message. ...

.NET: Inject Data into Input-Buffer of Process

Hi * I need to automate an command line application. It asks the user to enter a password. All my approches to send the password via STDIN failed. Now I am trying to do this with an wrapper-programm using .NET. I am starting the application creating a new process, setting the StartInfo-properties and then start the process: Dim app_pa...

C# FileStream : Optimal buffer size for writing large files ?

Suppose I'm writing a couple of files to disk, between 2MB and 5GB. What are sensible buffer values for the FileStream ? Is it sensible to work with buffersizes of several megabytes, or should I stick to kilobyte-buffers ? ...

A dynamic buffer type in C++?

I'm not exactly a C++ newbie, but I have had little serious dealings with it in the past, so my knowledge of its facilities is rather sketchy. I'm writing a quick proof-of-concept program in C++ and I need a dynamically sizeable buffer of binary data. That is, I'm going to receive data from a network socket and I don't know how much the...

how to replace a current line with what in a buffer using vi

Say i have line stored in buffer k. how do I replace some line with the content of the buffer? ...

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

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? ...

How to implement a circular buffer in Blackberry or java me?

How can we program a circular buffer for Blackberry? ...

C++/CLI efficient multithreaded circular buffer

I have four threads in a C++/CLI GUI I'm developing: Collects raw data The GUI itself A background processing thread which takes chunks of raw data and produces useful information Acts as a controller which joins the other three threads I've got the raw data collector working and posting results to the controller, but the next step i...

boosts buffer into char* (no std::string)

So, it may be sounds as a realy newbies question... And proboly it is newbies :) I try to turn infomation from boost::asio::streambuf which I got, using read_until into char*. I've found realy many examples of turning it into std::string, but I'd mad, if use bufer -> std::string -> c_str in an application, needs a high perfomanse. (But ...

How to iterate over a string using a buffer (python)

Hi all, I'm trying to find some code that, given a string, will allow me to iterate over each line using the for loop construct, but with the added requirement that separate for loop constructs will not reset the iteration back to the beginning. At the moment I have sList = [line for line in theString.split(os.linesep)] for line in SL...

buffer overflow

How can a buffer overflow effect the OSI model? How many layers of the OSI model can be affected by an buffer overflow vulnerability. ...

Selenium-rc: Is there a way to send a buffer of requests

Lets say I have a list of links and want to click a link at random: <div id="divA"> <a> first link </a> <a> second link </a> ... </div> It isn't the smartest of ways (and if you have a better solution please tell me) but what I currently do is (roughly): l = [] for i in range(numOfLinks): xpath = '//div[@id="divA"]/a[%d]...

OpenGL Frame Buffer Object for rendering to textures, renders weirdly

I'm using python but OpenGL is pretty much done exactly the same way as in any other language. The problem is that when I try to render a texture or a line to a texture by means of a frame buffer object, it is rendered upside down, too small in the bottom left corner. Very weird. I have these pictures to demonstrate: This is how it loo...

How do I set the line width in OpenGL relative to the viewing area of a frame buffer?

glLineWidth rasterises the width so it shows as that width on the screen. I want it to be that width on a frame buffer. Thank you. ...

Correct way to read a text file into a buffer in C?

I'm dealing with small text files that i want to read into a buffer while i process them, so i've come up with the following code: ... char source[1000000]; FILE *fp = fopen("TheFile.txt", "r"); if(fp != NULL) { while((symbol = getc(fp)) != EOF) { strcat(source, &symbol); } fclose(fp); } ... Is this the correc...

Is there anyway to programmably flush the buffer in log4net

Hi I'm using log4net with AdoNetAppender. It's seems that the AdoNetAppender has a Flush method. Is there anyway I can call that from my code? I'm trying to create an admin page to view all the entries in the database log, and I will like to setup log4net with bufferSize=100 (or more), then I want the administrator to be able to clic...

When should I allocate DirectSound buffers?

Please help me make up my mind. Allocate at the start of the application, free at the exit. Allocate when streaming starts, free as soon as streaming stops. Which one? Why? In case it matters: it's a voice communication application like Ekiga. I'm allocating the buffers with DSSCL_NORMAL (the 8bit 22KHz limitation is false as far as...

Is there a buffer size attached to stdout?

I am trying to find some information on data limits related to stdout on Windows. I can't seem to find the information on MSDN. Is there a limit to how much data can be written to stdout? If so, what happens if the limit is reached? Is the data lost? If stdout is redirected (for example, by launching the process from .Net and using the...

Using fstream tellg to read a portion of the stream till the end.

Hello: I have this simple code that needs to get a chunk of a large log file that is being written into. At some point it stores the current location returned from streampos start = istream::tellg(); method. Later on the code has to read from the stream a buffer from the start till the end. The code is approximately like this: streamp...

Packets down a named pipe? Single-byte buffer or pre-sized?

I want to send 'packets' of data (i.e. discrete messages) between two programs through named pipes. Given that I have to supply a buffer and a buffer size to read, and given that the read command is blocking (I believe), I either have to have a buffer size that guarantees I never get an under-run, or to know the size of the message up-fr...