<leftylink>
therefore, convert a string to the enumerable, where the enumerable contains the units of the string that should be checked for subset-ness.
smurfendrek123 has quit [Ping timeout: 245 seconds]
<leftylink>
sorry, I mixed up "a" and "the". let me try again
<leftylink>
therefore, convert the string to an enumerable, where the enumerable contains the units of the string that should be checked for subset-ness.
<leftylink>
wishing luck!
elphe has joined #ruby
<Swyper>
leftylink: game.rb:30:in `play_round': undefined method `subset' for #<Set:0x00007ff9ff03bf28> (NoMethodError)
<Swyper>
while !(valid_play?(@current_player.guess) && dictionary.subset(fragment.split().to_set)) <-- updated logic
<leftylink>
it sure appears that game.rb doesn't know what a Players is, doesn't it? It seems that it should be made aware of that, using the appropriate means.
elphe has joined #ruby
elphe has quit [Ping timeout: 245 seconds]
<Swyper>
fair
<Swyper>
game.rb:59:in `<main>': undefined method `type' for main:Object (NoMethodError) <-- when I do type(game.players)
<Swyper>
so it seems to be saying players is an object ?
<leftylink>
it has not said anything about players.
<leftylink>
it has said that type is not defined, and that main is an Object
<leftylink>
&>> werfasdfasdfads(5)
<rubydoc>
stderr: -e:2:in `<main>': undefined method `werfasdfasdfads' for main:Object (NoMethodError)... check link for more (https://carc.in/#/r/7nqg)
<leftylink>
just like if we had done that
<Swyper>
any ideas how I can find out the type of what players is?
smurfendrek123_ has quit [Ping timeout: 276 seconds]
<Swyper>
p Object.class(game.players) <-- tried this got an error game.rb:59:in `class': wrong number of arguments (given 1, expected 0) (ArgumentError)
fig-le-deunch has quit [Read error: Connection reset by peer]
ogres has quit [Quit: Connection closed for inactivity]
fig-le-deunch has joined #ruby
<leftylink>
what an interesting error message. as we can see, `class` must take 0 arguments. And what will happen when calling it with 0 arguments?
s2013 has joined #ruby
<leftylink>
since it said (given 1, expected 0)
<leftylink>
expected 0 tells us that it must take 0
<Swyper>
p game.players.class actually gives us "array" as the datatype, thats interesting
greengriminal has quit [Quit: This computer has gone to sleep]
<leftylink>
great, so it starts out as an array
<leftylink>
and then as we see by the error message posted at 2:08, at some point it becomes something other than an array
<leftylink>
so the next step is to figure out when it becomes something that is not an array.
<Swyper>
yeah I see, so I put the .class right before where the error is occuring and at that point it becomes an instance of the player class
<Swyper>
very strange.. it would make sense if it were an index out of bounds error
<leftylink>
great, so something must have changed it to a player instead of an array. so now it is to look at all places where players gets changed
<leftylink>
and see which of those places changed it from an array to a player.
<phaul>
Swyper: did you do the modulo aritmetics logic on the indices?
<havenwood>
Swyper: Might `@current_planner` be `nil`?
<Swyper>
I did this instead phaul if @players[players.length] == @current_player
<phaul>
you are missing the @ sign on players + arrays go from 0 to length - 1
<phaul>
so @players[@players.length] is again after the last element
<al2o3-cr>
the good old ~-a.size
<Swyper>
ah I see
<Swyper>
if @players[players.length-1] == @current_player
<Swyper>
@current_player = @players[0]
<Swyper>
changed it to this so hopefully that issue is fixed
<Swyper>
but I am still getting @current_player to be nil and I can't figure out why
<phaul>
you are still missing the @ sign
lightstalker has joined #ruby
hiroaki has joined #ruby
kyrylo has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<phaul>
im not even sure how this worked, is it also an attr_reader? probably... in that case it doesn't matter
<Swyper>
yeah tis also an attr_reader
<Swyper>
*its
<al2o3-cr>
i don't think i've ever seen an instance variable in the metasplot framework.
<al2o3-cr>
everything is attr'd and self used.
<al2o3-cr>
in the core of te framework that is
<Swyper>
o-o
<Swyper>
*has no idea what this conversation is about*
<phaul>
SandiM is a big advocate of that style. But I don't like polluting my external interfaces. ofc you could make those private
<al2o3-cr>
Swyper: don't go down that path
<phaul>
I just don't see the point. It feels yagni to me. I will do it when I need it
<Swyper>
al2o3-cr: sorry I'm new to ruby I don't exactly understand what you said xD
<al2o3-cr>
phaul: it's not as though the creator of the metasploit framework is naive
<phaul>
Swyper: there is a style in which you make everything - every single instance variable an attr_access
<Swyper>
oh
<phaul>
or
<Swyper>
I've never even worked in a framework yet my course will be teaching me rails though
<Swyper>
I also use rails at work by that I mean I am an incompetent intern who knows abit of ruby syntax xD
<al2o3-cr>
Swyper: it's used to be written in perl then rewritten in ruby
<havenwood>
phaul: I prefer explicit instance variables in Ruby too. Being faster and explicit signals to the reader about simplicity are two wins I like.
<Swyper>
interesting
<havenwood>
phaul: I don't like mucking up the public interface at all.
<Swyper>
still trying to figure out why @current_player is nil
etupat has joined #ruby
hutch1 has joined #ruby
fphilipe has joined #ruby
<Swyper>
with the magic of print statements I figured out the error is happening on this line: @current_player = @players[(@players.index(@current_player))+1]
<phaul>
Swyper: post the updated full code again. We don't want to second guess what else is there
Fernando-Basso has quit [Remote host closed the connection]
etupat has quit [Remote host closed the connection]
Ven`` has joined #ruby
etupat has joined #ruby
<HyperTables>
the docs for read_nonblock are confusing. is the nonblock flag set for the read call only or on the file descriptor, potentially affecting other threads?
<rubydoc>
stderr: -e:2:in `default_external': wrong number of arguments (given 1, expected 0) (ArgumentError)... check link for more (https://carc.in/#/r/7nxn)
<rubydoc>
stderr: -e:2:in `<main>': uninitialized constant Enconding (NameError)... check link for more (https://carc.in/#/r/7nxr)
<al2o3-cr>
&>> Encoding.default_encoding
<rubydoc>
stderr: -e:2:in `<main>': undefined method `default_encoding' for Encoding:Class (NoMethodError)... check link for more (https://carc.in/#/r/7nxt)
<phaul>
so it didn't reach carc in, so it can't be anything to do with that. It died as it serialized the string for carc in (that it fetched from the gist)
<phaul>
isn't the web service, in this case gist.github.com responsible for sending the correct encoding in the response headers?
Esa_ has joined #ruby
Esa_ has quit [Client Quit]
Esa_ has joined #ruby
<phaul>
yeah. I stopped there with pry. So github sends charset=utf-8 but after receiving it from Typhoeus user_content.body.encoding is #<Encoding:ASCII-8BIT>
Ven`` has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
grilix has quit [Ping timeout: 268 seconds]
<phaul>
ppl don't seem to be that bothered about it, it was reported 2 years ago
hightower2 has quit [Ping timeout: 245 seconds]
<leftylink>
lol
<al2o3-cr>
phaul: i never knew that typhoeus returns the body as ascii, and never checked tbh. but, that still doesn't change the fact the carc.in is still using ascii encoding
<phaul>
sure. that's the issue you had with &>>. the typhoeus issue is what we have with &url
<al2o3-cr>
phaul: in that case, force_encode the body to utf-8
<phaul>
ah. I feel it's a Typhoeus bug. Nobody uses &url anyways :)
<phaul>
just wanted to understand what's happening..
hiroaki has quit [Remote host closed the connection]
hiroaki has joined #ruby
<al2o3-cr>
phaul: just for completeness, adjust it anyway.
<phaul>
right, but I need more complex logic aren't I given the gist service can be any url with any encoding in the headers. What if the response header truly contains us-ascii? Or a force utf-8 work for every encoding?
<al2o3-cr>
what am i going on about, the body is always going to be binary. derp.
dinfuehr has quit [Ping timeout: 265 seconds]
<al2o3-cr>
with any http client
AJA4351 has joined #ruby
hiroaki has quit [Ping timeout: 245 seconds]
dinfuehr has joined #ruby
nowhere_man has quit [Ping timeout: 276 seconds]
<al2o3-cr>
phaul: are you not encoding the url or something?
<rubydoc>
stderr: -e:4:in `convert': "\xF0" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)... check link for more (https://carc.in/#/r/7ny6)
<rubydoc>
stderr: -e:1: syntax error, unexpected '<'... check link for more (https://carc.in/#/r/7ny7)
<al2o3-cr>
&url example.com
<rubydoc>
stderr: -e:1: syntax error, unexpected '<'... check link for more (https://carc.in/#/r/7ny8)
mre- has quit [Quit: Lost terminal]
<al2o3-cr>
phaul: can your bot be queried?
fphilipe has quit [Ping timeout: 245 seconds]
<phaul>
what query do you want?
akemacer has quit [Quit: Leaving]
cyclonis has joined #ruby
<al2o3-cr>
phaul: thumbs up is encoded in cp866
Intelo has quit [Remote host closed the connection]
Intelo has joined #ruby
<al2o3-cr>
anyway, cinch catches all errors
<al2o3-cr>
i'm at a loss with this
<al2o3-cr>
i just can't see it
<phaul>
thanks al2o3-cr for taking the time anyways. we just leave it, maybe I raise a github issue that tracks the fact that we can't handle utf-8 from remote gist services with all our findings.
<phaul>
we can have github issues that nobody looks at for years too! XD
conta1 has quit [Quit: conta1]
<al2o3-cr>
it's definitely not github
cyclonis has quit [Read error: Connection reset by peer]
etupat has quit [Remote host closed the connection]
<al2o3-cr>
phaul: sorry, yes, i know what you mean now.
<phaul>
unrelated: next week probably I'm arriving back in Ye good old Bligthy
<al2o3-cr>
cool, where've you been?
<phaul>
spent a year in Hungary
<al2o3-cr>
family over there or just sailing, seeing the world?
<phaul>
family over here. I can't sail as I don't have the funds. Probably I will become a weekend sailor. Sailing all the time eats up a lot of funds
<al2o3-cr>
i watch steve callahan adrift, f**k me, that is my worst nightmare!!
blackmesa has joined #ruby
<phaul>
I agree, I think about the possibility of falling out, and Im single handed. And the boat drives itself. It *will* leave me there. It's frightening
<al2o3-cr>
no shit
<al2o3-cr>
i'm not scared of water, but thousands of miles of any shore, well, i'll be ...
<phaul>
well furthest I ever been with my boat was the scillies :)
<havenwood>
rescues cost a ton, but nicer than being adrift
<al2o3-cr>
it's the fear of the unknown
<al2o3-cr>
well, to me anyway. i'd just give up.
etupat has joined #ruby
<havenwood>
I love the freezing in 2.7 but I'm curious what all will break with Symbol/TrueClass/FalseClass/NilClass all returning a frozen String.
<havenwood>
It'd be interesting to write a little scanner to compile instruction sequences and detect the offending gems.
<havenwood>
I recently tried implementing binary bytecode caching for RubyGems and was surprised home many gems actually had an error with producing binary code intermediary representation with RubyVM::InstructionSequence.
<phaul>
havenwood: nice. I also like these changes
ellcs has quit [Ping timeout: 245 seconds]
<havenwood>
phaul: Now that binary code is 1/4 of the size in 2.7 (love that work!) I'm interested in compiling gem binary code from parsing the source and caching that alongside the gem code locally with RubyGems.
<havenwood>
phaul: Then the trick is figuring out how to load the binary automagically with RubyGems on require if the checksum checks out.
<havenwood>
al2o3-cr: I think they show Elixir envy, which makes sense to me. ;)
<havenwood>
al2o3-cr: I appreciate eregon's argument that _0, _1 as it was would cause type issues and mass confusion.
<al2o3-cr>
havenwood: just don't like them one bit.
<havenwood>
al2o3-cr: I'm glad that _1 is now `{ |x| x }` rather than `{ |x,| x }`, which is fun but unintuitively destructuring.
<al2o3-cr>
is it me being personal, idk. just no!
<al2o3-cr>
yeah, i understand that, but, just shouldn't be.
<al2o3-cr>
imho
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
<havenwood>
al2o3-cr: i feel the same way i do about the syntax in Elixir, which is that i use it when it's not confusing only
dionysus69 has quit [Ping timeout: 245 seconds]
<havenwood>
i admit it's a bit less noise
<al2o3-cr>
Elixir is a functional language, it makes sense.
<havenwood>
Ruby is a lispy, object oriented, functional language.
<havenwood>
al2o3-cr: I look forward to more immutable data structures.
<al2o3-cr>
not really functional
wald0 has joined #ruby
<al2o3-cr>
me too.
<havenwood>
al2o3-cr: It's more functional than most.
etupat has quit [Remote host closed the connection]
<havenwood>
al2o3-cr: Everyone has first class functions these days, so I don't think that counts for much. I wish Ruby had fancier currying, especially for kwargs.
<al2o3-cr>
ruby used to be simple and to the point. i feel not any more.
wald0 has quit [Read error: Connection reset by peer]
<havenwood>
But it has currying! You can do lambda calculus. #map, #filter, #filter_map. Ruby is way more friendly towards programming functionally than many.
etupat has joined #ruby
etupat has quit [Remote host closed the connection]
etupat has joined #ruby
<havenwood>
al2o3-cr: I think Elixir or Clojure are more simple and to the point, but <3 Ruby.
<havenwood>
It has a different elegance and simplicity.
<al2o3-cr>
why spoil a good language?
<havenwood>
al2o3-cr: I don't think Ruby is getting spoiled at all. It was always an incredibly complex grammar focused on experienced C programmers that beginners could somehow grok.
wald0 has joined #ruby
<al2o3-cr>
havenwood: it is. simple expressions are turning into ugly ones.
<havenwood>
al2o3-cr: I think Matz has done an amazing job at pushing back against things that would compromise Ruby while keeping it relevant.
<havenwood>
al2o3-cr: like what?
<havenwood>
al2o3-cr: also, experimental features are experiments and more these days are yanked than ever before
<al2o3-cr>
@1 _1 just no!
<al2o3-cr>
hell, no!
<havenwood>
al2o3-cr: Not everything is positional, and I'm not a fan of positional generally, but when it is positional, doesn't bother me.
<al2o3-cr>
not at all, but meh
<havenwood>
al2o3-cr: I'm more excited about RBS type signatures in Ruby with type-profiler as a level one type profiler giving us feedback without any annotations.
<havenwood>
al2o3-cr: Those should both be part of Ruby 3 and *just work*. I love being able to write the Ruby I love and still keep up with performance and correctness guarantees.
<al2o3-cr>
havenwood: some effort put in to this. i think this is incredible work!
dviola has joined #ruby
<havenwood>
al2o3-cr: I think the functional dabbling will end up being great for Ruby. Guilds should bring it home.
<havenwood>
al2o3-cr: I'm kinda meh for anything positional.
<havenwood>
al2o3-cr: keywords sure are nicer for currying!
wald0 has quit [Read error: Connection reset by peer]
<havenwood>
entangling by name is better than by position
wald0 has joined #ruby
<al2o3-cr>
havenwood: he should of just got rid of the GIL/GVL
wald0 has quit [Read error: Connection reset by peer]
<havenwood>
al2o3-cr: guilds do that
<al2o3-cr>
in a context though
<havenwood>
al2o3-cr: if the lock isn't interpreter/VM side, it's not a GVL/GIL
<havenwood>
al2o3-cr: there's a branch of Ruby without a GVL, and it works great for multiple cores, but it's slow for single threaded
<al2o3-cr>
why?
<havenwood>
al2o3-cr: fine grained locks are expensive
<al2o3-cr>
i'm on a single core
<havenwood>
i mean that just adding a ton of fine grained locks to CRuby significantly impairs single core performance
<havenwood>
that's one way to remove the GVL, and it isn't pretty for single core performance
<havenwood>
Guilds keep single core performance while letting you peg all cores.
dviola has quit [Quit: WeeChat 2.6]
<al2o3-cr>
seriously?
<havenwood>
Objects can be members of the Guild, in which case they can be mutated by Threads in the Guild.
wald0 has joined #ruby
<havenwood>
al2o3-cr: Which part for seriously? :P
<al2o3-cr>
Guilds keep single core performance while letting you peg all cores.
greengriminal has quit [Quit: This computer has gone to sleep]
wald0 has quit [Client Quit]
<havenwood>
al2o3-cr: Yeah, they don't introduce fine grained locks that slow single core Ruby but they allow Threads in different Guilds to peg different cores.
dviola has joined #ruby
rbanffy has quit [Quit: rbanffy]
<al2o3-cr>
proof?
<havenwood>
al2o3-cr: Channels let you copy or move Objects between Guilds. If you move it, the Guild membership changes.
<havenwood>
al2o3-cr: You can just share an immutable Object between Guilds.
<al2o3-cr>
havenwood: what about mutable objects?
<havenwood>
al2o3-cr: You can dup em or xfer ownership via a Channel.
<havenwood>
al2o3-cr: Mutable objects can only be the member of one guild at a time, but you can duplicate them across Guilds.
<havenwood>
Or transfer Guild membership to another Guild.
<al2o3-cr>
right, that sounds promising
<al2o3-cr>
havenwood: like fibers?
<havenwood>
al2o3-cr: Fibers and the new Selector should be the solution for parallel IO.
<havenwood>
al2o3-cr: Guilds are the solution for parallel processing.
dviola has quit [Quit: WeeChat 2.6]
<al2o3-cr>
havenwood: will threads be deprecated?
diego1 has joined #ruby
<havenwood>
al2o3-cr: No, not in Ruby 3.
diego1 has quit [Client Quit]
<al2o3-cr>
i mean the thread class?
<havenwood>
al2o3-cr: Guilds will have Threads which have Fibers.
dviola has joined #ruby
<havenwood>
al2o3-cr: ioquatix has been working a ton on async fibers
<havenwood>
I think 84 was when I first used a computer, age 5.
<havenwood>
No Ruby.
<al2o3-cr>
havenwood: never had one, but, what i did have; commodore 64/128, psion series 3a, amiga 600/1200, bbc microcomputer from the 70's from school, acorn micro and even a apple micro 2
<havenwood>
al2o3-cr: Ah, the one before the Kapro 2000 was a Kapro II. I guess my dad was a Kapro fan.