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
3
votes
1answer
515 views

Script to store, search, and delete IPFS data with description in JSON file

Here is the script that I would like reviewed for the following: Best practices and design pattern usage Correctness in unanticipated cases Better dictionary access The script is made to store (IPFS)...
6
votes
3answers
114 views

SAT score reader program

This program takes 10 Math SAT scores and 10 Verbal Sat scores from the user, computes the standard deviation and averages, then displays them in a tabular format. After, it displays them to the user ...
3
votes
1answer
674 views

Parse data file and verify checksum

Here's my assignment: Write a program that takes a filename as its only command line argument and prints the results to std::out formatted as follows: ...
1
vote
1answer
6k 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 ...
3
votes
1answer
815 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 ...
6
votes
3answers
215 views

File handling in C

I've created an app to manage students' data which also supports file handling. The Student structure looks like this: ...
5
votes
5answers
2k views

Remove control and non-ASCII characters from large files

I get huge incoming files (up to 6GB) and they are littered with Control and non-ASCII characters. I need to strip them and I made this routine (below). The problem is that it is insanely slow. I ...
1
vote
1answer
1k views

Read an image file into a canvas and display click coordinates

I am a beginner in JavaScript, which I have started studying since Summer last year. My code's purpose is read a file from file explorer, and put that image in a canvas. Also there is code to allow ...
2
votes
1answer
8k views

Split a file into multiple files if it reaches a particular limit?

For each clientId, I have a Collection<Task> object. I am making file for each clientId...
5
votes
2answers
2k views

Reading file and writing to output file with line numbers

I started learning java relatively recently as my first computer language independently and would like to see if my approach is efficient. An exercise in the book I am studying from tells me to read a ...
6
votes
2answers
3k views

End of line converter

I recently wrote a python script to convert multiple files EOL's from Unix to DOS and vice versa. I am looking for tips to ...
2
votes
0answers
566 views

File shredding (secure deletion) algorithm

Does anyone see anything wrong with this? I was considering using something like srm or wipe and use ...
1
vote
3answers
198 views

Stitch or stretch lines of a simple text file

Often I write notes about a topic into a simple text file when I learn something. Sometimes i work with these text file on other computers with a different screen resolution. So sometimes the lines of ...
2
votes
2answers
285 views

Backup document root and MySQL in Linux

I wrote this program to backup everything in document root and the MySQL database in Linux environments. It is aimed for Debian/Ubuntu environments to say the least. ...
0
votes
1answer
311 views

Reading file and print it in hex format really slow

I'm trying to read a file and print its byte in hex form, using the below code. The code those it but i think optimization can be done to make it read and print faster, because if i remove the print ...
1
vote
1answer
76 views

Haskell searching through a large textfile efficiently

I have been given a list xs and a function f, and I want to know stuff like how many ...
4
votes
1answer
4k views

Basic File Browse

Below is a Browse class that lets the user browse files and show the path in an entry frame. This is pretty short and basic. ...
3
votes
1answer
96 views

Scraping metrics from log files

https://github.com/bodgix/log2metric/pull/1 This is my very first Go program so please forgive any beginner errors. This is a rewrite of a monitoring script I had written in Ruby. Coming from Ruby, ...
5
votes
1answer
60 views

File editing class

I was making this file editing class (writing to a file, reading a file etc.) in Python and was just looking for any feedback. Note: I've been thinking about removing the ...
3
votes
2answers
271 views

Reading lines of integers into a list of lists

I have a text file containing integers in different lines which I want to read into a list of lists. So 01 11 14 45 50 09 should become ...
7
votes
1answer
489 views

Computing a hash value of a file

I am trying to see if there is a more efficient way of creating a hash of a file of unknown size (could be gb). My code below works fine but I am sure there is a more efficient way of achieving this. ...
4
votes
0answers
116 views

File operations using Groovy

The idea is to read a file - "data" - and write the information to a new file - "output" - only if it meets the criteria (if the resource usage is more than a configured threshold). Content of the ...
16
votes
3answers
2k views

92 Spoons AI, sort of an AI in C++

I have made an AI that takes a user input and returns a predefined value. It that stores its info in a file (with the name of the file "default.92ai"). I thought ...
6
votes
1answer
380 views

Simple python code takes command line argument for file location and tokenizes text

The usage of this Python program is: python ~/test.py test.txt Here is the source: ...
1
vote
0answers
38 views

Speed up generate excel file

