00:20:47 | FromDiscord | <ringabout> In reply to @Elegantbeef "<@658563905425244160>\: an inane wiki": Thanks for informing me. But all I can do is delete it. |
00:27:17 | * | mahlon joined #nim |
00:31:19 | NimEventer | New Nimble package! DxLib - A Nim binding for DX Library, see https://github.com/777shuang/DxLib |
01:16:31 | * | azimut joined #nim |
01:21:21 | * | disso-peach joined #nim |
01:46:05 | FromDiscord | <odexine> Recursion good only if language has good support for it, which most don’t :baqua: |
02:10:34 | FromDiscord | <Benjamin> \Tail recursion |
02:21:33 | FromDiscord | <odexine> Not even just tail recursion I believe |
02:22:48 | FromDiscord | <takemichihanagaki3129> In reply to @odexine "Recursion good only if": I'm curious now. What should be considered a good support and what language does it well?↵(Genuine question)↵↵I particularly avoid recursion due to stack overflow... |
02:23:57 | FromDiscord | <Elegantbeef> Exactly the point of tail call optimisation and friends |
02:24:11 | FromDiscord | <Elegantbeef> Some languages rewrite recursion to not grow the stack more than once |
02:25:05 | FromDiscord | <takemichihanagaki3129> Impressive! I'll look for this. |
02:25:18 | FromDiscord | <odexine> CPS can generalise any recursion into tail recursion IIRC |
02:25:40 | FromDiscord | <michaelb.eth> In reply to @takemichihanagaki3129 "I'm curious now. What": Racket thoroughly supports and promotes use of recursion, and combines it with support for delimited continuations (not the same thing as call/cc) for extreme flexibility in program control flow |
02:26:41 | FromDiscord | <Elegantbeef> C does have limited optimisation for TCO iirc |
02:27:07 | FromDiscord | <michaelb.eth> I think maybe Guile offers a similar level of support for recursion and delimited continuations, but there aren't too many langs that do, though maybe it's available in some extensions for OCaml and Haskell in hyper-brain Oleg |
02:27:23 | FromDiscord | <michaelb.eth> (edit) "in" => "created by" |
02:27:43 | FromDiscord | <Elegantbeef> I say C, but I mean GCC, Clang, MSVC can optimise it |
02:28:21 | FromDiscord | <Elegantbeef> I do wonder how fugly a macro that did TCO would be |
02:30:35 | * | rockcavera quit (Remote host closed the connection) |
02:30:54 | FromDiscord | <takemichihanagaki3129> @odexine @elegantbeef and @michaelb.eth ↵Thanks you guys, I'll search these terms. ↵Sounds very interesting to me. |
02:36:22 | FromDiscord | <Elegantbeef> I was playing around with Odin and wrote a fractal tree generator originally using recursion, moved it to iterative and allowed me to spawn more nodes |
05:17:17 | * | ovenpasta joined #nim |
06:05:45 | FromDiscord | <bung8954> I have a object with some functions, when I compile with `vcc` and echo repr all functions have address, when come up to `gcc` one of them shows `nil`, any idea ? |
06:14:23 | * | ntat joined #nim |
06:16:26 | FromDiscord | <demotomohiro> It means you have an object that contains pointers to functions? |
06:18:02 | FromDiscord | <bung8954> yes it's windows com interface,only functions |
06:19:30 | FromDiscord | <demotomohiro> How they are initialized? |
06:19:33 | FromDiscord | <bung8954> sent a code paste, see https://play.nim-lang.org/#ix=4Atn |
06:19:55 | FromDiscord | <bung8954> the `Invoke` become nil |
06:23:34 | FromDiscord | <demotomohiro> `result.lpVtbl = vtbl.addr` seems unsafe code.↵It stores the pointer to `vtbl`that is in stack. |
06:25:14 | FromDiscord | <bung8954> what's the correct way? |
06:25:48 | FromDiscord | <Elegantbeef> likely just `result.lpVtbl` |
06:25:51 | FromDiscord | <Elegantbeef> or a heap allocated version |
06:26:37 | FromDiscord | <Elegantbeef> whoops |
06:26:48 | FromDiscord | <Elegantbeef> likely just `result.lpVtbl = vtbl` |
06:27:03 | FromDiscord | <Elegantbeef> Or a manually allocated version |
06:28:58 | FromDiscord | <demotomohiro> `var vtbl = ICoreWebView..()` is right hand side (ICoreWebView...VTBL) is a type or procedure? |
06:30:11 | FromDiscord | <bung8954> `var vtbl = create(ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVTBL); result.lpVtbl = vtbl` seems work |
06:32:30 | FromDiscord | <demotomohiro> It that a correct way and not undefined behaiver code?↵Did you read microsofts document about it? |
06:32:34 | * | ovenpasta quit (Ping timeout: 252 seconds) |
06:32:50 | * | ovenpasta joined #nim |
06:33:02 | FromDiscord | <arathanis> In reply to @odexine "Recursion good only if": or if its not a primitive recursive function and you have no choice |
06:33:16 | FromDiscord | <arathanis> but that is pretty rare |
06:34:52 | * | dv^_^ quit (Quit: dv^_^) |
06:35:51 | FromDiscord | <bung8954> In reply to @demotomohiro "It that a correct": I've read some documents and source code, well I didn't aware the difference between nim object initialization and `create` |
06:36:53 | FromDiscord | <bung8954> the program now pass this step and come to another error, so I think it's fine with that |
06:37:11 | * | dv^_^ joined #nim |
06:40:01 | * | PMunch joined #nim |
06:59:55 | FromDiscord | <demotomohiro> I think everyone who use C/C++ library should read books or documents about C and pointers so that they can use them safely.↵But learning about C and pointers might sounds like stupid for people using modern languages as C is an old language. |
07:02:48 | FromDiscord | <Elegantbeef> Well if you're using a system language you ought to do the due diligence and learn how low level things work |
07:05:41 | FromDiscord | <Elegantbeef> Though even in like C# knowing how stack memory works is important |
07:08:16 | FromDiscord | <bung8954> sent a code paste, see https://play.nim-lang.org/#ix=4Att |
07:09:05 | FromDiscord | <Elegantbeef> Inside a procedure named embed\_\_webview |
07:09:08 | FromDiscord | <Elegantbeef> Did you compile with `--debugger:native`? |
07:12:32 | FromDiscord | <bung8954> wow, that's amazing! |
07:13:30 | FromDiscord | <bung8954> https://media.discordapp.net/attachments/371759389889003532/1128947294767681548/3.PNG |
07:15:21 | FromDiscord | <Elegantbeef> you didnt do `vtabl[] = ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVTBL()` did you? |
07:15:25 | FromDiscord | <Elegantbeef> is `ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVTBL` a type or a procedure? |
07:15:40 | FromDiscord | <Elegantbeef> It has `create` in the name so it's... a procedure right, please say yes, my life depends on it |
07:17:54 | FromDiscord | <bung8954> `var vtbl = create(ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVTBL)` |
07:18:10 | FromDiscord | <Elegantbeef> Right but if that's a type you didnt populate it |
07:18:56 | FromDiscord | <Elegantbeef> Wait `ICoreWebView2CreateCoreWebView2ControllerCompletedHandlerVTBL` is a type eh? |
07:19:05 | FromDiscord | <Elegantbeef> It's unpopulated in your usage afaict |
07:20:36 | FromDiscord | <bung8954> it's a type |
07:21:19 | FromDiscord | <Elegantbeef> Well it's still unpopulated afaict |
07:21:19 | FromDiscord | <Elegantbeef> It's just a 0'd pointer until something writes to it |
07:24:30 | FromDiscord | <bung8954> sent a code paste, see https://play.nim-lang.org/#ix=4Atw |
07:25:00 | FromDiscord | <Elegantbeef> sure but `vtbl[]` is presently `0'd` |
07:25:03 | FromDiscord | <Elegantbeef> there is no data written to it |
07:25:06 | FromDiscord | <Elegantbeef> I doubt that's correct |
07:26:31 | Amun-Ra | it a virtual table for accessing the API from the C world |
07:26:45 | Amun-Ra | it's* |
07:28:30 | FromDiscord | <bung8954> yeah, it's like c++ object in c |
07:28:52 | Amun-Ra | yes, that works like vtable in C++ classes |
07:51:57 | FromDiscord | <ambient3332> In reply to @sys64 "toposort? Also output call": https://en.wikipedia.org/wiki/Topological_sorting it makes it so that you don't have to do any recursive calls for computing a node graph, you can just do a for loop and some caching |
07:54:24 | FromDiscord | <ambient3332> I mean as long you don't have any loop. but modular synth is a DAG (at least should be) |
07:58:34 | FromDiscord | <ambient3332> In reply to @demotomohiro "I think everyone who": Nobody can use C or C++ safely. There are always memory issues. Always. |
08:01:42 | FromDiscord | <ambient3332> Also about tail calls: if your function naturally uses a tail call, it could be useful to try and see what happend with -d:lto. A tail call is actually my fastest version, can't beat it in either writing it out or trying to manually wrangle AVX2 |
08:02:10 | FromDiscord | <ambient3332> (by writing it out I mean expanding it so as to remove the tail call) |
08:20:02 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ambient3332 "I mean as long": My synth is like a tree↵There is never loops |
08:34:25 | * | ovenpasta quit (Ping timeout: 240 seconds) |
08:35:19 | * | ovenpasta joined #nim |
08:54:03 | FromDiscord | <4zv4l> I was just wondering, for what reasons did Nim choose `try except` for error handling over returning an error value like in Go, Rust, Zig ? |
08:55:11 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @4zv4l "I was just wondering,": Try Catch takes a lot of resources |
08:57:24 | FromDiscord | <4zv4l> so that's a reason against `try except` |
08:57:45 | FromDiscord | <System64 ~ Flandre Scarlet> No idea |
09:05:11 | FromDiscord | <gogolxdong666> Does memory leaks with orc for chronos backend? |
09:05:37 | FromDiscord | <ieltan> In reply to @4zv4l "I was just wondering,": The reason Nim choose `try: ... except:` is because it's the creator's preference. You can search `from: _araq exception` if you wonder why |
09:05:37 | FromDiscord | <gogolxdong666> (edit) "leaks" => "leak" |
09:06:40 | FromDiscord | <ieltan> Now i'm sure he's not the only one who prefers them too, etc... |
09:09:54 | Amun-Ra | I like nim and zig error handling, I'm not a fan of rust/go one |
09:10:14 | PMunch | One argument for exceptions is that it keeps the good path fast. Basically when nothing goes wrong there is no return values to handle, no stack space allocated for them, etc. |
09:11:07 | PMunch | One of the reasons why you shouldn't use exceptions for control flow is because they are comparatively expensive compared to a check because they need to do things like stack unrolling and such. |
09:12:11 | FromDiscord | <4zv4l> In reply to @Amun-Ra "I like nim and": I am a huge fan of Zig error handling |
09:12:36 | FromDiscord | <ieltan> Yeah, if you expect your code to "error" a lot (which probably means 'not the value I want'), use options to handle your special case |
09:13:26 | FromDiscord | <4zv4l> you mean using std/options ? |
09:13:34 | FromDiscord | <ieltan> Yeah |
09:13:45 | FromDiscord | <4zv4l> I didn't find lot of library using it |
09:16:15 | FromDiscord | <gogolxdong666> What's the effect of useMalloc, does it return memory to OS sooner? |
09:17:15 | FromDiscord | <ieltan> In reply to @4zv4l "I didn't find lot": Well, that's because in Nim you're not supposed to use Options to express errors 🙂 you only use them to express a missing value and a lot of libraries do use options for this usecase |
09:17:16 | FromDiscord | <odexine> I believe the usual use case is so that tooling that tracks memory like Valgrind could work properly |
09:17:50 | FromDiscord | <odexine> The Nim standard library doesn’t contain an Either type |
09:18:05 | FromDiscord | <odexine> External libraries provide a result (specialised either) type |
09:18:51 | FromDiscord | <odexine> The nice thing about Nim’s exceptions is that they’re not necessarily heap allocated |
09:24:19 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4AtU |
09:25:21 | FromDiscord | <heysokam> If I have two different libraries, and they contain the exact same type declaration...↵are the types compatible by default, or do they need conversion because they come from different modules/libs? 🤔 |
09:26:44 | FromDiscord | <ieltan> In reply to @heysokam "If I have two": Can you even have two exact type declaration that coexist ? |
09:27:01 | FromDiscord | <ieltan> I dont think you can unless im mistaken |
09:27:44 | FromDiscord | <heysokam> In reply to @ieltan "Can you even have": definitely not in the same file... but i'm asking when the declarations are in different files/libraries |
09:29:37 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4AtV |
09:29:45 | FromDiscord | <ieltan> (edit) "https://play.nim-lang.org/#ix=4AtV" => "https://play.nim-lang.org/#ix=4AtW" |
09:29:54 | FromDiscord | <ieltan> (edit) "https://play.nim-lang.org/#ix=4AtW" => "https://play.nim-lang.org/#ix=4AtX" |
09:33:50 | * | Guest99 joined #nim |
09:34:00 | FromDiscord | <odexine> In reply to @heysokam "If I have two": They are different |
09:34:04 | FromDiscord | <odexine> You will need conversion |
09:35:42 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ieltan "Wrap `eval()` return type": I didn't understood very well |
09:43:53 | FromDiscord | <heysokam> In reply to @odexine "You will need conversion": is `lib1.Type1( myType2 )` enough, or does it need to be per-field? |
09:43:56 | FromDiscord | <ieltan> sent a code paste, see https://play.nim-lang.org/#ix=4AtZ |
09:44:08 | FromDiscord | <ieltan> Made some assuptions about the type you were using since you're checking for `NaN` |
09:44:23 | FromDiscord | <ieltan> which is `float64` according to Nim docs |
09:44:35 | FromDiscord | <ieltan> as you can see, no exceptions in sight |
09:44:42 | FromDiscord | <ieltan> use options 🙂 |
09:45:40 | FromDiscord | <ieltan> also putting `{.raises: [].}` pragma is to disallow having procedures that can raise exceptions inside `eval` since you have performance constraint so definitively use it. |
09:45:53 | FromDiscord | <ieltan> (edit) "constraint" => "constraints" |
09:49:45 | FromDiscord | <System64 ~ Flandre Scarlet> sent a code paste, see https://play.nim-lang.org/#ix=4Au1 |
09:56:24 | FromDiscord | <ieltan> In reply to @sys64 "Oh I didn't know": I don't know your code, I just suggest you put it in the `eval` prog or in any proc that you don't want to raise exceptions in |
09:56:32 | FromDiscord | <ieltan> (edit) "prog" => "proc" |
09:57:23 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ieltan "I don't know your": The eval proc comes from mathexpr module |
09:57:45 | FromDiscord | <ieltan> Ohh I see it's not your own, my bad |
09:58:08 | FromDiscord | <odexine> In reply to @heysokam "is `lib1.Type1( myType2 )`": Per field IIRC |
10:00:13 | FromDiscord | <System64 ~ Flandre Scarlet> In reply to @ieltan "Ohh I see it's": Yeah, so that's the problem |
10:11:06 | * | ovenpasta quit (Ping timeout: 258 seconds) |
10:11:50 | * | xet7 quit (Quit: Leaving) |
10:29:58 | * | Guest99 quit (Quit: Client closed) |
11:09:30 | FromDiscord | <jmgomez> @heysokam you could just do a `converter` that iterates over the fields and assign them |
11:11:55 | FromDiscord | <odexine> Or a regular procedure then just call that when needed |
11:16:30 | FromDiscord | <heysokam> In reply to @jmgomez "<@186489007247589376> you could just": problem is that the data could be large↵so was thinking of any potential way to avoid the processing step, since im already processing it twice (load from file, and then convert to lib1.Type) |
11:16:57 | FromDiscord | <heysokam> but the library that actually uses the data is lib2, which also has the same Type mapped |
11:19:13 | FromDiscord | <jmgomez> why dont you use the same type again? |
11:19:34 | FromDiscord | <jmgomez> also if they are an exact match a cast may work too |
11:21:17 | * | jmdaemon quit (Ping timeout: 246 seconds) |
11:31:41 | FromDiscord | <heysokam> In reply to @jmgomez "why dont you use": because lib2 is can have dependencies, but lib1 doesn't↵but the type is shared, so i would force lib1 to depend on lib2 just for the type only |
11:32:25 | FromDiscord | <heysokam> In reply to @jmgomez "also if they are": i guess, didn't think of that. gotta try 🤔 |
11:50:39 | FromDiscord | <craciu25_YT> whats the fastest way to read a file? I tried using streams and memfile and both are pretty slow compared to python |
11:52:29 | FromDiscord | <ambient3332> What are you trying to achieve? Quick dump or entire data to memory, or some kind of random access? |
11:52:53 | FromDiscord | <craciu25_YT> I just want to read a file and loop in it |
11:53:16 | FromDiscord | <ambient3332> Also operating systems do cache file access, so Python might not actually be faster |
11:54:33 | FromDiscord | <craciu25_YT> nim takes 20s while python takes 2 seconds using the same file |
11:54:51 | FromDiscord | <craciu25_YT> (edit) "using" => "reading" |
11:54:54 | FromDiscord | <ambient3332> Did you use the readData in streams? |
11:55:05 | FromDiscord | <ambient3332> and what kind of code you used for Python? |
11:55:39 | FromDiscord | <craciu25_YT> in python I used open and in nim I tried newFileStream |
11:58:17 | FromDiscord | <ambient3332> Nim also has open and you can just read and dump the file into memory |
11:58:54 | FromDiscord | <craciu25_YT> I tried it too but I can't because the file needs to be opened with an encode and open does not has any arguments for encode |
11:59:32 | FromDiscord | <ambient3332> UTF-8? |
11:59:40 | FromDiscord | <craciu25_YT> latin 1 |
12:00:52 | FromDiscord | <ambient3332> https://nim-lang.org/docs/encodings.html |
12:01:49 | FromDiscord | <craciu25_YT> I already took a look to that and you need to like have the string to convert it and the issue is that how I can't open it I can't convert it |
12:15:20 | FromDiscord | <ambient3332> sent a code paste, see https://play.nim-lang.org/#ix= |
12:18:24 | FromDiscord | <ambient3332> it's slow? |
12:30:12 | FromDiscord | <craciu25_YT> oh, I didn't know I could just add it after. I tought it would be an arg for readFile. Yes it works. Thanks |
13:34:41 | FromDiscord | <4zv4l> is there a way to readLine from stdin in a async way so that while it's not complete it still runs the other tasks ? |
13:52:34 | FromDiscord | <bung8954> sent a code paste, see https://play.nim-lang.org/#ix=4AuM |
13:53:13 | FromDiscord | <bung8954> (edit) "https://play.nim-lang.org/#ix=4AuM" => "https://play.nim-lang.org/#ix=4AuN" |
14:17:41 | * | PMunch quit (Quit: Leaving) |
15:06:59 | Amun-Ra | 4zv4l: select(2)? |
15:11:44 | FromDiscord | <mratsim> In reply to @4zv4l "is there a way": you need to put that on another thread. stdin always block |
15:11:56 | FromDiscord | <mratsim> (edit) "block" => "blocks" |
15:12:29 | FromDiscord | <mratsim> see: https://github.com/dom96/nim-in-action-code/blob/master/Chapter3/ChatApp/src/client.nim#L48-L50 |
15:18:29 | FromDiscord | <4zv4l> I’ll use spawn, thanks ! But it should be possible to use async io with stdin right ? |
15:47:37 | FromDiscord | <odexine> yet again i am surprised how nim does not have divmod |
15:58:50 | FromDiscord | <demotomohiro> sent a code paste, see https://play.nim-lang.org/#ix=4Avu |
16:10:32 | FromDiscord | <4zv4l> Is it easy to add a function to the stdlib ? I guess a pull request isn’t enough ? Need to argument etc. ? Otherwise could add it |
16:13:32 | FromDiscord | <Chronos [She/Her]> In reply to @demotomohiro "divmod is something like": Do we really need that as a separate stdlib function tho? |
16:13:45 | FromDiscord | <Chronos [She/Her]> Also, why exportc? And it could be a template, no need for a proc |
16:14:26 | FromDiscord | <Chronos [She/Her]> In reply to @yu.vitaqua.fer.chronos "Do we really need": I feel like it isn't something that'd be used by people often, which is why it probably already isn't in the stdlib |
16:16:14 | FromDiscord | <demotomohiro> In reply to @4zv4l "Is it easy to": At least, it needs good reason to add to stdlib.↵That function is commonly used by many people and not so hard to maintain by Nim devs. |
16:17:20 | FromDiscord | <demotomohiro> In reply to @yu.vitaqua.fer.chronos "Do we really need": I just copied it from godbolt.↵It doesn't need exportc. |
16:17:47 | FromDiscord | <demotomohiro> https://godbolt.org/z/6efd9f6aE |
16:21:39 | FromDiscord | <Chronos [She/Her]> Ah |
16:35:07 | FromDiscord | <graveflo> In reply to @odexine "yet again i am": I added divmod to devel. It's in `math` |
16:35:21 | FromDiscord | <odexine> on stable? |
16:35:25 | FromDiscord | <odexine> i am not using devel |
16:35:42 | FromDiscord | <graveflo> nah I doubt its back ported |
16:35:45 | FromDiscord | <odexine> good to know its there for 2 though |
16:35:54 | FromDiscord | <odexine> such a strange omission |
16:36:10 | FromDiscord | <graveflo> eh well. it happens ig |
17:02:22 | * | jmd_ joined #nim |
17:17:28 | * | oprypin quit (Remote host closed the connection) |
17:42:13 | * | hohlerde quit (Quit: Connection closed for inactivity) |
17:53:57 | * | rockcavera joined #nim |
17:56:37 | * | jmd_ quit (Ping timeout: 245 seconds) |
18:02:42 | FromDiscord | <nixfreak> is is possible to get the actual IP header and ethernet header using std/net ? I want to parse the actual packet header information. |
18:09:36 | * | jmd_ joined #nim |
18:13:01 | * | ntat quit (Quit: Leaving) |
18:14:30 | FromDiscord | <graveflo> os usually handles that. Prob cant do that with the std lib |
18:15:13 | Amun-Ra | it should be doable with raw sockets |
18:16:04 | FromDiscord | <nixfreak> so can I use nativesockets ? |
18:31:10 | * | jmd_ quit (Ping timeout: 252 seconds) |
18:34:38 | * | oddish_ joined #nim |
18:42:10 | * | oddish quit (*.net *.split) |
18:44:01 | * | jmd_ joined #nim |
18:47:05 | * | oprypin joined #nim |
18:47:55 | * | jmd_ quit (Remote host closed the connection) |
18:48:15 | * | jmd_ joined #nim |
18:54:46 | FromDiscord | <nnsee> In reply to @nixfreak "so can I use": yes |
18:54:54 | FromDiscord | <nnsee> i've done exactly this |
18:55:45 | FromDiscord | <nnsee> I've also taken it a step further and incorporated an ebpf filter in my program in order to do it "passively" |
18:59:52 | FromDiscord | <nixfreak> nice , do you have an example of this? |
19:04:46 | FromDiscord | <nnsee> http://ix.io/4Awd |
19:04:52 | FromDiscord | <nnsee> ignore the very ugly code |
19:05:30 | FromDiscord | <nnsee> this captures icmpv6 packets depending on the type |
19:05:44 | FromDiscord | <nnsee> you will have to adapt your bpf program accordingly |
19:06:48 | FromDiscord | <nnsee> I crafted mine manually, but tcpdump is excellent for compiling bpf programs from a more human-readable syntax |
19:08:20 | FromDiscord | <nixfreak> how did you connect ebpf to your nim program? |
19:09:28 | FromDiscord | <nnsee> it's all in the code I sent, once you've attached the filter, you can start .recv()-ing on it |
19:10:19 | FromDiscord | <nnsee> there's certainly more elegant ways you can do it, depending on what your use case is, but in my case I just wanted all ICMPv6 packets of certain types |
19:10:23 | FromDiscord | <nnsee> fits my use case |
19:13:31 | FromDiscord | <nixfreak> Ok, so I'm looking for a way to get better information for banner grabbing from a remote IP. My thinking is to recv IP header and Ethernet Header to grab the information. I know very little of ebpf , so I need to do some research on this. Could ebpf work in my case ? Building security tools and scanners |
19:29:33 | FromDiscord | <yandall> Is there an easy way to replace special characters in a string so it is SEO freindly? Eg: "Jägermeister" -> "Jagermeister" |
19:30:33 | FromDiscord | <nixfreak> Can't strutils do that ? |
19:31:02 | FromDiscord | <yandall> Didn't find any proc for that |
19:31:15 | FromDiscord | <yandall> Maybe `normalize`? haven't tested it yet |
19:31:30 | FromDiscord | <nixfreak> https://nim-lang.github.io/Nim/unicode.html#%24%2CRune |
19:32:37 | FromDiscord | <nixfreak> https://nim-lang.github.io/Nim/unidecode.html |
19:32:53 | FromDiscord | <nixfreak> proc unidecode(s\: string)\: string {.raises\: [], tags\: [], forbids\: [].} |
19:33:06 | FromDiscord | <yandall> In reply to @nixfreak "https://nim-lang.github.io/Nim/unicode.html#%24%2CR": This is exactly what I was looking for. Thank you |
19:34:15 | FromDiscord | <nixfreak> nice ... `nim> import unidecode nim> var x = unidecode("Jägermeister") nim> echo x Jagermeister` |
19:35:51 | FromDiscord | <spotlightkid> If you want to create URL slugs, you usually make the string lowercase too and replace all non-alphanumric ascii chars with a hyphen. |
19:37:08 | FromDiscord | <yandall> Yeah, was going to use `replace()` and `toLowerAscii()` for that |
19:58:43 | * | jmd_ quit (Ping timeout: 250 seconds) |
20:10:41 | * | jmdaemon joined #nim |
20:27:30 | FromDiscord | <_alkamist_> Does anyone have any insight into how text rendering is usually done in production apps? I've been experimenting for a while and I have no idea how something like VS Code can handle millions of wordwrapped characters at a high framerate. |
20:28:08 | FromDiscord | <Elegantbeef> Font atlassing |
20:28:45 | FromDiscord | <_alkamist_> Is that how it's usually done? Like every glyph is in an atlas and every letter is a quad? |
20:29:30 | FromDiscord | <Elegantbeef> That's one way of doing high speed rendering |
20:29:30 | FromDiscord | <_alkamist_> That's how I am doing it right now and it is definitely fast. |
20:29:39 | FromDiscord | <Elegantbeef> It's then just a case of uploading rects and their uvs |
20:31:29 | * | azimut quit (Remote host closed the connection) |
20:31:36 | FromDiscord | <_alkamist_> I am using Nanovg at the moment and that is essentially how it handles it I believe. I was thinking of trying to use Boxy but it seems way too slow to try to render images of text and draw them. |
20:31:57 | * | azimut joined #nim |
20:32:25 | FromDiscord | <Elegantbeef> I mean I use pixie and my own atlaser for my font rendering in my gui |
20:33:20 | FromDiscord | <_alkamist_> Well I'm sure it can be used to create an atlas that you then draw quads from, I just mean I was trying to literally render the end result to a quad itself and display it. |
20:33:44 | FromDiscord | <Elegantbeef> Why would you render it to a quad? |
20:34:00 | FromDiscord | <Elegantbeef> Upload all your rectangles with their texture index |
20:35:13 | FromDiscord | <_alkamist_> So like make a texture index for every single possible glyph? |
20:36:07 | FromDiscord | <Elegantbeef> not every single possible glyph |
20:36:07 | FromDiscord | <Elegantbeef> The atlas only has glyphs you've used |
20:37:00 | FromDiscord | <spotlightkid> sent a code paste, see https://paste.rs/cqXLj |
20:38:48 | FromDiscord | <_alkamist_> In reply to @Elegantbeef "The atlas only has": I guess then I would need to work out how to deal with positioning and dealing with kerning and stuff on my own which currently I haven't dealt with at all, since Nanovg does it for me. |
20:39:08 | FromDiscord | <Elegantbeef> https://github.com/beef331/truss3d/blob/master/src/truss3D/fontatlaser.nim |
20:39:12 | FromDiscord | <Elegantbeef> Pixie does kerning |
20:39:17 | FromDiscord | <Elegantbeef> Pixie does positioning aswell 😄 |
20:40:04 | FromDiscord | <_alkamist_> But only if you are drawing an image right? If you make your own font atlas arent you responsible for positioning everything on your own? |
20:40:48 | FromDiscord | <Elegantbeef> Pixie allows you to query the positioning of rectangels |
20:42:01 | FromDiscord | <Elegantbeef> https://github.com/beef331/truss3d/blob/master/src/truss3D/gui.nim#L155-L167 |
20:42:44 | FromDiscord | <Elegantbeef> That gives me layout of characters |
20:42:59 | FromDiscord | <Elegantbeef> It's then as simple as https://github.com/beef331/truss3d/blob/master/src/truss3D/gui.nim#L181-L193 |
20:43:13 | FromDiscord | <_alkamist_> Hmmm, I might need to look into it. Although I am still not sure how to accomplish drawing other things in the gui. Nanovg works sort of like Dear Imguis draw list, where geometry is actually vectorized instead of rasterized. |
20:43:42 | FromDiscord | <Elegantbeef> I mean my text renders as a single draw call |
20:43:52 | FromDiscord | <Elegantbeef> Aside from the atlas teture it's purely vector |
20:44:14 | FromDiscord | <_alkamist_> But what about non-text things? Like rounded rects and lines and polygons |
20:44:40 | FromDiscord | <Elegantbeef> I don't have any thing but rects and text presently, but I'd make those likely single drawcall aswell |
20:44:47 | FromDiscord | <Elegantbeef> Using shaders for making rounded rects |
20:45:29 | FromDiscord | <_alkamist_> That's why I'm kind of stuck on Nanovg, since there is this barrier between gpu accelerated and not. |
20:46:02 | FromDiscord | <spotlightkid> sent a code paste, see https://play.nim-lang.org/#ix=4Awy |
20:46:27 | FromDiscord | <Elegantbeef> I was going to show my render pipeline but I forgot my entire gui rendered in a single call 😄 |
20:47:48 | FromDiscord | <Elegantbeef> Some perspective issue |
20:47:49 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1129152221733474414/image.png |
20:47:49 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1129152224329744384/image.png |
20:48:18 | FromDiscord | <Elegantbeef> I do not have textures on rects yet, but each quad has a `index` which points to a specific letter I calculate the UVs for |
20:48:40 | FromDiscord | <Elegantbeef> https://github.com/beef331/truss3d/blob/master/src/truss3D/gui.nim#L36-L63 which is here if you want to see the shader |
20:52:17 | FromDiscord | <Elegantbeef> No clue if this is helpful or just spam |
20:53:02 | FromDiscord | <_alkamist_> Seems like there's a lot of cool stuff in there. I'll have to dig through it. 👀 |
20:54:33 | FromDiscord | <_alkamist_> Can I get your opinion on my Gui library? I think it might work on linux now, not 100% sure. |
21:02:37 | FromDiscord | <Elegantbeef> I mean it's not stateful iirc, so it r bad ;D |
21:02:47 | FromDiscord | <Elegantbeef> What's the link to it again? |
21:03:54 | FromDiscord | <_alkamist_> In reply to @Elegantbeef "I mean it's not": It's changed a bit since before. I'm not sure what it is at this point but I did a readme so hopefully it explains my thoughts well https://github.com/Alkamist/nimgui |
21:12:18 | FromDiscord | <Elegantbeef> Is this a general purpose gui? |
21:16:24 | FromDiscord | <_alkamist_> Yeah that's the ultimate goal |
21:16:53 | FromDiscord | <Elegantbeef> I don't know if this is just cause I havent dragged a window since 2003, but the window dragging feels off |
21:17:08 | om3ga | alkamist, can it work in macos? |
21:17:15 | FromDiscord | <_alkamist_> In reply to @Elegantbeef "I don't know if": It's actually running though? |
21:17:24 | FromDiscord | <Elegantbeef> Yea it's running |
21:17:41 | FromDiscord | <_alkamist_> In reply to @om3ga "alkamist, can it work": I think it should, I'm using staticglfw for backends other than windows and emscripten. I haven't tested though |
21:17:57 | FromDiscord | <Elegantbeef> Ah I see the issue the window is lagging behind |
21:17:57 | FromDiscord | <Elegantbeef> I had to change the font to iosevka though |
21:18:00 | FromDiscord | <Elegantbeef> image.png https://media.discordapp.net/attachments/371759389889003532/1129159818754662540/image.png |
21:18:04 | om3ga | wow, nice! |
21:18:09 | FromDiscord | <Elegantbeef> Works fine aside from having to modify that `readFile` |
21:18:37 | om3ga | I'll try it now |
21:19:09 | FromDiscord | <_alkamist_> Awesome, glad it is working properly with no testing haha. Yeah it lags behind slightly, not sure if there's a way to fix that, it's the same with Dear Imgui. |
21:19:49 | FromDiscord | <_alkamist_> Also hold Ctrl for low sensitivity sliders |
21:20:08 | FromDiscord | <_alkamist_> It's a thing in audio plugins that no one ever does anywhere else and I have no idea why |
21:20:26 | om3ga | Error: cannot open file: staticglfw |
21:20:47 | FromDiscord | <_alkamist_> Yeah you'll have to `nimble install staticglfw` i think |
21:20:55 | FromDiscord | <_alkamist_> I should probably put that in the readme |
21:21:06 | FromDiscord | <Elegantbeef> Well the reason they don't do it like you is you do not hide the cursor |
21:21:07 | om3ga | ok, one min |
21:21:08 | FromDiscord | <Elegantbeef> You should hide the cursor if you enter precision mode |
21:21:26 | FromDiscord | <Elegantbeef> Actually your slides suck cause you have to click the handle |
21:21:26 | FromDiscord | <Elegantbeef> Cmon! 😛 |
21:21:40 | FromDiscord | <_alkamist_> I might do that at some point, although that's not possible in the browser |
21:21:59 | FromDiscord | <Elegantbeef> It's possible to hide a cursor |
21:22:05 | FromDiscord | <_alkamist_> In the browser? |
21:22:10 | FromDiscord | <Elegantbeef> Yea |
21:22:32 | FromDiscord | <_alkamist_> Oh wait, it was that you can't set the cursor's position |
21:22:37 | FromDiscord | <Elegantbeef> Just add `cursor:none` to the html element |
21:22:49 | FromDiscord | <_alkamist_> The ideal behavior is to hide the cursor and keep it on top of the handle |
21:22:55 | FromDiscord | <_alkamist_> so it's there when you let go |
21:23:00 | FromDiscord | <_alkamist_> But I can't do that in the browser |
21:23:03 | FromDiscord | <Elegantbeef> Right |
21:23:14 | FromDiscord | <Elegantbeef> Well only hide it when you enter precision |
21:23:17 | FromDiscord | <_alkamist_> But I could conditionally do it based on what platform you are on i guess |
21:23:51 | FromDiscord | <Elegantbeef> I guess that depends on if you want infinite slide or not |
21:23:54 | FromDiscord | <Elegantbeef> I personally prefer seeing my cursor on sliders |
21:24:36 | FromDiscord | <_alkamist_> I'm modelling the behavior off of what I'm used to in audio plugins I suppose |
21:24:46 | FromDiscord | <_alkamist_> But yeah I might take a shot at hiding the cursor and stuff |
21:25:27 | om3ga | alkamist, segfaults unfortunately, ERROR: 0:1: '' : version '150' is not supported |
21:25:49 | om3ga | Shader shader/vert error: |
21:26:15 | FromDiscord | <_alkamist_> Hmm, maybe an opengl thing with nanovg? I am not sure. I don't have a macos system to test on unfortunately. |
21:26:53 | om3ga | yeah, I understand |
21:27:09 | FromDiscord | <_alkamist_> I do eventually want it to work on mac os though |
21:28:23 | FromDiscord | <Elegantbeef> I do appreciate that you've got no dynamic typing yet 😄 |
21:28:24 | om3ga | pm me if you need tests or smth |
21:28:43 | FromDiscord | <Elegantbeef> The irc user telling the discord user to pm them |
21:28:45 | FromDiscord | <Elegantbeef> Interesting 😄 |
21:29:32 | FromDiscord | <_alkamist_> In reply to @om3ga "pm me if you": I appreciate it! Will do, although I am stumped at the moment on what the issue might be. |
21:29:56 | FromDiscord | <_alkamist_> In reply to @Elegantbeef "I do appreciate that": I've tried all sorts of cursed things, believe me |
21:30:00 | om3ga | haha, yeah.. I not use discord |
21:35:58 | * | cedb quit (Ping timeout: 252 seconds) |
22:04:02 | FromDiscord | <yandall> sent a code paste, see https://play.nim-lang.org/#ix=4AwR |
22:08:35 | FromDiscord | <spotlightkid> Yes\: `" $ Español-" -> "espanol" (expected: "espanol")` |
22:46:27 | NimEventer | New post on r/nim by Artistic_Speech_1965: Execute code before and after test with testament, see https://reddit.com/r/nim/comments/14yyz3y/execute_code_before_and_after_test_with_testament/ |
22:54:55 | * | jmdaemon quit (Ping timeout: 240 seconds) |
23:44:55 | * | jmd_ joined #nim |