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.
2
votes
1answer
34 views
Updating certain values in text file
So I need to update some certain values within text file based on actual values there. Any advice on making it more effective or just readable is appreciated.
Example text file:
...
3
votes
1answer
58 views
Printing longest lines
Challenge
Write a program which reads a file and outputs a specified number of lines, sorted on length in descending order.
Specifications
The first argument is a path to a file.
The file ...
7
votes
4answers
458 views
Merging two files containing sorted numbers into one
The task is to merge 2 text files containing sorted integers into one file. Each number in both files is stored in new line(there are no empty lines,and only numbers are stored). Requirements are that ...
0
votes
1answer
31 views
3
votes
1answer
81 views
Python program to lock and unlock files
The code takes srcPaths and actionType as parameters. The former is a string with tab-delimited file paths, while the latter is ...
3
votes
2answers
64 views
Check that files don't contain Unicode
I use this code to check that all files in a directory are free from Unicode and non-printable characters.
Can I improve the structure of the code?
...
2
votes
1answer
116 views
Creating archive from over 3GB of files in less than 1 minute
This is a follow up to this question. I got some very good answers for my process speed, and wanted to go ahead and share what I've done with the program. The new updates of the program consist of the ...
5
votes
1answer
74 views
Speeding up process time while archiving files
I asked this question on Stackoverflow, and was told I might have better luck here.
I'm new to c# and have created a basic file archiver. It works, and it does what it's suppose to do, but I think ...
1
vote
1answer
59 views
File archiver, archive files into a zip file
I've created a simple little file archiver that will run through a given directory and extract your files into an archive folder. It's pretty cool if I do so say myself, I would like some critique on ...
4
votes
1answer
41 views
Secure file system utility functions
For Khronos, I've had to develop these utility functions to help me deal with storing the .wav files. However, they could also be used in a variety of ...
2
votes
2answers
139 views
Idiomatic word counting in Rust
My goal is to read from standard input, break up the input into words, case-insensitively, and produce a report to standard output, where each line is a word followed by a space followed by its count. ...
2
votes
1answer
141 views
Delimited file parser
This is some code I've cobbled together that reads a delimited file. If the user is able to tell us some stuff about the file, it uses the supplied information. Otherwise, it tries to work stuff out ...
4
votes
1answer
29 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
44 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
44 views
2
votes
1answer
109 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
102 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
181 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
86 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
76 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
95 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
38 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
125 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
35 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
141 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
56 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
53 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
78 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
131 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
76 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
80 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
91 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
154 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
66 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
80 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
458 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
788 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
239 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
76 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
259 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
86 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:
...
5
votes
2answers
107 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
107 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
135 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
79 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
85 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
66 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
116 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:
...