Is it possible to generate a list of all transient dependencies and their sources?

2020-12-24 Thread disruptek
Install Nimph from `nimph graph` to view the dependency graph in your console. `nimph lock` to write the graph into a JSON file.

Cancelation points in async

2020-12-24 Thread juancarlospaco
stdlib http stuff needs destructors.

Cancelation points in async

2020-12-24 Thread jackhftang
If your goal is just to have a timeout future, I have an example that wrap the `request` proc for `asyncHttpClient` which do not support pooling and timeout yet. proc request*( pool: HttpClientPool, url: string, httpMethod: string, body = "", headers: H

Finally found a language which is as fast as C and as Pythonic as possible...

2020-12-24 Thread filipeduarte
Awesome... I’m excited to use Nim in scientific computing.

Cancelation points in async

2020-12-24 Thread QMaster
In my example there's a 1 second pause, but it might be 15 minutes easily. What socket should I close to stop it from waiting those next 15 minutes? I can't close the socket of the connection before I've done everything to gracefully shutdown it and cancelling all the sending and waiting tasks a

Cancelation points in async

2020-12-24 Thread dom96
Your code still looks far too abstract for me to give you a good answer, but from what I'm seeing so far of your description you can simply close the FD like I said.

Is it possible to generate a list of all transient dependencies and their sources?

2020-12-24 Thread adnan
This is great. I’ll investigate this when I get home. Thank you.

Is it possible to generate a list of all transient dependencies and their sources?

2020-12-24 Thread saem
There is likely a more efficient way, but to at least get you started would using [local dependencies via a nimbledeps folder](https://github.com/nim-lang/nimble#nimbles-folder-structure-and-packages) and then listing all installed packages via [nimble list --installed --ver](https://github.com

Advent of Nim 2020 megathread

2020-12-24 Thread fxn
Same as mine!

Advent of Nim 2020 megathread

2020-12-24 Thread e
Hah! There are so many options for hexagonal coordinates. I sketched it on paper this morning and chose what I now know (following @lscrd's link) is a "double-width" horizontal layout. See [this site.](https://www.redblobgames.com/grids/hexagons/) For e, w, se, sw, ne, nw... proc

toBin

2020-12-24 Thread xigoi
Here's the documentation of Nim's standard library, you can find everything using the search bar:

Advent of Nim 2020 megathread

2020-12-24 Thread lscrd
About coordinates system for hexagon grids, I found this: For day 24 AOC, I used the axial coordinates and a set of black tiles too. In project Euler there are some problems involving hexagon grids.

Is it possible to generate a list of all transient dependencies and their sources?

2020-12-24 Thread adnan
Hello, I would like to download all my required nimble packages (and their own required dependencies) for an offline build. This is a necessary part of deploying an application to flathub. I would like to create a json/yaml file that lists all the required dependencies and the file looks like so

Windows Error

2020-12-24 Thread SyTax
Thank you for everthing. It's work :)

Windows Error

2020-12-24 Thread Hlaaftana
Are you sure you completed the setup? In , in the section Compiler Dependencies, it gives links to MingW for 32 and 64 bit windows. Choose the MingW version you want, download the .7z file, put the folder inside somewhere, then put the "bin" folder ins

Nim Seqs to C backend

2020-12-24 Thread 19
Thanks Clonk for the amazing answer! I am aware of the nimble packages, I just want to extend them with some C code. Thanks for that nice Nim snippet.

Cancelation points in async

2020-12-24 Thread JPLRouge
I have a bit of the same problem, several clients on the same server if one closes the server should not trigger alarms in all directions or even with a try, it will directly shutdown. the close operation should not determine the server shutdown

Nim Seqs to C backend

2020-12-24 Thread Clonk
>From the manual : > The UncheckedArray[T] type is a special kind of array where its bounds are > not checked. This is often useful to implement customized flexibly sized > arrays. Additionally, an unchecked array is translated into a C array of > undetermined size. > > The base type of the un

Advent of Nim 2020 megathread

2020-12-24 Thread fxn
For today's, I came out with a system of integer coordinates for the hexagons that reduced the problem to maintaining a hash table of black ones. Do not know if that is standard, first time I deal with a grid of hexagons.

Advent of Nim 2020 megathread

2020-12-24 Thread fxn
That's clever, take note of the technique! It's the same @miran used too if I am not mistaken.

Windows Error

2020-12-24 Thread SyTax
Hi, I install Nim Lang but it not works. I get this errors, how can i fix? (I have completed the setup.) Error;

Nim Seqs to C backend

2020-12-24 Thread 19
I would like to create some custom functions in C using SDL2 and then import to Nim. Do i need to compile a new SDL2 DLL with the new custom C functions? I tried to create an example custom C function in its own header but i got this error when i compiled the nim that imports the function:

toBin

2020-12-24 Thread archnim
Cool ! Thank you.

Cancelation points in async

2020-12-24 Thread QMaster
Let me rewrite a bit the upper code: import asyncdispatch var connectionAlive: bool = true proc test() {.async.} = var x = 0 while connectionAlive: # send heartbeat info await sleepAsync(1000) # await for heartbeat timeout # check if

toBin

2020-12-24 Thread archnim
Hello world. Is there any function in the std lib that takes a variable (or const) of any type, and returns its binary representation ? If not, which aproach could be the best the create such an algorithm ?

toBin

2020-12-24 Thread archnim
I'm struggling to find a tuto on binary operations in Nim. Can you please give me some links.

toBin

2020-12-24 Thread juancarlospaco
` strutils.toBin ` Run

Advent of Nim 2020 megathread

2020-12-24 Thread e
I needed a hint for Day 23, and went to reddit where I saw the SPOILER from [u/3urny](https://www.reddit.com/user/3urny/) "use a flat integer array of ints, length 1M, where at index at n you put which number comes after n in the ring." So, no linked list, no hash table. [My solution](https://g

Cancelation points in async

2020-12-24 Thread dom96
The current stdlib implementation does not support arbitrary cancellation of futures. What you can do to cancel an operation is close the FD (socket) that it is working on. This might work for your use case, but if not then I’d be interested to hear about it so we can support it.

Is anyone using duckdb with Nim?

2020-12-24 Thread qqtop
I tested it and simple connection works fine via python more advanced usage with nim needs consideration of how to pass strings from nim to duckdb so that thet appear single quoted after being passed through nimpy. pip install duckdb==0.2.3 nimble install nimpy nimduck.nim import

Cancelation points in async

2020-12-24 Thread QMaster
I've seen the thread of 1 year ago about "Data loss with async sockets", but I decided to start a newer one. I see that stdlib's async implementation yet completely lacks of cancellation points in futures, and this code works completely wrong and unintuitive: import asyncdispatch

Nim Seqs to C backend

2020-12-24 Thread 19
Yeah you're right. I'm gonna give that a shot. C2Nim is easier. Whats the difference between array and UncheckedArray?

Is anyone using duckdb with Nim?

2020-12-24 Thread Clonk
Never heard of it, but from the site : > > C++11, no dependencies, single file build So building bindings shouldn't be too hard. You can check Nimterop, c2nim tools to automate it.

Nim Seqs to C backend

2020-12-24 Thread Clonk
> > So far it has been fun to import stuff from Nim and use them in C. I recommend doing it ther other way - ergo calling C from Nim. It is much easier to accomplish. Are you set on using `seq` ? You could use `UncheckedArray` instead it would be much easier for C interop.

Client-side JS with Nim

2020-12-24 Thread jackhftang
FYI, I made a quick test on the generated js file size for the following code. import times echo now() Run I compiled the code in debug, release, release+danger mode. Also, I used google closure compiler (gcc) in simple mode for minification. And also, I wrap the

Nim Seqs to C backend

2020-12-24 Thread 19
Hello, I have been playing around with a hybrid app that uses C and Nim. So far it has been fun to import stuff from Nim and use them in C. I wanted someone to show me some ways to understand how sending memory between the two works. I have a few ideas: 1. malloc from C and give Nim a point

Is anyone using duckdb with Nim?

2020-12-24 Thread sdmcallister
I recently watched a presentation on duckdb. It is an embeddable SQL OLAP database management system. Similar to SQlite but optimized for analytics. I'm curious if anyone has been using this db with Nim?

Client-side JS with Nim

2020-12-24 Thread cumulonimbus
Indeed, it's the latency, not the size, that's the problem. While almost everything is cached for users today, most CDNs are configured in such a way that the browsers still try to validate the cache often, paying almost all the latency. One 250KB file that contains everything (html, js, possib

Client-side JS with Nim

2020-12-24 Thread saem
If we're going to talk about size and these things then some meaningful parameters are necessary to characterize things. In e-commerce milliseconds to page is useful/responsive (time to first render) is a big deal yes, but e-commerce itself has niches. For bandwidth, @Araq is bang on, the JS sh