<< 14-11-2021 >>

00:51:40FromDiscord<retkid> can you not have multiple channels?
00:52:51FromDiscord<Elegantbeef> You should be able to
00:54:03FromDiscord<TennisBowling> is there a good postgresql library?
00:54:16FromDiscord<retkid> forgot .open()
00:54:27FromDiscord<retkid> In reply to @TennisBowling "is there a good": theres on in the stdlib
00:54:31FromDiscord<retkid> (edit) "on" => "one"
00:54:55FromDiscord<TennisBowling> what’s it called?
00:55:04FromDiscord<retkid> https://nim-lang.org/docs/db_postgres.html#postgresql_1
00:56:30FromDiscord<andi-> Hey, nim newbie here. I've just tried to use `split` from the `unicode` module with the `maxsplit`parameter. I was expecting it to behave like `splitn` in rust or `split(..., n)` in Python but apparently it doesn't return the remaining parts of the input string a nth component but instead just returns everything between the separators (even if the max matches have been reached). Is there some stdlib function that does this "as expected"?
00:57:20FromDiscord<retkid> i don't know but, you can probably pipe in the last it then rsplit() the original string
00:57:25FromDiscord<retkid> (edit) "rsplit()" => "rsplit()[1]"
00:57:43FromDiscord<retkid> that'll return the remainder
00:58:03FromDiscord<retkid> however, there might be a cleaner way
00:58:24FromDiscord<Elegantbeef> Do you have an example of the problem?
00:59:01FromDiscord<andi-> `foo: bar:baz:zes`, I want to get `foo` as one element and ` bar:baz:zes` as another
00:59:02FromDiscord<retkid> think i might've sent him down a quest... I should have asked for an example...
00:59:32FromDiscord<retkid> ahhh
00:59:59FromDiscord<retkid> so in python, it splits into a tuple of 3↡ie ↡("foo", " ", "bar:baz:zes")
01:00:07FromDiscord<retkid> you want the delimiter
01:01:04FromDiscord<Elegantbeef> I dont get why it'd split it into `foo, " ", and "bar:baz:zes"`
01:01:30FromDiscord<andi-> sent a code paste, see https://play.nim-lang.org/#ix=3EV9
01:01:33FromDiscord<andi-> This is how it does it in python
01:01:35FromDiscord<Elegantbeef> That's what it does
01:01:36FromDiscord<exelotl> In reply to @TennisBowling "is there a good": ndb is better that the stdlib one because it's typesafe
01:01:39FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3EVa
01:01:56FromDiscord<exelotl> https://github.com/xzfc/ndb.nim
01:02:16FromDiscord<retkid> oh no
01:02:19FromDiscord<retkid> im thinking of partition
01:02:28FromDiscord<Elegantbeef> Both the unicode aware and strutils works the same https://play.nim-lang.org/#ix=3EVb
01:02:34FromDiscord<exelotl> (well I'm not actually sure how complete the ndb postgres support is, but it's good enough for Norm apparently)
01:02:39FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/909246916120940574/unknown.png
01:02:51FromDiscord<retkid> nim's split works the same way as it does in python
01:03:12FromDiscord<Elegantbeef> I mean it works correctly afaict
01:03:44FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/909247189778305044/unknown.png
01:04:09FromDiscord<andi-> Indeed it does.. m(
01:04:11FromDiscord<andi-> my fault
01:04:14FromDiscord<andi-> I had an off-by-one
01:04:17FromDiscord<andi-> in my actual code
01:04:22FromDiscord<retkid> happens to the best of us
01:05:40FromDiscord<TennisBowling> In reply to @exelotl "ndb is better that": will take a look
01:06:01FromDiscord<retkid> In reply to @exelotl "ndb is better that": is there a typesafe sqllite
01:06:19FromDiscord<exelotl> yep, also ndb ^^
01:06:29FromDiscord<exelotl> it just doesn't support mysql
01:56:15*krux02 quit (Remote host closed the connection)
02:33:27FromDiscord<retkid> is there any example of how to use .peek()
03:20:54FromDiscord<evoalg> When I do `nimble list -i` it no longer lists what's installed, but it says `Warning: Using project local deps mode` and nothing else ... did I break it?
03:22:08FromDiscord<Elegantbeef> Mine says the same, truthfully didnt know nimble would list installed packages
03:23:34FromDiscord<evoalg> it did before yea
03:28:35FromDiscord<Varriount> @GULPF Regarding the `times` module, what was your motivation for giving the `TimeInterval` type separate fields? Why not make it a single `int64`, and have year/month/day/etc. do division?
04:03:11FromDiscord<evoalg> I can not longer install or unintall anything using nimble ... I'll try deleting everything and reinstalling nim
04:06:01*supakeen quit (Quit: WeeChat 3.3)
04:06:31*supakeen joined #nim
04:15:53FromDiscord<evoalg> That worked
04:22:08FromDiscord<evoalg> sent a code paste, see https://play.nim-lang.org/#ix=3EVM
04:22:28FromDiscord<Elegantbeef> Yep
04:22:50FromDiscord<Elegantbeef> That was a change from 1.4.8 -\> 1.6 so either the author hasnt got around to it or doesnt care πŸ˜€
04:23:19FromDiscord<exelotl> the nimble enforced structure is dumb and I hate it
04:37:13FromDiscord<evoalg> @ElegantBeef I was testing kashae and I wanted to see the speed up of calling the factorial function just once, but kashae is so damn fast that I thought I should use timeit instead of benchy as timeit can measure to nanoseconds ... anyway kashae sped it up about 100354x (I used -d:release for both) πŸ™‚
04:38:07FromDiscord<Elegantbeef> Yep memoization is pretty nifty for stuff like this
04:43:26FromDiscord<Elegantbeef> The fun part is seeing how effective it is with just a few values cached
04:43:27FromDiscord<Elegantbeef> Like doing just `{.cacheOpt: 5.}` or similar
04:49:26FromDiscord<evoalg> oh I always misspeak - I was testing fib not func
04:50:16FromDiscord<evoalg> (edit) "func" => "fact"
04:50:37FromDiscord<evoalg> fact ... how many time will I misspeak
04:53:06FromDiscord<Elegantbeef> Ah so just validating my tests πŸ˜€
04:53:37FromDiscord<evoalg> lol to start with ... I'm not doing factorials
04:53:44FromDiscord<evoalg> using bigints
04:54:05FromDiscord<Elegantbeef> As most of my code, i just made it cause it seemed fun, never actually used it for anything
04:54:30FromDiscord<evoalg> I like fun code
04:58:07FromDiscord<evoalg> it's faster for factorials (using bigints) even on one call to the function instead of multiple calls ... I don't know why as the cache wouldn't be built up yet, as it's recursively going from n to 1 ... ?
04:58:45FromDiscord<Elegantbeef> What's the code?
04:59:58FromDiscord<evoalg> https://play.nim-lang.org/#ix=3EVX
05:01:25FromDiscord<evoalg> it's only like 4x faster, but it's faster
05:01:56FromDiscord<Elegantbeef> That's quite odd
05:02:02FromDiscord<evoalg> kashae magic!
05:02:27FromDiscord<Elegantbeef> Are we sure it got the right answer?
05:02:46FromDiscord<evoalg> lemme check...
05:03:51FromDiscord<Elegantbeef> Same value
05:04:47FromDiscord<Elegantbeef> I just dont get why it'd be faster, since it should enter it once go "yep it's not in the cache, invoke the child code"
05:05:54FromDiscord<evoalg> The kashae version and non-kashae answers are the same, and python's math.factorial(50) is the same answer too
05:06:00FromDiscord<Elegantbeef> Like it's expanded into https://play.nim-lang.org/#ix=3EW2
05:06:32FromDiscord<evoalg> wow ok
05:06:45FromDiscord<Elegantbeef> The fact it's faster is ... interesting
05:08:03FromDiscord<evoalg> and by "wow" I mean "Whoa look at all that code I don't understand" πŸ˜‰
05:08:30FromDiscord<Elegantbeef> Lol it's just hashing parameters then checking a table
05:09:48FromDiscord<evoalg> the what have we learned? ... use kashae for all my proc's just in case, cos you never know! lol
05:12:34FromDiscord<Elegantbeef> hmm give me one second i might've found the culrpit
05:12:36FromDiscord<Elegantbeef> culprit even
05:13:54FromDiscord<Elegantbeef> Yep found it
05:14:04FromDiscord<Elegantbeef> the `timeGo` was running it more than once
05:14:15FromDiscord<evoalg> ohhhhh ok
05:14:25FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3EW7 bench this
05:14:49FromDiscord<evoalg> I thought (1, 1) was 1 run of 1 loop
05:14:52FromDiscord<Elegantbeef> They're about even with that
05:15:13FromDiscord<Elegantbeef> I dont know might need to be `(1, 0)` but that still didnt seem right
05:15:50FromDiscord<Elegantbeef> I just went to the stdlib stuff since it's right there
05:17:16FromDiscord<Elegantbeef> Well there we go, dont always use kashae πŸ˜›
05:18:37FromDiscord<Elegantbeef> The full cached version will probably just be slower due to the nature of this code
05:38:46FromDiscord<retkid> somewhere in my code
05:38:57FromDiscord<retkid> http.getContent is causing some issue
05:39:05FromDiscord<retkid> which is causing threads to hang\
05:39:11FromDiscord<retkid> (edit) "hang\" => "hang"
05:44:29NimEventerNew thread by Plgupa: Getting error setting up Mysql Database, see https://forum.nim-lang.org/t/8620
05:53:07*vicfred joined #nim
05:58:23FromDiscord<evoalg> In reply to @Elegantbeef "Well there we go,": Thank you for all your help
06:02:24FromDiscord<Elegantbeef> Uh oh that's a lot of users i see joining on matrix
06:02:28FromDiscord<Elegantbeef> Bot raid inbound
06:12:01FromDiscord<BioS> https://media.discordapp.net/attachments/371759389889003532/909324773836869642/Screenshot_20211114_011330.png
06:12:15FromDiscord<BioS> admins get him
06:14:43FromDiscord<reilly> Yeup
06:14:51FromDiscord<reilly> Got a crypto spam DM
06:14:57FromDiscord<Dumb Dragon> Same
06:15:00FromDiscord<Dumb Dragon> Was just about to mention
06:15:47FromDiscord<Yardanico> banned them all I think
06:15:53FromDiscord<reilly> Wow guys, I can't believe I just inexplicably won $32,038.58! Surely this can't be a scam!
06:15:57FromDiscord<Yardanico> very nice "platform" you got there, discord
06:16:08FromDiscord<LilTuxie> i got a spam dm too
06:16:23FromDiscord<Yardanico> yeah i banned all bots who joined together in one minute
06:17:01FromDiscord<Yardanico> if you still see new bots messaging you _after_ this, please tell
06:17:33FromDiscord<Rika> Disable server DMs lol
06:18:30FromDiscord<Yardanico> In reply to @Rika "Disable server DMs lol": those can be quite helpful though
06:18:48FromDiscord<Rika> If they want to contact me they should ping me first
06:19:17FromDiscord<Yardanico> ah I thought it was a server option
06:19:22FromDiscord<Yardanico> yeah as a individual user option it's quite useless
06:19:35FromDiscord<Yardanico> because users have it enabled (can receive server DMs) by default
06:19:53FromDiscord<Yardanico> and you can't change this setting server-wide
06:22:32FromDiscord<Rika> Ah
06:22:38FromDiscord<Rika> Yeah
06:26:00*xet7 joined #nim
06:30:10NimEventerNew Nimble package! brainlyextractor - Brainly data extractor, see https://gitlab.com/lurlo/brainlyextractor
06:44:25FromDiscord<codic> this causes a segfault, what's wrong with it?
06:44:34FromDiscord<codic> sent a code paste, see https://play.nim-lang.org/#ix=3EWj
06:44:37FromDiscord<codic> params is a seq from `commandLineParams()`
06:44:45FromDiscord<Elegantbeef> fontList is nil
06:49:48FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3EWk
06:49:58FromDiscord<Yardanico> ptr UncheckedArray is mainly for _getting_ arrays from the C side (casting raw array pointers to some type)
06:50:08FromDiscord<Yardanico> you can just make a normal array and pass `addr elem[0]` to the C function
06:50:43FromDiscord<Yardanico> this also works for sequences
07:01:49FromDiscord<codic> oh I see, I didn't allocate the memory for fontList
07:01:54FromDiscord<codic> In reply to @Yardanico "you can just make": excellent, thanks
08:10:44NimEventerNew thread by Pietroppeter: FOSDEM 2022 call for Nim Devroom (deadline tomorrow), see https://forum.nim-lang.org/t/8621
08:12:44FromDiscord<pietroppeter> hey @dom96, the fosdem thread is here. a bit late but if people would be interested in submitting talks, I think it could stilll be doable.
08:32:55FromDiscord<apahl> In reply to @Ricky Spanish "is there any less": Have you tried https://github.com/c-blake/cligen ?
08:33:44FromDiscord<Ricky Spanish> no it didnt appear when i was searching, but thanks for sharing looks useful
08:38:28FromDiscord<Yardanico> In reply to @Ricky Spanish "is there any less": Aside from cligen I've found https://github.com/iffy/nim-argparse to be pretty useful. It also allows you to hook it to anything as long as you provide the command, so you can use it for e.g. Telegram bot commands
08:38:45FromDiscord<Ricky Spanish> yeh this is what i ended up using
08:40:04FromDiscord<Ricky Spanish> thanks for the suggestions anyway, good to have a development community that actually is helpful
08:42:23FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3EWy
08:43:00FromDiscord<Yardanico> so yeah, it's really nice to use it when you don't exactly need a CLI argument parser but for general command parsing
08:43:06FromDiscord<retkid> Yard all i see when i look at your pfp is the airbnb logo
08:43:21FromDiscord<Yardanico> https://cnc.fandom.com/wiki/Brotherhood_of_Nod
08:43:34FromDiscord<retkid> bella
08:43:52FromDiscord<retkid> https://en.wikipedia.org/wiki/Airbnb
08:44:28FromDiscord<Ricky Spanish> @Yardanico actually that usage is cleaner than what i was doing so going to steal that πŸ˜† thanks
08:44:47FromDiscord<retkid> ricky spanish
08:45:14FromDiscord<Yardanico> In reply to @Ricky Spanish "<@!177365113899057152> actually that usage": It's the second example in the readme :) https://github.com/iffy/nim-argparse#parse
08:45:22FromDiscord<retkid> (edit) "ricky spanish" => "rα΅£α΅’κœ€β‚–α΅§ β‚›β‚šβ‚β‚™α΅’β‚›β‚•"
08:46:08FromDiscord<retkid> so i was wondering here if anyone knows about any interesting behaviors in httpclient
08:47:30FromDiscord<retkid> it appears to occasionally just ignore my timeout and just hog the mainthread
08:47:42FromDiscord<retkid> (edit) "it appears to occasionally just ignore my timeout and just hog the mainthread ... " added "on .close()"
08:47:58FromDiscord<retkid> .close() will never complete
08:48:37FromDiscord<retkid> in my attempts to crawl a website I only get to about 14,000 urls before all threads get taken by the .close() and it grinds to a hault
08:50:48FromDiscord<retkid> lemme post some code to see if i can repicate it
08:50:51FromDiscord<retkid> (edit) "repicate" => "replicate"
08:57:01FromDiscord<Yardanico> why are you using threads for crawling to begin with?
08:57:12FromDiscord<Yardanico> Why not async? httpclient supports that
08:57:34FromDiscord<Yardanico> And then you'll also have asyncdispatch's withTimeout proc
08:58:23FromDiscord<retkid> In reply to @Yardanico "why are you using": I did try async
08:58:30FromDiscord<retkid> my code was basically
08:58:31FromDiscord<Yardanico> so?
08:59:51FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3EWB
08:59:56FromDiscord<retkid> but i would get read from Nil
09:00:11FromDiscord<retkid> (edit) "but i would get read from Nil ... " added "issues"
09:00:17FromDiscord<retkid> so i scrapped that idea
09:00:46FromDiscord<retkid> In reply to @Yardanico "why are you using": because i wanted to learn threading, and it would take hours
09:00:55FromDiscord<retkid> (edit) "In reply to @Yardanico "why are you using": because i wanted to learn threading, and it would take hours ... " added "otherwise"
09:01:13FromDiscord<Yardanico> it won't, you can run multiple async "workers" at the same time
09:01:18FromDiscord<retkid> (edit) "In reply to @Yardanico "why are you using": because i wanted to learn ... threading," added "more"
09:01:29FromDiscord<Yardanico> I've been using async in my adb scanner and screenshot scrapper and it works very well
09:01:44FromDiscord<retkid> well i can use async and threading
09:02:06FromDiscord<Yardanico> No need for hacks
09:02:08FromDiscord<Yardanico> sent a code paste, see https://play.nim-lang.org/#ix=3EWF
09:02:09FromDiscord<retkid> uea
09:02:11FromDiscord<retkid> (edit) "uea" => "yea"
09:02:13FromDiscord<retkid> as i said
09:02:14FromDiscord<retkid> it doesn't work
09:02:21FromDiscord<Yardanico> as in?
09:02:26FromDiscord<retkid> it wouldn't close it
09:02:38FromDiscord<retkid> In reply to @retkid "it appears to occasionally": read
09:02:56FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=3EWG
09:03:05FromDiscord<retkid> (edit) "https://play.nim-lang.org/#ix=3EWG" => "https://play.nim-lang.org/#ix=3EWH"
09:03:39FromDiscord<Yardanico> I was talking about async though, but okay :)
09:03:43FromDiscord<retkid> (edit) "https://play.nim-lang.org/#ix=3EWH" => "https://play.nim-lang.org/#ix=3EWI"
09:03:47FromDiscord<Yardanico> I've never used the sync version of httpclient with timeouts
09:04:12FromDiscord<Yardanico> Check where it hangs by a profiler, probably it doesn't account for the timeout somewhere where it accesses external stuff
09:04:14FromDiscord<retkid> I can try the async one
09:04:31FromDiscord<Yardanico> Compile with --debugger:native for original source code mapping for the profiler
09:04:33FromDiscord<retkid> I tried to profile it but the threads wouldn't start for some reason
09:04:35FromDiscord<retkid> oh
09:05:08FromDiscord<retkid> with nimprof, right?
09:05:38FromDiscord<Yardanico> no
09:05:47FromDiscord<Yardanico> With any generic app profiler
09:06:06FromDiscord<Yardanico> nimprof is not really maintained as far as I know
09:06:06FromDiscord<retkid> I don't think i have a profiler
09:06:09FromDiscord<retkid> apart from strace
09:06:28FromDiscord<Yardanico> Install one?
09:06:28FromDiscord<retkid> I haven't checked the strace yet
09:06:34FromDiscord<retkid> WHICH ONE DO YOU RECOMMEND
09:07:09FromDiscord<Yardanico> I don't have any particular recommendations, use the one you prefer
09:07:27FromDiscord<Yardanico> There's quite a lot of them, for example callgrind, perf, gprof, etc
09:07:58FromDiscord<retkid> sent a code paste, see https://play.nim-lang.org/#ix=
09:08:47FromDiscord<retkid> im looking for one for C, right?
09:09:12FromDiscord<Yardanico> Almost all of them are language agnostic, but yes, if it works for C it'll work for Nim too
09:19:16*redj quit (Ping timeout: 245 seconds)
09:30:43FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/909374776055824424/unknown.png
09:30:44FromDiscord<retkid> very cool
09:31:45FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/909375037272883200/unknown.png
09:32:09FromDiscord<Yardanico> so you weren't using callgrind
09:32:20FromDiscord<Yardanico> callgrind is a tool available in valgrind
09:32:24FromDiscord<Yardanico> `valgrind --tool=callgrind`
09:41:46*Jjp137 quit (Ping timeout: 245 seconds)
10:47:48*beshr joined #nim
10:53:07NimEventerNew thread by Kobi: Compiling to macOS, see https://forum.nim-lang.org/t/8622
11:09:12*xet7 quit (Remote host closed the connection)
11:33:14NimEventerNew thread by Rb3: Yet another macro DSL, see https://forum.nim-lang.org/t/8623
11:48:20FromDiscord<dom96> In reply to @pietroppeter "hey <@!132595483838251008>, the fosdem": thanks, I was wondering whether I should create this thread, glad you did so πŸ™‚
11:50:34FromDiscord<dom96> In reply to @Yardanico "it won't, you can": yesss, async all the way
11:50:41*Jjp137 joined #nim
12:06:01*supakeen quit (Quit: WeeChat 3.3)
12:06:31*supakeen joined #nim
12:32:28FromDiscord<Recruit_main707> the only way to debug nim code setting breakpoints is with vscode right? (without manually adding the breakpoint intructions)
12:52:41FromDiscord<Recruit_main707> I guess i can check gdbgui, seems pleasant enough to sue
12:52:46FromDiscord<Recruit_main707> use
13:22:13*Guest2 joined #nim
13:26:05*Guest2 quit (Client Quit)
13:46:20FromDiscord<hmmm> what am I doin wrong broskis https://media.discordapp.net/attachments/371759389889003532/909439106436702278/aaa.JPG
13:47:37FromDiscord<federico3> should we create a Nim FOSDEM matrix room?
13:49:05FromDiscord<Rika> @hmmm [] is not seq
13:49:17FromDiscord<hmmm> oh shi lol
13:49:26FromDiscord<Rika> either add a `@` before the [] or use `array[4, int]`
13:49:33FromDiscord<hmmm> yea now it should work
13:52:17*redj joined #nim
13:56:34FromDiscord<hmmm> rika πŸ«‚
13:59:01FromDiscord<Rika> lol
14:05:56*terminalpusher joined #nim
14:15:24*u0_a185 joined #nim
14:25:27FromDiscord<Pietro Peterlongo> well, since FOSDEM uses Matrix I guess it is appropriate (I created a Matrix account on purpose \:))! Maybe it could be nice to also have it linked to discord so people there can see it. Not sure how is the process to bridge the room to discord, whether is it better to create it first on discord or matrix...
14:26:13FromDiscord<pietroppeter> (and checked that if I reply to a message on matrix, the reply is not loss on discord, that is good!)
14:49:05*xet7 joined #nim
14:52:52*xet7 quit (Remote host closed the connection)
14:55:43*u0_a185 quit (Quit: WeeChat 3.0.1)
14:55:55*u0_a185 joined #nim
15:06:36*Guest2 joined #nim
15:08:44*u0_a185 quit (Quit: WeeChat 3.0.1)
15:19:45FromDiscord<dom96> I created https://matrix.to/#/#nim-fosdem:matrix.org
15:22:04*Guest2 quit (Quit: Client closed)
15:28:34*arkanoid quit (Ping timeout: 260 seconds)
15:30:37*xet7 joined #nim
15:38:46*xet7 quit (Quit: Leaving)
16:02:35*Vladar joined #nim
16:38:32NimEventerNew thread by Sdmcallister: Htmlgen question, see https://forum.nim-lang.org/t/8624
16:53:26*u0_a185 joined #nim
16:54:23*u0_a185 left #nim (#nim)
17:19:33FromDiscord<retkid> @Yardanico so i tried your method with async again
17:19:38FromDiscord<retkid> i had the same segment fault issue
17:19:44FromDiscord<retkid> i turned off the gc and it works fine
17:19:56FromDiscord<retkid> however, it uses too much memory and my computer just says "nah"
17:20:38FromDiscord<retkid> tried using arc and orc but seem to get the same issue
17:21:06FromDiscord<retkid> (edit) ""nah"" => ""nah"↡(i only have 8gb of ram)"
17:21:20FromDiscord<dom96> have some code the reproduces the problem?
17:21:26FromDiscord<PMunch> In reply to @Yardanico "https://cnc.fandom.com/wiki/Brotherhood_of_Nod": How have I not noticed this before now?!
17:22:06FromDiscord<retkid> In reply to @dom96 "have some code the": lemme I'll build something basic to reproduce it
17:24:50NimEventerNew thread by Mantielero: UFCS issue, see https://forum.nim-lang.org/t/8625
17:49:51FromDiscord<the cows came home> im learning nim and karax and im wondering why i can pass procedures with arguments like im calling them into onclick parameters and instead of calling it then it just calls it on click
17:50:10FromDiscord<Rika> likely a template
17:51:16FromDiscord<the cows came home> i wrote the proc and its just a normal proc
17:51:33FromDiscord<Rika> i mean the onclick "proc" is perhaps a template
17:51:36FromDiscord<Rika> i dont use karax
17:51:37FromDiscord<the cows came home> oh
17:59:44FromDiscord<retkid> In reply to @dom96 "I created https://matrix.to/#/#nim-fosdem:matrix.or": this code is stapled together
18:00:14FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/909503000400252938/example.nim
18:00:41FromDiscord<the cows came home> o i get it now
18:01:12FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/909503244252889118/example.nim
18:02:08FromDiscord<retkid> use --gc:none there will be no segfault
18:02:33FromDiscord<retkid> at least with -d:release
18:02:38FromDiscord<retkid> be sure to compile with -d:ssl
18:02:45FromDiscord<dom96> `cast[ptr Channel[string]](allocShared0(sizeof(Channel[string])))` that already looks like a bad idea
18:02:51FromDiscord<retkid> this is in the dock
18:02:53FromDiscord<retkid> (edit) "dock" => "doc"
18:03:11FromDiscord<retkid> (edit) "this is in the doc ... " added "for channel"
18:03:18FromDiscord<dom96> channels are already "shared" afaik
18:03:26FromDiscord<3xpl01tc0d3r> Is there some examples on parsing PE files in nim ?
18:03:45FromDiscord<dom96> huh https://nim-lang.org/docs/channels.html 404s
18:05:18FromDiscord<Rika> link changed
18:05:25FromDiscord<retkid> yea
18:05:33FromDiscord<retkid> for some reason they didn't put a redirct
18:05:42FromDiscord<dom96> what is it now?
18:05:42FromDiscord<retkid> https://nim-lang.org/docs/channel_builtin.html
18:05:49FromDiscord<retkid> (edit) "https://nim-lang.org/docs/channel_builtin.html" => "https://nim-lang.org/docs/channels_builtin.html"
18:06:07FromDiscord<dom96> huh, why was this changed lol
18:06:20FromDiscord<Rika> idk
18:06:29FromDiscord<Rika> it was just sudden
18:06:53FromDiscord<dom96> in any case, it seems that allocShared is only necessary when you want to pass channels around, in your case the channel is a global already so no need for this, or am I missing something?
18:07:01FromDiscord<konsumlamm> so that `std/channels` could use the link
18:07:04FromDiscord<konsumlamm> but then they decided that `std/channels` isn't ready yet
18:07:16FromDiscord<retkid> In reply to @dom96 "in any case, it": i am passing them around
18:07:33FromDiscord<retkid> i pass it to the thread recursive()
18:08:12FromDiscord<dom96> okay, but why, you only ever have one channel
18:08:13FromDiscord<retkid> in the original code i have multiple channels passing between threads
18:08:30FromDiscord<retkid> In reply to @dom96 "okay, but why, you": because the names are the same
18:09:09FromDiscord<retkid> proc recursive(uwu : string, urlChannel : ptr Channel[string]) {.thread async.} =↡↡discard spawn recursive(x, urlChannel)
18:09:21FromDiscord<retkid> (edit) "proc recursive(uwu : string, urlChannel : ptr Channel[string]) {.thread async.} =↡↡discard spawn recursive(x, urlChannel)" => "sent a code paste, see https://play.nim-lang.org/#ix=3F04"
18:09:23FromDiscord<retkid> there are better questions to ask lol
18:09:42FromDiscord<retkid> like why am i using asyncclient
18:09:46FromDiscord<retkid> (edit) "asyncclient" => "asyncclient, etc"
18:10:02FromDiscord<retkid> why is it async at all?
18:10:03FromDiscord<retkid> etc
18:10:18FromDiscord<Rika> they only sound like better questions to you
18:10:41FromDiscord<retkid> don't call me out
18:10:49FromDiscord<dom96> `ptr` is inherently unsafe
18:11:00FromDiscord<dom96> so any segfaulting problems immediately should begin there
18:11:13FromDiscord<retkid> well the interesting thing is
18:11:16FromDiscord<retkid> thats not the problem
18:11:27FromDiscord<retkid> the problem has something to do with the async
18:11:32FromDiscord<retkid> because if i dont use async it doesn't segfault
18:11:42FromDiscord<dom96> but yes, you're also mixing async and sync
18:11:57FromDiscord<retkid> In reply to @dom96 "but yes, you're also": where?
18:12:13FromDiscord<dom96> and have an {.async, thread.}, this simply won't work, not sure what you're trying to achieve there πŸ™‚
18:12:32FromDiscord<dom96> you're calling `newHttpClient` and `newAsyncHttpClient`
18:13:14FromDiscord<retkid> I'll fix that but i guarantee you that is not the issue on the second bit
18:13:29FromDiscord<retkid> In reply to @dom96 "and have an {.async,": If i dont use async, the httpclients dont close
18:13:37FromDiscord<retkid> eventually, what happens is
18:13:42FromDiscord<retkid> they hang on the .close() statement
18:13:46FromDiscord<retkid> (edit) "they hang on the .close() statement ... " added "and saturate every t hread"
18:13:48FromDiscord<retkid> (edit) "t hread" => "thread"
18:13:53FromDiscord<retkid> so i use async to close them
18:14:09FromDiscord<dom96> It sounds like you have just done a bunch of workarounds and ended up with something that kinda works
18:14:22FromDiscord<retkid> it works without GC
18:14:22FromDiscord<dom96> I would focus on the design of this
18:14:32FromDiscord<dom96> and make sure it's solid first
18:14:42FromDiscord<Rika> "works without gc" is not really
18:14:45FromDiscord<Rika> solid
18:14:56FromDiscord<retkid> alright, well that is fair
18:15:01FromDiscord<Rika> like a lot of broken things work without gc
18:15:11FromDiscord<retkid> this goes back to my original question
18:15:23FromDiscord<retkid> why the hell dose httpclient.close() just sometimes hang
18:15:53FromDiscord<retkid> I would never have to do weird async and threading things ((which should be compatible btw))
18:16:13FromDiscord<Rika> they are compatible
18:16:18FromDiscord<Rika> your design may just be wrong
18:17:00FromDiscord<retkid> ah ok so it cant be httpclient it is me being wrong for trying to work around its weird bug πŸ€”
18:17:22FromDiscord<dom96> no, it's likely that httpclient has some bugs πŸ™‚
18:17:47FromDiscord<retkid> I'll remove the async then open an issue
18:17:57FromDiscord<dom96> first thing to answer the question of why `close` hangs is to check the source code
18:17:58FromDiscord<dom96> https://github.com/nim-lang/Nim/blob/devel/lib/pure/httpclient.nim#L653
18:18:05FromDiscord<Rika> In reply to @retkid "why the hell dose": this is a bug
18:18:13FromDiscord<Rika> In reply to @retkid "I would never have": this is likely due to your design
18:18:14FromDiscord<dom96> Looking at this I don't see why it would hang
18:18:26FromDiscord<Rika> In reply to @dom96 "https://github.com/nim-lang/Nim/blob/devel/lib/pure": https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/net.nim#L1160
18:18:31FromDiscord<Rika> also looking at this
18:18:31FromDiscord<retkid> In reply to @dom96 "Looking at this I": im not sure either
18:18:36FromDiscord<retkid> i was looking at it
18:18:41FromDiscord<retkid> it seems pretty straightforward
18:18:52FromDiscord<retkid> where would the issue be
18:18:55FromDiscord<retkid> is it my machine?
18:19:12FromDiscord<dom96> https://github.com/nim-lang/Nim/blob/devel/lib/pure/net.nim#L1171
18:19:22FromDiscord<dom96> maybe it's the ssl logic that's to blame
18:19:23FromDiscord<Rika> > literally sent that
18:19:24FromDiscord<Rika> smh
18:19:40FromDiscord<dom96> sorry, didn't read backlog before sending πŸ™‚
18:19:46FromDiscord<Rika> im joking
18:26:57NimEventerNew thread by JPLRouge: What does bycopy mean , see https://forum.nim-lang.org/t/8626
18:29:37FromDiscord<dom96> I know I know πŸ™‚
18:37:54FromDiscord<hotdog> Has the choosenim install script has changed to windows line endings?
18:38:22FromDiscord<hotdog> Seems to be failing now with `bash: ./init.sh: /bin/sh^M: bad interpreter: No such file or directory`
18:39:35FromDiscord<hotdog> (edit) removed "has"
18:45:40FromDiscord<dom96> oof, I just updated it
18:45:45FromDiscord<dom96> so thank you for the call out
18:48:45FromDiscord<dom96> should be fixed now
18:53:11*muffin_ joined #nim
18:59:05*oddish joined #nim
19:04:22FromDiscord<hotdog> In reply to @dom96 "should be fixed now": Speedy fix! Cheer
19:04:27FromDiscord<hotdog> (edit) "Cheer" => "Cheers"
19:07:38*muffin_ is now known as muffin
19:08:51*muffin is now known as notmuffin
19:26:44*notmuffin is now known as muffin_
19:40:57FromDiscord<andi-> Is there some preferred way to convert an array of 8 bytes to e.g. an uint64 if I know the byte order is correct (e.g. because I swapped it beforehand). I can't seem to find the right way to do this.
19:44:03*PMunch joined #nim
19:50:22FromDiscord<el__maco> dunno about preferred way, but maybe something like this? https://play.nim-lang.org/#ix=3F0o
19:50:31*terminalpusher quit (Remote host closed the connection)
19:51:06NimEventerNew thread by Bpr: Preview of coming attractions?, see https://forum.nim-lang.org/t/8627
19:54:09*muffin_ quit (Quit: Konversation terminated!)
19:55:41*muffin joined #nim
19:55:44FromDiscord<andi-> mhm, yeah I saw a couple of those while googling. Might be the way to go but I am a bit surprised that I need manual pointer fiddling here.↡(@elmaco)
19:57:55*muffin is now known as muffin_
19:59:05FromDiscord<el__maco> I'm new with the language so it wouldn't surprise me if there was a cleaner way to express it, but that's how I would do it in C and that's probably alright in terms of resulting code performance
19:59:42PMunch@andi-, I mean you can just `cast[uint](a)`
19:59:52FromDiscord<andi-> Yeah, In C I'd not be scared by this as I would know that my array is of a given size on the stack and not some fancy abstractions I don't yet understand \:D
20:00:21PMunch!eval let a = [1.uint8,2,3,4,5,6,7,8]; echo cast[uint](a)
20:00:24NimBot578437695752307201
20:00:30*muffin_ quit (Client Quit)
20:00:45FromDiscord<el__maco> ah, thats probably better then ^^
20:01:52PMunchandi-, Nim arrays are just bytes in memory, same as in C. They'll also be placed on the stack by default
20:02:16FromDiscord<el__maco> I find it a bit surprising that simple cast works
20:02:18FromDiscord<andi-> ok
20:02:26FromDiscord<andi-> The simple cast didn't work for me
20:02:44FromDiscord<el__maco> if the array is narrower than the type, it seems to produce garbage
20:02:50PMunchWhat did you try to do?
20:03:04PMunchWell obviously, because then you're grabbing nearby data as well
20:03:27FromDiscord<andi-> my LSP complained that I can't treat my `array[0..8,uint8]` as pointer
20:03:29FromDiscord<el__maco> kinda thought we had to go through unsafe address but I guess not
20:03:42PMunchandi-, well, you can't..
20:04:13PMunchBut you're free to cast it to a pointer, at least if sizeof(pointer) == 8
20:05:41FromDiscord<andi-> That seems to work
20:05:44FromDiscord<andi-> sent a code paste, see https://play.nim-lang.org/#ix=3F0D
20:08:33PMunchThis also works: https://play.nim-lang.org/#ix=3F0G
20:08:49PMunchNote that I converted your array to `array[8, uint8]`
20:09:04PMunch!eval echo sizeof(array[0..8, uint8])
20:09:06NimBot9
20:09:10PMunch!eval echo sizeof(array[8, uint8])
20:09:12NimBot8
20:09:31FromDiscord<andi-> oh, wow
20:09:38PMunchThe .. is inclusive. So 0..8 is indexes 0 to 8, ie. 9 bytes
20:10:18FromDiscord<andi-> right, that is why Rust added the `..=` thingy to express this clearer.
20:10:38FromDiscord<andi-> Thanks! I'll try to make some progress now
20:11:07FromDiscord<enthus1ast> Why do you have the pointer in uint8 in the first place?
20:11:21FromDiscord<enthus1ast> Uint8 array I mean
20:12:13FromDiscord<andi-> Because it was mentioned here earlier and that is what I found in some older discourse thread
20:12:28FromDiscord<andi-> I didn't think that I could just cast it on the "spot"
20:13:08NimEventerNew thread by IvanS: Puzzling compiler error (1.4.8 Windows), see https://forum.nim-lang.org/t/8628
20:15:12FromDiscord<enthus1ast> Yes this I get, but what possible could lead to a uint8 array that resembles a pointer
20:16:37PMunchPointers are 8 byte long
20:16:57PMunchSo you could theoretically cast an array of 8 bytes to a pointer
20:17:03PMunchNot sure when that would ever come up though
20:17:32FromDiscord<enthus1ast> Yes I know and have done it aswell
20:17:34PMunchBut I'm guessing that they might have tried something like myArray[]
20:17:52PMunch@enthus1ast, in what scenario did you have to do that?
20:36:36*krux02 joined #nim
20:37:03NimEventerNew Nimble package! scraper - Scraping tools, see https://gitlab.com/lurlo/scraper
20:41:53FromDiscord<retkid> https://media.discordapp.net/attachments/371759389889003532/909543682892505108/unknown.png
20:41:56FromDiscord<retkid> so yea
20:42:03FromDiscord<retkid> something in .close()
21:03:04*xet7 joined #nim
21:17:49FromDiscord<retkid> at around 9000 requests .close() stops working
21:17:57FromDiscord<retkid> maybe its 90008
21:19:06NimEventerNew Nimble package! duckduckgo - Duckduckgo search, see https://gitlab.com/lurlo/duckduckgo
21:33:52*PMunch quit (Quit: leaving)
21:44:30*greaser|q is now known as GreaseMonkey
22:20:49*Vladar quit (Quit: Leaving)
22:55:35*hmmmmm joined #nim
23:27:08*hmmmmm quit ()
23:34:32FromDiscord<andi-> Earlier someone said that arrays are always stack allocated. So the correct way to allocate big chunks of memory is using `newSeq[T](...)`?
23:35:39FromDiscord<Elegantbeef> Correct is subjective and depending on the structure nim would be passing the array by reference anyway
23:37:06FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3F1s for instance
23:37:17FromDiscord<andi-> Yeah, but I am looking at allocating perhaps a few hundred megabyte. That wouldn't fit the stack and would be a dynamic stack allocation (ugh!)
23:38:33FromDiscord<Elegantbeef> I dont know if it's true that "always stack allocated"
23:40:40FromDiscord<Elegantbeef> The manual doesnt mention it so it could just be something always repeated and never checked πŸ˜€
23:40:49FromDiscord<andi-> hah
23:41:07FromDiscord<andi-> I just produced my first segfault with Nim \:D
23:41:08FromDiscord<Elegantbeef> Generally speaking if you need fixed length use array, if you need dynamic use seq
23:41:17FromDiscord<andi-> yeah, I thought as much
23:41:28FromDiscord<impbox [ftsf]> https://forum.nim-lang.org/t/5826 related
23:41:43FromDiscord<Elegantbeef> You also might want to look at a memory file or using a file in general if it's big and dont need it all in memory at once
23:42:12FromDiscord<Elegantbeef> Yea seems it might be a certainty then
23:42:19FromDiscord<impbox [ftsf]> but it'll be implementation specific, it won't be stack allocated on the js backend for example
23:42:26FromDiscord<andi-> I am writing a parser for a file format so not passing it through memory isn't gonna happen
23:42:48FromDiscord<impbox [ftsf]> well you don't necessarily have to have the whole file in memory at the same time
23:42:56FromDiscord<Elegantbeef> A file stream would be perfect here
23:43:24FromDiscord<Elegantbeef> Depending on what you have you read only what you need into memory manage it then continue
23:43:42FromDiscord<Elegantbeef> The parsed data might get large i suppose
23:43:44FromDiscord<andi-> That is what I am doing right now. I might have a few megabytes in memory at a time anyway
23:43:59FromDiscord<Elegantbeef> Ah ok misunderstanding then
23:44:06FromDiscord<andi-> I've written the same parser in Rust and Go before. It is my goto project for learning a new language.
23:44:19FromDiscord<Elegantbeef> I see
23:46:51FromDiscord<impbox [ftsf]> i hope you use lots of goto
23:47:02FromDiscord<Elegantbeef> I hope i can ban impbox eventually
23:50:26FromDiscord<andi-> sent a code paste, see https://play.nim-lang.org/#ix=3F1w
23:51:42FromDiscord<andi-> It works fine in the playground
23:51:58FromDiscord<Elegantbeef> You sure your stream has data?
23:52:41FromDiscord<andi-> Yeah, if it wouldn't I would get an IOError
23:52:50FromDiscord<andi-> and I've put like 30 bytes in there
23:52:57FromDiscord<Elegantbeef> Lol yea it fucks the sequence up
23:53:17FromDiscord<Elegantbeef> https://play.nim-lang.org/#ix=3F1x
23:53:52FromDiscord<Elegantbeef> Ah i see why
23:54:05FromDiscord<Elegantbeef> It writes the data to the ptr not the internal collection πŸ˜€
23:54:22FromDiscord<andi-> I was fearing as much \:\|
23:54:47FromDiscord<Elegantbeef> `readStr` is probably the best
23:55:06FromDiscord<andi-> and String is really a synonym for arbitrary "strings" of bytes in Nim?
23:55:56FromDiscord<Elegantbeef> a `seq[uint8]` is presently internally identical to a `string` except it doesnt have the `\0` element always at the end
23:56:02FromDiscord<andi-> ok
23:56:44FromDiscord<Elegantbeef> You can also do↡`stream.readData(b[0].addr, b.len)`
23:57:16FromDiscord<andi-> readData sounds better. readStr means I'll have to deal with a stray trailing zero byte when converting it to a seq again
23:57:28FromDiscord<Elegantbeef> Nah
23:57:46FromDiscord<Elegantbeef> You can cast string -\> seq[byte] without that `\0` appearing
23:57:50FromDiscord<Elegantbeef> It's purely for C interop
23:58:24FromDiscord<andi-> ok
23:58:49FromDiscord<Elegantbeef> Really though there needs to be support for `read`/`write` sequences
23:59:10FromDiscord<Elegantbeef> writing a sequence writes just the address and reading it returns it, quite pointless