text-files

Can not read turkish characters from text file to string array

纵饮孤独 提交于 2021-02-19 02:13:42
问题 I am trying to do some kind of sentence processing in turkish, and I am using text file for database. But I can not read turkish characters from text file, because of that I can not process the data correctly. string[] Tempdatabase = File.ReadAllLines(@"C:\Users\dialogs.txt"); textBox1.Text = Tempdatabase[5]; Output: 回答1: You can fiddle around using Encoding as much as you like. This might eventually yield the expected result, but bear in mind that this may not work with other files. Usually,

How to count all the words in a textfile with multiple space characters

无人久伴 提交于 2021-02-17 04:40:48
问题 I am trying to write a procedure that counts all the words in a text file in Pascal. I want it to handle multiple space characters, but I have no idea how to do it. I tried adding a boolean function Space to determine whether a character is a space and then do while not eof(file) do begin read(file,char); words:=words+1; if Space(char) then while Space(char) do words:=words; but that doesnt work, and basically just sums up my(probably bad) idea about how the procedure should look like. Any

How to count all the words in a textfile with multiple space characters

青春壹個敷衍的年華 提交于 2021-02-17 04:40:36
问题 I am trying to write a procedure that counts all the words in a text file in Pascal. I want it to handle multiple space characters, but I have no idea how to do it. I tried adding a boolean function Space to determine whether a character is a space and then do while not eof(file) do begin read(file,char); words:=words+1; if Space(char) then while Space(char) do words:=words; but that doesnt work, and basically just sums up my(probably bad) idea about how the procedure should look like. Any

Creating an array of Objects from reading a .txt file and saving line by line into object array

孤街浪徒 提交于 2021-02-11 15:44:59
问题 The project prompt looks like this: In Netbeans create a project named Project1, be sure to create a package, DO NOT use the default package. There will be two java files, the first most likely named Project1.java (which contains main) and the second named Record.java which contains a variable containing ONE LINE OF DATA (or record) read from the file. In your main class (not in Record.java) create an array of Record objects. When the program starts have main() call a method that reads each

Creating an array of Objects from reading a .txt file and saving line by line into object array

烈酒焚心 提交于 2021-02-11 15:44:43
问题 The project prompt looks like this: In Netbeans create a project named Project1, be sure to create a package, DO NOT use the default package. There will be two java files, the first most likely named Project1.java (which contains main) and the second named Record.java which contains a variable containing ONE LINE OF DATA (or record) read from the file. In your main class (not in Record.java) create an array of Record objects. When the program starts have main() call a method that reads each

Iterating over two text files in python

↘锁芯ラ 提交于 2021-02-11 15:24:49
问题 I have 2 text files and I want to iterate over both of them simultaneously. i.e: File1: x1 y1 z1 A,53,45,23 B,65,45,32 File2: x2 y2 z2 A,0.6,0.9,0.4 B,8.6,1.0,2.3 and I want use values from both files simultaneously: e.g: c1 = x1*x2 + y1*y2 + z1*z2 #for first line c2 = x1*x2 + y1*y2 + z1*z2 #for second line How can one do that using Python? 回答1: You need to treat both files as iterators and zip them. Izip will allow you to read the files in a lazy way: from itertools import izip fa=open(

Write JSON data to text file with PHP [duplicate]

回眸只為那壹抹淺笑 提交于 2021-02-10 19:58:55
问题 This question already has answers here : Issue reading HTTP request body from a JSON POST in PHP (2 answers) How to update/edit a JSON file using PHP [closed] (1 answer) Closed 2 years ago . Problem: I have a script that send JSON data to a PHP file in this way: var xmlhttp = new XMLHttpRequest(); xmlhttp.open("POST", "process-survey.php"); xmlhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); xmlhttp.send(JSON.stringify({uid, selected})); The problem is that JSON data

How would I calculate the standard deviation from a file of floating point numbers?

余生颓废 提交于 2021-02-10 18:49:07
问题 I'm trying to write a Java program to calculate the maximum, minimum, mean and standard deviation after reading a text file full of floating point numbers. As you can see, I've calculated the max, min, mean, but for the standard deviation, I'm confused. Any ideas how I should implement this? Also, I'm fairly new to programming, so sorry if things aren't structured correctly. Here's my code: /* * Create a Java program to read a file of floating point numbers and compute * the following

How would I calculate the standard deviation from a file of floating point numbers?

一笑奈何 提交于 2021-02-10 18:46:40
问题 I'm trying to write a Java program to calculate the maximum, minimum, mean and standard deviation after reading a text file full of floating point numbers. As you can see, I've calculated the max, min, mean, but for the standard deviation, I'm confused. Any ideas how I should implement this? Also, I'm fairly new to programming, so sorry if things aren't structured correctly. Here's my code: /* * Create a Java program to read a file of floating point numbers and compute * the following

Writing a text file into an array on Forth

泪湿孤枕 提交于 2021-02-10 14:21:48
问题 I have a text file, containing an array of numbers such as: 1 0 0 1 0 0 1 1 0 1 0 0 0 1 1 1 1 0 0 0 0 0 1 0 0 I have opened the text file with the following code: variable file-id : open_file ( -- ) \ Opens the text file s" c:\etc\textfile.txt" r/w open-file throw file-id ! ; I have also created an array to store this data: create an_array 25 chars allot \ Create the array : reset_array ( -- ) big_array 25 0 fill ; reset_array \ Set all elements to 0 Is there a way to write the contents of