havenwood changed the topic of #ruby to: Rules: https://ruby-community.com | Ruby 3.2.1, 3.1.3, 3.0.5, 2.7.7: https://www.ruby-lang.org | Paste 4+ lines to: https://gist.github.com | Books: https://t.ly/9ua4 | Logs: https://libera.irclog.whitequark.org/ruby/
roshanavand has joined #ruby
<myappie> I'm trying to use the AI https://replicate.com/tencentarc/gfpgan/api to enhance the image quality of photos. But that example is in Python, how do I do it in Ruby? Some Base64 stuff maybe? https://clbin.com/Z04M7
<newton> myappie, you should refresh your api token if that's your real one in the paste
<newton> the python example doesn't do any base64 stuff. it just reads the file data. maybe File.read('path/to/file')?
<myappie> newton: Yep, but the https://github.com/dreamingtulpa/replicate-ruby/ suggested it and then disappeared
<myappie> Kinda urgent, gotta rebrand a friend of mine using Dreambooth before Friday's concert
<myappie> Yep
<newton> so you're doing Dir.glob in your code, which'll get you a list of the images in the dir, but you've gotta read the file to get the data and pass that to encode
dionysus69 has quit [Ping timeout: 248 seconds]
<newton> so something like base64_image = Base64.encode64(File.read(image))
<myappie> and then img: base64_image,... and then later somewhere a decoder?
roshanavand has quit [Remote host closed the connection]
<myappie> this is confucius
<newton> I have no idea what the output of the predict is going to give you ¯\_(ツ)_/¯
<myappie> version.predict.finished? should be true
dionysus69 has joined #ruby
<myappie> and there should be a completed_at when running version.predict(inputs) after the pry
Al2O3 has quit [Quit: I'm quitting, thanks for all the sharks.]
nickjj_ has joined #ruby
A_Dragon has quit [Ping timeout: 615 seconds]
rhe8 has joined #ruby
kaivai_ has joined #ruby
entropy has joined #ruby
Vonter has quit [Ping timeout: 255 seconds]
Demi_ has joined #ruby
kaivai has quit [Ping timeout: 255 seconds]
ule has quit [Ping timeout: 255 seconds]
Demi has quit [Ping timeout: 255 seconds]
thecligu1 has quit [Ping timeout: 255 seconds]
entropie has quit [Ping timeout: 255 seconds]
nickjj has quit [Ping timeout: 255 seconds]
entropy is now known as entropie
rhe has quit [Ping timeout: 255 seconds]
rhe8 is now known as rhe
Vonter has joined #ruby
ule has joined #ruby
thecligu1 has joined #ruby
eddof13 has joined #ruby
eddof13 has quit [Client Quit]
A_Dragon has joined #ruby
Al2O3 has joined #ruby
pmwals09 has joined #ruby
pmwals09_ has joined #ruby
FullMetalStacker has joined #ruby
pmwals09 has quit [Ping timeout: 255 seconds]
<FullMetalStacker> Hi all! I have an issue with a Kata on Codewars. My code works but is not performant enough for bigger strings in terms of Big O. Here is my code: https://privatebin.net/?462115e1b6b913c4#D9oM5h2BFecAiTz8bN7D6vCkyp1r4G2kYrkn6oq5W2Dn and here is the kata description: https://www.codewars.com/kata/59cf8bed1a68b75ffb000026/train/ruby
<FullMetalStacker> I have tried changing the permutation so that each permutation is checked if it contains 2 consecutive vowels or consonants so to add only the ones which don't and thus keep the sorting later on smaller. But that increased the computing time by 4x instead of reducing it, supposedly because the iterations are slowlyer than the plain regex. Has anyone a suggestion for me what I could do to cut computing time?
<leftylink> permutation should not be used at all, then.
<leftylink> it is not necessary to check every single permutation because the correct answer is uniquely determined by the strict rules: it must be the lexicographically first, so there can only be one possibility
<leftylink> if this was a question about odd and even digits and they asked you to find the smallest number made of the digits 54321 that alternates odd ane even digits are you going to waste your time checking 54321 54312 54213 54231 54123 54132 no of course not, you know those can't be the smallest number
nirvdrum has joined #ruby
moldorcoder7 has quit [Ping timeout: 248 seconds]
<FullMetalStacker> @leftylink I understand what you are saying but have no clue about how to implement a solution into code that takes this into consideration. do you have an idea for me?
<leftylink> write down the process of how you, as a human, figure out what is the smallest number that alternates odd and even digits from the digits 54321. convert that written process into code in the language of your choice
<leftylink> you certainly aren't doing it as a human by checking every single possibility, that's for sure
pmwals09_ has quit [Remote host closed the connection]
markong has quit [Ping timeout: 248 seconds]
<FullMetalStacker> great advice, leftylink, thank you!
<leftylink> for some general principles, one of the tags on that problem is algorithms, so it is useful to take a look at some of the listed general techniques in https://en.wikipedia.org/wiki/Algorithmic_technique and see whether any of them apply. as has already been experimentally determined by you, brute force is unsuitable. so now it is time to think about some of the thers
<leftylink> that page might be said to list a lot. for a better idea of what should be a priority to look at first, one might consider what one university instructor thought was a good selection to teach their students http://www2.cs.uregina.ca/~mouhoubm/=postscript/=c3620/chap10.pdf
<leftylink> they only selected five, so presumably starting with those five would be a good introduction
<leftylink> I would of course never introduce bias into this process by selectively ony picking a university that I was associated with. it was just a random search result
razetime has joined #ruby
<myappie> newton: if you're still there i've cleaned it up a lot but the problem's still there: https://clbin.com/u6HzY -- https://replicate.com/p/hc24zndrq5aqbdqktbjgb7leca
<FullMetalStacker> @leftylink: superthanks! this is my intro moment into algorithms! i guess slowly but surely i have to face that i will have to become a real coder now if i want to further improve :-) I love it.
wk has quit [Ping timeout: 260 seconds]
<FullMetalStacker> currently working hard on reaching 2nd kyu on codewars, i guess diving into real algorithms & data structure topics is just about time for me now
Linux_Kerio has quit [Ping timeout: 248 seconds]
sickdyd has joined #ruby
<sickdyd> more like a ror question, but... when I run this User.where("email LIKE ?", "%test%") I get (Object doesn't support #inspect), any idea why?
wk has joined #ruby
<FullMetalStacker> @leftylink thank you so much, i solved it within minutes just by your "think like a human" advice. super simple code now :-) https://privatebin.net/?035edb9d3a6ba283#9PGrfWitzzV7Se7KDaXcqapJ8wxb4wRSQqNuSqGVv43L
<FullMetalStacker> Will study the algorithm links you sent now. Thanks again!
<leftylink> pandabot what's thumbs up emoji
<pandabot> thumbupemoji is: 👍
<leftylink> a list with only one element that then gets Array#join called on it might as well not be an array
<FullMetalStacker> refactored: https://privatebin.net/?a699622cb7cd6c3f#3uZiDzQVLsMRfL8UYV8eUxDy4bCz1VSbZD1PcqhqXU9u OMG and this took me hours :oD
pmwals09 has joined #ruby
pmwals09 has quit [Client Quit]
nirvdrum_ has joined #ruby
nirvdrum has quit [Ping timeout: 255 seconds]
FullMetalStacker has quit [Remote host closed the connection]
dorian_ is now known as dorian
Sankalp has quit [Ping timeout: 255 seconds]
Sankalp has joined #ruby
swaggboi has quit [Quit: C-x C-c]
nirvdrum_ has quit [Quit: nirvdrum_]
nirvdrum has joined #ruby
<ox1eef_> Codewars reminds me of a modern day crosswords puzzle. Very cool.
swaggboi has joined #ruby
ur5us_ has quit [Ping timeout: 260 seconds]
reset has quit [Quit: reset]
sickdyd has quit [Quit: leaving]
quazimodo has quit [Ping timeout: 276 seconds]
quazimodo has joined #ruby
neshpion has quit [Quit: neshpion]
razetime has quit [Ping timeout: 255 seconds]
shokohsc649 has joined #ruby
John_Ivan has quit [Remote host closed the connection]
John_Ivan has joined #ruby
shokohsc64 has quit [Ping timeout: 276 seconds]
shokohsc649 is now known as shokohsc64
razetime has joined #ruby
phenom has quit [Ping timeout: 255 seconds]
shokohsc64 has quit [Read error: Connection reset by peer]
razetime has quit [Quit: See You Space Cowboy]
shokohsc64 has joined #ruby
dmn has joined #ruby
grenierm has joined #ruby
dmn has quit [Ping timeout: 260 seconds]
freein36 has joined #ruby
dmn has joined #ruby
freein36 has quit [Remote host closed the connection]
proaca1 has quit [Ping timeout: 268 seconds]
u0_a115 has joined #ruby
Goodbye_Vincent has quit [Quit: Ping timeout (120 seconds)]
Goodbye_Vincent has joined #ruby
u0_a115 has quit [Ping timeout: 276 seconds]
u0_a115 has joined #ruby
Linux_Kerio has joined #ruby
razetime has joined #ruby
phenom has joined #ruby
nirvdrum has quit [Quit: nirvdrum]
tomtmym has joined #ruby
tomtmym has quit [Changing host]
tomtmym has joined #ruby
u0_a1151 has joined #ruby
u0_a115 has quit [Ping timeout: 255 seconds]
nirvdrum has joined #ruby
nirvdrum has quit [Quit: nirvdrum]
siery has quit [Ping timeout: 248 seconds]
teclator has joined #ruby
_ht has joined #ruby
Sankalp has quit [Quit: ZNC 1.7.2+deb3 - https://znc.in]
Sankalp has joined #ruby
razetime has quit [Ping timeout: 276 seconds]
lembron has joined #ruby
<lembron> so... i got a old docker image, in there i "gem install mailcatcher" - "now this broke" - 'net-protocol' is not happy with the ruby version ||| how can i get this to still build? - i tried to version-constrain mailcatcher but that seems to have no effect
<lembron> I still have a working image too, if there is any list-of-versions i can export&reuse or so?
shokohsc64 has quit [Quit: Ping timeout (120 seconds)]
<lembron> (updating the image-os / ruby is out of the question, this has to be this old version for CI)
shokohsc64 has joined #ruby
razetime has joined #ruby
u0_a1151 has quit [Ping timeout: 255 seconds]
u0_a1151 has joined #ruby
u0_a1152 has joined #ruby
dionysus69 has quit [Ping timeout: 248 seconds]
u0_a1151 has quit [Ping timeout: 248 seconds]
u0_a1152 has quit [Ping timeout: 248 seconds]
infinityfye has joined #ruby
u0_a1152 has joined #ruby
u0_a1152 has quit [Read error: Connection reset by peer]
u0_a1152 has joined #ruby
cnsvc- has joined #ruby
cnsvc has quit [Ping timeout: 255 seconds]
newton has quit [Ping timeout: 260 seconds]
newton has joined #ruby
shokohsc64 has quit [Quit: Ping timeout (120 seconds)]
shokohsc64 has joined #ruby
dionysus69 has joined #ruby
u0_a1152 has quit [Ping timeout: 248 seconds]
jvalleroy has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
jvalleroy has joined #ruby
u0_a1152 has joined #ruby
u0_a1152 has quit [Ping timeout: 255 seconds]
shokohsc646 has joined #ruby
shokohsc64 has quit [Ping timeout: 276 seconds]
shokohsc646 is now known as shokohsc64
shokohsc647 has joined #ruby
shokohsc64 has quit [Ping timeout: 255 seconds]
shokohsc647 is now known as shokohsc64
<ox1eef_> lembron: 'gem install mailcatcher -v X.X.X'. 'Gemfile.lock' usually avoids this problem by locking your bundle to specific versions that won't drift over time.
otisolsen70 has joined #ruby
<lembron> does that reference the/a lockfile in the package from upstream? how to check if that exists? or something i am expected/can create from my working?
<lembron> on that note, i did get somewhere... "gem list", reformed to package:version, and then run a `xargs gem install --no-rdoc --no-ri < gems_ruby-2-1.txt`
<ox1eef_> 'gem install mailcatcher' does not use Gemfile.lock. It wil fetch the most recent version, which might stop working over time.
<lembron> test-unit had some faulty 4-digit-version number, but for the rest that appears to be working
<lembron> (and removing the version constrain on test-unit made the whole list work)
<ox1eef_> Cool. But look into bundler. This is basically the problem it solves.
<lembron> now the same again for ruby2.3 :D
<lembron> a bigdecimal:1.2.8 that has been janked from the gemrepo... force that to 2.7 and thats working too =)
<ox1eef_> Great success.
razetime has quit [Remote host closed the connection]
u0_a1152 has joined #ruby
u0_a1152 has quit [Ping timeout: 268 seconds]
u0_a1152 has joined #ruby
u0_a1152 has quit [Ping timeout: 248 seconds]
shokohsc643 has joined #ruby
shokohsc64 has quit [Ping timeout: 255 seconds]
shokohsc643 is now known as shokohsc64
moldorcoder7 has joined #ruby
c10l7 has quit [Read error: Connection reset by peer]
c10l7 has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
shokohsc64 has quit [Ping timeout: 276 seconds]
grenierm has quit [Ping timeout: 260 seconds]
<lembron> well, historic 2.1, 2.3 & 2.5 handled, all images build, see ya in another 2 years ;D
teclator has quit [Ping timeout: 255 seconds]
teclator has joined #ruby
szkl has joined #ruby
MalusVulgaris has joined #ruby
reset has joined #ruby
gr33n7007h has quit [Ping timeout: 248 seconds]
gr33n7007h has joined #ruby
perrierjouet has quit [Quit: WeeChat 3.8]
perrierjouet has joined #ruby
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
MalusVulgaris has quit [Quit: MalusVulgaris]
Linux_Kerio has quit [Ping timeout: 255 seconds]
nirvdrum has joined #ruby
smp has quit [Ping timeout: 248 seconds]
smp has joined #ruby
smp has quit [Ping timeout: 268 seconds]
smp has joined #ruby
razetime has joined #ruby
smp_ has joined #ruby
smp has quit [Ping timeout: 248 seconds]
smp_ is now known as smp
eddof13 has joined #ruby
siery has joined #ruby
moldorcoder7 has quit [Ping timeout: 248 seconds]
dionysus69 has quit [Ping timeout: 248 seconds]
hightower2 has quit [Ping timeout: 255 seconds]
moldorcoder7 has joined #ruby
mollerup has joined #ruby
perrierjouet has quit [Quit: WeeChat 3.8]
nmollerup has quit [Read error: Connection reset by peer]
molle has joined #ruby
perrierjouet has joined #ruby
razetime has quit [Quit: See You Space Cowboy]
mollerup has quit [Ping timeout: 268 seconds]
MalusVulgaris has joined #ruby
MalusVulgaris has quit [Client Quit]
hightower2 has joined #ruby
dmn has quit [Quit: Client closed]
teclator has quit [Ping timeout: 268 seconds]
wand has quit [Ping timeout: 255 seconds]
wand has joined #ruby
infinityfye has quit [Quit: Leaving]
goldfish has joined #ruby
dostoyevsky2 has quit [Ping timeout: 252 seconds]
<sphex> Wouldn't it be nice if you could initialize an object's instance variables with a syntax like this: def initialize @a, @b, @c = 123; end;
<sphex> i.e., instance variables directly in the constructor's parameters list
<sphex> That's one (fairly minor) thing that I find a little bit annoying with ruby, the constructors often have a bunch of lines of assignments that look like boilerplate.
dostoyevsky2 has joined #ruby
<adam12> sphex: Every once in a while I think I'd like it, but tbh I'd rather it explicit.
<adam12> Seems like less one thing to explain away (like attr_accessor and it's relationship to @var)
Linux_Kerio has joined #ruby
<sphex> right now I sometimes use Struct so that it handles initialization for me (because I'm just that lazy) but it's also something to explain away
rvalue has quit [Read error: Connection reset by peer]
<adam12> That's true, and I sometimes use Struct for that too. But Struct does have some baggage I don't always want (Enumerable being one)
rvalue has joined #ruby
<sphex> also, Struct's internal instance variables are "invisible" somehow? what's up with that?
Linux_Kerio has quit [Ping timeout: 276 seconds]
<adam12> LOL. No idea.
___nick___ has joined #ruby
Artea has joined #ruby
Artea has quit [Remote host closed the connection]
goldfish has quit [Ping timeout: 276 seconds]
gonix has joined #ruby
___nick___ has quit [Quit: https://quassel-irc.org - Chat comfortably. Anywhere.]
___nick___ has joined #ruby
___nick___ has quit [Client Quit]
___nick___ has joined #ruby
dmn has joined #ruby
gonix has quit [Ping timeout: 255 seconds]
Artea has joined #ruby
otisolsen70 has quit [Quit: Leaving]
ur5us_ has joined #ruby
dmn has quit [Ping timeout: 260 seconds]
crespire has joined #ruby
crespire has quit [Changing host]
crespire has joined #ruby
___nick___ has quit [Ping timeout: 248 seconds]
_ht has quit [Remote host closed the connection]
dionysus69 has joined #ruby
dionysus69 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
dionysus69 has quit [Client Quit]
<havenwood> sphex: It's implemented as member attributes rather than instance variables, but agree it's odd. https://github.com/ruby/ruby/blob/v3_2_1/struct.c#L1175-L1206
<havenwood> Data.define is similar.
<havenwood> At least this works in Data but wouldn't in Struct:
<havenwood> Person = Data.define(:name) { def initialize(name: 'sphex') = super(name:) }
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
teclator has joined #ruby
tomtmym has quit [Quit: Gone.]
eddof13 has joined #ruby
drg99 has joined #ruby
apteryx has joined #ruby
<drg99> Hi, I am trying to run a command in this way: Open3.popen2("node run.js #{client_id}") {|i,o,t|, and client_id is having some spaces and parentheses inside. How would I pass it correctly without having sh syntax error?
<apteryx> hi! I'm trying to enable the test suite for railties 7.0.4.2, and I'm a little confused, it says "LoadError: cannot load such file -- rails/api/generator" at the time of running 'rake test'; isn't that provided by itself?
mexen has joined #ruby
drg99 has quit [Quit: Client closed]
Linux_Kerio has joined #ruby
markong has joined #ruby
<adam12> apteryx: That's strange. `bundle check` is OK?
ruby[bot] has quit [Remote host closed the connection]
ruby[bot] has joined #ruby
Vonter has quit [Ping timeout: 268 seconds]
eddof13 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mexen has quit []
FetidToot7 has joined #ruby
FetidToot has quit [Ping timeout: 248 seconds]
FetidToot7 is now known as FetidToot
FullMetalStacker has joined #ruby
Vonter has joined #ruby
<FullMetalStacker> #frontendframework: do you guys work with a frontend framework such as React, Vue.js, etc. or with Rails only? If with a framework, what would be the best one to learn in 2023 for a newcomer? My current idea is to go for React and then also React Native for a solution for adding native mobile Apps to the Rails backend. Is that the best curriculum to advance myself as an upcoming Rails Dev in 2023?