File Handling refer to some command that manipulate the file problematically. Like read, append, delete commands.
38
votes
12answers
9k views
Is it a bad practice to store large files (10 MB) in a database? [closed]
I am currently creating a web application that allows users to store and share files, 1 MB - 10 MB in size.
It seems to me that storing the files in a database will significantly slow down ...
38
votes
7answers
5k views
Difference between '\n' and '\r\n'
Yes yes, I am aware that '\n' writes a newline in UNIX while for Windows there is the two character sequence: '\r\n'. All this is very nice in theory, but my question is why? Why the carriage return ...
13
votes
7answers
918 views
Best way to handle delimited files
So typically a CSV file uses a comma and the return character as it's field and line delimiters.
This runs into obvious problems with text which can contain both these characters.
Obviously there ...
9
votes
6answers
794 views
Is it necessary to read every single byte to check if a copied file is identical to the original?
I recently learned of a program called Total Commander. It's a Windows Explorer replacement and has its own stuff to copy files. To check whether the files are identical, instead of calculation a CRC, ...
8
votes
4answers
567 views
What's the best practice for naming uploaded images?
Suppose I have a form in my web application where users can upload a profile picture.
I've got few requirements about file size, dimensions etc, but when the user uploads the image, how should I name ...
8
votes
4answers
265 views
Should the creation of an object implicitly or explicitly create a file?
I'm creating an object whose sole purpose is to read in a file of one format and create another of a different format.
Is it best to create the output file implicitly during object initialization or ...
7
votes
9answers
1k views
Multithreaded file copy
There is an utility we have which is used to upload files (and perform other operations on the file) to a network shared location.
The file size tends to vary from a few mb to 500 mb.
A suggestion has ...
4
votes
3answers
336 views
What is the best practice for reading a large number of custom settings from a text file?
So I have been looking through some code I wrote a few years ago for an economic simulation program. Each simulation has a large number of settings that can be saved to a file and later loaded back ...
4
votes
1answer
108 views
What does “windowed streaming” stand for?
So I was asking around the Mercurial development mailing list about binary diffing and patch handling and I got the following examples:
whole file approaches (classic diff, bsdiff, Mercurial's ...
3
votes
3answers
401 views
Was API hooking done as needed for Stuxnet to work? I don't think so
Caveat: I am a political science student and I have tried my level best to understand the technicalities; if I still sound naive please overlook that.
In the Symantec report on Stuxnet, the authors ...
3
votes
3answers
208 views
Design: Method that loads data from one of two file formats?
Say I have a class Person:
class Person
{
string FullName;
int Age;
}
And I need to load a list of Person's from a plain text file. The text file could be in one of two formats. I want a ...
3
votes
3answers
309 views
Any good reason to open files in text mode?
(Almost-)POSIX-compliant operating systems and Windows are known to distinguish between 'binary mode' and 'text mode' file I/O. While the former mode doesn't transform any data between the actual file ...
3
votes
3answers
145 views
Storing lots of large strings with frequent “appends” and few reads
In my current project, I need to store a very long ASCII string to each instance of a given object. This string will receive an 2 appends per minute and will not be retrieved so frequently.
The ...
3
votes
2answers
616 views
PHP file_put_contents File Locking
The Senario:
You have a file with a string (average sentence worth) on each line. For arguments sake lets say this file is 1Mb in size (thousands of lines).
You have a script that reads the file, ...
2
votes
5answers
115 views
Closest file match?
I am looking for a way to compare a set of files against a given file with each comparison giving me a "closeness" metric. I should then be able to order based upon the metric to find the closest ...