Re: Where can I deploy a Nim web application? Is there a "NimAnywhere" yet?

2020-04-09 Thread tedlavarias
Thanks! I'll look into it!

Re: Where can I deploy a Nim web application? Is there a "NimAnywhere" yet?

2020-04-09 Thread enthus1ast
i usualy got for * nginx as reverse proxy * "nim-templates" whith plain asynchttpserver with a small "path matching" library, since i find it easier to incoperate asynchttpserver into bigger applications than jester (for example in the past it was not possible to use websocket with jester s

Re: Where can I deploy a Nim web application? Is there a "NimAnywhere" yet?

2020-04-09 Thread moigagoo
For frontend, Karax is the way to go. For backend, there are at least Jester and Rosencrantz. There's no Nim-sponsored hosting solution, you can pick anyone you like. I used to use Zeit when they offered Docker deployments. People say Heroku is nice.s

Re: if error

2020-04-09 Thread Stefan_Salewski
When you use if as an expression like var res = if cond: x else: y Run the x and y have to have the same type. Seems to be obvious in a statically type language, but I think I will add a note in my book.

Where can I deploy a Nim web application? Is there a "NimAnywhere" yet?

2020-04-09 Thread tedlavarias
I've got a few ideas for some web applications that I want to deploy in Nim. How are Nim developers doing it now? Jester? Karax? What about hosting?

if error

2020-04-09 Thread tbutton
type Cell = object x,y:int let Size = 2345 #... for i in countup(1,Map.high,2): for j in countup(1, Map[i].high,2): var direction = random.sample( [if j+1 > 0 and j+1 < Size: Cell(x:j+1, y:i) else: NaN, if i+1 > 0 and i+1 < Size: Cell(x:j,

Re: Another state of generating Android APK thread...

2020-04-09 Thread GordonBGood
@glukhov: Thanks for the advice on compiling as a static library; looks like I should give it a try for these repos. Also, thanks for the pointer on using ANDROID_HOME to find the location of the Android NDK. However, it isn't automatically set on my Windows machines with Android Studio instal

Re: Creating dynamic libraries as nimble package

2020-04-09 Thread rayman22201
cool script. Thanks for sharing. > I would love to have a nim switch that will generate platform specific linker > options to load dynlibs from binary's location, like on Windows. This could > be considered as default behavior for nim programs. This is a bad ida IMO. The behavior is different o

Re: Terminal keyboard and mouse

2020-04-09 Thread JPLRouge
#enthus1ast You are free to use it, your idea is not bad I just finished (finished) on the Linux side ;)

Re: Newbie - gui based application and secondary event loop

2020-04-09 Thread max3d
thank you. Indeed I do the network stuff (parsing, filtering downloads etc) in a separate program, using async/await, and after the processing I send the gui relevant info to the GUI app via another socket. I'd prefer to listen also this "GUI" socket in a thread, that's what I do in Python, bu

Re: Terminal keyboard and mouse

2020-04-09 Thread enthus1ast
yeah the UTF-8 input fix is still only in my head ...

Re: Nim programming book for kids

2020-04-09 Thread enthus1ast
We also should implement some programming learning games like "Turtle".

Re: Newbie - gui based application and secondary event loop

2020-04-09 Thread enthus1ast
you must poll with a very small timeout (eg. 20-50 miliseconds), while it works i still recommend to do the network stuff in another thread and keep the gui thread for gui stuff. The gui will feel much more responsive then.

Re: Newbie - gui based application and secondary event loop

2020-04-09 Thread max3d
all right! thanks a lot for the tips. I'll give a look at Araq's code and play around with poll()

Re: Creating dynamic libraries as nimble package

2020-04-09 Thread leorize
> I would love to have a nim switch that will generate platform specific linker > options to load dynlibs from binary's location, like on Windows. This could > be considered as default behavior for nim programs. Depends on who you ask, using this as the default behavior have possible security i

Re: Creating dynamic libraries as nimble package

2020-04-09 Thread federico3
A benefit of shared/dynamic libraries is that they can receive security updates from the OS without having to rebuild and deploy all impacted applications. It's crucial in many scenarios.

Re: Resolving environment variables in a string

2020-04-09 Thread squattingmonk
Thanks, Araq! That's exactly what I needed.

Re: Newbie - gui based application and secondary event loop

2020-04-09 Thread Araq
For an example how I did see [https://github.com/nim-lang/Nim/blob/devel/tools/downloader.nim](https://github.com/nim-lang/Nim/blob/devel/tools/downloader.nim) Esp this section: pollingMainLoop((proc (timeout: int) = if hasPendingOperations(): asyncdispatch.poll(timeout)), 1

Re: Resolving environment variables in a string

2020-04-09 Thread Araq
`import os, strtabs proc envTable: StringTableRef = result = newStringTable(modeCaseSensitive) for key, value in envPairs(): result[key] = value let envs = envTable() path = paramStr(1) echo(`%`(path, envs, {useEmpty})) # or simply echo(`%`(path, newStringTable(modeCaseSensitive), {useEnvironme

Re: Newbie - gui based application and secondary event loop

2020-04-09 Thread leorize
> receiving input from a socket requires a runForever() `runForever()` is just an infinite while loop running `poll()`. Just make sure to run `poll()` along your GUI event loop and you should be fine :)

Newbie - gui based application and secondary event loop

2020-04-09 Thread max3d
Hi, semi-beginner with NIM, like it a lot but still need to get used to rather new way, for me, to structure the programs. I'm attempting to port to NIM an application written in Python. The application receives inputs both from a GUI and from a socket whose messages are used to update the GUI s

Re: Another state of generating Android APK thread...

2020-04-09 Thread yglukhov
> also couldn't one use a dynamic library as easily as a static one? By building static lib we offload the final linking to gradle. This gives an advantage to use non-nim dependencies more freely. E.g. you can pull in third-party native android libs in whatever gradle-compatible form they are d

Re: Web Scraping

2020-04-09 Thread Yardanico
q is cool but I like [https://github.com/GULPF/nimquery](https://github.com/GULPF/nimquery) more :)

Re: High to Low on sequence not working?

2020-04-09 Thread wiremoons
Thanks Vindaar. I saw `countup` and `countdown` in the Nim documents, but (wrongly) thought using `high` and `low` would provide the same. Especially as the `low..high` works fine without the use of the extra `countup`. Thanks for the help and the example correct code usage.

Re: High to Low on sequence not working?

2020-04-09 Thread Vindaar
The reason it doesn't work is that N .. M in the context of a for loop implicitly calls countup. You need to explicitly call countdown: for i in countdown(high(seqStr), low(seqStr)): echo seqStr[i] Run

High to Low on sequence not working?

2020-04-09 Thread wiremoons
Hi I was trying to reverse a string using a sequence and _high_ to _low_ iteration, but it does not output anything for some reason. When using the same iteration going from _low_ to _high_ it works as expect. Not sure what I am doing wrong - is this not supposed to work, or am I doing somethi

Re: Nim programming book for kids

2020-04-09 Thread JPLRouge
J'aime beaucoup

Re: Web Scraping

2020-04-09 Thread enthus1ast
Some days ago i tried to scrape data from a game trading site and build a small cookie handling "nim browser" (unfortunately the site was behind cloudflares anti crawling engine und behaved funny). import httpClient, asyncdispatch, httpclient, strtabs, uri, strformat, strutils, os

Creating dynamic libraries as nimble package

2020-04-09 Thread cmc
Hello, all! I created a command line tool that uses dynamic libraries to do different kinds of text processing so you can create a processor in your own tree. Getting nimble to package it was workable but kind of nontrivial so I thought I'd share. I've got a plugin folder with .nimf files that

Re: Web Scraping

2020-04-09 Thread ThomasTJdev
I have a small repo here, [https://github.com/ThomasTJdev/nim_nordnet_api](https://github.com/ThomasTJdev/nim_nordnet_api), where I scrape stock information, convert it to JSON and send it with MQTT. It uses the nimble package [q](https://github.com/OpenSystemsLab/q.nim) for HTML querying. With