[https://github.com/bung87/nimhttpd](https://github.com/bung87/nimhttpd) you
can try my fork version httpd support serve file through file system, memory
zip, file zip.
i've build one, but it needs some love (especially the part where ip addresses
are queried from the os)
[https://github.com/enthus1ast/nimAsyncHttpTools/blob/master/src/simplehttpserver.nim](https://github.com/enthus1ast/nimAsyncHttpTools/blob/master/src/simplehttpserver.nim)
Using python, one can trivially fire off an HTTP server to serve the files from
the current directory using:
python3 -m http.server
Run
Is there an equivalent one-liner for Nim?
The stream module seems strange to me. When I compile my avi demuxer with -d:
release it throws IO errors, but not without: The same file is read in both
release and debug mode.
This is the part in which the error occurs:
proc read_video_frame*(avi: Avi; vidbuf: ptr UncheckedArray
Here's an how I set things up:
[https://github.com/russpowers/nim-debug-example](https://github.com/russpowers/nim-debug-example)
It uses python to customize the gdb output, which generally works pretty well.
You still get a lot of junk variables, but the ones you care about are usually
there.
*
[https://www.overleaf.com/read/svnxffsjvscy](https://www.overleaf.com/read/svnxffsjvscy)
So my PR was merged -
[https://github.com/github/linguist/pull/4866](https://github.com/github/linguist/pull/4866),
but then reverted
([https://github.com/github/linguist/pull/4871](https://github.com/github/linguist/pull/4871))
because turns out some other language (Dafny) got a really similar
I think yellow is the way to go, just gotta find a different shade that passes
the proximity test. Maybe more orange would do.
And just to close out the example more fully for @chalybeum, since he said he
was a beginning programmer, he could probably start from the code below (after
a `nimble install 'cligen@#head'`) to do whatever it was he wanted to six
months ago if he even stuck with programming, with Nim and/or thi
Only Rust has memory safe zero-copy collection that can be stored in a type
(their slice type).
C++ and D can somewhat emulate that with ranges but I don't thing they have
proper lifetime/escape analysis as you would need a borrow checker for that.
Nim has openarray, but it cannot be stored, yo
Nim sets and C flags have a different byte representation, use another type to
distinguish between both.
Example
[https://github.com/numforge/laser/blob/d1e6ae61/laser/photon_jit/photon_osalloc.nim#L50-L61](https://github.com/numforge/laser/blob/d1e6ae61/laser/photon_jit/photon_osalloc.nim#L50-L
> Note that enums with holes may become deprecated in future
That would be silly IMHO — there are so many uses for enums that are
non-consecutive. It seems like Nim's idea of enums is primarily "named ordered
values you can make a set out of", and assigning specific numbers to them is
considere
I put various things that "might be useful" for Unix CLI utilities under
`cligen/` so client code can just have `cligen` as a leaf/sole dependency.
Directory tree recursion fits that pattern, and stdlib `walkDir*` never seemed
quite right to me. There is already `cligen/posixUt.recEntries`, for
Wow!.. why is it in **cligen** though? It looks like it can be a separate
`find`-competition package :)
I have reported this in issue
[https://github.com/nim-lang/Nim/issues/14473](https://github.com/nim-lang/Nim/issues/14473)
. Thanks for providing that minimal example.
Yes, that is well known, I discussed that behaviour with Araq 3 years ago
related to gintro. I then added dummy zero flags when the gtk enums started not
with 0. Note that enums with wholes may become deprecated in future, so we may
have to add even dummy values for missing values. Araq sometime
> Wrap the ptr UncheckedArray, len pair in an object
I could do that, but this object would be a second-class citizen since it's
neither an array nor seq nor string. I could implement `[]` and `len`, but it
still wouldn't work with e.g. `sequtils`, right? I guess what I'm saying is
that Nim doe
I have seen a similar issue on nim devel too. I am trying to create a
reproducible example for that.
I also see runnableExamples trying to get executed from sequtils.. My Nim
module does import sequtils, but there are no runnableExamples in it.
Also, I think this issue happens when I have \--pa
This happens on nim devel (the version should be 1.3.5). I see that you are
using nim stable 1.2.0.
As part of bridging a set of bit-masks in a C API, I declared an enum and a set:
type
Flag = enum
A = 4
B = 6
# ... more flags...
Flags = set[Flag]
Run
After about half an hour of debugging an mysterious EINVAL return value from
the
Of course, that doesn't control recursive descent which was @chalybeum's
driving use case but you did use a smiley. :-)
Based on possible broader interest and a general trend lately of trying to be
less abstract, I just added a template-based tree iteration to
`cligen/dents.nim`:
[https://gith
hmm... I did not occured error.
My environment is here.
$ nim --version
Nim Compiler Version 1.2.0 [Linux: amd64]
Compiled at 2020-04-03
Copyright (c) 2006-2020 by Andreas Rumpf
active boot switches: -d:release
Run
⟩ cat /etc/os-release
Here a mini example which displays this error on nim-devel :
#cxtimeb.nim
import sequtils
template doit():untyped =
## doit
## return output only
toSeq([1,2,3,4,5])
echo doit()
Run
Output ok :
... but walkPattern() does take a glob pattern. :)
FYI,
[thiscall](https://github.com/nim-lang/Nim/commit/00fa7a57476ed6fe81fb2d9171ba902fad9b83d5)
just get merged into dev branch
There are no runnableExamples in my module.
The module imports sequtils
The only way I found to circumvent this error in docgen is to add following line
in my module :
export sequtils
Run
I think this should not be required.
I want to watch code of cxtimeb.nim.
After most recent improvements to doc generation I see this error running nim
doc :
/home/lxuser/.cache/nim/cxtimeb_d/runnableExamples/cxtimeb_examples1.nim(15,
12) Error: undeclared identifier: 'toSeq'
[runnableExamples] failed: generated file:
'/home/lxuser/.cache/nim/cxtime
Is there `import sequtils` in runnableExamples?
runnableExamples:
import sequtils
echo toSeq(1..10)
Run
@chalybeum ..the feature being mentioned seems to be the `FilterDescend`
predicate function of the referenced package. You would just load up a Nim
`HashSet` from `sets` with to be skipped paths and pass some predicate like
`path notin blacklist`, with `blacklist` probably being a captured closu
How about more "reactive" observers ?
[https://gist.github.com/PixeyeHQ/fbec35b25b667b847b4eac413a8539a5](https://gist.github.com/PixeyeHQ/fbec35b25b667b847b4eac413a8539a5)
The idea is to subscribe for variable change. The proc you register will
trigger every time this variable changes.
This proc from system you will need:
proc toOpenArray*[T](x: ptr UncheckedArray[T]; first, last: int):
openArray[T] {.
magic: "Slice".}
Run
> I'd like to use nim to execute something like "C:UsersMeAppDataLocalThe
> AppTheApp.exe --uninstall --silent" or "bob" for short
did you mean:
"C:UsersMeAppDataLocalThe App\TheApp.exe --uninstall --silent"
Run
?
(you were missing the )
> execShellCmd(bob)
I can do this but it's not convenient to have all the subscribers be of the
same class
Wrap the ptr UncheckedArray, len pair in an object and write custom =destroy
and = procs. (= would be `proc `=`(self: var Foo; other: Foo) {.error.}` since
you want to avoid copies. The destructor frees the memory using whatever
function is provided by the C library.
35 matches
Mail list logo