Re: Sending emails from Nim using SMTP

2020-06-22 Thread enthus1ast
You can try to use my library: [https://github.com/enthus1ast/nimMime](https://github.com/enthus1ast/nimMime) it could be that you need to patch one or two things (pr welcome ;))

Re: How to load multiple shared libraries?

2020-06-26 Thread enthus1ast
As far as I understand dylib this specifies in which shared library the function is located. What happenes when you just choose the correct library?

Re: Problem sending binary file by socket never ending.

2020-06-27 Thread enthus1ast
Try client.recv(fileSize)

Any SSL sockets example?

2019-06-02 Thread enthus1ast
i've created a little example, with asyncnet and self signed keys: [https://github.com/enthus1ast/nimSslExample](https://github.com/enthus1ast/nimSslExample)

Re: Any SSL sockets example?

2019-06-04 Thread enthus1ast
@treeform it seems [https://github.com/niv/websocket.nim](https://github.com/niv/websocket.nim) also have wss support.

Re: Nerve: RPC framework for Nim

2019-06-21 Thread enthus1ast
can the server rpc call the client?

Re: Tables with keys of different types

2019-06-24 Thread enthus1ast
What you also could do (since we're talking about the _key_ not the _value_ right?) write a hash proc for each of your keys and let the table use that hash as its key. [https://nim-lang.org/docs/hashes.html](https://nim-lang.org/docs/hashes.html)

Re: Nim and DLLs?

2019-06-27 Thread enthus1ast
There where issues when the rtl was dynamically linked. But i've not tried it recently.

Re: Giving my library access to types in the file that import it

2019-06-27 Thread enthus1ast
Maybe i do not understand correctly but for me it "just works" coolLib.nim proc abs*(x: int): float = return 0.1 proc abs*(x: float): float = return 0.2 proc coolProc*[T](x: T): T = let a = abs(x) echo a Run coolMain.nim

Re: Read lines from file thats in a variable

2019-07-31 Thread enthus1ast
Why you read it in completely in the first place when you want to operate on lines? When you mystring.split('n') you double the amounth of memory used. For small files this seems ok but for larger ones your programm could explode. It's much better to use the splitLines iterator as Stefan_Salewsk

Re: Nested sequences in Nim, how to?

2019-08-14 Thread enthus1ast
what might work is if you have a seq[tuple[elemType: EnumOfElem, ref: refToData]] Run then cast it based on the elemType. But not tested and might have other issues i'm not aware of right now.

javascript cstring contains "%"

2019-09-21 Thread enthus1ast
this simple beginning of a c/js form validator produces strange strings on the js platform import strutils type Error* {.exportc.} = enum NoError, InvalidError Valid* {.exportc.} = object value: cstring error: cstring errorCode: Error

Re: javascript cstring contains "%"

2019-09-21 Thread enthus1ast
ok, i've pulled in the latest changes now it works.

Re: Example for using websocket with protobuf?

2019-10-01 Thread enthus1ast
I cannot say anything about protobuf, never used it, but your usage of nim's async is wrong: you could waitFor futures, but every waitFor drives its own async poll loop. After the waitFor there is no async poll loop any more. waitFor is usefull when you want to call async procs from non async c

code to unpack (msgpack) and "cast" object to

2019-10-12 Thread enthus1ast
I receive different types of object from network, packed as msgpack. Now i need a construct that creates objects of the given type, to work with them further. I'm struggeling to create a proc/template that does this in one call. My goal is to get something like this: var msgObj = u

we need better support of serialized objects downcast in stdlib

2019-10-14 Thread enthus1ast
The problem is that every serializer that i've tried (except json), cannot downcast a serialized message to its base type. json, the only serializer that does the job (but only on non ref types): import json type MsgBase* = object of RootObj version*: byte

Some questions about cligen

2019-10-27 Thread enthus1ast
cligen ([https://github.com/c-blake/cligen/](https://github.com/c-blake/cligen/)) how can i do: ./proc call "1. positional required" "2. positional required" "3. positional optional" # eg: ./proc call "*" "cmd.ping" # eg: ./proc call "*" "os.shell" "ifconfig" --json

Re: read number from ascii (text) file: scanf-like functionality?

2019-11-12 Thread enthus1ast
They're in strutils: parseInt(str) parseFloat(str) etc. To get a str representation use $

Re: read number from ascii (text) file: scanf-like functionality?

2019-11-12 Thread enthus1ast
They're in strutils: parseInt(str) parseFloat(str) etc. To get a str representation use $

Re: Running several processes asynchronously?

2019-11-20 Thread enthus1ast
also crashes for me. It seems that waitForExit is buggy. Maybe open a bug report in asynctools. I've done this as well in the past, but it is a _SUPER HACKY_ solution (but it's still working for me, in a non mission critical application). proc callAsync*(cmd: string, arguments: seq

Re: when to use 'ref object' vs plain 'object'

2019-11-20 Thread enthus1ast
ref is also needed for async: is not working: import asyncdispatch type Foo = object num: int proc dostuff(foo: var Foo): Future[void] {.async.} = foo.num = 0 return var foo = Foo() waitFor foo.dostuff() #Error: 'foo' is of t

Re: when to use 'ref object' vs plain 'object'

2019-11-24 Thread enthus1ast
thank you i'll try that.

Re: Problem using sometable.keys() in this case

2019-11-25 Thread enthus1ast
keys is an iterator so either iterate over it with a for loop or use toSeq from the sequtils module

Re: recvmsg on AsyncSocket

2019-11-25 Thread enthus1ast
I'am not sure what you want to do but, is a file descriptor just an integer? The you could just send an integer. If you want to send a struct/nim object, you can try: await mysock.send(addr myobj, myobj.sizeof) Run

Re: onSignal closure memory violation

2019-11-25 Thread enthus1ast
Try this: import os from posix import onSignal, SIGINT type App = object template cleanup(app: App) = discard proc start*(app: App) = onSignal(SIGINT): echo "Exiting: ", sig app.cleanup while true:

Re: asyncftpclient troubles

2019-11-25 Thread enthus1ast
You have to specify a password for anonymous login. This works for me: import asyncdispatch, asyncftpclient proc main() {.async.} = echo "trying to connect..." var ftp = new_async_ftp_client("speedtest.tele2.net", user = "anonymous", pass = "in ancients

Re: "out of memory" when creating new Thread inside sharedTable lock

2019-11-25 Thread enthus1ast
your example works for me (on win10, Nim Compiler Version 1.1.0 [Windows: amd64])

Re: Pragmas Above Procs

2019-11-26 Thread enthus1ast
how would you then write inline pragmas? like: foo(callback = proc() {.closure, gcsafe.} = echo "baa") Run

Re: Pragmas Above Procs

2019-11-26 Thread enthus1ast
I must say I do not see the benefit. the pragma above the proc reminds me of this special python syntax, though

Re: I want to launch services with Apache and jester

2019-11-27 Thread enthus1ast
is the js file "readable by others" like dom96 stated: "Note: Jester will only serve files, that are readable by others. On Unix/Linux you can ensure this with chmod o+r ./public/css/style.css."

Re: onSignal closure memory violation

2019-11-27 Thread enthus1ast
type App = ref object Run should also work

Re: I want to launch services with Apache and jester

2019-11-28 Thread enthus1ast
Ok then I think you must use ProxyMatch instead of ProxyPass Or maybe this works as well RewriteRule ^/(*) http://localhost:8000/$1 [P,L] Run

Re: Error running nim hello world from snap installation

2019-12-03 Thread enthus1ast
Looks like nimble is out of date. I would try to update nimble or nim tools in general

Re: Recommended GUI library?

2019-12-09 Thread enthus1ast
The best/most advanced gui library for nim is afaik gintro (gtk). I can also recommend web view for smaller things.

Re: TXT DNS lookup

2019-12-09 Thread enthus1ast
There is also cheatfate's asyncdns in asynctools repo. But have not tried it lately.

Re: How to properly use Proxies in Nim

2019-12-11 Thread enthus1ast
Just a guess but maybe you have to compile with -d:ssl

Re: How to use table in a type ?

2019-12-21 Thread enthus1ast
`import tables type Person = ref object name: string age: int jobSal: Table[string, int] # tell me how to declare proc newPerson() : Person = result = new Person result.name = "A Name" result.age = 50 result.jobSal = {"A Job": 35000}.toTable # And tell me how to initialize it. proc print(me : Pe

Re: How to use table in a type ?

2019-12-21 Thread enthus1ast
yeah i must say the table examples are a little bit strange. Here is some basic usage import tables var table: Table[string, string] # simple table with string as key, and string as values ## Set entries, examples table = {"key": "value", "key2": "value2"}.toTa

nimble always install @#head for url

2020-01-01 Thread enthus1ast
how can i force nimble to always install the newest version of a repository when it was specified with an url?: requires "https://url/repo.git@#head"; # nor requires "https://url/repo.git#head"; Run works properly.

Re: nimble always install @#head for url

2020-01-02 Thread enthus1ast
.code0.xyz/sn0re/nimAsyncHttpTools.git #head" requires "https://github.com/enthus1ast/flatdb #head" Run $ nimble install Run [david@eb quark]$ nimble install Error: Could not read package info file in /home/david/quar

Re: nimble always install @#head for url

2020-01-03 Thread enthus1ast
done: [https://github.com/nim-lang/nimble/issues/759](https://github.com/nim-lang/nimble/issues/759)

Re: Get local ip address

2020-01-11 Thread enthus1ast
or with psutils module ( [https://github.com/johnscillieri/psutil-nim](https://github.com/johnscillieri/psutil-nim) ) import psutil echo net_if_addrs() Run

Re: How to create and manage a http users sessions?

2020-01-11 Thread enthus1ast
I would create a browser cookie with a session id and also store the session id somewhere on the server (database, memory, etc) then on every request check if the transmitted session id is still in your datastore. To invalidate session keys you could register a function with asyncCheck that loo

Re: How to create and manage a http users sessions?

2020-01-12 Thread enthus1ast
well, as i've already written, i would not use globals to store sessions. I would create a session object that holds all your data and pass it to every procedure. so feed the session table into your http callback: import asynchttpserver, asyncdispatch, tables type

Re: How to upload large files efficiently and quickly with Jester?

2020-01-18 Thread enthus1ast
[https://github.com/mrhdias/StatorHTTPServer](https://github.com/mrhdias/StatorHTTPServer) can do this. It could be that [https://github.com/andreaferretti/rosencrantz](https://github.com/andreaferretti/rosencrantz) can do this as well, but never tried this with rosencrantz

How to add a long usage string to cligen's help?

2020-01-18 Thread enthus1ast
How can i add a large documentation string to cligen's help output?

Re: How to add a long usage string to cligen's help?

2020-01-18 Thread enthus1ast
Thank you cblake i got it to work now! dispatch(cli, doc = """ Foo baa """) Run before i tried: const help = "some help" dispatch(cli, doc = help) Run without noticing that not the content of the help string was printed

Re: How to add a long usage string to cligen's help?

2020-01-18 Thread enthus1ast
done a PR but not sure if this has unwanted side effects

Re: How to upload large files efficiently and quickly with Jester?

2020-01-19 Thread enthus1ast
thank you @mashingan for this snippet, i did not know that jester can websocket nowadays. And the slice thing is a nice trick as well.

Re: How to upload large files efficiently and quickly with Jester?

2020-01-19 Thread enthus1ast
@mashingan it seems there is a offset error in the code (files are not identically but shifted by some bytes at certain offsets)

Re: Discord server improvements

2020-01-22 Thread enthus1ast
IRC is far more accessible than discord. I would vote for bridging everything, maybe create some more IRC channels then?

Karax seems to only update button when text changes. Even other onclick should be bound.

2020-01-25 Thread enthus1ast
I have a strange issue with karax. When the text in the buttons are the same (so both are "FOO") then i can not toggle back and forth. When the text in one of them is changed, lets say = "BAA" Run than toggle works. Is this a bug? include karax / prelude

Re: Karax seems to only update button when text changes. Even other onclick should be bound.

2020-01-25 Thread enthus1ast
I can force redraw with: # ... of 0: text "Hello World!" button(onclick = () => (comp.menu = 1; avoidDomDiffing())): text "FOO" of 1: text "Other World!" button(onclick = () => (comp.menu = 0; avoidDomDiffing())):

Added Mouse support to illwill (cli) + widget library

2020-01-30 Thread enthus1ast
e) textbox We've tried to still give you this "immediate mode" feeling. Please try and report if its working for you (or not :) ). If it works well, i'll create a pull request to merge upstream. * Illwill with mouse support fork: [https://github.com/enthus1ast/illwill]

Re: Added Mouse support to illwill (cli) + widget library

2020-01-30 Thread enthus1ast
German umlaute (öäüß) are also not supported :). And the funny thing is, on windows typing them even crashes cmd.exe.

Re: Jester: How to serve static files in production (Heroku)?

2020-02-01 Thread enthus1ast
in a production app i would let the real webserver serve all the public/static files. i've never used heroku, but i would assume you have some kind of webserver configuration (.htaccess ?). The best option imho would be to change the webserverconfig to share your public files.

Re: Extended routes that return json doesn't compile

2020-02-07 Thread enthus1ast
export json Run in the api.nim also works

Re: FOSDEM 2020 - Brussels February 1st & 2nd

2020-02-12 Thread enthus1ast
is @mratsim 's video also coming?

Re: How to use pointer to mmaped file?

2020-02-20 Thread enthus1ast
You must cast the pointer to a datatype.

Re: debug-only echo

2020-02-21 Thread enthus1ast
I actually have modularized this (and some already made fun of the "smallest module in nimble" ;) ) [https://github.com/enthus1ast/nimDbg](https://github.com/enthus1ast/nimDbg) i think of adding this macro to the module, though: import macros macro decho*(ele

Re: A 'made with Nim' website?!

2020-02-21 Thread enthus1ast
go for it! :) (But be aware that there is [https://nimble.directory](https://nimble.directory)/ already)

Re: debug-only echo

2020-02-21 Thread enthus1ast
did not know dump, thanks for this!

Re: debug-only echo

2020-02-22 Thread enthus1ast
just testet dump, it is not quite the same but still usefull imho: dump("foo" & "123") #"foo123" = foo123 decho("foo" & "123") #"foo" & "123" => foo123 Run

Re: Osproc input stream hang

2020-02-24 Thread enthus1ast
Since the process streams has not implemented peak functionallity, it seems the only way to do this is with threads.

Re: Weird Behaviour

2020-02-25 Thread enthus1ast
Please format your question properly.

Re: Nim talk at FOSDEM

2020-02-25 Thread enthus1ast
I'm still waiting too :) [https://forum.nim-lang.org/t/5866](https://forum.nim-lang.org/t/5866)

Re: Styling Karax app

2020-02-26 Thread enthus1ast
Write karax code that generates a dom, add classes and id's etc. to your elements , then you use css to style the dom elements. you load the css in the html (not from karax), you could if you really like create a link element from karax, but i would just write it in the html , then when the dom

Re: Is this possible?

2020-02-27 Thread enthus1ast
you can also consider creating shared object files and load them. Depending on your use case this might be "dynamic" enough?

Re: Thank you Templates

2020-02-27 Thread enthus1ast
Maybe also have a look at cligen ( [https://github.com/c-blake/cligen](https://github.com/c-blake/cligen) )

Re: Doubt! Proc and import

2020-02-28 Thread enthus1ast
I do not know your use case, but i think embedding a compiler is a little overkill. Why can't you just include every required module? What are you'r concerns? Can you elaborate what your use case for the REST api is?

Re: Doubt! Proc and import

2020-02-28 Thread enthus1ast
ok, being compiled or dynamic, it might be a bad idea to let users run arbitrary code on your machine. Better define some procedures users can call. What kind of code the users will provide? (If your goale is to build something like a nim playground have a look how nim playground solves this i

Re: Using sendTo() to send custom types?

2020-03-02 Thread enthus1ast
Please try addr reallyWannaSendThis

Re: Module queues is not working? Is it deprecated?

2020-03-03 Thread enthus1ast
Think it is called dqeues now [https://nim-lang.org/docs/deques.html](https://nim-lang.org/docs/deques.html)

Re: nimkernel capabilities

2020-03-03 Thread enthus1ast
I think the "kernel" is more or less a proof of concept / experiment. If you find it Interesting: play with it! I can imagine dom96 is open for pr's.

Re: HELP: async httpclient running out of response

2020-03-05 Thread enthus1ast
You should close the HttClient after each request to avoid running out of file descriptors. Then try to make the requests with 'withTimeout' from the asyncdispatch module. This way you can react when a request timesout. If you still having troubles let me know. Later I can help you better (i'm o

Re: proc header: 'x' is of type which cannot be captured as it would violate memory safety

2020-03-05 Thread enthus1ast
i don't know much about arc but this is a common error on async. I would try to change the type to a "ref T"

Re: HELP: async httpclient running out of response

2020-03-05 Thread enthus1ast
Code looks good to me. you can drive your async loop with: runForever() Run which boils down to: while true: poll() Run or you can waitFor() # drives an async loop and also returns value. Run Then inside a

Re: Nim 1.1.1/devel: programs silently crashing with --gc:arc

2020-03-06 Thread enthus1ast
please share example code

Re: Using sendTo() to send custom types?

2020-03-10 Thread enthus1ast
btw. when you wanna use udp in an async manner, i've written a small library that can do so: [https://github.com/enthus1ast/nimAsyncUdp](https://github.com/enthus1ast/nimAsyncUdp)

Re: re or nre. What should i use? What will be supported in future?

2020-03-10 Thread enthus1ast
I use this pure library in one of my projects [https://github.com/nitely/nim-regex](https://github.com/nitely/nim-regex)

Re: [Noob Question] : Persistent http sessions in nim

2020-03-11 Thread enthus1ast
http is a state less protocol so`connection open` is kind of a wrong term. There is something like http connection reuse though, but afaik the authentication process is the same. So save the cookie data somewhere, maybe in a file. Then on a new http request, read it in and set it to the http he

Re: [Noob Question] : Persistent http sessions in nim

2020-03-11 Thread enthus1ast
A simple example code for doing by hand: # index.php (sorry for php here but i was lazy) # import httpClient var client = newHttpClient() # our "login", index.php just sets a cookie let resp = client.get("http://127.0.0.1:80/ttt/index.php";)

Re: How to start a Jester server?

2020-03-18 Thread enthus1ast
That's a weird issue Indeed! Can you check if you have saved your file. Or that you are compiling the correct one? (maybe "cat twitter.nim" reveals the issue?). Also check your imports if there is anything fishy going on. Then if you have triple checked and it's still not working, I would consid

Re: examples or documentation of Source Code filters

2020-03-23 Thread enthus1ast
nim-templates Front onionhammer is a good replacement IMHO.

Re: CGI request body is JSON not multipart.

2020-03-24 Thread enthus1ast
Can you share a code example? I've never done multipart with cgi in nim, but you maybe can just send a multipart msg from the browser and in one part you send json.

Re: ways to comunicate between different application

2020-03-27 Thread enthus1ast
There are several ways, if the python app is fired only once, then maybe command line params and stdout are enough for communication. or both applications communicate with network sockets: Socket one nim -socket-> python - python do this - python do that R

Re: ways to comunicate between different application

2020-03-27 Thread enthus1ast
sure you can but then its not so simple to have an "eval loop" socket1: --connection-> --do this-> <--ok-some info--- --do that-> <--ok-some info--- Run socket2: -connection-> <-update this-- ok> <-update that-- --

Re: WebRTC support 👑

2020-04-05 Thread enthus1ast
in the browser via js. Natively i'm not aware of any ready to use libraries for webrtc. There is status-im/libp2p, though.

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

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: 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: 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

Create type with macro that depends on other types in a type block

2020-04-25 Thread enthus1ast
I create a type in a macro which depends on other type ( i create the World type) The issue is that the world type depends on other types (Store and Entity) which are in the same typeblock. It seems that i cannot call the create macro inside the type block to create the type. When i call the gen

Re: Create type with macro that depends on other types in a type block

2020-04-25 Thread enthus1ast
Got it! :) at first i dumped the ast: World {.dumpAstGen.} = ref object guids: GUID storeHealthAble: Store[CompHealthAble] storeDrawAble: Store[CompDrawAble] storeNameAble: Store[CompNameAble] Run this works because the ast that generate

Re: Embedding OpenGL window into some of our gui frameworks

2020-04-29 Thread enthus1ast
Also have a look at the sfml bindings. Sfml draws with gl.

Re: Termcurs

2020-04-29 Thread enthus1ast
I would add a description what your library is all about. I just skimmed it and I saw vte. Ok I know that vte is the gnome terminal emulator but what is your project doing with terminal?

Re: NOOB: Is there a way to do: dos.com + my.nim ==> my.exe (Just ONE file)

2020-04-29 Thread enthus1ast
Another way would be to port a RunPe to nim and run it directly from memory.

Re: Termcurs

2020-04-29 Thread enthus1ast
please speak english so that we all can participate

Re: Is there a simple example on how to create a Windows UI

2020-05-04 Thread enthus1ast
I could have a look at gintro (gtk) or wnim (winapi)

  1   2   >