adam12 changed the topic of #ruby to: Ruby 3.3.1, 3.2.4, 3.1.5 https://www.ruby-lang.org | Logs https://libera.irclog.whitequark.org/ruby
hightower3 has joined #ruby
hightower2 has quit [Ping timeout: 268 seconds]
fercell has joined #ruby
fercell_ has quit [Ping timeout: 272 seconds]
HappyPassover is now known as Al2O3
pascal_blaze has joined #ruby
donofrio__ has joined #ruby
donofrio_ has quit [Ping timeout: 245 seconds]
TomyLobo has quit [Ping timeout: 260 seconds]
gaussianblue has joined #ruby
<zayd> How would I correctly pass a instance variable to a method in that same class? https://bpa.st/BOAA This is what I'm trying, and it prints out "VALUE: " instead of printing it out with the value. When I set L28 to be round_ram(1) or something like that, it works, it just breaks when I try to give it a instance variable.
jenrzzz has quit [Ping timeout: 268 seconds]
jenrzzz_ has joined #ruby
<weaksauce> zayd you need to put all that in initialize
<weaksauce> class RAM is in the scope of the class itself
<weaksauce> anything under def is in the scope of an instance of ram which can be many
<weaksauce> only one RAM but many RAM.new instances
<zayd> weaksauce: everything? lsp starts yelling at me if i do that, should i just ignore it?
<weaksauce> you can ignore for now yeah
<weaksauce> make it right
<weaksauce> make it pretty
<weaksauce> make it fast
<weaksauce> in that order
<zayd> weaksauce: seems to work, thanks
jenrzzz_ has quit [Ping timeout: 260 seconds]
pascal_blaze has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
konsolebox has joined #ruby
_ht has joined #ruby
jenrzzz has joined #ruby
grenierm has joined #ruby
pascal_blaze has joined #ruby
gaussianblue has quit [Quit: leaving]
havenwood has quit [Quit: The Lounge - https://thelounge.chat]
havenwood has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
rvalue has quit [Read error: Connection reset by peer]
rvalue has joined #ruby
jenrzzz has quit [Ping timeout: 272 seconds]
lucerne has quit [Ping timeout: 260 seconds]
ih8u has quit [Remote host closed the connection]
jenrzzz has joined #ruby
BSaboia has quit [Quit: ZNC - https://znc.in]
BSaboia has joined #ruby
BSaboia has quit [Remote host closed the connection]
BSaboia has joined #ruby
lucerne has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
TomyLobo has joined #ruby
jenrzzz has joined #ruby
grenierm has quit [Ping timeout: 250 seconds]
jenrzzz has quit [Ping timeout: 268 seconds]
osc4rpt has quit [Ping timeout: 260 seconds]
osc4rpt has joined #ruby
jenrzzz has joined #ruby
gaussianblue has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
deadmarshal_ has quit [Ping timeout: 268 seconds]
osc4rpt has quit [Ping timeout: 252 seconds]
osc4rpt has joined #ruby
donofrio__ has quit [Remote host closed the connection]
emilknievel has joined #ruby
donofrio has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
osc4rpt has quit [Ping timeout: 245 seconds]
<mooff> zayd: the backticks thing from the other day.. you can def `(cmd) do_something_with(cmd) end to override what `some command` does
osc4rpt has joined #ruby
Trivial has joined #ruby
ken_barber has joined #ruby
deadmarshal_ has joined #ruby
<mooff> here's another way to write the RAM thing https://dpaste.org/irGL3
pascal_blaze has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<mooff> n.b. the MemFree value doesn't seem to match /bin/free, and MemCached doesn't match /bin/free's "buff/cache"
gaussianblue has quit [Quit: leaving]
<mooff> meaning the "used" value is different.. it seems to include cache too, for greater error ;P
ken_barber has quit [Quit: Client closed]
gaussianblue has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 264 seconds]
donofrio_ has joined #ruby
donofrio__ has joined #ruby
donofrio has quit [Ping timeout: 255 seconds]
donofrio has joined #ruby
donofrio_ has quit [Ping timeout: 245 seconds]
donofrio_ has joined #ruby
donofrio__ has quit [Ping timeout: 245 seconds]
donofrio has quit [Ping timeout: 260 seconds]
otisolsen70 has joined #ruby
donofrio__ has joined #ruby
donofrio_ has quit [Ping timeout: 268 seconds]
polishdub has joined #ruby
gaussianblue has quit [Quit: leaving]
user71 has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 256 seconds]
factor2 has joined #ruby
factor2 has quit [Read error: Connection reset by peer]
factor2 has joined #ruby
konsolebox_ has joined #ruby
konsolebox has quit [Ping timeout: 256 seconds]
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 252 seconds]
donofrio_ has joined #ruby
jenrzzz has joined #ruby
donofrio_ has quit [Remote host closed the connection]
donofrio__ has quit [Ping timeout: 245 seconds]
donofrio_ has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
factor2 has quit [Quit: The Lounge - https://thelounge.chat]
factor2 has joined #ruby
factor2 has quit [Quit: The Lounge - https://thelounge.chat]
factor2 has joined #ruby
factor2 has quit [Client Quit]
factor2 has joined #ruby
otisolsen70 has quit [Quit: Leaving]
<rapha> hmm, so i had really long integers that i accidentally saved to sqlite as varchar and now they look like '1.14838269885531e+74' ... is an integer recoverable from that?
<adam12> >> 1.14838269885531e+74.to_i
<ruby-eval> => 114838269885530998508474828970629887146632918726700079172199233071016312832
<ruby[bot]> adam12: # => 114838269885530998508474828970629887146632918726700079172199233071016312832 (https://carc.in/#/r/grxt)
CanuteTheGreat has joined #ruby
<zayd> is it suggested to put .rb files in /project/lib/file.rb or /project/lib/project/file.rb when they aren't the main project file?
<Al2O3> best practice?
<zayd> yeah i guess. some stack overflow answer i found suggests putting them in lib/project/file.rb
<Al2O3> sounds like what is suggested.
<Al2O3> interestingly its not project or architecture specific, and each installation requirement for a job or contract may be quite different.
<Al2O3> with anything contract, or work for hire, suck on that nipple that makes the checks clear.
<Al2O3> when you figure out the conditionally correct location, inform us what you discovered.
<adam12> zayd: There's a reason behind lib/project/file, and that is when Rubygem installs your package, it basically puts `lib` into $LOAD_PATH (where files are required from). So if you don't namespace under `lib/project`, you run the risk of collision with other libraries.
<zayd> adam12: ah
<rapha> oooh, so it's .to_f.to_i, thank you adam12
<rapha> >> '1.14838269885531e+74'.to_f.to_i
<ruby-eval> => 114838269885530998508474828970629887146632918726700079172199233071016312832
<ruby[bot]> rapha: # => 114838269885530998508474828970629887146632918726700079172199233071016312832 (https://carc.in/#/r/grxy)
<rapha> thank god
<adam12> ie. For your example, if you went to `require "file"`, you'd get the wrong `File`, I bet (maybe one from stdlib).
<adam12> But if you required "myproject/file" you'd get the right one.
<rapha> (which is not to say that you are god, but thank both of you i guess :P )
<adam12> rapha: You might want BigDecimal then....
<adam12> >> require "bigdecimal"; BigDecimal("1.14838269885531e+74").to_i
<ruby-eval> => 114838269885531000000000000000000000000000000000000000000000000000000000000
<ruby[bot]> adam12: # => 114838269885531000000000000000000000000000000000000000000000000000000000000 (https://carc.in/#/r/grxz)
<adam12> Err. maybe? Hmm.
<rapha> that doesn't look as correct as the above one did
<adam12> I'm guessing the BigDecimal example is correct tho.
<rapha> these used to be hashes consisting of digits
<adam12> You tell me? e+74 is basically moving the decimal place 74 places.
<rapha> hmm
<adam12> But how does it backfill those digits?
<rapha> why does .to_f.to_i result in the number it does, then?
<adam12> Floating-point math maybe?
<rapha> because those hashes do not have lots of zeros in them
<weaksauce> because of ieee
<weaksauce> floating point spec
<rapha> but then i guess the info did get lost and god did forsake me :(
<weaksauce> once you get that big the accuracy goes to shit
<rapha> i should have INSERT'd them with quotation marks around the question marks :(
<adam12> rapha: Maybe :( I guess you'd have to have a comparable number to determine if you've lost any accuracy.
<weaksauce> why is the number so big in the first place?
<rapha> there is no accuracy as such adam12. they weren't numbers to begin with, just hashes that happened to be written as strings of digits.
<adam12> Hmm.
<adam12> Can you reproduce one?
<weaksauce> so like a bad serialization thing?
<adam12> If you generated them on the machine you're on, they might be right? (to_f, to_i)
<adam12> I am not super familiar with IEEE 754 but maybe someone else is.
<adam12> Assuming the co-processor or whatever on your machine would generate the same floating point value twice with the same input (pure)... ?
<adam12> >> '1.14838269885531e+74'.to_f.to_i
<ruby-eval> => 114838269885530998508474828970629887146632918726700079172199233071016312832
<ruby[bot]> adam12: # => 114838269885530998508474828970629887146632918726700079172199233071016312832 (https://carc.in/#/r/gry0)
<adam12> Hmm. Same number that I get locally.
<adam12> I dunno.
<rapha> it is indeed the same machine
<rapha> and since they're fingerprint hashes, i should be able to reproduce
<rapha> would beat waiting a week again
<rapha> ah, no, they're not correct at all. the distance function find thousands of duplicates for each photo i try it on.
<rapha> oh well. you live, you learn.
<adam12> Yeah :( store as a hexdigest next time I guess.
<adam12> That's a shame.
<rapha> well, sorting one's photos is a big task either way 😂
<rapha> but i appreciate your compassion, adam 🤗
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
Linux_Kerio has joined #ruby
Trivial has quit [Ping timeout: 268 seconds]
goldfish has joined #ruby
konsolebox_ has quit [Quit: .]
jenrzzz has joined #ruby
_ht has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 260 seconds]
pascal_blaze has joined #ruby
goldfish has quit [Remote host closed the connection]
user71 has quit [Quit: Leaving]
xdminsy has quit [Read error: Connection reset by peer]
goldfish has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 268 seconds]
xdminsy has joined #ruby
goldfish has quit [Quit: Leaving]
johnjaye has quit [Ping timeout: 245 seconds]
pascal_blaze has quit [Ping timeout: 245 seconds]
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
johnjaye has joined #ruby
leah2 has quit [Ping timeout: 268 seconds]
leah2 has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
jenrzzz has joined #ruby
Al2O3 is now known as DocturdSquonky
desnudopenguino has quit [Read error: Connection reset by peer]
desnudopenguino has joined #ruby
TomyLobo has quit [Read error: Connection reset by peer]