🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
ToddAndMargo I think I understand.  Would yo mind throwing me togher a quic example usiong 00:07
C++
typedef struct _WTS_SESSION_INFOA {
  DWORD                  SessionId;
  LPSTR                  pWinStationName;
  WTS_CONNECTSTATE_CLASS State;
} WTS_SESSION_INFOA, *PWTS_SESSION_INFOA;
ToddAndMargo the dll is wtsapi32 00:08
ToddAndMargo I guess what is confusing me  on docs.raku.org/language/nativecall#...esentation is where is the tag that says what dll the structure is coming from:    is native("wtsapi32") 00:38
   is symbol("WTSSendMessageA")
guifa_ it would be something like `class WTS_SESSION_INFOA is repr<CStruct> { has uint16 $.SessionID; has [LPSTR] $.pWinStationName; has WTS_CONNECTSTATE_CLASS $.State }` 00:41
You may need to use a HAS instead of has for the $.State depending on if it's a pointer or not (I'd guess it's not, since LPStr that definitely is one is named with p at the start) 00:42
LPSTR I think is best defined as CArray[uint16] 00:43
but I could be wrong
ToddAndMargo Do I not need to tell it the name of the structure (WTS_SESSION_INFOA) is coming from wtsapi32.dll? 00:50
ToddAndMargo In my NativeConstants.pm6 module, I have the followign defined: constant BYTE := uint8; constant LPSTR = CArray[BYTE]; 00:53
ToddAndMargo So I figure I can remove the [] from LPSTR 00:54
Next step. 00:57
   C++
    BOOL WTSEnumerateSessionsA(
      [in]  HANDLE             hServer,
    # WTS_CURRENT_SERVER_HANDLE to use the RD Session Host server that hosts your application.
      [in]  DWORD              Reserved,
      [in]  DWORD              Version,
      [out] PWTS_SESSION_INFOA *ppSessionInfo,
      [out] DWORD              *pCount
    );
