Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Mar 03 2017 15:52
    @dom96 banned @Octopoda7
  • Feb 12 2017 23:57
    @dom96 banned @zzz125
  • Dec 23 2016 19:43
    @dom96 banned @Izrab
From IRC (bridge bot)
@FromIRC
<FromDiscord> <Lunar> I noticed that you split up creating the variables onto multiple lines
<FromDiscord> <Lunar> That makes more sense, not going to lie
<r3c> I was wondering, can you serve static files with httpserver? No Jester
<FromDiscord> <treeform> then ,? yeah
<FromDiscord> <treeform> r3c, yes I do that for work. I don't use Jester. But I do use httpserver.
<r3c> Is it complicated?
<FromDiscord> <treeform> let me look
<FromDiscord> <treeform> I don't remmber it being
<r3c> I had crazy idea writing framework from scratch :⁠P
<r3c> *have
<FromDiscord> <treeform> Hmm I was wrong I don't do that. It looks dead easy though. I server static files through nginx. I use nginx because of SSL and because its battle hardened vs attacks. So in nginx i split traffic between static files and dynamic nim stuff.
<r3c> interesting
<FromDiscord> <Lunar> Is it possible to make an async variable?
<FromDiscord> <treeform> On high volume sites I even split between a static domain and "dynamic domain". Well my API is a single websocket .. I don't like REST.
From IRC (bridge bot)
@FromIRC
<FromDiscord> <treeform> @Lunar I don't think so. Once you have async stuff you get the race conditions and need locking kind of ...
<FromDiscord> <treeform> @Lunar I don't think so. Once you have async stuff you get the race conditions and need locking kind of ...
<r3c> How does jester serve static files?
<FromDiscord> <treeform> @r3c I think the source for it is: https://github.com/dom96/jester/blob/dc74a797ebca15e4f1b46a7f2e1f4e733b1c5ee2/jester.nim#L166
<FromDiscord> <treeform> @r3c, server static files is easy, get the URL path, see if the file is there, figure out the mime-type of the file (usually by extension) send the header, then write size, then write the file body.
<FromDiscord> <treeform> Jester does extra by also handing caching which I what most of that code is, caching and error handling.
<r3c> oh yes :⁠) tnx
<FromDiscord> <treeform> I recommend going nginx route to serve static files. nginx is a nice shield to hide behind.
From IRC (bridge bot)
@FromIRC
<FromDiscord> <treeform> really easy to setup SSL with LetsEncrypt, which modern web basically requires.
<r3c> ill try both, tnx @treeform
retromaniac
@theretromaniac

Hello everyone, i start recently to play with Nim and today i am playing with cli. I have this code:

for kind, key, val in getopt():
    case kind:
    of cmdEnd: doAssert(false)
    of cmdShortOption, cmdLongOption:
      case key:
      of "v", "version": echo VERSION
      of "h", "help": echo "This is the help section"
      else:
        echo "Not exist option"

but in the short option when i type:

$ cli -version

i get this as a result:


0.1.0
This option does not exist
This option does not exist
This option does not exist
This option does not exist
This option does not exist
This option does not exist

Any help?

From IRC (bridge bot)
@FromIRC
<r3c> change the for loop with while loop
<r3c> like in the example https://nim-lang.org/docs/parseopt.html
retromaniac
@theretromaniac
Thank you
i fix it with for loop
just have to add
quit(0)
under case of
From IRC (bridge bot)
@FromIRC
<FromDiscord> <Kiloneie> Why does fmReadWrite clear my file ?
<FromDiscord> <Kiloneie> i used a for loop using the lines iterator and my file is empty after running it
From IRC (bridge bot)
@FromIRC
<FromDiscord> <garageagle> Is there something that I can do like python's print("> " end="")?
<disruptek> garageagle: if you mean to write without a newline, you could stdout.write("some text") or stdmsg().write("other text")
From IRC (bridge bot)
@FromIRC
<ball2> q
Matt Haggard
@iffy
Is this error an indication of running out of memory? http://ix.io/1Ycm
@theretromaniac also check out https://nimble.directory/pkg/argparse
dawkot
@dawkot
image.png
How do I prevent this? (VSCode)
From IRC (bridge bot)
@FromIRC
<disruptek> when i've run out of memory, i get an "Out of memory" error.
<disruptek> admittedly, it doesn't happen often on 64gig...
<disruptek> i made an error and it doesn't matter, but i can't figure out how this line compiles successfully: https://github.com/disruptek/golden/blob/master/src/golden/running.nim#L59
liuxiaodong
@gogolxdong
if body[i].kind == xnText and body[i].innerText != " ":
to filter the empty text element of XmlNode traverse
From IRC (bridge bot)
@FromIRC
<leorize> I wouldn't count of checking for "one space"
<leorize> use stripWhitespace() to deal with such cases
<leorize> then you can check for "not empty"
liuxiaodong
@gogolxdong
yes, good tip.
From IRC (bridge bot)
@FromIRC
<nc-x> @dawkot: https://github.com/nim-lang/Nim/issues/11679#issuecomment-518188355 this might fix the issue. Or a PR to nim-vscode plugin so that it does not spawn nimsuggest for every file would work. which would be easier if leorize fulfills his promise of improving nimsuggest project detection :⁠)