The facts:
When a file is moved, there's two possibilities:
The source and destination file are on the same partition and only the file system index is updated
The source and destination are on two different file system and the file need to be moved byte per byte. (aka copy on move)
The question:
How can I determine if a file will ...
Is is possible to open a text file and read the contents while another application is updating the file, in such a way that it does not cause a lock conflict?
I need to monitor a log file from one application which is updated by another application each time an event occurs.
I do check if the file is in use before I try to read it, bu...
Is there a way to write a string directly to a tarfile? From http://docs.python.org/library/tarfile.html it looks like only files already written to the file system can be added.
...
I have a 384MB text file with 50 million lines. Each line contains 2 space-separated integers: a key and a value. The file is sorted by key. I need an efficient way of looking up the values of a list of about 200 keys in Python.
My current approach is included below. It takes 30 seconds. There must be more efficient Python foo to get th...
I need to delete a bunch of subdirectories that only contain other directories, and ".svn" directories.
If you look at it like a tree, the "leaves" contain only ".svn" directories, so it should be possible to delete the leaves, then step back up a level, delete the new leaves, etc.
I think this code should do it, but I'm stuck on what ...
I'm attempting to provide a script-only solution for reading the contents of a file on a client machine through a browser.
I have a solution that works with Firefox and Internet Explorer. It's not pretty, but I'm only trying things at the moment:
function getFileContents() {
var fileForUpload = document.forms[0].fileForUpload;
...
Hi
My blackberry application has some mp3 files bundled with the application. I want to add these files from the app to a folder in the sdcard or a folder in my phone memory through program.
How can I do this? Is it possible?
Thanks.
...
I've found several examples and documentation that show how to read and write files on the system, but all show user intervention or reading/writing files in user profile directories. There are a few things I want to do:
Monitor system and other application log files for changes, then automatically load those files when changes occur
...
I am already using this example of how to read large data files in PHP line by line
Now, what it'd like to do, is obtain the total number of rows in the file so that I may display a percentage complete or at least what the total number of rows are so I can provide some idea of how much processing is left to be done.
Is there a way to g...
I need to read the last 25 lines from a file (for displaying the most recent log entries). Is there anyway in Ruby to start at the end of a file and read it backwards?
...
I am trying to read in from a few files using something like this
IO.foreach("TeamFields.txt") { |line| fieldNames.push(line.chomp) }
It works fine when running the from the command line, but when I package to an .exe with shoes and run it can't find the file. Is there a way to specify a path relative the the .exe or do I have to prov...
I need to write a large amount of data in my application. Data arrive periodically and pushed into the queue.
//producer
queue_.push( new_data );// new_data is a 64kb memory range
PostThreadMessage(worker_thread_id_, MyMsg, 0, 0);//notify the worker thread
after that, i need to write this data to the file. I have another thread, that ...
Using java, how do you get the amount of free space on a solaris zfs file system?
I have a SunFire x4140 with built-in hdd mounted as /. It also has a connected JBOD with 7.6TB of HDD space, configured as a ZFS file system and mounted as /app.
I use java.io.File.getUsableSpace or java.io.File.getFreeSpace to get the amount of free spac...
I am writing a concurrent, persistent message queue in C++, which requires concurrent read access to a file without using memory mapped io. Short story is that several threads will need to read from different offsets of the file.
Originally I had a file object that had typical read/write methods, and threads would acquire a mutex to cal...
This is my assignment:
link
Here are my questions:
How can I fix this error:
Exception in thread "main" java.lang.NumberFormatException: empty String
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:1012)
at java.lang.Double.parseDouble(Double.java:527)
at extracredit.Main.read...
I have a small code block that should append text to the beg of a file. However it still only adds to the end of the file. I thought the rewind set the pointer to the front of the file, thus when I added the text using fprintf it should add to the front. How can I change this?
fp = fopen("Data.txt", "a");
rewind(fp);
fprintf(fp, "%s\n",...
I'm using sqlite to do an index of a proprietary file, and the database will be accessed with multiple threads (using different sqlite handles) for reading and writing.
I know that sqlite locks the file in order to provide concurrency for readers/writers, and depends on the OS file api for locking.
This is all fine on windows and linux...
Does Python have an equivalent to the $OUTPUT_RECORD_SEPARATOR or $\ in Perl?
UPDATE:
I totally had this wrong... I was looking for a Python equivalent to a $INPUT_RECORD_SEPARATOR if there is such a thing?
Something that you can override so that when you do a readline() type call its looking for something other than the newline char. S...
Hello. I have a base controller abstract class, which my other controllers inherit. This class needs to load a local xml file in order to create some buttons for the master page. Given that the ControllerContext is null at this stage, what is the best practice for loading the file? (When running on the webserver, I get the following erro...
hi guys,
I am running windows application in vb.net.I have a xml file named mail.xml in folder named XmlFiles.In default.aspx.vb i have to get the path of mail.xml.What code i hve to write to make it possible?
...