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
10 votes
4 answers
799 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 ...
coderodde's user avatar
  • 27k
5 votes
2 answers
329 views

Two dimensional gaussian image generator in C

This is a follow-up question for Image Processing Median Filter in C. I am attempting to create a two dimensional gaussian image like below in C. The formula is as follows. The experimental ...
JimmyHu's user avatar
  • 3,974
1 vote
1 answer
2k views

Opening a file and printing its contents line by line

Everything that I've read online says that the best way to open a file in python is: ...
Matt's user avatar
  • 183
4 votes
1 answer
145 views

An Update on my TileMap Class

I'm making a old-school Final Fantasy type game and I made a tile map class a while back and posted it on here (Is this a good way to implement a tile map from a text file?) But, when I got to ...
Twiggy's user avatar
  • 333
4 votes
1 answer
919 views

Copy File, remove spaces in specific lines

This question now has a follow-up question 1 and follow-up question 2 As an exercise in writing decent code and because I learn best by example, I wrote this program and would ask for a review so ...
Philipp Doerner's user avatar
4 votes
4 answers
950 views

Image Processing Median Filter in C

I am attempting to perform Median Filter with size 3 x 3 in C language. The function MedianFilter33 has been implemented as follows. The experimental implementation ...
JimmyHu's user avatar
  • 3,974
4 votes
1 answer
149 views

Group duplicate files

Here is my source code which group duplicate files together, written in Python 2.7. Any advice on smarter ideas to group duplicate files together more efficient, it will be great. Any general advice ...
Lin Ma's user avatar
  • 3,433
3 votes
2 answers
173 views

Follow-up 1: Copy File, remove spaces in specific lines

This Question now has a follow-up question After learning a lot about applying OO principles, interfaces and a bit about argument-handling I post a revised version of my previous code. This is still ...
Philipp Doerner's user avatar
3 votes
1 answer
127 views

Follow-up 2: Copy File, remove spaces in specific lines

This is an iterative review: The Original Question | Follow up 1 Differences to Follow up 1 This iteration tries to take the previous review to heart and see how it turns out. It sacrifices the ...
Philipp Doerner's user avatar
2 votes
1 answer
122 views

Simple diff utility in Java using OOP

(Previous and initial iteration lives here.) (The next iteration is here.) Now I was able to spare some lines by putting diff related state in an object. Also, I relied on ...
coderodde's user avatar
  • 27k
45 votes
5 answers
9k 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 ...
coderodde's user avatar
  • 27k
14 votes
4 answers
3k views

Reading a DHT11 to a file

Disclaimer: not a Pythonista, first actual Python programme written right here. I'm reading a DHT11 sensor from GPIO pin 4 on my Raspberry Pi (thanks Thomas Ward for sending the RPi to me), and I ...
Der Kommissar's user avatar
12 votes
2 answers
987 views

Speech Recognition Part 1: Generate Training Data

You've all heard of neural nets, no? One of the "hello world"s of neural nets is OCR with the MNIST dataset. My idea for speech recognition is to train the neural net with short labeled spectrograms ...
syb0rg's user avatar
  • 21.8k
11 votes
5 answers
8k 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 ...
srikavineehari's user avatar
10 votes
1 answer
368 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 Forth-...
cat's user avatar
  • 977
10 votes
4 answers
13k 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? ...
Mathematica's user avatar
9 votes
1 answer
4k views

Duplicate files finder in C++

I've came across this question https://stackoverflow.com/questions/11760420/what-is-an-optimal-way-to-find-duplicate-files-in-c and there are two answers for it both the answers convey that it is bit ...
VISWESWARAN NAGASIVAM's user avatar
8 votes
1 answer
429 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 ...
user avatar
8 votes
2 answers
13k views

Python code that compares two files byte by byte

I wrote a Python (2.7) script that compares a file byte by byte. filecmp was not suitable for the application because it compares metadata as well. How can I ...
jkd's user avatar
  • 275
8 votes
2 answers
139 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. ...
Mast's user avatar
  • 13.1k
7 votes
2 answers
2k views

Project Euler #22 - Name scores

I have written code in C++ 11 and check output with Project Euler site, and it is correct. I am not showing output, just to keep it secret, at least from my end. Please review my C++ 11 code. ...
Pranit Kothari's user avatar
7 votes
1 answer
5k 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 it'...
13aal's user avatar
  • 822
7 votes
1 answer
184 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 ...
lochsh's user avatar
  • 215
7 votes
2 answers
217 views

Cleaning a file / Word Query