I have little knowledge about java (I'm just starting). I have issues in my generate excel file code. It takes some time to generate the file. Could you please take a look at it? ...
3
votes
1answer
188 views

Retrieve TOC from PDF

I am reading 'Python Trick' in PDF type. To have a big picture of the book, I aim to get a structure dict of TOC from the book. So I copied its TOC from PDF to typora(a markdown editor) and solve the ...
2
votes
1answer
39 views

Retrieve Data from TOC

I aim to convert the TOC of The Python Language Reference — Python 3.6.3 documentation to a structured data with the following steps: Copy contents to a plr.md ...
2
votes
1answer
43 views

Retrieve the shared words from files

I have two files of dip.md and tp.md, which copied respectively from Think Python and Dive Into Python 3 By comparing them, I ...
4
votes
1answer
1k views

Binary data utility class

I have recently been trying to get a solid grasp of how to work with binary data, both for networking and file storage, in C++. In java, there are many utility classes that made this easy. Since these ...
0
votes
2answers
148 views

Reading numbers from three text files in C++

This code is supposed to read some text files. What should I do in order to optimize my code. I was confused about writing a user defined function so that I can pass any text to it and it stores it in ...
23
votes
4answers
2k views

Perl CGI script to serve a PDF file

In a different post I showed the following Perl CGI script. Someone in the comments said that "You're using a lot of very unperlish syntax, and I'd like to give you some feedback". So, here it ...
8
votes
3answers
851 views

XOR cipher C program

I was learning about getopt to parse command line options and I decided to write this small XOR cipher program for files. It acts as a "UNIX filter" (I guess) ...
2
votes
1answer
371 views

Split a data file into files for each time step

I have written a simple code to extract different time steps from a big text file. It works for small text files, but not for bigger text files as input. ...
1
vote
1answer
281 views

Backup of directory

I'm a student that have been learning java for the last year. I have recently created a little program that creates a backup of a directory (it creates a directory named backup0 and copies all files ...
2
votes
1answer
125 views

Extracting file names from text file

I need to extract file names with their extension from an input text file to a string vector. The input text file is quite messy and serves as configuration file for some application. What I know ...
4
votes
1answer
214 views

Reading records from a FoxBASE database file

I'm working on implementing a library that can read/write from FoxBASE files in C#. I can't use ODBC for this, because it's not supported in .NET core. I've got the reading working, but it's ...
6
votes
3answers
1k views

Removing empty lines from a file

The below code removes empty line from test.txt. I posted this answer on StackOverflow but someone commented that this code needs review and suggested me to post ...
9
votes
1answer
627 views

Reading a file without blocking the main thread

Background Info: Running Python 3.6 on Windows 10 I have a text file parsed like this: Ann Marie,Smith,ams@cia.com There can over 100+ names in the text file. ...
1
vote
1answer
736 views

Java method to load random paragraph from text file

Looking for some critique for this code. but ultimately I would like to be directed to resources/books that address my code writing weaknesses, in terms of style structure an convention : The task is ...
6
votes
1answer
607 views

Python read/write pickled file

Is there a way in Python 2.7 to improve reading/writing speed (or memory consumption of the file) compared to this version? ...
2
votes
2answers
483 views

Simple yet threadsafe file cache in java

I'm attempting to cache contents of a file to avoid frequent reads, using a very simple implementation in a single class. The file contains a list of emailids, one per line. The file changes rarely, ...
0
votes
1answer
182 views

Powershell GetKeystate with outfile

I got a keylogger Powershell script to protocol my input, since I'm quite paranoid if someone uses my PC. However, some letters (I have an anti-ghosting keyboard) are swallowed if I type them in fast....
7
votes
1answer
3k views

Tokenizing a file with a generator

I'm parsing (specifically tokenizing) a file, line-by-line. I've a method tokenize, that takes a string (one line of code, it can't take the whole file at once), breaks it into parts, and returns a ...
0
votes
2answers
249 views

Print every line of file, last to first, with recursion

Had a discussion with a friend to solve this extra credit problem, and we came up with two separate solutions. What are the differences between these two? Is one better than the other? How can I make ...
2
votes
1answer
63 views

Small database with a user defined size

This is a program that accepts user input for a database size - number of rows and data size. After creating the database the user should be able to read, add, remove and list entries and the file ...
1
vote
1answer
4k views

Get file absolute path from file URL in PHP

Reading several questions regarding the topic, I made my function to return file's absolute path from the file URL. As I'm using this in an WordPress environment, hence I availed ...
1
vote
1answer
66 views

Function for store data - C++ [closed]

Given the following definition for a NODE in a linked list: struct NODE { int data; NODE* next; }; I want a function to store the nodes with odd data to a given ...
5
votes
2answers
344 views

Replace the content of a file by zero-bytes and keep the same filesize

Here is a little tool for Windows that replaces the content of a file with zero-bytes, keeping the same filesize. It works. The goal is to be sure that the old bytes-content of the file is no more ...
4
votes
1answer
2k views

Python CSV file slicer

I have made CSV file slicer. This is my first and biggest piece of code on Python. It takes one .csv file from current folder and then slices it to n parts and adds ...
2
votes
2answers
132 views

For names sake - Project Euler 22

Project Euler - 22 Names scores Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin ...