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