byte position: file_get_contents vs fopen

I need some data from a specific byte in range in a binary file. (concatenated jpegs, don't ask...) So I have a offset and length data from an external API. (I would guess that those are byte positions) What works is the following: $fileData = fil...
more »

2017-10-13 09:10 (2) Answers

Bash - Rename file that have " in it

Ok I have a function that will have as parameter a string and it will output a new string that doesn't have any spaces, ', " function rename_file() { local string_to_change=$1 local length=${#string_to_change} local i=0 local new_string=" " loc...
more »

2017-10-10 18:10 (1) Answers

Only use already existing files(python)

Ok so I have a the name of a file as an raw input. But I the code to only use an already existing file and not and not be able to type in everything and just create new files. So how can I make the program only use an already existing file and NOT c...
more »

2017-10-08 13:10 (1) Answers

Creating directories and files using a loop in C

I'm new to C programming so there is probably a simple solution for this but I trying to create multiple directories and files within those directories by using a loop in C. For example, Directory1 text1.txt text2.txt Directory2 text1.txt text...
more »

2017-10-06 21:10 (2) Answers

Find line by one word in vector

Trying to find a line by one word in a vector. For example: In a file some data,like: ctrl+a move,find ctrl+c copy,group ctrl+z take,give all letters are small. Then I tried to read a file in vector - it's okay Then the user want ...
more »

2017-10-04 20:10 (1) Answers

How to SEO Index Documents

I've got a page, in which I have a preview of a document, as jpg. Also, I've got the content read of that image. I am doing it like this, but I have no idea if this is a way Google won't hate me.. <div class="image-container"> ...
more »

2017-10-04 15:10 (0) Answers

ruby save file from client to server

Imagine, I have this text on client: <form action="{{ some action }}"> <input type="file" name="certificate_template"> <input type="submit" value="AAAeee, send me to server!"> </form> What should I do to save this clien...
more »

2017-09-29 20:09 (2) Answers

django file duplicated somewhere

I'm having an issue where a file is generated and saved to the database, but somewhere along the line, the file is being duplicated. Please help! file_generator.py out_data = 'test text' out_file = open(settings.MEDIA_ROOT + '/post_ship.txt', 'w') ...
more »

2017-09-29 17:09 (0) Answers

How to Read&Write preserving the class

Is there a way to save a data frame data and keep attributes classes? I find it very annoying to read the file, and convert e.g: from character to fastposix, from numeric to factor. Specially knowing this was all set before. ...
more »

2017-09-29 11:09 (0) Answers

Removing file using name contains in Ruby

I have written the below code to keep a file that matches the passed in name and removes the rest of the files in the folder. def removeFiles2(path, namePart) aft_logger=AFTLogger.new Dir[path+'/*'].each do |fname| break if !(fname.include?...
more »

2017-09-29 10:09 (2) Answers

search a line in preprocessed big text file

I have a data file which contains 100,000+ lines, each line just contains two fields, key and value split by comma, and all the keys are unique. I want to query value by key from this file. Loading it to a map is out of question as that consumes too ...
more »

2017-09-26 13:09 (3) Answers

How do i input data for every name in a text file

I have a text file that starts with names listed one after another on different lines but i want to enter the percentages that each student got to be saved into the file, separated by commas but in order of the average score that they achieved. This ...
more »

2017-09-19 00:09 (1) Answers

How to load file from computer OR from URL

I have an webapp, that takes JSON file and parses it into objects. My goal is to make an user capable of uploading a file from them local computer OR from URL My index jsp page looks like this <form method="post" action="products" enctype="multip...
more »

2017-09-16 21:09 (0) Answers

Write to a file using fputs in C

Could someone tell me why the file doesn't change? It works when I use rewind or fseek but not otherwise. What's the standard way of using fputs after fgets. The file indicator is at position 9 so fputs must write after that, but it doesn't do anyth...
more »

2017-09-11 11:09 (2) Answers

java search with help of grep linux

I have the following java code to search on word in file, if that word found it stored the line contains that word in lista. List<String> lista = new ArrayList<>(); BufferedReader bf = null; String findWord = "city"; String line=""; bf =...
more »

2017-09-11 09:09 (0) Answers

UWP File Management

Why does saving a file fail so often on UWP? I open and read the contents of a specified file when the application is initially launched (with the help of a BackgroundWorker). Then when the application is suspending I try to save new content to the...
more »

2017-09-06 21:09 (0) Answers