Compile-time string obfuscation

2021-03-22 Thread oyster
strenc does a good job. However I have met some strings without been encrypted if the code has several hundred line as Yardanico have stated. Is there any way to treat all string?

Generating code coverage with Nim 1.4.0

2021-03-22 Thread wendy1999
I am interested in this too[!](http://comunidad.eia.edu.co/foros/usuarios/fowid22767990ys-com/)

Manually initializing exception handling

2021-03-22 Thread vitreo12
That was what I assumed, thanks! For others that eventually might be having the same problem, I ended up wrapping C's `setjmp` and `longjmp` to implement a very basic custom `try` / `except` behavior.

Manually initializing exception handling

2021-03-22 Thread leorize
You should call `NimMain()`, which will initialize the GC (yes, `--gc:none`'s seq/string still uses the GC, even if the GC doesn't collect). Alternatively you can use `--gc:arc` or `--gc:orc` instead.

Manually initializing exception handling

2021-03-22 Thread vitreo12
I know that, but since it is coming from the exception handler, I thought maybe there was a way to use custom memory with that, by initializing it somehow.

Manually initializing exception handling

2021-03-22 Thread ynfle
I don't think you can use `seq` with `--gc:none`, it's a GC'ed type

Generating code coverage with Nim 1.4.0

2021-03-22 Thread arnetheduck
fwiw, `rr` gives the possibility to replay any program execution in a debugger: / - this gives access to all interactive features of gdb effectively, without requiring any changes to nim - breakpoints, memory inspection etc etc work out of the box. We've used it to succes

Manually initializing exception handling

2021-03-22 Thread vitreo12
Hello everyone! I am trying to use Nim's `try` / `raise` / `except` in a shared library, but it crashes. My hunch is that I must initialize it somehow. Is there a manual way to initialize it? Thanks!

array sample slower than indexing into rand(size-1)

2021-03-22 Thread cblake
Your state cannot start as all zero which is the default without init. See usage of the `random` module.

array sample slower than indexing into rand(size-1)

2021-03-22 Thread HJarausch
I've just added under `when isMainModule` var randState:Rand Run Then your code goes into an endless loop (even for `for trial in 1..1`)

array sample slower than indexing into rand(size-1)

2021-03-22 Thread cblake
This may get someone started on a PR or at least get @shirleyquirk a-benchmarkin': import random # Lemire2018 https://r-libre.teluq.ca/1437/ proc mul(a, b: uint64; hi, lo: var uint64) = # Store hi & low parts of full product a*b; # Note VM & JS branches need doi

I'd like to make a tiny contribution to stats.nim - how to?

2021-03-22 Thread Clonk
Fork the main Nim repository () and modify `lib/pure/stats.nim`, then create a PR against the devel branch.

Generics overload - which one is selected?

2021-03-22 Thread Yardanico
As I've mentioned in previous threads, please don't create so much threads in such a short amount of time. Your question is answered by

Generics overload - which one is selected?

2021-03-22 Thread HJarausch
How about this sentence (from the manual) `Likewise for generic matches the most specialized generic type (that still matches) is preferred:` For me that should prefer the `T:SomeInteger` version.

Generics overload - which one is selected?

2021-03-22 Thread HJarausch
The following example does not compile due to an `ambiguous call` error. I don't understand why, since the `T:SomeInteger` version fits better than the generic version proc foo[T](A:openArray[T]) = echo "Generic version" echo A proc foo[T:SomeInteger](A:ope

runnableExamples need random - what can I do?

2021-03-22 Thread Yardanico
Also, please try to not create as much forum threads as you do right now, we're here to offer help in the real-time chat (the Gitter bridge has been down for some time but you can always access the real-time chat from and #nim on Freenode).

I'd like to make a tiny contribution to stats.nim - how to?

2021-03-22 Thread Yardanico
There's only one place for such things - \- it contains the compiler, standard library, different tools, test suite, etc, etc...

runnableExamples need random - what can I do?

2021-03-22 Thread HJarausch
Thanks, I forgot to do the import under runnableExamples again.

runnableExamples need random - what can I do?

2021-03-22 Thread HJarausch
I'd like to put some example under `runnableExamples` but this fails since they need `random` which doesn't work at compile time. Is there an alternative?

Location of nimdoc.css ?

2021-03-22 Thread HJarausch
Running nim doc tries to open `/usr/doc/nimdoc.css` but nimdoc.css has been installed in `/opt/nimble/pkgs/compiler-1.4.4/doc/nimdoc.css` Where can I configure the location of nimdoc.css ?

I'd like to make a tiny contribution to stats.nim - how to?

2021-03-22 Thread HJarausch
I'm missing the **median** function in `stats.nim`. I have created one - based on `quickselect` \-- which I want to contribute. Where do I have to create a pull request?

runnableExamples need random - what can I do?

2021-03-22 Thread Yardanico
Not sure I understand your question - `runnableExamples` compile the examples like normal Nim programs and run them normally, so any Nim code that normally works will work in `runnableExamples`

runnableExamples need random - what can I do?

2021-03-22 Thread juancarlospaco
`import std/random` ?.

winim - onenote

2021-03-22 Thread mantielero
Thanks @adrianv, I am not compiling to 32bits. But I tried some Excel and Word examples and they work fine (compiled in the same way). I tried with `OneNote.Application.12`, `OneNote.Application.15` and `OneNote.Application`. All of them fail. `GetHierarchy` is still there because the python v

Search SSH library

2021-03-22 Thread yglukhov
To name a few: * *

winim - onenote

2021-03-22 Thread adrianv
some guesses: * are you compiling to 32bit ? - or * in your python example you wrote OneNote.Application.12 not OneNote.Application.15, maybe GetHierarchy was removed * you are not using the return result ! try `var res = obj.GetHierarchy("", 2)`

Search SSH library

2021-03-22 Thread demotomohiro
You can use [osproc](https://nim-lang.org/docs/osproc.html) module to run ssh. import osproc var p = startProcess("ssh", args = ["sshoptions", "myname@hostname", "command you want to run on the server"], options = {poUsePath, poParentStreams}) doAssert p.waitForExit ==

array sample slower than indexing into rand(size-1)

2021-03-22 Thread cblake
Also, for what it's worth, I think `proc rand*(r: var Rand; max Natural)` could be profitably upgraded/sped up with the techniques of [Lemire 2018](https://r-libre.teluq.ca/1437/). But you can also just use `random.next()` and do that on your own. { It would also be unsurprising if @mratsim had

Nimview - a lightweight UI helper

2021-03-22 Thread marcomq
The security issues weren't about webview but about webservers in general. As soon as you create a webserver, even on localhost, you should care about authentication, xss, xsrf and all the other stuff. Most of those are easy to implement with known frameworks. You can check owasp.org for the top

Search SSH library

2021-03-22 Thread dearikomaru
I have an issue, how to connect ssh and run command using nim? why using ssh? cz i want to config a router using exe. so i need ssh connect. help pls. thanks.

winim - onenote

2021-03-22 Thread mantielero
I raised an issue [here](https://github.com/khchen/winim/issues/67), but just in case somebody knows here. Do you know how to automate some tasks in OneNote using `winim`? It looks like a python's minimal example goes like: import win32com.client onObj = win32com.client.gencac

array sample slower than indexing into rand(size-1)

2021-03-22 Thread cblake
Note that if you look at the implementation for `proc rand*(r: var Rand; max: Natural)`, it is possible to do this more quickly in a loop if `max` does not change in said loop. The `mod` is constant over the loop and `randMax mod Ui(max)` can be computed just once instead of every function call.

Nimview - a lightweight UI helper

2021-03-22 Thread JPLRouge
Hello, I don't understand webview, you sound like it's not secure? An application made with webview bind with web-socket is just like a program which understands its internal ui, GTK / LIBUI etc ... except that the part which is in html / javascript ... an example with [Nim](https://github.com/

Norm & Functions

2021-03-22 Thread moigagoo
> is there a way to attach an "on delete cascade" condition to a column > definintion You're right, there is no way to do that now. It shouldn't be hard to implement though. I used to have in Norm 1.0, I think.

array sample slower than indexing into rand(size-1)

2021-03-22 Thread alexeypetrushin
Why not use `sum += xs[rand(xs_len - 1)]` instead of `sum += xs[rand(int.high) mod size]`?

Documentation: Method Call Synatx and Inverse Index

2021-03-22 Thread alexeypetrushin
Not what you want, but still useful doc / For convenient usage you may need to change preferences and disable all other APIs except of Nim

Norm & Functions

2021-03-22 Thread nealie
Yes, this is precisely what I want to do (the AVG example that is). I had thought I could just run the query myself, but wondered if the ORM would be able to do it for me. I definitely didn't want to have to calculate it all myself as that would be slow and wasteful. OK, my next question is: is