Questions tagged [file]

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.

Filter by
Sorted by
Tagged with
0
votes
0answers
10 views

Is there any way I can better this Client to Server program?

Made this Java program recently. it gets an input from the client. The first line specifies the the file name that you will use. The second line specifies what you want to put in the file. I have been ...
1
vote
0answers
15 views

Trie to index files and search for them

Basic idea (foo and foa are filenames): ...
1
vote
1answer
8k views

Compare large text File in java line by line

Dear fellow developers I am doing a java program which compare two text files line by line, first text file has 99,000 lines and the other file has 1,15,000 lines. I want to read the files and compare ...
-1
votes
3answers
111 views

Fastest way to create random pixel image

I want to create a very big gigantic PNG image. The image pixel are generated randomly, being How can I improve the below code to create a fast random pixel image in java? ...
1
vote
1answer
36 views

Renaming and deleting video file

I am using below code to rename and delete video. Need review for the following: Code optimization Performance Overall code review ...
2
votes
1answer
42 views

Python - A Regex Text File Searcher by Content Project

I would like some advice on efficiency and ways to further remove redundant code. Regex Text File Search: enter a valid directory path, and a string to search for makes a list containing all the ...
1
vote
2answers
35 views

What is the fastest way to record the names of each file in a directory?

I want to fill an array of strings with the name of each directory item. The issue is allocating memory. I either need to count the items before, allocate memory, then go over them again, or I will ...
3
votes
2answers
97 views

Efficiently generate large file to create SQL table and insert sample user data

Here's a function I use to generate a 2.5 gig SQL dump file for testing. It works but it takes a long time. How can I make it more efficient? ...
2
votes
1answer
50 views

recursive file search, C , linux

hi guys this script recursively searches for files with a certain extension and possibly in a directory passed by the terminal ....(In case no directory has been passed, search from the current one) I ...
20
votes
6answers
4k views

Can I slim this UTF8-encoding program?

Below is my entire program. You can read what it does thanks to the comments and specifications in particular. My question is: can it be improved? Would it be possible, for example, to avoid writing ...
4
votes
1answer
109 views

Reversing a file in Fortran

This is my first foray into (modern) Fortran in order to learn a bit more about the language, and I'm attempting the following problem: taking the path of an arbitrarily-sized text or binary file ...
4
votes
1answer
51 views

Column File Format

Following up on my previous Column work: Column File Format Stream It is now available in github: https://github.com/Loki-Astari/ThorsStorage I have incorporated the comment by @L.F. but have done a ...
-1
votes
2answers
75 views

Finding the k most frequent words in file in c++

I have written C++ code using trie and min-heap to find the k most frequent words. I want to review my code. ...
11
votes
5answers
7k views

Most common words in a text file of about 1.1 million words

I'm learning programming with Python. I’ve written the code below for finding the most common words in a text file that has about 1.1 million words. It is working fine, but I believe there is always ...
4
votes
2answers
65 views

Encrypting file from source AEAD

I am trying to encrypt/decrypt file using source code directly. The issue is how to properly do it after reading the file. ...
5
votes
3answers
586 views

Check header files for namespace usage

To ensure there are no naming conflicts within our project (C++) I was tasked with writing a python script to check all of our header files for any occurrences of a ...
4
votes
1answer
1k views

Multi-query PHP Parser for SQL files

I have an external project, which needs to run an SQL file containing multiple SQL queries (a bit like mysqldump, if you like, but is user-created, with any kind of SQL statement/definition). PHP ...
1
vote
0answers
34 views

sudoedit_enhanced written POSIX-ly (readlink possible problem?)

sudoedit_enhanced written POSIX-ly challenge While creating sudoedit_enhanced POSIX (apart from ...
3
votes
0answers
49 views

Simple beginner Rust CLI file reader that prints to stdout

Q: Am I approaching writing idiomatic Rust code correctly? Hi CodeReview, I'm a beginner Rustacean coming from Python going through Rust books (The Rust Book, Rust in Action). A lot of the beginner ...
2
votes
1answer
48 views

RemoteFile in Java - follow-up

(See the first and initial iteration at RemoteFile in Java.) I have added some new facilities for convenience. Now I have this in mind: com.github.coderodde.utils.io.RemoteFileDownloadListener.java: ...
2
votes
0answers
57 views

RemoteFile in Java

(Also, see the next iteration.) I have this tiny class for downloading files from internet: ...
3
votes
2answers
55 views

Python word counter for all files in the current directory

I wrote a simple command-line script to count all words in all documents (of the supported formats) in the current directory. Currently it supports TXT, DOCX, XLSX, and PDF formats and has been ...
3
votes
1answer
60 views

Python file modifying script with focus on OOP

I am currently coding a tool for my work that modifies a textfile by removing unneeded parts of a string at specific spots in the file. I would like to know if there are any obvious things I am ...
5
votes
2answers
96 views

Python image combiner reading writing

I am writing a simple script that will combine two images at a pixel level, selecting every other pixel from one image, and the other pixels from a second image. ...
1
vote
1answer
76 views

Serializing object graph to proprietary binary file

I'm creating a class library to read/write .3di files which are binary files describing 3D models for a video game. This review is for the write/serialization process. I've mapped the different ...
8
votes
2answers
161 views

Opening a file in Python

I use the following function for opening files in Python: ...
5
votes
2answers
206 views

File Based AVL Tree

For class I have to write a program that reads (plaintext) numbers from a file, and inserts them into an AVL tree stored in another (binary) file. I cannot have more than about 10 nodes in memory at ...
1
vote
1answer
74 views

Rust program, which reads, processes, and writes a file

I'm making a small program to benchmark Rust's performance compared to some other languages. The idea I came up with, was to take a file (with the numbers 1 to 10000000 written to it in separate lines)...
4
votes
1answer
74 views

Check existence of user identification number

I was tasked with writing a python script to check if a passed ID number exists within a file. The file I was give contains roughly 25,000 unique ID numbers. An ID number is a unique 9 digit number. ...
6
votes
2answers
79 views

File classifier based on extension and date modified

Note: this code will be run using portable WinPython 3.7.6.0 (Python 3.7.6, package list here) on Win10x64. Installing new packages or upgrading the Python version are not an option for this project. ...
0
votes
0answers
57 views

Make a Map<?,?> containing configurations based on file system principles

I am working on a Java project that currently depends on 500+ configuration files in the form of XML, XSLT and YML files. The vast majority (~400) are XSLT files, and the purpose of the application is ...
10
votes
4answers
10k views

Reversing the lines of a file

I am trying to reverse the lines of a file by reading the file through an array. Is there a more efficient and quicker way of achieving this? ...
2
votes
3answers
78 views

Java file analyzer byte-by-byte

This is part of this topic. Problem: I need to read a file with BigIntegers and make some analysis "on-the-fly" with each read number (get prime numbers count, get armstrong numbers count). Right now ...
2
votes
1answer
58 views

Python Etiquette for Functions in Multiple Files

Here's the context: My code is meant to automate testing of OCR (Image to Text programs) for a science project which could easily be read and understood my others. The code includes sets of functions ...
4
votes
1answer
231 views

Reading from and writing to a file without passing around filename

I was looking for a way to write to and then read from a file in different parts of my code, without passing the filename around and without consumers needing to know it was coming from a file. I ...
5
votes
2answers
147 views

Running out of fuel near Saturn

Optimizing/parsing files into semi-complex data-structures more efficiently To preface, I'd like to say that this code is part of the Advent of Code 2019 solutions I have been working on. ...
4
votes
1answer
70 views

Delete file from server (php function)

Is there a better way to write this code. Suppose I have 10 files to delete and I have to repeat code (public function destroy() ) 10 times. First remove the ...
2
votes
2answers
45 views

Speed performance of picking unique value from binary matrix file

I wrote this code to read a square matrix saved as binary file, that it can be int, uint, float etc... to pick a value from the matrix at given row ...
4
votes
1answer
50 views

Python timing optimisation

I'm new in this community and with Python 3! I'm trying to optimize this exercise: We have n strings stored in a txt file. Inside the strings a secret word is ...
18
votes
6answers
5k views

Explicit song lyrics checker

To stay in practice with my Python I've decided to write an explicit song checker. It checks each word in the song against an array of 14 explicit words contained in the text file. I've decided not to ...
3
votes
1answer
68 views

Concatenating an already existing filename to create a new file

I had answered this question from stackoverlow and the code below is code that I wrote to explain to the OP a possible way to achieve what I believe they were looking for. The general idea that I ...
5
votes
3answers
132 views

Proper way to find newest file in a directory

I wanted to ask if this is a better way to find a latest file in given directory. This is my current approach: ...
3
votes
1answer
81 views

Code dealing with files and separate lines in them

I have been using similar piece of code since a while. I have read some issues regarding treating mapped memory as a string. I am not sure about that though, so I just use ...
4
votes
1answer
77 views

Read JPEG dimensions properly

I need to extract the dimensions (width and height) of a jpeg file for inserting in an html document. According to the JPEG image compression FAQ, cautions against what's commonly out there, Some ...
3
votes
2answers
101 views

Download a zip archive and extract one file from it

I wrote a function that downloads a file https://www.ohjelmointiputka.net/tiedostot/junar.zip if it not already downloaded, unzips it and returns the content of <...
3
votes
1answer
43 views

File Utilities in Go

I'm beginning to learn Go. I've decided to write some file utilities to help me with some bigger projects I intend to write. Coming from mainly a Python background, I'm sure there are plenty of ...
3
votes
0answers
122 views

Script to auto-generate Markdown tables of contents

I would greatly appreciate feedback on the enclosed script, which auto-generates a Markdown table of contents for Github-flavoured Markdown, with respect to: Consistency with Ruby idiom & style ...
3
votes
1answer
48 views

File Encryption

I'n written this small file encryption module to work on my skills with the os module. It's my very first time using it to navigate files and file structures, so I'...
2
votes
0answers
80 views

Sanitize input for a “robot on a grid” kata

I have the following piece of code which is FSI tested and works. However, I want to trim it as much as possible (not only the comments, which are there for my own future reference) and make it as ...
5
votes
1answer
157 views

Plain-text file encryption and decryption

I have created an Encryption and Decryption Algorithm that encrypts plain text using a given cipher and also decrypts it back to the original notation. It works great. This was my code for a coding ...

1
2 3 4 5
15