banisterfiend has quit [Read error: Connection reset by peer]
<leftylink>
what was that saying again
<Intelo>
leftylink, I want to check if a param has true value or not
<Intelo>
rails
<leftylink>
somethng about "if the expected behaviour is not specified, not only can a proposed solution not be correct, it also cannot be incorrect"
<Intelo>
leftylink, what?
kent\n has joined #ruby
<leftylink>
I want to know whether anyone knows where that saying comes from, I seem to have a hard time finding it... I paraphrased it of course, but hoping the general idea rings a bell for someone...?
<leftylink>
it should be noted that even though `-> x { x == true }` is the identity function for booleans (therefore one might as well write `->x{x}` instead), that statement is only true if we think the function will only ever take booleans. if I desired differing behaviour based on whether the value was specifically `true` versus any other truthy value, then we would have to reconsider.
tdy has quit [Ping timeout: 245 seconds]
fphilipe has quit [Read error: Connection reset by peer]
fphilipe has joined #ruby
<leftylink>
s/would have to reconsider/wouldn't be able to assume `(== true)` is the identity function/
jenrzzz has quit [Ping timeout: 258 seconds]
bmurt has joined #ruby
absolutejam1 has quit [Read error: Connection reset by peer]
AJA4350 has quit [Ping timeout: 258 seconds]
<chalkmonster>
Intelo: how to make what unique? You can specify unique: true, in your migrations. Also specify an index on the same column.
<chalkmonster>
Intelo: also, params[:is_some] should be unset if you've done your form right. `do_something () if params[:is_some]`
<chalkmonster>
is what you're looking for
gell5 has joined #ruby
absolutejam1 has joined #ruby
gell5 has quit [Ping timeout: 245 seconds]
andikr has quit [Remote host closed the connection]
<paddy>
NL3limin4t0r: this is a good link! i am trying a similar one and rvm is doing something
<NL3limin4t0r>
The question might be 7 years old, but have you check if the "zlib1g-dev" or "zlib-devel" package is installed on your system?
<paddy>
there is no "zlib" anything on my fedora 30
jenrzzz has quit [Ping timeout: 245 seconds]
<NL3limin4t0r>
If you haven't already, first update your package list `[sudo] dnf check-update`. Then run `dnf search zlib` and see what comes back.
pep7 has quit [Remote host closed the connection]
voolik has joined #ruby
fphilipe has quit [Read error: Connection reset by peer]
Huck777 has joined #ruby
GodFather has joined #ruby
schne1der has quit [Ping timeout: 246 seconds]
voolik has quit [Quit: Leaving]
hutch has joined #ruby
td123 has quit [Ping timeout: 252 seconds]
poontangmessiah_ has quit [Remote host closed the connection]
jcalla has joined #ruby
crankharder has joined #ruby
<NL3limin4t0r>
paddy: Anything with "zlib" as a result of the above?
jenrzzz has joined #ruby
queip has quit [Ping timeout: 250 seconds]
fphilipe has joined #ruby
schaerli has quit [Ping timeout: 244 seconds]
john2496 has joined #ruby
<paddy>
NL3limin4t0r: no, but the tip to install rvm worked and jekyll is ready now :)
<paddy>
only problem is now that i did the install as root :(
involans has quit [Quit: involans]
queip has joined #ruby
<NL3limin4t0r>
You can remove rvm by running `rvm implode` then reinstall it as normal user.
<paddy>
heh, implode. i feel like that
john2496 has quit [Remote host closed the connection]
banisterfiend has joined #ruby
<NL3limin4t0r>
yeah, I know the feeling
banister_ has joined #ruby
banisterfiend has quit [Read error: Connection reset by peer]
jinie has quit [Ping timeout: 245 seconds]
jinie has joined #ruby
DTZUZO has joined #ruby
jenrzzz has quit [Ping timeout: 244 seconds]
crankharder has quit [Ping timeout: 244 seconds]
absolutejam1 has quit [Ping timeout: 276 seconds]
greengriminal has joined #ruby
schaerli has joined #ruby
fphilipe has quit [Read error: Connection reset by peer]
fphilipe has joined #ruby
<Intelo>
I have 2 arrays having objects in them. array A and B. I want to insert one object of B into A but after every 2 objects of A. e.g A[a,b,c,d,e,f] B[1,2,3,4,5] C[1,a,b,2,c,d,3,e,f,4,5]. How to do it?
<havenwood>
Intelo: B.zip(A).flatten
<Intelo>
what.. whats that!
<havenwood>
Intelo: zip 'n flatten
absolutejam1 has joined #ruby
<Intelo>
really nice
<Intelo>
but how to make interval of 2
<havenwood>
Intelo: ohhh, i didn't see that
<havenwood>
Intelo: each_slice(2)
<Intelo>
also, I am getting B from an api call and its in json. Do I need to do anything?
<havenwood>
Intelo: I did use Python more back in the days I wanted Twistd for WebSockets. There are great WebSockets libraries in Ruby now and I prefer Ruby. I'd most likely use Python these days for something related to math or graphics libraries.
renich has joined #ruby
<Intelo>
havenwood, so the taste and ease and syntax and magic is same for python as for ruby? at least similar?
<havenwood>
Intelo: Ask #python for a solution to the same problem and see which you prefer. :)
brool has joined #ruby
<SeepingN>
python gets mad if you didn't indent your lines properly..
<Intelo>
got ro run. brb havenwood I wanted your percpective as I know you
<havenwood>
SeepingN: havenwood gets mad if you don't indent your Ruby lines properlu.
<Intelo>
will catchup in an hour
Intelo has quit [Remote host closed the connection]
<SeepingN>
well sure I do to, but at least it runs if it's "off"
<havenwood>
hehe
schaerli has quit [Ping timeout: 245 seconds]
chalkmonster has quit [Quit: WeeChat 2.5]
nixy has joined #ruby
<SeepingN>
python seems well suited to command line automation. I have a ruby script that does all sorts of things with an ssh tunneled device, but to make the final interactive shell connection, it calls a small python script
chalkmonster has joined #ruby
sagax has quit [Ping timeout: 245 seconds]
td123 has joined #ruby
jenrzzz has joined #ruby
emptyflask has joined #ruby
gell5 has joined #ruby
fphilipe has quit [Read error: Connection reset by peer]
Brian-W-Gray has quit [Quit: Give a man a phish, you might get his credentials. Teach a man to phish, he'll get someone elses.]
GodFather has quit [Ping timeout: 245 seconds]
vondruch has quit [Quit: vondruch]
openCircuit__ has joined #ruby
haivron has quit [Quit: haivron]
banisterfiend has quit [Read error: Connection reset by peer]
openCircuit__ has quit [Ping timeout: 246 seconds]
jenrzzz has joined #ruby
MrCrackPot has quit [Ping timeout: 264 seconds]
hutch has quit [Ping timeout: 250 seconds]
leitz has joined #ruby
schaerli has joined #ruby
edwardly has quit [Ping timeout: 258 seconds]
schne1der has joined #ruby
involans has quit [Quit: involans]
vondruch has joined #ruby
edwardly has joined #ruby
edwardly has quit [Changing host]
edwardly has joined #ruby
paddy has left #ruby ["Leaving"]
banisterfiend has joined #ruby
vondruch has quit [Remote host closed the connection]
cthulchu_ has joined #ruby
Inline has joined #ruby
wildtrees has joined #ruby
wildtrees has quit [Max SendQ exceeded]
wildtrees has joined #ruby
vondruch has joined #ruby
tsrt^ has quit []
DaRock has quit [Ping timeout: 264 seconds]
banisterfiend has quit [Read error: Connection reset by peer]
bnh^ has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
uranoss has quit [Quit: Connection closed for inactivity]
hutch has joined #ruby
psilly0 has joined #ruby
crankharder has joined #ruby
phaul has quit [Quit: :wq]
skryking has quit [Read error: Connection reset by peer]
ElFerna has joined #ruby
crankharder has quit [Ping timeout: 245 seconds]
phaul has joined #ruby
schaerli has quit [Ping timeout: 245 seconds]
mikecmpbll has quit [Quit: inabit. zz.]
tdy has joined #ruby
banisterfiend has joined #ruby
john2496 has quit [Remote host closed the connection]
ElFerna has quit [Ping timeout: 258 seconds]
gell5 has joined #ruby
jenrzzz has joined #ruby
banisterfiend has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
banisterfiend has joined #ruby
gell5 has quit [Ping timeout: 258 seconds]
rippa has joined #ruby
gheegh has joined #ruby
<gheegh>
so, i have a question guys.. i'm super confused.. I have a system that uses sidekiq. When I launch it.. i get 100% failure rate with a NoMethodError. The error comes from an old version of a gem. When i Rails console and run the same job with the same arguments, it doesn't have a problem (it uses the right version of the gem). Why would sidekiq not be using the same gems as rails?
dretnx has joined #ruby
<dretnx>
join #rubyonrails
<dretnx>
sorry
<phaul>
?crosspost
<ruby[bot]>
Please do not crosspost without at least telling so and mentioning provided suggestions and their outcome in all channels. Experience shows that people don't do either, and not doing so is considered rude.
<phaul>
I would try launching the system with bundle exec
john2496 has joined #ruby
marz_d`ghostman has joined #ruby
<marz_d`ghostman>
How do I setup rvm to use specific ruby version for my project? Do I install it in the same directory?
<gheegh>
sorry.. #ruby is my go to normally.. after i posted, i realized it was probably a rails question
ElFerna has joined #ruby
<gheegh>
phaul i am using bundle exec
<gheegh>
both for rails and for sidekiq
chalkmonster has quit [Ping timeout: 244 seconds]
<gheegh>
it's a really strange thing.. i'm thoroughly confused.. i've spent several hours trying to figure out why my fixes weren't working, and realized it's still using an old version
duderonomy has joined #ruby
ElFerna has quit [Ping timeout: 246 seconds]
TomyWork has quit [Ping timeout: 246 seconds]
NL3limin4t0r is now known as NL3limin4t0r_afk
Exuma has joined #ruby
gix has joined #ruby
gell5 has joined #ruby
rsenic has joined #ruby
crankharder has joined #ruby
<gheegh>
dang Tmux. I had closed some sessions wiht workers in them.. and it didn't kill the process.. that was why.
<rubydoc>
# => [1, 2, "Fizz", 4, "Buzz", "Fizz", 7, 8, "Fizz", "Buzz", 11, "Fizz", 13, 14, "FizzBuzz", 16, 17, "Fizz",... check link for more (https://carc.in/#/r/7huj)
<leftylink>
n insead of nil, doesn't need ||n
<havenwood>
leftylink: Yaass, true :)
<havenwood>
leftylink: But it'll create a bunch of arrays. Hmm.
<havenwood>
leftylink: Yeah, I like it. This FizzBuzz isn't sane so why not. ;P
<leftylink>
as written, I think it is already creating a bunch of arrays anyway, but I guess if you wanted you could lift the array out of the map so that it is not recreated. in that case I suppose you would have to keep nil there
ravenous_ has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
dinfuehr has quit [Ping timeout: 264 seconds]
dinfuehr_ has joined #ruby
<leftylink>
this is unfortunate. I have to call this a heisen-optimisation since every test I can think of to check whether the array gets created multiple times will make it so that the array's creation surely cannot be avoided
kira_rose[m] has joined #ruby
<leftylink>
actually, object_id should be good enough
<havenwood>
leftylink: Recent optimizations have removed some of the need to extract constants. I agree it makes it trickier to optimize, but also means you'll accidentally optimize. :P
<havenwood>
leftylink: Actually not extracting a constant is often faster now.
<havenwood>
I've developed a habit of constant extraction...
Ven`` has joined #ruby
ur5us has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
<rubydoc>
# => [47082718268540, 47082718267700, 47082718267180, 47082718267100, 47082718267020, 47082718266780,... check link for more (https://carc.in/#/r/7hun)
<leftylink>
well crap, maybe I heisen-optimised it again
<leftylink>
I have no idea
<leftylink>
guess there's a lot I don't know
sagax has joined #ruby
<leftylink>
or the shy optimisation
<leftylink>
"I can't optimise when you're looking!!!"
Freshnuts has quit [Remote host closed the connection]
Freshnuts has joined #ruby
jud has joined #ruby
jud has joined #ruby
ramfjord has joined #ruby
<leftylink>
and they could internally still be backed by same memory anyway so this test isn't even indicative
<havenwood>
leftylink: It doesn't work in that case.
<havenwood>
leftylink: It really is creating new Arrays there.
<rubydoc>
# => [47452013424500, 47452013424500, 47452013424500, 47452013424500, 47452013424500, 47452013424500,... check link for more (https://carc.in/#/r/7huq)
<rubydoc>
# => [94897268763921, 94897268761521, 94897268757241, 94897268756201, 94897268755161, 94897268753841,... check link for more (https://carc.in/#/r/7hus)
Esa_ has quit []
<havenwood>
leftylink: So yeah, pay attention to whether a method is optimizing inlining freezes.
<havenwood>
leftylink: Jeremy Evans always seems to know. I've been meaning to study up, but currently extract constants aggresively.
<havenwood>
leftylink: I saw an (I think Roda) commit where Evans removed constants in favor of inlined freezes for speed. :O
<havenwood>
Pretty nifty.
<havenwood>
leftylink: The object_id really does correspond to memory location, so your assumption is correct.
jenrzzz has joined #ruby
alexis-[m] has joined #ruby
<leftylink>
hmmmmm
Ven`` has quit [Read error: Connection reset by peer]
banisterfiend has joined #ruby
Jonopoly has quit [Ping timeout: 258 seconds]
leitz has joined #ruby
banisterfiend has quit [Ping timeout: 268 seconds]
<leitz>
Anyone done a sinatra app with Docker? I did the short demo, and am now working on my own code. Which works, as a gem and run manually. But when I do "docker run" I get: NameError: uninitialized constant FTLTools
<leftylink>
if you do that and inspect the reulting .csv file in the OUTPUTDIR, you will then be able to see what effect the `reverse` has had.
edwardly has joined #ruby
edwardly has quit [Changing host]
edwardly has joined #ruby
<leftylink>
(that is my nice way of saying "I have no way of knowing whether that is where it should go, I leave that determination in the capable hands of the people with knowledge of the problem domain")
<lechner>
leftylink: thanks. i'll try that as long as it seems reasonable. it's my first contact with ruby. a little funky but super concise!
ramfjord has joined #ruby
al2o3-cr has quit [Quit: WeeChat 2.5]
john2496 has quit [Ping timeout: 244 seconds]
zapata_ is now known as zapata
<leitz>
It...LIVES!!!!
ellcs has quit [Ping timeout: 245 seconds]
involans has quit [Quit: involans]
gell5 has joined #ruby
JasonO has quit [Quit: Well......this is rare. Goodbye!]
JasonO has joined #ruby
gell5 has quit [Ping timeout: 245 seconds]
greengriminal has quit [Quit: This computer has gone to sleep]
greengriminal has joined #ruby
Fernando-Basso has joined #ruby
grilix has quit [Ping timeout: 244 seconds]
pep7 has joined #ruby
pep7 has quit [Changing host]
pep7 has joined #ruby
Fernando-Basso has quit [Max SendQ exceeded]
Fernando-Basso has joined #ruby
<psilly0>
how can i put quotes in a system call
<psilly0>
system(jq -r “.parameter.value”)
<psilly0>
system(“jq -r “.parameter.value””)
<psilly0>
how do i escape the quotes around parameter.value?
gell5 has joined #ruby
greengriminal has quit [Quit: This computer has gone to sleep]
<psilly0>
any buddy?
gell5 has quit [Ping timeout: 258 seconds]
<leitz>
psilly0, would it work to use single quotes?
<psilly0>
no doesn’t work
<psilly0>
it does work thanks!
<leitz>
:P
queip has quit [Ping timeout: 258 seconds]
<psilly0>
when i am setting a varable to a system call and outputting the varble i get an quotes and a /n new line in the output
<psilly0>
how can i remove this
<leftylink>
but is that because A) the string contains quotes, \, and n, B) the `inspect` of the string is being printed, or `C) some other reason?
<leftylink>
because the answer obviously depends on which of the above situations is true
<psilly0>
there is no quotes when i run the system call in bash
<leftylink>
whether that be String#chomp, modifying the contents of the string, or not using `inspect`
queip has joined #ruby
<psilly0>
i tried chomp
<psilly0>
didn’t work
<psilly0>
.chomp('"').reverse.chomp('"').reverse
<psilly0>
.rchomp('"').chomp('"')
bruce_lee has quit [Remote host closed the connection]
<leftylink>
then that clearly has told you the string does not contain " on either end of it.
<leftylink>
so, then?
spacesuitdiver has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<leftylink>
what will you do about this fact?
<psilly0>
i have no idea, thats why i am asking you
<psilly0>
:(
mozzarella has joined #ruby
<leftylink>
I have given the suggestions based on the information I have. they remain the same unless more information is given. a reminder to be mindful of the difference between `puts "a\nb"` vs `p "a\nb"`
<leftylink>
stupid idiotic question implies that it is something that everyone should know, but there is no such thing, therefore not a stupid idiotic question
absolutejam1 has quit [Ping timeout: 264 seconds]
<leftylink>
however, there are ways of asking questions that are more conducive or less conducive to getting the right answer quickly. because you saw I was only able to give answers based on what I was told, I could not read minds
<psilly0>
thanks
<leftylink>
so do not fear asking questions for fear that they will be seen as stupid and idiotic, but do help others help you
renich has quit [Remote host closed the connection]
openCircuit__ has joined #ruby
<leftylink>
(like "I tried X Y Z", or uh... I think there's an MCVE quote somewhere??????? Ineed to find it)
mochiyoda has quit [Remote host closed the connection]
openCircuit__ has quit [Ping timeout: 244 seconds]
mochiyoda has joined #ruby
mochiyoda has quit [Client Quit]
<leftylink>
people may have noticed I have a very specific way of answering questions here, it is like a https://i.imgur.com/bf0ZlcD.jpg attitude ("good grief. if you copy the homework, you learn nothing"). so I always try to answer in the way to encourage the other person to learn something
mochiyoda has joined #ruby
edwardly has quit [Ping timeout: 245 seconds]
mozzarel1 has joined #ruby
greengriminal has joined #ruby
mozzarella has quit [Ping timeout: 258 seconds]
mozzarel1 is now known as mozzarella
poontangmessiah has joined #ruby
edwardly has joined #ruby
edwardly has quit [Changing host]
edwardly has joined #ruby
alexis-[m] has left #ruby ["User left"]
leitz has quit [Quit: Leaving]
spacesuitdiver has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
SeepingN has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<psilly0>
i want to make it populate the file with a system call output
<psilly0>
how do i do this
ur5us has quit [Read error: Connection reset by peer]
ur5us has joined #ruby
mikecmpbll has joined #ruby
mikecmpbll has quit [Client Quit]
<leftylink>
well, there's not going to be any magic here, if you wish for the results of the command to be written into a file on disk, it will be necessary to use a `File.open(filename, 'w') { |f| f.puts(something) }`, or a `File.write(filename, something)`, or a `command > filename`
<leftylink>
if you wanted something else, I apologise for misunderstanding.
<leftylink>
it is probably for the best that there is no magic -- wouldn't want files being written to disk without an explicit desire to do so
<psilly0>
let me try this
<leftylink>
also note (and this has nothing to do with writing a file to disk, but I will mention it anyway) that assigning to `c`, a variable local to the block, cannot possibly affect anything outisde the block. one is of course able to call methods on `c` as usual, but reassigning it just replaces the value of the local variable
<leftylink>
just like how reassigning a local variable in a function doesn't change any bindings outside of the function either
<leftylink>
&>> def f(a); a = 77777777 end; b = 99999; f(b); p b # did NOT change to 77777777
<ramfjord>
but if you want to be really lazy I recommend using docker + the fat ruby images which are based on buildpack-deps, and you won't have to debug which system libraries you're missing when you try to install a random gem