A block of arbitrary information, or resource for storing information, accessible by the string-based name or path. Files are available to computer programs and are usually based on some kind of persistent storage.

learn more… | top users | synonyms

3
votes
1answer
23 views

Prompt system from reading a text file

I worked starting from basic example code from an exercise in chapter 10 of Java: A Beginner's Guide, Sixth Edition, the code in the exercise was not very good and I wanted to improve upon it and make ...
6
votes
1answer
39 views

Randomly selecting an adjective and noun, combining them into a message

This is my first Rust program. I have previously written a lot of Python, and some C. I would like some advice on whether I am doing things idiomatically, and any improvements I could make! I also ...
3
votes
1answer
32 views
2
votes
1answer
98 views

Loading data from a text file into the database as fast as possible

I'm building a Django (1.8.12) application that parses a .bc3 file (Standard Interchange Format for Databases of Construction and Real State) and loads all the data into the database (PostgreSQL ...
10
votes
2answers
97 views

Java hex dumper

Can somebody please try and help me speed up my code? The file is ~12MB (you can download it here). It takes around 500-600 milliseconds to run on my i7 4790k. ...
6
votes
1answer
168 views

Quote of the day program

Create a class diagram and Java code for the following system and scenario, taking into account the possibility of future extensions. The system is a command line utility that prints a short ...
3
votes
3answers
76 views

Scrape HTML into separate files for each chapter

I have written a program to read HTML file, find particular text, write text from that particular text to next particular text in a newly opened file. I am interested in code review. I am very new ...
1
vote
2answers
58 views

Find a specific file, or find all executable files within the system path

I wrote a function to find a specific file, or all the executable files with a given name and accessing flag, and I want to make ...
1
vote
1answer
48 views

Multiple emails and attachments, reusing memory stream

I am generating a pdf form based on user input from an MVC website form. The pdf is genrated using the Foxit .NET SDK, then attached to three separate emails, generated using Postal. It has been ...
3
votes
1answer
32 views

Putting a matrix from a text file into a list

I'm trying to read a text file with matrix and put it in a list, but I am using two loops here and I want my function to be faster. ...
5
votes
2answers
94 views

Counting occurrences of a word in a file

This gives me the output of how many times the word is in the file. (I will eventually want to enhance the program to output on what line of the file the word is.) ...
4
votes
1answer
32 views

Using arrays to read in file, append it with parsed program output and overwrite original

Yesterday a friend of mine asked on U&L: How to optimize 'grep'-and-save? I will summarise shortly. The output of the torque pbs queueing system tool qstat ...
10
votes
1answer
138 views

Fuzzy grep for fuzzy bears in pure Python

I am aware of the Python modules galore to do this, but this was partially a learning experience and partially all the functionality I need and no more. I'm writing a simple interpreter for a ...
-3
votes
1answer
55 views

Reading a file byte by byte in Java [closed]

I am currently using this: Path path = Paths.get("c:\test\test.txt"); byte[] all= Files.readAllBytes(path); The problem with this is that I have to load the ...
4
votes
1answer
48 views

Watch log dir for new file, automatically tail to slack

We have a process that outputs to log files in the format /var/log/xxx/YYYY_MM_DD.log - the file name is chosen programmatically and is not rotated using logrotate ...
4
votes
1answer
64 views

Application for encrypting and decrypting files in Java - follow-up

(Everything needed for running the app is here.) I have refactored my previous version a bit. App.java: ...
3
votes
1answer
76 views

Application for encrypting and decrypting files in Java

(See the next iteration.) I have that application for en-/decrypting files. Here, I will post the actual GUI and command line code. In order to run the program refer to this GitHub repository. Some ...
2
votes
1answer
62 views

Two Java methods for easy writing and reading bytes in files

I have these easy-to-use methods for reading and writing binary data in files. FileTools.java: ...
2
votes
3answers
79 views

Duplicate Line Finder

I recently wrote a program that reads a plain text file, and compares every line and alerts you if any are similar, based on a float value that you pass in to a function. ...
4
votes
3answers
86 views

Counts the number of times a particular character, such as e, appears in a file

This question came from a Java tutorial online: Write an example that counts the number of times a particular character, such as e, appears in a file. I was just wondering if there is any way to ...
8
votes
4answers
128 views

Python Implementation - Conway's Game of Life

This is my implementation of Conway's Game of Life in Python. Now since I am a novice coder, naturally I have some key doubts: The usage of idioms and code redundancies - Are there any small ...
3
votes
2answers
64 views

BMP file writer

In my current project I'm writing a C function to write a BMP-File. Internally, the function is split up into three parts: write header, write info header, write data. In some of these functions I do ...
3
votes
3answers
71 views

Creating and manipulating FITS files

I wrote a program that manipulated data from VLA observations and created FITS files to be used in creating spectral energy distributions of high redshift radio galaxies. I really tried to be as ...
3
votes
4answers
398 views

Min and max of numbers read from a file

I had to create this program, and I did it fine, all is working and stuff but I was wondering, what is better way of doing such thing? I want more efficient method. Problem assignment: In the ...
8
votes
2answers
785 views

Q&A-based file editor

