bruce_lee has quit [Remote host closed the connection]
lanc has quit [Quit: zzZZZZzzZZZZzzZZzzZZZZzzzzzzzzz]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
beilabs has joined #ruby
solocshaw has quit [Ping timeout: 256 seconds]
cschneid_ 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]]
brent__ has quit [Read error: Connection reset by peer]
griffindy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
brent__ has joined #ruby
cagomez has joined #ruby
cschneid_ has quit [Ping timeout: 276 seconds]
RickHull has quit [Ping timeout: 260 seconds]
nankyokusei has joined #ruby
mim1k has joined #ruby
nettoweb has joined #ruby
nankyokusei has quit [Ping timeout: 276 seconds]
nettoweb has quit [Client Quit]
hahuang61 has joined #ruby
tolerablyjake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mim1k has quit [Ping timeout: 240 seconds]
sparky has joined #ruby
bkxd has joined #ruby
rrichardsr3 has joined #ruby
Iacobus__ has joined #ruby
hahuang61 has quit [Ping timeout: 264 seconds]
agent_white has quit [Quit: leaving]
bkxd has quit [Ping timeout: 260 seconds]
enterprisey has joined #ruby
ResidentBiscuit has joined #ruby
zeroDi has quit [Quit: WeeChat 1.7]
ResidentBiscuit has quit [Remote host closed the connection]
hobodave has joined #ruby
EckT has quit [Ping timeout: 240 seconds]
marxarelli is now known as marxarelli|afk
skweek has joined #ruby
nertzy has quit [Ping timeout: 240 seconds]
kht has joined #ruby
hobodave has quit [Ping timeout: 264 seconds]
cpruitt has quit [Ping timeout: 255 seconds]
enterprisey has quit [Remote host closed the connection]
Slinky_Pete has quit [Remote host closed the connection]
cpruitt has joined #ruby
nertzy has joined #ruby
parsnip has joined #ruby
DTZUZU2 has quit [Quit: WeeChat 1.5]
whathappens has quit [Quit: Leaving...]
KCmetro has quit [Remote host closed the connection]
choke has quit [Ping timeout: 255 seconds]
EckT has joined #ruby
nertzy has quit [Ping timeout: 240 seconds]
knutmithut has quit [Remote host closed the connection]
Puffball has joined #ruby
Guest46409 has quit [Ping timeout: 260 seconds]
Puffball_ has quit [Ping timeout: 245 seconds]
gloscombe_ has quit [Quit: gloscombe_]
marxarelli|afk is now known as marxarelli
marxarelli is now known as marxarelli|afk
mim1k has joined #ruby
sepp2k has quit [Read error: Connection reset by peer]
hutch34 has joined #ruby
astrobunny has joined #ruby
brent__ has quit [Ping timeout: 258 seconds]
mim1k has quit [Ping timeout: 260 seconds]
marchelzo has joined #ruby
<marchelzo>
hello ruby family
montanonic has quit [Ping timeout: 240 seconds]
Guest15205 has quit [Read error: Connection reset by peer]
EckT has quit [Ping timeout: 260 seconds]
enterprisey has joined #ruby
EckT has joined #ruby
marr has quit [Ping timeout: 240 seconds]
nettoweb has joined #ruby
johnzorn has joined #ruby
hutch34 has quit [Ping timeout: 255 seconds]
jenrzzz has quit [Ping timeout: 240 seconds]
jenrzzz has joined #ruby
agent_white has joined #ruby
mikecmpbll has quit [Quit: inabit. zz.]
nertzy has joined #ruby
A_Drone has joined #ruby
blackmesa has quit [Ping timeout: 258 seconds]
whathappens has joined #ruby
roamingdog has joined #ruby
mistermocha has quit [Remote host closed the connection]
mistermocha has joined #ruby
<newrubycoder>
hey marchelzo
whathappens has quit [Remote host closed the connection]
<marchelzo>
newrubycoder: hey!
<marchelzo>
happy valentine's day
<newrubycoder>
i spent it with a special girl
<newrubycoder>
her name is Ruby xD
Channel6 has joined #ruby
<marchelzo>
hahaha
cagomez has quit []
<marchelzo>
she really is a special girl
bigtawm has joined #ruby
mistermocha has quit [Ping timeout: 268 seconds]
<marchelzo>
that's a great way to spend valentine's day
markholmes has quit [Remote host closed the connection]
<bigtawm>
Im currently building a chess app, and I am having trouble checking for check,checkmate, and stalemate. Any advice on how I should approach the problem? I am representing my chessboard as an 8x8 matrix made by a two dimensional array.
kht has quit [Ping timeout: 260 seconds]
jenrzzz has quit [Ping timeout: 276 seconds]
<marchelzo>
bigtawm: cool
<marchelzo>
chess is fun
<marchelzo>
check is easy to check (haha) for
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
jcao219 has joined #ruby
<marchelzo>
i guess checkmate is pretty easy too
<bigtawm>
Would that just be checking all directions from my king to see if there is a piece that can take it right?
bkxd has joined #ruby
Slinky_Pete has joined #ruby
<bigtawm>
I was thinking of doing that, and would checkmate be moving my king in all directions and seeing if it would be in check there?
<marchelzo>
right
<marchelzo>
for check i'd just iterate over all pieces on the board and see whether they could take the king
<marchelzo>
and then checkmate is just, for the kings current position and any position he could move into, is he in check in all of them?
<marchelzo>
stalemate is similar except he's not in check in his current position
<bigtawm>
Oh okay I have a function that returns if a move is possible so if it ever returns true on the board going from a space to the king this it would be check
<marchelzo>
exactly
maneco has joined #ruby
KCmetro has joined #ruby
<bigtawm>
Cool so I could have a function that checks for check in his current position then one that checks for all the possible moves
nettoweb has quit [Ping timeout: 260 seconds]
Klumben has joined #ruby
PrepperJack has joined #ruby
Slinky_Pete has quit [Ping timeout: 240 seconds]
<marchelzo>
yeah. i would make a method called safe? or something, that takes a position and returns true if none of the opposing pieces can move to that position
bkxd has quit [Ping timeout: 258 seconds]
<marchelzo>
hmm actually checkmate is harder
<marchelzo>
never mind
<marchelzo>
because you could move a different piece other than the king to get him out of check
<bigtawm>
Yeah or I could take a piece with the king I just thought of that. Or that might be covered when checking the surrounding spots
<marchelzo>
the naive way isn't very efficient but maybe it would be fine since the board is small
<marchelzo>
i'm sure there are optimized algorithms for this somewhere though
<marchelzo>
probably papers on it
_djbkd has quit [Quit: My people need me...]
KCmetro has quit [Ping timeout: 258 seconds]
nettoweb has joined #ruby
<bigtawm>
Yeah maybe I should instance another array that maps all the spots and see which pieces protect them or something like that
tyang_ has quit [Read error: Connection reset by peer]
bmurt has joined #ruby
millerti has joined #ruby
<bigtawm>
Either way I think I know what direction I should go toward thanks again you've helped me with some things in the past haha
rakm has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<marchelzo>
no problem
<marchelzo>
have fun
gusrub has quit [Remote host closed the connection]
alem0lars has joined #ruby
jenrzzz has quit [Ping timeout: 245 seconds]
t-recx has quit [Quit: t-recx]
__Yiota has joined #ruby
solocshaw has joined #ruby
SeepingN_ has quit [Ping timeout: 240 seconds]
TPug has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
beilabs has quit [Remote host closed the connection]
PrepperJack has left #ruby ["Leaving"]
enterprisey has quit [Remote host closed the connection]
Guest69 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
railswebdev has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
zacts has joined #ruby
Derperperd has joined #ruby
mim1k has joined #ruby
duderonomy has joined #ruby
brent__ has joined #ruby
duderono_ has quit [Ping timeout: 240 seconds]
LoneHerm_ has joined #ruby
LoneHerm_ has quit [Remote host closed the connection]
LoneHermit has joined #ruby
mim1k has quit [Ping timeout: 260 seconds]
Derperperd has quit [Ping timeout: 264 seconds]
UnknownSoldier has quit [Remote host closed the connection]
LoneHermit has quit [Remote host closed the connection]
LoneHerm_ has joined #ruby
LoneHerm_ has quit [Remote host closed the connection]
JoshS has joined #ruby
LoneHermit has joined #ruby
brent__ has quit [Ping timeout: 268 seconds]
LoneHermit has quit [Remote host closed the connection]
lanc has joined #ruby
LoneHermit has joined #ruby
Guest69 has joined #ruby
railswebdev has joined #ruby
LoneHermit has quit [Remote host closed the connection]
LoneHerm_ has joined #ruby
LoneHerm_ has quit [Remote host closed the connection]
jzigmund has quit [Ping timeout: 240 seconds]
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
safetypin has joined #ruby
Chagel has joined #ruby
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
arescorpio has joined #ruby
lanc has quit [Quit: zzZZZZzzZZZZzzZZzzZZZZzzzzzzzzz]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
enterprisey has joined #ruby
nankyokusei has joined #ruby
Definity has joined #ruby
jameser has joined #ruby
Roa has quit [Changing host]
Roa has joined #ruby
roamingdog has quit [Remote host closed the connection]
TPug has joined #ruby
Lyfe_ is now known as Lyfe
nankyokusei has quit [Ping timeout: 258 seconds]
lanc has joined #ruby
hahuang61 has joined #ruby
bkxd has joined #ruby
hahuang61 has quit [Ping timeout: 260 seconds]
mim1k has joined #ruby
beilabs has joined #ruby
hutch34 has joined #ruby
bkxd has quit [Ping timeout: 255 seconds]
railswebdev has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Guest69 has quit [Quit: My iMac has gone to sleep. ZZZzzz…]
beilabs has quit [Read error: Connection reset by peer]
beilabs has joined #ruby
jenrzzz has joined #ruby
sparky has quit [Quit: leaving]
mim1k has quit [Ping timeout: 276 seconds]
hutch34 has quit [Ping timeout: 258 seconds]
UnknownSoldier has joined #ruby
hutch34 has joined #ruby
duderonomy has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
d^sh has quit [Ping timeout: 240 seconds]
d^sh has joined #ruby
malconis has quit [Read error: Connection reset by peer]
tomphp has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
gusrub has quit [Ping timeout: 258 seconds]
jeyraof^mbpr has quit [Quit: This computer has gone to sleep]
tomphp has joined #ruby
davezd has joined #ruby
tomphp has quit [Client Quit]
Snickers has joined #ruby
lenwood has joined #ruby
jeyraof^mbpr has joined #ruby
astrobunny has quit [Remote host closed the connection]
versigtig has quit [Quit: This computer has gone to sleep]
fusta has quit [Ping timeout: 268 seconds]
mikecmpbll has joined #ruby
Ryzokuken has joined #ruby
def_jam has joined #ruby
eb0t_ has joined #ruby
vondruch__ is now known as vondruch
szulak has joined #ruby
eblip has quit [Ping timeout: 245 seconds]
eb0t has quit [Ping timeout: 260 seconds]
jsrn has joined #ruby
<szulak>
Hi, I am having a trouble understanding a keyword (I suppose) in ruby. I am fairly new into ruby language, and any help would be appreciated. Considering this snippet of code: https://gist.github.com/anonymous/9f493bf4f684390a3ad6b267e66e330a, wha is the 'validates' ?
hutch34 has joined #ruby
rscnyv has joined #ruby
danguita has quit [Quit: danguita]
jcao219 has quit [Ping timeout: 276 seconds]
danguita has joined #ruby
mim1k has joined #ruby
danguita has quit [Client Quit]
<matthewd>
szulak: It's a method defined by Ruby on Rails (specifically, Active Record)
armando has quit [Ping timeout: 240 seconds]
tomphp has joined #ruby
tvl has joined #ruby
tvl is now known as tobiasvl
<szulak>
matthewd: thanks. so, it's the invocation of method - but how is it possible in class definition?
jeyraof^mbpr has quit [Quit: This computer has gone to sleep]
danguita has joined #ruby
hutch34 has quit [Ping timeout: 245 seconds]
<szulak>
matthewd: I have a few years of c++ development experience, and this construction (calling a method in class definition destroys my brain).
<matthewd>
There is only runtime
djbkd has quit [Ping timeout: 240 seconds]
govg has quit [Ping timeout: 240 seconds]
<matthewd>
>> class A; def foo; end; p instance_methods(false); def bar; end; p instance_methods(false); end
<apeiros>
szulak: classes are objects too in ruby
<apeiros>
szulak: and code in the class body is executed in the context of that class object, i.e. self is the class itself
<apeiros>
>> class X; p current_self: self; end
<apeiros>
oh, where's ruby[bot]? o0
<apeiros>
netsplit again?
<apeiros>
well… `class X; p current_self: self; end` -> X
<szulak>
hm
<apeiros>
and: X.is_a?(Class) # -> true
Burgestrand has joined #ruby
ruby[bot] has joined #ruby
<apeiros>
hello again ruby[bot]
Burgestrand has quit [Client Quit]
<apeiros>
?botsnack
<ruby[bot]>
nomnomnomnom
Burgestrand has joined #ruby
<apeiros>
szulak: also note (and that's part of this) - every object in ruby can have its own methods too, which belong only to it:
<apeiros>
>> x = "hi"; def x.foo; "woot!"; end; x.foo
<ruby[bot]>
apeiros: I'm terribly sorry, I could not evaluate your code because of an error: NoMethodError:undefined method `[]' for nil:NilClass
<apeiros>
wtf?
<apeiros>
eval.in down again?
jaruga______ has joined #ruby
<apeiros>
>> x = "hi"; def x.foo; "woot!"; end; x.foo
<apeiros>
yeah, iirc that error above was a problem in ruby[bot] handling an error from eval.in (the service it uses to evaluate the code safely)
blackmesa has joined #ruby
<apeiros>
that foo method there exists only on that string, no other string has it
<apeiros>
note that `def x.foo; …; end` is alternative syntax for `class << x; def foo; …; end; end` - which you'll see somewhat often to define "class methods".
Beams has joined #ruby
<apeiros>
usually it is `class X; class << self; def class_method; …; end; end; end`
<szulak>
ok, I think I finally get it
<szulak>
class X
<szulak>
end
<szulak>
p current_self: self
<apeiros>
and since `self` == `X` in the class body scope, it follows that it is alternative syntax for `def X.class_method; …; end`
<szulak>
why p current_self: self, instead of p self ?
pandaant has joined #ruby
<apeiros>
eh, I usually label my output
<szulak>
oh, ok :)
pskosinski_ has joined #ruby
<apeiros>
i.e. habit. like: p user_id: user.id, attribute: attr_name, old_value: model.old_attr
marr has joined #ruby
bkxd has joined #ruby
<apeiros>
back to topic: i.e. a class method is a method defined on the class object itself (technically it's stored somewhere else, but that might be a bit too much right now)
<apeiros>
and any method invoked without an explicit receiver uses self, i.e. `foo("bar")` is `self.foo("bar")`
TheHodge has joined #ruby
pskosinski has quit [Ping timeout: 245 seconds]
<apeiros>
so in class scope, `class X; foo("bar"); end` is `class X; X.foo("bar"); end`
<apeiros>
(again, there are some technicalities regarding private methods, but probably too much right now)
<szulak>
I think, it's self.foo("bar"); ?
mim1k has quit [Ping timeout: 258 seconds]
<apeiros>
yes
<apeiros>
and self is X
<szulak>
yeah
<Burgestrand>
(and another technicality due to syntax regarding property setters, but not getters, regarding implicit self)
<apeiros>
Burgestrand: going full ruby technicalities inception? :D
djbkd has joined #ruby
<Burgestrand>
apeiros I still have memories of it biting me a few times over the first few months of learning ruby, slightly bitter ;P
<apeiros>
Burgestrand: hehe
<apeiros>
yeah, some of the noise reducing features of ruby make it less explicit and the implicit things aren't always self evident :-/
mark_66 has quit [Remote host closed the connection]
mim1k has joined #ruby
<Burgestrand>
indeed, and having just one or two exceptions to an otherwise nice rule can be annoying :d
<apeiros>
I think shadowing methods via local vars has bitten me more and longer. most famous: `if false; foo = "hi"; end; bar = foo` - expecting foo to be the method, not the lvar and being wrong :)
solocshaw has joined #ruby
TheWhip has quit [Remote host closed the connection]
<Burgestrand>
ah yeah, hehe
bkxd has quit [Ping timeout: 240 seconds]
<apeiros>
it makes perfect sense. but it's not obvious.
<Burgestrand>
indeed :)
mark_66 has joined #ruby
<apeiros>
I'd actually like it if they'd expose Qundefined there
<apeiros>
and raise upon access
<apeiros>
"You're accessing a local variable which has not been set" or somesuch
<Burgestrand>
apeiros didn't we use to have warnings for shadowing outer variables through block variables? maybe we still do?
<apeiros>
I think they're opt-in, no?
<Burgestrand>
apeiros ah yes, there are many opt-in warnings :)
<apeiros>
and given that we can't exclude sources of warnings, combined with the quality of some 3rd party libs, I don't dare to use -v anymore.
<Burgestrand>
this is true, so much noise from third-parties makes keeping a tidy source hard
tofusonruby has joined #ruby
nettoweb has joined #ruby
hobodave has joined #ruby
GeorgesLeYeti has joined #ruby
<GeorgesLeYeti>
Hi
<Burgestrand>
HI!
<apeiros>
ho
<Burgestrand>
hi ho
<GeorgesLeYeti>
I have an interger a = 11. I want to split it in 3 integer same "size" [4, 4, 3]
<Burgestrand>
GeorgesLeYeti what is size?
ur5us has quit [Remote host closed the connection]
hobodave has quit [Ping timeout: 260 seconds]
<jokke>
hey
<jokke>
i've got a project where i'm not able to use pry for some reason. I get the error 'cannot load such file pry'. pry (and pry-byebug) are in the Gemfile and it's bundled.
<jokke>
i don't have this problem for any other gems
<matthewd>
GeorgesLeYeti: The word you're looking for is "divide"
<apeiros>
GeorgesLeYeti: int=11; buckets=3; res = [int.div(buckets)]*buckets; res[0,int % buckets] = res[0,int % buckets].map { |val| val + 1 }
<apeiros>
can probably do it more elegantly as map isn't really necessary
<GeorgesLeYeti>
If i make 11/3 it will returns 3.66666... so 3.66.to_i = 3 and 3+3+3 != 11
<apeiros>
but that contains the basic logic to divide the modulus
<apeiros>
s/divide/"spread"/
ketan has quit [Remote host closed the connection]
ketan has joined #ruby
jeyraof^mbpr has joined #ruby
<apeiros>
GeorgesLeYeti: int=11; buckets=3; low = int.div(buckets); highcount = int % buckets; res = Array.new(highcount, low+1) + Array.new(buckets-highcount, low)
jeyraof^mbpr has quit [Remote host closed the connection]
<apeiros>
maybe more elegant
<GeorgesLeYeti>
Ty a lot for you answer
ferr1 has joined #ruby
<apeiros>
no guarantees :-p
<matthewd>
>> a, b = 11.divmod(3); [a + 1] * b + [a] * (a - b)
<apeiros>
you made me think for a second I was missing knowledge on a core method :D
mikecmpbll has quit [Quit: inabit. zz.]
<Burgestrand>
slightly different than #each_slice, interesting
patarr has joined #ruby
mikecmpbll has joined #ruby
Qchmqs has joined #ruby
<matthewd>
Burgestrand: Yeah, though it should probably now be implemented using each_slice
<apeiros>
that'd be difficult. it depends on .size
LoneHermit has quit [Ping timeout: 260 seconds]
<Burgestrand>
matthewd I did a version with each_slice and flat_map because oneliners are fun xP
<apeiros>
could buffer, though
<matthewd>
apeiros: It's still on array, so you can still just grab the size. Just seems like it could be simplified with each_slice(size / n) { |slice| slice << fill if .. }
<apeiros>
with buffering, you can do it on Enumerable
<matthewd>
You have to buffer the whole thing, so you might as well just call to_a :P
patarr has quit [Ping timeout: 256 seconds]
<apeiros>
no
kiddorai_ has joined #ruby
<apeiros>
at least I think you don't have to buffer the whole thing
workmad3 has joined #ruby
<apeiros>
hm
<matthewd>
You don't know how many elements go in the first column until you know how many there are in total
<apeiros>
yeah, you have to only buffer N, sadly N is size-1 :D
<apeiros>
so… pointless. size required.
<matthewd>
On an Enumerator, though...
braincrash has quit [Ping timeout: 260 seconds]
catbusters has quit [Quit: Connection closed for inactivity]
despai has quit [Ping timeout: 240 seconds]
nankyokusei has joined #ruby
solocshaw has quit [Quit: solocshaw]
tvw has joined #ruby
govg has joined #ruby
despai has joined #ruby
nankyokusei has quit [Ping timeout: 245 seconds]
toretore has joined #ruby
wingwalker has joined #ruby
esObe has joined #ruby
bkxd has joined #ruby
JeanCarloMachado has joined #ruby
maneco has joined #ruby
Cohedrin has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
brent__ has joined #ruby
despai has quit [Read error: Connection reset by peer]
despai has joined #ruby
ldnunes has joined #ruby
bkxd has quit [Ping timeout: 240 seconds]
cyphase_eviltwin has quit [Ping timeout: 258 seconds]
jameser has quit [Ping timeout: 240 seconds]
brent__ has quit [Ping timeout: 276 seconds]
minimalism has quit [Quit: minimalism]
jenrzzz has joined #ruby
shadeslayer_ is now known as shadeslayer
tvw has quit []
Clarity has joined #ruby
cyphase has joined #ruby
<Clarity>
does Ruby support hash destructuring?
<matthewd>
Clarity: No
<manveru>
Clarity: in what way?
<Clarity>
smth like {name, age} = {name: 'John', age: 42}
Pumukel has quit [Remote host closed the connection]
<manveru>
not directly
<Clarity>
basically smth similar as there's for arrays
<manveru>
so if you take the hash as method argument, you can do it
jcao219 has quit [Ping timeout: 260 seconds]
patarr has joined #ruby
jdm has quit [Quit: Leaving]
lupine has quit [Ping timeout: 276 seconds]
xall has quit [Ping timeout: 276 seconds]
govg has quit [Ping timeout: 264 seconds]
patarr has quit [Ping timeout: 255 seconds]
govg has joined #ruby
lupine has joined #ruby
braincrash has joined #ruby
tofusonruby has quit [Ping timeout: 260 seconds]
stamina has joined #ruby
BackEndCoder has quit [Excess Flood]
rscnyv has quit [Remote host closed the connection]
beilabs has quit [Read error: Connection reset by peer]
beilabs has joined #ruby
BackEndCoder has joined #ruby
sylario has joined #ruby
raspado has joined #ruby
jshjsh has joined #ruby
raspado has quit [Ping timeout: 260 seconds]
hutch34 has joined #ruby
newrubycoder has joined #ruby
JoshS has quit [Ping timeout: 260 seconds]
csk157_ has joined #ruby
csk157 has quit [Ping timeout: 252 seconds]
hutch34 has quit [Ping timeout: 264 seconds]
danguita has quit [Remote host closed the connection]
despai has quit [Ping timeout: 260 seconds]
Ryzokuken has quit [Quit: Connection closed for inactivity]
zotherstupidguy has quit [Remote host closed the connection]
blackmesa has joined #ruby
despai has joined #ruby
djbkd_ has joined #ruby
Sebastia1Thorn has quit [Ping timeout: 252 seconds]
ldnunes has quit [Read error: Connection reset by peer]
ldnunes has joined #ruby
bkxd has joined #ruby
lenwood has quit [Ping timeout: 255 seconds]
bkxd has quit [Ping timeout: 252 seconds]
braincrash has quit [Ping timeout: 260 seconds]
cschneid_ has joined #ruby
cschneid_ has quit [Ping timeout: 245 seconds]
davezd has quit [Quit: Leaving]
charliesome has joined #ruby
Guest43 has joined #ruby
jameser has joined #ruby
csk has quit [Quit: ZZZzzz…]
cyphase has quit [Ping timeout: 260 seconds]
djbkd_ has quit [Ping timeout: 240 seconds]
Guest43 has quit [Ping timeout: 245 seconds]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jameser has joined #ruby
ldnunes has quit [Ping timeout: 256 seconds]
cyphase has joined #ruby
marsjaninzmarsa has quit [Ping timeout: 240 seconds]
emilkarl has joined #ruby
cyphase has quit [Excess Flood]
marsjaninzmarsa has joined #ruby
cyphase has joined #ruby
jgnagy has joined #ruby
cyphase has quit [Max SendQ exceeded]
cyphase has joined #ruby
ocbtec has joined #ruby
Pumukel has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
loechel has joined #ruby
jameser has joined #ruby
despai has quit [Ping timeout: 240 seconds]
Pumukel has quit [Read error: Connection reset by peer]
despai has joined #ruby
ldnunes has joined #ruby
Slinky_Pete has joined #ruby
ifctj has joined #ruby
millerti has joined #ruby
nankyokusei has joined #ruby
psychicist__ has joined #ruby
Slinky_Pete has quit [Ping timeout: 256 seconds]
ifctj has quit [Ping timeout: 260 seconds]
nankyokusei has quit [Ping timeout: 240 seconds]
larcara has joined #ruby
TheWhip has quit [Remote host closed the connection]
pskosinski_ is now known as pskosinski
pskosinski has quit [Changing host]
pskosinski has joined #ruby
pskosinski has joined #ruby
kiddorai_ has quit [Remote host closed the connection]
blackeel has joined #ruby
<blackeel>
what are the differences of Ruby and Eiffel?
Derperperd has quit [Ping timeout: 245 seconds]
lenwood has joined #ruby
bkxd has joined #ruby
<blackeel>
what are the differences of Ruby and Eiffel?
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
TheWhip has joined #ruby
<xpt>
blackeel: All the letters are different, Eiffel is longer but will be listed before Ruby if you sort the names in alphabetical order. Sorry I don't know anything about Eiffel so can't point more differences.
bkxd has quit [Ping timeout: 240 seconds]
csk has joined #ruby
TheWhip has quit [Remote host closed the connection]
jenrzzz has quit [Ping timeout: 240 seconds]
TheWhip has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ShoaibJahejo has quit [Ping timeout: 256 seconds]
hobodave has joined #ruby
jameser has joined #ruby
houhoulis has joined #ruby
jameser has quit [Client Quit]
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
hobodave has quit [Ping timeout: 268 seconds]
brent__ has joined #ruby
jameser has joined #ruby
bruce_lee has joined #ruby
jenrzzz has quit [Ping timeout: 260 seconds]
__Yiota has joined #ruby
brent__ has quit [Ping timeout: 245 seconds]
Chagel has joined #ruby
byte512 has joined #ruby
synthroid has joined #ruby
Derperperd has joined #ruby
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
ShoaibJahejo has joined #ruby
ShoaibJahejo has quit [Max SendQ exceeded]
tyang has joined #ruby
UnknownSoldier has joined #ruby
moei has quit [Quit: Leaving...]
jameser has joined #ruby
Derperperd has quit [Ping timeout: 240 seconds]
squ has quit [Remote host closed the connection]
charliesome has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
wingwalker has quit [Quit: Leaving]
houhoulis has quit [Remote host closed the connection]
jameser has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
Chagel has quit [Ping timeout: 240 seconds]
ShoaibJahejo has joined #ruby
ShoaibJahejo has quit [Max SendQ exceeded]
mnms_ has joined #ruby
hutch34 has joined #ruby
browndawg has joined #ruby
gnufied has joined #ruby
safetypin has quit [Quit: ZZZzzz…]
ShoaibJahejo has joined #ruby
ShoaibJahejo has quit [Max SendQ exceeded]
mlkkk has joined #ruby
ocbtec has quit [Ping timeout: 256 seconds]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jdm has joined #ruby
mnms_ has quit [Client Quit]
braincrash has joined #ruby
mnms_ has joined #ruby
ShoaibJahejo has joined #ruby
hutch34 has quit [Ping timeout: 276 seconds]
<mnms_>
Does Net::SMTP is able to send mails via 465 port (SMTPS)?
TheWhip has quit [Remote host closed the connection]
<apeiros>
mnms_: seems like. see all methods which contain tls.
<apeiros>
e.g. enable_tls
<mnms_>
I cannot get something working and not writing everyday in ruby
JeanCarl1Machado has joined #ruby
JeanCarloMachado has quit [Read error: Connection reset by peer]
<mnms_>
looking at examples on the internet I feel like Net::SMTP it's not working with ssl
<apeiros>
so you mean those tls methods are just decoration? ok.
<dminuoso>
"its not working"
<dminuoso>
I love this kind of error description.
<mnms_>
Im not sure I tried few combinations
<rob__>
anyone know if theres a method similar to fetch for Array that accepts a block, and a default, so that i can chain .fetch methods to search through nested Arrays?
<dminuoso>
Be glad you didnt just call me with that error description, or you would have learned about pain.
<apeiros>
rob__: you mean like Hash#fetch? (which accepts either a default or a block, not both)
<mnms_>
dminuoso: read carefuly I said that I think Net::SMTP is not working with SMTPS
<mnms_>
no that something in my code is not working
<apeiros>
also yeah, dig for that specific purpose.
<dminuoso>
<mnms_> looking at examples on the internet I feel like Net::SMTP it's not working with ssl
<dminuoso>
Just saying.
<dminuoso>
apeiros, I totally dig that method.
<dminuoso>
Hooray, another pun!
<rob__>
ah, thanks, i searched for dig but was on wrong ruby version, doh
<dminuoso>
rob__, never not use ri.
<rob__>
dminuoso: so used to googling for rdoc :\
<dminuoso>
rob__, unlike this google which will at times give you 1.9.3 docs
<mnms_>
dminuoso: Im not talking about code but that I cannot find any working example
<dminuoso>
rob__, either search on the appropriate version on ruby-doc.org directly or use ri
<rob__>
dminuoso: im going to talk to larry about making google better ;)
blackeel has quit [Ping timeout: 260 seconds]
<dminuoso>
You do that, and if you succeed Ill get a provision right?
<dminuoso>
Something like 1% of all Alphabet shares
<apeiros>
google's search results AI already learnt enough about me to know that I'm almost certainly referring to something related to the newest ruby proglang version.
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<apeiros>
(the not-so-far future)
mlkkk has quit [Ping timeout: 240 seconds]
bkxd has joined #ruby
quiqua has joined #ruby
quiqua has quit [Client Quit]
quiqua has joined #ruby
anisha has quit [Quit: This computer has gone to sleep]
<fuzzyhorns>
it's just the return value that is diff
<canton7>
yeah, but it's still very surprising to see a map mutate its input
<dminuoso>
canton7, in a dynamic language like ruby you shouldn't be surprised if any method mutates the living hell out of its arguments.
<fuzzyhorns>
hmm, idk that it is really, in this case — what i'd find weird is if map actually mutated words
<fuzzyhorns>
not the scope it defines, w
<canton7>
you're supposed to write code which people don't have to re-read a few times to make sure that it does what it's supposed to with no bad side-effects :P
<fuzzyhorns>
and amazingly you can do all kinds of messed up stuff with that!
<dminuoso>
This is precisely why I want this critical API to be written in C++, because I don't want this "You can easily shoot yourself in your head *and* the foot at the same time" gun in my hand.
<fuzzyhorns>
check out the examples midway down where i mention "delete"
<canton7>
fuzzyhorns, it *does* mutate the words!
neuraload has joined #ruby
<canton7>
fuzzyhorns, you mean, where it uses #each?
<dminuoso>
canton7, the big issue is really that often you have a hard time telling which method mutates which object. In a language without cv specifiers it's hard to reason about this at all.
<fuzzyhorns>
w is mutated
<canton7>
that's expected - #each is a looping operation. #map is a mapping operation, and you'd expect it to be pure
* dminuoso
waits for the "but.. write unit tests" argument
<canton7>
fuzzyhorns, see my example - the *input* to the map is mutated
<fuzzyhorns>
i wish ruby had a static type system, but i'm a bad person, so
<canton7>
fuzzyhorns, you're not looking at the input to the map. Put 'str.split' into a var, feed it into the map, then print it afterwards, as I did
JeanCarloMachado has joined #ruby
<canton7>
dminuoso, sure, but '=' is a fairly big red flag, which is why I did a double-take, followed by "it stinks"
KCmetro has joined #ruby
jdm has quit [Quit: Leaving]
shinnya has joined #ruby
<fuzzyhorns>
canton7: yah, but that's different
<fuzzyhorns>
canton7: split dups
jdm has joined #ruby
<fuzzyhorns>
i see your point though
<canton7>
fuzzyhorns, I think you're missing the point still. The point is that someone reading the code sees the mutation in the #map, does a double-take, re-reads it, then figures out that the input to the map is only used in that one place, so it's OK
bkxd has joined #ruby
<canton7>
fuzzyhorns, the *point* is that you're requiring the reader to do that double-take and re-read your code. You haven't written good or clear code. You've written code which someone has to read twice to understand, and which raises red flags in their mind. It will disrupt their ability to scan through your code
<canton7>
(bear in mind that this other person is most likely to be you in a few weeks)
mistermocha has joined #ruby
<fuzzyhorns>
canton7: i. never. said. it's. good. code.
<fuzzyhorns>
so i am unclear why you are taking great pains to convince me lol
<canton7>
and I said it's bad code :P where's the argument then?
<canton7>
I just said it stinks. You went to great lengths to try and convince me that it's OK. I know it's OK, but it still stinks :P
jhack has quit [Quit: jhack]
<fuzzyhorns>
telling me the "point" is it's tough to read sure scans like that
lenwood has joined #ruby
<fuzzyhorns>
& i actually think by focusing on veering that direction just to be right while i'm wrong missed an interesting line where i actually *am* wrong:
<fuzzyhorns>
words.dup.map {|w| w[1..-2] = w[1..-2].chars.sort.join ; w }.join(" ")
<fuzzyhorns>
this still mutates words!
<fuzzyhorns>
that genuinely surprised me
jdm has quit [Client Quit]
jdm has joined #ruby
<Papierkorb>
fuzzyhorns: #dup doesn't clone deeply, you duplicated the array, but not what's in the array
<canton7>
yeah, as 'dup' is a shallow copy
jdm has quit [Remote host closed the connection]
<fuzzyhorns>
i always forget that — i'd think at least with Array#dup you'd get the first dimension
jdm has joined #ruby
<fuzzyhorns>
this has caught me up before too
<canton7>
if you add/remove elements to the dup, that isn't reflected in the original. If you mutate elements in the dup, those are reflected, because they're the same elements
jhack has joined #ruby
jdm has quit [Remote host closed the connection]
<fuzzyhorns>
yeah, that always gets me
radic has joined #ruby
andikr has quit [Remote host closed the connection]
KCmetro has quit [Read error: Connection reset by peer]
KCmetro__ has joined #ruby
Qchmqs has quit [Quit: Konversation terminated!]
hobodave has joined #ruby
UserJosh has joined #ruby
Asher has quit [Quit: Leaving.]
<cr3>
how folks, when I `bundle install` a package from a local gem (gem 'foobar', 'version', path: '/path/to/foobar.gem') and I require 'foobar' from `bundle exec irb`, I get 'cannot load such file -- foobar'. When I bundle install the same project from source (gem 'foobar', path: '/path/to/foobar'), I can require 'foobar' just fine. When I compare the installed files under /usr/local/bundle, they look the same to me. What would make one not found by require?
<canton7>
fuzzyhorns, FWIW, I'd say 'str.split.map{ |w| w[0] + w[1..-2].chars.sort.join + w[-1] }.join(" ") or similar is the easiest to read - it clearly shows that the pattern is <first letter> <middle letters sorted> <last letter>
Slinky_Pete has joined #ruby
KCmetro_ has quit [Ping timeout: 256 seconds]
jshjsh has quit [Ping timeout: 268 seconds]
<fuzzyhorns>
yep, i started with `str.split.map {|w| (f, m, l = w[0], w[1..-2].chars.sort.join, w[-1]).join }.join(" ")`
<fuzzyhorns>
(though i imagine folks might disapprove of the destructuring technique, at least i can use it to name the segments clearly, not that i did above)
<fuzzyhorns>
one thing i find kinda amazing about ruby is you could do that assignment in the pipes too
hutch34 has joined #ruby
<canton7>
heh, I still had to read that 3 times to figure out that you were assigning f, m, l, then never directly referencing them :P
govg has quit [Ping timeout: 240 seconds]
<fuzzyhorns>
yep hehe
<fuzzyhorns>
if in pipes, i think it's ugly but clearer what's happening: `str.split.map {|w, first_char=w[0], middle_chars=w[1..-2], last_char=w[-1]| "#{first_char}#{middle_chars.chars.sort.join}#{last_char}" }.join("`
<fuzzyhorns>
oops lost the last few chars there but you prob get
lenwood has quit [Ping timeout: 255 seconds]
<fuzzyhorns>
in fact i think could've split to chars in pipes, lets see
Slinky_Pete has quit [Ping timeout: 264 seconds]
neuraload has quit [Quit: This computer has gone to sleep]
<fuzzyhorns>
haha omg this is awful: `str.split.map {|w, first_char=w[0], sorted_middle_chars=w[1..-2].chars.sort.join, last_char=w[-1]| "#{first_char}#{sorted_middle_chars}#{last_char}" }.join(" ")`
* canton7
winces
mark_66 has quit [Remote host closed the connection]
<nicola_pav>
hi all, I am new to Ruby. I am using Dashing which is based on ruby. I have a code that runs SCHEDULER.
jolamb has joined #ruby
spiette has joined #ruby
<nicola_pav>
the scheduler runs each 30s against sensu api. if the sensy api is down, nothing happens. I would like to catch the scehduler exception
<nicola_pav>
how can I do that?
SteenJobs_ has quit [Quit: SteenJobs_]
t-recx has joined #ruby
module7 has joined #ruby
<module7>
Why should I use Ruby? (I am serious)
<marchelzo>
because it's beautiful
<marchelzo>
it's art
<marchelzo>
ruby brings me happiness when i'm feeling down. it brings meaning to otherwise meaningless programs.
Prepper_Jack has joined #ruby
mlkkk has quit [Read error: Connection reset by peer]
milardovich has joined #ruby
aganov has quit [Remote host closed the connection]
<fuzzyhorns>
module7: i think it has a nice central metaphor, and is very good for beginners to programming
blaxter has joined #ruby
mlkkk has joined #ruby
<fuzzyhorns>
module7: if you already have some other dynamically typed lang under your belt, i think the main reason would be to use Rails, practically speaking
<fuzzyhorns>
i also find it convenient for "i just need to write this tiny thing in a REPL real quick"
<dminuoso>
module7, Ruby is extremely fast at prototyping.
<dminuoso>
That's basically the major selling point.
<fuzzyhorns>
a blessing and a curse hehe
<dminuoso>
We have a rich set of libraries for all kinds of things, increasing prototyping speed even more.
<dminuoso>
It's all based on getting things done quickly but having absolutely no clue how stuff works.
<fuzzyhorns>
lmao
<dminuoso>
It's like JavaScript, except our closures look better.
<apeiros>
!fact add whyruby Because ruby is a language made for developers. it is beautiful, mature, has a vibrant community. Also because we say so.
<ruby[bot]>
apeiros: I will remember that whyruby is Because ruby is a language made for developers. it is beautiful, mature, has a vibrant community. Also because we say so.
<apeiros>
hm, or maybe "because ruby is a language made for humans, not machines"?
<marchelzo>
yes
brent__ has joined #ruby
<dminuoso>
apeiros, that factoid doesnt have enough propaganda in it
<dminuoso>
The ministry of propaganda rejects this factoid.
<apeiros>
!fact edit whyruby because ruby is a language made for humans, not machines. It is beautiful, mature, has a vibrant community. Also because we say so.
<ruby[bot]>
apeiros: I stand corrected that whyruby is because ruby is a language made for humans, not machines. It is beautiful, mature, has a vibrant community. Also because we say so.
<apeiros>
dminuoso: we're not using alt-facts here
<dminuoso>
alt facts is what the other say about ruby
<dminuoso>
we speak the truth.
swills has quit [Quit: Leaving]
<case__>
It's worth learning ruby just to have an excuse to read Why's poignant guide
SeepingN has quit [Remote host closed the connection]
SeepingN has joined #ruby
AnoHito_ has joined #ruby
lupine has quit [Ping timeout: 276 seconds]
dcunit3d has quit [Ping timeout: 240 seconds]
szulak has joined #ruby
bkxd has quit [Ping timeout: 240 seconds]
rakm has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
gnufied has joined #ruby
nadir is now known as nadir|absentia
nadir|absentia is now known as nadir
AnoHito has quit [Ping timeout: 258 seconds]
Rodya_ has quit [Remote host closed the connection]
Rodya_ has joined #ruby
qba73 has quit [Remote host closed the connection]
dionysus69 has joined #ruby
manjaro-kde5_ has quit [Ping timeout: 255 seconds]
jhack has joined #ruby
maneco has quit [Quit: Leaving]
rakm has joined #ruby
jhack has quit [Client Quit]
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
jhack has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
dcunit3d has joined #ruby
ifctj has joined #ruby
Yzguy has quit [Quit: Zzz...]
SirOliver has quit [Quit: ZZZzzz…]
jenrzzz has quit [Ping timeout: 260 seconds]
qba73 has joined #ruby
Slinky_Pete has quit []
qmr has joined #ruby
<qmr>
what's recommended for getting newer ruby on debian jessie? ruby-build ?
al2o3-cr has quit [Ping timeout: 240 seconds]
gnufied__ has joined #ruby
gnufied__ has quit [Remote host closed the connection]
JeanCarloMachado has quit [Ping timeout: 264 seconds]
<qmr>
wtf, ruby-build has same definitions as the versions available in repos, nothing newer
qba73 has quit [Ping timeout: 240 seconds]
lupine has joined #ruby
jose_leeto has joined #ruby
kallisti5 has joined #ruby
<kallisti5>
ok.. YAML.dump is stupid. Anyone know how to turn a yaml document into a hash / array map and back without all the silly Psych object stuff?
mim1k has quit [Ping timeout: 256 seconds]
<kallisti5>
I pretty much want to pass in a yaml, tweak it, and turn it back into text. (like you can with json)
qba73 has joined #ruby
nowhere_man has joined #ruby
gman has quit [Ping timeout: 255 seconds]
ur5us has quit [Remote host closed the connection]
Fernando-Basso has joined #ruby
cschneid_ has quit []
ldnunes has quit [Quit: Leaving]
millerti has joined #ruby
qba73 has quit [Ping timeout: 240 seconds]
anisha_ has joined #ruby
al2o3-cr has joined #ruby
anisha__ has joined #ruby
SirOliver has joined #ruby
freddymungo has joined #ruby
JeanCarloMachado has joined #ruby
mim1k has joined #ruby
anisha has quit [Ping timeout: 255 seconds]
Drakevr has quit [Changing host]
Drakevr has joined #ruby
anisha__ has quit [Client Quit]
anisha_ has quit [Ping timeout: 264 seconds]
tvw has joined #ruby
jhack has quit [Quit: jhack]
gman has joined #ruby
JoshS has joined #ruby
radic has joined #ruby
username_ has quit [Ping timeout: 260 seconds]
saslam has quit [Quit: Leaving]
<kallisti5>
aah safe_load. How silly
enterprisey has quit [Remote host closed the connection]
cschneid_ has joined #ruby
nettoweb has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
mim1k has quit [Ping timeout: 240 seconds]
dc1 has joined #ruby
esObe has quit [Read error: Connection reset by peer]
esObe has joined #ruby
dcunit3d has quit [Ping timeout: 260 seconds]
rakm has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
_aeris_ has quit [Remote host closed the connection]
_aeris_ has joined #ruby
gevans has joined #ruby
whathappens has quit [Remote host closed the connection]
mholmes has joined #ruby
whathappens has joined #ruby
bkxd has joined #ruby
markholmes has quit [Ping timeout: 260 seconds]
whathappens has quit [Read error: Connection reset by peer]
elifoster has quit [Quit: class]
whathappens has joined #ruby
bkxd has quit [Ping timeout: 252 seconds]
FastJack_ has joined #ruby
cdg has joined #ruby
FastJack has quit [Ping timeout: 260 seconds]
FastJack_ is now known as FastJack
ledestin has joined #ruby
zherbert has joined #ruby
grh has quit [Ping timeout: 258 seconds]
<zherbert>
anyone free to take a quick look at this?
<bigtawm>
Im trying to create a copy of an instance variable. Its a multidimensional array that represents a chess board called @board and Im making changes to it but I want to save a copy of it in a variable called copy_board so I can revert back to the original when I am done making changes. Ive been having problems getting the copy to restore any advice?
markholmes has joined #ruby
cdg has quit [Read error: Connection reset by peer]
tercenya_ has quit [Read error: Connection reset by peer]
<bigtawm>
I can share a gist upon request
tolerablyjake has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
tercenya has joined #ruby
cdg has joined #ruby
Lord_of_Life has quit [Excess Flood]
nowhere_man has quit [Remote host closed the connection]
<Eiam>
meh. ["3.0," , "Stuff", "More stuff", "2015"].find {|x| x[/(\d+.\d+)/]} . So I'd like to have the regex first result ALSO be whats first returned without having to re-run it
<Eiam>
instead of returning "3.0," which is the first value in the array that matches, return actually "3.0" which is the first match too
jhack has joined #ruby
lanc has joined #ruby
nankyokusei has quit [Ping timeout: 259 seconds]
<Eiam>
but i can't think of a way to do it without re-running the match again
<qmr>
ok, geminabox is running and I've disowned the pid
nettoweb1 has joined #ruby
<Papierkorb>
qmr: You could also write a systemd service for it
<Papierkorb>
to make it all kinds of nice
tildes has joined #ruby
bkxd has joined #ruby
<qmr>
.... and now I can't connect, even though it's running and listening on port 80. wtf
<Papierkorb>
qmr: Make sure you let it bind to the correct address (or just 0.0.0.0), and not only localhost
<qmr>
it is, I could get to webui before I disowned it
ur5us_ has joined #ruby
synthroi_ has quit []
<Papierkorb>
did you ^Z it before disowning?
<qmr>
yes
<qmr>
Process 15228 attached
<qmr>
--- stopped by SIGTSTP ---
<Papierkorb>
Then it's still stopped
nettoweb has quit [Ping timeout: 260 seconds]
<Papierkorb>
Just send it SIGCONT through htop or kill
<qmr>
Duh!
<qmr>
I want to be just like you when I grow up Papierkorb
nettoweb1 has quit [Client Quit]
teclator has quit [Ping timeout: 252 seconds]
teclator_ has joined #ruby
<Radar>
me too
<Papierkorb>
qmr: Thanks for the compliment. But knowing about ^Z is already advanced, many coworkers don't know any shell job handling, you're doing fine
centrx has joined #ruby
centrx has joined #ruby
centrx has quit [Changing host]
jhack has quit [Quit: jhack]
<qmr>
any bright ideas for getting all our gems in there?
ur5us has quit [Ping timeout: 256 seconds]
<Papierkorb>
gem inabox my_awesome_gem.gemspec
bkxd has quit [Ping timeout: 260 seconds]
gregf_ has quit [Ping timeout: 260 seconds]
csk has quit [Quit: ZZZzzz…]
<Papierkorb>
Radar: OHAYO SIR
<Radar>
Papierkorb: good morning
SirOliver has quit [Quit: ZZZzzz…]
tusharmalik has quit [Ping timeout: 240 seconds]
tildes has quit [Read error: No route to host]
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
zacts has quit [Ping timeout: 240 seconds]
pragmaticus has quit [Ping timeout: 240 seconds]
yokel has quit [Ping timeout: 260 seconds]
bousquet has quit []
marchelzo has joined #ruby
whathappens has joined #ruby
cdg has quit [Read error: Connection reset by peer]
cdg has joined #ruby
<marchelzo>
hello ruby family
raul782 has quit [Remote host closed the connection]
<Papierkorb>
hello
blackwind_123 has quit [Ping timeout: 240 seconds]
leitz has joined #ruby
JeanCarloMachado has joined #ruby
<marchelzo>
how are you Papierkorb
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
<Papierkorb>
Doing fine atm, on your end?
<marchelzo>
doing ok :)
cdg has quit [Read error: Connection reset by peer]
<leitz>
Same effective result if i do a row.each and puts the k,v pair.
<marchelzo>
i don't see what that's a problem
<marchelzo>
s/what/why/
malconis has quit [Read error: Connection reset by peer]
<leitz>
Because I'm pulling one row with 18 fields and gettng 36 results.
<leitz>
Beacuse if I want to iterate through the hash as a k/v set I have 50% trash.
<Papierkorb>
leitz: Looks like it's mapping from the column id *and* from the column name
<alexandernst>
I'm downloading a file with HTTPClient. And I want to upload each chunk at the same time. I have a StringIO buffer that I use to save the downloaded chunks, but as soon as I start the upload, the download stops (because the upload is blocking): http://pastebin.com/xyi63BUN
<marchelzo>
why would you want to iterate over the columns in a table row? that's not really a sensible operation
<alexandernst>
how can I avoid that?
<leitz>
Papierkorb, agreed. The data, where listed, seems correct. Just not sure why the double listing.
<Papierkorb>
leitz: so allowing both row[6] and row["species"]
hanmac has joined #ruby
<marchelzo>
a row is like a record. in C, would you iterate over members of a struct?
nofxx has joined #ruby
<Papierkorb>
leitz: I don't know the sqlite3 driver on that level (I always just use `sequel`...), but if there's no option to turn that off, you could just #select those entries which have a String as key
jamesaxl has quit [Quit: Leaving]
<leitz>
Papierkorb, is "sequel" a gem that can do SQLite3 databases?
<Papierkorb>
Yeah, it supports many RDBMSes, among them sqlite3 and postgres
<Papierkorb>
It's a full-blown ORM though
mim1k has quit [Ping timeout: 252 seconds]
<toretore>
not really orm the way most people think of it
username_ has quit [Quit: Lost terminal]
<Papierkorb>
I may be biased, but I think it's fantastic and to me, the best ORM I've ever used
<leitz>
Hmm...my needs are pretty small; read the fields, populate a gui, reinsert data.
<toretore>
(unless you want that, in which case you choose to use that part of it)
<Papierkorb>
And if you end up liking it, and you need a small web framework, see Roda :P
* leitz
goes to look up Roda.
despai has joined #ruby
<adam12>
I didn't think I'd take to Roda but I've been enjoying it a lot
<Papierkorb>
made by the same guy, shares the same principles
psychicist__ has quit [Ping timeout: 240 seconds]
nofxx has quit [Remote host closed the connection]
csk has joined #ruby
<leitz>
Actually, that leads to a question. I need to be able to edit fields in the DB, and was thinking of RubyTk. Would Roda be better/easier?
biberu has quit []
<Papierkorb>
But I'm biased, I've been using both in my project template for the last 2 years or so, and still don't regret it
<leitz>
I'm looking for a Ruby solution, a friend is writing the PHP/Apache webstuff for the actual site.
<qmr>
so a gem is a gemspec file? or these trees of source code?
<marchelzo>
why are you reinventing a rdbms front-end?
<Papierkorb>
qmr: A gem has a gemspec file to describe itself, and has source code to actually do something useful. Though "gem" often times also refers to the packaged version of that, which you install through bundler or `gem`
jenrzzz has joined #ruby
cdg_ has joined #ruby
Snickers has quit [Quit: Snickers]
bmurt has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
cdg_ has quit [Read error: Connection reset by peer]
cdg_ has joined #ruby
<Papierkorb>
Make sure you see the web interface qmr. If not, make sure it's not a network routing issue (that is, that IP is reachable from your computer)
<qmr>
I can load webUI and reach that IP fine
<Papierkorb>
did you already upload a gem into it?
tomphp has joined #ruby
<qmr>
I'm just trying to add it as a source, I think
<qmr>
I dropped all the source code repos with our gems in there, not sure if that will work
cdg has quit [Ping timeout: 255 seconds]
<Papierkorb>
You see which gems it hosts on the web interface
<Papierkorb>
if nothing's there, then it doesn't host any
<qmr>
nothing listed in there
last_staff has joined #ruby
jc_io has joined #ruby
ramortegui has quit [Remote host closed the connection]
__Yiota has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Papierkorb>
You have to 1) build a gem 2) and then upload the built .gem archive through the web interface. If you install `geminabox` on your computer, you can also write `gem inabox my_gem.gemspec` instead which does both for you
milardovich has joined #ruby
cschneid_ has quit [Remote host closed the connection]
Lord_of_Life has quit [Excess Flood]
millerti has joined #ruby
<leitz>
Hrmph...can't find "sequel" in the load path. Off to figure it out.
raul782 has quit [Remote host closed the connection]
fuzzyhorns has quit [Quit: Leaving.]
raul782 has joined #ruby
Lord_of_Life has joined #ruby
<Papierkorb>
qmr: hang on, am on phone
Snickers has joined #ruby
jhack has joined #ruby
ddffg has joined #ruby
polishdub has quit [Quit: Leaving]
<leitz>
Hmm...Papierkorb, I now have to lose time on another rabbit trail. Ugh.
al2o3-cr_ has joined #ruby
Fernando-Basso has quit [Quit: WeeChat 1.7]
fredolinhares has joined #ruby
malconis has joined #ruby
brent__ has joined #ruby
JeanCarloMachado has quit [Ping timeout: 240 seconds]
al2o3-cr has quit [Ping timeout: 255 seconds]
<Papierkorb>
leitz: No problem. #ruby's will still be here by that time :)
marxarelli is now known as marxarelli|afk
<Papierkorb>
qmr: Please try then building the .gemspec (`gem build the.gemspec`), and manually upload the .gem file through the web interface. If you already have the .gem from somewhere else, that's fine too
Prepper_Jack has quit [Quit: Leaving]
al2o3-cr_ is now known as al2o3-cr
Guest76152 has joined #ruby
<Guest76152>
9 11 attacks, Did USA do it itself or it just let it happen?
<Guest76152>
Some of the benefits Americans say they achieved after 9 11 attacks include:
<Guest76152>
If al-qaeda did it, why go to kill 2 million Iraqi?
<Guest76152>
Did USA administration murder 3000 American citizen in 9 11 attacks to justify starting a war against iraq?
<Guest76152>
*constant flow of oil, which price is in continuous decline. Trump said he will simply take the Iraqi oil, and when he was told that Iraqi oil belongs to iraq he said there is no iraq(after usa destroyed it ).
<Guest76152>
*Invasion of afghanstan with construction of not less than 14 american military base which give a close eye on china.
<Guest76152>
*Removal of potential threat to isreal represented in iraq which throw isreal with more than 30 rocket after American assault on iraq during 2nd gulf war.
Guest76152 has quit [Excess Flood]
Guest76152 has joined #ruby
<Papierkorb>
!ops
<ruby[bot]>
Papierkorb: ops currently in #ruby: adaedra, aredridel, havenwood, Radar, apeiros, banisterfiend, baweaver, helpa, jhass, matthewd, miah, ruby[bot], zenspider and zzak
Guest76152 has quit [Killed (Sigyn (Spam is off topic on freenode.))]
<baweaver>
freenode got em first
<Papierkorb>
G-lining works too I guess
<baweaver>
that it does.
bkxd has joined #ruby
<qmr>
Invalid gemspec in [./hbase-orm/hbase-orm/hbase-orm.gemspec]: No such file or directory - git
<leitz>
Papierkorb, at this point I'd rather try and figure out the double key printing issue. Not ready to start learning multiple gems yet.
jenrzzz has joined #ruby
<Papierkorb>
leitz: Look at the Enumerable#select method to filter the row
hotpancakes has quit [Remote host closed the connection]
* leitz
goes to read.
hotpancakes has joined #ruby
<Papierkorb>
leitz: To give you an example of usage in your case: `row.select{|key, value| key.is_a?(String)}.to_h`
hotpancakes has quit [Remote host closed the connection]
hotpanca_ has joined #ruby
hotpanca_ has quit [Remote host closed the connection]
hotpancakes has joined #ruby
<Papierkorb>
leitz: important, #select doesn't change `row` (but #select! would). And #to_h gets you back a Hash again. I suggest trying the line without to see what's going on
<Papierkorb>
Huh I thought Hash used #select from Enumerable
<baweaver>
huh
<baweaver>
So way back then
<qmr>
Papierkorb: Ok, after installing git I successfully built and uploaded a gem
<baweaver>
Na, it has it implemented in Hash
<qmr>
doing this manually for 50 gems is going to suck though
<Papierkorb>
leitz: In short, try the line without #to_h, as it's useless in this case
SeepingN has quit [Remote host closed the connection]
yokel has joined #ruby
<Papierkorb>
qmr: shell for loop *cough*
jenrzzz has quit [Ping timeout: 260 seconds]
<qmr>
ok smart guy, give me a shell for loop that tells your browser of choice to upload
SeepingN has joined #ruby
millerti has quit [Quit: My Mac has gone to sleep. ZZZzzz…]
<Papierkorb>
`gem minabox the.gem` should work, if that fails, there's still curl
<qmr>
huh, why is it working now
markholmes has quit [Remote host closed the connection]
jeffreylevesque_ is now known as jeffreylevesque
Xentil has joined #ruby
<qmr>
yes, yes, shiny beautiful gems all up in here. the devs will rejoyce. thanks so much.
__Yiota has joined #ruby
mikeiniowa has quit [Remote host closed the connection]
mikeiniowa has joined #ruby
mim1k has joined #ruby
csk has quit [Quit: ZZZzzz…]
gusrub has quit [Remote host closed the connection]
safetypin has quit [Quit: ZZZzzz…]
gusrub has joined #ruby
<alexandernst>
I'm downloading a file with HTTPClient. And I want to upload each chunk at the same time. I have a StringIO buffer that I use to save the downloaded chunks, but as soon as I start the upload, the download stops (because the upload is blocking): pastebin.com/xyi63BUN . how can I avoid that?
jeffreylevesque has quit [Ping timeout: 240 seconds]
hobodave has quit [Quit: Computer has gone to sleep.]
SeepingN has quit [Quit: The system is going down for reboot NOW!]
Lord_of_Life has quit [Excess Flood]
cpruitt has joined #ruby
cpruitt has quit [Client Quit]
csk157_ has joined #ruby
SeepingN has joined #ruby
Lord_of_Life has joined #ruby
hotpancakes has quit [Remote host closed the connection]
despai has quit [Ping timeout: 260 seconds]
despai has joined #ruby
CloCkWeRX has joined #ruby
csk157_ has quit [Ping timeout: 260 seconds]
bigtawm has quit [Ping timeout: 260 seconds]
fowlduck has joined #ruby
jenrzzz has joined #ruby
jenrzzz has joined #ruby
jenrzzz has quit [Changing host]
TPug has joined #ruby
Snickers has quit [Quit: Snickers]
<leitz>
Papierkorb, the row is a SQLite3::ResultSet::ArrayWithTypesAndFields, and doesn't seem to have a to-h method.
<fowlduck>
is there something like Enumerable#detect that returns the truthy value instead of the element for which the value is truth? Something like [nil, {}, false].method{|i| i } # => {}
Snickers has joined #ruby
<leitz>
I can index the row by index key though.
Snickers has quit [Client Quit]
johnny56_ has quit [Ping timeout: 264 seconds]
Snickers has joined #ruby
<fowlduck>
err, no, my example is bad
Snickers has quit [Client Quit]
Snickers has joined #ruby
Snickers has quit [Client Quit]
Snickers has joined #ruby
<fowlduck>
[1, 2, 3].detect{|id| Account.where(:id => id).first } # => returns the first found Account object (it's more complicated than that but this is good enough)
Snickers has quit [Client Quit]
Snickers has joined #ruby
jose_leeto has quit [Quit: Leaving.]
marxarelli|afk is now known as marxarelli
<Radar>
fowlduck: what do you expect to be returned there?
Snickers has quit [Client Quit]
<fowlduck>
I'm looking for a method that does that, I know it's not Enumerable#detect
<Papierkorb>
leitz: If not, it's a fantastic REPL for ruby. `gem install pry pry-{coolline,toys,doc,rescue}` for a full blown version, then start it with `pry`, require sqlite3, and do a request against your DB to get a `row`. Then do `ls row` to see not only what it is, but also, what it can do
<Papierkorb>
leitz: Trust me, it'll be worth your time, makes it much much faster to dig through libraries and things
cschneid_ has joined #ruby
<leitz>
Papierkorb, won't completely work. Remember, I'm the guy with ancient Ruby. pry-cooline requires 1.9.1
nckpz has quit [Ping timeout: 260 seconds]
<marchelzo>
i like to reflect and think of one ruby feature i'm grateful for each day. usually something that came in handy recently. do you guys want to participate?