jhass[m] changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.1.2, 3.0.4, 2.7.6: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
roadie has quit [Ping timeout: 260 seconds]
roadie has joined #ruby
stylo has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
RickHull has quit [Ping timeout: 256 seconds]
RickHull has joined #ruby
ur5us has quit [Ping timeout: 250 seconds]
roadie has joined #ruby
jpn has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
jpn has quit [Ping timeout: 260 seconds]
roadie has joined #ruby
roadie has quit [Remote host closed the connection]
roadie has joined #ruby
roadie has quit [Remote host closed the connection]
roadie has joined #ruby
Thanzex has quit [Read error: Connection reset by peer]
Thanzex has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
roadie has joined #ruby
jpn has joined #ruby
ur5us has joined #ruby
RickHull has quit [Ping timeout: 250 seconds]
jpn has quit [Ping timeout: 260 seconds]
roadie has quit [Ping timeout: 248 seconds]
roadie has joined #ruby
roadie has quit [Remote host closed the connection]
roadie has joined #ruby
roadie has quit [Ping timeout: 260 seconds]
roadie has joined #ruby
roadie has quit [Ping timeout: 252 seconds]
Ziyan has joined #ruby
roadie has joined #ruby
roadie has quit [Ping timeout: 248 seconds]
Ziyan has quit [Ping timeout: 248 seconds]
Ziyan has joined #ruby
Sankalp has quit [Ping timeout: 246 seconds]
Sankalp has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 256 seconds]
Laplace has quit [Quit: Connection closed for inactivity]
z4kz83 has joined #ruby
z4kz83 has quit [Client Quit]
Ziyan has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
Ziyan has joined #ruby
roadie has joined #ruby
itok has quit [*.net *.split]
joenoon has quit [*.net *.split]
henk has quit [*.net *.split]
nyuszika7h has quit [*.net *.split]
jtperreault has quit [*.net *.split]
cornett has quit [*.net *.split]
bougyman has quit [*.net *.split]
eof has quit [*.net *.split]
summerisle has joined #ruby
cornett has joined #ruby
joenoon has joined #ruby
nyuszika7h has joined #ruby
bougyman has joined #ruby
jtperreault has joined #ruby
itok has joined #ruby
roadie has quit [Ping timeout: 260 seconds]
henk has joined #ruby
gfawcett has quit [*.net *.split]
agrosant has quit [*.net *.split]
sphex has quit [*.net *.split]
weaksauce has quit [*.net *.split]
ollysmith has quit [*.net *.split]
phenom has quit [*.net *.split]
duds- has quit [*.net *.split]
cnsvc has quit [*.net *.split]
cnsvc has joined #ruby
gfawcett has joined #ruby
sphex has joined #ruby
duds- has joined #ruby
phenom has joined #ruby
weaksauce has joined #ruby
ollysmith has joined #ruby
agrosant has joined #ruby
agrosant has quit [Max SendQ exceeded]
agrosant has joined #ruby
jpn has joined #ruby
jpn has quit [Ping timeout: 256 seconds]
ur5us has quit [Ping timeout: 250 seconds]
Ziyan has quit [Ping timeout: 248 seconds]
Ziyan has joined #ruby
roadie has joined #ruby
roadie has quit [Ping timeout: 260 seconds]
protektwar has joined #ruby
protektwar has joined #ruby
jpn has joined #ruby
roadie has joined #ruby
fef has joined #ruby
jpn has quit [Ping timeout: 240 seconds]
gr33n7007h has quit [Ping timeout: 256 seconds]
dionysus69 has quit [Quit: dionysus69]
dionysus69 has joined #ruby
gr33n7007h has joined #ruby
gr33n7007h has quit [Quit: WeeChat 3.5]
jpn has joined #ruby
Furai has quit [Quit: WeeChat 3.5]
Furai has joined #ruby
jpn has quit [Ping timeout: 246 seconds]
dionysus69 has quit [Ping timeout: 240 seconds]
ur5us has joined #ruby
dionysus69 has joined #ruby
dionysus69 has quit [Ping timeout: 250 seconds]
ur5us has quit [Ping timeout: 252 seconds]
roadie has quit [Ping timeout: 248 seconds]
roadie has joined #ruby
N_3Do has joined #ruby
dionysus69 has joined #ruby
roadie has quit [Quit: ERC (IRC client for Emacs 25.3.50.1)]
ur5us has joined #ruby
N_3Do has quit [Remote host closed the connection]
N_3Do has joined #ruby
fef has quit [Ping timeout: 240 seconds]
ur5us has quit [Ping timeout: 248 seconds]
N_3Do has quit [Ping timeout: 248 seconds]
N_3Do has joined #ruby
N_3Do has quit [Ping timeout: 250 seconds]
TomyWork has joined #ruby
Ziyan has quit [Ping timeout: 240 seconds]
ssh073 has quit [Quit: Ping timeout (120 seconds)]
ssh073 has joined #ruby
oxfuxxx has joined #ruby
factor7 has joined #ruby
factor has quit [Ping timeout: 276 seconds]
factor7 is now known as factor
Thanzex has quit [Read error: Connection reset by peer]
Thanzex has joined #ruby
oxfuxxx has quit [Quit: [H]EAT ROX FUCK R0X SHIT BRIX. = The Yankies M0th3Rphackers Coconut Aerospace =]
shiru has joined #ruby
fredlinhares has joined #ruby
Ziyan has joined #ruby
shiru has quit [Quit: leaving]
Ziyan has quit [Quit: Textual IRC Client: www.textualapp.com]
fredlinhares has quit [Quit: WeeChat 3.5]
<John_Ivan> is there a keyword in ruby that lets you repeat the same iteration in a loop?
<John_Ivan> e.g "repeat" and have the same loop restart at the beginning, having the same state (e.g iteration counter being the same)
<John_Ivan> I have some code that is executing and fails. I wish to re-repeat the same code but from the start of the loop, without altering the iteration counter.
<John_Ivan> actually. nevermind. I'll just wrap it up in a while() loop.
ssh073 has quit [Remote host closed the connection]
ssh073 has joined #ruby
<adam12> John_Ivan: loop ?
<adam12> oh. nevermind. I see you want something a bit more advanced.
<John_Ivan> adam12, just something like "for x in 1..5 do #a; #b; #c; end" where I would have wanted to execute #a, #b, #c again, but with the same counter it's at.
<adam12> John_Ivan: Maybe you can cycle.
<John_Ivan> e.g if x was 3, to call "repeat" and have the loop start again from the top. but still with 3.
<adam12> Seems kind of XY. What are you trying to retry and what's the counter for?
<adam12> Maybe this is as simple as 1..5.times and the redo keyword.
dionysus69 has quit [Quit: dionysus69]
dionysus70 has joined #ruby
<John_Ivan> adam12, I have solved it with a while() loop so it's fine. thank you :)
<adam12> John_Ivan: Curious what the solution ended up being?
dionysus70 has quit [Ping timeout: 256 seconds]
<John_Ivan> adam12, while(true) ... if (error) next; end iterator++
<John_Ivan> next will just repeat the while loop on the same iterator.
<adam12> John_Ivan: Where do you set up the iterator value? outside the while loop?
<John_Ivan> yup. and iterate it inside the loop.
<adam12> You can use `loop` instead of `while true` here.
<John_Ivan> adam12, the "loop" keyword?
<adam12> Is the iterator just an Integer?
<John_Ivan> yes
TasiMobile has joined #ruby
TasiMobile has quit [Client Quit]
<John_Ivan> if "loop" was the answer, well, dang :D
<adam12> Does it have a range or is it infinite?
<John_Ivan> adam12, it can be a situation of both. in this case, infinite.
<adam12> John_Ivan: Ah. I think redo might have worked as well, with an Enumerator.
rvalue has joined #ruby
<John_Ivan> adam12, here is my code. warning: a mess.
<John_Ivan> adam12, https://pastebin.com/KU5yuPyG
<John_Ivan> don't judge. I was in a rush.
<John_Ivan> the loop I'm talking about begins at "while(true)"
<adam12> John_Ivan: Hey, we all write quick and dirty code. It's no big deal.
<John_Ivan> adam12, the place where I needed the "redo" is where I use "next", right in the if statement's else under the caught exceptions. there's only 2 of them.
<John_Ivan> adam12, context: my spider collects my manga. it starts by not knowing how many images a particular artists' work has
<John_Ivan> adam12, so it iterates (to 20000 originally because why not) infinitely until if encounters a 404
<John_Ivan> that marks the end of a particular work
<adam12> John_Ivan: I think your solution is fine.
<John_Ivan> adam12, the problem is, a particular request may fail (network error, 429, 503, whatever)
<John_Ivan> so I'd want to delete the amount of manga downloaded
<John_Ivan> because I won't bother counting backwards how many pages I took, although it would be much simpler...
<John_Ivan> but instead I say
<adam12> John_Ivan: If you were looking for improvements, I'd probably start decomposing this into smaller methods with some names. Then you could move behaviour closer to its locality.
<John_Ivan> "throw away the entire work. keep track of the counter. restart that work's download."
<John_Ivan> adam12, yeah. definitely. but no, not looking for improvements. at least, not with this script.
<John_Ivan> it's a fire and forget spider.
<adam12> Cool.
<John_Ivan> adam12, stuff tends to dissapear off the internet
<John_Ivan> wrote this really fast as I don't want to see my favourites dissapear :P
<John_Ivan> the quicker I start downloading, the better.
<adam12> John_Ivan: Indeed. I've actually taken to sending _every_ Ruby article I read through archive.is.
<adam12> Because the bitrot is real.
<John_Ivan> aye
<adam12> And I like reading stuff from years ago.
dionysus69 has joined #ruby
<John_Ivan> for me, the manga is on a website that does #piracy so chances of it dissapearing are very high (especially when this is the 4th time the website was put back up)
<John_Ivan> and I have like 5k mangas to download
<John_Ivan> each with averaging 80+ pages.
<adam12> Shame it's not just available as a torrent. Oh well.
<John_Ivan> adam12, it is. but their content is messy.
<John_Ivan> and they offer torrent per manga rather than torrent for everything.
<John_Ivan> adam12, it does*
<adam12> Ah.
wand has joined #ruby
oxfuxxx has joined #ruby
tekkconvos has joined #ruby
<tekkconvos> Hi, I have some strange issue. I'm using Net::HTTP inside a class, it works fine as is... but as soon as I try to invoke a simple .get() within a docker container ruby environment I get: `getaddrinfo: Name or service not known`. The hostname is resolvable and curl inside the same container works. Trying to debug this but running out of ideas.
<tekkconvos> I'm using URI.parse(my_url) followed by URI.encode_www_form(params) and then a Net::HTTP.get_response() with that URI.
<adam12> tekkconvos: What Ruby version? and the hostname, is it something local via Docker (ie another container via the service fabric) or is it something external, like google.com?
<tekkconvos> ruby 2.7.4 from package repo's. Its reaching to an external service. (such as google in your example)
<tekkconvos> http (not https)
<tekkconvos> exact same code works fine when ran outside a containerised environment (I tried only docker, but on 2 different hosts)
<adam12> tekkconvos: What happens if you call Resolv directly? ruby -rresolv -e 'p Resolv.getaddress("yourgoogle.com")'
<tekkconvos> good idea 1 sec
<tekkconvos> that works, its also worth mentioning, if I put in the IP directly instead of the hostname, I still get the same error, which is odd as it should not be attempting a lookup
<adam12> Maybe it's IPv6 and happy eyeballs related.
<adam12> Oh. With IP it's broken too. Hmm.
<tekkconvos> haha, no IPv6 here (or on the remote host), but yes could be
<tekkconvos> is there a way to get Net::HTTP (or ruby) to spit out more debug info?
<tekkconvos> with IP (no hostname) it still fails on getaddrinfo btw.
<adam12> Not sure, but you could maybe enable tracer and see if it helps at all. gem install tracer; irb --tracer; run your commands.
<tekkconvos> although I just noticed a "twerk"
<tekkconvos> "qwerk"
<tekkconvos> even
<adam12> I wonder if you `curl -vvvv` it would show a hint.
<tekkconvos> my URL contains a non standard port
<adam12> Oh. Yes, that might be it.
<tekkconvos> once it runs through URI.parse a standard port is attached :80
<tekkconvos> I think that may be it
<adam12> It's resolving foobar:80
<tekkconvos> yup
<adam12> which is obviously failing. Shame the error message isn't nicer. Maybe worthy of a PR to net/http
<tekkconvos> but getaddrinfo still a strange result
<adam12> I wonder how URI is parsing that port. Because it has no scheme? or does it?
<tekkconvos> In fact, the URI object is fine, its Net::HTTP.get_response() that is injecting the :80
<adam12> Ooh.
<adam12> Maybe get_response expects a String.
<adam12> Hmm nope. I'm not sure.
<adam12> What's the exact way you're calling #get_response, out of curiosity.
<tekkconvos> oh this is getting more interesting (after your last hint)
<tekkconvos> Net::HTTP.get_response(uri.to_s) is whats failing.... it works on my local machine (a Mac)... however inside the container, if I pass it a URI object rather than a String... it works
<tekkconvos> perhaps its a ruby 3.x vs ruby 2.x thing
<tekkconvos> and Net::HTTP went from expecting URI to String or something
<kenichi> curious if this is a resolv-replace use case
<tekkconvos> still, the error message is not great.
Milos has quit [Ping timeout: 246 seconds]
<tekkconvos> I did try resolv-replace but perhaps not correctly
Milos has joined #ruby
<tekkconvos> I need to support both Ruby 2.x and Ruby 3.x ideally, will look into a conditional way of doing so that is inside the script rather than elsewhere
<tekkconvos> (no implicit conversion of URI::HTTP into String)... this is getting even stranger...
<adam12> Net::HTTP.get_response(uri) is causing issues?
<tekkconvos> no
<tekkconvos> Net::HTTP.get() now
oxfuxxx has quit [Ping timeout: 252 seconds]
<adam12> Ah.
<tekkconvos> interestingly, I'm getting different behaviour in irb when running in-line vs loading the class
<tekkconvos> rubber ducking at this point, but getting closer
<tekkconvos> I mean, the lazy option would be to move to HTTParty or something, but I didn't wanna give up on Net::HTTP that easily after several decades of its existence
<tekkconvos> I bet if I use Net::HTTP "the old way" with separate host port path suffix fields it'd work
<adam12> I wish net/http saw more usage, but I feel like it's half abandonded. I still use it where possible, but that's because any large enough Ruby application ends up with 5+ transitive http client dependencies.
Ziyan has joined #ruby
tekkconvos has quit [Quit: Ping timeout (120 seconds)]
RickHull has joined #ruby
teclator has quit [Ping timeout: 246 seconds]
teclator has joined #ruby
___nick___ has joined #ruby
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
fredlinhares has joined #ruby
___nick___ has joined #ruby
stackdroid18 has joined #ruby
stackdroid18 has left #ruby [#ruby]
fredlinhares has quit [Read error: Connection reset by peer]
fredlinhares has joined #ruby
wand has quit [Remote host closed the connection]
TomyWork has quit [Remote host closed the connection]
dionysus69 has quit [Ping timeout: 240 seconds]
fredlinhares has quit [Read error: Connection reset by peer]
dionysus69 has joined #ruby
wand has joined #ruby
fredlinhares has joined #ruby
fredlinhares has quit [Client Quit]
smp has quit [Quit: ZNC 1.8.2 - https://znc.in]
smp has joined #ruby
dionysus69 has quit [Ping timeout: 252 seconds]
<RickHull> I've noticed a difference in behavior in mruby, relative to MRI (and older versions of mruby). different results of floating point operations
<RickHull> older mruby and MRI yield 0.0, but mruby master yields 2.22044604925031e-16
<RickHull> before I try to come up with a simpler test case and file an issue -- is there any good reason this is expected behavior?
ollysmith has quit [Quit: ZNC 1.8.2+deb2+b4 - https://znc.in]
ollysmith has joined #ruby
protektwar has quit [Ping timeout: 252 seconds]
oxfuxxx has joined #ruby
oxfuxxx has quit [Client Quit]
dviola has joined #ruby
jtdowney has joined #ruby
jpn has joined #ruby
Ziyan has quit [Ping timeout: 260 seconds]
Ziyan has joined #ruby
<havenwood> RickHull: I can't think of a reason.
<RickHull> i see there are some flags introduced for float behavior, and my old mruby was like 5 years old
<weaksauce> which calculations?
<RickHull> mruby 1.3ish from 2017
<RickHull> hard to say, I'm tracing them now
ssh073 has quit [Ping timeout: 240 seconds]
<RickHull> to reproduce: clone this repo, get it set up (pretty easy). then `rake timed_simplex` should exit cleanly. update the mruby submodule; clean and rebuild; then `rake timed_simplex` fails
<RickHull> you can confirm the MRI behavior with: ruby -Iexamples -rtimer -rsimplex examples/driver.rb
<RickHull> all the simplex stuff is kind of a nightmare to wade through; I never understood it that well to begin with; taking my time with it now
Ziyan has quit [Ping timeout: 248 seconds]
<RickHull> I'm thinking I will probably want to use Rational more and floats less
Ziyan has joined #ruby
___nick___ has quit [Ping timeout: 240 seconds]
moldorcoder7 has quit [Ping timeout: 248 seconds]
jpn has quit [Ping timeout: 240 seconds]
moldorcoder7 has joined #ruby
Ziyan has quit [Ping timeout: 246 seconds]
Ziyan has joined #ruby
mahlon has quit [Ping timeout: 260 seconds]
Ziyan has quit [Quit: Textual IRC Client: www.textualapp.com]
robotmay has quit [Quit: No Ping reply in 180 seconds.]
<RickHull> i added #rationalize thricely and it tests out nicely; still haven't solved the behavioral issue
robotmay has joined #ruby
<RickHull> is anyone familiar with Simplex? https://en.wikipedia.org/wiki/Simplex_algorithm#Example I have some questions
<leah2> mildly
dionysus69 has joined #ruby
mahlon has joined #ruby
ua_ has quit [Ping timeout: 256 seconds]
ur5us has joined #ruby
ua_ has joined #ruby
RickHull has quit [Ping timeout: 240 seconds]
ua_ has quit [Read error: Connection reset by peer]
ua__ has joined #ruby
jpn has joined #ruby
jpn_ has joined #ruby
jpn has quit [Ping timeout: 250 seconds]
teclator has quit [Quit: http://quassel-irc.org - Chat comfortably. Anywhere.]
ua__ has quit [Read error: Connection reset by peer]
ua_ has joined #ruby
John_Ivan has quit [Read error: Connection reset by peer]
John_Ivan has joined #ruby
perrierjouet has quit [Quit: WeeChat 3.5]
perrierjouet has joined #ruby
dionysus69 has quit [Quit: dionysus69]
jpn_ has quit [Ping timeout: 248 seconds]
dionysus70 has joined #ruby
jpn has joined #ruby
dionysus70 is now known as dionysus69
white_magic has joined #ruby
RickHull has joined #ruby
<RickHull> sorry, back
dionysus69 has quit [Ping timeout: 248 seconds]
<RickHull> i see on wikipedia: slack vars, non slack vars, free vars, non free vars, basic vars, non basic vars
<RickHull> my understanding is that the coefficients of the constraints provide the free vars; the inequalities determine the basic vars