*ppSessionInfo points to the first instance of my WTS_SESSION_INFOA object.  *pCount tells me how many of these objects there are.  How do I loop through them? 00:59
guifa_ My guess is you define it as a CArray[PWTS_SESSION_INFOA], because presumably those should be stored in order in memory, aand then you iterate through using pCount, e.g. for ^pCount { sessionInfo[$_] }  04:11
ToddAndMargo :-) 05:09
Xliff ToddAndMargo: Still around? 06:28
Looping through struct arrays is not so simple. NativeCall does NOT support it. 06:29
You have to use C tricks to get at the data.
Please see the role here: github.com/Xliff/p6-GLib/blob/mast...Buffer.pm6 06:30
Feel free to copy and use it. To get at your struct array, you would use "GLib::Roles::TypedBuffer[PWTS_SESSION_INFOA].new($.ppSessionInfo).Array" 06:31
If you would rather manually set the size, then it is:
"my $l = GLib::Roles::TypedBuffer[PWTS_SESSION_INFOA].new($.ppSessionInfo); $l.setSize($.pCount); $l.Array" 06:32
You might need... 06:33
"my $l = GLib::Roles::TypedBuffer[PWTS_SESSION_INFOA].new($.ppSessionInfo); $l.setSize($.pCount, :forced); $l.Array"
Xliff And if that still doesn't work, try this one: 06:34
"my $l = GLib::Roles::TypedBuffer[PWTS_SESSION_INFOA].new($.ppSessionInfo, :!autosize); $l.setSize($.pCount, :forced); $l.Array"
tonyo ToddAndMargo: gist.github.com/tony-o/5c8b9506578...7a043b6a08 08:10
that should get you going on looping through some struct[] from C<->Raku 08:11
ToddAndMargo Tonyo: Thank you! 08:14
Nemokosch > Unsupported use of - as character range. In Raku please use: .. 10:11
I don't think this should be an error. I'm just trying to use - as one character in the group.
Maybe it could generate a "worry" but an error...
lizmat code? 10:12
m: say "-" ~~ /<[-]>/ 10:13
camelia 「-」
Nemokosch `.grep(/ ^ <![<>\-]> /)` works, `.grep(/ ^ <![<>-\]> /)` doesn't work 10:14
anything where - is in the middle doesn't work 10:15
lizmat the latter *could* be interpreted as a range with \] as the endpoint
parsing breaks down before it notices you didn't end the <[]> sequence
lizmat clickbaits rakudoweekly.blog/2022/11/21/2022-47-migratory/ 10:34
guifa_ Nemokosch: I think if you disable Perl warnings it'll let you, but I agree 10:46
tellable6 guifa_, I'll pass your message to Nemokosch
lizmat m: use isms; say "-" ~~ / ^ <![<>-\]> / # indeed 10:49
camelia ===SORRY!===
Unrecognized regex metacharacter < (must be quoted to match literally)
at <tmp>:1
------> use isms; say "-" ~~ / ^ <![<>-\⏏]> / # indeed
Unable to parse regex; couldn't find final '/'
at <tmp>:1
------> use …
Nemokosch m: my $valid = Set.new('Foo', 'Bar'); subset ValidStr of Str where * (elem) $valid; my ValidStr $choice = 'Foo'; 11:02
camelia ( no output )
tellable6 2022-11-22T10:46:56Z #raku <guifa_> Nemokosch: I think if you disable Perl warnings it'll let you, but I agree
Nemokosch bruh, works here... that doesn't help xD 11:03
El_Che Nemokosch: you've been busy on mastodon :)
Nemokosch What mastodon? 11:04
El_Che ah no, not you
Nemokosch I checked out some posts but I didn't even log in iirc 11:04
El_Che I was confused by the m and k sounds, I meant masukomi :)
lizmat yeah, Masukomi has been busy :-) 11:06
Nemokosch I'm not unemployed just yet :grimacing:
Nemokosch Okay... all I know is that the same code works for me with { $_ (elem) %spectrum-paths.keys } and not with * (elem) %spectrum-paths.keys, but I have no clue where the behavior diverged. I think this is not worth investigating, not for me and not for now at least 11:14
SmokeMachine lizmat: is it possible/will it be possible some day, to rak ignore comments on code? 12:50
lizmat: at least for perl and raku
lizmat sure, you can already do that now
if you don't mind the line numbers being off 12:51
SmokeMachine lizmat: how? is there an option or should I use a regex?
(or code)
lizmat figuring that out now myself :-) 12:52
--per-line='*.lines.grep(*.starts-with("#").not) 12:53
or similar
the --per-line defaults to *.lines 12:54
but you can put anything in there that produces lines
but I guess it could actually warrant a separate flag 12:55
--starting-with="#" or --/starting-with="#" ? 12:56
or maybe something more general, like an additional "and" pattern ? 12:57
Anton Antonov weekly: rakuforprediction.wordpress.com/20...valuation/ 15:05
melezhik o/ 16:24
Hi tonyo, does `fez upload` work when tty is not open? - github.com/tony-o/raku-fez/issues/69
tonyo melezhik if you run that command manually/locally does it ask if you'd like to proceed with the upload anyway? 16:57
tonyo wondering if you're hitting this github.com/tony-o/raku-fez/blob/ma...kumod#L535 16:58
melezhik Tony the thing is - I don't run this manually - it gets run by pipeline
tonyo right 16:59
but if that checkbuild prompts then it'll be stuck waiting on tty, which you should be able to find out locally
melezhik according the report checkbuld has passed , as I can see the next step (`tom --clean`) also succeeded - github.com/melezhik/sparrowci-sand...w.yaml#L35 17:00
tonyo the other thing i'm thinking is that your docker container has no route to api.zef.pm 17:01
melezhik the line "cleaning /var/.sparrowdo/env/fez-upload/.sparrowdo/source/.tom/.cache ..." means it proceeds to the next step (the last before `fez upload`)
why?
I mean `fez checkbuild` succeeds ...
line - "01:59:46 :: >>= SparrowCI-SandBox:ver<0.0.1>:auth<zef:melezhik> looks OK"
ci.sparrowhub.io/report/1865 17:02
let me try "echo Y | fez upload" )))
SmokeMachine lizmat: that would still mach substrings inside comments that's at the end of the line, right? 17:06
lizmat ah, ok, so you want Raku's semantics for the use of '#' as a comment indicator 17:07
that's tricky:
m: my $foo = '#'; sat $foo
camelia ===SORRY!=== Error while compiling <tmp>
Undeclared routine:
sat used at line 1. Did you mean 'set', 'say'?
lizmat m: my $foo = '#'; say $foo
camelia #
melezhik tonyo - nope - does not help - ci.sparrowhub.io/report/1882 17:12
tonyo melezhik: can you run a trace rt to api.zef.pm in there?
melezhik which http client do you use in your code? 17:13
tonyo it uses curl or wget 17:14
melezhik curl?
github.com/tony-o/raku-fez/blob/ma...rl.rakumod
I see
tonyo you can run the command `curl --trace-ascii - api.zef.pm` 17:15
melezhik ok
tonyo is this using docker?
melezhik pipeline gets run in docker container 17:16
so far there have not been any issues with access too any other http resources from containers 17:17
in SparrowCI
melezhik . 17:22
tonyo we have something - ci.sparrowhub.io/report/1883
Failed to connect to api.zef.pm port 80: Connection refused
tonyo none of those are the correct ip address 17:23
should be resolving to 52.26.243.128 17:24
melezhik ah, ok, what does it mean? cached dns?
but wait, why does then zef install work? 17:25
tonyo hmm, maybe? it should resolve to 44.238.102.180, 52.26.243.128, 35.166.18.46
what is the dns it is using? can you hardcode it to 8.8.8.8 as a test?
melezhik want me dump resolve.conf? 17:26
tonyo sure
melezhik ok, I will rerun pipeline
wait a sec, it should be my physical host, not docker one issue 17:29
gist.github.com/melezhik/d15f9d85a...0664eda314
log from my debian VM, where docker runs
resolve.conf - gist.github.com/melezhik/d15f9d85a...nt-4378265 17:30
I believed it should be `curl --trace-ascii - api.zef.pm` not just http? 17:31
curl --trace-ascii - api.zef.pm works just fine 17:32
honestly I doubt this is network connectivity problem, I'd blame it to docker none tty stuff ... 17:36
tonyo ah
i can't see a path where it hangs on a tty if checkbuild doesn't fail 17:37
or if you're not logged in
melezhik yeah, I will login to docker container later and see what it gets, ttl 17:45
Geth ecosystem/main: 51a6431835 | (Elizabeth Mattijsen)++ | META.list
DBIish now lives in the zef ecosystem
17:46
grondilu Ain't this a cute way to encode a permutation? rosettacode.org/wiki/Perlin_noise#Raku 18:07
El_Che hello 18:09
lizmat grondilu: looks cool 18:18
grondilu Unrelated: does trizen, Sidef's author, hang around here at times? 18:22
github.com/trizen/sidef
as far as I can tell it's the only programming language explicitely inspired from raku 18:23
lizmat .seen sidef 18:27
tellable6 lizmat, I haven't seen sidef around, did you mean skids?
lizmat I guess that answers that question
grondilu oh yeah I had forgotten about .seen 18:30
.seen trizen 18:31
tellable6 grondilu, I haven't seen trizen around, did you mean trzef?
Nemokosch The author is Romanian, nice 19:54
tonyo is that the long name of Roman ? 20:51
ugexe romania 20:52
tonyo Romania Wistinghousen 21:02
s/ou/au 21:03
avuserow This is pretty interesting, maybe moreso for the MoarVM side of things: Deterministic Linux for controlled testing and software bug-finding - news.ycombinator.com/item?id=33708867 21:17
Nemokosch I'm not sure if some next level joking is going on lol 21:41
retry: metacpan.org/pod/Text::Extract::Word what would you use for this? 23:18