Hi,
I have a little problem with compiling my project in emacs. The compilation buffer does not line-wrap and I have some very long compile and link commands which I would like to sanity check sometimes.
Does anyone know how to force line-wrap on the output added to the compilation buffer, ideally as it is added (a la auto-fill).
V...
Hi,
In order to make a binary comparer I'm trying to read in the binary contents of two files using the CreateFileW function. However, that causes the whole file to be bufferred into memory, and that becomes a problem for large (500MB) files.
I've looked around for other functions that'll let me just buffer part of the file instead,...
I would like to read a string from a TCP stream that is given with a byte length followed by the actual data. In Python, I would do
length = ord(stream.read(1))
data = stream.read(length)
How do I do the same in Java NIO? What I have is a buffer (of capacity 257)
stream.read(buffer); // cannot specify a size here
int length = buffer....
I unefficiently use "^a + ESC SPACE -- SPACE" and "^a + ]".
1. How can I copy a big file to GNU Screen buffer like
^a + : cat big_file > new_buffer
^a + : new_buffer ]
2. How can specify the number for each buffer like
^a + : cat big_file 2> new_buffer_number_2
^a + 2]
...
[Updated]
The question is related to the questions GNU Screen: Programmers quotes in Readbuf and GNU Screen: files to numbered buffers?. Since they are not solved, the question targets more general concept about environment variables. My belief is that they are the key to make Screen more efficient.
1. How can I use Bash's variables in ...
If I have the following example file where each number is represents a byte (123 has bytes 1, 2, and 3):
123456789
Let's say I create a FileInputStream. This reads in the binary byte by byte. So .read() returns 1, then 2, etc. Now let's say I create a buffer. The initial chunk it reads in (if I understand buffers correctly) is 1-5. Th...
I'm having an issue trying to parse the ascii part of a file, and once I hit the end tag, IMMEDIATELY start reading in the bytes from that point on. Everything I know in Java to read off a line or a whole word creates a buffer, which ruins any chance of getting the bytes immediately following my stop point. Is the only way to do this rea...
Could someone explain to me the uses of using buffers, and perhaps some simple (documented) examples of a buffer in use. Thanks.
I lack much knowledge in this area of Java programming, so forgive me if I asked the question wrong. :s
...
Hi,
I am working on a simple protocol stack for a small embedded system (multidrop, rs485 type stuff). In this stack, losely models after OSI layers:
Application
Network
Datalink
physical (serial driver)
Each layer has its own header / footer portion that wraps the payload of the layer above it.
I will be using my own buffer pool ...
I've written a buffer class that provides a File-like interface with read, write, seek, tell, flush methods to a simple string in memory. Of course it is incomplete (e.g. I didn't write readline). It's purpose is to be filled by a background thread from some external data source, but let a user treat it like a file. I'd expect it to cont...
Hi,
Some overflow runtime error happens when my C++ program is trying to write some .png images into a directory.
The directory where the images are written into is given as a command line argument. The program is compiled with gcc -ggdb3 -O3. It is strange that the error disappears if I change the directory to another one when rerun...
I'm having a headache trying to figure out why vim isn't copying to a system buffer.
Here's my workflow:
vim asd
y1y
:q
vim qwe
p
On computerA and computerB, this works as I want it to: the line yanked from the file asd is put into the file qwe.
On computerC, this doesn't work.
All systems are running Ubuntu 8.04. computerA has th...
I commonly build up long, multi-command pipes on Linux/Unix to process large text files (sed | grep | sort | less , etc.).
I would like to be able to use a pipeline element that would buffer everything received via stdin until a key phrase/string is detected (e.g. "SUCCESS"), at which point it releases everything received up to that poi...
here is the code
ob_start(array(&$dispatcher, 'outputCallback'));
include($file);
ob_end_flush();
function outputCallback($string) {
if(ob_get_level() == 1) {
$static =& ParserStatic::getInstance();
return $static->insertToppings($string);
}
return false;
}
the problem is when i return $string it b...
I've created a simple buffer manager class to be used with asyncroneous sockets. This will protect against memory fragmentation and improve performance. Any suggestions for further improvements or other approaches?
public class BufferManager
{
private int[] free;
private byte[] buffer;
private readonly int blocksize;
pu...
hello, I have a general question about popen (and all related functions), applicable to all operating systems, when I write a python script or some c code and run the resulting executable from the console (win or linux), i can immediately see the output from the process. However, if I run the same executable as a forked process with its ...
I have a unsigned char buffer, and I'm wondering how I would write and read signed and unsigned bits to this byte buffer.
In the Source Engine there is a class named bf_write, which two main methods (used by WriteString, WriteChar, WriteLong, etc.) use two functions named WriteUBitLong and WriteSBitLong.
Thanks in advance
...
Okay, I was writing a simple C++ function to combine cin'd strings. I'm working on Linux at the moment, so I don't have the luxury of a simple "getline(cin, input)" command. Here's the code so far:
string getLine()
{
string dummy;
string retvalue;
do
{
cin << dummy;
retvalue ...
By 'empty buffer,' I mean a buffer full of zeroes.
I am searching for a faster method of accomplishing this:
int is_empty(char * buf, int size) {
int i;
for(i = 0; i < size; i++) {
if(buf[i] != 0) return 0;
}
return 1;
}
I realize I am searching micro optimization unnecessary except in extreme cases, but I know a faster method ...
I am retrieving the HTML from the web. I get "java.lang.OutOfMemoryError: Java heap space (repl-1:3)"
;; fetch: URL -> String
;; fetch returns the string of the HTML url
(defn fetch [url]
(with-open [stream (. url openStream)]
(let [buffer (BufferedReader. (InputStreamReader. stream))]
(apply str (line-seq buffer)))))
...