Re: FOSDEM Call for Participation
Hi All, Anyone have link of slide/video of fosdem conference please help post here. here's one of the talk that have slide [https://fosdem.org/2020/schedule/event/nimultralowoverheadruntime](https://fosdem.org/2020/schedule/event/nimultralowoverheadruntime)/
Re: Advent of Nim 2019 megathread
First year of AoC and first year of Nim too. Each part I usually take 2 hours so I need dedicate 4 hours each day to finish it. [https://github.com/me7/AdventOfCode](https://github.com/me7/AdventOfCode) Looking at other people code once I've done it is my favorite part. I've learn what's my mistake everyday
Re: use jester with SSE (server side event) example
Hi dom, Thanks for point out. But I've try that and not success, here the reasons 1\. No documentation - while treeform/ws have jester example on first page (readme.md) but niv's one mention nowhere. Even sample code from issue [https://github.com/niv/websocket.nim/issues/61](https://github.com/niv/websocket.nim/issues/61) not working 2\. The word on readme.md scare me This is a pre-release and not final software. There might be bugs, unintended side-effects, the API might change without warning between releases, and features are missing 3\. I've look at example folder of the project and I think API is more complicate than threeform/ws (just my personal opinion)
Re: use jester with SSE (server side event) example
Thank you for help looking on the problem!! I think the problem is from this line [https://github.com/treeform/ws/blob/master/src/ws/jester_extra.nim#L5](https://github.com/treeform/ws/blob/master/src/ws/jester_extra.nim#L5) which you expect to detect defined(useHttpBeast) but it's fail to detect
Re: Nerve: RPC framework for Nim
Thank for bump the thread. Just found it and it's look fit to my requirement
use jester with SSE (server side event) example
Right now web socket library (treeform/ws) not working with httpBeast on jester yet [https://github.com/treeform/ws/issues/11#event-2831261507](https://github.com/treeform/ws/issues/11#event-2831261507). So I want to use SSE (server side event) instead. After googling and do it myself several time I still cannot make it work yet. Anyone could here guide me what's the correct way to use it with jester? (I'll do pull request to jester to add this example after it work) Here's code that working ok but using PHP [https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events) Here's my code so far (that's not work) server import jester import os, random routes: get "/": resp "Home" get "/demo_sse": request.headers.add "Content-Type", "text/event-stream" request.headers.add "Cache-Control", "no-cache" request.sendHeaders() for i in 1..20: request.send($rand(100)) sleep(100) Run client code in js var source = new EventSource("/demo_sse"); source.onmessage = function (event) { document.getElementById("result").innerHTML += event.data + ""; }; Run Any example available?
Re: why md5.toMD5 violate {. noSideEffect .} pragma? and why modify var T not violate it?
> I want to help to submit the nosideeffect version to you but I'm afraid that > my knowledge is not up to that level yet. If you can point me to nosideeffect > of python version I'll try to convert it to nim and do pull request
Re: I want to launch services with Apache and jester
Maybe use instead of file under /public/a.txt folder will be /a.txt not ./a.txt [https://github.com/dom96/jester#static-files](https://github.com/dom96/jester#static-files)
Re: why md5.toMD5 violate {. noSideEffect .} pragma? and why modify var T not violate it?
Thanks for clarify, so from my understand nse5 --> Can compile because proc only changes locations that are reachable from its parameters (var s). OK nse6 --> Cannot compile because use zeroMem, copyMem which modify memory. But this mean all MD5 function will never pure? (no side effect)
Re: Nim should be your language of choice for IoT
Cool!!, good luck with your project.:) I'm in contract manufacturing factory and looking on implement IoT stuff to our machines in factory. Your post boost my confident that nim is suitable for this kind of work
why md5.toMD5 violate {. noSideEffect .} pragma? and why modify var T not violate it?
I've just watched "Why is heskell so hard to learn and how to deal with it" youtube video. On minute 33 have a quote that "Functional purity is the most important thing that sets Heskell apart". As soon as I see this slide, my first though is "wait... I remember that nim also have this feature. It's {. noSideEffect .} pragma, or just use "func" instead of "proc" and problem solved. Here's what I've try # experiment no side effect # could nim enforce pure function like Heskell? import md5 # This is ok, no side effect func nse1(s:int): string = $s # This is not ok, echo have side effect func nse2(s:string): string = echo s return s # This is not ok, read from file have side effect func nse3(s:string): string = readFile("secret") & s # This is ok, use var but not modify var func nse4(s: var string): string = return s & " no side effect" # This is not ok, use var and modify var func nse5(s: var string): string = s = s & "hi" return s & " no side effect" # This should ok, why not? func nse6(s:string): string = $s.toMD5 when(isMainModule): echo 123.nse1 var s = "hello" echo s.nse2 echo s.nse3 echo s.nse4 echo s.nse5 echo s #s was modified echo s.nse6 Run my question is why nse5 not fail to compile? it's modify input --> s before call = "hello" while s after call = "hellohi" why nse6 fail to compile? it's just call md5.toMD5 and not modify anything
Re: Jester memory usage keep rising using sqlite
Thank you for your answer. I think that's because Nim does not free memory to OS. It's still ok for me that it's not memory leak
Jester memory usage keep rising using sqlite
My testing jester app memory keep rising. when start res mem around 2MB then go up to 12MB with about 50 load. I want to ask for how to use db_sqlite correctly? right now I'm just open in the beginning but no close (not know where to close) do I need to do db.close in every route? import jester let db = open("chinook.db","","","") routes: get "/": var s = "header " for x in db.fastRows sql"select * from albums;": s.add "album " & $x & "" s.add "footer" resp s