As part of my autodidacticism into all things Python related, I have decided to write a number of functions that I can save in a library for future use. One such function that struck me as useful to ...
4
votes
3answers
84 views

Command called 'sprinkle'

I have a command called sprinkle. I'm not going to explain anything about it, because I want whoever that reviews the code to also tell me how much of the command ...
6
votes
3answers
227 views

Loading tab-separated tweet data into an array

I'm working on this school project and was wondering if there was any way of storing this information better, faster, more professionally. I'm also restricted to only using an array; don't ask me we ...
2
votes
1answer
64 views

Creation of playlist to fake-split a full-album video

I created this snippet to "split" my full-album videos into its individual songs without the need of actually splitting the video file. I personally created this snippet because I enjoy reading all ...
4
votes
2answers
161 views

Search word in multiple files

I am writing a brute-force method to search for a word. Please review my code and tell me how I can improve it. ...
2
votes
2answers
71 views

Counting the occurrences of a string in each file

I am trying to find a phrase or a string in file and count the number of occurrences of that string: ...
4
votes
2answers
105 views

Given a path to a directory, print the path to the biggest file in it

Here is my code. I simulated a stack rather than used some regular recursive algorithm because I needed to keep track of two variables: the path to the biggest file and its size. Besides I wrote a few ...
1
vote
0answers
21 views

Unlock spreadsheet files - follow up 2

Awhile ago I created a program that unlocked spreadsheets, for a better understanding of what happens when it's run, see here. I decided to rewrite it again, and go for a more OOP approach.. My ...
3
votes
1answer
104 views

Writing data to a file

I have the following two methods that write to file various data line by line. Both methods differ from each other only by few lines what would be the best way to refactor them that when in future I ...
6
votes
0answers
130 views

Extracting single files from a tarball (spreadsheets)

I've created a program that will pull spreadsheets out of a large tarball. First it specifies the file name through the "folio" number which is given as an argument when the program is called. From ...
1
vote
2answers
72 views

Efficiently process large (~100MB) structured binary file in C

This question regards the C implementation of the python code posted in this other question of mine, hence the explanation of the task at hand will be the same: The problem I need to process the ...
3
votes
1answer
72 views

Ordering a .txt file numerically by size and alphabetically

I am doing a controlled assessment and one of the tasks is that we have to sort the saved pupils scores (numerically), and their names (alphabetically) in a .txt file. Any other improvements to the ...
5
votes
1answer
62 views

Read through a log file to find “Fail” lines

Please bear with me, I'm only about a week into Python. This code is something that I wanted to do once I completed the chapters dealing with opening and reading files, and RegEx. I always feel like ...
4
votes
2answers
95 views

Efficiently processing large (~100 MB) structured binary data in Python 3

I need to process the data contained in a (relatively) large binary file. The file has the following structure: ...
8
votes
4answers
990 views

Creating a unique file name in C#

I find that I am often writing files where the names either: Need to be incremented (rather than overwriting a file that already exists in the directory with the same name) Need to be timestamped ...
2
votes
1answer
48 views

Using GetTempFileName api function to check write access to a directory

On windows, to find out if I have write access to a directory, I found that it is easiest to just create a file in that directory. In order to do so, I found ...
4
votes
1answer
71 views

Search file for keyword program

Just looking for some advice and I know using std namespace is bad but I didnt have the time to do all the using stuff. I want help on what here is good and what is bad practice :). ...
2
votes
2answers
83 views

Resolving IP to hostname in Python 2

This piece of script will take one argument (file which contain list of ip, one per line) and convert it to its hostname. For now this will only work with IPv4. This definitely doesn't look good and ...
5
votes
1answer
87 views

String parsing and saving ipaddress to file in Java

Following function will parse string resp, which will be like shown in following example. I will get an IP address in the form of a hexadecimal string like ...
6
votes
1answer
67 views

Dealing with a command line argument (path) with spaces

I created a key in Windows registry to have an option on every folder which allows me to simply right click, choose the right option and have a PDF made, either from JPGS, or PNGs, or TIFs. My ...
7
votes
2answers
71 views

Updating resources while avoiding race conditions

I am writing a utility class for a game client. This class has two main functions: connect to a game server and retrieve the current game revision, and retrieve a "recipe", which is basically ...
6
votes
2answers
209 views

Frequency count of single words and word pairs over 20 million tweets

My application needs to read 20-million-line text files and count the word frequencies for one and two words. For example: A B A B SSS G D A One word Frequency A: 3 B: 2 SSS: 1 G: 1 Two ...
7
votes
2answers
118 views

Usage of scanner

I have a legacy method which I would like to clean up: ...
6
votes
2answers
59 views

pjen - Simple static website generator

I've created a simple static website generator called pjen. The GitHub repository can be found here. ...
6
votes
2answers
152 views

Random File Opener

I wrote a random file opener in Python that takes file extensions as a tuple at code level, and directory/amount at console level: ...
7
votes
5answers
740 views

XOR encryption program in C

I've written a program that encrypts files (or stdin) with a user-specified key from 1 to 255. This "encryption" is very insecure, but still a bit better than ROT13 ...