io

How do I take the output of one program and use it as the input of another?

I've looked at this and it wasn't much help. I have a Ruby program that puts a question to the cmd line and I would like to write a Python program that can return an answer. Does anyone know of any links or in general how I might go about doing this? Thanks for your help. EDIT Thanks to the guys that mentioned piping. I haven't use...

an htop-like tool to display disk activity in linux

I am looking for a linux command-line tool that would report the disk IO activity. Something similar to htop would be really cool.Has someone heard of something like that? Thanks! EDIT: for the vote down:about not being programming -related. I happen to need to check if my code is actually behaving as I expect which involves looking at...

How can I tell if a file has changed through .NET?

Hello World! I am looking for a way to determine when a particular file has changed, through .NET. (What I ultimately want is functionality that makes a copy of the file as soon as it has changed.) How can this be done? ...

Loading a text file into a vector <string>

I want to load separately the words on a text file like text.txt Hi this is a text file with many words I don't know how many into a vector<string> how do I go about it? ...

FileNotFoundException thrown when the file does exists.

Hello. I'm facing this strange problem. I'm trying to read a file that is located in another machine as a shared resource: \\remote-machine\dir\MyFileHere.txt When I run a standalone application ( a 16 lines java file ) everything is just fine. But when I attempt to read the same file with using the same class and the same method fr...

What Process is using all of my disk IO

If I use "top" I can see what CPU is busy and what process is using all of my CPU. If I use "iostat -x" I can see what drive is busy. But how do I see what process is using all of the drive's throughput? ...

"Reliable" file work with .NET

Hi, An application needs a counter, which value to be stored in a text file. Sometimes it happens on very short intervals. This test code rewrites a text file very often (f.e. every 100 milliseconds): int counter = 0; while (true) { WriteToFile(counter); counter++; Thread.Sleep(100); } private void WriteToFile(int counter) { byt...

Unicode (utf8) reading and writing to files in python

I'm having some brain failure in understanding reading and writing text to a file (Python 2.4). # the string, which has an a-acute in it. ss = u'Capit\xe1n' ss8 = ss.encode('utf8') repr(ss), repr(ss8) ("u'Capit\xe1n'", "'Capit\xc3\xa1n'") print ss, ss8 print >> open('f1','w'), ss8 >>> file('f1').read() 'Capit\xc3\xa1n\n' ...

How to Read only the last line of a text file in Lua?

I have a program that generates text fiels that can be up to 20 mets in size. Sometimes I only care about the last line in the file, is there a way to read just that line with out wasting memory reading the rest of the file? ...

Java - Capturing System.err.println or Capturing a PrintStream

Hi Java Newbie question : I need to capture the text being written to a printStream by a 3rd party component. The PrintStream is defaulted to System.err, but can be changed to another PrintStream. Looking through the docs, I couldn't find an easy way to direct the contents of a PrintStream to a string writer / buffer. Can someone pl...

Testing IO.Stream interaction

I have a method in my business logic layer that accepts a stream, which in the GUI comes from a user uploading a file, and I am interested in which is an appropriate way to test that the method appropriately uses this stream to make decisions. public Sub Initialize(ByVal uploadStream As Stream) ''// Logic using uploadStream End Sub ...

File Copying optimization through multiple threads

Can you make file copying faster through multiple threading? Edit: To clarify, suppose you were implementing CopyFile(src, tgt). It seems logical that under certain circumstances you could use multiple threads to make it go faster. Edit Some more thoughts: Naturally, it depends on the HW/storage in question. If you're copying from on...

C# check that a file destination is valid

Is there a standard function to check that a specified directory is valid? The reason I ask is that I am receiving an absolute directory string and filename from a user and I want to sanity check the location to check that it is valid. ...

Stackless python network performance degrading over time?

So i'm toying around with stackless python, writing a very simple webserver to teach myself programming with microthreads/tasklets. But now to my problem, when I run something like "ab -n 100000 -c 50 http://192.168.0.192/" (100k requests, 50 concurrency) in apache bench I get something like 6k req/s, the second time I run it I get 5.5k,...

Do ASMX or WCF Proxy clients use IO completion ports?

I'm in the middle of performance testing a critical section of my project, when I notice a whole lot of extra threads being used to to perform WaitOrTimerCallback operations. On closer inspection I can see that these are being spawned by my ASMX client proxy class for operations on a remote server. I was under the impression that t...

How you test your applications for reliability under badly behaving i/o

Almost every application out there performs i/o operations, either with disk or over network. As my applications work fine under the development-time environment, I want to be sure they will still do when the Internet connection is slow or unstable, or when the user attempts to read data from badly-written CD. What tools would you reco...

Convert a StreamWriter to an OutputStream in java ?

I am trying to redirect System.out into a String using System.setOut, which takes a PrintStream. Is there any way to convert a StringWriter into a Stream so that I can pass it to setOut? ...

Java - Reading Strings and Binary from the same stream

I have a file that contains some amount of plain text at the start followed by binary content at the end. The size of the binary content is determined by some one of the plain text lines I read. I was using a BufferedReader to read the individual lines, however it exposes no methods to refer to read a byte array. The readUTF for a DataI...

Download image with Ruby RIO gem

My code: require 'rio' rio('nice.jpg') < rio('http://farm4.static.flickr.com/3134/3160515898_59354c9733.jpg?v=0') But the image downloaded is currupted. Whtat is wrong with this solution? ...

Do most modern kernels use DMA for network IO with generic Ethernet controllers?

In most modern operating systems like Linux and Windows, is network IO typically accomplished using DMA? This is concerning generic Ethernet controllers; I'm not asking about things that require special drivers (such as many wireless cards, at least in Linux). I imagine the answer is "yes," but I'm interested in any sources (esp. for t...