karapetyan has quit [Remote host closed the connection]
karapetyan has joined #ruby
cschneid_ has quit [Remote host closed the connection]
<knutmithut>
hello, how can I tell gem install to skip a lib build and installed with make? there is a problem with unf_ext on armv7h which is fixed in the git, but not in upstream. so I have built it myself
CloCkWeRX has quit [Ping timeout: 240 seconds]
karapety_ has joined #ruby
<zenspider>
knutmithut: skip a pre-built binary gem?
karapetyan has quit [Ping timeout: 276 seconds]
<knutmithut>
I'm not sure.. neither I'm much into ruby nor gem. But I've just seen that I've built against ruby 2.4, while 2.3 is required.. What I'm actually trying is installing diaspora-mysql from AUR on ArchLinux ARM
<zenspider>
I think you want gem install --platform ruby
xen0fon has joined #ruby
<knutmithut>
And it fails during 'gem install unf_ext' which again is listed in the bundle
<knutmithut>
Or is there a way to manually install gems from git?
chouhoulis has quit [Remote host closed the connection]
<zenspider>
...first time you mentioned bundler...
chouhoulis has joined #ruby
DLSteve has quit [Quit: All rise, the honorable DLSteve has left the channel.]
sepp2k has quit [Quit: Leaving.]
<knutmithut>
well I'm sorry, I have no access to the bundle file itself, as I try installing directly with yaourt from AUR
connor_goodwolf has quit [Ping timeout: 258 seconds]
tvw has quit [Read error: Connection reset by peer]
<knutmithut>
So I thought there must be a way to install the gem beforehand, so when bundle runs it is already present
alveric2 has joined #ruby
jhack has quit [Quit: jhack]
alveric1 has quit [Ping timeout: 264 seconds]
ramortegui has quit [Quit: Ex-Chat]
xen0fon has quit [Quit: xen0fon]
CloCkWeRX has joined #ruby
Azure|dc has quit [Quit: Oops.]
Azure has joined #ruby
blaxter has joined #ruby
saneax-_-|AFK is now known as saneax
tolerablyjake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tolerablyjake has joined #ruby
karapety_ has quit [Remote host closed the connection]
tolerablyjake has quit [Client Quit]
cschneid_ has joined #ruby
connor_goodwolf has joined #ruby
matp has quit [Remote host closed the connection]
matp has joined #ruby
cschneid_ has quit [Ping timeout: 255 seconds]
<zenspider>
I have no idea what the words you are using are... so I probably can't help. I'd suggest filing a bug with the projects involved
pandbearit has joined #ruby
pandabearit_ has joined #ruby
Bob8989 has joined #ruby
Derperperd has quit [Ping timeout: 255 seconds]
jhack has joined #ruby
minimalism has quit [Quit: minimalism]
Derperperd has joined #ruby
harai has quit [Ping timeout: 264 seconds]
al2o3-cr has quit [Ping timeout: 240 seconds]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
JeanCarloMachado has quit [Ping timeout: 240 seconds]
mybigsweatyballs has joined #ruby
JeanCarloMachado has joined #ruby
A124 has quit [Ping timeout: 240 seconds]
benlieb has quit [Quit: benlieb]
A124 has joined #ruby
hahuang65 has quit [Ping timeout: 264 seconds]
<knutmithut>
I hope I finally got it. In the git gem folder I could run "gem-2.3 build unf_ext.gemspec", "gem-2.3 install unf_ext-0.0.7.2.gem".
AndrewIsHere has quit []
jgnagy has joined #ruby
ur5us has quit [Remote host closed the connection]
marr has quit [Ping timeout: 264 seconds]
blaxter has quit [Quit: foo]
jgnagy has quit [Ping timeout: 240 seconds]
teclator has quit [Remote host closed the connection]
markholmes has quit [Remote host closed the connection]
mhenrixon has quit [Ping timeout: 276 seconds]
GodFather has quit [Read error: Connection reset by peer]
bpmedley has quit [Ping timeout: 240 seconds]
mikeiniowa has quit [Ping timeout: 240 seconds]
ejnahc_ has quit [Ping timeout: 240 seconds]
hahuang65 has joined #ruby
toretore has quit [Ping timeout: 255 seconds]
pandabearit_ has quit [Ping timeout: 258 seconds]
tdump has joined #ruby
ejnahc has joined #ruby
pandbearit has quit [Ping timeout: 255 seconds]
pandbearit has joined #ruby
pandabearit_ has joined #ruby
howdoi has quit [Quit: Connection closed for inactivity]
gloscombe_ has quit [Quit: gloscombe_]
bigtawm has quit []
Channel6 has joined #ruby
tdump_ has joined #ruby
marxarelli is now known as marxarelli|afk
pandabearit_ has quit [Ping timeout: 256 seconds]
pandabearit_ has joined #ruby
<knutmithut>
Nope, it still tries to install unf_ext even though 'gem-2.3 which unf_ext' returns the correct path
JeanCarloMachado has quit [Ping timeout: 240 seconds]
martencassel has joined #ruby
<kke>
hmm where do i put something like "Starting server version #{Server::VERSION}" in my rack app with config.ru so it just comes up once instead of for every worker
jeyraof has quit [Quit: This computer has gone to sleep]
montanonic has quit [Ping timeout: 255 seconds]
martencassel has joined #ruby
jeyraof has joined #ruby
<nofxxx>
This error: "Errno::ENOENT: No such file or directory @ fptr_finalize - /sys/devices/platform/bone_capemgr/slots" is happening on #close, and not on #open... it's 'w' operationa actually. Maybe some watcher is reloading this file after ruby writes to it?
JeanCarloMachado has quit [Ping timeout: 255 seconds]
JeanCarloMachado has joined #ruby
teclator has joined #ruby
Chagel has quit [Ping timeout: 264 seconds]
simmib has quit [Ping timeout: 276 seconds]
simmib has joined #ruby
<nofxxx>
hm, forget about it, error is somewhere else but failing on that write, strange
futilegames has joined #ruby
csk157 has joined #ruby
CloCkWeRX has quit [Quit: Leaving.]
Chagel has joined #ruby
nadir has quit [Quit: Connection closed for inactivity]
LoneHerm_ has joined #ruby
Dimik has joined #ruby
aganov has joined #ruby
mlkkk has joined #ruby
SesMan has joined #ruby
tildes has joined #ruby
TomyWork has joined #ruby
saneax-_-|AFK is now known as saneax
DaveTaboola has quit [Ping timeout: 255 seconds]
jcao219 has quit [Ping timeout: 276 seconds]
JeanCarloMachado has quit [Ping timeout: 256 seconds]
jaruga______ has joined #ruby
jaruga______ is now known as jaruga_______
futilegames_ has joined #ruby
xen0fon has joined #ruby
lxsameer has joined #ruby
mlkkk has quit [Remote host closed the connection]
futilegames has quit [Ping timeout: 260 seconds]
futilegames_ is now known as futilegames
Chagel has quit [Ping timeout: 245 seconds]
troulouliou_div2 has joined #ruby
TomyWork has quit [Remote host closed the connection]
mark_66 has joined #ruby
tildes has quit [Ping timeout: 240 seconds]
Silthias has joined #ruby
enterprisey has quit [Read error: Connection reset by peer]
Chagel has joined #ruby
teclator has quit [Read error: Connection reset by peer]
Silthias1 has joined #ruby
Silthias2 has quit [Ping timeout: 255 seconds]
Silthias has quit [Ping timeout: 240 seconds]
grh has joined #ruby
tildes has joined #ruby
msmith has joined #ruby
jeyraof has quit [Quit: This computer has gone to sleep]
futilegames has quit [Quit: futilegames]
paradisaeidae has joined #ruby
paradisaeidae_ has joined #ruby
aupadhye has joined #ruby
postmodern has quit [Quit: Leaving]
patarr has joined #ruby
anisha has joined #ruby
teclator has joined #ruby
gevans has joined #ruby
patarr has quit [Ping timeout: 240 seconds]
cgfbee has joined #ruby
jeyraof has joined #ruby
gevans has quit [Ping timeout: 255 seconds]
Derperperd has joined #ruby
jcao219 has joined #ruby
alveric2 has quit [Quit: WeeChat 1.7]
mlkkk has joined #ruby
Derperperd has quit [Ping timeout: 245 seconds]
TheHodge has joined #ruby
JoshS has quit [Ping timeout: 256 seconds]
marr has joined #ruby
mikecmpbll has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
brent__ has joined #ruby
davezd has quit [Quit: Leaving]
msmith has quit [Ping timeout: 252 seconds]
Shashikant86 has joined #ruby
toretore has joined #ruby
shortCircuit__ has joined #ruby
<shortCircuit__>
hi
brent__ has quit [Ping timeout: 240 seconds]
kshitij has quit [Quit: Connection closed for inactivity]
JeanCarloMachado has joined #ruby
maloik has quit [Remote host closed the connection]
maloik has joined #ruby
<shortCircuit__>
how do I make the logic for a weighted scheduler.. like if I have a hash say { provider1: 2, provider2: 5, provider3: 3 } then suppose I call a method.. b = LoadBalancer.new(providers) 20.times { b.get_provider }. it would return provide1 provider1, provider3 3 times and the provider5 5times and back to provider1
<shortCircuit__>
the thing is the number of providers can be like any number
<scootaloo>
I'm looking for tools/process to analyse ruby memory usage, do you have any leads?
martencassel has joined #ruby
LoneHermit has quit [Ping timeout: 240 seconds]
<toretore>
shortCircuit__: if you're not going to be handling lots of providers, you can just flatten them like `@providers = providers.reduce([]){|a,(p,c)| a + ([p] * c) }`
<toretore>
then you just need to keep count of the current index
martencassel has left #ruby [#ruby]
paradisaeidae has quit [Ping timeout: 240 seconds]
<toretore>
but shouldn't a load balancer ideally, you know, balance the load and not return the same provider until it's "empty"?
paradisaeidae_ has quit [Ping timeout: 260 seconds]
jcao219 has quit [Ping timeout: 252 seconds]
<shortCircuit__>
I didn't get the last bit
<shortCircuit__>
oh
<toretore>
in your example you get [p1, p1, p1, p2, p2, p2], shouldn't it be [p1, p2, p1, p2, p1, p2]?
<shortCircuit__>
I am doing a weighted one .. a simple load balancer would have been easier
JoshS has joined #ruby
<toretore>
a weighted lb still balances the load
<shortCircuit__>
I mean I have like 2 to 4 services, and the I want to assign some weight and let the load balancer decide which service to use .. so that u know if one service performs bad then I decrease the weight.
<shortCircuit__>
my only experience with load balancer has been like (count + 1) % total .. so yeah I can be wrong about the way I am doing it :P
<toretore>
a load balancer of {p1: 2, p2: 4} should ideally give you [p2, p2, p1, p2, p2, p1]
Dimik has quit [Ping timeout: 252 seconds]
<toretore>
or [p1, p2, p2, p1, p2, p2]
<shortCircuit__>
ok.. but what is the algorithm like..
<toretore>
no idea, i've just had my morning coffee and my brain isn't ready to think yet
<shortCircuit__>
:D
<shortCircuit__>
ok
jeyraof has quit [Quit: This computer has gone to sleep]
<toretore>
an easy but inefficient implementation would be `loop{ ps=providers.inject([]){|a,(p,w)| a + [[p]*w] }; until ps.empty?; ps.each{|a| yield a.pop }; end }`
knutmithut has quit [Ping timeout: 245 seconds]
biberu has joined #ruby
<toretore>
`loop{ ps=providers.inject([]){|a,(p,w)| a + [[p]*w] }; until ps.empty?; ps.each{|a| yield a.pop }; ps.reject!(&:empty?); end }`
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Shashikant86 has joined #ruby
LoneHerm_ has quit [Ping timeout: 240 seconds]
cschneid_ has joined #ruby
brent__ has joined #ruby
<ljarvis>
it is
kith has joined #ruby
cschneid_ has quit [Ping timeout: 255 seconds]
brent__ has quit [Ping timeout: 260 seconds]
dviola has joined #ruby
CloCkWeRX has quit [Quit: Leaving.]
pragmaticus has joined #ruby
dionysus69 has joined #ruby
xen0fon has quit [Remote host closed the connection]
<atmosx>
Hello, I'm trying to work with a SOAP server using savon: http://savonrb.com/version2/client.html .. I have a local wsdl file (with namespace definitions) and endpoint is at 127.0.0.1:8080 ... I can't seem to understand how to pass these options together.
xen0fon has joined #ruby
jameser has joined #ruby
<atmosx>
nevermind I got it :-P
scootaloo has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
anisha_ has quit [Quit: Leaving]
Guest98046 has quit [Changing host]
Guest98046 has joined #ruby
Guest98046 has joined #ruby
Guest98046 is now known as pskosinski
mlkkk has quit [Remote host closed the connection]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
msmith has quit [Ping timeout: 240 seconds]
jameser has joined #ruby
<marahin>
Is there any Ruby library that allows making a screenshot of a webpage that does __NOT__ use phantom.js?
lxsameer has quit [Read error: Connection reset by peer]
lxsameer has joined #ruby
patarr has joined #ruby
saneax is now known as saneax-_-|AFK
biberu has quit []
biberu has joined #ruby
<apeiros>
marahin: selenium, capybara with non-phantomjs based drivers
<marahin>
apeiros thank you!
<apeiros>
(e.g. headless webkit)
patarr has quit [Ping timeout: 245 seconds]
matp has joined #ruby
paradisaeidae has quit [Quit: ChatZilla 0.9.93 [Firefox 51.0.1/20170125094131]]
paradisaeidae_ has quit [Quit: ChatZilla 0.9.93 [Firefox 51.0.1/20170125094131]]
xen0fon1 has joined #ruby
xen0fon has quit [Ping timeout: 258 seconds]
xen0fon1 is now known as xen0fon
saneax-_-|AFK is now known as saneax
sepp2k has joined #ruby
scootaloo has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
c355e3b has joined #ruby
johnzorn has quit [Read error: Connection reset by peer]
johnzorn has joined #ruby
govg has quit [Ping timeout: 255 seconds]
johnzorn has quit [Read error: Connection reset by peer]
saneax is now known as saneax-_-|AFK
johnzorn has joined #ruby
radic has quit [Ping timeout: 240 seconds]
jaruga_______ has quit [Remote host closed the connection]
gevans has joined #ruby
saneax-_-|AFK is now known as saneax
jameser has joined #ruby
radic has joined #ruby
shadeslayer has quit [Ping timeout: 264 seconds]
gevans has quit [Ping timeout: 255 seconds]
shadeslayer has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
csk157 has quit [Ping timeout: 258 seconds]
jenrzzz has quit [Ping timeout: 260 seconds]
nettoweb1 has joined #ruby
nettoweb has quit [Ping timeout: 240 seconds]
blaxter has quit [Quit: foo]
jgnagy has joined #ruby
Shashikant86 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Abhijit has joined #ruby
<Abhijit>
hi
k13nox has joined #ruby
<Abhijit>
is there any standalone / inbuilt dictionary gem I can use ?
astrobunny has joined #ruby
lxsameer has quit [Quit: WeeChat 1.6]
astrobunny has quit [Remote host closed the connection]
Shashikant86 has joined #ruby
astrobunny has joined #ruby
kobain has joined #ruby
Shashikant86 has quit [Client Quit]
c355e3b has quit []
Derperperd has joined #ruby
nadir has joined #ruby
xen0fon has quit [Quit: xen0fon]
tyang has joined #ruby
UnknownSoldier has joined #ruby
Derperperd has quit [Ping timeout: 252 seconds]
millerti has joined #ruby
tyang_ has joined #ruby
chouhoulis has joined #ruby
synthroid has joined #ruby
tyang has quit [Ping timeout: 255 seconds]
simmib_ has quit [Remote host closed the connection]
simmib has joined #ruby
mlkkk has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
synthroi_ has joined #ruby
jameser has joined #ruby
simmib has quit [Ping timeout: 260 seconds]
nowhereman has joined #ruby
synthroid has quit [Ping timeout: 240 seconds]
jameser has quit [Client Quit]
jameser has joined #ruby
danguita has joined #ruby
chouhoulis has quit [Remote host closed the connection]
chouhoulis has joined #ruby
<newrubycoder>
is it possible to use functions within .map?
nettoweb1 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<newrubycoder>
wow thanks :D thought you had to use maths
plantfood has joined #ruby
<herwin>
or shorter: ["one", "two"].map(&:reverse)
t-recx has joined #ruby
brent__ has quit [Ping timeout: 256 seconds]
synthroid has joined #ruby
malconis has joined #ruby
malconis_ has joined #ruby
synthroi_ has quit [Ping timeout: 256 seconds]
kobain has quit [Ping timeout: 252 seconds]
malconis has quit [Ping timeout: 255 seconds]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
<dminuoso>
>> %w{bar quux}.inject(<<-FOO) { |m, o| m += o } foo FOO
<ruby[bot]>
dminuoso: # => /tmp/execpad-8eab57ba690c/source-8eab57ba690c:7: can't find string "FOO" anywhere before EOF ...check link for more (https://eval.in/734738)
<dminuoso>
y u no work.
squ has quit [Remote host closed the connection]
<dminuoso>
Im trying to do a naughty, but Ruby wont let me.
<_mak>
also, I don't get why I don't get what's going on with this object :D
__Yiota has joined #ruby
<toretore>
it's not a hash
<toretore>
it's a Google::Cloud::Datastore::Entity
<_mak>
yeah
<_mak>
which is not a 'normal' ruby object I guess
<_mak>
that's why the to_json is not working I guess
fabio has joined #ruby
<havenwood>
_mak: Check the docs for a solution.
fabio is now known as Guest84501
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<havenwood>
_mak: How do you turn an instance of a #<Google::Cloud::Datastore::Entity:...> into a Hash?
<toretore>
also, define what "turn into a hash" actually means
<_mak>
there's a hash in there
<_mak>
I just don't know how to get there
<havenwood>
"The properties can be converted to a hash: prop_hash = task.properties.to_h"
<_mak>
oh, with 'dot'!
skweek has joined #ruby
vondruch_ is now known as vondruch
Abhijit has quit [Ping timeout: 240 seconds]
DLSteve has joined #ruby
<_mak>
havenwood: thanks mate, in my stupidity I've tried to bruteforce it with stuff like obj[:properties], obj['properties']
jtperreault has quit [Quit: WeeChat 0.4.2]
OTORelic has joined #ruby
<newrubycoder>
is it possible to get several true or false outputs?
<toretore>
elaborate
<Guest84501>
you can return an hash {output1: true, output2: false, .. } and use result[:output1]
saneax is now known as saneax-_-|AFK
<newrubycoder>
toretore: well i got several arrays within an array, and i need to check each of them true or false to decide if they should be .rotated or .reversed
<herwin>
"each of them true or false" ??
<al2o3-cr>
newrubycoder: need more context then that
<toretore>
?code newrubycoder
<ruby[bot]>
newrubycoder: We can't help you without your code, please post it to https://gist.github.com
BTRE has quit [Ping timeout: 245 seconds]
<toretore>
newrubycoder: from now on, each time you ask a question, you should also provide code in the form of a gist. it's a lot easier to understand what you're asking by looking at the code
astrobunny has quit [Remote host closed the connection]
<toretore>
newrubycoder: try to use meaningful names, not short ones
BTRE has joined #ruby
gnufied has quit [Ping timeout: 255 seconds]
grh has quit [Remote host closed the connection]
terens has quit [Remote host closed the connection]
<newrubycoder>
basically i need to test bye.even? for every chunk, and rotate or reverse each chunk based on the individual output
braincrash has quit [Ping timeout: 240 seconds]
<toretore>
first, describe what `devrot` is supposed to do
bybb_ has left #ruby [#ruby]
<newrubycoder>
The input is a string str of digits. Cut the string into chunks of size sz (ignore the last chunk if its size is less than sz). If a chunk represents an integer such as the sum of the cubes of its digits is divisible by 2, reverse it; otherwise rotate it to the left by one position. Put together these modified chunks and return the result as a stri
<newrubycoder>
ng.
<toretore>
you have to get past the "fewer lines is better" mentality, it's part of what makes your code difficult to understand
<toretore>
that's a code smell, and it's harder to read
<dminuoso>
That is harder to read, than long crazy nested blocks?
<toretore>
and in this case counter-productive because the emphasis is on beginner friendly
<dminuoso>
Easy to read code is beginner friendly.
<dminuoso>
If you can look at it, and immediately understand what it does -> its beginner/maintenance friendly.
<elomatreb>
Why have the return inside a block and not use the modifier if?
<dminuoso>
elomatreb: Personal style, I avoid modifier_if/modifier_unless like the best
<toretore>
stop the bike shedding please
<newrubycoder>
yeah i understand i think, you made it integers i think
<dminuoso>
because the order of code does not follow execution flow
<dminuoso>
*like the pest
<dminuoso>
:P
<toretore>
newrubycoder: not that i forgot to change the last two `hey`s to `digit_groups`
<toretore>
*note
<toretore>
newrubycoder: `digit_groups` when you have str="123456" and size=2 is [[1,2], [3,4], [5,6]]
vondruch_ has joined #ruby
<toretore>
before, it would be ["12", "34", "56"]
<elomatreb>
dminuoso: I agree on the execution flow problem, but having the actual return keyword come first in a line makes it clear (for me) that I'm dealing with some early-return condition
* elomatreb
likes his bikes in a blue shed please
Derperperd has joined #ruby
<toretore>
"early return" is not a thing, it's just a different way of writing if-else
<toretore>
and, like goto, an abomination
<elomatreb>
I don't agree, it gets handling the simple cases out of the way first (usually), makes it clearer the rest of your method does something more complex
<newrubycoder>
yeah now i get numbers without quotes
<newrubycoder>
is that better?
dionysus69 has joined #ruby
<toretore>
no, you misread
Guest43 has quit [Ping timeout: 240 seconds]
<toretore>
read what i wrote again
<toretore>
do you understand the difference between "12" and [1,2]?
ChiefAlexander has joined #ruby
vondruch has quit [Ping timeout: 256 seconds]
<newrubycoder>
yes but 2 sec
mikeXsh has joined #ruby
<toretore>
newrubycoder: it's important that you know the exact shape of your data as it goes through and is transformed by your code
<toretore>
newrubycoder: you should open up an irb session and play around with stuff to get a feel for it
<newrubycoder>
but didnt my original code do this: [["7", "3", "3", "0", "4"]
<toretore>
>> "1" + "2"
<toretore>
no, it would have been [["7", "3"], ["3", "0"], ["4"]]
<newrubycoder>
yeah if sz was 2 and i would discard last array
bmurt has joined #ruby
<newrubycoder>
is it better to get [7, 3] than ["7", "3"]
<toretore>
in this case, yes, because you are using them as numbers, not strings
chouhoul_ has joined #ruby
<toretore>
ok, so on line #10, you have a `digit groups` of [[7,3], [3,0]] after removing the [4]
<toretore>
what is your next step?
chouhoulis has quit [Ping timeout: 255 seconds]
nettoweb has joined #ruby
vondruch_ has quit [Quit: vondruch_]
jz has joined #ruby
jz is now known as Guest23394
<newrubycoder>
i take the sum of the squares of the arrays and check if they're divisible by 2, so 7 squared would be 2 and 3 would be 1, the sum would be 3, which is not divisible by 2 so it will .rotate, the same for the other array, but let's say it is divisible by 2, so i get 2 values right but i dont know how to fetch 2 values and react to them
mlkkk has quit []
<newrubycoder>
first one would be false, second one true, i need some way to connect the first output to the first array and second to the second array
johnzorn has quit [Ping timeout: 264 seconds]
vondruch_ has joined #ruby
Exuma has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
<toretore>
you write "7 squared", but that's 49. do you mean floor(sqrt(n)) ?
patarr has joined #ruby
<newrubycoder>
oh i mean square rooted
<newrubycoder>
or cubed
jcao219 has joined #ruby
<newrubycoder>
wow maybe i misunderstood the maths
<newrubycoder>
but i can change the maths logic easily
charliesome has joined #ruby
<newrubycoder>
i still need a way to connect several outputs with several arrays
jenrzzz has quit [Ping timeout: 255 seconds]
antoniobeyah has joined #ruby
<toretore>
ok, so you perform some operation on each digit group, doesn't matter which
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
simmib has joined #ruby
<toretore>
you have 2 cases: case 1 and case 2; what happens in each?
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<newrubycoder>
case 1 false, i rotate, case 2 true, i reverse
patarr has quit [Ping timeout: 264 seconds]
patarr has joined #ruby
charliesome has quit [Ping timeout: 245 seconds]
<toretore>
if result % 2 == 0; case1; else; case2; end
<toretore>
one results in [2,3,1] and the other [1,2,3]. why?
Rodya_ has quit [Remote host closed the connection]
<newrubycoder>
not sure to be honest, the first one isn't a real array?
Rodya_ has joined #ruby
<toretore>
` a=[1,2,3]; a.rotate; a` is a series of 3 expressions. the value of the last expression is returned, and that's what you're seeing ruby[bot] print out
<toretore>
that is, the value of `a`
<toretore>
`a` is the same as when it was defined in expression 1, despite expression 2 being `a.rotate`. why?
<toretore>
and the result of the expression `a.rotate` is `[2,3,1]`
conta has quit [Ping timeout: 245 seconds]
<newrubycoder>
thinking hard but i dont know
<phreakocious>
you might say he's banging away at the problem ;)
<newrubycoder>
if the array in question returns false based on the mathematical comparisons, i want to call rotate, else reverse
<toretore>
what is "the array" here?
ChiefAlexander has quit [Quit: Leaving...]
<toretore>
you have `[[7,3], [3,0]]` - 3 arrays in all
roger_rabbit has quit [Changing host]
roger_rabbit has joined #ruby
devon21 has quit [Quit: devon21]
<newrubycoder>
never the superarray, but the metaarrays kinda, i want both of them to be compared, maybe not at the same time, but in one operation sort of
hobodave has joined #ruby
<toretore>
what does that mean, not at the same time, but in one operation?
<toretore>
are you talking about taking each of them in turn, then running the as-of-yet-undefined mathematical operation on it and then reversing or mutating?
flyingX has quit []
synthroid has joined #ruby
<newrubycoder>
like first it compares true or false on the first meta array, then puts the output into a buffer, then does the same on the second meta array, then releases the buffer
tuelz has joined #ruby
dc4 has quit [Ping timeout: 258 seconds]
<tuelz>
is there a 'shortcut' to using keywords args in a class init to set ivars?
<toretore>
no
<tuelz>
what's the cleanest way to setup ivars on init? just @ivar = ivar_from_arg
<tuelz>
gotcha, I don't think I have enough init vars to justify something clever yet
<tuelz>
thanks though
<toretore>
another option is to store the args as @args and have getters and/or setters operate directly on it
<toretore>
def foo; @options[:foo]; end
simmib has quit [Remote host closed the connection]
simmib_ has joined #ruby
jcao219 has joined #ruby
ldnunes has quit [Read error: Connection reset by peer]
amagawdd has joined #ruby
brent__ has joined #ruby
ldnunes has joined #ruby
<toretore>
newrubycoder: so say you have `[[1,2], [3,5]]` and the operation is simply "if n1 + n2 is even then rotate else reverse"; how would you go about it?
<toretore>
what should the result be?
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
<toretore>
actually that was a stupid example as rotate and reverse are the same :P
aufi has quit [Remote host closed the connection]
<toretore>
let's use `[[1,2,3], [4,5,6]]`
simmib_ has quit [Ping timeout: 240 seconds]
hilaire has joined #ruby
duderonomy has quit [Ping timeout: 256 seconds]
brent__ has quit [Ping timeout: 240 seconds]
destructure has quit [Changing host]
destructure has joined #ruby
<newrubycoder>
result should be [[2,3,1][6,5,4]], but as of now im only able to do one operation on both arrays based on the comparison of one array
despai has joined #ruby
hotpancakes has joined #ruby
hotpancakes has quit [Client Quit]
jenrzzz has quit [Ping timeout: 264 seconds]
hilaire has left #ruby [#ruby]
<newrubycoder>
so my results would be to rotate both because the first array is even
dionysus69 has quit [Remote host closed the connection]
JoshS has quit [Ping timeout: 256 seconds]
al2o3-cr_ has joined #ruby
<toretore>
so you need to operate on each array independently
Rodya_ has quit [Remote host closed the connection]
aaa has quit [Ping timeout: 255 seconds]
Rodya_ has joined #ruby
<toretore>
you need to loop through the outer array, then for each inner array, perform the operation
username_ has joined #ruby
username1 has joined #ruby
<toretore>
>> [[1,2,3], [4,5,6]].map{|a| a.sum }
<ruby[bot]>
toretore: # => undefined method `sum' for [1, 2, 3]:Array (NoMethodError) ...check link for more (https://eval.in/734859)
<toretore>
huh
al2o3-cr has quit [Ping timeout: 258 seconds]
mtkd has quit [Ping timeout: 258 seconds]
mtkd has joined #ruby
<jgnagy>
what are you trying to do with those arrays?
* apeiros
ponders giving baweaver his interview question from hell…
<baweaver>
oh?
<apeiros>
though I think I don't even have it on my private computers :-|
<baweaver>
realize I may not answer as I have a meeting soon
millerti has joined #ruby
<baweaver>
well, technically now, but someone borked a cluster that I'm unborking
<apeiros>
heh, right, different TZ
* apeiros
is in the WEEEEKEEEEEND, WEEEEE!
* apeiros
friday-hugs the channel
babblebre has joined #ruby
* baweaver
grumbles at apeiros
<apeiros>
keep grumbling when I'm up at ~0600 on monday and you're still merrily sleeping in bed…
<baweaver>
Ah Karma
lenwood has joined #ruby
TheSass has left #ruby ["Later, gents and electronbabies."]
JoshS has joined #ruby
TomyWork has quit [Remote host closed the connection]
* baweaver
kinda wants apeiros's special question now
<apeiros>
I'll see whether I have it on my private laptop. it's basically a "this is bad code. tell me all the things which are bad about it and how to do better"
<apeiros>
I never used it because I think it's not a productive question in a live interview
<apeiros>
it was fun coming up with it, though :)
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
bocaneri has quit [Remote host closed the connection]
<newrubycoder>
can't get the code to work, it does some weird stuff i think
<baweaver>
oh?
jcao219 has quit [Ping timeout: 240 seconds]
<newrubycoder>
it will only rotate, not reverse
vuoto has joined #ruby
<newrubycoder>
i need to check the numbers
gevans has joined #ruby
lenwood has quit [Ping timeout: 240 seconds]
Dimik has joined #ruby
maddmaxx has joined #ruby
t-recx has quit [Read error: No route to host]
chouhoulis has joined #ruby
lmc has joined #ruby
t-recx has joined #ruby
negatifze has joined #ruby
Macaveli has joined #ruby
Macaveli has quit [Max SendQ exceeded]
negatifze has quit [Client Quit]
workmad3 has quit [Ping timeout: 255 seconds]
OTORelic has quit [Ping timeout: 240 seconds]
Macaveli has joined #ruby
Macaveli has quit [Max SendQ exceeded]
ibrahim has joined #ruby
Macaveli has joined #ruby
aryaching has joined #ruby
Macaveli has quit [Client Quit]
<newrubycoder>
when i tell the code to puts "rotate" else puts "reverse", the logic is correct, but when i tell it to .map(&:rotate) and .map(&:reverse) then .join, it will only do the first operation for all the arrays
Macaveli has joined #ruby
Macaveli has quit [Client Quit]
enterprisey has joined #ruby
guacamole has quit [Quit: leaving]
cpruitt has joined #ruby
<toretore>
newrubycoder: remember what i said about gisting your code?
<marchelzo>
wow github changed the look of the gist page o.o
Elderfain has joined #ruby
<elomatreb>
marchelzo: D: All of github it seems
<marchelzo>
oh wow
<newrubycoder>
i've tried many variations of that code with ! and doing the return etc. on a new line, just think it's weird that the logic works with puts
<marchelzo>
newrubycoder: if str.length.to_f / size % 1 != 0
<marchelzo>
if digit_groups.last.length != size
<Papierkorb>
elomatreb: Looks like enterprise github. Wondering if it's a mistake on their end :)
Fernando-Basso has quit [Quit: WeeChat 1.7]
<elomatreb>
Really? That would be funny
<Papierkorb>
elomatreb: iirc enterprise github had a black navbar, yes
ramortegui has quit [Quit: Ex-Chat]
ych has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<newrubycoder>
not really tbh, i guess it does x for each thing in the array
<toretore>
yes
renchan_ has joined #ruby
renchan has quit [Ping timeout: 240 seconds]
Synthead has joined #ruby
<newrubycoder>
hmm each doesn't seem to differ from .map in this case, i still get the bug
dviola has quit [Quit: WeeChat 1.7]
renchan_ has quit [Remote host closed the connection]
msmith has quit [Remote host closed the connection]
<toretore>
newrubycoder: stop using `return` in your code
<toretore>
it only serves to confuse you at this point
<Elderfain>
each and map do differ in how they work
vuoto has quit [Remote host closed the connection]
<Elderfain>
each returns the same array it started with, map returns the array created by the return of each iteration
<DarkBushido>
newrubycoder: how are you combining reverse and rotate?
<toretore>
newrubycoder: you have an array `digit_groups`, you have a transformation that you want to run on each item in the group, and then you want to collect each result of that transformation
<toretore>
newrubycoder: how would you go about this?
<toretore>
the transformation is what happens inside the block; it transforms e.g. [1,2,3] to [3,2,1]
jenrzzz_ has quit [Ping timeout: 264 seconds]
renchan has joined #ruby
<patarr>
Is there a way to run a activerecord query like Thing.sub_things when you have a Thing ID? But I don't want to do Thing.find(1).sub_things. That will needlessly fire off two queries
<toretore>
show some real code patarr
<toretore>
and explain in more detail and why
<toretore>
oh you're actually talking about ar, that should go in #rubyonrails
<newrubycoder>
toretore: i guess you can collect it if it mutates, but i kinda tried it
<toretore>
(the answer is `SubThing.where(id: thing_id)`)
ldnunes has quit [Quit: Leaving]
<toretore>
newrubycoder: how would that work?
amagawdd has quit [Quit: Leaving...]
JeanCarloMachado has quit [Ping timeout: 276 seconds]
babblebre has quit [Quit: Connection closed for inactivity]
swills_ has joined #ruby
<newrubycoder>
like if it mutates it's changed permamently right? so you can collect it
<newrubycoder>
or maybe i can collect it in a variable
swills has quit [Read error: Connection reset by peer]
chouhoulis has quit [Remote host closed the connection]
ibrahim has quit [Quit: Leaving]
chouhoulis has joined #ruby
teoric has joined #ruby
karapetyan has joined #ruby
Cohedrin has joined #ruby
teoric has quit [Remote host closed the connection]
karapetyan has quit [Remote host closed the connection]
Rodya_ has joined #ruby
Xentil has quit [Ping timeout: 240 seconds]
karapetyan has joined #ruby
Macaveli has joined #ruby
Rodya_ has quit [Remote host closed the connection]
teoric has joined #ruby
yqt has joined #ruby
Flaghacker has joined #ruby
teoric has quit [Client Quit]
<Flaghacker>
Hey guys, I know next to nothing about ruby but I need gem to install a problem I want to use. Do I need to install ruby before installing gem? The download page (https://rubygems.org/pages/download) s not that helpful. I'm running Windows 10.
<Flaghacker>
*I need it to install a program I want to use
Macaveli has quit [Client Quit]
bmurt has joined #ruby
teoric has joined #ruby
simmib_ has joined #ruby
lmc has joined #ruby
teoric has quit [Remote host closed the connection]
<centrx>
Flaghacker: Yes, install Ruby first
<Flaghacker>
centrx, Okay, thanks!
username_ has joined #ruby
username1 has joined #ruby
benlieb has joined #ruby
jenrzzz has joined #ruby
zahadoom has quit []
cdg has joined #ruby
simmib_ has quit [Ping timeout: 240 seconds]
pgib has joined #ruby
lmc has quit [Client Quit]
karapetyan has quit [Remote host closed the connection]
mfb2 has joined #ruby
cdg_ has joined #ruby
dionysus69 has joined #ruby
tildes has joined #ruby
railswebdev has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Guest69 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
JeanCarloMachado has joined #ruby
cdg has quit [Ping timeout: 255 seconds]
cdg__ has joined #ruby
torQue_ has quit [Quit: ChatZilla 0.9.93 [Firefox 51.0.1/20170125094131]]
cdg_ has quit [Ping timeout: 255 seconds]
marchelzo has joined #ruby
cdg has joined #ruby
rippa has quit [Quit: {#`%${%&`+'${`%&NO CARRIER]
cdg__ has quit [Ping timeout: 256 seconds]
<jgnagy>
anybody familiar with Munson (or have a suggestion for a better {json:api} r+w client for ruby)?
<jgnagy>
I don't see any way to add to a relationship collection (like you'd do in AR via Auther.posts << Post.new())
kristofferR has joined #ruby
Guest69 has joined #ruby
dionysus69 has quit [Ping timeout: 276 seconds]
railswebdev has joined #ruby
Definity has quit [Ping timeout: 240 seconds]
hobodave_ has quit [Quit: Computer has gone to sleep.]
ben_vulpes has joined #ruby
Ishido has quit [Quit: Roads? Where We're Going We Don't Need Roads.]
tvw has joined #ruby
<ben_vulpes>
dear rubyists, how would i compare maps with bigdecimals for equality using rspec? a naive expect(map_thingy).to eq [{:map => "literal"}] is sad because i can only assume the bigdecimals are not actually the same
devon21 has joined #ruby
hobodave has joined #ruby
<baweaver>
ben_vulpes: what're the actual values?
<baweaver>
You have an array of hashes with string values there
<baweaver>
I don't see how BigDecimal factors in there.
<ben_vulpes>
i did neglect to say that i am comparing a list of hashes, the example is incomplete!
<ben_vulpes>
the actual data structure is more along the lines of [{:thing => BigDecimal.new(2.0, 10)}]
<apeiros>
ben_vulpes: compare apples to apples, and not to oranges?
enterprisey has quit [Remote host closed the connection]
<apeiros>
constructing bigdecimals from floats is not a good idea.