io

Improving java file i/o performance when using a mapped network drive on Windows

We've created a java application that (among other things) uses the built-in file IO libraries to access a list of files inside a particular folder on a network share. When the folder is specified as a local file (e.g., c:\foobar), performance is fine. However, if we map a network drive to the folder, even if the folder is on the same ...

How can I detach a stream from a stream reader or stream writer?

I have a class which accepts a stream as input (in the constructor). It surfaces content from this stream through various methods. However, I don't want my object to be responsible for closing the stream -- that should be the responsibility of the caller. I therefore need to close my StreamReader inside my class, but I can't close the u...

Exception Message: Some kind of disk I/O error occurred

I am getting this error when I try to run a update query on a SQLite database. This only happens on XP (on Vista works fine). The database is created without any issue, insert also works fine. I also checked and I have permissions and disk space available (as sqlite.org says these are possible causes). ...

What are the return values for apr_file_open()?

I want to be able to differentiate between "file not exist" and "other" errors when opening a file using apr_file_open(). It seems like the official documentation at apr_file_open doesn't list expected return values or even file permission enums. Anyone can point me to more documentation on it? ...

Ruby won't read /proc/mounts IFF in a thread and on RHEL 5.5

I've been successfully reading the Linux file '/proc/self/mounts' from within a Ruby thread using stock Ruby in Ubuntu Lucid (ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]). Now I'm trying to do the same on Red Hat 5.5 (ruby 1.8.6 (2010-02-05 patchlevel 399) [x86_64-linux]), but the thread won't complete. I wrote a testing script...

What profiler should I use to measure _real_ time (including waiting for syscalls) spend in this function, not _CPU_ one.

The application does not calculate things, but does i/o, read files, uses network. I want profiler to show it. I expect something like something like in callgrind that calls clock_gettime each proble. Or like oprofile that interrupts my application (while it is sleeping or waiting for socket/file/whatever) to see what is it doing. I w...

console.writeline and System.out.println

What exactly is the technical difference between console.writeline and System.out.println? I know that system.out.println writes to standard output but is this not the same thing as the console? The manual for console.writeline is very abstract for me to understand it (http://download.oracle.com/javase/6/docs/api/java/io/Console.html)...

How to limit I/O operations in .NET application?

I'm developing an application (.NET 4.0, C#) that: 1. Scans file system. 2. Opens and reads some files. The app will work in background and should have low impact on the disk usage. It shouldn't bother users if they are doing their usual tasks and the disk usage is high. And vice versa, the app can go faster if nobody is using the dis...

C++: Where does the ofstream class save the files to?

I moved from Windows to Mac and now I'm experiencing a problem with the file input/output classes: ifstream & ofstream. In Windows when you run with g++/Code Blocks ofstream out("output.txt"); out << "TEST"; out.close(); A new file "output.txt" will be created in the same directory. However in MAC OS X, this file is created in my h...

python read from keyboard and detect end space or end of linue

I need a python code which does these 1.user enters a char 2.python gets it and displays whether its alphabets or numeric or space or newline char. output will be one of the following - its alphabets its numeric its space its newline ...

How is event driven programming implemented?

I was looking on how the twisted and node.js frameworks work and I am trying to understand exactly how the operating system supports I/O operations using callbacks. I understand it's good because we need less threads because we don't need to have blocked threads waiting for I/O operations. But something has to call the callback once the...

File handling in core java

I need to do some housekeeping.I accidentally setup my classpath same as my codebase and all classes are placed along with my code.I need to write a quick java program to select all files of the type .class and .class alone and delete it immediately.Has anyone done something related to this? ...

How can I increase the I/O queue depth to maximize performance

Disk benchmarks typically have a chart that shows the I/O throughput increasing as the queue depth increases. I'm assuming that what's going on at the hardware level is that the disk controller is reordering the requests to coincide with where the magnetic head happens to be. But how can I increase the queue depth in my own I/O-heavy a...

In what sense is the IO Monad pure?

I've had the IO monad described to me as a State monad where the state is "the real world". The proponents of this approach to IO argue that this makes IO operations pure, as in referentially transparent. Why is that? From my perspective it appears that code inside the IO monad have plenty of observable side effects. Also, isn't it possi...