Re: Why is -1 mod 5 not equal to 4? (it is -1)

2019-12-23 Thread forcefaction
Thank you for the detailed explanation.

Why is -1 mod 5 not equal to 4? (it is -1)

2019-12-22 Thread forcefaction
The Title is the Question :D. I know that there is mod and %%. %% is only for unsigned integers, so i thought mod would also work with signed ones. What is the operator or function i need to get the correct modulus?

Re: How to properly use Proxies in Nim

2019-12-11 Thread forcefaction
When trying different proxies i get different errors, sometimes it's unable to CONNECT or the connection is refused or i get a ProtocolError. I don't know if it's a configuration thing on the proxy side or if i have to use different methods. If someone has an idea on how to investigate that

How to properly use Proxies in Nim

2019-12-10 Thread forcefaction
Hi, i'm trying the following code: import httpclient let myProxy = newProxy("http://ip:port;) let proxyClient = newHttpClient(proxy = myProxy) let response = proxyClient.request("https://www.google.de/;) echo response.body Run i

Re: Question about multithreaded use of filestream.readLine() function

2019-12-03 Thread forcefaction
Hm yes that makes sense. The input fie contains a URL per line which has to be checked and the result should be written into a file. Because this depends on Network latency i thought it would speed up the program if i spawn many connections ~300-400 concurrently. But maybe i'm mistaken.

Re: Question about multithreaded use of filestream.readLine() function

2019-12-03 Thread forcefaction
Thank you for your time and the detailed explanation , now i understand and it works across many physical cores. Because i have to write data into a single file the lines are now mixed up, i think i need channels (?) to solve this, i will read how that works try it out and ask again if i have

Re: Question about multithreaded use of filestream.readLine() function

2019-12-02 Thread forcefaction
I read your answer in the other Thread and i don't understand how your example code should be translated into a "parallel_for" loop. I don't know what to look for. Do you have any keywords i should search for ? :(

Re: Question about multithreaded use of filestream.readLine() function

2019-12-02 Thread forcefaction
Thank you for the link. I will try that out.

Question about multithreaded use of filestream.readLine() function

2019-12-01 Thread forcefaction
Hi, i currently use this code to divide work between worker threads: var linePtr: seq[pointer] for line in memSlices(memfiles.open($args["--inputFile"], mode = fmRead)): linePtr.add(line.data) let batchSize = (linePtr.len /

Re: How to divide file in Chunks for multithreaded processing?

2019-11-15 Thread forcefaction
Thank you, this works.

Re: Resolve ambiguous call to open

2019-11-14 Thread forcefaction
That makes sense. Thank you!

Resolve ambiguous call to open

2019-11-14 Thread forcefaction
Hi, i'm using let m = memfiles.open("text.txt", mode = fmRead) Run and try to call let f open("another.txt") Run results in Error: ambiguous call; both io.open(filename: string, mode: FileMode, bufSize: int) [declared in

Re: How to divide file in Chunks for multithreaded processing?

2019-11-14 Thread forcefaction
Hm, so you mean something along this? var linePtr: seq[pointer] var input = memfiles.open("file.txt", mode = fmRead) for line in memSlices(input): linePtr.add(line.data) Run and then i divide the length of linePtr by my core count. This gives me the

How to divide file in Chunks for multithreaded processing?

2019-11-13 Thread forcefaction
I want to split a file into multiple pieces and give one piece to one thread. I figured memfiles should be the best option, but I'm struggling as to how I should use them to divide my file into multiple slices. The file itself contains in each line a single datum. Does anyone have any hints on