adam12 changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.0.2, 2.7.4, 2.6.8: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://goo.gl/wpGhoQ
<seydar> adam12: single-threaded, the program takes ~2 min. With 2 processes, the program takes >2 min
<seydar> so that makes me think that the DB calls are not actually being processed in parallel, and that there appears to be substantial overhead in the context switching
<adam12> seydar: I'd try turning on WAL.
<adam12> seydar: Actually, nm. You said reads. Hmm.
<adam12> seydar: I guess you'd have to benchmark it to see if you can see the bottleneck. Could it be IO bound?
<seydar> adam12: it's cpu-bound
<seydar> adam12: well i guess that answers my question
<seydar> adam12: Because I was previously smarter than I am today, I fetched everything from the DB ahead of time
Dreeg has joined #ruby
<Dreeg> Hi all! I'm using ruby 2.7 and encountered a problem that i didn't understand. I'm using "gsub" to substitute a regular expression in a static file but I'm stuck for strange behavior.
<Dreeg> a = ' const match = name.match(/(\d{4}-\d{2}-\d{2})((|-)\d{2}:\d{2})/);'
<Dreeg> a.gsub(/\(\\d\{4\}\-\\d\{2\}\-\\d\{2\}\)\(\-\\d\{2\}\:\\d\{2\}\)/, '(\d{4}-\d{2}-\d{2})((\+|-)\d{2}:\d{2})')
<Dreeg> Results: => " const match = name.match(/(\\d{4}-\\d{2}-\\d{2})((|-)\\d{2}:\\d{2})/);"
<seydar> adam12: maybe i should... not preload my data? Then I'd have some I/O to do work during
<Dreeg> Uhm .... where is "\+"? Why omit that character from a static string?
lunarkitty has joined #ruby
<adam12> Dreeg: That's .. narly. Have you tried running the first expression through Regexp.escape first?
seydar has quit [Quit: leaving]
<adam12> Dreeg: Or just pass a literal string for both? I don't think you need the regexp at all.
<Dreeg> hi adam12, thanks in advance! Nice Regexp.escape! Thank you, but in this case is not the problem. Regexp match correctly.
<Dreeg> I know :( but my problem is that I'm using a Chef Cookbook (Line) and I can't change the mode of using gsub. I can change just the arguments.
<adam12> >> 'const match = name.match(/(\d{4}-\d{2}-\d{2})((|-)\d{2}:\d{2})/);'.gsub("/(\d{4}-\d{2}-\d{2})((|-)\d{2}:\d{2})/", '(\d{4}-\d{2}-\d{2})((\+|-)\d{2}:\d{2})')
<ruby[bot]> adam12: # => "const match = name.match(/(\\d{4}-\\d{2}-\\d{2})((|-)\\d{2}:\\d{2})/);" (https://carc.in/#/r/bkp4)
<Dreeg> Hehehehe also in this link there are this problem with '\+' >.<
<Dreeg> More simply: 'hi'.gsub(/i/, '\+')
<Dreeg> >> 'hi'.gsub(/i/, '\+')
<Dreeg> => "h"
<adam12> Dreeg: This is weird, and I'm having deja-vu kinda. Maybe if havenwood is around, he might remember this.
<Dreeg> I hope!
<aesthetikx> wait what that is weird
<Dreeg> Meanwhile, thanks for the answers and the tag to those who might know the solution
<aesthetikx> I thought anything in single quotes was interpereted literally
<Dreeg> I thought so too
<Dreeg> I think GSub is a joking people :')
<aesthetikx> so
<aesthetikx> stuff like '\1' refers to the first group caputre, is '\+' doing something similar?
<adam12> >> 'hi'.gsub(/i/, "\+")
<ruby[bot]> adam12: # => "h+" (https://carc.in/#/r/bkpb)
<Dreeg> Exactly, I'm writhing this with double quote hehehehe is so strange!
<Dreeg> Ok aesthetikx but with '\\+' still didn't work :\
<aesthetikx> seems like '\+' is referrring to a match, check like
<Dreeg> Like with "\\+" that is egual to '\+'
<Dreeg> How can I avoid that?
<aesthetikx> >> 'abcd'.gsub(/(ab)/, '\+\+\+')
<ruby[bot]> aesthetikx: # => "abababcd" (https://carc.in/#/r/bkpc)
<aesthetikx> maybe that can help, I am right there with you currently haha if I can figure it out I'll let you know
<aesthetikx> nevermind that link is not even related to this, just how to escape +
<aesthetikx> so are you expecting => "h\+" Dreeg
<Dreeg> Ok aesthetikx.. Meanwhile, thank you, even if I have news I will let you know!
<Dreeg> Yes aesthetikx, I'm expecting => "h\+"
<aesthetikx> https://ruby-doc.com/docs/ProgrammingRuby/html/ref_c_string.html If you go to the gsub section this at least explains whats happening, \+ is the highest numbered capture group
<Dreeg> Ok... and so, how can I insert "\+" in a string with gsub?
<Dreeg> 'hi'.gsub(/i/, '\\\+')
<Dreeg> => "h\\+"
<Dreeg> lol
<aesthetikx> this is blowing my mind
<aesthetikx> im trying over here lol
<aesthetikx> no luck
<aesthetikx> tr wont do it either
xuochi has joined #ruby
<Dreeg> It seems absurd to me
<aesthetikx> ok try block form
<aesthetikx> >> 'hi'.gsub(/i/) { '\+' }
<ruby[bot]> aesthetikx: # => "h\\+" (https://carc.in/#/r/bkpi)
<aesthetikx> ^ shows \\ but actually that is the escape, #length shows 3
<Dreeg> hehehe yeah but for me \\+ is a problem
<aesthetikx> if you puts it its just h\+, if that is what you mean
<aesthetikx> I think I was confused because the string ruby displays as a result has escaping, but if you puts it shows whats actually in there
<aesthetikx> >> puts 'hi'.gsub(/i/, '\\\\+')
<ruby[bot]> aesthetikx: # => h\+ ...check link for more (https://carc.in/#/r/bkpj)
<Dreeg> Wait... what?
<Dreeg> 'hi'.gsub(/i/, '\\\\+') is ok?
<aesthetikx> yeah seemingly that gives 'h\+'
<Dreeg> Oh......... you're right!!
<aesthetikx> even though when ruby displays the string it shows "h\\+"
<Dreeg> with puts is ok!
<Dreeg> shit! hahahahahah
<aesthetikx> yeeeeeh boi
<aesthetikx> i know i was loosing it
<Dreeg> lol many thanks!
<Dreeg> I try immediately
<aesthetikx> I don't think I knew that ruby would display "" with escapes in there, or I never have been down the rabbit hole you are down maybe
<aesthetikx> well I learned a lot today
<Dreeg> I'm glad my problem has created opportunities for other people besides me to learn!
<Dreeg> LOL ... try with "p" instead of "puts" ...
<Dreeg> hahahahahahah
<Dreeg> aesthetikx
<aesthetikx> lol yeah I never use p although I probably should , is that just doing #inspect and then printing that and also returning it?
<Dreeg> Yes
<Dreeg> "Ruby uses single quote to indicate raw string" ... uhm ... are you sure? hahahaha
jetchisel has joined #ruby
<aesthetikx> lol if you see this %r!ftp://[^/]*/pub/! its time to give up for the day
<Dreeg> Great! It works in the software!
<aesthetikx> awesome
<Dreeg> Many thanks!
<aesthetikx> cheers
<Dreeg> cheers!
Dreeg has quit [Quit: Client closed]
drincruz has quit [Ping timeout: 246 seconds]
drincruz has joined #ruby
drincruz has quit [Ping timeout: 268 seconds]
ua_ has quit [Ping timeout: 265 seconds]
Rounin has quit [Ping timeout: 268 seconds]
ua_ has joined #ruby
kwilczynski has quit []
lunarkitty has quit [Quit: Connection closed for inactivity]
ua_ has quit [Ping timeout: 268 seconds]
lucf117 has quit [Quit: Leaving]
drincruz has joined #ruby
drincruz has quit [Ping timeout: 265 seconds]
darkxploit has quit [Read error: Connection reset by peer]
darkxploit has joined #ruby
michigan has quit [Quit: Connection closed for inactivity]
deftclaw has joined #ruby
jmcgnh has joined #ruby
michigan has joined #ruby
<michigan> hey uhm.. which is more proper, #{ foo } or #{foo}?
<michigan> or which do u prefer?
<michigan> gtg
<llua> the latter
jetchisel has quit [Ping timeout: 252 seconds]
deftclaw has quit [Quit: Client closed]
<michigan> llua: hmmm
<michigan> then i shall adopt it
<michigan> unless anybody has any objections?
<michigan> speak now or forever hold your peace :-) please
<michigan> i have to go. i love u guys
* michigan kisses llua on the mouth
_ht has joined #ruby
ua_ has joined #ruby
rhe has quit [Quit: Ping timeout (120 seconds)]
rhe has joined #ruby
drincruz has joined #ruby
lunarkitty has joined #ruby
drincruz has quit [Ping timeout: 268 seconds]
pwnd_sfw has quit [Ping timeout: 265 seconds]
pwnd_sfw has joined #ruby
entel_ has quit [Quit: Connection closed for inactivity]
gr33n7007h has joined #ruby
gr33n7007h has quit [Ping timeout: 268 seconds]
gr33n7007h has joined #ruby
gr33n7007h has quit [Read error: Connection reset by peer]
gr33n7007h has joined #ruby
michigan has quit [Quit: Connection closed for inactivity]
gr33n7001 has joined #ruby
gr33n7007h has quit [Ping timeout: 255 seconds]
gr33n7001 has quit [Ping timeout: 268 seconds]
Guest77 has joined #ruby
gr33n7001 has joined #ruby
gr33n7007h has joined #ruby
gr33n7001 has quit [Ping timeout: 252 seconds]
Rounin has joined #ruby
lunarkitty has quit [Quit: Connection closed for inactivity]
gr33n7007h has quit [Ping timeout: 268 seconds]
gr33n7007h has joined #ruby
shokohsc has joined #ruby
menace has quit [Ping timeout: 250 seconds]
lucerne has quit [Quit: Bye]
lucerne has joined #ruby
greyrat_ has joined #ruby
greyrat has quit [Ping timeout: 240 seconds]
gr33n7007h has quit [Ping timeout: 268 seconds]
gr33n7007h has joined #ruby
drincruz has joined #ruby
gr33n7001 has joined #ruby
gr33n7007h has quit [Ping timeout: 255 seconds]
drincruz has quit [Ping timeout: 265 seconds]
<aesthetikx> lol michigan i thought you said you were on the east coast what are you doing up at 2:47 am
gr33n7001 has quit [Ping timeout: 268 seconds]
gr33n7001 has joined #ruby
gr33n7001 is now known as gr33n7007h
jetchisel has joined #ruby
gr33n7001 has joined #ruby
gr33n7007h has quit [Ping timeout: 246 seconds]
drincruz has joined #ruby
easbarbosa has joined #ruby
drincruz has quit [Ping timeout: 268 seconds]
easbarbosa has quit [Ping timeout: 250 seconds]
gr33n7001 has quit [Ping timeout: 268 seconds]
gr33n7001 has joined #ruby
gr33n7007h has joined #ruby
gr33n7001 has quit [Ping timeout: 255 seconds]
willow has quit [Quit: willow]
michigan has joined #ruby
<michigan> whats up guys, was curious which one you prefer, #{ foo } or #{foo}?
<michigan> i've always used the former but my lab partner prefers the latter and now we're fighting over which to use
<michigan> i use [foo] however
<nakilon> #{foo}
<nakilon> basically put spaces only: 1. around operators 2. after ",", ";" 3. around |arg| 4. in between multiple bracket to make them read easier like when [{[({[{
<michigan> hmmm
<nakilon> and it's awful when people place space before { -- it has no purpose is an obvious inconsistency because after } they don't put the space when there is method chaining
<nakilon> also why you don't put space before[ and ( ? exactly, no sense
<michigan> true..
<michigan> i guess i just found { more visually disturbing, like it was begging me for extra space
<michigan> no more space for you little one, thanks nakilon
<aesthetikx> "A #{b} c".tap { |x| x }.map(&:upcase)
<aesthetikx> that is my preferences
<aesthetikx> unless we are in a seattle style codebase ;) .map &:upcase
<nakilon> seattle/google is a good one
<nakilon> it was a pleasure discover that they write like I do and not like the 99%
<aesthetikx> yeah its objectively more ruby like but I understand why some (most) codebases dont use it
<aesthetikx> i only do it that way on small or personal projects when I am going for poetry
<nakilon> why? because they had no codestyle so they have adopted the most advertised one (that was the one made by a guy with no experience)
<aesthetikx> haha are you referring to something specific
lzap has quit [Ping timeout: 268 seconds]
<nakilon> can't tell more
<aesthetikx> at google are you saying?
<aesthetikx> i didn't know they even wrote ruby over there
<nakilon> most (if not all) of the Google Cloud SDK team is there
<aesthetikx> in seattle? wait are you arguing for or against seattle style
<aesthetikx> brb
<nakilon> for
<nakilon> in the above message with "they had no codestyle" I mean not seattle but the majority of ruby newcomers
<nakilon> for lots of people it's either first lang or the 2nd after php
<nakilon> at least it's what I see around
<nakilon> at prevprevious job I was replaced by a student that didn't yet finish his study and jumper into coding in ruby "because it's the highest paid lang on market here" he said
<nakilon> *jumped
<nakilon> 99% of IT development in Russia is making websites (half is an outsource orders from Europe) and it's shifting from php to rails, and it's cheaper to hire students, so how much experience would you expect to be put into chosing the codestyle, practices, patterns, etc.
<nakilon> it's a huge business of paid courses since majority don't understand a single word in English and no one writes free Russian educational websites, books, etc. (the only one was in Wikibooks and no one advertises it because...) so people finish the basic school and asks parents money for a course
<nakilon> that is usually a low effort short articles in random order and after you finish it you are kind of able to make websites that is as I said the main job here; yesterday I saw someone called his course business a "Rails faculty", like in some university _<>
bandithijo has quit [Ping timeout: 258 seconds]
<nakilon> and since I don't want to become this narrowminded believer that programming==rails (that's really what all people here believe in) I don't do Rails, and it appears to be easier to win a jackpot than to find a job
bandithijo has joined #ruby
bandithijo has quit [Ping timeout: 268 seconds]
isekaijin has joined #ruby
gr33n7007h has quit [Ping timeout: 265 seconds]
bandithijo has joined #ruby
darkxploit has quit [Remote host closed the connection]
bandithijo has quit [Ping timeout: 268 seconds]
bandithijo has joined #ruby
gr33n7007h has joined #ruby
Guest47 has joined #ruby
Guest47 is now known as ShalokShalom
<ShalokShalom> I am interested into code patterns and architectures, particularly in form of real world experience, that facilitate mainly functional code in Ruby.
ShalokShalom has quit [Quit: Ping timeout (120 seconds)]
Guest47 has joined #ruby
gr33n7001 has joined #ruby
gr33n7007h has quit [Ping timeout: 255 seconds]
Guest47 has quit [Quit: Client closed]
gr33n7007h has joined #ruby
gr33n7001 has quit [Ping timeout: 265 seconds]
gr33n7007h has quit [Ping timeout: 268 seconds]
gr33n7007h has joined #ruby
bandithijo has quit [Ping timeout: 256 seconds]
gr33n7001 has joined #ruby
gr33n7007h has quit [Ping timeout: 265 seconds]
gr33n7001 has quit [Ping timeout: 268 seconds]
gr33n7001 has joined #ruby
<rg1> i use standardrb because i don't want to be a code nazi
Guest77 has quit [Quit: Client closed]
gr33n7007h has joined #ruby
gr33n7001 has quit [Ping timeout: 265 seconds]
lucf117 has joined #ruby
gr33n7007h has quit [Ping timeout: 246 seconds]
gr33n7007h has joined #ruby
con3 has joined #ruby
havenwood has quit [Quit: The Lounge - https://thelounge.chat]
havenwood has joined #ruby
havenwood has quit [Client Quit]
havenwood has joined #ruby
havenwood has quit [Quit: The Lounge - https://thelounge.chat]
havenwood has joined #ruby
havenwood9 has joined #ruby
havenwood has quit [Ping timeout: 258 seconds]
havenwood9 is now known as havenwood
entel_ has joined #ruby
_ht has quit [Remote host closed the connection]
drincruz has joined #ruby
gr33n7007h has quit [Ping timeout: 268 seconds]
gr33n7007h has joined #ruby
jetchisel has quit [Ping timeout: 265 seconds]
gr33n7007h has quit [Ping timeout: 268 seconds]
gr33n7007h has joined #ruby
michigan has quit [Quit: Connection closed for inactivity]
gr33n7007h has quit [Ping timeout: 268 seconds]
gr33n7007h has joined #ruby
menace has joined #ruby
menace has joined #ruby
menace has quit [Changing host]
jetchisel has joined #ruby
ur5us has joined #ruby
kwilczynski has joined #ruby
bandithijo has joined #ruby
bandithijo has quit [Ping timeout: 268 seconds]
bandithijo has joined #ruby
gr33n7007h has quit [Ping timeout: 255 seconds]
gr33n7007h has joined #ruby
menace has quit [Quit: menace]
bandithijo has quit [Ping timeout: 258 seconds]
CrazyEddy has quit [Ping timeout: 255 seconds]
drincruz has quit [Ping timeout: 255 seconds]
jetchisel has quit [Ping timeout: 265 seconds]
jetchisel has joined #ruby
jetchisel has quit [Ping timeout: 255 seconds]
ur5us has quit [Ping timeout: 255 seconds]
drincruz has joined #ruby
drincruz has quit [Ping timeout: 258 seconds]
drincruz has joined #ruby
michigan has joined #ruby
graywolf has quit [Ping timeout: 268 seconds]
CrazyEddy has joined #ruby
jetchisel has joined #ruby
drincruz has quit [Ping timeout: 246 seconds]