00:02:41 | FromDiscord | <millymox> In reply to @elegantbeef "`let result = result.strip`": says it still cant open for me |
00:02:42 | FromDiscord | <millymox> hm |
00:03:11 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4yMP |
00:03:24 | FromDiscord | <millymox> might just use external python code |
00:03:29 | FromDiscord | <millymox> use tkinter for now |
00:04:01 | FromDiscord | <elegantbeef> Jesus |
00:04:46 | FromDiscord | <elegantbeef> Yea that code works fine for me, are you sure you're not getting spurious characters? |
00:05:12 | FromDiscord | <elegantbeef> sent a code paste, see https://play.nim-lang.org/#ix=4yMQ |
00:06:12 | FromDiscord | <elegantbeef> Given that you're using zenity I'd suggest owlkettle |
00:06:21 | FromDiscord | <elegantbeef> It's a nice declarative Nim gui that does have a file dialog |
00:06:41 | FromDiscord | <elegantbeef> Though there is https://github.com/Patitotective/tinydialogs/tree/main |
00:30:04 | FromDiscord | <millymox> In reply to @elegantbeef "Yea that code works": interesting, im on macos, perhaps thats the issue? |
00:35:04 | FromDiscord | <elegantbeef> Perhaps |
00:35:05 | FromDiscord | <millymox> In reply to @elegantbeef "Yea that code works": the file has spaces in it, thats about it |
00:35:09 | FromDiscord | <millymox> shouldn't be an issue though |
00:35:38 | FromDiscord | <elegantbeef> You could do `echo result.toOpenArrayByte(0, result.len)` |
00:35:46 | FromDiscord | <elegantbeef> then ensure there are no odd characters |
00:37:04 | FromDiscord | <elegantbeef> `result.high` |
00:37:44 | FromDiscord | <millymox> still doesn't work |
00:37:44 | FromDiscord | <millymox> hm |
00:38:01 | FromDiscord | <elegantbeef> Well it's not going to make it work it's to ensure there are no wrong characters |
00:38:14 | FromDiscord | <elegantbeef> Well it's going to show you if there are no wrong characters |
00:38:26 | FromDiscord | <millymox> ah well yeah, even extrenal python code doens't work. Is there something wrong with open() on macos? |
00:38:34 | FromDiscord | <elegantbeef> Perhaps |
00:38:35 | FromDiscord | <millymox> i can't even open a txt called hey.txt |
00:38:38 | FromDiscord | <millymox> no spaces |
00:38:52 | FromDiscord | <elegantbeef> Perhaps it's a locale issue? I don't really know |
00:39:12 | FromDiscord | <elegantbeef> Do you not have permissions for the file you're attempting to open? |
00:39:28 | FromDiscord | <millymox> i should have permissions, its in download folder, perhaps try sudo? |
00:41:35 | FromDiscord | <millymox> escalating perms to sudo does not work |
00:42:35 | FromDiscord | <elegantbeef> so does `zenity` return an incorrect string? |
00:42:43 | FromDiscord | <elegantbeef> Might have some non printed characters |
00:43:04 | FromDiscord | <elegantbeef> oh wait you said you just did `open("test.txt")`? |
00:43:44 | FromDiscord | <millymox> hey.txt. It seems to be maybe an issue weith directory paths?? cuz i can do it if its in my directory bhut anything outside its a no |
00:44:26 | FromDiscord | <elegantbeef> This sounds a lot like some permission issue, but given you used sudo it's quite odd |
00:44:49 | FromDiscord | <millymox> yes i did sudo ./main |
01:04:23 | FromDiscord | <millymox> how to go about threacding in nim? |
01:24:04 | FromDiscord | <michaelb.eth> In reply to @millymox "how to go about": it depends on what you're trying to do, can be a pain-point with Nim |
01:25:18 | FromDiscord | <michaelb.eth> if you look back through the `#internals` channel on this discord you'll see there's been a lot of discussion in recent weeks+ |
01:25:29 | FromDiscord | <michaelb.eth> related to multi-threading, I mean |
01:59:29 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4yN1 |
01:59:31 | FromDiscord | <millymox> the second part of my code is not being reached |
01:59:44 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4yN2 |
01:59:48 | FromDiscord | <millymox> echo checking never gets outputted |
02:00:31 | FromDiscord | <huantian> You might consider using async instead of threading if your task is io bound like http requests |
02:00:34 | FromDiscord | <elegantbeef> You don't return anything i read proxies |
02:00:49 | FromDiscord | <millymox> In reply to @huantian "You might consider using": example? |
02:01:12 | FromDiscord | <elegantbeef> implicit result |
02:01:13 | FromDiscord | <elegantbeef> sent a code paste, see https://paste.rs/FfIAg |
02:01:21 | FromDiscord | <elegantbeef> That's a much more idiomatic version and closes teh file handle |
02:01:53 | FromDiscord | <michaelb.eth> implicit result 😱 |
02:01:59 | FromDiscord | <michaelb.eth> 🙀 even |
02:02:07 | FromDiscord | <elegantbeef> Yea people that don't work at status use them |
02:02:15 | FromDiscord | <michaelb.eth> anyway, mummy might be worth a look: https://github.com/guzba/mummy |
02:02:22 | FromDiscord | <michaelb.eth> for @millymox I mean |
02:03:18 | FromDiscord | <millymox> In reply to @michaelb.eth "anyway, mummy might be": can i send requests with it |
02:03:21 | FromDiscord | <millymox> or just routes? |
02:03:58 | FromDiscord | <michaelb.eth> I'm not sure, haven't used it myself, I just recall that the author had/has a focus on making it work well re: how threading works in Nim |
02:05:06 | FromDiscord | <millymox> In reply to @michaelb.eth "I'm not sure, haven't": ask far as i can see its just a library for handeling req, like backend stuff |
02:05:10 | FromDiscord | <millymox> ill take a look at the code though |
02:05:17 | FromDiscord | <elegantbeef> It's for backend |
02:05:20 | FromDiscord | <michaelb.eth> you want proxy middleware, that kind of thing? |
02:05:37 | FromDiscord | <michaelb.eth> ah yeah, duh, I see proxy in your code above |
02:05:53 | FromDiscord | <millymox> i just want a http library that isn't the standard library that supports proxies |
02:06:23 | FromDiscord | <elegantbeef> Why not the stdlib? |
02:06:57 | FromDiscord | <millymox> In reply to @elegantbeef "Nim has an implicit": Thank you but how do i return the proxies so i can use them? |
02:09:08 | FromDiscord | <millymox> its okay got it |
02:10:50 | FromDiscord | <elegantbeef> What do you mean how do you return them, it r eturns them |
02:11:38 | FromDiscord | <millymox> its why i said its okay i was being stupid |
02:16:34 | FromDiscord | <millymox> In reply to @elegantbeef "Why not the stdlib?": nothing im just in a shit mood lmao |
02:16:49 | FromDiscord | <millymox> Im loving nim so far though |
02:19:39 | * | oldpcuser quit (Remote host closed the connection) |
02:20:25 | * | oldpcuser joined #nim |
02:21:00 | * | oldpcuser quit (Remote host closed the connection) |
02:21:26 | * | oldpcuser joined #nim |
02:24:04 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4yN7 |
02:39:33 | FromDiscord | <elegantbeef> You arent closing the client |
02:39:39 | FromDiscord | <elegantbeef> defer: client.close() |
02:40:25 | FromDiscord | <millymox> In reply to @elegantbeef "defer: client.close()": where am i too place this? |
02:40:33 | FromDiscord | <elegantbeef> After opening the client |
02:40:41 | FromDiscord | <elegantbeef> Like i showed with the file |
02:40:44 | FromDiscord | <millymox> https://media.discordapp.net/attachments/371759389889003532/1121268505673732186/Screenshot_2023-06-21_at_8.40.40_PM.png |
02:40:58 | FromDiscord | <millymox> i get the same error: Bad file descriptor |
02:42:00 | FromDiscord | <elegantbeef> Also you're using threads for no reason, this is an async problem |
02:42:19 | FromDiscord | <elegantbeef> How many proxies do you have, could be hiting a file descriptor limit |
02:42:43 | FromDiscord | <millymox> In reply to @elegantbeef "How many proxies do": 11k proxies |
02:42:49 | FromDiscord | <millymox> 11,000 |
02:47:50 | FromDiscord | <elegantbeef> Yea you likely need to do fewer at once |
02:50:39 | FromDiscord | <michaelb.eth> I'd suggest trying it with chronos on a single thread |
02:50:54 | FromDiscord | <elegantbeef> any async solution 😄 |
02:50:59 | FromDiscord | <elegantbeef> or CPS |
02:51:09 | FromDiscord | <michaelb.eth> the event loop may get bottled up, but you won't know until you try |
02:51:18 | FromDiscord | <michaelb.eth> (edit) "bottled" => "backed" |
02:51:25 | FromDiscord | <elegantbeef> I assume you'd still need to chunk it |
02:51:30 | FromDiscord | <millymox> In reply to @michaelb.eth "I'd suggest trying it": link? |
02:51:34 | FromDiscord | <huantian> Make like a queue system |
02:51:35 | FromDiscord | <millymox> to chrons |
02:51:37 | FromDiscord | <elegantbeef> 11k requests + async is likely to eat descriptions |
02:51:39 | FromDiscord | <millymox> chronoes |
02:51:46 | FromDiscord | <huantian> Or do what did and use callbacks in a omega jank way |
02:52:10 | FromDiscord | <michaelb.eth> https://github.com/status-im/nim-chronos↵you want apps/httpclient↵https://github.com/status-im/nim-chronos/tree/master/chronos/apps/http |
02:52:22 | FromDiscord | <michaelb.eth> (edit) "apps/httpclient↵https://github.com/status-im/nim-chronos/tree/master/chronos/apps/http" => "apps/http/httpclient, I think↵https://github.com/status-im/nim-chronos/tree/master/chronos/apps/http" |
02:53:16 | FromDiscord | <michaelb.eth> just note that chronos event loop and std/asyncdispatch event loop can't run in the same thread, i.e. don't try to mix and match chronos stuff with std/asyncdispatch stuff |
02:53:53 | FromDiscord | <millymox> okay thank you |
02:55:07 | FromDiscord | <huantian> Is there a reason to use chronos over stdlib async client |
02:55:16 | FromDiscord | <elegantbeef> Not really unless you care about cycles |
02:55:21 | FromDiscord | <elegantbeef> It also uses bearssl |
02:55:25 | FromDiscord | <elegantbeef> chronos that is |
02:55:43 | FromDiscord | <elegantbeef> Statically linked makes it easy to ship on winblows |
02:55:54 | FromDiscord | <michaelb.eth> In reply to @huantian "Is there a reason": well, chronos is being used in production at scale with a lot of $$ on the line, can the same be said of std/asyncdispatch? |
02:56:17 | FromDiscord | <elegantbeef> That's a pointless argument for "why" |
02:56:23 | FromDiscord | <michaelb.eth> not that that proves anything, just that it's an indicator that it's solid if it's being used correctly |
02:59:04 | * | pbsds quit (Quit: The Lounge - https://thelounge.chat) |
02:59:38 | * | pbsds joined #nim |
03:22:25 | FromDiscord | <michaelb.eth> eh, actually, malebolgia has a "crawler" test/example, maybe could work for you if you're okay using build of Nim's `devel` branch: https://github.com/Araq/malebolgia/blob/master/tests/tcrawler.nim |
03:23:02 | FromDiscord | <michaelb.eth> no async stuff, just malebolgia's approach to coordinating multi-threaded stuff |
03:23:10 | FromDiscord | <michaelb.eth> (edit) "multi-threaded stuff" => "multiple threads" |
03:23:27 | FromDiscord | <michaelb.eth> whoops, wrong chat context:D |
03:57:26 | NimEventer | New thread by dwhall256: Nim merch, see https://forum.nim-lang.org/t/10291 |
04:10:52 | termer | How can I create a ref type for an array literal? |
04:10:55 | termer | I can't figure it out |
04:25:42 | FromDiscord | <elegantbeef> write a `proc new[T](val: sink T): ref T = new result; result[] = val` |
05:18:21 | * | ntat joined #nim |
05:29:06 | * | rockcavera quit (Remote host closed the connection) |
05:35:56 | termer | oh right |
05:36:56 | * | azimut quit (Ping timeout: 240 seconds) |
06:07:17 | FromDiscord | <acek7> Whats up everyone |
06:21:37 | * | PMunch joined #nim |
06:39:27 | FromDiscord | <huantian> Hello gamers |
07:17:38 | termer | good morning gamers |
08:09:23 | FromDiscord | <gogolxdong666> Anyone list nimbus in this comparing https://media.discordapp.net/attachments/371759389889003532/1121351210721611807/6622b625c34232f710156dbd39a757cc_.jpg |
08:13:57 | * | beholders_eye joined #nim |
08:36:48 | * | oldpcuser_ joined #nim |
08:38:59 | * | oldpcuser quit (Ping timeout: 240 seconds) |
08:45:33 | FromDiscord | <mratsim> In reply to @gogolxdong666 "Anyone list nimbus in": Thisbis a comparison of execution clients, Nimbus-eth1 (execution client) is not ready for prime time.↵↵Nimbus-eth2 (consensus client) is |
09:07:30 | * | oldpcuser_ quit (Ping timeout: 240 seconds) |
09:33:31 | FromDiscord | <fabricio> so I'm still a bit confused about the copying semantics in Nim for strings and seqs. if I pass a string/seq to a function as a value but I don't mutate it inside the function, will thedata be duplicated and a new string/seq will be created to be passed, or same data will the be reused |
09:41:08 | FromDiscord | <graveflo> looks like it doesn't copy when I try it |
09:53:38 | PMunch | fabricio, Nim is smart enough to know that if you pass a seq to a procedure which isn't allowed to mutate it it will be safe to do so by pointer. So under the hood it passes a pointer in |
10:17:24 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4yOd |
10:17:58 | FromDiscord | <heysokam> (edit) "https://play.nim-lang.org/#ix=4yOd" => "https://paste.rs/rxUSb" |
10:22:30 | FromDiscord | <heysokam> @demotomohiro know anything about this? ^↵i'm reading your guide on it, but it seems like the .py script is missing in my system 🤔 |
10:23:50 | FromDiscord | <intellj_gamer> Are you using devel? The gdb script was recently moved↵Maybe choosenim hasn't updated that 🤔 |
10:24:17 | FromDiscord | <heysokam> 1.6.12 |
10:24:28 | FromDiscord | <intellj_gamer> oh weird,↵You could download this file and put it there https://github.com/nim-lang/Nim/blob/devel/tools/debug/nim-gdb.py |
10:25:05 | FromDiscord | <heysokam> thats very useful, ty! |
10:44:24 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4yOB |
10:45:20 | FromDiscord | <heysokam> (edit) "https://play.nim-lang.org/#ix=4yOB" => "https://play.nim-lang.org/#ix=4yOC" |
10:53:59 | FromDiscord | <heysokam> is there a better way to debug nim code than this?↵i cannot even find the variables i need to search for 😔 |
11:08:42 | FromDiscord | <demotomohiro> In reply to @heysokam "well, maybe not. i": Did you ru nim-gdb or load nim-gdb.py with `source Nim/tools/debug/nim-gdb.py`? |
11:09:01 | FromDiscord | <heysokam> nim-gdb |
11:09:41 | FromDiscord | <heysokam> seems like the nim-gdb binary was in my system, but not the script |
11:11:35 | FromDiscord | <demotomohiro> If you set a value to a variable but didn't use it, Nim might remove that variable and you cannot find it on debugger. |
11:12:11 | FromDiscord | <heysokam> i tried with `break myfile.nim:num` and it didnt' find the file |
11:12:34 | FromDiscord | <heysokam> didn't even try setting a variable name, since i don't know exactly the variable name im looking for (or else i wouldn't need the debugger) |
11:13:00 | FromDiscord | <heysokam> usually, in C, i step through it close enough so that i can find where im going or how to stop it close enough |
11:13:21 | FromDiscord | <heysokam> but here i cannot find anything, because its all mangled 😦↵thought that the nim-gdb thing would help with that |
11:13:34 | FromDiscord | <odexine> Did you compile with debugger symbiks |
11:13:37 | FromDiscord | <odexine> Symbols |
11:13:40 | FromDiscord | <heysokam> of course |
11:13:48 | FromDiscord | <odexine> How did you do so exactly |
11:13:51 | FromDiscord | <demotomohiro> `--debugger:native` |
11:14:12 | FromDiscord | <heysokam> i believe i had that by default, but let me recheck in case i didn't |
11:14:30 | FromDiscord | <odexine> Nim doesn’t do that by default so I assume you mean you put it in a config file |
11:14:45 | FromDiscord | <heysokam> yeah i do it in my config |
11:14:56 | FromDiscord | <heysokam> it was commented out though ⚰️ |
11:17:19 | FromDiscord | <heysokam> oh i can see the code now! ty, that was me being a dummy 🙏 |
11:45:20 | FromDiscord | <fabricio> In reply to @PMunch "<@607600292086939696>, Nim is smart": okay but what if a function takes a large object as param by value that doesn't get mutated and I have a ref or a ptr to one of those objects. if I dereference that ptr/ref so I can pass it as a value to the function, will the compiler be smart enough to not do the deref and pass the ptr/ref directly under the hood |
11:46:32 | PMunch | That's an interesting question, but I believe it should still pass that by reference (a pointer) |
12:05:47 | FromDiscord | <demotomohiro> In reply to @fabricio "okay but what if": If you care that, you can read generated C code in Nim cache directory. |
12:06:10 | FromDiscord | <jmgomez> Also `bycopy` and `byref` exists |
12:16:04 | FromDiscord | <fabricio> In reply to @jmgomez "Also `bycopy` and `byref`": oh cool didn't know that thanks |
12:22:07 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4yOP |
12:23:54 | FromDiscord | <jmgomez> demo, if you do `exportc` it will be easier to follow as it doesnt mangle |
12:23:59 | FromDiscord | <demotomohiro> You don't need to use `bycopy` or `byref` pragma unless you are calling C/C++ functions.↵Nim passes arguments optimal way and you don't need to optimize them yourself. |
12:28:20 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4yOR |
12:29:28 | FromDiscord | <demotomohiro> Anyway, there is no code that copy `BigObj`. |
12:33:27 | FromDiscord | <jmgomez> The type can also have it 😛 |
12:34:19 | FromDiscord | <jmgomez> Yeah, IIRC `array[24, byte]` would be copied but `array[25, byte]` wouldnt |
12:34:27 | FromDiscord | <jmgomez> (in most platforms) |
12:34:52 | PMunch | The magic size is 3*sizeof(float) IIRC |
12:35:00 | FromDiscord | <jmgomez> exactly |
12:51:46 | PMunch | Hmm, I'm getting false for fileExists on files that definitely exists |
12:53:21 | FromDiscord | <demotomohiro> Maybe it doesn't have permission to access the file or parent directly? |
12:53:52 | PMunch | Ah, never mind.. |
12:54:13 | PMunch | I was pulling stuff from environment variables, and I had set them as strings in quotes.. |
12:54:21 | PMunch | So it wasn't looking for myfile it was looking for "myfile" |
13:24:58 | * | rockcavera joined #nim |
13:34:22 | * | beholders_eye quit (Ping timeout: 245 seconds) |
13:53:41 | * | beholders_eye joined #nim |
14:08:21 | * | PMunch quit (Quit: Leaving) |
14:28:24 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4yPn |
14:55:52 | * | azimut joined #nim |
15:03:24 | FromDiscord | <Andreas> i have smth very disturbing here : https://play.nim-lang.org/#ix=4yPw↵When run with `nim -d:useMalloc` the locations 4..6 get scambled ? When rin with `nim r` everything is fine ? |
15:03:37 | FromDiscord | <Andreas> (edit) "rin" => "run" |
15:06:39 | FromDiscord | <arnetheduck> In reply to @Andreas "i have smth very": switch to `allocShared` - `createShared(T, n)` = `malloc(sizeof(T)n)` and `sizeof(T) == 0` in your example |
15:08:32 | * | beholders_eye quit (Ping timeout: 240 seconds) |
15:11:02 | * | beholders_eye joined #nim |
15:11:12 | FromDiscord | <Andreas> In reply to @arnetheduck "switch to `allocShared` -": thx, that helps |
15:19:46 | * | rockcavera quit (Remote host closed the connection) |
15:23:17 | * | beholders_eye quit (Quit: WeeChat 3.6) |
15:34:46 | arkanoid | what is a c++ class from importcpp standpoint? an object type? |
15:36:33 | FromDiscord | <fabricio> In reply to @demotomohiro "Here is example code:": it is calling it with `(&(x)), x`, which answers my question that nim doesn't skip the dereference and pass the pointer directly, it is copying and passing the pointer of the copy |
15:41:22 | FromDiscord | <mratsim> In reply to @fabricio "it is calling it": hat should be optimized away by tghe C compiler |
15:41:32 | FromDiscord | <mratsim> (edit) "hat" => "that" | "tghe" => "the" |
15:44:30 | FromDiscord | <demotomohiro> In reply to @fabricio "it is calling it": `x` dereference the pointer but doesn't mean copy it. |
15:48:58 | FromDiscord | <ieltan> Probably a dumbass question:↵Are circular references "recursive" ? I have a case where I have T1 which is a ref type that has a field which is a table of T2 where T2 is a ref type that has a field which is T1 |
15:49:14 | FromDiscord | <ieltan> That was a mouthful... |
15:55:06 | FromDiscord | <demotomohiro> sent a code paste, see https://paste.rs/zKw2x |
15:55:22 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4yPP |
15:57:38 | FromDiscord | <demotomohiro> So `var x` become rax on assembly code, `testProcCallee` is inlined inside `testProcCallee`.↵rax is just copied to rbx and rdi and stringified with `dollar_testproc_106`. |
15:58:42 | FromDiscord | <odexine> In reply to @ieltan "Probably a dumbass question:": what does recursive mean here |
15:59:26 | FromDiscord | <demotomohiro> https://en.wikipedia.org/wiki/X86_calling_conventions#System_V_AMD64_ABI↵In System V AMD64 ABI calling convention, Integer/Pointers are passed with register "RDI, RSI, RDX, RCX, R8, R9". |
16:01:53 | FromDiscord | <demotomohiro> In reply to @ieltan "Probably a dumbass question:": I think that can create circular references and `--mm:arc` doesn't work and you need `--mm:orc`. |
16:02:29 | FromDiscord | <ieltan> In reply to @odexine "what does recursive mean": Sorry it's the wrong word I think I figured it out |
16:02:49 | FromDiscord | <ieltan> In reply to @demotomohiro "I think that can": Yeah my bad sorry I got it now |
16:06:17 | * | rockcavera joined #nim |
16:09:23 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4yPV |
16:09:39 | FromDiscord | <odexine> nim does not have classes inbuilt |
16:10:05 | FromDiscord | <millymox> okay so what is the alternative? |
16:10:12 | FromDiscord | <millymox> what is the equivelent |
16:10:21 | FromDiscord | <odexine> discord crashed while i was typing |
16:10:33 | FromDiscord | <odexine> you need to install a 3rd party library like `classes` |
16:10:35 | FromDiscord | <millymox> oh lmao |
16:10:43 | FromDiscord | <millymox> nimble install classes? |
16:11:27 | FromDiscord | <millymox> oh my just took a look at it |
16:11:31 | FromDiscord | <millymox> thanks so much |
16:11:31 | FromDiscord | <millymox> lmao |
16:11:43 | FromDiscord | <jmgomez> but likely you wont need it |
16:12:45 | FromDiscord | <jmgomez> Nim has UFCS meaning the first argument can be treated as `self` |
16:15:15 | FromDiscord | <fabricio> In reply to @demotomohiro "Generated assembly code for": it's not really about the assembly, more about for the C codegen, trying to see if the nim compiler is smart enough to do what I asked, `x` is dereference and maybe it gets optimized by the C compiler, I was trying to see if the nim compiler would pass it directly as `x`, anyway thanks, I appreciate the effort |
16:20:35 | FromDiscord | <demotomohiro> In reply to @millymox "oh lmao": Nimmers just define object or ref object types and define procedures that take it as first parameter. |
16:24:13 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4yPZ |
16:24:54 | FromDiscord | <millymox> In reply to @demotomohiro "Nimmers just define object": Thanks! |
16:24:58 | FromDiscord | <millymox> Yes im doing this |
16:25:04 | FromDiscord | <millymox> In reply to @jmgomez "Nim has UFCS meaning": I see okay okay |
16:30:33 | * | azimut quit (Remote host closed the connection) |
16:30:36 | FromDiscord | <odexine> most of us dont use the word "self" since theyre not bound to classes (it gets confusing real quick) |
16:30:43 | FromDiscord | <millymox> how do i add a json body to a req? using std lib |
16:30:45 | FromDiscord | <odexine> we use lowercased class name |
16:31:00 | FromDiscord | <millymox> In reply to @odexine "most of us dont": Ahhh |
16:31:28 | FromDiscord | <odexine> In reply to @millymox "how do i add": json body in what format? json module? make it a string with the $ proc `$theJson` and send that |
16:32:19 | * | azimut joined #nim |
16:32:21 | * | jmdaemon joined #nim |
16:32:46 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4yQ3 |
16:33:42 | FromDiscord | <odexine> postContent 3rd argument is of type `string` so just put the json as a string, i am not sure what library you are using for json |
16:34:33 | FromDiscord | <millymox> In reply to @odexine "postContent 3rd argument is": i am not using a library for json i didn't know i needed one, completely new to this so i apologize for my ignorance |
16:35:19 | FromDiscord | <millymox> what library do you reccomend? |
16:35:21 | FromDiscord | <odexine> well some need one some dont, if you just want to simply send the json "{"api_key": "key"}" as is without needing to manipulate it you can always manually construct the string like this↵`"{\"api_key\": \"key\"}"` |
16:36:01 | FromDiscord | <odexine> you will want to set the headers `client.headers = newHttpHeaders({ "Content-Type": "application/json" })` |
16:36:10 | FromDiscord | <odexine> before sending the post |
16:36:30 | FromDiscord | <millymox> Thank you so much okay i got it! |
16:38:45 | FromDiscord | <millymox> In reply to @odexine "well some need one": {"balance":4.7868,"errorId":0,"errorCode":null,"errorDescription":null}↵↵how would i go about parsing the balance of this response? |
16:39:00 | FromDiscord | <odexine> okay so this is where the json library comes in |
16:39:11 | FromDiscord | <millymox> okay okay what do you suggest |
16:39:18 | FromDiscord | <odexine> https://nim-lang.org/docs/json.html is the basic standard library json library |
16:39:28 | FromDiscord | <odexine> there are others but i think for now you should start with this |
16:39:39 | FromDiscord | <odexine> see the docs for more information |
16:39:46 | FromDiscord | <odexine> it shouldnt be too difficult |
16:41:24 | FromDiscord | <millymox> awesome thank you taking a look right now |
16:44:24 | FromDiscord | <millymox> sent a long message, see http://ix.io/4yQ5 |
16:44:40 | FromDiscord | <odexine> what are you trying to do? |
16:44:45 | FromDiscord | <odexine> like what is it you want to do |
16:44:55 | FromDiscord | <millymox> get the "balance" and assign it to a variable and echo it |
16:45:11 | FromDiscord | <millymox> get the value of the key balance and assign it to the balance variable and then echo balance |
16:46:34 | FromDiscord | <odexine> `let balance = jsonNode["balance"]` doesnt have the echo part, and this gives you a json node (you have to convert it to the appropriate primitive type like integer or string) |
16:47:17 | FromDiscord | <odexine> with the conversion `let balance = jsonNode["balance"].getFloat` |
16:48:38 | FromDiscord | <millymox> In reply to @odexine "with the conversion `let": Thank you this works, i appreciate the help |
16:49:27 | FromDiscord | <millymox> i see for some reason an unnecessary new line, anyway to get rid of this? https://media.discordapp.net/attachments/371759389889003532/1121482091473940570/Screenshot_2023-06-22_at_10.49.22_AM.png |
16:51:47 | FromDiscord | <michaelb.eth> In reply to @millymox "awesome thank you taking": there's also jsony: https://github.com/treeform/jsony↵↵as Rika said, std/json is a good place to start and figure things out; later, if you have a perf issue processions thousands of json concurrently (recalling from last night you're processing 10k+ requests or something like that), you can try switching to json for a perf boost |
16:52:26 | FromDiscord | <millymox> In reply to @michaelb.eth "there's also jsony: https://github.com/treeform/jso": Okay great thank you, i have to ask: who is treeform? I see a lot of things made by him, is this a company, or person or? |
16:52:30 | FromDiscord | <heysokam> In reply to @millymox "how do i assign": `assert condition, message` means:↵> hey computer, make sure that this condition im giving you is true, but fail and output the message when its false. also, ignore it in release mode`↵`doAssert condition, message` means the same, but it will be done even in release mode |
16:52:46 | FromDiscord | <heysokam> (edit) "In reply to @millymox "how do i assign": `assert condition, message` means:↵> hey computer, make sure that this condition im giving you is true, but fail and ... output" added "crash the application and" |
16:53:17 | FromDiscord | <michaelb.eth> In reply to @millymox "Okay great thank you,": just another Nim coder as far as I know |
16:53:31 | FromDiscord | <millymox> In reply to @heysokam "`assert condition, message` means:": can you give me an example? With numbers maybe so i can better visualize |
16:53:38 | FromDiscord | <millymox> In reply to @michaelb.eth "just another Nim coder": ahh okay |
16:55:08 | FromDiscord | <heysokam> In reply to @millymox "can you give me": search assert in here. there are a million and one examples all around the code examples for each section:↵https://nim-lang.org/docs/manual.html |
16:55:09 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4yQc |
16:55:22 | FromDiscord | <heysokam> In reply to @millymox "so like you can": yeah |
16:55:41 | FromDiscord | <heysokam> the condition is just any boolean you want |
16:55:54 | FromDiscord | <heysokam> In reply to @millymox "so like you can": well, actually, no thats not valid |
16:55:59 | FromDiscord | <heysokam> 4 + asdfasdf is not a boolean |
16:56:23 | FromDiscord | <heysokam> `doAssert 4+asdfwerlkjadf > 1, "failed"` would be a boolean |
16:56:56 | FromDiscord | <heysokam> `doAssert true, "failed"` is also valid code, that will of course never trigger |
16:57:34 | FromDiscord | <heysokam> (edit) ">" => "==" |
17:00:40 | FromDiscord | <millymox> Ahhhh okay i get it now |
17:01:35 | FromDiscord | <millymox> how to concatenate variables?↵↵ let res = req.post("https://api.capmonster.cloud/getBalance", "{\"clientKey\": \"{api_key}\"}") |
17:01:40 | FromDiscord | <millymox> let api_key = client.api_key |
17:03:20 | FromDiscord | <k0ts> if you want interpolation try strformat: https://nim-lang.org/docs/strformat.html |
17:03:33 | FromDiscord | <spotlightkid> You can watch some of his presentations from past Nim online conferences on the Nim YouTube channel.↵(@millymox) |
17:19:49 | FromDiscord | <heysokam> sent a code paste, see https://play.nim-lang.org/#ix=4yQh |
17:20:07 | FromDiscord | <Phil> Generally when it comes to strings I highly recommend strformat. It's equivalent to what f-strings are in python and template-strings in JS. I really like this kind of string interpolation.↵You can use either `&` or `fmt` (if & seems to cryptic) |
17:20:15 | FromDiscord | <Phil> (edit) "to" => "too" |
17:20:41 | FromDiscord | <heysokam> if you have two strings, you just do `string1 & string2` |
17:31:14 | FromDiscord | <voidwalker> https://github.com/nim-lang/Nim/blob/d137a3b52af1a83cd9617e47b63d7b3d6c4d935b/lib/pure/httpclient.nim#L1066 - can anyone explain where the user-agent header is set if not here ? |
17:31:46 | FromDiscord | <voidwalker> because I don't understand why it's lowercase in the request itself : `user-agent:` |
17:31:50 | FromDiscord | <Zoom> Don't forget there's also `&=`/`add` for in-place append to `var string` |
17:39:00 | FromDiscord | <voidwalker> same thing for `content-length`. maybe there's something that makes them lowercase? |
17:42:22 | FromDiscord | <odexine> yes |
17:42:28 | FromDiscord | <odexine> nim lowercases all headers |
17:42:40 | FromDiscord | <odexine> it is in http spec that headers are case insensitive |
17:44:00 | FromDiscord | <millymox> how to use strfomat for something like this?↵↵HcaptchaTaskProxyless |
17:44:05 | FromDiscord | <millymox> {{"clientKey": "{}", "task": {{"type":"HcaptchaTaskProxyless","websiteURL":"{}","websiteKey":"{}"}}}} |
17:44:41 | FromDiscord | <millymox> let payloadStr = "{\"clientKey\": \"{}\", \"task\": {\"type\":\"HcaptchaTaskProxyless\",\"websiteURL\":\"{}\",\"websiteKey\":\"{}\"}}" |
17:49:00 | FromDiscord | <Phil> What are the parts you want to have placeholder in? |
17:53:17 | FromDiscord | <ricky> In reply to @odexine "it is in http": that spec is cursed\r\n\r\n |
17:56:35 | FromDiscord | <odexine> In reply to @.rictus "that spec is cursed\r\n\r\n": yeah, but oh well |
17:56:38 | FromDiscord | <odexine> what can we do about it |
17:57:22 | FromDiscord | <demotomohiro> `strformat.fmt` allows to use ``openChar`` instead of '{' and ``closeChar`` instead of '}':↵https://nim-lang.org/docs/strformat.html#fmt.m%2Cstaticstring%2Cstaticchar%2Cstaticchar |
17:59:44 | * | rockcavera quit (Remote host closed the connection) |
18:00:18 | FromDiscord | <voidwalker> In reply to @odexine "nim lowercases all headers": where does this happen please ? I know they're case insensitive, but for some purposes this might matter (like fingerprinting) |
18:00:34 | FromDiscord | <voidwalker> I wanna pretend i'm wget, but I give wrongly cased headers, busted |
18:03:01 | FromDiscord | <jmgomez> sent a code paste, see https://play.nim-lang.org/#ix=4yQq |
18:13:15 | FromDiscord | <odexine> @voidwalker https://github.com/nim-lang/Nim/blob/version-1-6/lib/pure/httpcore.nim#L139 |
18:13:25 | * | rockcavera joined #nim |
18:13:27 | FromDiscord | <odexine> you can set it to not |
18:13:27 | FromDiscord | <voidwalker> oh I was looking in the wrong file, thanks |
18:13:49 | FromDiscord | <odexine> well, "not" |
18:13:52 | FromDiscord | <voidwalker> btw, is there any way to order the http headers ? |
18:14:08 | FromDiscord | <odexine> In reply to @odexine "well, "not"": it wont keep the original format but it will title case it |
18:14:15 | FromDiscord | <odexine> In reply to @voidwalker "btw, is there any": not with httpcore |
18:14:18 | FromDiscord | <odexine> that info is lost |
18:14:24 | FromDiscord | <odexine> it uses a table after all |
18:15:00 | FromDiscord | <odexine> if you want to act exactly like wget its likely best to bind wget instead of acting |
18:19:23 | FromDiscord | <voidwalker> so it should use an ordered table to keep that info ? |
18:23:40 | * | oldpcuser joined #nim |
18:26:33 | FromDiscord | <odexine> you can patch the file with a custom version https://nim-lang.org/docs/nimscript.html#patchFile%2Cstring%2Cstring%2Cstring |
18:26:40 | FromDiscord | <odexine> In reply to @voidwalker "so it should use": you could do that yeah |
18:30:59 | * | oldpcuser quit (Ping timeout: 240 seconds) |
18:36:39 | * | jmdaemon quit (Ping timeout: 250 seconds) |
18:42:18 | FromDiscord | <JJ> why is `type A = object[x: int]` not supported? |
18:42:31 | * | jmdaemon joined #nim |
18:44:30 | FromDiscord | <Andreas> sent a code paste, see https://play.nim-lang.org/#ix=4yQF |
18:46:36 | FromDiscord | <odexine> i dont think theres a reason other than "araq thought not to support it"? |
18:46:59 | * | jmdaemon quit (Ping timeout: 246 seconds) |
18:48:44 | FromDiscord | <jmgomez> In reply to @omentic "why is `type A": What would differ from `type A[x: int] = object` ? |
18:49:24 | FromDiscord | <odexine> In reply to @jmgomez "What would differ from": i think it is meant to emulate how tuples can be defined |
18:49:30 | FromDiscord | <odexine> where the runtime fields go in [] |
18:50:19 | FromDiscord | <JJ> yeah, pretty much |
18:50:37 | FromDiscord | <jmgomez> hmm what about ↵` RuntimeStruct = seq[(string, RuntimeField)]` |
18:50:58 | FromDiscord | <jmgomez> (without `string` if you dont want named pairs) |
18:50:58 | FromDiscord | <JJ> thinking about this wrt. the adts proposal basically. named tuples are good enough though |
18:55:03 | FromDiscord | <odexine> In reply to @jmgomez "hmm what about ": i mean runtime value fields, not runtime defined field |
18:55:04 | FromDiscord | <odexine> (edit) "field" => "fields" |
19:43:26 | * | oldpcuser joined #nim |
20:33:10 | * | xet7 quit (Ping timeout: 265 seconds) |
20:46:09 | * | Guest99 joined #nim |
21:03:14 | FromDiscord | <bostonboston> Is there a nice way to turn an enum into a list of strings, assuming the enum has holes |
21:03:27 | FromDiscord | <bostonboston> I want the strings to be the names not the values |
21:07:07 | * | xet7 joined #nim |
21:07:38 | NimEventer | New thread by przemyslawo: Does Nim has the same features that D has when interfacing to Objective-C?, see https://forum.nim-lang.org/t/10292 |
21:11:05 | FromDiscord | <Elegantbeef> Not really a Macro is pretty much the only way↵(@bostonboston) |
21:11:21 | FromDiscord | <bostonboston> Figured |
21:12:01 | FromDiscord | <Elegantbeef> There is `items` defined inside enumutils but it doesnt always work |
21:12:26 | FromDiscord | <millymox> In reply to @jmgomez "@mox you likely want": what library does this use? |
21:12:38 | FromDiscord | <Elegantbeef> `std/strutils` |
21:12:40 | FromDiscord | <Elegantbeef> whoops |
21:12:43 | FromDiscord | <Elegantbeef> `std/json` |
21:12:51 | FromDiscord | <Elegantbeef> `std/jsonutils` |
21:13:16 | FromDiscord | <millymox> attempting to call undeclared routine: 'jsonTo'↵expression '' has no type (or is ambiguous) |
21:13:21 | FromDiscord | <millymox> var foo = jsonStr.parseJson.jsonTo(Foo) |
21:13:28 | FromDiscord | <Elegantbeef> `impor std/[json, jsonutils]` |
21:13:39 | FromDiscord | <huantian> that's a lot of libraries beef |
21:13:48 | FromDiscord | <Elegantbeef> Yep |
21:14:23 | FromDiscord | <Elegantbeef> Atleast 2 |
21:16:08 | FromDiscord | <millymox> sent a long message, see http://ix.io/4yR3 |
21:16:25 | FromDiscord | <Elegantbeef> Make a typedef for your `task` |
21:16:27 | * | Guest99 quit (Quit: Client closed) |
21:16:41 | FromDiscord | <millymox> not sure what you mean |
21:17:32 | FromDiscord | <millymox> this |
21:17:33 | FromDiscord | <millymox> sent a long message, see http://ix.io/4yR5 |
21:17:41 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/W5V4T |
21:18:34 | FromDiscord | <Elegantbeef> then you can use `toJson` and `jsonTo` |
21:21:50 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4yR8 |
21:30:36 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4yR9 |
21:31:17 | FromDiscord | <Elegantbeef> either `import std/json` or `export json` |
21:33:10 | FromDiscord | <millymox> In reply to @Elegantbeef "either `import std/json` or": Thank you! |
21:34:54 | * | mad_toothbrush joined #nim |
21:38:39 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4yRb |
21:39:08 | FromDiscord | <millymox> sent a long message, see http://ix.io/4yRc |
21:39:35 | FromDiscord | <Elegantbeef> Of course cause it wants a `string` |
21:39:44 | FromDiscord | <millymox> how to turn to a string? |
21:39:47 | FromDiscord | <Elegantbeef> The runtime error is due to your json being empty |
21:39:55 | FromDiscord | <Elegantbeef> `$` the stringify operator |
21:41:11 | FromDiscord | <millymox> In reply to @Elegantbeef "The runtime error is": how is my json empty? |
21:41:28 | FromDiscord | <Elegantbeef> No clue something is nil |
21:41:48 | FromDiscord | <millymox> this is what i get when i echo payload↵↵{"clientKey":"gvHe","task":{"type":"HcaptchaTaskProxyless","websiteURL":"hey","websiteKey":"hey"}} |
21:44:29 | FromDiscord | <!&luke> sent a code paste, see https://play.nim-lang.org/#ix=4yRd |
21:50:10 | FromDiscord | <millymox> now i just get a segementation fault↵↵SIGSEGV: Illegal storage access. (Attempt to read from nil?)↵zsh: segmentation fault ./test |
21:52:20 | FromDiscord | <!&luke> How can I convert a string to cstring |
21:54:47 | * | ntat quit (Quit: Leaving) |
21:55:17 | FromDiscord | <Elegantbeef> `cstring myString` |
21:56:53 | FromDiscord | <Elegantbeef> That doesnt extend the string lifetime so if you need to extend the life time you need to do something else |
21:59:12 | FromDiscord | <huantian> In reply to @millymox "now i just get": what's your full code again? |
21:59:29 | FromDiscord | <millymox> sent a code paste, see https://play.nim-lang.org/#ix=4yRf |
22:02:15 | FromDiscord | <huantian> https://play.nim-lang.org/#ix=4yRj |
22:02:16 | FromDiscord | <huantian> seems to work |
22:02:43 | FromDiscord | <huantian> the nil access isn't from the json code |
22:03:08 | FromDiscord | <millymox> In reply to @huantian "the nil access isn't": i just removed the req code and it still giving me the error |
22:03:08 | FromDiscord | <ieltan> hmm... 🤔 https://media.discordapp.net/attachments/371759389889003532/1121561031991369908/image.png |
22:03:20 | FromDiscord | <huantian> is client nil? |
22:03:40 | FromDiscord | <millymox> No client is not nil |
22:03:53 | FromDiscord | <millymox> sent a long message, see http://ix.io/4yRk |
22:04:10 | FromDiscord | <millymox> sent a long message, see http://ix.io/4yRl |
22:05:38 | FromDiscord | <huantian> which line is the nil access on? |
22:06:05 | FromDiscord | <millymox> sent a long message, see http://ix.io/4yRm |
22:07:25 | FromDiscord | <huantian> ok so that means payload is nil I'd assume |
22:08:08 | FromDiscord | <huantian> can you echo what payload is again |
22:08:17 | FromDiscord | <huantian> (edit) "payload" => "foo" | "foois again ... " added "before you toJson" |
22:09:19 | arkanoid | Nim manual expose how to sloppy import a c++ class within a namespace using header and importcpp pragma. I'm trying to upgrade it to non-sloppy importcpp (stripping away header pragma) but it fails to compile due to namespaces not declared |
22:09:59 | * | rockcavera quit (Ping timeout: 246 seconds) |
22:10:15 | arkanoid | "MyClass {.importcpp: "outer::inner::MyClass".} = object" does NOT work, but "MyClass {.header: "myheader.hpp", importcpp: "outer::inner::MyClass".} = object" works correctly |
22:10:34 | FromDiscord | <millymox> In reply to @huantian "can you echo what": The error goes away when i stop echoing taskjson not payload |
22:12:05 | * | xet7 quit (Ping timeout: 246 seconds) |
22:18:58 | * | rockcavera joined #nim |
22:21:59 | NimEventer | New thread by giaco: How to importcpp a C++ class within namespaces in non-sloppy way, see https://forum.nim-lang.org/t/10293 |
22:35:12 | * | lucasta joined #nim |
22:35:41 | * | lucasta quit (Remote host closed the connection) |
22:36:28 | * | lucasta joined #nim |
22:57:05 | * | mad_toothbrush quit (Ping timeout: 250 seconds) |
22:59:16 | FromDiscord | <JJ> sent a code paste, see https://play.nim-lang.org/#ix=4yRt |
23:00:45 | FromDiscord | <Elegantbeef> Yes |
23:01:17 | * | jmdaemon joined #nim |
23:02:47 | FromDiscord | <millymox> how to send asynchronous http requests? |
23:06:46 | * | xet7 joined #nim |
23:11:26 | * | xet7 quit (Remote host closed the connection) |
23:11:55 | * | xet7 joined #nim |
23:25:17 | FromDiscord | <millymox> whats the equivelent of sleep in nim?↵↵ sleep(1000) |
23:25:31 | FromDiscord | <Elegantbeef> `import std/os` |
23:25:35 | FromDiscord | <Elegantbeef> Also why are you sleeping |
23:25:41 | NimEventer | New question by Lex: Nim SDL2 no window appears, see https://stackoverflow.com/questions/76536235/nim-sdl2-no-window-appears |
23:25:45 | FromDiscord | <Elegantbeef> You almost never want to actually sleep |
23:30:40 | FromDiscord | <millymox> In reply to @Elegantbeef "Also why are you": im setting a delay for requests, i send a requests every 1 - 2 seconds to wait for a specific response from the server |
23:31:17 | FromDiscord | <Elegantbeef> Ok well that might be fine, though it does freeze your thread |
23:35:18 | FromDiscord | <millymox> In reply to @Elegantbeef "Ok well that might": alright alright |
23:35:25 | FromDiscord | <millymox> can i ask why you show up as a bot sometimes? |
23:35:41 | FromDiscord | <Elegantbeef> I prefer using matrix but at times the bridge dies |
23:36:37 | FromDiscord | <jviega> I mean, the whole point of async is to let the async system resume your func easily where you left off when there's something to do. Explicitly waiting around for it isn't sensical if you're using async |
23:36:37 | FromDiscord | <millymox> Thank you to every nim coder that helped me with my idiotic questions today :nimGlow: https://media.discordapp.net/attachments/371759389889003532/1121584557842509935/Screenshot_2023-06-22_at_5.36.06_PM.png |
23:36:57 | FromDiscord | <millymox> In reply to @jviega "I mean, the whole": sorry for the lack of context, im not using async anymore |
23:37:05 | FromDiscord | <millymox> In reply to @Elegantbeef "I prefer using matrix": Ahhh okay i see |
23:37:24 | FromDiscord | <jviega> I don't like async, but then you should have a different model where you're polling to read w/ epoll and then dispatching to a handler |
23:39:39 | FromDiscord | <jviega> Basically, if you've got thousands of file descriptors because you're handling a lot of connections, idle threads wait for any descriptor to fire, and then go handle that. It scales far, far better than async and tends to be far less error prone / (easier to understand the control flow and debug) in the systems I've seen. |
23:40:26 | FromDiscord | <millymox> In reply to @jviega "Basically, if you've got": Ahhhh okay i see i understand |
23:40:28 | FromDiscord | <millymox> thank you |
23:40:32 | FromDiscord | <Elegantbeef> Eh they're mostly just moving through a list of proxies afaik, so there isnt much reason not to just use async 😄 |
23:41:11 | FromDiscord | <Elegantbeef> Like yes you can just use selectors or similar, but for most cases async will be fine for this code |
23:41:19 | FromDiscord | <Elegantbeef> Atleast assuming it hasnt changed much |
23:42:16 | FromDiscord | <Elegantbeef> If you really want to go down the epoll method https://nim-lang.org/docs/selectors.html does exist |
23:46:33 | FromDiscord | <millymox> sent a long message, see http://ix.io/4yRC |
23:47:09 | FromDiscord | <Elegantbeef> `proc joinTaskResult[T](client: T)` |
23:47:44 | FromDiscord | <Elegantbeef> Nim has generics assuming the body is identical it'll suffice |
23:47:45 | FromDiscord | <Elegantbeef> If the body is not identical, nope |
23:48:06 | FromDiscord | <millymox> ahh that sucks, the body won't be indetical there will be a few small changes |
23:48:18 | FromDiscord | <millymox> like whats sent through the payload etc |
23:49:08 | FromDiscord | <Elegantbeef> sent a code paste, see https://paste.rs/Umt5h |
23:49:11 | FromDiscord | <Elegantbeef> You could also do full on generic code and just define procedures that do the parts that are different |
23:49:49 | FromDiscord | <Elegantbeef> That way you can make a basic interface and implement segments per type |
23:51:26 | FromDiscord | <millymox> Ahhh perhaps, some captchas differ largely from other, this method would work for recaptcha and hcaptcha but GeeTest and cloudflare turnstile are very different |
23:52:26 | FromDiscord | <millymox> So basically just have a generic create_task function, or join_task function and then have segements depending on the client |
23:52:58 | FromDiscord | <Elegantbeef> Operations can be their own procedures and then you could implement those procedures per types |
23:53:04 | FromDiscord | <Elegantbeef> It's a "generic interface" |
23:53:15 | FromDiscord | <millymox> can you give a visual example? |
23:55:34 | FromDiscord | <Elegantbeef> https://play.nim-lang.org/#ix=4yRE |