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.
7
votes
1answer
49 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 ...
7
votes
2answers
97 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
106 views
6
votes
2answers
54 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
120 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:
...
-3
votes
0answers
20 views
my code only checks first line of txt file [closed]
My code should take user input then check whether the name exists or not. The code only checks first line. It does not check another lines so if I write Jacob, it finds the name which is in first line ...
7
votes
5answers
601 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 ...
0
votes
2answers
32 views
Differences in word counts in two files
How can I change my two functions to be more readable functions (i.e. in steps), because I am using pycharm.
...
11
votes
4answers
114 views
Let's play Find that File
Isn't it annoying when you can't find a file you recently created? Especially when you either have a very disorganized drive or a directory with lots of files.
Even if you don't care, isn't it nice ...
3
votes
1answer
65 views
Scanning multiple huge files in Python (follow-up)
I'm trying to implement an algorithm able to search for multiple keys through ten huge files in Python (16 million of rows each one). I've got a sorted file with 62 million of keys, and I'm trying to ...
9
votes
1answer
400 views
Scanning multiple huge files in Python
I'm trying to implement an algorithm able to search for multiple keys through ten huge files in Python (16 million of rows each one). I've got a sorted file with 62 million of keys, and I'm trying to ...
1
vote
0answers
47 views
Non-curses pager in C (revision 2)
In this revision (follow-up of this post) I've fixed reading from stdin, and also tried to minimise the damage caused by typing additional characters. You might want to see my original post on this.
...
7
votes
1answer
351 views
Non-curses pager in C
I have written a pager in C that is supposed to be used in systems where curses is not installed (or broken). It can also be used as a system-wide pager, it works ...
3
votes
3answers
157 views
Reading and printing a text file in Java
I am trying to read lines from a text file in Java, but there is a lot going on. Is this the best way to do this? I am especially concerned with resource leaks.
...
1
vote
2answers
93 views
Calculating the energy of a signal
I have a program to read signal data from 120 files in a folder and performing the energy of the signal.
It works correctly, but execution time is more than 20 mins, so there may be a problem with ...
6
votes
5answers
795 views
Memory-safe file-reading in C
I am trying to write a single function that will read a certain number of bytes from a C file, or the entire file, based on the arguments. I want it to be memory-safe of course, and deal with ...
2
votes
3answers
71 views
File parsing and data management - follow-up
This is part of a two-part post (Part 1).
Here, I have two recent projects that parse a file. The first uses a loop that's kind of hard to follow, and the second uses "modes" to decide what to do.
...
3
votes
1answer
31 views
File parsing and data management
This is part of a two-part post (Part 2).
Here, I have two recent projects that parse a file. The first uses a loop that's kind of hard to follow, and the second uses "modes" to decide what to do.
...
0
votes
1answer
27 views
Unlocking spreadsheet files quickly - follow-up
I recently posted a program I made to unlock spreadsheet files( see also ), I've taken all of your advice and made it more Ruby like, it has no shell commands in it, and uses ...
1
vote
2answers
98 views
Java Utility that converts warc (Web Archive) files into XML files
I have written a program to perform a task, but I'm guessing it is not optimized. I want to know if there are any ways to improve the effiency and performance of this program.
This program reads a ...
3
votes
1answer
48 views
Unlocking spreadsheet files quickly
I've created a program for my job that unlocks spreadsheet files quickly and efficiently. What we use to have to do before this program is we'd have to go into the system, search for the file, kill ...
4
votes
1answer
32 views
Powershell to break apart large flat files (e.g. csv)
I created the below script to help break apart large flat files; to save myself effort opening files which are several gigs in a text editor and manually split them.
So far I've only tested on sample ...
0
votes
1answer
61 views
Two similar functions for writing data to binary file using BinaryWriter
I have two functions for writing data to binary file using BinaryWriter.
The first function has single data object as argument and looks as below:
...
2
votes
3answers
54 views
Replacing the second word of some matching lines in a file
I have a file that at some point contains a line of the following form:
OutputFilename output.root
I want to write a Python function that replaces the text after ...
7
votes
2answers
92 views
Very basic Java file reader/writer
I started learning the Java language about 10 days ago, reading Introduction to Programming Using Java by David J. Eck. I've made it halfway through chapter six in about 9 days. I realized I was ...
6
votes
1answer
52 views
Simple pager in C
I have written a simple pager in C. It works fine for most things, but I'd like to know how it can be improved. Specific things I'm looking for are if there are size and/or speed improvements to be ...
5
votes
2answers
119 views
Extract text from news articles
I have written a file to extract text from news articles. The program works as I want it to except it takes hours for it to write the output files. I have tried different buffering options as well as ...
2
votes
1answer
60 views
GitHub Auto Copy Committer via API
I did write the GitHub Auto Copy Committer.
The purpose is to copy an existing public GitHub repository to in
another repository - commit per commit. It's reason is not a full copy
of a ...
7
votes
1answer
50 views
Function to wrap words in a text editor without breaking them
These are 3 functions I created in C language to read in a text file, remove the carriage returns from it in order to display on the screen, and display the file on screen wrapped with the words of ...
0
votes
1answer
52 views
Updating a .txt file
I'm outputting the results of a query to file.txt in JSON. The file is updated every time I click on 'submit'(form) and depending on the variables it updates the query.
Right now the table only has ...
5
votes
2answers
67 views
Reading lines from a file in random order
I originally wrote this as an answer to a question on Stack Overflow, but it turned out so nicely that I decided to post it here to see if I can make it even better.
...
5
votes
2answers
65 views
Displaying a new image document in Picturebox
I'm using WinForms and have a picturebox in my form. This program looks in "C:\image\" directory to find a specified image document, in my case a tif file. There is always only one picture in ...
4
votes
3answers
57 views
'Learn projects the hard way': logfind project
I'm a new programmer, who has just finished his first small project.
It's a sort of basic imitation of the grep command from Linux. I'm learning from projects the ...
2
votes
1answer
56 views
5
votes
3answers
199 views
Writing and reading code from a text file
Using file stream object, write a program to read an external text file ("myCourse.txt") which contains all the course name and numbers you are taking this semester, and to generate an analysis ...
2
votes
0answers
78 views
Bitmap to base64 and writefile
I have the following code which does 2 things:
Return a scanned fingerprint as base64
Store this print as bitmap
While the code works most of the time, sometimes an invalid bitmap is saved (I ...
6
votes
3answers
88 views
Text file manipulation with Java 8 and Guava
I am trying to do some translation of text files. I have a translation .csv file and a file I need to translate (tab delimited). The translation is creating a file with an extra column of the ...
4
votes
2answers
63 views
Assembling very large files
I have users uploading files sometimes as large as 100+ GB to a local web server. The upload process works well and chunks come in at 50MB. The problem seems to be after the file is uploaded, when ...
4
votes
2answers
40 views
Speeding Up BufferedWriter
Are there any possible speed improvements I can make to the following method. It takes a JDBC ResultSet and breaks it into several CSV files:
...
4
votes
2answers
146 views
Reverse all lines in a file
The script below should open a file, read and reverse every line, then overwrite the source file.
...
1
vote
1answer
28 views
Searching and replacing text
Simple Playlist Modifier
This program is a search and replace program for text based files. The main goal of the program is to replace directory paths to music files.
The idea is to have the program ...
-2
votes
1answer
52 views
Merging files in Bash
I had this homework assignment:
Create on the desktop a folder with your name.
Copy from your account [email protected] two files, ...
6
votes
2answers
161 views
Some sort of console “notepad”
This is notepad that works with list of files (pages w/e) that can be edited (list). You can access each file separately and edit/view it too (rewrite, append, read). Here's my implementation of it. I ...
1
vote
1answer
32 views
Writing computer generated music to a wav.file in C - follow-up 2
See the previous iteration.
What's new: endianness is now handled more gracefully (only one endianness check, and convertion if need be) and music is more funky.
...
10
votes
4answers
252 views
Writing computer generated music to a .wav file in C - follow-up
See the previous and initial iteration.
See the next iteration.
Now I have refactored the code according to many suggestions made in the first iteration.
What's new:
I attempted to deal with ...
30
votes
5answers
2k views
Writing computer generated music to a .wav file in C
See the next iteration.
I wrote this simple C program for writing computer generated music to a WAV file over three years ago. I refactored it a little, but it does not look good to me. Any ...
5
votes
3answers
348 views
32-bit checksum of a file
I have implemented a function to produce a 32-bit checksum of a file using the following method: checksum = word_1 + word_2 + ... + word_n, where ...
2
votes
1answer
18 views
Saving and loading parts of configuration
I have a piece of code where I have string pairs (eg. 'a' and 'AA'), where both have their own unique ids. Id for first object is configured by user and second id is received at some point during ...
4
votes
3answers
108 views
Writing huge 2D vectors to text file too slow
I have 10 large (34 million cell) 2D gridded vectors storing doubles. When written they are over 200 MB in size. I use an ofstream object to write them to a text ...
2
votes
2answers
688 views
Load text file into an array in Swift
I'm drowning in Swift optionals and error handling syntax. I'm just converting a text file into an array of Strings. One would think that this could be a simple two or three liner but by the time I ...