File handling refers to the set of tools, functions, and libraries to work with files and file handles. Creating, writing, appending, moving, and deleting files fall in this domain.

learn more… | top users | synonyms

-2
votes
0answers
48 views

What is the best way to store user uploaded Java files? [duplicate]

I am working on a website where users can upload their own Java files, and we will later compile and execute them. I will address the risks of executing users' code separately, but what would be the ...
16
votes
3answers
964 views

Should I pass in filenames to be opened, or open files?

Suppose I have a function that does things with a text file - for example reads from it and removes the word 'a'. I could either pass it a filename and handle the opening/closing in the function, or ...
2
votes
3answers
88 views

Smart fallback for line endings in code files? [closed]

What do you recommend as a default fallback for line endings if the operating system cannot be determined? Example Mac OS up to version 9 uses carriage returns (\r) for line endings. Unix-like ...
1
vote
1answer
73 views

Holding of files being edited in a text editor

I'm writing an implementation of Ex (hopefully Vi eventually) as a personal project. I need to somehow store an identifier for the file associated with each buffer. In terms of security/race ...
2
votes
2answers
131 views

Recreating files from shell script or java?

I have java application which takes a file, which is created by a process running on terminal. I start the process using a small shell script. Then run the Java application and it reads the file ...
1
vote
2answers
148 views

Is creating and writing to one large file faster than creating and writing to many smaller files in Python on Linux?

If using Python on a Linux machine, which of the following would be faster? Why? Creating a file at the very beginning of the program, writing very large amounts of data (text), closing it, then ...
1
vote
2answers
132 views

How do I / what is the best way to interact with a desktop application from a browser web application?

Situation: We have a desktop application. We also have a web application. We need the two to interact with each other. So when a button is pushed in the web application, the desktop application ...
1
vote
1answer
184 views

Design Pattern: A single class with multiple purposes, or multiple extended classes each with their own purpose in PHP

I'm working on a PHP framework called Carbon CMS. This framework will be used as base to build larger web applications on top of it. This framework should provide all kinds of interfaces such as ...
4
votes
1answer
178 views

How should I recursively process a file in Haskell?

Basically I'm expanding a literate program in Haskell. There are two things I need to look for to expand. Here's an example file: program.c.lit: ============== Some comments in the source file that I ...
2
votes
2answers
172 views

Why do binary files load quicker than alphanumeric text files?

I've noticed that when I load/store large data files in a binary format, the program runs much faster than if I load data from an ASCII encoded file. Why is this the case? The data in my case is ...
0
votes
2answers
279 views

Way for java program to read file from when it was stopped

I am working on an application that reads a log file, looks for a specific string, sends alert emails and saves data from the file into a database. The reading functionality is working well, but I am ...
1
vote
3answers
180 views

How to make a random-access archive of text files?

I wrote an application that tests the performance of evolutionary algorithms. This application performs a run of the algorithm which consists of several generations. The data which is produced by my ...
1
vote
2answers
260 views

Retrying a statement or call in a catch block - code smell or anti-pattern?

I'm wondering how better to perform this operation for a large amount of files. The bit I'd like some thoughts on whether this copy/paste is acceptable enough of a tradeoff. try to write a file if ...
5
votes
1answer
158 views

Is there a standard way of cleaning data files?

Having spent quite a lot of time working in software companies that deal in medium to large data sets, I've seen that a choke point in their processes is often prepping data files for loading into ...
-2
votes
4answers
116 views

How often should saving to disk occur in an automatically saving text editor? [closed]

I am developing a simple text editor and would like the application to save the text automatically. In other words, the user would never have to press a save button. I have seen other applications ...
3
votes
1answer
94 views

What does it mean that file IO binary flag is only relevant on Windows

I was reading a question and one of the comments mentioned that "The binary flag is only relevant on Windows". Given the context of the question and answer, I interpret this statement as on ...
0
votes
2answers
770 views

Large MySQL Batch Inserts From PHP: Run insert from script, or save as SQL file?

We have a large dataset that's current residing in many, many spreadsheets. I've been tasked with getting part of that data into our MySQL DB. When all is said and done, I will probably be inserting ...
1
vote
1answer
137 views

How to name filename parameter to make clear it should contain full path? [closed]

I'm seeking vital naming of string filename parameter in parameter list used in various methods where filename with full path is expected. In many cases also UNC path can be actually supplied as full ...
5
votes
1answer
193 views

Why is Java 7's new file API usage still so scarce? [closed]

I don't even know whether this is the correct StackExchange site to ask such a question but here it is... I principally lurk on StackOverflow; and I am frankly flabbergasted by the number of ...
0
votes
3answers
84 views

Write to stdout and redirect or write directly to file?

I can see two ways to fill an empty file with data: $ run_program arg1 > data_file or, specifically write code that manages a file and write to it? ie. a file stream? Which is better to ...
0
votes
3answers
163 views

How can I handle this string concatenation in C in a reusable way

I've been writing a small C application that operates on files, and I've found that I have been copy+pasting this code around my functions: char fullpath[PATH_MAX]; fullpath[0] = '\0'; ...
0
votes
2answers
135 views

Whats a good structure to save and retrieve locations of images?

I got a java-ee application, where I collect informations about movies. Im my backend I provide data like the name, description, genre and a random uuid. I also got lots of related files, which are ...
0
votes
3answers
206 views

Advantage of monitoring file change using Windows API rather than manually

