streamreader

ERR_EMPTY_RESPONSE when processing a large number of files in ASP.Net using C#

隐身守侯 提交于 2019-12-12 17:42:42
问题 I created an intranet system to handle TXT files in a directory and process it's data into a SQL Server database. It's recursive, so I have a file structure like this: C:\RawData\2012_06_01\2012_06_01_0002144493.txt C:\RawData\2012_06_01\2012_06_01_0002954412.txt ... C:\RawData\2012_06_15\2012_06_15_0012554778.txt And so on, summing up to about 10.530 files. It works perfectly when selecting just some folders (like all folders from a month). However, when trying to process, let's say, an year

Load Image from Stream/StreamReader to Image OR RawImage component

可紊 提交于 2019-12-12 12:47:51
问题 I'm using AWS Unity (v3.3.50.0): S3 SDK (AWSSDK.S3.3.3.5.4.unitypackage) downloaded from https://aws.amazon.com/mobile/sdk/. My Unity version is 5.5.1. I want to download an image placed on S3 bucket, bucket is configured and can be downloaded. And I see the string as data in response. But I cannot able to convert the returned StreamReader to UnityEngine.UI.Image.sprite OR UnityEngine.UI.RawImage.texture in S3 sample GetObject() function. private void GetObject() { ResultText.text = string

Reading very large text files, should I be incorporating async?

别来无恙 提交于 2019-12-12 12:16:11
问题 I have been challenged with producing a method that will read in very large text files into a program these files can range from 2gb to 100gb. The idea so far has been to read say a couple of 1000 lines of text into the method. At the moment the program is setup using a stream reader reading a file line by line and processing the necessary areas of data found on that line. using (StreamReader reader = new StreamReader("FileName")) { string nextline = reader.ReadLine(); string textline = null;

StreamReader with tab delimited text file

我怕爱的太早我们不能终老 提交于 2019-12-12 10:08:34
问题 I have a similar requirement to this post... Populate Gridview at runtime using textfile Where I want to read a text file with StreamReader and populate a DataTable with the data in the file, however I'm not sure how to implement a split() with a tab. Could anybody point me in the right direction, please? 回答1: You can try this: DataTable table = new DataTable(); table.Columns.Add("col1"); table.Columns.Add("col2"); table.Columns.Add("col3"); var lines = File.ReadAllLines(@"Data.txt").ToList()

C# - Parallelizing While Loop with StreamReader causing High CPU

限于喜欢 提交于 2019-12-12 10:02:42
问题 SemaphoreSlim sm = new SemaphoreSlim(10); using (FileStream fileStream = File.OpenRead("...")) using (StreamReader streamReader = new StreamReader(fileStream, Encoding.UTF8, true, 4096)) { String line; while ((line = streamReader.ReadLine()) != null) { sm.Wait(); new Thread(() => { doSomething(line); sm.Release(); }).Start(); } } MessageBox.Show("This should only show once doSomething() has done its LAST line."); So, I have an extremely large file that I want to execute code on every single

JsonSerializer can't read stream from StreamReader

匆匆过客 提交于 2019-12-12 02:42:04
问题 I can't get the DataContractJsonSerializer object to swallow my stream. When I execute the code with the commented-out line active, I get to see the text provided (and it is a parsable JSON object), so I know that the stream is working fine. However, for some reason, the compiler complains that the streamReader I'm trying to shove down its throat in ReadObject isn't a Stream . Well, isn't it?! Argument 1: cannot convert from 'System.IO.StreamReader' to 'System.IO.Stream' What am I missing and

Is clojure's read file structure, i.e. with-open and clojure.java.io/reader, efficient enough for frequent access?

这一生的挚爱 提交于 2019-12-12 02:25:45
问题 Suppose I write a function to parse data from a txt file with with-open and clojure.java.io/reader, and then I wrote another function to call the reader function multiple of times in order to process data, e.g. (defn grabDataFromFile [file patternString] (let [data (atom [])] (with-open [rdr (clojure.java.io/reader file)] (doseq [line (line-seq rdr)] (if (re-matches (re-pattern patternString) line) (swap! data conj line)))) @data)) (defn myCalculation [file ] (let [data1 (grabDataFromFile

How to read from a text file and add that data to a graph in c++

岁酱吖の 提交于 2019-12-12 02:24:31
问题 I have a text file that has 256 pairs of data. I need to take those pairs and put them into the vectors for the graph. I am know how to do this in C# but I am new to C++. The format of the text file is 125, 151 124, 176 ect... I need it to come into the vectors for the graph in the format of graph[n][m], where n = 256 and m=256. So I would read through the file and would mark 1 on the number that corresponds with the L/R Pair. So for example 125, 151. I would go to the 125th line and I would

Sending a multiline string over NamedPipe?

岁酱吖の 提交于 2019-12-12 02:23:24
问题 How can I send a multiline string with blank lines over a NamedPipe? If I send a string string text= @"line 1 line2 line four "; StreamWriter sw = new StreamWriter(client); sw.Write(text); I get on the server side only "line 1" : StreamReader sr = new StreamReader(server); string message = sr.ReadLine(); When I try something like this StringBuilder message = new StringBuilder(); string line; while ((line = sr.ReadLine()) != null) { message.Append(line + Environment.NewLine); } It hangs in the

Streamreader to 2d array

╄→尐↘猪︶ㄣ 提交于 2019-12-12 01:52:34
问题 How do I take the contents of a file using a Streamreader and place it in a 2d array. The file is as follows: type1,apple,olive,pear type2,orange,nuts,melon type3,honey,grapes,coconut So far my code is as follows: public static void invent() { StreamReader reader2 = new StreamReader("food.txt"); while (reader2.EndOfStream == false) { string[,] line = new string[1000, 1000]; line = reader2.ReadLine(); } } 回答1: I think the better approach for what you are trying to do is to have your splitted