adam12 changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.1.3, 3.0.5, 2.7.7: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ | Logs: https://libera.irclog.whitequark.org/ruby/
markong has joined #ruby
Al2O3 is now known as cheese
cheese is now known as Al2O3
markong has quit [Ping timeout: 260 seconds]
crankharder has quit [Quit: leaving]
axisys has quit [Quit: Lost terminal]
grokify has joined #ruby
grokify has quit [Ping timeout: 260 seconds]
Rounin has quit [Ping timeout: 252 seconds]
caedmon has joined #ruby
caedmon has quit [Client Quit]
caedmon has joined #ruby
caedmon has quit [Client Quit]
caedmon has joined #ruby
caedmon has quit [Client Quit]
caedmon has joined #ruby
caedmon has quit [Client Quit]
grokify has joined #ruby
grokify has quit [Ping timeout: 265 seconds]
<D_A_N_> if it's on the backend, it's not js, it's node
<D_A_N_> similar but not the same thing
ur5us has quit [Ping timeout: 260 seconds]
cartdrige has joined #ruby
crax23 has joined #ruby
crax23 has quit [Client Quit]
crax23 has joined #ruby
cartdrige has quit [Ping timeout: 268 seconds]
<ox1eef_> unpoly ? it looks like browser-side javascript that interfaces with any backend. it could be using HTML features as well, like the "preload" attribute: https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types/preload - adam12 likely knows the details.
hightower3 has joined #ruby
hightower2 has quit [Ping timeout: 264 seconds]
cartdrige has joined #ruby
Y05hito__ has joined #ruby
crax23 has quit [Ping timeout: 264 seconds]
cartdrige has quit [Ping timeout: 264 seconds]
FullMetalStacker has joined #ruby
grokify has joined #ruby
Laplace has joined #ruby
grokify has quit [Ping timeout: 265 seconds]
aighearach_ has quit [Remote host closed the connection]
grokify has joined #ruby
grokify has quit [Remote host closed the connection]
<D_A_N_> it resides in the browser, it's unable to manipulate the file system, cannot render a desktop gui, perform database queries, is easily viewable by the end user just pressing ctrl + u
<D_A_N_> a server-side language, (as the name entails) is executed by the server
some14u has joined #ruby
<D_A_N_> google's Chrome V8 engine allows javascript to be executed by the server but that's Node
some14u has quit [Ping timeout: 264 seconds]
grokify has joined #ruby
tirnanog has quit [Quit: = ""]
grokify has quit [Ping timeout: 265 seconds]
grokify has joined #ruby
grokify has quit [Ping timeout: 264 seconds]
Linux_Kerio has joined #ruby
Guest9979 has joined #ruby
Guest9979 has quit [Client Quit]
white_magic has joined #ruby
grokify has joined #ruby
grokify_ has joined #ruby
grokify has quit [Read error: Connection reset by peer]
grokify_ has quit [Remote host closed the connection]
grokify has joined #ruby
grokify has quit [Remote host closed the connection]
Sankalp- has joined #ruby
Sankalp has quit [Ping timeout: 260 seconds]
Sankalp- is now known as Sankalp
mahlon has quit [Remote host closed the connection]
crax23 has joined #ruby
finsternis has quit [Read error: Connection reset by peer]
Y05hito__ has quit [Ping timeout: 256 seconds]
grokify has joined #ruby
grokify has quit [Ping timeout: 260 seconds]
grokify has joined #ruby
grokify has quit [Ping timeout: 265 seconds]
Y05hito__ has joined #ruby
rx has joined #ruby
crax23 has quit [Ping timeout: 264 seconds]
reset has quit [Quit: reset]
cartdrige has joined #ruby
white_magic has quit [Quit: Client closed]
Y05hito__ has quit [Ping timeout: 265 seconds]
crax23 has joined #ruby
Y05hito__ has joined #ruby
cartdrige has quit [Ping timeout: 268 seconds]
Guest74 has joined #ruby
crax23 has quit [Ping timeout: 265 seconds]
lutrinus has joined #ruby
grokify has joined #ruby
grokify has quit [Ping timeout: 264 seconds]
walez has joined #ruby
walez has quit [Client Quit]
aeris has quit [Ping timeout: 255 seconds]
aeris has joined #ruby
crax23 has joined #ruby
otisolsen70 has joined #ruby
Y05hito__ has quit [Ping timeout: 260 seconds]
Aminda has quit [Remote host closed the connection]
crax23 has quit [Ping timeout: 265 seconds]
Aminda has joined #ruby
grokify has joined #ruby
teclator has joined #ruby
grokify has quit [Ping timeout: 264 seconds]
cryptkeeper has quit [Quit: Connection closed for inactivity]
Rounin has joined #ruby
Rounin has quit [Changing host]
Rounin has joined #ruby
cryptkeeper has joined #ruby
teclator has quit [Ping timeout: 260 seconds]
teclator has joined #ruby
Linux_Kerio has quit [Ping timeout: 264 seconds]
Linux_Kerio has joined #ruby
D_A_N_ has quit [Quit: leaving]
Linux_Kerio has quit [Client Quit]
Linux_Kerio has joined #ruby
Rounin has quit [Ping timeout: 260 seconds]
grokify has joined #ruby
Linux_Kerio has quit [Ping timeout: 265 seconds]
grokify has quit [Ping timeout: 265 seconds]
Rounin has joined #ruby
Rounin has quit [Changing host]
Rounin has joined #ruby
grokify has joined #ruby
grokify has quit [Ping timeout: 260 seconds]
Linux_Kerio has joined #ruby
Guest7368 has joined #ruby
_aeris_ has joined #ruby
<Guest7368> Hello Team, may I know the meaning of below line, I am writing unit tests using existing code as reference, I want to understand below line.
<Guest7368> ```
<Guest7368> expect(@subject).to receive(:get_url).with(@client, @db){@uri}
<Guest7368> ```
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
Aminda has quit [Ping timeout: 255 seconds]
aeris has quit [Ping timeout: 255 seconds]
_aeris_ is now known as aeris
jvalleroy has joined #ruby
lutrinus has quit [Quit: lutrinus]
lutrinus has joined #ruby
Aminda has joined #ruby
<ox1eef_> Guest7368: That line of code sets up an expectation (assertion) that 'get_url' with be called on '@subject', with two arguments: @client, @db, and a block that returns @uri. The expecation is expected to be met by code that's run after it.
Guest74 has quit [Quit: Client closed]
<ox1eef_> I'm not too sure about the block part, though. I never seen it used in the real world. Apart from that, I think the above is accurate description of that line.
<Guest7368> ox1eef_, Thank you its clean now, I am able to connect the dots, BTW can you refer me any resources please to understand Rspec syntax better ?
<Guest7368> ox1eef_, Thank you. it's clear now. I am able to connect the dots, BTW can you refer me to any resources please to understand Rspec syntax better?
<ox1eef_> https://relishapp.com/rspec .. it might help. i have found practice to be the best teacher when it comes to rspec.
grokify has joined #ruby
grokify has quit [Ping timeout: 264 seconds]
kinduff has quit [Remote host closed the connection]
<Guest7368> Thank you ox1eef_
kinduff has joined #ruby
Guest7368 has quit [Quit: Client closed]
___nick___ has joined #ruby
hightower3 has quit [Ping timeout: 265 seconds]
grokify has joined #ruby
aeris has quit [Remote host closed the connection]
grokify has quit [Ping timeout: 260 seconds]
aeris has joined #ruby
some14u has joined #ruby
cartdrige has joined #ruby
dionysus69 has joined #ruby
grokify has joined #ruby
cryptkeeper has quit [Quit: Connection closed for inactivity]
grokify has quit [Ping timeout: 260 seconds]
markong has joined #ruby
weaksauce has joined #ruby
grokify has joined #ruby
weaksauc_ has quit [Ping timeout: 260 seconds]
grokify has quit [Ping timeout: 265 seconds]
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
otisolsen70 has quit [Quit: Leaving]
dionysus70 has joined #ruby
dionysus69 has quit [Ping timeout: 265 seconds]
dionysus70 is now known as dionysus69
grokify has joined #ruby
cartdrige has quit [Ping timeout: 268 seconds]
grokify has quit [Ping timeout: 260 seconds]
TomyWork has joined #ruby
cartdrige has joined #ruby
grokify has joined #ruby
grokify has quit [Ping timeout: 265 seconds]
markong has quit [Read error: Connection reset by peer]
grokify has joined #ruby
grokify has quit [Ping timeout: 265 seconds]
crax23 has joined #ruby
cartdrige has quit [Ping timeout: 260 seconds]
Y05hito__ has joined #ruby
crax23 has quit [Ping timeout: 265 seconds]
Y05hito__ has quit [Ping timeout: 256 seconds]
grokify has joined #ruby
grokify has quit [Ping timeout: 260 seconds]
grokify has joined #ruby
va5c0 has joined #ruby
va5c0 has quit [Client Quit]
hightower2 has joined #ruby
grokify has quit [Ping timeout: 260 seconds]
va5c0 has joined #ruby
hightower3 has joined #ruby
hightower2 has quit [Ping timeout: 264 seconds]
Linux_Kerio has quit [Ping timeout: 260 seconds]
va5c0 has quit [Quit: WeeChat 3.7.1]
grokify has joined #ruby
grokify has quit [Ping timeout: 264 seconds]
idkwtf has joined #ruby
<idkwtf> Hi :)
<adam12> idkwtf: hello
<idkwtf> Good to see you bud!
<adam12> idkwtf: you too. how goes.
<idkwtf> Almost done with all my layouts!
<idkwtf> Made a little tune for my dad: https://lsangeles.com/sang_til_pappa.mp3
<idkwtf> Gotta finish my marketplace https://lsangeles.com/marketplace before the Christmas rush if I hope to see any affiliate dollars
<idkwtf> yourself there?
<adam12> idkwtf: Sick. Whole house has been sick for 2+ weeks now. Sucks.
<idkwtf> Damn!
<adam12> I'm pushing through because I'm taking vacation in a week+half.
<adam12> But it's been a bit rough :)
<idkwtf> Not too bad timing actually
<idkwtf> Where you going? :)
<adam12> idkwtf: My couch :P
<idkwtf> lmao
<adam12> idkwtf: It's a staycation. I don't like travelling near holidays.
<idkwtf> Yeah good point
<idkwtf> Very good point
grokify has joined #ruby
FullMetalStacker has quit [Remote host closed the connection]
grokify has quit [Remote host closed the connection]
reset has joined #ruby
grokify has joined #ruby
<yourfriend> hello :)
<yourfriend> I've been learning ruby, it's been quite fun
<idkwtf> lol
<idkwtf> i used to have that nick!
<yourfriend> unforunately, I'm running into some kind of weird memory leak inside io:buffer..?
<idkwtf> no wait that was "yournick"
<yourfriend> xD
<idkwtf> welcome glad to have you here <3
<yourfriend> thanks! I ran a profiler on my code to figure out wheeere the issue was coming from, and it was inside of my packets.rb file
<yourfriend> for context, I'm writing a ncurses-based chatapp
<yourfriend> precisely the line being
<yourfriend> @packet.set_string(value+(" "*(128-value.length)), @id)
<yourfriend> @id is a offset, @packet is a IO::Buffer buffer
<yourfriend> value is just some string
<yourfriend> it's supposed to make a string with padding to length 128
grokify has quit [Remote host closed the connection]
<yourfriend> anytime the packet is well, extracted, it free's the buffer and gets the string
<ruby[bot]> yourfriend: we in #ruby do not like pastebin.com, it loads slowly for most, has ads which are distracting and has terrible formatting. Please use https://gist.github.com
<yourfriend> alright I was guessing that people won't like pastebin
<yourfriend> the def extract() line
<yourfriend> io::buffer is so enticing.. I'm thinking of switching away from it however because of this, and I'm not even sure if will work if I switch away from it
dionysus69 has quit [Ping timeout: 264 seconds]
lutrinus has quit [Ping timeout: 264 seconds]
<adam12> yourfriend: If you can make a reproducable example, it might be worth tagging Samuel (ioquatix)
<yourfriend> reproducable memory leak?
<adam12> yourfriend: Yes.
rx has quit [Ping timeout: 268 seconds]
Laplace has quit [Quit: Connection closed for inactivity]
<yourfriend> ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-linux]
<yourfriend> recreated on ruby 3.1.3p185 (2022-11-24 revision 1a6b16756e) [x86_64-linux]
grokify has joined #ruby
grokify has quit [Ping timeout: 264 seconds]
D_A_N_ has joined #ruby
<yourfriend> adam12: made a reproducable example
<adam12> yourfriend: the gist?
FullMetalStacker has joined #ruby
<yourfriend> yes
<yourfriend> not entierly sure if that's the correct way to get used memory
<adam12> If I run GC after free, memory seems to stay consisitent.
<adam12> So the question is if there's a memory leak, or if the GC never kicked in automatically yet.
<adam12> Since we're recreating new objects in the loop every time.
kinduff has quit [Remote host closed the connection]
grokify has joined #ruby
TomyWork has quit [Remote host closed the connection]
croberts has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
supay has joined #ruby
grokify has quit [Ping timeout: 265 seconds]
kinduff has joined #ruby
kinduff has quit [Remote host closed the connection]
kinduff has joined #ruby
tirnanog has joined #ruby
grokify has joined #ruby
kinduff has quit [Remote host closed the connection]
desnudopenguino has joined #ruby
kinduff has joined #ruby
grokify has quit [Remote host closed the connection]
kinduff has quit [Remote host closed the connection]
kinduff has joined #ruby
polishdub has quit [Quit: leaving]
Linux_Kerio has joined #ruby
Linux_Kerio has quit [Ping timeout: 265 seconds]
<yourfriend> adam12: is it bad that this is happening that?
<yourfriend> that it's not kicking in yet
<adam12> yourfriend: Nah. GC is expensive so it's not normal to be called frequently.
<yourfriend> so this isn't a memory leak then?
<adam12> yourfriend: I'd graph it running for a long time. If it's saw-like, when the GC kicks in, then there is no leak.
<yourfriend> what do you mean by saw-like?
<adam12> yourfriend: Increases gradually, then GC kicks in, so it drops a bunch, then increases back up again.
<adam12> So it's like saw-tooth patterend.
<yourfriend> Right now it looks more like it's constantly growing a lot, and then GC drops it entierly
<adam12> Every buffer object is an allocation, so that does make sense.
polishdub has joined #ruby
zoknert has joined #ruby
<yourfriend> cool! learnt something about ruby today
<yourfriend> originally I was researching why my stuff memory leaked
<yourfriend> because I was getting weird and obscure GC errors
_73 has joined #ruby
Guest8222 is now known as gr33n7007h
moldorcoder7 has quit [Ping timeout: 264 seconds]
moldorcoder7 has joined #ruby
cryptkeeper has joined #ruby
some14u has joined #ruby
Linux_Kerio has joined #ruby
Vonter_ has quit [Quit: WeeChat 3.7.1]
_ht has joined #ruby
cartdrige has joined #ruby
FullMetalStacker has quit [Read error: Connection reset by peer]
grokify has joined #ruby
zoknert has quit [Ping timeout: 260 seconds]
grokify has quit [Ping timeout: 260 seconds]
grokify has joined #ruby
grokify has quit [Ping timeout: 260 seconds]
grokify has joined #ruby
dionysus69 has joined #ruby
grokify has quit [Ping timeout: 256 seconds]
hightower3 has quit [Remote host closed the connection]
___nick___ has quit [Ping timeout: 264 seconds]
grokify has joined #ruby
_ht has quit [Quit: _ht]
grokify has quit [Ping timeout: 256 seconds]
grokify has joined #ruby
grokify has quit [Ping timeout: 256 seconds]
Linux_Kerio has quit [Ping timeout: 265 seconds]
grokify has joined #ruby
grokify has quit [Ping timeout: 260 seconds]
idkwtf has quit [Quit: Lost terminal]
sagax has joined #ruby
grokify has joined #ruby
grokify has quit [Ping timeout: 260 seconds]
dionysus69 has quit [Ping timeout: 264 seconds]
dionysus69 has joined #ruby
hightower2 has joined #ruby
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
<isene> Using STDIN.getch, how do I disregard control character inputs (like C-L, PgUP etc?
Aminda has quit [Remote host closed the connection]
Aminda has joined #ruby
<ox1eef_> isene: do you know what you can accept ? it is probably easier to use an allow list.
<isene> ox1eef_: How? (I would accept a-zA-z0-9\" )
<isene> Or actually any single word character
<ox1eef_> something like:
<ox1eef_> def getch
<ox1eef_> c = STDIN.getch
<ox1eef_> getch unless c =~ /[a-zA-Z]+/
<ox1eef_> end
<ox1eef_> prayer time. bbiab.
<ox1eef_> oh it's one character. probably don't need a regexp at all but an array of what's allowed, then 'getch unless allowed.include?(c)'
<ox1eef_> you will also probably want to return c just below the 'unless', then you can call that method, and be sure when it finally exits that you have something in 'allwed'.
<isene> Problem seems to be that PgUP or other control character sequence leaves several characters in STDIN. How do I get rid of those? STDIN.flush or STDIN.iflush doesnæt clear those
<ox1eef_> How do I reproduce that?
<ox1eef_> I guess that could happen if more than one byte is written to STDIN by pgup
<isene> in irb;
<isene> a = STDIN.getch
<isene> then press C-LEFT
<isene> then do a = STDIN.getch again to see remaining chars to flush
<isene> then do another a = STDIN.getch
<isene> again press C-LEFT
<ox1eef_> ctrl-left is a no-op for me. still though, with a recursive method, it would empty stdin until it is something in the allowed list.
<isene> do STDIN.iflush
<ox1eef_> the getch method above, under those circumstances, would call itself however many times until something 'allowed' is returned from stdin.
<isene> OK, trying
<ox1eef_> i will be back in 15min or so
some14u has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<isene> ox1eef_: That recursive function either returns nil or waits indefinitely...
<ox1eef_> yeah, one second
<ox1eef_> def getch(allowed)
<ox1eef_> c = STDIN.getch
<ox1eef_> getch unless allowed.include?(c.downcase)
<ox1eef_> c
<ox1eef_> end
<ox1eef_> allowed = ('a'..'z').to_a.concat (0..9).to_a
<ox1eef_> getch(allowed)
<ox1eef_> require 'io/console'
<ox1eef_> def getch(allowed)
<ox1eef_> c = STDIN.getch
<ox1eef_> getch(allowed) unless allowed.include?(c.downcase)
<ox1eef_> c
<ox1eef_> end
<ox1eef_> allowed = ('a'..'z').to_a.concat (0..9).to_a
<ox1eef_> puts getch(allowed)
<ox1eef_> this version should work ^