In a followup this application was turned into a GUI using FLTK: Cleaning a file / Word Query GUI (FLTK) I did the following two exercises in Programming: Principles and Practice Using C++ (2nd ...
Sandro4912's user avatar
  • 3,046
7 votes
3 answers
419 views

Console based Vocabulary Trainer

This code was reworked and repostet in Console based Vocabulary Trainer Version 2 I wrote a console based Vocabulary Trainer to practice C++. Its possible to add and remove vocabulary and practice ...
Sandro4912's user avatar
  • 3,046
7 votes
2 answers
1k views

Find and rename all png files

I have such problem : find all png files to disk and rename them as I did: ...
Lolidze's user avatar
  • 201
6 votes
2 answers
912 views

Simple diff utility in Java

(See the next and second iteration here.) I have this toy implementation of the diff utility in Java: ...
coderodde's user avatar
  • 27k
6 votes
1 answer
1k views

Simple Rust Webserver

I started learning Rust today and for my first project created a simple webserver. I don't have a clear vision about Rust programming and I tried to write it with my previous knowledge in Python and ...
Saeed M.'s user avatar
  • 423
6 votes
2 answers
5k views

The most efficient way to merge two lists in Java

I am looking for a way to merge two files with a list of distinct words, one word per line. I have to create a new txt file that would contain all the words of the first list and all the words from ...
Kabachok's user avatar
  • 163
6 votes
1 answer
105 views

Inserting filename, reading data, inserting regex, and testing if each line matches

This program first displays a menu which shows some options that the user can select. Each option will the respective functions which do some things. The user can insert a filename, read data from it,...
Spikatrix's user avatar
  • 981
6 votes
2 answers
562 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 ...
mizuki_'s user avatar
  • 155
6 votes
2 answers
7k 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: ...
glS's user avatar
  • 185
5 votes
2 answers
868 views

Uploading multiple files to server with PHP and JavaScript

I wrote some code to upload multiple files to a server with PHP and JavaScript. I'm happy with the form and JavaScript, below. ...
Tania Rascia's user avatar
5 votes
1 answer
1k views

Reading a binary file containing periodic samples

I have the following code for reading HTK feature files. The code below is working completely correct (verified it with unit tests and the output of the original HTK toolkit). ...
Peter Smit's user avatar
5 votes
3 answers
3k views

Correcting duplicate names in array

I have an array of file names. For example: string[] files= { "one.zip", "two.txt", "one.zip", "three.txt", "three.txt", "one.zip" }; And I've developed the ...
StepUp's user avatar
  • 553
5 votes
1 answer
617 views

Python script to rename images based on descriptions in a text file

I like to collect images for my desktop background, but the problem is sometimes the image names don't represent what the image is. I decided to write a script that reads a text file that contains the ...
киска's user avatar
5 votes
2 answers
7k 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. ...
Sarah's user avatar
  • 151
5 votes
1 answer
3k views

Python Hex Viewer

I have created an hex viewer in python, as a timed-challenge by friend. My implementation was in the form of a class, with a separate main file running with argparse...
Uriel's user avatar
  • 519
5 votes
3 answers
3k views

Is this a good way to implement a tile map from a text file?

I'm working on a small final fantasy type game. I have this for a tile map. I was just wondering if this is a good way to do this or if anyone has any suggestions, I would love to read them. ...
Twiggy's user avatar
  • 333
4 votes
1 answer
7k views

Making a list from user input

I have wrote a program that lets the user open up their text file that would look something like this: 1 2 3 4 5 6 It would then let the user enter a name for ...
Ashley's user avatar
  • 61
4 votes
2 answers
307 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. ...
coderodde's user avatar
  • 27k
4 votes
1 answer
73 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 ...
Martin York's user avatar
  • 94.3k
4 votes
2 answers
1k views

Scanning through logs (tail -f fashion) parsing and sending to a remote server

I have a task at hand to build a utility which Scans through a log file. Rolls over if a log file is reset. Scans through each line of the log file. Each line is sent to an executor service and ...
User3's user avatar
  • 261
4 votes
1 answer
80 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 ...
13aal's user avatar
  • 822
4 votes
1 answer
443 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: ...
coderodde's user avatar
  • 27k
4 votes
1 answer
5k 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 ...
coderodde's user avatar
  • 27k
3 votes
1 answer
3k views

Reading all file contents via x64 assembly

I have come up with the following snippet by building upon the answers given to my StackOverflow question. Just trying to get some other eyeballs to review things so that they can point out any ...
Kittoes0124's user avatar
  • 1,940
3 votes
1 answer
2k views

Mad Libs excercise

I did the following Excercise from Automate the boring stuff with Python Chapter 8: Create a Mad Libs program that reads in text files and lets the user add their own text anywhere the word ...
Sandro4912's user avatar
  • 3,046
3 votes
1 answer
96 views

Inserting filename, reading data, inserting regex, and testing if each line matches - version 2

This is a improved version of the program seen in my older question. This program first displays a menu which shows some options that the user can select. Each option will the respective functions ...
Spikatrix's user avatar
  • 981
3 votes
0 answers
117 views

Counting words in files - follow-up 2

Previous question: Counting words in files - follow-up I have fixed punctuation problems in my previous code by using template, because it is easy to understand and my focus on template mechanism. ...
MORTAL's user avatar
  • 3,278