Ruby: Iterating through dir's and files

I wrote the following script to iterate through a directory, it's subdirectories and their files: def self.search_files_in_dir_for(dir, strings) results = {} puts "Initializing test ..." Dir.foreach(dir) do |file| ...
more »

2017-03-17 22:03 (1) Answers

Batch file, search file and replace string

I'm trying to create a batch file who will search for a specified file and will replace a string in it by something else The problem is that the path is different for each user. The file is prefs.js, and it's located in C:\%username%\AppData\Roamin...
more »

2017-03-17 18:03 (1) Answers

How to save to an INI file delphi

I have buttons which when clicked store their caption in a TStringList ChairList : TStringList; procedure TForm1.FormCreate(Sender: TObject); begin ChairList := TStringList.Create; end; An example of one button is: procedure TForm1.Table17Click(...
more »

2017-03-17 10:03 (4) Answers

Closing a file without knowing its handle

I have a function (which I can't modify) that tries to open a file but throws an exception in the process (blackbox in my MWE, a function imported from a module in reality). I'm trying to write some exception handling code that would delete the garba...
more »

2017-03-16 00:03 (0) Answers

CSV to JSON in Typescript

I am trying to create a JSON file from the data received from a CSV file uploaded using a file uploader input. I have found lots of posts doing this in Javascript but they just aren't quite working for me in Typescript. The error I get when running...
more »

2017-03-15 13:03 (1) Answers

Python glob -- get newest file from list

I am able to retrieve the list of files with similar names. What I am trying to do is retrieve the newest file in order to be manipulated. With glob, I am able to retrieve all of the files, but not the specific one. Here is my sample code: permissi...
more »

2017-03-13 20:03 (1) Answers

Make a Dictionary in Batch

I am attempting to make a Batch program that, when a word (eg. "coding") is inputted, its corresponding definition is outputted. What I have tried: 1) Downloading lists of all accepting English words, but I can't find any lists that include definit...
more »

2017-03-12 16:03 (1) Answers

Need to search a big file of integers using Java

I have a file which has 100,000 lines and each line is a list of space separated 1000 integers(ranging from 0 to 1,000,000). Now I need to to make an API which when given two inputs a and b tells me if there are two numbers present in same line in fi...
more »

2017-03-11 22:03 (1) Answers

How to overwrite INI file

I have this code which saves the location of Objects in an ini file but when I try to overwrite an already saved file, it doesn't delete the data currently in the file. I have a popup which asks the user if they want to overwrite but it doesn't cl...
more »

2017-03-10 11:03 (1) Answers

Bash - find matching pairs of files

I have many files in the folder: Filename1.mp4 Filename2.mp4 Filename3.mp4 Etc. As well as many files with added suffix to the name: Filename1_x264.mp4 Filename2_x264.mp4 Filename3_x264.mp4 Etc. I am trying to catch the matching pairs using fi...
more »

2017-03-04 14:03 (1) Answers

how to update a text in a file line by line

I have a text file foo.txt that looks like: first 01 start some thing 01 and more 101 i dont care end i dont care final 01 I want to replace all 01 with 10 between the lines start and end in the same foo.txt like so: first 01 star...
more »

2017-03-03 19:03 (1) Answers

How To Save & Load My Connect 4 C Program

I have a C implementation of connect-4* that I made. It allows users to pass in command-line arguments such as board height, width, and the number of pieces in a row required to win. After a game is won the program asks the user if they want to play ...
more »

2017-03-03 03:03 (0) Answers

Writing bson to a file in C++

I am planning to write a bson to disk from a c++ code and read it back from java code. the c++ lib and example i am using is: bson example any idea on how to write it to disk in binary bson format? I have a binary data(a binary file content like j...
more »

2017-02-25 11:02 (0) Answers

Android N take photo

I am creating an application that needs to make a photo and store it to the external storage. Now, everytime I click on the button to take a photo it sets the view back to my main activity. What's the matter with my code? Button button...
more »

2017-02-22 12:02 (0) Answers

Reading binary data in python

Firstly, before this question gets marked as duplicate, I'm aware others have asked similar questions but there doesn't seem to be a clear explanation. I'm trying to read in a binary file into an 2D array (documented well here
more »

2017-02-21 12:02 (1) Answers