Re: R-Tree module -- what can we improve?

2019-10-16 Thread Stefan_Salewski
OK, maybe lets start with the proc vs iterator issue: We have [https://github.com/StefanSalewski/RTree/blob/master/src/rtree.nim#L894](https://github.com/StefanSalewski/RTree/blob/master/src/rtree.nim#L894) proc findNearestBox*[M, D: Dim; RT, LT](t: RTree[M, D, RT, LT]; queryObject:

Re: Nim for enterprise software development

2019-10-16 Thread JPLRouge
Bonjour, je suis à la retraite , j'ai bien compris le problème , j'arrive de la grosse informatique de gestion , et j'ai aussi travailler sur des pc en c/c++ mon problème est de trouvé un exemple concret qui montre comment fonctionne au trvers d'une application simple mais dont les principe ce

Re: images: simple way to read/write and manipulate images in nim?

2019-10-16 Thread Stefan_Salewski
Yes, that looks good, but when I visited that page yesterday I was not sure if it is a pure Nim solution or it depends on C libs. I found that flippy depends on some other libs, but than again I was not sure if that where native Nim libs or C wrappers. C wrappers is not too bad when done well of

Re: Winning the Base64 benchmarks.

2019-10-16 Thread refaqtor
just gotta say, "cool!" and Thanks, all! 3 hours from "... noticed that..." to "PR up:"! and love that compile time lookup table goodness! I use nim heavily on my projects. I hope to get some bits polished enough to give back at some point.

Re: Winning the Base64 benchmarks.

2019-10-16 Thread Libman
> benchmarks are a game. I agree, but in a very positive interpretation of that phrase. Competitive games are essential, both to individual human development as well as software projects. They are a feedback mechanism that challenges potential complacency, and helps bring out the best that is w

Re: images: simple way to read/write and manipulate images in nim?

2019-10-16 Thread treeform
I am based toward [https://github.com/treeform/flippy](https://github.com/treeform/flippy) because I made it.

Re: Winning the Base64 benchmarks.

2019-10-16 Thread treeform
PR up: [https://github.com/nim-lang/Nim/pull/12436](https://github.com/nim-lang/Nim/pull/12436)

Re: Create a firewall / Net IDS with Nim lang

2019-10-16 Thread federico3
What traffic capturing speed do you want to achieve? DPDK is a monster, perhaps [https://kukuruku.co/post/capturing-packets-in-linux-at-a-speed-of-millions-of-packets-per-second-without-using-third-party-libraries](https://kukuruku.co/post/capturing-packets-in-linux-at-a-speed-of-millions-of-packe

Re: Manu v1.1 - Matrix Numeric package released!

2019-10-16 Thread b3liever
Hello, version v1.2 is released with a breaking change! Element wise operators starting with a dot (`.*`, `./`, `.\`) are renamed to `*.`, `/.` and similar. These had incorrect [precedence](https://nim-lang.org/docs/manual.html#syntax-precedence), writing `1.0 - A .* A` is actually `(1.0 - A) .

Re: Winning the Base64 benchmarks.

2019-10-16 Thread treeform
I am working on a PR. The gist is just a proof of concept. You are right. I need to check for "" otherwise my code breaks. I just added that in. Thanks!

Create a firewall / Net IDS with Nim lang

2019-10-16 Thread dmknght
Hi everyone! I am wanting to create an application firewall (opensnitch like) with Nim lang and add more features. I also want to monitor packets and block packets by signatures (snort / suricata like). So i searched for packet sniffing lib for nim lang and the only thing i found was libpcap fro

Re: Winning the Base64 benchmarks.

2019-10-16 Thread juancarlospaco
Wheres the PR ?. :P if unlikely(str.len == 0): return "" # For eg. encode("") Run Special case return fast for empty string ?.

Re: Winning the Base64 benchmarks.

2019-10-16 Thread Araq
Sounds good.

Re: Manu v1.1 - Matrix Numeric package released!

2019-10-16 Thread e
The links in the docs are broken, e.g., [https://github.com/b3liever/manu//tree/devel/manu/qr.nim#L51](https://github.com/b3liever/manu//tree/devel/manu/qr.nim#L51) Note that there is a `devel` in the path, whereas your repo has no `devel` branch. Perhaps it should be `master` instead.

Re: Winning the Base64 benchmarks.

2019-10-16 Thread treeform
I am happy to take over the stdlib base64 API and make it stable if you guys agree with my proposals bellow: This is the place where stdlib does not handle errors: [https://github.com/nim-lang/Nim/blob/master/lib/pure/base64.nim#L123](https://github.com/nim-lang/Nim/blob/master/lib/pure/base64.n

Winning the Base64 benchmarks.

2019-10-16 Thread treeform
I was looking at Nim benchmarks here: [https://github.com/kostya/benchmarks#base64](https://github.com/kostya/benchmarks#base64) , and noticed that Nim's base64 is so far behind the simple C implementation. I took the plain C algorithm and ported it to Nim without using any crazy C's pointers e

Re: Winning the Base64 benchmarks.

2019-10-16 Thread Araq
> it has more features but does not handle errors? Since base64.nim says "unstable API" we could take your code... :-)

Re: Out of bounds error when use seq with emscripten

2019-10-16 Thread snjax
Also, I have the same issue with dicts. It seems dynamic memory allocating is broken.

Out of bounds error when use seq with emscripten

2019-10-16 Thread snjax
Here is the code import macros import random macro EMSCRIPTEN_KEEPALIVE*(someProc: untyped): typed = result = someProc result.addPragma(newIdentNode("exportc")) when defined(cpp): result.addPragma(newNimNode(nnkExprColonExpr).add( newId

Re: May we need one more assert(), like debugAssert()?

2019-10-16 Thread juancarlospaco
[assercho](https://github.com/juancarlospaco/nim-contra/blob/master/README.rst#assercho) is like `assert(conditionBool, errorString)` \+ `echo(Nim_Code)` \+ `printf(C_Code)`. It only works `when not defined(release) and not defined(danger)`. 🙂

Re: May we need one more assert(), like debugAssert()?

2019-10-16 Thread Araq
Compile with `-d:release --assertions:off`. Maybe we should turn them off in version 1.1...

May we need one more assert(), like debugAssert()?

2019-10-16 Thread Stefan_Salewski
In the past we had doAssert() for checks always enabled, and assert() which was disabled in release built. But with Nim 1.0 we generally avoid -d:danger, so assert() is generally enabled. For example in [https://github.com/StefanSalewski/RTree/blob/master/src/rtree.nim](https://github.com/Stefa

Re: images: simple way to read/write and manipulate images in nim?

2019-10-16 Thread Stefan_Salewski
Thanks for example. I have never found time to learn about gtk-pixbuf myself. Of course gintro can work on Windows as well, some Nim users have managed to install it. But of course most Windows users just don't want to use GTK.

Re: images: simple way to read/write and manipulate images in nim?

2019-10-16 Thread SolitudeSF
[https://github.com/SolitudeSF/imageman](https://github.com/SolitudeSF/imageman) its heavily wip but it works. if something doesnt work or functionality is missing, issue on github would be much appreciated.

Re: images: simple way to read/write and manipulate images in nim?

2019-10-16 Thread leorize
You'll have to deal with them for now, as the Nim ecosystem is not that big yet. It's not too hard to provide abstractions for cstrings, as Nim's string can be converted implicitly to them. If you're on Linux, `gdk-pixbuf` is a viable choice (bindings provided by gintro package). Here's a CLI t

Re: images: simple way to read/write and manipulate images in nim?

2019-10-16 Thread b3liever
Tried [https://github.com/treeform/flippy](https://github.com/treeform/flippy) ?

Re: Getter and Setter methods in Nim

2019-10-16 Thread leorize
You might also wants to do this the [Nim way](https://nim-lang.org/docs/manual.html#procedures-properties) proc age(a: Human): int = a.age proc `age=`(a: var Human, age: int) = a.age = age Frank.age = 99 # or `age=`(Frank, 99) echo Frank.age # or age(Frank

images: simple way to read/write and manipulate images in nim?

2019-10-16 Thread luntik2012
What is the most simple way to read image, flip or rotate (for example) and write back? tried many ways from here [https://forum.nim-lang.org/t/3056](https://forum.nim-lang.org/t/3056) half of libs are not working/legacy, the rest methods aren't pretty (operating with C pointers/strings etc.)

Re: Getter and Setter methods in Nim

2019-10-16 Thread cblake
Should probably also be mentioned/of interest to @torarinvik that Nim has fancier support for setters as well. See [https://nim-lang.org/docs/tut2.html#object-oriented-programming-properties](https://nim-lang.org/docs/tut2.html#object-oriented-programming-properties)

Re: Getter and Setter methods in Nim

2019-10-16 Thread torarinvik
Thank you!!! Perfect!!

Re: split does not seem to work properly

2019-10-16 Thread Araq
> On the contrary of what araq says, I never had problems of writing efficient > two line programs for such a task in a straightforward way. No, what I say is true, here is what Python does: "a b ".split(" ") ['a', '', '', 'b', ''] Run

Re: Getter and Setter methods in Nim

2019-10-16 Thread miran
proc getAge(a: Human): int = return a.age echo Frank.getAge() # or: getAge(Frank) Run .

Getter and Setter methods in Nim

2019-10-16 Thread torarinvik
Hi I have tried several times to create Getter and Setter methods in my project but failed. The code is this: type Human = ref object of RootObj age: int job: string height: int weight: int var Frank : Human proc getAge(a: Human, age: int): int = return a.age Frank = Human(age:

Re: Nim for enterprise software development

2019-10-16 Thread torarinvik
I am pretty sure you are right on all these things. It is a no-brainer for me, Nim is the obvious choice for me. Since Nim can compile to C, C++, js and Obj-c, the sky is the limit. But we need that Qt Studio integration, or at least more helpful manual/tutorials to get the Nim beginners like me