🦋 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;
00:07 reportable6 left
ToddAndMargo the dll is wtsapi32 00:08
00:10 reportable6 joined 00:17 Guest89 left 00:26 epony left 00:31 lichtkind left 00:32 lucerne joined
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
00:51 Guest89 joined
ToddAndMargo In my NativeConstants.pm6 module, I have the followign defined: constant BYTE := uint8; constant LPSTR = CArray[BYTE]; 00:53
00:53 epony joined
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
01:03 Guest89 left 01:09 ToddAndMargo left 01:14 Guest89 joined 01:22 sacomo joined 01:28 ToddAndMargo joined, razetime joined 01:34 derpydoo joined 01:36 razetime left 01:37 razetime joined 01:42 razetime left 01:43 ToddAndMargo left 01:45 razetime joined 01:47 ToddAndMargo joined 01:50 razetime_ joined, razetime left 01:51 MasterDuke joined, sgrs joined 02:02 Guest89 left 02:11 Guest89 joined 02:13 lizmat_ joined 02:15 Geth left 02:16 lizmat left 02:28 sgrs left 02:34 tirnanog left 02:36 sgrs joined 02:43 sortiz joined 03:13 sgrs left 03:33 eseyman left 04:08 Guest89 left
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
04:21 derpydoo left 04:45 epony left 04:48 euandreh left 05:09 eseyman joined
ToddAndMargo :-) 05:09
05:20 coleman left 05:21 coleman joined 05:25 coleman left 05:33 coleman joined 05:34 epony joined 06:07 reportable6 left 06:09 reportable6 joined 06:16 sortiz left 06:27 Xliff_ joined
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"
06:33 bd3i left
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"
06:49 tonyo left, tonyo joined 06:51 bd3i joined 06:52 Kaiepi joined 06:54 abraxxa joined 07:00 abraxxa left 07:01 abraxxa joined 07:45 mjgardner left, mjgardner joined 07:55 coleman left, coleman joined 08:00 coleman left 08:09 coleman joined
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
08:14 coleman left, pejayes left 08:15 pejayes joined 08:19 razetime_ left, razetime joined 08:22 Sgeo left 08:28 razetime left 08:30 razetime joined 08:34 coleman joined 08:39 coleman left, coleman joined 08:44 coleman left 08:50 lizmat_ left, lizmat joined 08:51 Geth joined, lizmat_ left 09:00 coleman joined 09:02 Matthew|m left 09:03 Matthew|m joined 09:04 euandreh joined 09:08 euandreh left 09:09 lichtkind joined 09:11 euandreh joined 09:13 dakkar joined 09:21 sena_kun joined 09:24 razetime left, razetime joined 09:43 razetime left, razetime joined 09:50 razetime left 09:53 razetime joined 09:58 dustinm` left
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...
10:11 dustinm` joined
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
10:21 coleman left, coleman joined 10:25 coleman left 10:32 razetime left 10:33 razetime joined
lizmat clickbaits rakudoweekly.blog/2022/11/21/2022-47-migratory/ 10:34
10:34 coleman joined 10:35 CIAvash left, Demos[m] left, tadzik left, Matthew|m left, tiziodcaio left, AlexDaniel left 10:39 coleman left 10:40 CIAvash joined
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
10:47 AlexDaniel joined, tiziodcaio joined, Matthew|m joined, tadzik joined, Demos[m] joined
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 …
11:01 Nemokosch joined
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
11:04 coleman joined
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:
11:08 coleman left
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
11:14 ToddAndMargo left, Nemokosch left 11:16 coleman joined 11:20 coleman left 11:21 coleman joined 11:24 razetime left, razetime joined 11:43 razetime left, razetime joined 12:07 reportable6 left 12:08 reportable6 joined 12:22 razetime left 12:23 razetime joined 12:28 razetime_ joined, razetime left 12:30 abraxxa left
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
13:20 derpydoo joined 13:49 razetime_ left 13:50 razetime joined 13:51 discord-raku-bot left, discord-raku-bot joined, sgrs joined, lucerne left 13:55 razetime left 13:57 ProperNoun joined 14:00 razetime joined 14:05 razetime left 14:06 razetime joined 14:21 razetime_ joined 14:22 razetime left 14:28 razetime_ left, razetime joined 15:01 Sgeo joined
Anton Antonov weekly: rakuforprediction.wordpress.com/20...valuation/ 15:05
15:24 razetime left 15:44 rypervenche left 15:50 epony left 16:05 lucerne joined, mikkel joined 16:12 rypervenche joined 16:24 melezhik joined
melezhik o/ 16:24
Hi tonyo, does `fez upload` work when tty is not open? - github.com/tony-o/raku-fez/issues/69
16:27 daxim joined 16:34 jonasjlinde joined 16:36 jonasjlinde left 16:39 melezhik left 16:45 razetime joined
tonyo melezhik if you run that command manually/locally does it ask if you'd like to proceed with the upload anyway? 16:57
16:58 melezhik joined
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
17:15 razetime left
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
17:19 melezhik left 17:22 melezhik joined
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
17:45 dakkar left
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
17:53 xinming left 18:00 xinming joined 18:01 melezhik left 18:07 mikkel left, grondilu joined, mikkel joined
grondilu Ain't this a cute way to encode a permutation? rosettacode.org/wiki/Perlin_noise#Raku 18:07
18:08 reportable6 left
El_Che hello 18:09
18:09 reportable6 joined 18:15 sena_kun left 18:16 mikkel left 18:18 sena_kun joined
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?
18:34 Guest68 joined 19:01 grondilu left 19:25 epony joined 19:48 pierrot_ is now known as pierrot, sena_kun left 19:50 sena_kun joined, guifa_ left
Nemokosch The author is Romanian, nice 19:54
20:50 linkable6 left, evalable6 left 20:51 linkable6 joined
tonyo is that the long name of Roman ? 20:51
ugexe romania 20:52
20:52 evalable6 joined
tonyo Romania Wistinghousen 21:02
s/ou/au 21:03
21:06 Guest68 left 21:12 Guest68 joined
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
21:50 Guest68 left, Guest68 joined 22:10 xinming left 22:11 xinming joined 22:48 sena_kun left 22:55 habere-et-disper joined, Xliff left 22:57 m_athias_ joined 23:00 Maylay_ joined 23:04 NemokoschKiwi joined, m_athias left, Maylay left 23:07 m_athias_ is now known as m_athias 23:09 NemokoschKiwi left
retry: metacpan.org/pod/Text::Extract::Word what would you use for this? 23:18
23:32 Guest68 left 23:34 Zero_Dogg left 23:35 lichtkind left 23:43 derpydoo left