00:00:56 | * | laaron quit (Quit: ZNC 1.7.1 - https://znc.in) |
00:03:29 | * | rnrwashere quit (Remote host closed the connection) |
00:05:44 | * | laaron joined #nim |
00:08:10 | * | rnrwashere joined #nim |
00:09:25 | * | cyberjpn joined #nim |
00:12:23 | skrylar[m] | `Returns 1 if the computer is on. If the computer isn't on, the value returned by this function is undefined. |
00:20:59 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
00:37:52 | FromGitter | <gogolxdong> Nim has to compile to machine code on RISC-V. |
00:41:47 | * | laaron quit (Remote host closed the connection) |
00:42:09 | * | laaron joined #nim |
01:34:51 | skrylar[m] | i have a nagging feeling that people are going to hate any gui kit that isn't just qt |
01:49:38 | * | dddddd quit (Ping timeout: 245 seconds) |
01:50:43 | * | vlad1777d quit (Ping timeout: 246 seconds) |
02:01:36 | * | banc quit (Quit: Bye) |
02:04:31 | * | kapilp joined #nim |
02:15:52 | leorize[m] | skrylar: there's also `is_computer_on_fire()` |
02:18:18 | FromDiscord | <treeform> Wait ppl hate qt too. |
02:23:07 | * | banc joined #nim |
02:27:07 | FromDiscord | <DeltaPHC> People dislike pretty much all GUI toolkits for one reason for another. lol |
02:30:45 | FromDiscord | <DeltaPHC> Doesn't look 'native' (GTK; and has questionable meaning on Windows and Linux), uses too much resources (Electron), is quite heavyweight (Qt), too simple/primitive (libui), made for games (immediate mode libraries), isn't cross-platform (Win32/WinForms/WPF/UWP/Cocoa/etc) |
02:31:39 | FromDiscord | <DeltaPHC> 'questionable meaning' referring to 'native' |
02:35:25 | FromDiscord | <DeltaPHC> IMO, a true cross-platform GUI that can be everything to everyone is more of a pipe dream. Like a version of utopia that we're always trying to reach but can never get it quite right |
02:43:24 | shashlick | Partly why I've just used winapi directly on windows for feud |
02:44:02 | shashlick | But as I enhance it, it gets more boring to think about support on other os |
02:59:07 | * | leorize quit (Quit: WeeChat 2.3) |
03:04:03 | * | dddddd joined #nim |
03:05:25 | * | leorize joined #nim |
03:13:53 | * | elronnd joined #nim |
03:14:37 | * | elronnd is now known as Elronnd |
03:22:41 | * | theelous3 quit (Ping timeout: 252 seconds) |
03:29:04 | FromDiscord | <kiwi> Question for @PMunch: I spent the morning working away with wxnim. Looking good up until I decided to change the colour of my buttons using setBackgroundColour. I couldn't find any working versions of wxColor or WxColor or wxColour or WxColour. Any thoughts please? |
03:33:44 | FromGitter | <Varriount> Shashlick: What's Feud? |
03:34:34 | shashlick | it's the text editor i've been working on - runs on windows, built with nim, scintilla, and winapi |
03:34:39 | shashlick | https://github.com/genotrance/feud |
03:47:55 | * | sealmove quit (Quit: WeeChat 2.4) |
03:54:51 | * | cyberjpn quit (Ping timeout: 246 seconds) |
04:21:16 | skrylar[m] | when i was making my own in go once, i went all the way in to left field. basically a Self-like tree of morphs, except things were assigned implementation on context, so there was no such things as a "menu." if you put a button inside a button, it made it a drop-down, if you put buttons inside a window, it became the menu, and submenus, and whatnot, so the actual UX code was purely semantic |
04:21:39 | skrylar[m] | it became a menu or a tool bar or a button or whatever based on where it was |
04:22:19 | skrylar[m] | the internals for that were... a bit strange |
04:42:24 | skrylar[m] | @varriount how did your stuff with SOAP and GUIs go? |
05:12:27 | * | dddddd quit (Remote host closed the connection) |
05:16:57 | * | cyberjpn joined #nim |
05:31:18 | * | kapilp quit (Quit: Connection closed for inactivity) |
05:50:48 | FromDiscord | <kiwi> Got it @PMunch - I can use constructwxColour to create the wxColours. |
05:54:59 | * | solitudesf joined #nim |
06:01:53 | * | narimiran joined #nim |
06:09:44 | FromDiscord | <kiwi> However you can't setBackgroundColour in linux so that seems to seal in Python with Qt5 as the more attractive option. |
06:09:58 | FromDiscord | <kiwi> However you can't setBackgroundColour for buttons in linux so that seems to seal in Python with Qt5 as the more attractive option. |
06:18:21 | * | solitudesf quit (Ping timeout: 246 seconds) |
06:24:47 | * | cyberjpn quit (Ping timeout: 258 seconds) |
06:35:29 | * | Vladar joined #nim |
06:46:59 | * | rnrwashere quit (Remote host closed the connection) |
07:00:00 | * | gmpreussner quit (Quit: kthxbye) |
07:04:39 | * | gmpreussner joined #nim |
07:07:43 | * | narimiran quit (Ping timeout: 258 seconds) |
07:29:07 | FromDiscord | <kiwi> However you can't setBackgroundColour for buttons in linux. I assume that's being true to the native gtk style, so that seems to seal in Python with Qt5 as the more attractive option. Thats a shame because I'd like to have migrated it to Nim. |
07:29:34 | FromDiscord | <kiwi> However you can't setBackgroundColour for buttons in linux. Foreground changes the text, background seems to be nothing. I assume that's being true to the native gtk style, so that seems to seal in Python with Qt5 as the more attractive option. Thats a shame because I'd like to have migrated it to Nim. |
07:33:04 | * | xet7 joined #nim |
07:37:44 | * | clyybber joined #nim |
07:47:06 | * | enigmeta quit (Quit: Connection closed for inactivity) |
07:58:21 | * | Trustable joined #nim |
08:04:26 | skrylar[m] | there are advantages to drawing widgets yourself :/ |
08:04:40 | skrylar[m] | although doesn't Qt also spend an exorbinant amount of effort... trying to recreate what the platform already does |
08:24:59 | * | cyberjpn joined #nim |
08:32:27 | * | leorize quit (Ping timeout: 256 seconds) |
08:40:42 | FromDiscord | <kiwi> I have seen that written elsewhere, skrylar, but why should QT's implementation cost many more cycles (per unit quality) than a system version. |
08:44:25 | skrylar[m] | i'm thinking here the code effort to ex. get the native theming interface to draw the button, then also interface with the IME services if you're dealing with asian languages, and so forth |
08:44:50 | skrylar[m] | performance-wise qt didn't seem to have troubles (although sig/slot is going to be less efficient by a tiny margin, doesn't seem to have mattered) |
08:45:45 | skrylar[m] | also to make sure you get the border sizes correct because you can't always ask what those are, you just sort ofh ave to tweak it and pray, and then also deal with dpi scaling if that happens (LOT of programs surprisingly break when dpi scaling was turned on) |
08:46:35 | skrylar[m] | this reminds me that one thing i do need to pilfer from the vcl is the auto-size property for labels |
08:50:23 | * | cyberjpn quit (Ping timeout: 244 seconds) |
08:53:16 | * | kapilp joined #nim |
08:54:38 | * | leorize joined #nim |
09:08:38 | FromDiscord | <SirHaswell> Why when I do this code, it only displays 1 instruction and not all of them? I know that tokens contains 12 Token objects when I did it https://hastebin.com/netuzifiqa.cs |
09:18:47 | * | nsf joined #nim |
09:20:02 | leorize | the amount of return in the code is terrifying :p |
09:20:37 | leorize | for display_function, there's a built-in result variable that you could re-use instead of making a new token variable |
09:21:01 | leorize | also, seqs are now initialized by default |
09:25:14 | FromDiscord | <SirHaswell> I don't understand what's not working and you don't seem to say it in your message |
09:28:19 | * | vlad1777d joined #nim |
09:41:31 | FromDiscord | <SirHaswell> I search all over the internet and it drives me crazy |
09:41:31 | FromDiscord | <SirHaswell> how to know a tank is a space or not? I can't find how to convert a tank into a Rune |
09:47:21 | FromGitter | <alehander42> what is tank? |
09:49:39 | * | solitudesf joined #nim |
09:58:23 | FromDiscord | <SirHaswell> deepl ... |
09:58:31 | FromDiscord | <SirHaswell> not tank, char |
10:01:29 | * | nsf quit (Quit: WeeChat 2.4) |
10:06:04 | FromGitter | <alehander42> runeAt($c, 0) ? |
10:06:24 | FromGitter | <alehander42> or something maybe |
10:06:39 | FromGitter | <alehander42> do you really need an unicode string for this program |
10:08:08 | FromDiscord | <SirHaswell> I need to know exactly which tank is a space or not |
10:09:01 | FromGitter | <alehander42> but can't you compare it to ` ` directly |
10:12:37 | * | al_ joined #nim |
10:29:22 | * | Cold[m] joined #nim |
10:31:15 | Cold[m] | hello, guys, i wanted to ask something |
10:40:46 | Zevv | hi Cold[m], just ask |
10:43:13 | * | laaron- joined #nim |
10:44:00 | Cold[m] | so in the docs, it says that the quit proc doesn't collect garbage. is this true? |
10:45:57 | Cold[m] | because when i ran my app through valgrind, it says all the heap blocks were freed |
10:46:25 | Cold[m] | regardless if i called quit(QuitFailure) |
10:46:45 | * | laaron quit (Ping timeout: 256 seconds) |
10:54:52 | * | entus1ast joined #nim |
10:55:22 | entus1ast | are you aware of a working async process implementation? |
10:55:43 | * | entus1ast is now known as enthus1ast |
10:57:16 | FromGitter | <jrfondren> working in what sense? you can spawn any process and then add a trigger to the event machine when it ends |
10:57:51 | enthus1ast | there was cheatfates implementation (in asynctools) but it seems abadonned |
10:58:00 | FromGitter | <jrfondren> https://nim-lang.github.io/Nim/asyncdispatch.html#addProcess%2Cint%2CCallback |
10:58:06 | FromGitter | <jrfondren> implementation of what? |
10:58:31 | enthus1ast | https://github.com/cheatfate/asynctools/blob/master/asynctools/asyncproc.nim |
10:58:42 | FromGitter | <jrfondren> yeah, and what do you want from that? |
10:59:11 | enthus1ast | that it works withouth me patching it? |
11:01:34 | enthus1ast | i'm working on a simple monitoring and command execution tool (imagine nagios + saltsack with nim) and for this i need to spawn processes (that could be long running) and asyncly report back to the monitoring server |
11:04:10 | enthus1ast | and atm i do not see any async process implementation that is maintained, so i was wondering if someone has something |
11:17:59 | * | enthus1ast quit (Ping timeout: 256 seconds) |
11:30:21 | * | kapilp quit (Quit: Connection closed for inactivity) |
11:34:36 | * | jjido joined #nim |
11:43:22 | * | solitudesf quit (Remote host closed the connection) |
11:43:43 | * | solitudesf joined #nim |
12:04:07 | * | nsf joined #nim |
12:05:22 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
12:09:16 | * | rnrwashere joined #nim |
12:10:04 | * | dddddd joined #nim |
12:13:47 | * | rnrwashere quit (Ping timeout: 248 seconds) |
12:17:43 | * | jjido joined #nim |
12:32:53 | * | al_ quit (Quit: al_) |
12:39:32 | federico3 | nagios and saltstack... urgh |
12:43:31 | * | cyberjpn joined #nim |
12:56:47 | FromGitter | <mratsim> @enthus1ast, asynctools as been superceded by Chronos |
12:58:57 | FromGitter | <mratsim> async processes are not there yet though, but it's planned |
13:01:57 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
13:29:32 | * | mal`` quit (Quit: Leaving) |
13:34:54 | * | mal`` joined #nim |
13:39:13 | federico3 | is Chronos meant to be merged into the stdlib? |
13:39:19 | * | Snircle joined #nim |
13:45:44 | * | serialdev[m] left #nim ("User left") |
13:47:10 | * | clyybber quit (Quit: WeeChat 2.4) |
14:05:54 | FromDiscord | <SirHaswell> var inputWithoutSpace = input.match(re"\s+(?=([^\"]*\"[^\"]*\")*[^\"]*$)")` |
14:05:54 | FromDiscord | <SirHaswell> |
14:05:54 | FromDiscord | <SirHaswell> Why my blackslash not work ? |
14:08:16 | FromGitter | <mratsim> @federico3, for now no plan. I think it would require an RFC. |
14:09:22 | FromGitter | <mratsim> we try to keep the async APIs where we can but sometimes we have to depart from it. |
14:10:06 | leorize | @SirHaswell: because that's a string literal |
14:10:14 | leorize | raw string literal* |
14:10:25 | leorize | you can't escape anything within |
14:10:45 | leorize | use triple quote to quote the string instead |
14:11:13 | leorize | re"""s+(?=([^"]*"[^"]*")*[^"]*$)""" |
14:19:48 | FromDiscord | <SirHaswell> https://regexr.com/4e7il it's working on but not working on Nim, i get : None[RegexMatch@ |
14:19:51 | FromDiscord | <SirHaswell> https://regexr.com/4e7il it's working on but not working on Nim, i get : None[RegexMatch] |
14:29:13 | * | cyberjpn quit (Ping timeout: 245 seconds) |
14:34:43 | * | narimiran joined #nim |
15:02:28 | FromDiscord | <Anuke> How would I make a template that invokes a string parsing function at compile-time? |
15:02:28 | FromDiscord | <Anuke> I am attempting to make a template that converts %-strings to colors: as an example, `%"ff0000"` -> `Col(r: 255, g: 0, b:0)`, where Col is a simple RGB color class. |
15:02:28 | FromDiscord | <Anuke> |
15:02:28 | FromDiscord | <Anuke> Code: |
15:02:29 | FromDiscord | <Anuke> ``` |
15:02:29 | FromDiscord | <Anuke> template `%`*(str: string): Col = |
15:02:31 | FromDiscord | <Anuke> Col(r: str[0..1].parseHexInt().uint8, g: str[2..3].parseHexInt().uint8, b: str[4..5].parseHexInt().uint8, a: 255) |
15:02:33 | FromDiscord | <Anuke> ``` |
15:02:34 | FromDiscord | <Anuke> |
15:02:37 | FromDiscord | <Anuke> However, this gives me the error "attempting to call undeclared routine: 'parseHexInt'" on usage, although that proc is marked as `noSideEffect`. What am I doing wrong? |
15:03:13 | FromGitter | <liquid600pgm> are you importing strutils? |
15:03:45 | FromDiscord | <Anuke> Yes, and my IDE displays correct documentation for the `parseHexInt` proc when I hover over it |
15:04:24 | FromDiscord | <Anuke> Note that the error only occurs when using the template; when I convert it to a proc, it works fine |
15:05:09 | FromGitter | <liquid600pgm> are you sure you *need* to use a template here? |
15:05:17 | FromGitter | <liquid600pgm> if a proc can do the job, use it |
15:05:29 | Zevv | Anuke: it works for me? http://p.zevv.nl/?0b93 |
15:05:39 | FromGitter | <liquid600pgm> it's probably a thing with modules |
15:06:15 | FromDiscord | <Anuke> oh, it probably is-- I don't have the `strutils` imported in the module I'm running the code in |
15:06:26 | FromGitter | <liquid600pgm> yeah, that's the problem |
15:06:32 | FromDiscord | <Anuke> interesting |
15:06:34 | FromGitter | <liquid600pgm> I was in the middle of writing this |
15:06:44 | FromGitter | <liquid600pgm> simply add `export toHexInt` |
15:06:57 | FromGitter | <liquid600pgm> should do the job |
15:07:04 | Zevv | parseHexInt :) |
15:07:05 | FromGitter | <liquid600pgm> parseHexInt*, I meant |
15:07:37 | FromDiscord | <Anuke> Alright, that works, thanks |
15:07:51 | narimiran | to repeat: "are you sure you *need* to use a template here?" |
15:08:16 | * | theelous3 joined #nim |
15:08:50 | FromGitter | <liquid600pgm> quote https://nim-lang.org/docs/nep1.html#introduction-coding-conventions |
15:08:55 | FromGitter | <liquid600pgm> `Use a proc when possible, only using the more powerful facilities of macros, templates, iterators, and converters when necessary.` |
15:08:56 | FromDiscord | <Anuke> honestly, I *don't*, but if I happen to have a hex color used when tinting a sprite in a render loop, wouldn't it be faster to use `Col(r, g, b)` instead of parsing it from a string each time? |
15:09:37 | FromGitter | <liquid600pgm> it probably will, but today's computers are so fast you won't notice a difference |
15:09:45 | FromGitter | <liquid600pgm> parsing a hex string isn't a resource-intensive task |
15:10:18 | FromDiscord | <Anuke> Would `str[0..1]` generate garbage? |
15:10:19 | FromGitter | <liquid600pgm> you still substitute the `%"ff0000"` with a Col() constructor |
15:10:46 | FromGitter | <liquid600pgm> a macro could be used here to "compile" the Col() constructor at compile-time, if you really care about performance |
15:10:55 | Zevv | Anuke: if you 'const' your colors the parsing will happen at compile time |
15:11:01 | FromGitter | <liquid600pgm> ^ |
15:11:10 | Zevv | no macros needed |
15:11:20 | Zevv | just a proc and put the output in a const |
15:11:44 | Zevv | rule #1: Only use templates if you can't do it with a proc. Rule #2: Only use macros when you can't do it with a template |
15:14:16 | FromDiscord | <Anuke> Would that mean replacing `core.clearColor = %"af8569"` |
15:14:16 | FromDiscord | <Anuke> with ``` |
15:14:16 | FromDiscord | <Anuke> const cl = %"af8569" |
15:14:16 | FromDiscord | <Anuke> core.clearColor = cl |
15:14:16 | FromDiscord | <Anuke> ``` |
15:14:17 | FromDiscord | <Anuke> ? |
15:14:41 | FromDiscord | <Anuke> or is this first statement implicitly computed at compile time as well? |
15:15:18 | FromDiscord | <Anuke> the first *example*, not statement, sorry |
15:22:03 | FromGitter | <liquid600pgm> I don't think performance would be that terrible if you didn't make it a const anyway, I bet you create a ton of vec2s in your program anyway and it doesn't negatively impact performance. |
15:22:30 | FromGitter | <liquid600pgm> but if you want some optimization, you can use memoization |
15:22:42 | FromGitter | <liquid600pgm> basically, you cache the result of your function |
15:23:12 | FromGitter | <liquid600pgm> and yes, I said *function* not *procedure* because memoization is only useful with *functions* |
15:23:26 | FromGitter | <liquid600pgm> and functions don't have side effects |
15:23:51 | FromGitter | <liquid600pgm> for a given input, they always give the same output no matter what |
15:38:12 | FromGitter | <mratsim> const are always computed at compile-time and the result is pasted at call sites |
15:39:07 | FromGitter | <mratsim> "let" and "var" are sometimes computed at compile-time by the Nim compiler, especially for numeric or bitwise operations. In any case gcc/clang will do constant propagation as well |
15:49:35 | * | Snircle quit (Quit: Textual IRC Client: www.textualapp.com) |
15:58:07 | * | vivus joined #nim |
15:58:49 | vivus | Hello all. I initialized my table like so: mytable = newTable[string, my_str_sequence]() |
15:59:29 | vivus | I am looping through another object, is the following code valid: mytable[p.row[0]] = (p.row[2], []) ? |
15:59:41 | vivus | ```mytable[p.row[0]] = (p.row[2], [])``` |
15:59:58 | narimiran | what is `my_str_sequence`? |
16:00:25 | narimiran | `(p.row[2], [])` is a tuple of some value and an empty array? |
16:02:36 | * | stefanos82 joined #nim |
16:04:27 | vivus | narimiran: var my_str_sequence: seq[string] |
16:05:29 | narimiran | then maybe this is what you wanted? `mytable[p.row[0]] = @[p.row[2]]` |
16:05:45 | * | SenasOzys joined #nim |
16:06:25 | narimiran | but a var cannot be put here: `newTable[string, my_str_sequence]`, you need a type |
16:06:41 | narimiran | newTable[string, seq[string]] |
16:07:18 | * | solitudesf quit (Remote host closed the connection) |
16:07:32 | * | solitudesf joined #nim |
16:07:51 | vivus | oh. What is the difference between saying "var =" and "let ..." ? |
16:08:08 | narimiran | no, var vs let is not a problem here |
16:08:20 | vivus | im trying to understand, cause that is what confused me first |
16:08:26 | narimiran | but var is for variables (mutable stuff), while let is for immutable stuff |
16:08:48 | vivus | immutable meaning I can't add to it? |
16:09:13 | vivus | I want to add to the table |
16:09:22 | narimiran | yes, you cannot add to it. see here for some explantion for var vs let: https://narimiran.github.io/nim-basics/#_naming_values |
16:09:32 | narimiran | you need to have `var myTable` then |
16:42:18 | * | vivus quit (Remote host closed the connection) |
16:52:55 | * | SenasOzys quit (Ping timeout: 255 seconds) |
16:55:32 | FromDiscord | <SirHaswell> https://regexr.com/4e7il it's working on but not working on Nim, i get : None[RegexMatch] why ? |
16:56:18 | narimiran | SirHaswell show us you nim code please |
16:56:20 | Zevv | Can you post a complete example |
16:59:34 | Zevv | Q: Some experiments show that Nim passes proc parameters smaller then 24 bytes by copy, and passes by ref for anything bigger. Where does this magic number 24 come from? |
16:59:45 | narimiran | 3*8 |
16:59:51 | narimiran | and i'm not joking |
17:00:27 | narimiran | 3x pointer size |
17:00:53 | Zevv | why 3? |
17:01:08 | narimiran | now that's a much harder question for me to answer.... |
17:01:28 | Zevv | :) |
17:02:13 | Zevv | and also a basic question: why is the same mechamism not used when assigning let constant vars? How is that different from passign to a constant proc argument? |
17:03:10 | Zevv | wow, "let constant vars", that's a nice way of wording |
17:03:18 | Zevv | I mean 'let' variables. |
17:03:32 | Zevv | also bad, because it's not a variable. But also not a const. How do you call that?! |
17:06:49 | * | nsf quit (Quit: WeeChat 2.4) |
17:06:57 | Zevv | wow, it's even "3 * floatSize" |
17:12:52 | * | coopernurse joined #nim |
17:26:22 | * | JustASlacker joined #nim |
17:34:22 | * | SenasOzys joined #nim |
17:38:09 | FromGitter | <dom96> So I guess we need to fork async tools? |
17:38:12 | * | SenasOzys quit (Read error: Connection reset by peer) |
17:50:28 | * | jjido joined #nim |
17:51:09 | FromDiscord | <treeform> I wrote this asyncPool thing that only lets N async chains to run at the same time. Is there such a thing already? Where is a good place to contribute such a thing? |
17:52:49 | FromDiscord | <treeform> Basically I have a 1000s of HTTP requests to make, but if I make to many it rate limits me. So I make 30 at a time only. |
18:10:26 | FromGitter | <singularperturbation> that sounds very useful :) |
18:17:31 | * | gangstacat quit (Ping timeout: 248 seconds) |
18:21:49 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
18:21:52 | * | gangstacat joined #nim |
18:28:34 | * | JustASlacker quit (Ping timeout: 246 seconds) |
18:29:53 | * | jjido joined #nim |
18:31:18 | FromDiscord | <treeform> thanks |
18:32:43 | * | narimiran quit (Read error: Connection reset by peer) |
18:38:34 | * | gangstacat quit (Quit: Ĝis!) |
18:43:40 | * | JustASlacker joined #nim |
19:02:28 | dom96 | treeform: Make a Nimble package out of this for now |
19:09:12 | * | jjido quit (Quit: My MacBook has gone to sleep. ZZZzzz…) |
19:18:11 | Zevv | narimiran[m]: how do you generate the nim-basics pages? |
19:19:37 | * | Cthalupa quit (Ping timeout: 255 seconds) |
19:22:08 | * | theelous3 quit (Ping timeout: 245 seconds) |
19:23:36 | * | enthus1ast joined #nim |
19:26:51 | enthus1ast | yeah mratsim i loosely follow status-im's code |
19:26:52 | * | laaron- quit (Remote host closed the connection) |
19:30:16 | Zevv | narimiran[m]: nevermind, found the source! |
19:32:31 | enthus1ast | federico3 i know its urgh but, the concepts behind nagios and saltstack is interesting, when i used saltstack a few years ago i find myself fighting with their python agent which was super strange to build, package and distribute. |
19:32:37 | * | JustASlacker quit (Ping timeout: 246 seconds) |
19:32:46 | * | Cthalupa joined #nim |
19:36:55 | dom96 | enthus1ast, please create a fork. I'll happily switch the URL |
19:41:47 | * | Cthalupa quit (Ping timeout: 248 seconds) |
19:44:29 | * | nsf joined #nim |
19:46:41 | * | Cthalupa joined #nim |
19:53:47 | * | vlad1777d quit (Ping timeout: 244 seconds) |
20:05:24 | federico3 | enthus1ast: concepts... in nagios? |
20:07:15 | enthus1ast | dom96: i can't support it, i do not understand it |
20:08:22 | dom96 | I see :/ |
20:08:32 | * | matic joined #nim |
20:08:47 | dom96 | I depend on it, I guess I'll need to support it eventually |
20:09:01 | matic | Hey guys, is there a way to set a timeout for net.recvFrom ? |
20:09:08 | enthus1ast | federico3: the basis: return code determines color of the message, stdout is visible as message in the manager |
20:09:37 | enthus1ast | or lets say, i have not give it enough brain power |
20:11:10 | enthus1ast | and the remote execution part of saltstack was working nice for me |
20:14:23 | enthus1ast | matic, maybe you could check non blocking sockets |
20:14:34 | enthus1ast | but then you have to poll |
20:16:09 | matic | enthus1ast: I'm creating a socket with this 'socket = newSocket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)', how do I make it non blocking? |
20:16:32 | matic | I don't have much experience with sockets. |
20:18:06 | enthus1ast | socket.getFd().setBlocking(false) |
20:18:20 | enthus1ast | but this creates other funny issues :) |
20:19:25 | enthus1ast | this means that when you read from a socket and no new data is there it fails instantly |
20:21:42 | matic | excellent, thanks! |
20:23:18 | enthus1ast | dom96: i would be happy if you would :) |
20:24:48 | * | stefanos82 quit (Remote host closed the connection) |
20:29:28 | FromDiscord | <treeform> dom96, I want to make an "asyncproc" module that could use async stuff to communicate with other process. It appears to be quite hard. I think you almost need to wrap each process you run in its own thread an then communicate with the main process where you emulate it being async. Have you looked into this? |
20:30:08 | FromDiscord | <treeform> enthus1ast, udp should already be non blocking? |
20:30:47 | FromDiscord | <treeform> this is what I do: https://github.com/treeform/netpipe/blob/master/src/netpipe.nim#L127 |
20:30:59 | FromDiscord | <treeform> i guess you do need to call `reactor.socket.getFd().setBlocking(false)` |
20:32:09 | FromDiscord | <treeform> enthus1ast, so what if it fails? that's normal operation. https://github.com/treeform/netpipe/blob/master/src/netpipe.nim#L315 |
20:32:53 | enthus1ast | yes you must catch it, but then there are other issues mainly: how often do i poll? Should i consider polling again if there was something etc etc |
20:33:05 | FromDiscord | <treeform> that is what I do |
20:33:14 | FromDiscord | <treeform> i poll till i get exception or -1 |
20:33:20 | FromDiscord | <treeform> well I guess I poll 1000 times |
20:33:30 | FromDiscord | <treeform> so I can read 1000 packets per tick... |
20:34:16 | FromDiscord | <treeform> checkout my library: https://github.com/treeform/netpipe maybe you can just use it directly |
20:35:46 | * | JustASlacker joined #nim |
20:38:04 | federico3 | treeform: does netpipe provide congestion control and message priority? |
20:38:51 | enthus1ast | if i would write upd code again i would consider asyncdispatch2 (its called chronos now?) |
20:39:48 | FromDiscord | <treeform> congestion control sort of (its not as good as TCP but probably enough) |
20:39:59 | FromDiscord | <treeform> "message priority" no |
20:40:38 | dom96 | treeform: AFAIK asyncproc package does support that |
20:41:09 | dom96 | enthus1ast, just use asyncdispatch, iirc it supports udp now |
20:41:11 | FromDiscord | <treeform> oh its part of asynctools |
20:41:30 | enthus1ast | oh nice dom96 :) |
20:42:08 | * | JustASlacker quit (Ping timeout: 245 seconds) |
20:42:12 | FromDiscord | <treeform> why is this asynctools not part of nim std? |
20:43:10 | * | rnrwashere joined #nim |
20:46:45 | * | matic quit (Quit: Leaving) |
20:59:21 | dom96 | no specific reason |
21:04:08 | * | gangstacat joined #nim |
21:07:44 | FromGitter | <liquid600pgm> https://termbin.com/5kzw |
21:07:49 | FromGitter | <liquid600pgm> I don't think this is supposed to happen |
21:08:10 | FromGitter | <liquid600pgm> is this a bug? |
21:08:40 | FromGitter | <liquid600pgm> basically, it allows anyone to skip privacy and access object fields directly |
21:09:29 | FromGitter | <liquid600pgm> the expected output should have a `set d` line, btw |
21:13:54 | * | rnrwashere quit (Remote host closed the connection) |
21:15:10 | * | rnrwashere joined #nim |
21:21:14 | * | uvegbot quit (Remote host closed the connection) |
21:28:02 | FromGitter | <jrfondren> Nim's a language with casts and pointers. It's going to also have skipped privacy. |
21:28:28 | * | uvegbot joined #nim |
21:32:17 | * | rnrwashere quit (Remote host closed the connection) |
21:32:31 | * | Kaivo quit (Ping timeout: 258 seconds) |
21:33:15 | * | ng0 joined #nim |
21:34:39 | * | Kaivo joined #nim |
21:35:43 | * | smitop joined #nim |
21:36:55 | smitop | I'm using `asyncnet`/`asyncdispatch` to run a basic HTTP server that always responds with a hardcoded response. When I use my computer's LAN IP to connect from an other computer on the network it works great, but I can't connect from the machine itself. Localhost, local IP, always get a connection refused error from Chrome. How do I fix this? |
21:37:08 | FromGitter | <liquid600pgm> yeah, but it's annoying since I need some extra work to be done on assignment |
21:37:39 | * | Trustable quit (Remote host closed the connection) |
21:39:58 | FromGitter | <jrfondren> @smitop, http://$ip/ works remotely but not locally? sounds like you have some weird security. |
21:40:36 | FromGitter | <jrfondren> try turning off selinux (forever) and then the firewall (temporarily) |
21:41:04 | smitop | @jrfondren yep |
21:41:16 | smitop | I've tried turning off windows firewall but that didn't do anything |
21:41:21 | FromGitter | <jrfondren> oh windows. |
21:41:41 | FromGitter | <jrfondren> I have no idea then, sorry. |
21:43:05 | FromGitter | <jrfondren> thing to confirm, though: 1) you can't connect locally on the same runs that you can connect locally? You're not restarting the server to do a local test, or something. ⏎ 2) this also happens with other browsers, like firefox or IE? |
21:44:15 | * | Kaivo quit (Quit: WeeChat 2.4) |
21:45:14 | smitop | It doesn't work in firefox or chrome, but I justed tested using curl (in Windows Subsystem for Linux) and it works there |
21:47:43 | smitop | Powershell's Invoke-WebRequest can't get it either |
21:48:19 | smitop | IDK why the (emulated) Ubuntu shell can access it |
21:48:28 | dom96 | huh, that's peculiar |
21:48:54 | dom96 | Did you try going to http://$your-lan-ip on the machine that's running the HTTP server? |
21:49:02 | * | Kaivo joined #nim |
21:50:19 | smitop | Yep, I'm going to `http://192.168.2.123:7920/` on my server machine, which fails, and the exact same URI on a separate laptop on the same network, which works |
21:51:20 | FromGitter | <jrfondren> turn off your anti-virus? |
21:52:29 | shashlick | Is it running on all interfaces? |
21:53:12 | FromGitter | <jrfondren> he's connecting to the IP though. |
21:55:19 | rayman22201 | sounds like @smitop isn't listening on the loopback interface. WSL works because it's basically a VM, which acts like a separate machine on the network. |
21:55:42 | dom96 | Is that what smitop is using? WSL? |
21:56:00 | dom96 | If so, there is no need for this |
21:56:10 | smitop | I'm running the server on real Windows |
21:56:17 | rayman22201 | He said that he tested by using curl through WSL |
21:56:18 | smitop | And testing via `curl` on WSL |
21:57:21 | * | solitudesf quit (Quit: Leaving) |
21:58:32 | rayman22201 | can you show your asyncnet connect code? |
22:04:41 | smitop | https://www.irccloud.com/pastebin/7HPgWaud/ |
22:05:22 | smitop | Oh and `import asyncdispatch, asyncnet`, forget to copy that |
22:05:38 | * | theelous3 joined #nim |
22:06:59 | dom96 | also, oh, I guess you're the sminot I follow on Twitter. I knew your nickname sounded familiar :) |
22:07:39 | dom96 | You can try: server.socket.bindAddr(port, "localhost") |
22:07:42 | dom96 | See if that makes a difference |
22:09:11 | rayman22201 | you keep sniping me Dom lol |
22:09:31 | rayman22201 | I type too slow :-P |
22:10:23 | rayman22201 | you could also try `server.socket.bindAddr(port, "0.0.0.0")` |
22:10:44 | rayman22201 | It should be doing that automatically as the default, but maybe it's not for some reason? |
22:13:17 | smitop | Still get the same issue |
22:13:39 | smitop | btw I'm not that guy you follow on Twitter |
22:16:31 | rayman22201 | try one more: `server.socket.bindAddr(port, "127.0.0.1")` |
22:18:53 | FromDiscord | <treeform> smitop, some rouers lack the route back capability, so you can't route from your public IP to your public IP. |
22:19:58 | rayman22201 | That shouldn't affect localhost @treeform |
22:20:29 | FromDiscord | <treeform> Yes that should not |
22:21:44 | rayman22201 | the lan network interface works fine for him, it is the localhost interface that does not work. |
22:21:48 | smitop | 127.0.0.1 stops it from working anywhere |
22:22:50 | rayman22201 | hrmm. That's weird |
22:23:31 | smitop | I ran a server example for Node.js and it worked perfectly |
22:24:05 | smitop | So it's probably not a weird bug with my router |
22:25:12 | FromDiscord | <treeform> Could it be that what you are sending back makes Firefox make it look like a connection issue? |
22:25:24 | FromDiscord | <treeform> While curl just takes it? |
22:25:57 | FromDiscord | <treeform> Invalid http header or something like thay |
22:26:38 | FromGitter | <dom96> Are you testing with the same OS/browser versions on your other PC? |
22:26:48 | FromGitter | <dom96> If not then what treeform says is likely |
22:28:10 | rayman22201 | What version of Nim are you using @smiltop? |
22:28:50 | smitop | Both are on recent Chrome, Nim v0.19.6 (c6f601d4) |
22:29:11 | rayman22201 | I just compiled your snippet to repro on devel, and I need to change the line to: `server.socket.bindAddr(Port(port))` or it wont compile |
22:29:49 | rayman22201 | also, I get a "connection reset" error in firefox and chrome, which indeed means a bad header. |
22:30:36 | smitop | I just transcribed it wrong, in my actual code I use a compile-time var there |
22:31:57 | smitop | How is it sending invalid data to localhost, but valid data to other computers on the LAN? |
22:32:07 | smitop | valid/invalid HTTP data that is |
22:32:52 | rayman22201 | The connection is getting closed for some reason |
22:33:46 | rayman22201 | I can actually repro |
22:34:29 | rayman22201 | connection gets closed on localhost, but my linux VM works |
22:35:26 | rayman22201 | I actually think this might be a windows bug in the Nim network code |
22:41:00 | * | Jjp137 quit (Read error: Connection reset by peer) |
22:41:45 | * | Jjp137 joined #nim |
22:48:00 | enthus1ast | smitop try to receive before you send |
22:50:06 | smitop | enthus1ast: Thanks, that worked |
22:50:24 | smitop | `discard await clientSocket.recv(0)` is what I did |
22:50:46 | smitop | `asyncnet` should do that automatically tho if sending |
22:53:01 | FromGitter | <dom96> Why should it? |
22:53:39 | rayman22201 | Please explain @enthus1ast? Why do you need to receive before you send? |
22:53:59 | smitop | @dom96 Because otherwise `asyncnet` is broken on Windows. IDK why it fixes the problem, but it does. |
22:54:22 | smitop | Although it does require the client to send some data over the wire first, which is bad |
22:54:38 | smitop | Perhaps fixing the root issue would also work |
22:55:41 | rayman22201 | My intuition is telling me that the wrong flags are being given to the Windows bind syscall... |
22:55:46 | enthus1ast | idk rayman22201 :/ |
22:56:54 | rayman22201 | you say Node works? |
22:57:42 | smitop | @rayman22201 Yep, I ran a basic node.js server and it worked right |
22:57:43 | FromGitter | <dom96> You should possibly use asynchttpserver of you don't want to deal with these details |
22:58:17 | rayman22201 | @dom96 that sidesteps the issue doesn't it? it still seems like a bug |
22:58:32 | * | rnrwashere joined #nim |
22:59:18 | smitop | My intention isn't to re-implement http, I'm just using some basic http to test my server. Later I intend to implement a custom protocol |
22:59:58 | enthus1ast | btw i run that code on linux and 1/3 of the refreshes showed error messages |
23:00:03 | enthus1ast | the other ran through |
23:00:05 | enthus1ast | others |
23:00:16 | smitop | But the "receive before you send" limitation should definitely be documented |
23:00:29 | rayman22201 | also, looking at the src for asynchttpserver, it has the same bug. That wouldn't have fixed anything, and would have just made it harder to see that there was a bug. |
23:02:27 | enthus1ast | and i see that chrome does: 1. "GET / HTTP/1.1" 2. "GET /favicon.ico HTTP/1.1" maybe favicon this is part of the issue |
23:02:56 | smitop | I tested with curl, which doesn't request favicon, and got the same results |
23:02:59 | * | rnrwashere quit (Ping timeout: 258 seconds) |
23:03:11 | * | nsf quit (Quit: WeeChat 2.4) |
23:04:06 | FromGitter | <dom96> This is how sockets work. You can't just not read data and expect the OS to discard it. |
23:04:37 | FromGitter | <dom96> Asynchttpserver doesn't have the same issue, not sure why you think that |
23:05:14 | smitop | @dom96 But when I connect from a non-localhost computer, the OS *does* discard the data for me |
23:05:39 | enthus1ast | should it not be still in your input buffer? |
23:06:37 | FromGitter | <dom96> So then that's a Windows bug |
23:07:02 | FromGitter | <dom96> It shouldn't give different behaviour like that |
23:07:25 | FromGitter | <dom96> Either that or the behaviour can be explained by different browser versions or configuration |
23:08:36 | rayman22201 | ok. I applogize @Dom96. aysnhttpserver does not have the issue. |
23:08:39 | rayman22201 | Why? |
23:09:04 | smitop | @rayman22201 aysnhttpserver will always read before sending data |
23:09:17 | FromGitter | <dom96> Anyway. If you'd like, make an issue and we can discuss it |
23:09:47 | FromGitter | <dom96> It's an interesting edge case, but imo you're abusing the socket API here |
23:10:04 | FromGitter | <dom96> 'night |
23:10:15 | rayman22201 | I see |
23:10:22 | rayman22201 | night |
23:10:25 | enthus1ast | n8 |
23:11:54 | rayman22201 | There are protocols that send before reading, like ssh and POP, so it still seems weird |
23:12:28 | enthus1ast | rayman22201: test this with nc (ncat, socat) not with the browser |
23:13:45 | enthus1ast | you definitely can send before you read |
23:14:51 | rayman22201 | I know you can in general. I mean using the Nim socket api with the loopback address on Windows. |
23:16:11 | rayman22201 | That's my point. Why is Nim acting unexpectedly in this regard? |
23:16:31 | enthus1ast | is it? Maybe its the browser? |
23:16:43 | rayman22201 | Also, it's a counter point to Dom saying that this is an "abuse" of the socket api |
23:17:31 | rayman22201 | actually. let me test something |
23:18:57 | enthus1ast | https://gist.github.com/enthus1ast/19a472de473e1049ec954f9cc946068c |
23:19:11 | enthus1ast | works as expected |
23:21:49 | enthus1ast | ah |
23:21:54 | enthus1ast | maybe not |
23:22:15 | enthus1ast | echo "foo" | ncat 127.0.0.1 7920 |
23:22:25 | enthus1ast | this indeed resets the connection |
23:23:01 | enthus1ast | this i cannot explain :) |
23:23:57 | enthus1ast | mhh |
23:25:12 | smitop | maybe it's that browsers don't like getting a response before they send data, and when sending over LAN it added enough lag time that browsers sent data (that was ignored) before they got a response |
23:25:13 | rayman22201 | wireshark shows the response. And then a RST packet |
23:25:39 | rayman22201 | and powershell uses a httpclient, so I think it's just http that wants a read first |
23:25:43 | rayman22201 | which makes sense |
23:26:20 | rayman22201 | so it's not an abuse of sockets at all, it's just an abuse of HTTP :-P |
23:27:11 | rayman22201 | well that was a fun dive down the network protocol rabbit hole :/ |
23:41:13 | * | rnrwashere joined #nim |
23:42:14 | * | rnrwashere quit (Client Quit) |
23:43:08 | * | rnrwashere joined #nim |