I developed a Windows software about an year ago. Part of it was to monitor few configuration files for manual changes by user and if any of these change restart a particular service. So, I used the ...
4
votes
2answers
160 views

What is a stream, and how does it work?

Like a data stream in general, this can be an I/O stream or memory stream or a file stream or what not. I understand that it's some sort of stream of bytes, that you can read to parse very large ...
0
votes
1answer
53 views

Uploading files(code) on a web server?

I have a very small and basic web site on a web server. Usually I'm doing the changes on a localhost where the development version is, and after that I upload it to the server with FileZilla. That's ...
0
votes
3answers
105 views

Advice on which storage technology for an Image repository [duplicate]

At this point, I'm not much of a programmer, solid html/css, familiar with JS but not a programmer by any means. I'm looking to pick up whatever is necessary for an upcoming project. I need to build ...
2
votes
1answer
88 views

How to share a file over multiple projects

I'm using Visual Studio 2010 to amend a C# project. Part of the application requires the user to be able to save and read a settings file (1 Project reads them in (as read only) from a file. The ...
1
vote
1answer
250 views

Editing files without race conditions?

I have a CSV file that needs to be edited by multiple processes at the same time. My question is, how can I do this without introducing race conditions? It's easy to write to the end of the file ...
5
votes
4answers
623 views

Test Driven Development: A good/accepted way to test file system operations?

I am working on a project at the moment that generates a table (among other things) based on the contents of a file-system, and and in turn does some meta-data modifications on the things it finds. ...
0
votes
3answers
188 views

CSS File Editing for Teams? (how to avoid stepping on each others' feet?!)

I'm wondering if anyone has a good solution for when you're working as a team and there's a single file used throughout a project (like a styles.css file) and everyone needs to use it throughout the ...
13
votes
1answer
1k views

How do I test a file reader?

I am working on a project with a few file formats. Some formats are specified by .xsds, others by documentation on their respective websites, and some are custom in-house formats that have no ...
3
votes
2answers
521 views

How to simulate inner join on very large files in java (without running out of memory)

I am trying to simulate SQL joins using java and very large text files (INNER, RIGHT OUTER and LEFT OUTER). The files have already been sorted using an external sort routine. The issue I have is I am ...
-1
votes
2answers
5k views

How to update an existing excel file using java program? [closed]

I've made a file browser in java that opens and read already been made excel files. (using Apache poi 3.9 library) program read those files perfectly but i want to update some of those files. how can ...
1
vote
2answers
431 views

Ruby: Multithreading a CSV with output

I have a script written in Ruby that has maxed out a core in my server's Xeon processor for the last 2 hours. Since it's currently only using 1 of four possible cores, I want to try and rewrite the ...
0
votes
1answer
359 views

Reading a specific type of input from file

I have a software that reads from a file. Each object in the software takes 7 inputs viz. string string string float string float int I have an input file. It contains a number of input values. If ...
5
votes
5answers
380 views

How are new file formats constructed?

I've used a software suite that is installed in offices and on remote vessels. The installations communicate back and forth, and they do that by using a simple proprietary file format that looks ...
1
vote
3answers
406 views

Maintaining log stream after file name change

I'm trying to log to a file and move it about every 30 seconds. I'm using the os.rename function (which I do from a supervisord process) in python to move the current log to a timestamped log (which ...
5
votes
3answers
372 views

Where to load and store settings from a file?

I think this question should apply to most programs that load settings from a file. My question is from a programming point of view, and it is really how to deal with the loading of settings from a ...
4
votes
5answers
407 views

Should I encrypt files saved by my program

I'm trying to decide on what format I should save data in, and hopefully this question will help me come to a decision. The program I'm writing uses 'databases' in which word=meaning (not a ...
2
votes
2answers
675 views

Optimize Reading of Multiple files

I have a unique problem which I'm hoping someone can assist with. I have One big text file, our Production file. The data in the file is delimited in the following format Reference|Cost ...
0
votes
1answer
964 views

How to design an application that read files using MVC pattern?

I am going to write an application that reads data from a csv file, and display that data to the user. I intend to apply an MVC design pattern to create this application. A user will interact with ...
9
votes
4answers
3k 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 ...
4
votes
1answer
522 views

Designing status management for a file processing module

The background One of the functionality of a product that I am currently working on is to process a set of compressed files ( containing XML files ) that will be made available at a fixed location ...
3
votes
3answers
215 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 ...
1
vote
1answer
106 views

Efficient way to check for changes to the contents of folders

I am creating an application that maintains a database of files of a certain type in a given folder (and all subfolders) Initially the program will recurse the folders and add any file it finds of ...
2
votes
3answers
288 views

Quickly compute added and removed lines

I'm trying to compare two text files. I want to compute how many lines were added and removed. Basically what git diff --stat is doing. Bonus points for not having to store the entire file contents in ...
4
votes
2answers
5k 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
2answers
115 views

Criteria for selecting timeout value?

Situation: a piece of software reads frames of data from a file in a seperate thread and puts it on a queue, emptied by another thread. That second thread periodically checks on the queue and fails ...
3
votes
1answer
119 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 ...
1
vote
1answer
3k views

How are Java ByteBuffer's limit and position variable's updated?

There are two scenarios: writing and reading Writing: Whenever I write something to the ByteBuffer by calling its put(byte[]) method the position variable is incremented as: current position + size of ...