« first day (3560 days earlier)      last day (1374 days later) » 

7:00 PM
got the error,
I can't find equivalent async classes of FileStream and FileStreamResult. Any help is appreciated.
 
mr5
I assume .ReadToEndAsync() returns a Task
and .DeserializeObject<T>(in) expects a string/stream
and iirc, .DeserializeObject<T> returns T instead of Task<T> so you can't await to it.
 
 ` var resultobj = await reader.ReadToEndAsync();`
               ` var result = JsonConvert.DeserializeObject<Result>(resultobj);`  fixes it
actually in my OnPostAync, a python script is being run and secondly a file is being read. I therefore want 2 awaits
 
mr5
In the new .netcore, it already has a built-in JSON serializer which offers async deserializer
You're using NewtonSoft right?
 
mr5
those are pure synchronous. You might need to wrap them in Task if you want an asynchronous deserialization
 
7:12 PM
the json returned by the python script(i.e., printed to the console) is one liner. No need to await it
but the file reading is time consuming
 
mr5
oh. you can put .ConfigureAwait(false) at the end of .ReadToEndAsync() so that deserialization would run on same thread.
No context switching.
 
wait a bit, thread? In Asynchronous programming, things are single threaded, aren't they?
I jumped from python /javascript to c# the day before yesterday.
C# is cool.
 
mr5
no
it runs on different Thread.
 
oh , I forgot world is changed now, from single threaded languages to multithreaded ones.
 
mr5
I'm not sure have could you achieve async in a single threaded environment.
 
7:25 PM
async is a series of processes which run each for 5 milliseconds in a single thread. That's how I understand it in javascript.
 
mr5
5 milliseconds? where does that number came from?
 
it runs continuously in an perpetual event loop. Whichever finishes fast gets completed first
I chose that randomly. I meant small time.
it might be microseconds.
 
mr5
> async is a series of processes which run each for 5 milliseconds in a single thread.
it sounds so wrong
 
I think I confirmed it at IRC node.js
this topic is not so easy to take in.
 
mr5
how would you "halt" an execution even though it runs on perpetual event loop?
how would you "chunk" the process so that it can pause-resume and do other things?
if you think in procedural, it seems to be impossible to accomplish
 
7:29 PM
One need to learn about the event loop for that
I have read a stack and a queue are used for this purpose(in javascript)
 
mr5
doesn't matter. that event loop would run synchronously anyway.
still, synchronous.
if one action from event loop has while(true); then it will freeze completely.
idk how JS does it.
 
well, it's like you take 5 min to cook bread and 5 min to make tea . Then to get bbreakfast ready you need both items and 10 mins are to be spend without food. This is sync . In async you cook break for 2 min, and make tea for 2 min, and you see serving is diffrent in this case.
 
mr5
26
A: how javascript single threaded and asynchronous

T.J. CrowderJavaScript, the language, is not single-threaded, and there exist multi-threaded environments that run JavaScript (for instance, the Java virtual machine via its scripting support). The language itself is largely silent on the topic of threads. It does define a job queue (browser-oriented folks c...

JS is not single threaded
 
ok, now you are talking about node
 
mr5
 
7:35 PM
Js is /was single threaded. Ask on IRC. Node which is a javascript wrapper around c++ is multithreaded
 
mr5
look at the tag.
 
I wish it could had more upvotes if it was right
users dont necessarily upvote things that are right, they often do it if it seems to be right.
just like law, court rooms. What can be proved right is right.
 
mr5
7:47 PM
setTimeout(() => {console.log('hello')}, 10);
(function() {
  while (true) { }
})();
setTimeout(() => {console.log('world!')}, 1);
the setTimeout will not fire because one action would prevent all of them to get fired
 
8:34 PM
cant post normal questions so:
string[] FileLine = { Application + Username + Password + "\n" };
File.WriteAllLines(@"Account.txt", FileLine);
using this it seems to wipe the file and then write the line
 
anybody there?
 
8:53 PM
Here?
2
 
9:36 PM
Hello guys how are yo u
Tell me about some projects you guys are working on
 

« first day (3560 days earlier)      last day (1374 days later) »