Net::HTTPResponse's body is a stream-like object, and you get can read its input in lazy chucks using read_body. In the rest of ruby, steams are represented as class IO. Is there a wrapper or something that lets me use a Net::HTTPResponse as if it was an IO object?
...
I've got a parser written using ruby's standard StringScanner. It would be nice if I could use it on streaming files. Is there an equivalent to StringScanner that doesn't require me to load the whole string into memory?
...
What is the most memory efficient way to remove duplicate lines in a large text file using C++?
Let me clarify, I'm not asking for code, just the best method. The duplicate lines are not guaranteed to be adjacent. I realize that an approach optimized for minimal memory usage would result in slower speeds however this is my restriction...
I have an external java application (blackbox), which requires authentication. I need to run this application in a batch setting, but it seems to be reading from standard input in some nonstandard way. That is, if I set the calling of the program to redirect STDIN to a file (... <password.txt) or pipe data to it (echo mypasword | ...), i...
The MSDN states in its description of ReadFile() function:
If hFile is opened with FILE_FLAG_OVERLAPPED, the lpOverlapped parameter must point to a valid and unique OVERLAPPED structure, otherwise the function can incorrectly report that the read operation is complete.
I have some applications that are violating the above recommend...
I'm trying to upload a file via URLConnection, but I need to read/write it as a binary file without any encoding changes.
So i've tried to read byte[] array from a FileInputStream, but now i have an issue. The PrintWriter object I use for outputing to the server does not allow me to do writer.write(content) (where content is of type byt...
I'm getting the following error when trying to write a string to a file in pythion:
Traceback (most recent call last):
File "export_off.py", line 264, in execute
save_off(self.properties.path, context)
File "export_off.py", line 244, in save_off
primary.write(file)
File "export_off.py", line 181, in write
variable.writ...
Hi,
I cant read a file, and I dont understand why:
f = open("test/test.pdf", "r")
data = list(f.read())
print data
Returns : []
I would like to open a PDF, and extract every bytes, and put it in a List.
What's wrong with my code ? :(
Thanks,
...
Suppose there is a System A which gives some output. This output is used as input by system B. The rate at which System A produces is faster than the rate at which system B consumes it. How can we implement this?
The System A sends video at 10mbps where system b can take up only 4mbps.how we can implement this.Also there should be conti...
How to obtain File Path/Name from an InputStream in Java ?
...
What class can I use for reading an integer variable in Java?
...
I want to print the content of a simple text file in Java exactly the way the text appears in the text file.
The print out has the same content as the text file but the format is not the same. Tabs and line breaks are ignored in the print out. Any help will be very much appreciated.
...
I am trying to create a new file and write XML to it:
FileStream output = File.Create(Path.Combine(PATH_TO_DATA_DIR, fileName));
The argument evaluates to:
C:\path\to\Data\test.xml
The exception is:
The process cannot access the file 'C:\path\to\Data\test.xml' because it is being used by another process.
What am I doing wrong he...
I have two Java.io.File objects file1 and file2. I want to copy the contents from file1 to file2. Is there an standard way to do this without me having to create a method that reads file1 and write to file2
...
I've read the documentation and I've tried lots of things in the REPL, and Googled, but I can't for the life of me understand how subprocess.Popen works in Python.
Here is some Ruby code I am using:
IO.popen("some-process") do |io|
while(line = io.gets)
# do whatever with line
end
end
How do I translate this into Python using...
Here is a typical sequence of events that occur :
Host device opens a service ( Host device accepts and opens all incoming connections)
A remote device connects to host device.
Now, we have a slave connection open at host device.
At host device, I want to know the bluetooth address of remote device.
I can always pass it as data from ...
I need to read binary PGM image files. Its format:
P5
# comments
nrows ncolumns
max-value
binary values start at this line. (totally nrows*ncolumns bytes/unsigned char)
I know how to do it in C or C++ using FILE handler by reading several lines first and read the binary block. But don't know how to do it in .Net.
...
I could use some hints or tips for a decent interface for reading file of special characteristics.
The files in question has a header (~120 bytes), a body (1 byte - 3gb) and a footer (4 bytes).
The header contains information about the body and the footer is only a simple CRC32-value of the body.
I use Java so my idea was to extend th...
Hello All,
I want to ensure I have done all I can to configure a system's disks for serious database use. The three areas I know of (any others?) to be concerned about are:
I/O size: the database engine and disk's native size should either match, or the database's native I/O size should be a multiple of the disk's native I/O size.
Dis...
Hi
Usually you have a single bound tcp port and several connections on these. At least there are usually more connections as bound ports. My case is different: I want to bind a lot of ports and usually have no (or at least very few) connections.
So I want to use NIO to accept the incoming connections.
However, I need to pass the accep...