buffer

Problem with realloc() in C. Always hangs but compiles fine...

Hi there, I'm having some trouble with a program that is intended to be a String buffer, specifically this function is intended to reset the buffer with the string cstr. If cstr is null then the content needs to be reset to an empty char '\0'. It always hangs at the second set of realloc where it's resizing buf->contents I have no clue w...

How can I open a help file in Vim on a new buffer in an existing window?

I often take a look at help files in Vim, but sometimes I want to read one in full screen. Since the :help command opens it in a new window, and closing the old window, if it was the only one besides of the help file, for some reason closes Vim, the only way I found of doing this was opening the help file, and then reopening it in a new ...

StreamReader and buffer in C#

I've a question about buffer usage with StreamReader. Here: http://msdn.microsoft.com/en-us/library/system.io.streamreader.aspx you can see: "When reading from a Stream, it is more efficient to use a buffer that is the same size as the internal buffer of the stream.". According to this weblog , the internal buffer size of a Stream...

SQL Server Deadlock Problem - How to Resolve ?

Hi All We have a SQL Job (2005) that from time to time will fail due a deadlock. The error is as follows ; Transaction (Process ID 52) was deadlocked on thread | communication buffer resources with another process and has been chosen as the deadlock victim. Rerun the transaction. [SQLSTATE 40001] (Error 1205). The step failed. This i...

How to delete multiple buffers in Vim?

Assuming I have multiple files opened as buffers in Vim. The files have *.cpp, *.h and some are *.xml. I want to close all the xml files with :bd *.xml. However, Vim does not allow this (E93: More than one match...). Is there any way to do this? P.S. I know that :bd file1 file2 file3 ... works. So can I somehow evaluate *.xml to file1....

Php Record Buffer Fread Problem

function Ifurl($subject) { $pattern = "/http:\/\//"; $regex = preg_match_all($pattern, $subject, $array); if ($regex == 1) { return true; //true that it exist } else { return false; //flase mother fucker! } } function g...

Help using semphores and threads

I am using the pthread library to simulate a threaded buffer. I am also using semaphores as a solution to accessing critical section variables one at a time. The main problem is that the producer is filling the entire buffer and the consumer is then emptying the entire buffer. Is this code correct? I was assuming that the production a...

In vim can you split multiple files from the command line?

In vim you can edit multiple files when you launch, a la: $ vim file1 file2 file3 Then you can edit each file one after the other. What I would like to do is have file1, file2, and file3 all open up in different buffers, like they would if I did $ vim, :split file1, :split file2, :split file3 Is this possible? I'd also settle for be...

TCP Socket file transfer

Hello, I'm trying to write a secure transfer file program using Python and AES and i've got a problem i don't totally understand. I send my file by parsing it with 1024 bytes chunks and sending them over but the server side who receive the data crashes ( I use AES CBC therefore my data length must be a multiple of 16 bytes ) and the e...

Writing to SDCARD problem in Android ??

When implementing download function it work but during file saving to sdcard i get the following Default buffer size used in BufferedInputStream constructor. It would be better to be explicit if an 8k buffer is required. Also IO Exception occure W(14495:0x389f) java.io.FileNotFoundException: /sdcard W(14495:0x389f) at org.apa...

Why does SetCookie have to be called at the Beginning of an HTTP Response?

while reading about cookies i found difficulty to grasp the following statement "setcookie() must be called before any output to the HTTP response. The main reason is that PHP is not buffering the HTTP response" please help me to interpret it in easy way ...

Silverlight MediaElement double buffering

Hello, I have a MediaElement that displays a simple progress bar when buffering. It gets displayed or hidden on the BufferingProgressChanged event. For the code, see below. The problem is that quite often the MediaElement decides to buffer twice, causing the progress bar to show up twice. Why is this and is there a way to fix this? Th...

PHP - ob_start("ob_gzhandler") why the function not use directly in zend framework project?

Hi, I beginer in zend framework. ob_start("ob_gzhandler") - why the function not use directly in zend framework project? (does ob_start("ob_gzhandler") used auto in zend framework? ) Thanks ...

Why do I need std::get_temporary_buffer ?

For what purpose I should use std::get_temporary_buffer? Standard says the following: Obtains a pointer to storage sufficient to store up to n adjacent T objects. I thought that the buffer will be allocated on the stack, but that is not true. According to the C++ Standard this buffer is actually not temporary. What advantages does ...

What's a buffer?

Hello! As far as my understanding of languages goes, a buffer is any portion of memory in which a data is stored like an int,float variables, character arrays etc. However, I was reading buffer overflows and came across this link while reading about stack http://www.tenouk.com/Bufferoverflowc/Bufferoverflow2a.html The diagram in this li...

Why FileOutputStream does not throw OutOfMemoryException

Hi, I've tried the code below on both Windows (64bit) and Linux(32bit). I was sure that without BufferedOutputStream the code is bound to throw OutOfMemoryException yet it didn't. Why is that? Who is doing the {caching / buffer / steaming} to disk there? Can you please describe, if relevant to the answer, the full flow (Java API ->...

MS Visual c++ 2008 char buffer longer than defined

I've got a char* buffer to hold a file that i read in binary mode. I know the length of the file is 70 bytes and this is the value being used to produce a buffer of the correct size. The problem is, there is 17 or 18 extra spaces in the array so some random characters are being added to the end. Could the be a unicode issue? ulFLen stor...

Efficient C# byte queue for parsing stream of bytes for binary message packets

Hi, I'm trying to replace what I would usually implement as a circular-buffer+. The function of the queue is to buffer incoming bytes (eg. from serial port or some other stream of data), whilst a parser examines bytes in the queue and detects and extracts message packets. Criteria: can grow (ie not fixed-sized) >= 1 bytes can be e...

C - read string from buffer of certain size

Hey, I have a char buf[x], int s and void* data. I want to write a string of size s into data from buf. How do I do that? Thanks in advance. ...

elisp regexp search in strings, not buffers

I have been searching everywhere in the emacs lisp documentation for how to regular expressions search into a string. All I find is how to do this in buffers. Is there something I'm missing? Should I just spit my string into a temporary buffer and search for it there? Is this just the coding style of elisp, something I'll get used to?...