00:54:42 | * | def- quit (Quit: -) |
00:55:23 | * | def- joined #nim |
01:16:09 | FromDiscord | <MDuardo> Is possible to download an specific file from a GitHub repo with the Standard Library?I want a program that downloads Nerds Fonts and installs to use in TermuxRight now I'm doing it with `curl` but I don't want dependencies |
01:17:50 | FromDiscord | <MDuardo> Does this work for that?↵https://nim-lang.org/docs/httpclient.html |
01:20:01 | FromDiscord | <Elegantbeef> `downloadFile` exists |
01:20:03 | FromDiscord | <Elegantbeef> Or you can use `get` |
01:25:31 | FromDiscord | <MDuardo> Thank you Beef, very cool |
01:26:23 | FromDiscord | <MDuardo> My shameless ripoff of this will be a success↵https://github.com/notflawffles/termux-nerd-installer |
01:38:17 | * | def- quit (Quit: -) |
01:38:29 | * | def- joined #nim |
02:10:53 | * | SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev) |
02:13:42 | * | def- quit (Quit: -) |
02:14:00 | * | def- joined #nim |
02:20:32 | Amun-Ra | C project what shoul've been a shell script |
02:26:05 | FromDiscord | <zumi.dxy> maybe he's a mad lad |
02:26:15 | FromDiscord | <zumi.dxy> what about C as a scripting language |
02:28:10 | FromDiscord | <MDuardo> With manual memory management and all that stuff?↵(@zumi.dxy) |
02:28:20 | FromDiscord | <Elegantbeef> Exactly! |
02:28:24 | FromDiscord | <Elegantbeef> Dynamically load it and leak away |
02:29:46 | FromDiscord | <MDuardo> Now I don't know if should keep it in Nim or just make it a Bash script |
02:29:55 | FromDiscord | <MDuardo> 🤔 |
02:34:26 | FromDiscord | <Elegantbeef> Using Nim gives you a crossplatform binary |
02:35:57 | FromDiscord | <Elegantbeef> Using bash gives you a headache and forces you to depend on programs |
02:35:58 | FromDiscord | <Elegantbeef> Though you're using the stdlib httpclient so yea it also has deps |
02:35:59 | FromDiscord | <MDuardo> This would probably be useless in a normal computer |
02:35:59 | FromDiscord | <MDuardo> Yeah, but I only need it for Termux↵Which is ARM64 |
02:36:04 | FromDiscord | <Elegantbeef> Right then write it for the default shell script of termux |
02:36:27 | FromDiscord | <zumi.dxy> I tried to use Nimscript↵it isn't good for everything :(↵↵So I just use Nim instead |
02:36:55 | FromDiscord | <zumi.dxy> in particular docutils don't work with Nimscript yet |
02:38:13 | FromDiscord | <zumi.dxy> I wonder if this is the virtue of actual scripting languages, fast prototyping esp. for quick and dirty scripts |
02:38:41 | FromDiscord | <Elegantbeef> You can write normal Nim as fast as scripting languages so who knows 😄 |
02:39:35 | FromDiscord | <zumi.dxy> Python just so happens to have a rich stdlib and a rich ecosystem, so people end up building megastructures on top of it↵A scripting language↵Even torturing themselves to code somewhere else and use FFI for the tiniest bit of performance |
02:40:05 | FromDiscord | <zumi.dxy> Well that's writing, what about compiling |
02:40:11 | Amun-Ra | always try to use the right tool for the job |
02:40:33 | FromDiscord | <zumi.dxy> Nim is plenty fast to compile, but isn't quite as snappy for scripting purposes |
02:41:02 | FromDiscord | <Elegantbeef> It's fine for scripting purposes |
02:41:27 | FromDiscord | <MDuardo> Is NimScript slow or something?↵I used it two or three times, works fine for me |
02:41:27 | FromDiscord | <zumi.dxy> In reply to @Amun-Ra "always try to use": I mean, obviously↵I think some people say "no such thing as right tool for the job, use Our Thing for everything"↵(but not here thankfully) |
02:41:42 | FromDiscord | <zumi.dxy> well it's not slow |
02:42:02 | FromDiscord | <zumi.dxy> I just wish it's a little bit "snappier" |
02:44:47 | Amun-Ra | I've never find a use for nimscript yet, what do you mean by snappier? what nimscript lacks in your opinion? |
02:45:13 | FromDiscord | <Elegantbeef> Nimscript lacks a lot of basic features, cannot even cast a set to an int! |
02:45:33 | Amun-Ra | uch, that's a no go for me |
02:45:37 | Amun-Ra | ouch* |
02:46:07 | FromDiscord | <MDuardo> Hope NimScript gets better↵It's a bit basic for now |
02:46:25 | FromDiscord | <Elegantbeef> It's not the focus of development so it's not likely |
03:36:28 | FromDiscord | <zumi.dxy> You'd be better off just using Nim |
03:54:15 | * | SchweinDeBurg joined #nim |
05:01:06 | NimEventer | New thread by take1234: Nim on the go: Smartphone, termux and ... "no" docs., see https://forum.nim-lang.org/t/11501 |
05:33:39 | * | MacDefender joined #nim |
05:36:43 | * | def- quit (Quit: -) |
05:37:54 | * | def- joined #nim |
05:46:24 | * | def- quit (Quit: -) |
05:46:48 | * | def- joined #nim |
06:03:28 | * | coldfeet joined #nim |
06:17:18 | * | ntat joined #nim |
06:48:12 | * | bomb joined #nim |
07:09:08 | * | ntat quit (Quit: Leaving) |
08:53:52 | * | ntat joined #nim |
10:23:46 | * | coldfeet quit (Remote host closed the connection) |
10:25:47 | * | KhazAkar joined #nim |
10:42:35 | * | SchweinDeBurg quit (Quit: WeeChat 4.3.0-dev) |
11:02:46 | FromDiscord | <pmunch> In reply to @zumi.dxy "I just wish it's": For scripting? Maybe try a faster C compiler like TCC? |
11:04:44 | FromDiscord | <pmunch> Has anyone implemented a all fields lookup collection in Nim yet? Like give it an object with fields a, b, and c; and it generates byA, byB, and byC lookup procedures for a collection of them? |
11:05:52 | FromDiscord | <aintea> sent a code paste, see https://play.nim-lang.org/#pasty=XRAlREIFZSsO |
11:06:01 | FromDiscord | <aintea> https://nim-lang.org/docs/options.html |
11:06:38 | FromDiscord | <aintea> Also when I just copy paste the code from the docs it works, but when I copy it by hand it doesn't |
11:11:24 | FromDiscord | <zumi.dxy> In reply to @pmunch "For scripting? Maybe try": It's still "supported" isn't it? :p |
11:22:15 | FromDiscord | <pmunch> What is? |
11:29:08 | FromDiscord | <pmunch> In reply to @aintea "Any idea why the": Very strange |
11:29:39 | FromDiscord | <aintea> I get this |
11:29:50 | FromDiscord | <aintea> sent a code paste, see https://play.nim-lang.org/#pasty=zSwVmmJGNZZM |
11:30:12 | * | nyeaa49284230101 quit (Quit: The Lounge - https://thelounge.chat) |
11:33:17 | * | nyeaa49284230101 joined #nim |
11:35:17 | FromDiscord | <pmunch> Yeah same |
11:35:36 | FromDiscord | <pmunch> Which is strange considering it's used just above that |
11:36:01 | FromDiscord | <pmunch> I think it might be a generics issue |
11:36:21 | FromDiscord | <pmunch> Tried putting it in a template and the error changed |
11:37:19 | FromDiscord | <pmunch> Yeah, if you do Option[int] and return type int it works. |
11:37:27 | FromDiscord | <pmunch> So definitely a generics issue |
11:43:52 | * | coldfeet joined #nim |
11:49:47 | FromDiscord | <aintea> sent a code paste, see https://play.nim-lang.org/#pasty=gkIwXqAQrFfD |
11:50:11 | FromDiscord | <aintea> sent a code paste, see https://play.nim-lang.org/#pasty=yPpDLohWSEtv |
11:50:41 | FromDiscord | <ieltan> Fwiw, `fusion/matching` is a unmaintained package |
11:50:53 | FromDiscord | <aintea> oh |
11:50:58 | FromDiscord | <ieltan> Nobody touched it since like ages ago like 4-5 years? |
11:51:10 | FromDiscord | <aintea> Then why is it in the nim options docs |
11:51:12 | FromDiscord | <aintea> (edit) "Then why is it in the nim options docs ... " added "?" |
11:51:40 | FromDiscord | <ieltan> Imo it's a oversight and it should be removed from the docs 😅 |
11:51:48 | FromDiscord | <aintea> If it hasn't been touched in years, it makes sense it's breaking everything |
11:52:02 | FromDiscord | <aintea> What's the best way I can match on options then ? |
11:52:45 | FromDiscord | <aintea> Except if is_some |
11:52:59 | FromDiscord | <aintea> (edit) "is_some" => "isSome" |
11:53:01 | FromDiscord | <ieltan> There are some libraries that does it better and are more up to date on nimble |
11:53:12 | FromDiscord | <ieltan> Lemme check on my computer cause I'm on my phone |
11:53:47 | FromDiscord | <aintea> I will don't worry |
11:53:50 | FromDiscord | <aintea> thanks for the answers |
12:15:16 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=ldpbyfDEwuWa |
12:15:26 | FromDiscord | <nocturn9x> sent a code paste, see https://play.nim-lang.org/#pasty=YZUlUjQrxIIa |
12:15:29 | FromDiscord | <nocturn9x> _cool_ |
12:25:13 | FromDiscord | <ieltan> In reply to @nocturn9x "so apparently this line": #internals, ideally with your types |
12:25:38 | FromDiscord | <nocturn9x> wish I had the time to delve into that now, might do that this evening |
12:25:39 | FromDiscord | <ieltan> I'd say though you shouldn't need the `[]`? |
12:25:49 | FromDiscord | <nocturn9x> it's a ref type |
12:26:06 | FromDiscord | <nocturn9x> iirc `==` compares pointers for refs? |
12:26:36 | FromDiscord | <ieltan> Yeah you're right |
12:26:47 | FromDiscord | <nocturn9x> that's not what I need, I need value equality |
12:27:01 | FromDiscord | <nocturn9x> hence the deref |
12:27:16 | FromDiscord | <ieltan> Yeah that makes sense, my bad |
12:33:11 | * | coldfeet quit (Remote host closed the connection) |
12:42:16 | * | ntat quit (Quit: Leaving) |
12:45:18 | * | def- quit (Quit: -) |
12:46:25 | * | def- joined #nim |
12:50:43 | * | krux02 joined #nim |
13:18:50 | FromDiscord | <wileycoleman> In reply to @isofruit "I'm not aware of": Turns out owlkettle will probably work better for me anyway. |
13:20:31 | * | SchweinDeBurg joined #nim |
13:22:54 | * | MacDefender quit (Read error: Connection reset by peer) |
13:38:23 | * | def- quit (Quit: -) |
13:38:51 | * | ntat joined #nim |
13:40:05 | * | def- joined #nim |
13:43:56 | * | def- quit (Client Quit) |
13:44:08 | * | def- joined #nim |
14:25:20 | NimEventer | New thread by thegraynode: Introducing nginwho - An nginx log parser, Cloudflare IP restorer, and untrusted traffic blocker, see https://forum.nim-lang.org/t/11505 |
14:37:38 | * | xet7 quit (Ping timeout: 268 seconds) |
14:50:08 | FromDiscord | <pmunch> In reply to @wileycoleman "Turns out owlkettle will": Otherwise Futhark also works to wrap Gtk |
14:50:30 | FromDiscord | <pmunch> I've done it for my Markdown editor project |
15:08:11 | FromDiscord | <zumi.dxy> sent a code paste, see https://play.nim-lang.org/#pasty=QYipHTkGUtNm |
15:08:33 | FromDiscord | <zumi.dxy> (edit) "https://play.nim-lang.org/#pasty=aninNTnFUAEB" => "https://play.nim-lang.org/#pasty=YlolNrjULqtM" |
15:08:44 | FromDiscord | <pmunch> Sure |
15:10:00 | * | ntat quit (Quit: Leaving) |
15:11:06 | FromDiscord | <pmunch> https://play.nim-lang.org/#pasty=HCGOSIznAgoW |
15:11:22 | FromDiscord | <pmunch> Pardon the formatting, the playground doesn't do mobile well.. |
15:12:24 | FromDiscord | <pmunch> For more tricks like this: https://peterme.net/tips-and-tricks-with-implicit-return-in-nim.html |
15:16:38 | FromDiscord | <zumi.dxy> oh dayum, that's handy |
15:20:10 | FromDiscord | <pmunch> Yup |
15:20:58 | FromDiscord | <pmunch> It ensures that all branches return something, or returns/throw an exception. |
15:21:05 | FromDiscord | <the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=CpUEhXOIcFaW |
15:21:20 | FromDiscord | <the_real_hypno> (edit) "https://play.nim-lang.org/#pasty=JvdCULafVElg" => "https://play.nim-lang.org/#pasty=BNvZAxPZaATm" |
15:22:32 | FromDiscord | <the_real_hypno> (edit) "https://play.nim-lang.org/#pasty=mgNyGMskYyxr" => "https://play.nim-lang.org/#pasty=ymeFIWbiouBN" |
15:23:04 | FromDiscord | <pmunch> In reply to @PMunch "Like, this feels wrong": And you can stuff is pretty much anything in thero |
15:24:17 | FromDiscord | <pmunch> (edit) "is" => "in" | "thero" => "there" |
15:24:46 | FromDiscord | <pmunch> @zumi.dxy ^ |
15:25:22 | FromDiscord | <zumi.dxy> I already knew that it works with `if` and `case` but↵even `try` works 🤔 |
15:26:36 | FromDiscord | <zumi.dxy> some refactoring may be in order then 😄 |
15:29:15 | FromDiscord | <the_real_hypno> No one? Sad.↵↵Anyway: above example shows when using "return" is necessary |
15:31:54 | FromDiscord | <pmunch> @the_real_hypno I have no idea what you meant. Was that a question for help? |
15:32:29 | FromDiscord | <pmunch> In reply to @zumi.dxy "I already knew that": Works with all the block statements |
15:32:33 | FromDiscord | <the_real_hypno> I wanted to ask one about my problem but figured out myself while writing it down here |
15:33:08 | FromDiscord | <pmunch> You can even do `let x = block:...` |
15:33:10 | FromDiscord | <the_real_hypno> But i thought its a good example for when using "return" instead of result is a good thing |
15:34:15 | FromDiscord | <zidsal> And my take away after reading that article is that the p in pmunch stands for Peter |
15:34:20 | * | ntat joined #nim |
15:34:25 | FromDiscord | <pmunch> Ah right, yes return is good for control flow |
15:34:40 | FromDiscord | <pmunch> In reply to @zidsal "And my take away": Haha, correct |
15:35:28 | FromDiscord | <the_real_hypno> Its even necessary in that example because i allocate a newSeq[char](size) it jumps into the next branch |
15:35:50 | FromDiscord | <the_real_hypno> (edit) "Its even necessary in that example because ... i" added "since" |
15:36:42 | FromDiscord | <the_real_hypno> And somehow the T is typeof(seq) happily accepts my created sequence |
15:37:14 | FromDiscord | <the_real_hypno> Or probably the else |
16:16:08 | * | pmp-p quit (Ping timeout: 260 seconds) |
16:32:26 | * | krux02_ joined #nim |
16:34:53 | * | krux02 quit (Ping timeout: 240 seconds) |
16:54:38 | * | xet7 joined #nim |
17:14:22 | FromDiscord | <wileycoleman> Is there a simple library that will let me clip rectangular sub images from a larger image file? I have a jpg file that contains the tile surface images for my game. I was looking at Pixie but don't see this capability in the docs. I would like to pluck the individual tile images off and perhaps put them in an array. |
17:14:45 | FromDiscord | <wileycoleman> (edit) "Is there a simple library that will let me clip rectangular sub images from a larger image file? I have a jpg file that contains the tile surface images for my game. I was looking at Pixie but don't see this capability in the docs. I would like to pluck the individual tile images off and perhaps put them in an array. ... " added "Ultimately I would use them like this pixbuf: Pixbuf = loadPixbuf("./cereal.jpg")" |
17:16:03 | FromDiscord | <wileycoleman> (edit) "loadPixbuf("./cereal.jpg")" => "loadPixbuf(onetileimage) then put this in a picture inside a box or button." |
17:16:26 | * | xet7 quit (Remote host closed the connection) |
17:21:47 | FromDiscord | <pmunch> SDL would probably work |
17:22:25 | Amun-Ra | plus SDL_image |
17:27:05 | * | rez joined #nim |
17:49:10 | * | pmp-p joined #nim |
17:54:32 | * | coldfeet joined #nim |
18:02:42 | * | bomb quit (Remote host closed the connection) |
18:02:50 | * | bomb_ joined #nim |
18:07:24 | * | rez quit (Quit: much snoozes...) |
18:11:12 | * | bomb_ is now known as bomb |
18:21:27 | strogon14 | wileycoleman: you can do that with pixie. the documentation is just not very clear about it. You can use masks for cropping images and ImagePaints for copying between image objects. |
18:21:27 | strogon14 | https://play.nim-lang.org/#pasty=FMyLLUzdKyuY |
18:22:09 | strogon14 | You can somehat infer that from the tutorial: https://github.com/treeform/pixiebook/blob/master/tutorial.md |
18:25:46 | FromDiscord | <user2m> sent a code paste, see https://play.nim-lang.org/#pasty=ZeKfVCRtgAuk |
18:26:18 | FromDiscord | <user2m> (edit) "https://play.nim-lang.org/#pasty=zyRxRISsACGP" => "https://play.nim-lang.org/#pasty=fYdrFvMgmRmw" |
18:26:18 | FromDiscord | <Phil> sent a long message, see https://pasty.ee/KDeUkuDtPDVX |
18:26:25 | FromDiscord | <Phil> I can't really know how many nodes there will be along the way |
18:28:34 | FromDiscord | <Phil> The Problem that I see here given nim's static type system is that each Node needs a ref to its parent.↵However, if you have a ref to the parent, you'll also need to contain all of its generic types. Which means your type needs to have all of its generic types and may include another one of its own. And that just stacks along the way |
18:28:59 | FromDiscord | <Phil> (edit) "The Problem that I see here given nim's static type system is that each Node needs a ref to its parent.↵However, if you have a ref to the parent, you'll also need to contain all of its generic types. Which means your type needs to have all of its generic types and may include another one of its own. And that just stacks along the way ... " added "as each node might introduce a new generic type or rather you must assume that e |
18:29:35 | FromDiscord | <Phil> ... maybe I should ask this in the forum |
18:33:04 | * | bomb quit (Remote host closed the connection) |
18:39:47 | FromDiscord | <Elegantbeef> Turn it all into closure procedures 😄 |
18:40:16 | FromDiscord | <Phil> I can't even conceptualize what that would look like |
18:40:43 | FromDiscord | <Elegantbeef> Closure generators that capture the data and return a value |
18:41:36 | FromDiscord | <the_real_hypno> Is there a way to determine the needed size of a variable inside a sequence which hasnt been specified?↵↵Like, if i do [0x90, 0x90, 0x90] be it array or sequence, its always 3x sizeof(int) |
18:41:51 | FromDiscord | <the_real_hypno> while i personally would have expected uint8 so 3x3 |
18:42:32 | FromDiscord | <Elegantbeef> `0x90u8` |
18:42:37 | FromDiscord | <the_real_hypno> or can i possible reject the given values if they have been guessed by the compiler? |
18:42:47 | FromDiscord | <Elegantbeef> The first one tells the rest how to type |
18:42:50 | FromDiscord | <the_real_hypno> In reply to @Elegantbeef "`0x90u8`": yes but im not on the "writer" side |
18:43:03 | FromDiscord | <Elegantbeef> What does that even mean |
18:43:54 | FromDiscord | <the_real_hypno> Well, im working with memory writing and reading and try to make it as convienient and secure as possible. And i can see a user doing exactly this: [0x90, 0x90, 0x90] |
18:44:07 | FromDiscord | <the_real_hypno> And that would harm, which it shouldnt |
18:44:25 | FromDiscord | <Elegantbeef> So write a proc that takes `var openArray[byte]` |
18:44:31 | FromDiscord | <Elegantbeef> Though why would the above be an issue? |
18:44:48 | FromDiscord | <Elegantbeef> `sizeof(mySeq[0]) mySeq.len` works just fine |
18:45:09 | FromDiscord | <the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=xTLXArXqIIng |
18:45:19 | FromDiscord | <the_real_hypno> but this: ↵ [0x90, 0x90, 0x90] |
18:45:26 | FromDiscord | <the_real_hypno> is not uint8 |
18:45:28 | FromDiscord | <the_real_hypno> its int |
18:45:30 | FromDiscord | <the_real_hypno> so its 8 |
18:45:33 | FromDiscord | <Elegantbeef> or `sizeof(theArray)` |
18:47:14 | FromDiscord | <the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=mOOCmWMyLYzj |
18:47:20 | FromDiscord | <the_real_hypno> 8↵4↵32↵5 |
18:48:09 | FromDiscord | <the_real_hypno> So i guess since you dont see my problem its probably me doing something wrong 😛 |
18:52:22 | NimEventer | New thread by Isofruit: How to implement a generic arbitrary node-graph with unknown number of generic types?, see https://forum.nim-lang.org/t/11506 |
18:54:50 | FromDiscord | <Phil> In reply to @Elegantbeef "Closure generators that capture": I may just be too mentally dead to imagine how that'd look like, apologies |
19:05:38 | FromDiscord | <Elegantbeef> @the_real_hypno you're using `if` not `when` |
19:05:59 | FromDiscord | <the_real_hypno> oh my god |
19:06:20 | FromDiscord | <the_real_hypno> Thanks, you saved me from a lot of hacky boundary checks |
19:07:01 | FromDiscord | <Elegantbeef> Also `T is openArray` I don't think will pass |
19:07:18 | FromDiscord | <Elegantbeef> Unless you do `myProc(myArg.toOpenArray(a, b))` |
19:08:21 | FromDiscord | <the_real_hypno> It took `seq[array[3, int]] = @[[1, 2, 3], [4, 5, 6], [7, 8, 9]]` |
19:08:31 | FromDiscord | <the_real_hypno> but i didnt try something else |
19:09:01 | FromDiscord | <Elegantbeef> Right but `assert [1, 2, 3] isnot openArray[int]` |
19:09:28 | FromDiscord | <Elegantbeef> `openArray` is not a generic typeclass it's a type containers implicitly convert to |
19:10:36 | FromDiscord | <the_real_hypno> I think its even useless to check for openArray type right? As far as i know `if typeof(T) is seq:` already gladly accepts array |
19:10:37 | FromDiscord | <the_real_hypno> (edit) "array" => "arrays" |
19:10:51 | FromDiscord | <Elegantbeef> No it does not accept arrays |
19:11:11 | FromDiscord | <Elegantbeef> `assert [1, 2, 3] isnot seq` |
19:11:45 | FromDiscord | <Elegantbeef> Really what you're doing seems best to be done by an intermediate proc |
19:11:55 | FromDiscord | <Elegantbeef> Have a proc that does your operations but takes in `addr, size` |
19:12:25 | FromDiscord | <the_real_hypno> yes that would have been my next attempt: One proc that can get feed everything |
19:12:29 | FromDiscord | <the_real_hypno> and the rest i will define |
19:12:38 | FromDiscord | <the_real_hypno> (edit) "yes that would have been my next attempt: One proc that can get feed everything ... " added "(which doesnt get exported)" |
19:13:04 | FromDiscord | <the_real_hypno> Or wasnt that what you mean? |
19:13:08 | FromDiscord | <the_real_hypno> im open for ideas! |
19:15:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=RrVBtLQkrKnJ |
19:17:28 | FromDiscord | <the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=SAqxBKcuDMUJ |
19:18:19 | FromDiscord | <the_real_hypno> sent a code paste, see https://play.nim-lang.org/#pasty=SXuYvqGyVtcJ |
19:21:07 | FromDiscord | <.bobbbob> do I have to call randomize() once per thread or is doing it once globally at the beginning of the program enough? |
19:22:05 | * | def- quit (Quit: -) |
19:30:31 | * | ntat quit (Quit: Leaving) |
19:38:45 | * | def- joined #nim |
19:42:27 | FromDiscord | <Elegantbeef> @.bobbbob check if the global rand variable is a threadvar(it probably is) |
19:47:38 | FromDiscord | <polylokh_39446> doesn't seem to be: <https://github.com/nim-lang/Nim/blob/version-2-0/lib/pure/random.nim#L118>↵how can that be checked with a program? |
19:47:54 | FromDiscord | <Elegantbeef> Then you need to init it once |
19:48:07 | FromDiscord | <Elegantbeef> Create two threads and check if the address of `state` is the same |
19:50:57 | FromDiscord | <Elegantbeef> For example https://play.nim-lang.org/#pasty=HpKWbRRFoDQr |
19:53:27 | FromDiscord | <polylokh_39446> sent a code paste, see https://play.nim-lang.org/#pasty=dUGsoELeveIb |
19:57:07 | FromDiscord | <Elegantbeef> QED https://play.nim-lang.org/#pasty=XxIWVJPCpSlD |
19:58:28 | FromDiscord | <polylokh_39446> cool, thanks |
20:01:33 | FromDiscord | <wileycoleman> In reply to @strogon14 "You can somehat infer": Thanks that makes sense now! |
20:31:06 | * | coldfeet quit (Remote host closed the connection) |
20:43:03 | FromDiscord | <wileycoleman> sent a code paste, see https://play.nim-lang.org/#pasty=pzUIkdFlLhcC |
20:43:46 | FromDiscord | <wileycoleman> Image doesn't work obviously. |
20:43:52 | FromDiscord | <Elegantbeef> You load the image into a pixbuff |
20:44:14 | FromDiscord | <wileycoleman> how please? |
20:45:24 | FromDiscord | <Elegantbeef> There is the Picture example |
20:45:24 | FromDiscord | <Elegantbeef> https://github.com/can-lehmann/owlkettle/blob/3c08d1cadd0042caee0af6dcdce429ba9ecdddbe/examples/widgets/picture.nim#L178 |
20:45:56 | FromDiscord | <wileycoleman> (edit) "please?" => "to display a picture with a pixbuf. I can't figure out how to convert an in memory image object to a pixbuf." |
20:47:09 | FromDiscord | <wileycoleman> In reply to @Elegantbeef "https://github.com/can-lehmann/owlkettle/blob/3c08d": Yes I saw that example, what is missing is how to plug in an in memory image object... |
20:51:08 | FromDiscord | <Elegantbeef> `newPixBuf` |
20:51:42 | FromDiscord | <Phil> https://github.com/can-lehmann/owlkettle/blob/3c08d1cadd0042caee0af6dcdce429ba9ecdddbe/owlkettle/bindings/gtk.nim#L545 ↵One of these might do the trick |
20:54:57 | FromDiscord | <Phil> https://github.com/can-lehmann/owlkettle/blob/3c08d1cadd0042caee0af6dcdce429ba9ecdddbe/owlkettle/widgets.nim#L648↵↵Never mind we have some higher level wrappers |
20:57:43 | FromDiscord | <wileycoleman> I will try this later, its seems rather complicated versus loading from a file. |
20:58:43 | FromDiscord | <Phil> I will admit it's only mildly higher level than the GTK API itself and that's really not centered around image stuff |
21:43:32 | NimEventer | New thread by Phyton: Compilation Problem: "Error: cannot open C:\..\..\..\lib\system.nim", see https://forum.nim-lang.org/t/11507 |
22:27:27 | FromDiscord | <can.l> In reply to @wileycoleman "I know how to": You need the overload with a `data` argument: https://github.com/can-lehmann/owlkettle/blob/main/owlkettle/widgets.nim#L660 Not sure if this is helpful, but here is an example where I use newPixbuf to convert the contents of a cairo context to a Pixbuf: https://github.com/can-lehmann/Graphing/blob/main/src/graphing.nim#L977-L982 |
22:33:10 | FromDiscord | <Elegantbeef> @can.l before I delve into the docs does gtk have a constructor that includes stride? |
22:33:29 | FromDiscord | <Elegantbeef> Ah it does I see from phils |
22:33:36 | FromDiscord | <Elegantbeef> I should click links 😄 |
22:34:10 | FromDiscord | <can.l> In reply to @Elegantbeef "<@893965307171979326> before I delve": Maybe rowstride: https://docs.gtk.org/gdk-pixbuf/ctor.Pixbuf.new_from_data.html |
22:34:47 | FromDiscord | <Elegantbeef> If that was exposed you could do `cast[ptr UncheckedArray[int8]].toOpenArray(0, len - 1)` and supply `stride = 4` without copying |
22:35:24 | FromDiscord | <Elegantbeef> Wait nevermind that's row stride |
22:35:24 | FromDiscord | <Elegantbeef> Ugh |
22:35:44 | FromDiscord | <can.l> In the graphing app? |
22:35:54 | FromDiscord | <Elegantbeef> Yea |
22:37:05 | FromDiscord | <can.l> The issue is that on little endian systems, the channel order is exactly oppsoite of what it needs to be 😐 |
22:37:18 | FromDiscord | <can.l> (edit) "oppsoite" => "opposite" |
22:37:55 | FromDiscord | <Elegantbeef> Right, the GTK api should specify order aswell, shame |
22:38:29 | FromDiscord | <can.l> Yeah, this should be part of https://docs.gtk.org/gdk-pixbuf/enum.Colorspace.html |
22:38:33 | FromDiscord | <Elegantbeef> Should specify order, stride and rowstride to allow loading just `r` from `rgba` or `argb`, .... |
22:38:36 | FromDiscord | <can.l> i.e. there should probably COLORSPACE_BGR |
22:38:41 | FromDiscord | <can.l> (edit) "i.e. there should probably ... COLORSPACE_BGR" added "be" |
22:39:26 | * | nyeaa49284230101 quit (Quit: The Lounge - https://thelounge.chat) |
22:41:56 | * | nyeaa49284230101 joined #nim |
22:43:38 | FromDiscord | <can.l> cairo also does not have it... https://cairographics.org/manual/cairo-Image-Surfaces.html#cairo-format-t |
22:43:38 | FromDiscord | <Elegantbeef> I guess even opengl's `glTexStorage` do not have what I mention |
22:43:39 | FromDiscord | <Elegantbeef> Equally simple |
22:43:39 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=dDXeyahBpcda |
22:43:39 | FromDiscord | <Elegantbeef> Wait that's the wrong proc I realise |
22:43:41 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=FwohqEGtbJwE |
22:43:43 | FromDiscord | <Elegantbeef> There we go |
22:43:43 | FromDiscord | <Elegantbeef> There's no way to only upload the `r` channel of a texture in opengl aswell so I'm probably living in a pipedream world 😄 |
22:43:57 | FromDiscord | <Elegantbeef> Opengl does have BGR |
22:44:11 | FromDiscord | <can.l> Huh, the bridge just glitched... |
22:44:26 | FromDiscord | <can.l> I did not receive all your messages until now. |
22:44:34 | FromDiscord | <Elegantbeef> It does that occasionally |
22:44:37 | FromDiscord | <can.l> (edit) "I did not receive all your ... messages" added "related to opengl" |
22:44:48 | FromDiscord | <can.l> (edit) "I did not receive all your ... related" added "messages" | removed "messages" |
22:44:54 | FromDiscord | <Elegantbeef> One day someone can write a proper bridge using my matrix API 🙂 |
22:45:45 | FromDiscord | <Elegantbeef> In the meantime everyone should use matrix! |
22:47:36 | FromDiscord | <can.l> 😄 |
22:56:20 | FromDiscord | <wileycoleman> sent a code paste, see https://play.nim-lang.org/#pasty=LoPLJfgYdzYr |
22:57:41 | FromDiscord | <wileycoleman> However since I want to load a whole lot of these images, it seems inefficient to keep loading from the file every time. I was hoping to load once then crop from that. |
23:01:05 | FromDiscord | <Elegantbeef> cache the image then crop it |
23:04:27 | FromDiscord | <can.l> You can use an `afterBuild` hook, if you want to assign multiple fields of a viewable based on a common `alltiles` pixbuf: https://can-lehmann.github.io/owlkettle/book/internals/hooks/after_build_hook.html |
23:04:37 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=BSsjNmBMbUXs |
23:06:44 | FromDiscord | <Elegantbeef> That code expanded will cache all pixbufs you want, including crops of crops |
23:06:59 | FromDiscord | <Elegantbeef> Just draw the rest of the owl |
23:07:45 | FromDiscord | <Elegantbeef> Though I might be in too deep since i've been caching everything I can for my present project |
23:08:03 | FromDiscord | <can.l> sent a code paste, see https://play.nim-lang.org/#pasty=cHcPbUEVbWmw |
23:08:44 | FromDiscord | <wileycoleman> Thanks! I will dig into this more later on. I appreciate all the help from everyone. |
23:08:53 | FromDiscord | <Elegantbeef> In hindsight I could suggest my kashae 😄 |
23:09:25 | FromDiscord | <Elegantbeef> `proc loadCachedImage(img: ImageEntry) {.cached.}` would be all that requires 😄 |
23:09:36 | FromDiscord | <Elegantbeef> Though it of course would always load `path` before cropping |
23:13:01 | FromDiscord | <Elegantbeef> sent a code paste, see https://play.nim-lang.org/#pasty=tdqwgpsKYgJI |
23:13:48 | FromDiscord | <can.l> oh neat |
23:29:46 | * | rez joined #nim |
23:42:38 | * | rez quit (Quit: l8r) |