apeiros changed the topic of #ruby to: Ruby 2.0.0-p247: http://ruby-lang.org (Ruby 1.9.3-p448) || Paste >3 lines of text on http://gist.github.com
yshh has quit [Remote host closed the connection]
ryan_GPX has joined #ruby
<ryan_GPX> Simple question - How can I do a regex no-match check? Like if var =~ /rgx/, but the opposite?
<ryan_GPX> !~ ?
Spooner has quit [Remote host closed the connection]
wargasm has joined #ruby
staafl has joined #ruby
ravster has joined #ruby
<RubyPanther> I dunno, can you? I can.
madumo has joined #ruby
cmarques has quit [Ping timeout: 276 seconds]
<lnormous> He said How
i_s_ has quit [Remote host closed the connection]
<RubyPanther> what I do is, I open the manual every time I write a regex.
guiocavalcanti has joined #ruby
kzrl has quit [Ping timeout: 264 seconds]
emergion has quit [Quit: Computer has gone to sleep.]
<RubyPanther> you have to be trying to do it, and failing, first.
freeayu has joined #ruby
zeromodulus has quit [Remote host closed the connection]
<ryan_GPX> jesus
<ryan_GPX> yes or no, guy
jp- has joined #ruby
madumo has quit [Client Quit]
sailias has joined #ruby
madumo has joined #ruby
babykosh has joined #ruby
bigoldrock has quit [Ping timeout: 268 seconds]
popl has joined #ruby
<babykosh> ruby gods….so I have an Array like so…[[-1, 2], [-1, 0], [-1, 0], [-1, 8], [-1, 2]]
<babykosh> so how to extract duplicate inner [1] values?
mikeg has quit [Remote host closed the connection]
Burnninator has quit [Quit: Leaving]
<Eiam> I don't see any inner [1] values
wmoxam has joined #ruby
<babykosh> I'm reffering to the '0' in the second and third inner arrays
<Eiam> how are those duplicates but all the -1's are not?
<Eiam> or the 2s?
Guest42633 is now known as fred
mgorbach has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<babykosh> I'm only interested in the fact that 0 repeats…I need to know what incantation will look at this main Array and say…you have two '0's
tomzx_mac has quit [Ping timeout: 245 seconds]
fred is now known as Guest26795
<Eiam> babykosh: you mean if they occur back to back?
mgorbach has joined #ruby
<babykosh> yes
<Eiam> babykosh: so that can be possible for any element?
<Eiam> e.g. [[1,1][1.2]] does 1 count as occurring back to back?
<babykosh> ah and apologies I didn't see the repeating 2 at the end
brianpWins has quit [Quit: brianpWins]
<Eiam> babykosh: okay... I don't think you've adequately explained your desired output & well defined the input here. For a given array, you want to pull *out* any value that occurs more than once, and get back what? the array with the value removed? the values that occurred more than once?
<babykosh> ah more like this...
nanothief has joined #ruby
<babykosh> [[-1, 2], [-1, 0], [-1, 0], [-1, 8]]
<babykosh> some code… answer => 0
randomautomator has joined #ruby
<babykosh> hope that is better
npulse has joined #ruby
<popl> not really
<babykosh> hmmm, trying to locate any repeating second element…all the first elements will be -1
<popl> is the depth of the list consistent?
<babykosh> and then have that second element value returned
<popl> you don't have something like [[-1, [-1, 0]], [-1, 0]] or anything like that?
<babykosh> nope it's always something like…[[-1, 2], [-1, 0], [-1, 0], [-1, 8]]
randomau_ has quit [Ping timeout: 248 seconds]
rupee has joined #ruby
randomautomator has quit [Ping timeout: 256 seconds]
Derander has quit [Quit: ZNC - http://znc.sourceforge.net]
Lindrian has left #ruby ["Leaving"]
anonymuse has quit [Remote host closed the connection]
anonymuse has joined #ruby
mary5030 has joined #ruby
staafl_alt has joined #ruby
marr has quit [Ping timeout: 246 seconds]
RichardBaker has quit [Quit: RichardBaker]
ssvo has quit [Ping timeout: 256 seconds]
thams has quit [Quit: thams]
locriani has quit [Remote host closed the connection]
johnkary has joined #ruby
<Eiam> okay
ryan_GPX has quit [Quit: Leaving.]
<Eiam> >> temp = [[-1, 2], [-1, 0], [-1, 0], [-1, 8]].map{|a,b| b} ; var x = []; [[-1, 2], [-1, 0], [-1, 0], [-1, 8]].map{|a,b| b}.each_with_index{|a,index| a==temp[index+1] ? x.push(a) : '' }
<eval-in> Eiam => undefined method `var' for main:Object (NoMethodError) ... (https://eval.in/38427)
hogeo has joined #ruby
<Eiam> >> temp = [[-1, 2], [-1, 0], [-1, 0], [-1, 8]].map{|a,b| b} ; x = []; [[-1, 2], [-1, 0], [-1, 0], [-1, 8]].map{|a,b| b}.each_with_index{|a,index| a==temp[index+1] ? x.push(a) : '' }
<eval-in> Eiam => [2, 0, 0, 8] (https://eval.in/38428)
<Eiam> >> temp = [[-1, 2], [-1, 0], [-1, 0], [-1, 8]].map{|a,b| b} ; x = []; [[-1, 2], [-1, 0], [-1, 0], [-1, 8]].map{|a,b| b}.each_with_index{|a,index| a==temp[index+1] ? x.push(a) : '' }; x
<eval-in> Eiam => [0] (https://eval.in/38429)
anonymuse has quit [Ping timeout: 268 seconds]
<Eiam> there.
<Eiam> I'm not proud of that solution but I've gotta jet in 2 minutes so fuck it =)
<popl> eek
jonathanwallace has quit [Ping timeout: 246 seconds]
<Eiam> popl: lol shut up ;)
staafl has quit [Quit: Leaving]
<Eiam> "works for the given use case"!
Bry8Star{T2 has joined #ruby
johnkary has quit [Client Quit]
<babykosh> I "see" where you are going…I can follow
<babykosh> thank you much
jonathanwallace has joined #ruby
gstamp has quit [Read error: Connection reset by peer]
<Eiam> thats really bad code dude, ugh. it shouldn't use an intermediate array, or two variables, and its super fragile..
<Eiam> christ. I'm not rewriting it, but w/e.
amacgregor has quit [Read error: Connection reset by peer]
wsterling has joined #ruby
<Eiam> babykosh: based on your criteria, I don't give a shit about the first value in any array, so I drop them. obviously I go out of bounds at the end, but that just returns a nil to compare against which will be false.
DonRichie has quit [Ping timeout: 264 seconds]
<Eiam> k heading home. good luck.
<babykosh> domo
DanKnox is now known as DanKnox_away
DonRichie has joined #ruby
mgorbach has quit [Quit: Textual IRC Client: www.textualapp.com]
<popl> I'm working on a much nicer solution so if you wait around I will give it to you.
jhn has joined #ruby
<popl> I am halfway there
<Eiam> popl: inline my name in the response so I can check it out tomorrow. cheers.
<Eiam> its totally doable in a nicer way.
gstamp has joined #ruby
wsterling has quit [Ping timeout: 245 seconds]
Gooder has quit [Read error: Connection reset by peer]
Gooder` has joined #ruby
<babykosh> @popl coolness
jp- has quit [Quit: OK, I believe you… but my tommy gun don't]
mary5030 has quit [Remote host closed the connection]
<pontiki> babykosh: 2.0.0p247 :003 > [[-1, 2], [-1, 0], [-1, 0], [-1, 8]].count{|x| x.last==0} => 2
<pontiki> ?
<pontiki> that what you want?
<pontiki> or ?
Gooder` has quit [Read error: Connection reset by peer]
kobain has joined #ruby
Gooder` has joined #ruby
<pontiki> i probably am missing something
ckrailo has quit [Quit: Computer has gone to sleep.]
<popl> no, he wants the actual values that are repeated pontiki
<babykosh> hmm almost….I wont have any knowledge of the repeating number….that is in fact what I'm trying to tease out
<pontiki> ah so
<pontiki> oh, repeated, not the 0
<pontiki> well
<popl> yes, the 0
<popl> I was going to use transpose
<pontiki> 2.0.0p247 :004 > [[-1, 2], [-1, 0], [-1, 0], [-1, 8]].select{|x| x.last==0} => [[-1, 0], [-1, 0]]
<pontiki> that?
<popl> >> [[-1, 2], [-1, 0], [-1, 0], [-1, 8]].transpose[-1]
<eval-in> popl => [2, 0, 0, 8] (https://eval.in/38430)
<popl> then find the repeated values from that
<popl> so not 2 or 8 but 0
<popl> presumably the values will change
<popl> I can't think of a way to check for repeats without using a temp variable
freerobby has quit [Quit: Leaving.]
<popl> babykosh: if you have a question just ask in the channel please
_seanc_ has quit [Ping timeout: 248 seconds]
mootpointer has joined #ruby
<babykosh> ok
mootpointer has quit [Client Quit]
rupee has quit [Quit: Leaving]
tjbiddle_ has joined #ruby
<popl> babykosh: did your IRC client tell you that I wasn't getting your messages?
<babykosh> negative
<popl> ah. then it sucks. :)
<babykosh> hahahaha
osvico has joined #ruby
<babykosh> or I'm just bad at using it
<popl> I am +g so I have to whitelist people for them to be able to message me.
<babykosh> ah
colonolGron has quit [Quit: Lost terminal]
mootpointer has joined #ruby
<babykosh> going into irb…one sec
tjbiddle has quit [Ping timeout: 256 seconds]
tjbiddle_ is now known as tjbiddle
ZOGM has joined #ruby
lnormous has quit [Ping timeout: 256 seconds]
<pontiki> you have to do either some kind of look-ahead, or save... or multiple passes
<pontiki> assuming the duplicated bits could be anywhere, not adjacent?
<popl> my understanding is they need to be adjacent, pontiki
<pontiki> ah ok
hamakn has joined #ruby
<pontiki> hmm
iliketurtles has quit [Quit: zzzzz…..]
hamakn has quit [Read error: Connection reset by peer]
ultimoo_ has joined #ruby
hamakn has joined #ruby
ChristianS has joined #ruby
<pontiki> and just the second values or the array element?
zero7 has joined #ruby
tjbiddle_ has joined #ruby
BRMatt has quit [Read error: Operation timed out]
tjbiddle has quit [Ping timeout: 246 seconds]
tjbiddle_ is now known as tjbiddle
ultimoo has quit [Ping timeout: 276 seconds]
ultimoo_ is now known as ultimoo
Spami has quit [Quit: This computer has gone to sleep]
madumo has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
burlyscudd has joined #ruby
shouya has quit [Ping timeout: 246 seconds]
zeropx has quit [Quit: has left the room … Or did he?]
lindenle_ has quit [Quit: This computer has gone to sleep]
yshh has joined #ruby
<pontiki> *shrug*
<popl> >> dupes = []; last = nil; [[-1, 2], [-1, 0], [-1, 0], [-1, 8], [-1, 2]].transpose[-1].each{|x| dupes.push(x) if x == last; last = x}
<eval-in> popl => [2, 0, 0, 8, 2] (https://eval.in/38431)
<Fuzai> Hi, could someone help me with some regex, i'm trying to extract data from a random place in a string that is surrounded by '<b> </b>'
<popl> >> dupes = []; last = nil; [[-1, 2], [-1, 0], [-1, 0], [-1, 8], [-1, 2]].transpose[-1].each{|x| dupes.push(x) if x == last; last = x}; dupes
<eval-in> popl => [0] (https://eval.in/38432)
<popl> is that an OK solution?
swordsmanz_ has joined #ruby
swordsmanz has quit [Read error: Connection reset by peer]
swordsmanz_ is now known as swordsmanz
tomzx_mac has joined #ruby
NickTemp1 has joined #ruby
<popl> Eiam: I just found a solution.
burlyscudd has quit [Ping timeout: 246 seconds]
<babykosh> yes
<babykosh> thank you
<popl> now learn ruby!
<pontiki> lol
<pontiki> there's probably a way to map/reduce it too
<babykosh> lol
<pontiki> seems like there always is
<popl> hang on, you may be on to something
NickTemp1 has left #ruby [#ruby]
<pontiki> i was avoiding it waiting to see what babykosh came up with
<popl> no #reduce for Array?
<pontiki> it's lower level than that
<pontiki> it's on enumerable
<popl> ok thanks
<pontiki> Enumerable
<pontiki> blah
<pontiki> lazy me
dirtyzero has joined #ruby
madumo has joined #ruby
tobyo1 has joined #ruby
<popl> >> dupes = []; [[-1, 2], [-1, 0], [-1, 0], [-1, 8], [-1, 2]].transpose[-1].reduce{|lhs, rhs| dupes.push(lhs) if lhs == rhs}; dupes
<eval-in> popl => [] (https://eval.in/38434)
<popl> \o/
tobin has quit [Quit: tobin]
<popl> oh crap I meant inject
<pontiki> same same
shouya has joined #ruby
<popl> >> dupes = []; [[-1, 2], [-1, 0], [-1, 0], [-1, 8], [-1, 2]].transpose[-1].inject{|lhs, rhs| dupes.push(lhs) if lhs == rhs}; dupes
<eval-in> popl => [] (https://eval.in/38435)
<popl> I fucking rock.
aeontech has joined #ruby
lindenle has joined #ruby
<popl> ahhh
<r0bglees0n> that doesn't work
<popl> >> dupes = []; [[-1, 2], [-1, 0], [-1, 0], [-1, 8], [-1, 2]].transpose[-1].inject{|lhs, rhs| dupes.push(lhs) if lhs == rhs; lhs = rhs}; dupes
gildo has joined #ruby
<eval-in> popl => [0] (https://eval.in/38436)
<popl> that does
rubyguy has joined #ruby
<r0bglees0n> yah, but its terrible
grumpwork has quit [Remote host closed the connection]
<r0bglees0n> id never use that in production code
<popl> probably not. what would you use?
<r0bglees0n> probably just use #each.
johnnyfuchs has quit [Remote host closed the connection]
yacks has quit [Ping timeout: 246 seconds]
<popl> you mean initially, then check index 1 for repeats?
<r0bglees0n> your example just isn't a good use case for inject/reduce.
dankest has quit [Quit: Peace]
baroquebobcat has joined #ruby
<pontiki> mines a leedle diff:
<pontiki> >> last=nil;[[-1, 2], [-1, 0], [-1, 0], [-1, 8]].reduce([]){|m,o| m<<o.last if o.last==last; last=o.last;m}
<eval-in> pontiki => [0] (https://eval.in/38437)
<popl> r0bglees0n: ok. I understand that. I'm asking how you would do it in production code.
<popl> :)
<pontiki> still a bit too crunchy for me
nfkd has joined #ruby
Anarch has quit [Ping timeout: 268 seconds]
<r0bglees0n> popl: [[1,1],[1,1]].flatten.uniq
<popl> but that's not what he's looking for
<r0bglees0n> what does he want?
<r0bglees0n> the duplicates?
<popl> the repeats
<pontiki> only the adjacent duplicates of the last value in each subarray
<popl> pontiki++
<pontiki> and it's not a good usecase for reduce, but i love making reduce do my bidding :)
<r0bglees0n> pontiki: ah ok,first step: stop using inject
<popl> me too
<pontiki> pfft
<r0bglees0n> it a retarded idea to use for this
Zeeraw has quit [Quit: Computer has gone to sleep.]
<popl> I was just toying with it r0bglees0n
<pontiki> stop using "retarded" in that fashion
<popl> also I'm still learning ruby
<r0bglees0n> popl: i'm not griping on you, just the idea.
<r0bglees0n> pontiki: if you dont like it, tough?
Anarch has joined #ruby
henn has quit [Ping timeout: 248 seconds]
<Quadlex> A much better word is "enterprise"
<popl> r0bglees0n: when is a good time to use inject?
sailias has quit [Ping timeout: 246 seconds]
<r0bglees0n> i guess a common one is
<Quadlex> Java answer: "When the design pattern requires it"
<r0bglees0n> >> [1,2,2,3].inject(&:+)
<eval-in> r0bglees0n => 8 (https://eval.in/38438)
<Quadlex> Ruby answer: "When it makes your code more readable"
<popl> how is inject different from reduce?
<r0bglees0n> its not, they're aliases.
<popl> nevermind I'll look at the implementation
<popl> ah
<popl> ok
<Kelet> Late to the conversation but what about something like this:
<Kelet> >> [[-1, 2], [-1, 0], [-1, 0], [-1, 8]].each_cons(2) { |e1, e2| puts e2.last if e1.last == e2.last }
<eval-in> Kelet => 0 ... (https://eval.in/38439)
<popl> r0bglees0n: thanks
<popl> I was going to fucking use each_cons too
<popl> :)
<Kelet> I've found it was a nice pattern to avoid each_with_index
<Kelet> when you need to look one forward or something
tjbiddle has quit [Quit: tjbiddle]
jhn has quit [Ping timeout: 256 seconds]
<Kelet> Just goes to show you, a million ways to do one thing in Ruby
<popl> like Perl in that respect
<popl> *it's like
<pontiki> it's the best part
<pontiki> so i'd really like to know, where are the rules about when to use reduce and when not to described?
<pontiki> why is one a bad use case and another not?
mootpointer has quit [Quit: Computer has gone to sleep.]
<r0bglees0n> use inject when it makes sense?
jonkri has quit [Quit: jonkri]
<pontiki> and when is that?
wmoxam has quit [Ping timeout: 246 seconds]
ultimoo has quit [Quit: ultimoo]
tommyvyo has quit [Quit:]
<r0bglees0n> pontiki: do you know what inject does?
<pontiki> i think i just showed it
<pontiki> so yes
tkuchiki has joined #ruby
<r0bglees0n> why do you think that makes sense for finding duplicates?
<pontiki> why do you think it doesn't -- you made the claim
<pontiki> you defend it
<r0bglees0n> well, inject() applies an operation to all elements in an Enumerable, collectively building the object on each iteration, and returns the result
<r0bglees0n> does that sound like something you'd use for finding duplicates
<pontiki> if you are building an array of the duplicates, yes
pitzips has quit [Ping timeout: 240 seconds]
<r0bglees0n> no, you'd just build an array and append to it in an iteration
<r0bglees0n> inject() is expensive
<r0bglees0n> don't use it unless for its purpose
mrsolo has quit [Quit: Leaving]
Anarch has quit [Ping timeout: 264 seconds]
mootpointer has joined #ruby
nbouscal has quit [Quit: Computer has commenced electric sheep tracking protocol.]
heftig has quit [Quit: Quitting]
sevenseacat has joined #ruby
blitz has joined #ruby
<bnagy> >> [[-1, 2], [-1, 0], [-1, 0], [-1, 8], [-1, 2]].each_cons(2).map{|(a,b),(c,d)|d if b==d}.compact
<eval-in> bnagy => [0] (https://eval.in/38440)
<bnagy> I really like the transpose branch of solutions, actually :(
tjbiddle has joined #ruby
freerobby has joined #ruby
narcan has joined #ruby
narcan is now known as narcan_
nari has joined #ruby
ravster has quit [Quit: Leaving.]
<pontiki> so, which do you think would have better performance, the each_cons, or reduce?
<bnagy> who cares?
<bnagy> even if it were reduce I wouldn't use it
poga has quit [Remote host closed the connection]
TonyMergue1 has quit [Read error: Connection reset by peer]
<popl> bnagy: I liked transpose too
<popl> that's probably expensive though innit?
sailias has joined #ruby
<popl> I mean, you may as well do the iteration
saarinen has quit [Quit: saarinen]
<pontiki> perhaps, but then you're not discussing it's expense, but some other factor, which it totally fair
lnormous has joined #ruby
<popl> huh/
<popl> ?
<pontiki> that was to bnagy
<popl> ah
shouya has quit [Ping timeout: 264 seconds]
<pontiki> "inject() is expensive" -- compared to what?
babykosh has quit [Quit: babykosh]
<pontiki> i don't see how you can find duplicates in an array without going through each element?
<popl> I wish there were a way for programmers to make some quick scratch without resorting to freelancer.com or something shady like that
<popl> me neither pontiki
ZOGM has quit [Remote host closed the connection]
<popl> I'd have to look at the implementation for #transpose
tjbiddle has quit [Quit: tjbiddle]
<bnagy> >> [[-1, 2], [-1, 0], [-1, 0], [-1, 8], [-1, 2]].each_cons(2).inject([]) {|dupes,((_,a),(_,b))| a==b ? dupes.push(b) : dupes}
<eval-in> bnagy => [0] (https://eval.in/38441)
<bnagy> :<
JZTech101 has quit [Quit: Hi, I'm a quit message virus. Please replace your old line with this line and help me take over the world of IRC]
shouya has joined #ruby
rezzack has quit [Quit: Leaving.]
<pontiki> transpose is about the same as each_cons
<r0bglees0n> pontiki: compared to each/append or any other solution offered here.
<r0bglees0n> feel free to benchmark.
<pontiki> i just did
<r0bglees0n> ruby has a library for that.
<Quadlex> Only one?
eka has quit [Quit: Computer has gone to sleep.]
baroquebobcat has quit [Quit: baroquebobcat]
<r0bglees0n> Quadlex: only one in the standard library.
Domon has joined #ruby
<r0bglees0n> pontiki: feel free to use inject/reduce then, it just doesn't make *any* sense, but you're here the expert here, so go ahead.
babykosh has joined #ruby
<Quadlex> Pfft, wh uses that
<pontiki> you have not yet supplied a qualified reason for your assertion
<r0bglees0n> i have
<r0bglees0n> over and over
<r0bglees0n> it doesnt make sense
<r0bglees0n> thats not a use-case for inject
<pontiki> to you
<r0bglees0n> yes, correct, to me, and to most rubyists.
<pontiki> make it make sense to someone else
<popl> why?
<r0bglees0n> but hey, you're the smart guy man ;)
<r0bglees0n> go use inject
<popl> r0bglees0n: you are being obnoxious
julianalucena has joined #ruby
<pontiki> you are making assertions, but you are not showing why those assertions are so
<pontiki> data man
<r0bglees0n> popl: i just dont tolerate stubborn idiots very well
<pontiki> show me the data
<r0bglees0n> ive explained over & over
<pontiki> DATA
<pontiki> no data yet
<pontiki> just your opinion
<popl> I haven't seen an explanation.
<r0bglees0n> because it doesn't make sense, guys
<r0bglees0n> its not a use case for inject/reduce
<popl> ok.
<pontiki> you have only repeated yourself
<r0bglees0n> thats all there is to it
DanKnox_away is now known as DanKnox
haxrbyte_ has quit [Remote host closed the connection]
<pontiki> no it's not
<pontiki> really
haxrbyte has joined #ruby
<pontiki> it is not
<popl> why does it not make sense?
<pontiki> you said it's expensive
ogew2 has joined #ruby
<pontiki> HOW is it expensive?
<pontiki> not in time
<pontiki> space?
<r0bglees0n> pontiki: ok, you're right
<r0bglees0n> use inject
<r0bglees0n> i dont care anymore
guiocavalcanti is now known as guiocavalcanti_o
<popl> I think r0bglees0n is talking out of his ass
<bnagy> >> a=[[-1, 2], [-1, 0], [-1, 0], [-1, 8], [-1, 2]];a.map(&:last).select.with_index {|e,i| e==a[i-1].last if i > 0}
<eval-in> bnagy => [0] (https://eval.in/38442)
guiocavalcanti_o is now known as guiocavalca_off
<r0bglees0n> popl: yup, 5 years ruby experience, must be!
<popl> r0bglees0n: I'm over here trying to learn and you're just giving me tautologies dude
<pontiki> 8 years ruby experience, much longer with smalltalk, even *longer* with lisp
headius has joined #ruby
<lnormous> r0bglees0n: He's not saying you're wrong, just asking for a bit of an explanation...
<r0bglees0n> popl: it's about right tool for the right job
ogew2 has left #ruby [#ruby]
<popl> r0bglees0n: save the dogma
<pontiki> if we're merely using length use as an authoritative measure
<bnagy> select with index I win!
<bnagy> I'm sure that was a rule I read
<r0bglees0n> pontiki: 8 years with ruby?
<r0bglees0n> pontiki: i doubt it
<r0bglees0n> you have noob written all over you
<pontiki> lol
<popl> heh
<popl> this is childish
<pontiki> you have male arrogant prick written all over you as well
<r0bglees0n> sure, i dont deny that, but im only a prick if you're an absolute idiot
thams has joined #ruby
<pontiki> i'm only an absolute idiot when you can't explain something
julianalucena has quit [Remote host closed the connection]
<r0bglees0n> ok, what's your question? I will explain *once*.
<popl> maybe he's afraid to admit he doesn't know
<popl> some people have that problem
<r0bglees0n> popl: i have given my answer to you and pontiki _over and over_
<r0bglees0n> you just ignore it
smathieu has quit [Remote host closed the connection]
drfreeze has quit [Ping timeout: 260 seconds]
<pontiki> repeating the same words over and over with no underlying data or corroboration is just being the jerk in the corner table
<r0bglees0n> ok
<r0bglees0n> what is confusing/vague about my answer
<popl> I think it's obvious, and I think you're trolling.
<pontiki> you say "it's not a use case for reduce/inject" and "inject() is expensive"
<r0bglees0n> correct
dhruvasagar has quit [Ping timeout: 246 seconds]
<popl> fuck this, I'll just read the implementation :)
<pontiki> why not, and how is it expensive, and compared to what? the benchmark shows it's less expensive than either each_cons or the transpose
lutfidemirci has joined #ruby
<bnagy> which each_cons? that's surprising
<bnagy> can you pastie?
drfreeze has joined #ruby
<bnagy> huh, weird
ColKurtz has quit [Quit: Textual IRC Client: www.textualapp.com]
nbouscal has joined #ruby
shouya has quit [Ping timeout: 248 seconds]
<r0bglees0n> bnagy: can you run that bench?
<r0bglees0n> reduce() is slower here
james_ has joined #ruby
<r0bglees0n> and i dont trust that moron very much.
james_ is now known as Guest62344
<krainboltgreene> Woah.
<krainboltgreene> What the hell is going on?
<popl> someone's being an asshat
mansi has joined #ruby
<bnagy> I get transpose fastest by a margin
<bnagy> but not as much as I thought
<krainboltgreene> MINASAW.
<r0bglees0n> popl: i'm not, i'm trying to give you good advice, to make you write better code, and for that i'm an asshole.
jonathanwallace has quit [Ping timeout: 246 seconds]
mikepack has quit [Remote host closed the connection]
Radar has joined #ruby
<popl> r0bglees0n: no, you're an asshole because you're calling people idiots
tommyvyo has joined #ruby
<bnagy> oh transpose uses inject anyway
<popl> there's no reason for that
Encosi has joined #ruby
tommyvyo has quit [Changing host]
tommyvyo has joined #ruby
<popl> *being an asshole
<pontiki> updated with bnagy's select.with_index: https://gist.github.com/tamouse/dbcea4dac11ecd605428
guiocavalca_off has quit [Remote host closed the connection]
<lnormous> pontiki: I get the same ordering as you
shouya has joined #ruby
<Radar> Guys, cut the crap. This is Ruby, not PHP.
guiocavalca_off has joined #ruby
charliesome has joined #ruby
<Kelet> Funny - for me, the transpose one is quite a bit faster than the rest.
<Kelet> And I've run it a number of times
<r0bglees0n> reduce is slowest for me every time
<r0bglees0n> and i ran it 10 times
* Kelet shrugs
<Kelet> Micro-optimization premature optimization grumble grumble
adeponte has quit [Remote host closed the connection]
<popl> indeedy
<r0bglees0n> performance isn't really the main factor
<r0bglees0n> it's just that using reduce/inject for this makes no sense
<bnagy> that's better
guiocava_ has joined #ruby
guiocavalca_off has quit [Read error: Connection reset by peer]
<bnagy> except I suck
<charliesome> bnagy: instead of: a.each_cons(2) { |e1, e2| dups << e2.last if e1.last == e2.last }
<charliesome> bnagy: a.each_cons(2) { |(*,e1), (*,e2)| dups << e2 if e1 == e2 }
<charliesome> that is possible too
x1337807x has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
locriani has joined #ruby
<popl> bnagy: you're doing findup3 twice
<bnagy> yep, that's why I said I suck :)
<popl> I figured
<popl> .
<popl> :)
<bnagy> there's no way that crazy last one should have been in the race
<r0bglees0n> oh huh so inject is slower?
<r0bglees0n> someone said that earlier.. hm
<bnagy> no, sadly
<headshot> heh, interesting your numbers are different
<popl> yeah
<popl> bnagy: can you repost that?
shouya has quit [Ping timeout: 256 seconds]
<popl> s/can/will/
dawkirst has quit [Ping timeout: 264 seconds]
<headshot> it would be interesting to see the numbers running the same test four times
<headshot> because that's suspicious
iliketurtles has joined #ruby
kofno has joined #ruby
willbradley has joined #ruby
nfk has quit [Quit: yawn]
<bnagy> you winrar!
burlyscudd has joined #ruby
johnnyfuchs has joined #ruby
<charliesome> bnagy: lol shit i glanced over the each_cons2 one
<charliesome> lol
osvico has quit [Ping timeout: 256 seconds]
gildo has quit [Ping timeout: 246 seconds]
<bnagy> it's a bit wack because there are two inject tests
johnnyfuchs has quit [Remote host closed the connection]
<bnagy> looks like last is really costly? o_0
sleetdrop has joined #ruby
locriani has quit [Remote host closed the connection]
Mattix has joined #ruby
<popl> hm
locriani has joined #ruby
wesside has joined #ruby
sleetdrop has quit [Client Quit]
<bnagy> in other news, pontiki has a really fast computer :P
Es0teric has quit [Quit: Computer has gone to sleep.]
burlyscudd has quit [Ping timeout: 264 seconds]
blz7337 has quit [Ping timeout: 250 seconds]
jarin has quit [Quit: Textual IRC Client: http://www.textualapp.com/]
<popl> :(
niklasb has quit [Ping timeout: 264 seconds]
mary5030 has joined #ruby
nitish has joined #ruby
nitish has joined #ruby
nitish has quit [Changing host]
<popl> my c2d is stuck at 800MHz
sleetdrop has joined #ruby
sailias has quit [Ping timeout: 246 seconds]
shouya has joined #ruby
<bnagy> but now nothing is making sense to me, cause the results for charliesome's one are inverted
Davey has quit [Quit: Computer has gone to sleep.]
dhruvasagar has joined #ruby
<bnagy> ok I'd better stop myself before I go looking at the rubyinline docs again
<popl> bnagy: DO IT
cgore has quit [Read error: Connection reset by peer]
<popl> yeah, i5
<popl> suck it :)
marcdel has joined #ruby
<popl> i5 is pretty neat
<popl> i7 is sweet
<popl> nehalem++
cibs_ has joined #ruby
Guest62344 has quit [Ping timeout: 246 seconds]
<popl> sandy bridge is even nuttier
<bnagy> oh, the transpose one doesn't actually work, does it?
<popl> I didn't even bother checking bnagy
<bnagy> yeah it's broken
mmitchell has joined #ruby
matti has quit [Quit: Reconnecting]
matti has joined #ruby
<bnagy> wait
matti has quit [Changing host]
matti has joined #ruby
<bnagy> oh god no, it's not even actually using inject properly
Guest2011 has joined #ruby
<headshot> bnagy, which jruby version are you running?
<bnagy> like it works
<bnagy> 1.7.5dev
cibs has quit [Ping timeout: 256 seconds]
Guest57220 has quit [Ping timeout: 256 seconds]
<popl> bnagy: no, you need to assign rhs to lhs
sleetdrop has quit [Quit: Textual IRC Client: www.textualapp.com]
<popl> at least that's how I did it waaaay up there ^
radic_ has joined #ruby
cibs has joined #ruby
shouya has quit [Ping timeout: 248 seconds]
cibs_ has quit [Ping timeout: 256 seconds]
cads has joined #ruby
Rubba has joined #ruby
radic__ has quit [Ping timeout: 260 seconds]
<Rubba> what's an elegant way to convert array ["a","b","c"] to string ('a','b','c') ?
<bnagy> yeah, it is broken after all
smathieu has joined #ruby
<bnagy> Rubba: I'm not sure exactly what string you want
<Rubba> "('a','b','c')"
babykosh has quit [Quit: babykosh]
guiocava_ has quit [Remote host closed the connection]
agarie has joined #ruby
<Rubba> basically list all array's elements surrounded with single quotes, comma-delimited, and enclosed in paranthesis
guiocavalca_off has joined #ruby
<bnagy> I don't think it's going to be pretty
<Rubba> :( shame
<Rubba> thought ruby was good at this kinda stuff :d
DanKnox is now known as DanKnox_away
<popl> what kind of stuff?
<bnagy> >> "(#{["a","b","c"].map {|e| "'#{e}'"}.join(",")})"
<eval-in> bnagy => "('a','b','c')" (https://eval.in/38443)
Mattix has quit [Ping timeout: 245 seconds]
<Rubba> i'm a noob at ruby, is #{} evaluating the enclosed code?
<bnagy> >> a=%w(a b c); "(#{a.map {|e| "'#{e}'"}.join(",")})"
<eval-in> bnagy => "('a','b','c')" (https://eval.in/38444)
<bnagy> easier to read that way
<lnormous> Rubba: inside a string?
<bnagy> yeah #{} is string interpolation
DanKnox_away is now known as DanKnox
zeade has joined #ruby
Evixion has quit [Ping timeout: 240 seconds]
<Rubba> bnagy what happens to the double quotes around each element?
smathieu has quit [Ping timeout: 248 seconds]
<Rubba> #{e} 'strips' them?
<bnagy> they're not there
<bnagy> they're only there when the interpreter inspects that array for you
<r0bglees0n> Rubba: "" is just syntax for ruby to create a string object.
<Rubba> i see
<Rubba> thanks :D
<r0bglees0n> same as [], {}, they're object literals.
sailias has joined #ruby
<Rubba> if i don't want to transform my original array though, should i just duplicate it?
<bnagy> that won't touch your original array
<Rubba> oh wait it's not map!
guiocavalca_off has quit [Ping timeout: 264 seconds]
<Rubba> right, thanks
<bnagy> well it will touch it, just not in a catholic priest way
<r0bglees0n> oh god you didnt
<popl> you mean the best kind of way
<r0bglees0n> lol
jp- has joined #ruby
RichardBaker has joined #ruby
<popl> eventually something I say online will be taken out of context and I will be arrested and held on $500k bail.
<bnagy> I had to, r0bglees0n is like hundreds of asshole points ahead of me today and it's not even noon local
<r0bglees0n> hahahaha
robustus has quit [Ping timeout: 248 seconds]
staafl_alt has quit [Ping timeout: 276 seconds]
mahmoudimus has quit [Quit: Computer has gone to sleep.]
DanKnox is now known as DanKnox_away
freerobby has quit [Quit: Leaving.]
robustus has joined #ruby
agarie has quit [Remote host closed the connection]
alx- has joined #ruby
alx- has quit [Client Quit]
Anarch has joined #ruby
<Rubba> can i use the same |name| in multiple blocks?
<r0bglees0n> name is block local.
<bnagy> btw whoever wrote a.reduce([]){|m,o| m << o.last if o.last==last; last=o.last;m} with an external last var
<bnagy> a.reduce([[],nil]){|(accum,last),o| accum << o.last if o.last==last; [accum,o.last]}[0]
<bnagy> which is still more reason to hate inject imho, but anyways
spike|spiegel has quit [Read error: Operation timed out]
DanKnox_away is now known as DanKnox
<bnagy> but if you're going to use it, having an external last is tacky as heck
<popl> heck!
freeayu has quit [Ping timeout: 248 seconds]
<popl> gee willikers
blackmesa has quit [Ping timeout: 240 seconds]
<popl> :)
hamakn has quit [Remote host closed the connection]
<iliketurtles> if I do this: 'abcdefghij'.scan(/.{2}/).combination(2).to_a, is there an easy way to limit the number of iterations?
hamakn has joined #ruby
zeade has quit [Quit: Leaving.]
goleldar has quit [Ping timeout: 264 seconds]
<bnagy> iterations of what?
<bnagy> isn't that just the size of the array?
spike|spiegel has joined #ruby
goleldar has joined #ruby
<bnagy> oh limit sorry, I read list
jp- has quit [Quit: OK, I believe you… but my tommy gun don't]
<bnagy> I neeed to get this second coffee in me
<bnagy> iliketurtles: yes. Don't do to_a - it will return an enumerator then
<iliketurtles> bnagy: haha, no worries
<r0bglees0n> iliketurtles: i would probably write that each_char.each_slice(2), but i don't know what you mean by "limit", you could make the string smaller, but otherwise i dont know.
<bnagy> >> 'abcdefghij'.scan(/.{2}/).combination(2).next
<eval-in> bnagy => ["ab", "cd"] (https://eval.in/38445)
<bnagy> basically just call next as many times as you want, and rescue StopIteration in case it runs out before you're done
jp- has joined #ruby
cha1tanya has joined #ruby
blackmesa has joined #ruby
henn has joined #ruby
henn has joined #ruby
henn has quit [Changing host]
<iliketurtles> bnagy: hmm but calling next just returns the same values, no?
ghr has joined #ruby
hamakn has quit [Ping timeout: 264 seconds]
<bnagy> no
blackmesa has quit [Remote host closed the connection]
<iliketurtles> >> 3.times { p 'abcdefghij'.scan(/.{2}/).combination(2).next }
<eval-in> iliketurtles => ["ab", "cd"] ... (https://eval.in/38446)
<bnagy> >> a='abcdefghij'.scan(/.{2}/).combination(2);a.next;a.next
<eval-in> bnagy => ["ab", "ef"] (https://eval.in/38447)
<iliketurtles> ah i see
Vivekananda has quit [Ping timeout: 248 seconds]
<bnagy> I really love the Enumerator / Generator pattern, external iterators as first class vars, but they don't seem much loved these days :(
<Rubba> if have to use == 1/0 when doing binary operations in conditionals?
<Rubba> i*
<r0bglees0n> you cant divide by 0
<Rubba> / is or
<bnagy> it's not
<bnagy> unless or is drunk
<popl> go home or
<Rubba> pedantry aside...?
<bnagy> | . o O ( I AM TOTALLY FIIINE)
<popl> Rubba: pedantry?
<popl> Rubba: | is not /
<epitron> bnagy: who doesn't love generators! point those people out to me!
Dwarf has joined #ruby
<Rubba> ok....
* epitron puts on his brass knuckles
<bnagy> Rubba: not sure what the code you're asking about looks like
<Rubba> i have to use == 1|0 when doing binary operations in conditionals?
<bnagy> well 1|0 is 0
<Rubba> i want to do: if (condition? && (othercondition? & something?))
<popl> Rubba: usually people here don't know if you're pasting actual code or not so it's usually best not to confuse the issue :)
<bnagy> srsly, though, just show some actual code
<Rubba> but it seems that & only works in binary
<bnagy> 1|0 is not 0 btw
brandon has joined #ruby
<popl> bnagy: that's 2 strikes
<Rubba> oh wait
<bnagy> && is logical & is binary, ditto || and |
<epitron> >> ([0]*2**64).reduce(:|)
<eval-in> epitron => bignum too big to convert into `long' (RangeError) ... (https://eval.in/38448)
Mattix has joined #ruby
<epitron> lul
<popl> bnagy: third strike gets a paddlin'
<epitron> >> ([0]*2**32).reduce(:|)
<eval-in> epitron => bignum too big to convert into `long' (RangeError) ... (https://eval.in/38449)
<Rubba> & works with boolean too
brandon is now known as Guest76733
<epitron> >> ([0]*2**30).reduce(:|)
<eval-in> epitron => argument too big (ArgumentError) ... (https://eval.in/38450)
<iliketurtles> bnagy: i think i'm overcomplicating my solution here
<bnagy> Rubba: no, it doesn't
<epitron> nevermind :)
<iliketurtles> can I run my goal by you?
<bnagy> well, you might think it does but it's almost certainly not doing what you want
<bnagy> like a & b will always be ruby truthy
<popl> iliketurtles: can I try to tackle you when you run by?
<iliketurtles> sure ^_^
<r0bglees0n> >> def foo(*args); args.size; end; x = Array.new(50_000) { "a" }; foo(*x)
<eval-in> r0bglees0n => 50000 (https://eval.in/38451)
<r0bglees0n> ok cool
* popl puts on his robe and wizard hat
<r0bglees0n> i can have 50k arguments
<r0bglees0n> if i ever need them
<Rubba> true & true => true, true & false => false, etc.
babykosh has joined #ruby
jonathanwallace has joined #ruby
<r0bglees0n> >> def foo(*args); args.size; end; x = Array.new(500_000) { "a" }; foo(*x)
<eval-in> r0bglees0n => stack level too deep (SystemStackError) ... (https://eval.in/38452)
<bnagy> that only works for the actual objects true and false
<r0bglees0n> hah
<bnagy> and even then it shouldn't imho
<bnagy> it's because they're also immediates :(
<bnagy> laame
<epitron> >> [0].cycle(2**24).reduce(:|)
<bnagy> >> puts "NOT LOGICAL" if 0 & 1
<eval-in> epitron => 0 (https://eval.in/38454)
<eval-in> bnagy => NOT LOGICAL ... (https://eval.in/38454)
<epitron> :D
shouya has joined #ruby
<iliketurtles> I have a string. for example's sake, lets make it "abcdefghijkl". I want to break the string up into SIZE blocks, and pair them. So for instance, for SIZE=2, I would want [[ab,cd],[ef,gh],[ij,kl]]. For SIZE=3, I would want [[abc,def],[ghi,jkl]]
mansi has quit [Remote host closed the connection]
Xiti has quit []
<r0bglees0n> >> SIZE = 2; "dreamer".each_char.each_slice(SIZE).to_a
<eval-in> r0bglees0n => [["d", "r"], ["e", "a"], ["m", "e"], ["r"]] (https://eval.in/38455)
sailias has quit [Quit: Leaving.]
thams has quit [Quit: thams]
Xiti has joined #ruby
<r0bglees0n> oh that wont work
<iliketurtles> and I never want to return a "pair" without a matching pair. your lonesome ["r"] for instance ^
v0n has joined #ruby
<epitron> >> "abcdefghijkl".chars.each_slice(2).map{|a| a.join("").each_slice(2).to_a
<eval-in> epitron => /tmp/execpad-8bd5b302021d/source-8bd5b302021d:3: syntax error, unexpected keyword_rescue, expecting '}' ... (https://eval.in/38456)
<bnagy> iliketurtles: what are you doing with them afterwards, like why do you want them in pairs?
<epitron> oops
ZOGM has joined #ruby
Xiti has quit [Read error: Connection reset by peer]
<iliketurtles> bnagy: it's really irrelevant I suppose, but I am calculating the hamming distance between the string pairs.
Xiti has joined #ruby
<epitron> >> "abcdefghijkl".chars.each_slice(2).map{|a| a.join("")}.each_slice(2).to_a
<eval-in> epitron => [["ab", "cd"], ["ef", "gh"], ["ij", "kl"]] (https://eval.in/38457)
<r0bglees0n> epitron: original solution is nicer, .split(/.{2}/).combination(2)
<epitron> oic :)
reset has quit [Quit: Leaving...]
<epitron> i'd actually use scan(/../)
<r0bglees0n> oh sorry
<r0bglees0n> heh
<r0bglees0n> he used scan
<bnagy> basically you want run to run some_func() on all pairs
<bnagy> .. ( lol in advance )
<bnagy> I would think about inject
<popl> each_cons(2)? :P
<epitron> reduce!
<bnagy> but it wouldn't do all pairs, just adjacent ones
<bnagy> which I'm sure is sufficient anyway
<iliketurtles> bnagy: i want to run total += "ab".hamming("cd")/keysize; total += "cd".hamming("ef")/keysize,
<epitron> popl: what, is 2 the default?
<r0bglees0n> >> SIZE = 2; "abcdefg".scan(/.{2}/).combination(2).reject { |x| x < SIZE }
<eval-in> r0bglees0n => undefined method `<' for ["ab", "cd"]:Array (NoMethodError) ... (https://eval.in/38458)
<popl> epitron: no
<r0bglees0n> >> SIZE = 2; "abcdefg".scan(/.{2}/).combination(2).reject { |x| x.size < SIZE }
<eval-in> r0bglees0n => [["ab", "cd"], ["ab", "ef"], ["cd", "ef"]] (https://eval.in/38459)
<epitron> haha wtf is going on
<popl> THE DARK LORD HAS RETURNED
<popl> ALL HAIL THE DARK ONE
<popl> IA IA
<popl> *ahem*
<popl> sorry, something in my throat
<epitron> >> class DarkLord; def hail!; @hailed = true; end; end; return DarkLord.new.hail!
<eval-in> epitron => unexpected return (LocalJumpError) ... (https://eval.in/38460)
<epitron> hahah
<epitron> i suck at eval
Mattix has quit [Ping timeout: 248 seconds]
<r0bglees0n> YOU SUCK AT THE TOPLEVEL
<iliketurtles> >> class DarkLord; def hail!; @hailed = true; end; end; DarkLord.new.hail!
<eval-in> iliketurtles => true (https://eval.in/38461)
<epitron> i just wanted the dark lord to return
<bnagy> >> "abcdefghijkl".scan(/../).each_cons(2).to_a
<eval-in> bnagy => [["ab", "cd"], ["cd", "ef"], ["ef", "gh"], ["gh", "ij"], ["ij", "kl"]] (https://eval.in/38462)
<r0bglees0n> .. is nicer for sure
<bnagy> iliketurtles: then hamming all those pairs via inject
johnkary has joined #ruby
ZOGM has quit [Ping timeout: 256 seconds]
<bnagy> pairs.inject(0) {|hamming_sum,(a,b)| hamming_sum+=hamming(a,b)}
<epitron> except don't use to_a, just pass a block to each_cons
<iliketurtles> wow nice solution bnagy
<epitron> or that :)
<bnagy> iliketurtles: but it's not the same as your first requirement
<bnagy> that's just the adjacent pairs
<bnagy> which I bet will be plenty, but ymmv
<epitron> you could also eschew inject, and pairs.map{|a,b| hamming(a,b)}.sum
<epitron> or wait, sum takes a block i think
<bnagy> epitron: uh how does sum work again?
<bnagy> :D
<epitron> you could also eschew inject, and pairs.sum{|a,b| hamming(a,b)}
<iliketurtles> bnagy: do you mean my first requirement yesterday?
<epitron> bnagy: oh, is that one of my custom methods?
henn has quit [Remote host closed the connection]
<bnagy> well, and today, when you said you wanted combinations
Mattix has joined #ruby
<bnagy> epitron: doesn't exist for me?
<bnagy> smells like an inject wrapper though
<iliketurtles> sure, I basically just want to take the first N number of pairs of a string. I don't want to iterate through the ENTIRE string, as "abcdefghijkl".scan(/../).each_cons(2).to_a does
dhruvasagar has quit [Ping timeout: 268 seconds]
<Rubba> how do i write a string in multiple lines without ruby adding \n for me? do i have to close the quote and add + at each line?
<bnagy> you may as well
<bnagy> it will be cheap
hamakn has joined #ruby
<bnagy> computers are fast
<bnagy> vroom!
<iliketurtles> ^_^
<r0bglees0n> Rubba: "foo" \ "bar" \ "baz"
<r0bglees0n> on newlines
<epitron> bnagy: it's actually just reduce(:+)
<iliketurtles> probably not with the string I'm feeding it
<iliketurtles> hahaha
<iliketurtles> 4000 chars or so
<Rubba> so i still gotta close the quote?
<r0bglees0n> yeah
freerobby has joined #ruby
<Rubba> alright thanks
<epitron> or map(&block).reduce(:+) if block_given?
<bnagy> Rubba: there are heredocs as well
<r0bglees0n> bnagy: without newlines, though
<bnagy> but, you know, almost nobody uses them
<bnagy> iliketurtles: that's really not a lot
<iliketurtles> ok
<bnagy> just do the whole thing and stop being a fairy
<iliketurtles> well fuck it then, i'll do it live =P
<r0bglees0n> lol
bradhe has quit [Remote host closed the connection]
Heero has quit [Ping timeout: 256 seconds]
bradhe has joined #ruby
<bnagy> hm I'm not sure how I feel about fairy as a pejorative... I think it's too close to 'gay' which I don't use
<iliketurtles> lol
<bnagy> I think I'll just stick with princess
<iliketurtles> i have this irish neighbor, who just goes around calling everyone a cunt. apparently it's akin to "brother" in ireland
<iliketurtles> ~_~
<bnagy> pretty much the same in australia / NZ
<iliketurtles> hahaha
<iliketurtles> you from there?
<r0bglees0n> i wouldnt say its as endearing as 'brother' :P
<r0bglees0n> its very offensive for some people
<iliketurtles> no kitten ;P
henn has joined #ruby
henn has joined #ruby
henn has quit [Changing host]
burlyscudd has joined #ruby
viszu has quit [Quit: Leaving.]
<bnagy> that's actually me in the picture
wesside has quit [Quit: I think I heard an ice cream truck..]
<r0bglees0n> lol
<r0bglees0n> just how i imagined you
<r0bglees0n> where's your kangeroo skippy?
<iliketurtles> hahahaha
Ripp__ has quit [Quit: This computer has gone to sleep]
wesside has joined #ruby
bradhe has quit [Ping timeout: 276 seconds]
<jarray52> Is there a simple one liner to find all pairs of elements of a ruby array?
<bnagy> it's deja vu day!
<r0bglees0n> this is crazy
<iliketurtles> bnagy: so with pairs = "abcdefghij".scan(/../).each_cons(2).to_a, how do I get it to pick blocks of a size other than 2? just increase the number of ....?
<bnagy> >> [1,2,3,4].combination(2).to_a
<eval-in> bnagy => [[1, 2], [1, 3], [1, 4], [2, 3], [2, 4], [3, 4]] (https://eval.in/38463)
henn has quit [Ping timeout: 264 seconds]
<bnagy> iliketurtles: yeah you can use the {} form in your regex and use a variable
burlyscudd has quit [Ping timeout: 276 seconds]
<iliketurtles> .scan(/.{#{keysize}}/)?
<bnagy> I think it's like /.{,4}/
aeontech has quit [Quit: aeontech]
<iliketurtles> prob dont need the #
binw_ has joined #ruby
adeponte has joined #ruby
<Rubba> /.{N}/ N being size
<jarray52> bnagy: Thanks. That combination function is nice.
<jarray52> s/function/method
<iliketurtles> nice
<iliketurtles> me gusta el ruby
<jarray52> me gusta tambien
<bnagy> iliketurtles: use Rubba's one, with no comma you won't get odd sized strings at the end
<bnagy> which is what you want for this
<iliketurtles> bnagy: brilliant
alvaro_o has quit [Quit: Ex-Chat]
headius has quit [Quit: headius]
kid_icarus has joined #ruby
binw has quit [Ping timeout: 268 seconds]
<iliketurtles> you guys da best
<iliketurtles> learning so much
<kid_icarus> how can I get the absolute path to a file in ~?
<bnagy> if you want the whole thing you need the comma
<bnagy> >> i=4;"qwertyuiop".scan(/.{,#{i}}/)
<bnagy> hm
<eval-in> bnagy => ["qwer", "tyui", "op", ""] (https://eval.in/38464)
<bnagy> kid_icarus: check the docs for File, you want File.expand_path ...
<iliketurtles> i dont really care about the whole thing in this case, I am just concerned with the pairs always being same sized
<kid_icarus> bnagy: thank you! :)
love_color_text has joined #ruby
<epitron> >> "qwertyuiop".scan(/.{1,4}/)
<eval-in> epitron => ["qwer", "tyui", "op"] (https://eval.in/38465)
<iliketurtles> >> "qwertyuiop".scan(/.{4}/)
<eval-in> iliketurtles => ["qwer", "tyui"] (https://eval.in/38466)
<iliketurtles> ^ better for my case
cyong has joined #ruby
<iliketurtles> so sweet
adeponte has quit [Ping timeout: 276 seconds]
jonathanwallace has quit [Ping timeout: 276 seconds]
<epitron> i know, right? :)
<epitron> i wonder why scan doesn't return an enumerator
<iliketurtles> someone probably had a good reason
YaNakilon has quit [Ping timeout: 276 seconds]
mary5030 has quit [Remote host closed the connection]
lindenle has quit [Quit: This computer has gone to sleep]
<epitron> my guess is that they didn't get around to it
<iliketurtles> haha or that
<epitron> it's probably implemented by some low-level C regexp library
mary5030 has joined #ruby
<epitron> which just returns a C array
<bnagy> some things can just return arrays
<epitron> bnagy: well, if you're scanning a 50 gigabyte file...
<epitron> enumerators are good :D
rodacato has joined #ruby
ssvo has joined #ruby
kung has joined #ruby
<r0bglees0n> epitron: regexp engine is "onigurama" or something like that.
<r0bglees0n> it's C :P
<epitron> r0bglees0n: didn't they replace that?
<epitron> i thought that was just a 1.9 thing
<bnagy> I thought they went boost
<r0bglees0n> i thought thats what they *moved* to
<r0bglees0n> maybe it was changed again
<bnagy> I would google, but I don't actually care :P
<bnagy> I'm almost certainly wrong
<r0bglees0n> annoying thing to google as well
<iliketurtles> why is an enum better than an array for a huge file?
<epitron> just look at your ruby source :)
<bnagy> iliketurtles: memory
<iliketurtles> how so?
<bnagy> but you'd chunk it anyway
love_col_ has joined #ruby
<bnagy> well enumerators are lazy, so you can handle effectively infinite sequences
<iliketurtles> what does lazy mean in this context?
<epitron> it means it only gives you one element at a time
<epitron> instead of returning the entire array
krainboltgreene has quit [Ping timeout: 256 seconds]
smathieu has joined #ruby
<epitron> if you had a huge file, .scan would be bad.. .chars.each_slice(4).combination(2) would be better
jp- has quit [Quit: OK, I believe you… but my tommy gun don't]
<iliketurtles> huge == how big?
<epitron> depends on your memory
<bnagy> >> (1..Float::INFINITY).lazy.select {|i| i%13==0}.take 4
<eval-in> bnagy => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: 1..Infinity>:select>:take(4)> (https://eval.in/38467)
<bnagy> lame
<iliketurtles> hahaha
<bnagy> >> (1..Float::INFINITY).lazy.select {|i| i%13==0}.take(4).to_a
<eval-in> bnagy => [13, 26, 39, 52] (https://eval.in/38468)
<epitron> >> [:D, :O].cycle.take(5).to_a
<eval-in> epitron => [:D, :O, :D, :O, :D] (https://eval.in/38469)
<iliketurtles> i see so the enum sort of "hides" the real array until you need it, then performs the math to grab it?
<bnagy> >> (1..Float::INFINITY).select {|i| i%13==0}.take(4).to_a
love_color_text has quit [Ping timeout: 264 seconds]
<eval-in> bnagy => (https://eval.in/38470)
<iliketurtles> or am i totes off
<r0bglees0n> bnagy: what makes it stop being lazy? to_a?
<bnagy> which is eval.in telling me to *** myself
<epitron> iliketurtles: enumerators only support one operation: NEXT THING
<iliketurtles> AH i see
<epitron> and when you make a big long chain of enumerators, it's great
<epitron> because you can pass one thing through that entire chain
<r0bglees0n> bnagy: i wouldnt have thought the select would be lazy
<bnagy> it's not, which is why the second one hangs
<r0bglees0n> ah
smathieu has quit [Ping timeout: 245 seconds]
<bnagy> there's a lazily gem which someone wrote that brings all that back to 1.9, and also jruby
<epitron> bnagy: wait, select is lazy by default, isn't it?
<r0bglees0n> no?
<bnagy> epitron: not according to that
<epitron> i thought Lazy just made everything into an enumerator
<bnagy> well it is if the thing it's talking to is
<bnagy> so yes, I guess
Mattix has quit [Ping timeout: 268 seconds]
<bnagy> like it's hanging trying to construct that range
henn has joined #ruby
henn has joined #ruby
henn has quit [Changing host]
<r0bglees0n> >> (1..Float::INFINITY).to_enum.lazy.select { |x| x == 1 }
<eval-in> r0bglees0n => #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: 1..Infinity:each>>:select> (https://eval.in/38471)
<epitron> ohhh
<r0bglees0n> there ya go
<epitron> right
<epitron> that's very strange
<epitron> .lazy is a really gross hack, imo
<r0bglees0n> its what i expected to be honest :o
<bnagy> ok now I have confused myself
<epitron> ranges should be lazy by default
<bnagy> yeah, but when you give a naked range to select
<r0bglees0n> epitron: sure, but select() is an iteration isn't it
<bnagy> I guess it tries to make it into an array
<r0bglees0n> for me, select is asking to *not* be lazy anymore
<r0bglees0n> but maybe thats just me
<epitron> bnagy: which is ridiculous :)
<bnagy> although I don't see any fundamental reason for that
<epitron> BUG FILING TIME
<epitron> r0bglees0n: everything should be lazy by default!
<epitron> EVERRRYYYTTHIINNGG
<Rubba> (1..5).each do { |n| blah=blah+n.to_s+"," } <-- how can i avoid the trailing comma at the end? (the syntax may be wrong, i wrote that from scratch)
<r0bglees0n> yeah, I guess I'm thinking of ActiveRecord and how it defines lazy.
<epitron> btw, .all is much nicer than .to_a
<epitron> what's AR lazy?
<r0bglees0n> invoke on iteration
<r0bglees0n> each, select, etc
<r0bglees0n> query is lazy until then
<epitron> oh, execute the query
<epitron> hmm
<epitron> databases have cursors
<epitron> you could have lazy AR as well
<r0bglees0n> Rubba: im sorry, but, remove the comma?
<r0bglees0n> i dont get it
<bnagy> Rubba: just use join, that's what it's for
wsterling has joined #ruby
<r0bglees0n> ah ok, i see now
<Rubba> anyone able to answer my question up there^
<r0bglees0n> epitron: maybe as an extension or something
<Rubba> oops
<bnagy> >> (1..5).map(&:to_s).join ','
<eval-in> bnagy => "1,2,3,4,5" (https://eval.in/38473)
<Rubba> was scrolled up
<r0bglees0n> epitron: I had to add hstore support to AR through a plugin
<epitron> o_O
<r0bglees0n> i think its native in rails4
<epitron> that's nice
<r0bglees0n> yeah, it'll be nice, i can get rid of some hacks :p
<epitron> oracle taking over mysql was a great thing for postgres
<r0bglees0n> i've used mysql before oracle, i dont think it'd ever be my first choice
renderful has quit [Remote host closed the connection]
SHyx0rmZ has quit [Quit: ネウロイを負かさなきゃならないね]
renderful has joined #ruby
twoism_ has joined #ruby
<r0bglees0n> i think id always pick postgres for SQL
<r0bglees0n> but ive never had access to commercial DBs, just ms-sql
moos3 has quit [Quit: Computer has gone to sleep.]
moos3 has joined #ruby
dhruvasagar has joined #ruby
twoism has quit [Ping timeout: 245 seconds]
renderful has quit [Ping timeout: 246 seconds]
twoism_ has quit [Ping timeout: 246 seconds]
amh345 has joined #ruby
narcan_ has quit [Quit: Leaving...]
<iliketurtles> bnagy: with that inject block you showed earlier, is there a good way to take the hamming_sum and divide it by the number of iterations that happened in the inject block?
<r0bglees0n> iliketurtles: iterations == size.
<bnagy> there's a couple of ways
<bnagy> you can construct the each_slice as an array and just take its size
<bnagy> or, lazily, you can keep a counter in the accumulator
<bnagy> imho do the first
<iliketurtles> i didnt do each_slice though
<bnagy> scan whatever
<bnagy> the thing that builds the array
<amh345> I'm experiencing a very vague issue. maybe someone here can shed some light? i can sftp to a server with filezilla. but in ruby i keep getting "Net::SSH::AuthenticationFailed <username>". no idea why. I'm using Net::SFTP.start('<server>', '<username>', :password => '<password>') do |sftp| .
<iliketurtles> something like: pairs = buffer.scan(/.{#{keysize}}/).each_cons(2).to_a; (pairs.inject(0) {|hamming_sum,(a,b)| hamming_sum += a.hamming_distance(b); }) / pairs.size
eaWPq4nU has quit [Remote host closed the connection]
<bnagy> iliketurtles: looks close to right. hamming_sum will already be a float, so that make the final division be floaty
DanKnox is now known as DanKnox_away
<iliketurtles> floaty is good in this case, i want to be precise
<bnagy> amh345: are you using the literal string <username> as your username?
<iliketurtles> bnagy: beautiful
<amh345> bnagy: no, i just put that there as a stub.
anay has joined #ruby
<amh345> i have other sftp logins via Net::sftp that work.
<amh345> but this one has me stumped.
wmoxam has joined #ruby
<bnagy> could be special chars in the username or password?
<r0bglees0n> where does the username come from?
<r0bglees0n> a file? the script?
<bnagy> or encoding issues?
Mattix has joined #ruby
cortexman1 has quit [Quit: Leaving.]
<amh345> hrm.
<amh345> i can also login via terminal
zachrab_ has joined #ruby
<amh345> r0bglees0n: the username is just a word.
<amh345> same with the pass
<r0bglees0n> in the code itelf? ok
<iliketurtles> bnagy: and others, thanks a ton for your help; and teaching
<amh345> and I'm testing it by copying.
<amh345> when it works, it'll be pulled from a db.
<amh345> but yes, for now. I'm trying manually. or c/ping.
<r0bglees0n> i thought if it came from a file it might be a newline somewhere or something
<r0bglees0n> can you inspect the username + password with #inspect to be sure it looks right?
<amh345> yeah, i hear you.
<amh345> I'm certain it's right (i know everyone says that). but I'm copying from an email that was sent.
<amh345> im literally copying and pasting or retyping it.
<r0bglees0n> i believe it's right if you can login with filezilla
<amh345> ok. so it seems like this is straight up an issue with it actually not being correct user/pass.
<amh345> i thought maybe there was some other gotcha.
<r0bglees0n> probably not
<amh345> so weird.
love_col_ has quit [Read error: Connection reset by peer]
<r0bglees0n> thats why id inspect the strings and see if there's something weird/unexpected in there invisible to the naked eye, who knows
<bnagy> if the same user / pass works elsewhere then probably one of your variables just isn't what you think it is
<amh345> and yeah, it works via filezilla and logging in directly via terminal .
<bnagy> s/probably//
brunoro__ has joined #ruby
<amh345> this is madness. hah
fenak has joined #ruby
<amh345> i don't even have a variable.
<r0bglees0n> put them into variables and inspect them
<r0bglees0n> this is SSL?
<bnagy> have you double checked that you're logging into the correct server for those credentials?
<amh345> it's just plain ol port 22
fenak has quit [Quit: leaving]
pontiki has quit [Quit: "Poets have been mysteriously silent on the subject of cheese." -- G.K.Chesterson]
<amh345> this particular ftp will allow me to login to port 21 too. i wonder if that's something to do with it. i can't imagine why.
<amh345> (not via ruby though)
Domon has quit [Remote host closed the connection]
<bnagy> iliketurtles: btw if you reopened String to add hamming_distance then I disapprove
<iliketurtles> bnagy: what do you mean
narcan has joined #ruby
burlyscudd has joined #ruby
noyb has joined #ruby
LucidDreamZzZ has joined #ruby
DeanH has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<bnagy> in your code you had a.hamming_distance(b)
<bnagy> which implies that you monkeypatched String
<r0bglees0n> bnagy: he just wrapped over a string in his own class like a cool dude
<r0bglees0n> i guess if you come from Java or something being able to open core classes/data types and add methods to them is too tempting to resist
blitz has quit [Quit: This computer has gone to sleep]
<r0bglees0n> i never really wanted to do it that much
burlyscudd has quit [Ping timeout: 256 seconds]
<r0bglees0n> if the environment is *yours*, i think its fine
blitz has joined #ruby
<Kelet> Use refinements, then?
<r0bglees0n> Kelet: yeah, for real code, if it's just your little hack environment then i think its okay i guess.
<r0bglees0n> do refinements matter that much for stuff like rails?
<r0bglees0n> maybe for internal-only monkey patches
Anarch has quit [Ping timeout: 276 seconds]
bradhe has joined #ruby
Anarch has joined #ruby
rodacato has quit [Remote host closed the connection]
DeanH has joined #ruby
DeanH has quit [Max SendQ exceeded]
mmitchell has quit [Remote host closed the connection]
Domon has joined #ruby
bradhe has quit [Ping timeout: 248 seconds]
krz has joined #ruby
krz has joined #ruby
krz has quit [Changing host]
wallerdev has joined #ruby
wmoxam has quit [Ping timeout: 264 seconds]
sayan has quit [Ping timeout: 264 seconds]
Asher1 has joined #ruby
wsterling has quit [Remote host closed the connection]
Asher is now known as Guest83156
Asher1 has quit [Client Quit]
freerobby has quit [Quit: Leaving.]
<iliketurtles> bnagy: yes i did monkeypatch string, this isn't a production use case by any means
kofno has quit [Remote host closed the connection]
<iliketurtles> its more of a "challenge" thing, like the euler problems
johnkary has quit [Quit: @johnkary]
mootpointer has quit [Quit: Computer has gone to sleep.]
smathieu_ has joined #ruby
Guest83156 has quit [Ping timeout: 276 seconds]
davedev24 has quit [Remote host closed the connection]
Asher- has joined #ruby
<r0bglees0n> oh, and third-party libraries wouldn't see the monkey patches
Asher- is now known as asher
asher is now known as Asher
ShaneD has joined #ruby
Asher has quit [Client Quit]
Asher has joined #ruby
_whitelogger has joined #ruby
<r0bglees0n> ShaneD: that means you're yielding an array - you're iterating over an array of arrays.
<r0bglees0n> ShaneD: the object you want is in the array
lochez has joined #ruby
burlyscudd has joined #ruby
apeiros has quit [Remote host closed the connection]
<ShaneD> So not rows.each then columns.each? I thought each element in columns would be a cell.
<r0bglees0n> it is, but you're not going through your object anymore remember
<r0bglees0n> you're bypassing it by accessing the array directly
<r0bglees0n> you want grid.each {}
<r0bglees0n> not grid.grid.each {}
<r0bglees0n> which is the array you wrap
<ShaneD> I ….uh…don't get it. Shoot.
<ShaneD> I see what you are saying, I just don't understand what you are saying.
<r0bglees0n> L68
<r0bglees0n> change grid.grid
<r0bglees0n> to grid.each
<r0bglees0n> ill explain why
cha1tanya has quit [Ping timeout: 264 seconds]
<ShaneD> Wow, I don't know how that even got in there. Totally missed that.
<r0bglees0n> ok, so you understand
romdi has joined #ruby
<ShaneD> You sir, are a lifesaver.
burlyscudd has quit [Ping timeout: 268 seconds]
DanKnox is now known as DanKnox_away
<r0bglees0n> happy to help
<ShaneD> Just staring at it so long I couldn't see little things, like having left a p in front of something I was putsing to inspect, and then the grid.grid. Getting used to vim, keep screwing up my code while learning the new editor too.
<ShaneD> I can now sleep peacefully. Thanks again.
<r0bglees0n> yes, sometimes its better to take a break
<r0bglees0n> youre welcome
ShaneD has left #ruby [#ruby]
tkuchiki_ has joined #ruby
tkuchiki has quit [Read error: Connection reset by peer]
rickruby has joined #ruby
huoxito has quit [Quit: Leaving]
n_blownapart has quit [Remote host closed the connection]
Mattix has joined #ruby
AkashicLegend has quit [Quit: AkashicLegend]
lochez has quit [Quit: This computer has gone to sleep]
lochez has joined #ruby
lindenle has joined #ruby
lochez has quit [Client Quit]
dawkirst has quit [Ping timeout: 248 seconds]
ssvo has quit [Ping timeout: 248 seconds]
v0n has quit [Ping timeout: 264 seconds]
mansi has joined #ruby
smathieu has joined #ruby
<zachrab_> anyone here actively contribute to rubygems?
renderful has joined #ruby
dhruvasagar has quit [Ping timeout: 264 seconds]
mansi has quit [Ping timeout: 245 seconds]
mary5030 has joined #ruby
cyong has quit [Quit: Leaving.]
hasrb_ has quit [Remote host closed the connection]
gstamp has quit [Read error: Connection reset by peer]
charliesome has quit [Read error: Connection reset by peer]
hasrb has joined #ruby
rshetty has quit [Ping timeout: 246 seconds]
smathieu has quit [Ping timeout: 248 seconds]
rshetty_ has joined #ruby
Zeeraw has joined #ruby
ultimoo has joined #ruby
hanmac2 has joined #ruby
darth_chatri has joined #ruby
jalcine has quit [Excess Flood]
dawkirst has joined #ruby
ultimoo has quit [Client Quit]
wsterling has joined #ruby
vlad_starkov has joined #ruby
hasrb has quit [Ping timeout: 268 seconds]
gstamp has joined #ruby
hanmac2 has quit [Ping timeout: 248 seconds]
tkuchiki has joined #ruby
tkuchiki_ has quit [Read error: Connection reset by peer]
Domon has joined #ruby
choobie has quit [Ping timeout: 256 seconds]
vlad_starkov has quit [Ping timeout: 248 seconds]
wsterling has quit [Ping timeout: 264 seconds]
krz has joined #ruby
sayan has joined #ruby
Davey has quit [Quit: Computer has gone to sleep.]
anildigital_away is now known as anildigital
<zachrab_> does anyone know what this means: (?i-mx:rails)
Zeeraw has quit [Quit: Computer has gone to sleep.]
nomenkun has joined #ruby
Zeeraw has joined #ruby
Kabaka has quit [Ping timeout: 240 seconds]
mahmoudimus has joined #ruby
<sevenseacat> looks like vim magic
<zachrab_> sevenseacat: ha what do u mean?
<sevenseacat> uh, i mean exactly what i said
bradhe has joined #ruby
Kabaka has joined #ruby
<zachrab_> sevenseacat: by im receiving that as stdout of a puts interpolation
jonahR has quit [Quit: jonahR]
nayfun has joined #ruby
<sevenseacat> well you best provide some context then hey
browndawg has joined #ruby
browndawg has quit [Client Quit]
Perceptes has joined #ruby
<zachrab_> sevenseacat: i am attempting to contribute to ruby gems
<sevenseacat> a noble task
ananthakumaran has joined #ruby
<zachrab_> and theres a regex handling for a single argument and im trying to modify to handle it for multiple args
darknyan has joined #ruby
mary5030 has quit [Remote host closed the connection]
<zachrab_> so using a control structure im conditionally mapping a regex array
<zachrab_> however its not rendering the same for some reason
<zachrab_> one puts as (?i-mx:rails)
<zachrab_> the other puts as [/rails/]
<zachrab_> why?
<zachrab_> sorry [/rails/i]
mansi has joined #ruby
andr0m3da has quit [Ping timeout: 264 seconds]
<sevenseacat> uh huh.
tagrudev has joined #ruby
<zachrab_> sevenseacat: ?
<zachrab_> help!
<sevenseacat> with?
justsee has quit [Ping timeout: 264 seconds]
<zachrab_> ha this issue
<sevenseacat> oh right, you want me to debug a code issue after you didnt provide any code
tvw has joined #ruby
<zachrab_> well i described the issue
<sevenseacat> well in that case, you have a syntax error on line 4.
<sevenseacat> you should probably fix that.
<zachrab_> ok joking aside
noyb has quit [Ping timeout: 268 seconds]
<sevenseacat> all joking aside, no-one can help you with code they can't see.
eldariof has quit [Ping timeout: 256 seconds]
<zachrab_> im talking conceptually
<zachrab_> why would (?i-mx:rails) be produced
<zachrab_> vs /rails/i
<zachrab_> im creating each the same = /#{string}/i
nfkd has left #ruby [#ruby]
hamakn has quit [Read error: Connection reset by peer]
mansi has quit [Ping timeout: 268 seconds]
hamakn has joined #ruby
anildigital is now known as anildigital_away
<Perceptes> i've seen that mixed-mode regex get created if you try to interpolate one regex into another one
<Perceptes> make sure the pattern is a string until the very last step when you convert it into a regex
anildigital_away is now known as anildigital
<zachrab_> Perceptes: it is
<zachrab_> Perceptes: which one is the representation of a regex interplolated into another?
aaa has joined #ruby
lindenle has quit [Quit: This computer has gone to sleep]
Davey has joined #ruby
Zeeraw has quit [Quit: Computer has gone to sleep.]
rahult has quit [Quit: Back to the world of zombies]
iliketurtles has joined #ruby
bradhe has quit [Remote host closed the connection]
burlyscudd has joined #ruby
Anarch has quit [Ping timeout: 248 seconds]
<Perceptes> zachrab: i'm trying to find the place where i ran into this problem but i'm not finding it. basically i was doing something like `foo = /pattern/; bar = /anotherpattern#{foo}/`
AkashicLegend has joined #ruby
<zachrab_> yes i see that and im able to reproduce that
<zachrab_> but im struggling to see where im double interpolating
aaa has left #ruby [#ruby]
jalcine has joined #ruby
tjbiddle has joined #ruby
<popl> maybe if you pasted your code to a pastebin
tjbiddle has quit [Remote host closed the connection]
burlyscudd has quit [Ping timeout: 268 seconds]
<popl> zachrab_: was my hint too subtle? :)
justsee has joined #ruby
zachrab_ has quit [Remote host closed the connection]
Al_ has joined #ruby
louism2wash has joined #ruby
zachrab_ has joined #ruby
hamakn has quit [Read error: Connection reset by peer]
zachrab_ has quit [Remote host closed the connection]
<louism2wash> hey everyone, I am learning about threading and the way that ruby schedules thread execution. Can anyone give me an example of a blocking i/o operation
blaxter_ has joined #ruby
hamakn has joined #ruby
r0bglees0n has quit [Ping timeout: 246 seconds]
sayan has quit [Ping timeout: 248 seconds]
ChristianS has quit [Excess Flood]
ChristianS has joined #ruby
mary5030 has joined #ruby
jmimi has joined #ruby
ananthakumaran1 has joined #ruby
kiri has joined #ruby
Senjai has quit [Ping timeout: 246 seconds]
Anarch has joined #ruby
tommyvyo has quit [Quit:]
ananthakumaran has quit [Ping timeout: 268 seconds]
lsmola has joined #ruby
workmad3 has joined #ruby
justsee has left #ruby [#ruby]
ananthakumaran has joined #ruby
smathieu has joined #ruby
krz has quit [Quit: krz]
nayfun has quit [Quit: nayfun]
pranny has joined #ruby
ananthakumaran1 has quit [Ping timeout: 256 seconds]
brunoro__ has quit [Ping timeout: 276 seconds]
iliketurtles has quit [Quit: zzzzz…..]
<davidcelis> louism2wash: gets
<louism2wash> gets?
smathieu has quit [Ping timeout: 264 seconds]
mary5030 has quit [Remote host closed the connection]
Al_ has quit [Quit: Al_]
mary5030 has joined #ruby
codecop has joined #ruby
darkc0met has joined #ruby
krz has joined #ruby
ayaz has joined #ruby
burlyscudd has joined #ruby
spectre| has joined #ruby
aganov has joined #ruby
nitish has joined #ruby
ayaz has quit [Ping timeout: 246 seconds]
k0rupted has joined #ruby
burlyscudd has quit [Ping timeout: 248 seconds]
henn has quit [Ping timeout: 245 seconds]
henn has joined #ruby
fridim__ has quit [Ping timeout: 264 seconds]
oceabreeze has joined #ruby
ewnd9 has joined #ruby
<oceabreeze> Sup could anyone guide me throught some Ruby code?
kayloos has joined #ruby
<Nilium> What does guide mean and what is the code?
bubbajoness has quit [Ping timeout: 260 seconds]
<Nilium> Wow, that has no indentation. Who wrote this?
<Nilium> Also pretty sure this is rails-specific, so I can't help you. Rails is of the devil.
_Andres has joined #ruby
mary5030 has quit [Remote host closed the connection]
<oceabreeze> :D oki
JohnBat26 has joined #ruby
<Perceptes> oceabreeze: what do you want to know about it
<sevenseacat> charming
dhruvasa1ar has joined #ruby
Mattix has quit [Ping timeout: 264 seconds]
darknyan has quit [Changing host]
darknyan has joined #ruby
blz37 has quit [Ping timeout: 246 seconds]
ewnd9 has quit [Ping timeout: 245 seconds]
erry_ is now known as erry
Zeeraw has joined #ruby
renderful has quit [Remote host closed the connection]
LadyRuby has joined #ruby
vlad_starkov has joined #ruby
apeiros has joined #ruby
LadyRuby is now known as lady_lancer
<lady_lancer> Hi
Gooder`` has joined #ruby
<lady_lancer> I have to develop backend for FTP-SERVER
<Nilium> A very large moth just crawled up my window.
<lady_lancer> using em-ftpd
<Nilium> Looked fuzzy.
<lady_lancer> in order to persist files to Amazon S3
<lady_lancer> :S I have no idea how to do this
<lady_lancer> can anyone help
<lady_lancer> any help will be greatly appreciated
vlad_starkov has quit [Ping timeout: 245 seconds]
<popl> Nilium: how large?
<lady_lancer> has anyone used em-ftpd before
<popl> lady_lancer: This is a non-trivial task even for somebody who knows ruby.
<Nilium> Not the largest I've seen, about thumb-sized
Gooder`` has quit [Remote host closed the connection]
Gooder` has quit [Ping timeout: 246 seconds]
gstamp has quit [Quit: Computer has gone to sleep.]
renderful has joined #ruby
lutfidemirci has joined #ruby
<Nilium> http://spifftastic.net/stuff/moth3.jpg ← That was the largest.
<lady_lancer> I know popl , but atleast you might be knowing a lot more than me when it comes to ruby...I am just a newbie
<Nilium> Hard to see from that, but imagine a moth with a body the size of a finger and a wingspan a little bigger than your hand
<popl> Nilium: Ah, that's nothing. The largest moth I've ever seen up close was perched on the back of my friend's house at a rave in Thermal, CA. The black lights had attracted masses of insects. This moth (with outstretched wings) was probably as big as the back of his hand.
jefflyne has quit [Remote host closed the connection]
<popl> actually it's not nothing
<popl> I don't mean to diminish your experience
<popl> moths look so cool up close
<Nilium> No, I like moths, so it's cool to hear about them
<popl> me too
bubbajones has joined #ruby
<popl> \o/
renderful has quit [Remote host closed the connection]
<Nilium> http://spifftastic.net/stuff/moth2.jpg Slightly different angle on the larger moth.
predator217 has quit [Ping timeout: 248 seconds]
predator117 has joined #ruby
senayar has joined #ruby
<popl> lady_lancer: There are many pitfalls that I am afraid you will not be wary of. Is there another language you know better that would maybe be easier for you to work in?
sayan has joined #ruby
ewnd9 has joined #ruby
<lady_lancer> I am afraid , I have to do this in ruby only!
<Nilium> Well, now would be a good time to start reading whatever documentation you can.
<Nilium> Or fire your client, if it's a client.
<popl> lady_lancer: I foresee many sleepless nights in your near future. ;)
Mattix has joined #ruby
GeissT has joined #ruby
<rickruby> when using each, is there a way to get the loop count or do i just make my own counter variable outside the block ?
<popl> Nilium: The Atlas moth doesn't have a mouth. :(
kayloos has quit [Remote host closed the connection]
<lady_lancer> haha....I know Mate! will really appreciate any help...even a small hint matters at times
<Nilium> Yeah, most of the giant moths don't have mouths
andikr has joined #ruby
<Nilium> It's pretty unfortunate since you could capture one but trying to care for it would be sort of futile
<popl> rickruby: #each_with_index
<popl> yeah
<Nilium> Unfortunately, I did not know that when I first found the large one in the pictures
<popl> oh no
jarin has joined #ruby
<popl> you inadvertently took out a moth bloodline
predator117 has quit [Ping timeout: 256 seconds]
<rickruby> cool thanks
<Nilium> I'm sure there're plenty more, but it was kind of sad seeing Sir Mothington was dead.
nitish has quit [Remote host closed the connection]
kaspergrubbe has joined #ruby
wudofyr___ has joined #ruby
tatsuya_o has joined #ruby
wudofyr___ has quit [Remote host closed the connection]
wudofyr has joined #ruby
hakunin has quit [Read error: Connection reset by peer]
hakunin has joined #ruby
anildigital is now known as anildigital_away
threesome has joined #ruby
mansi has joined #ruby
zomgbie has joined #ruby
staafl_alt has joined #ruby
noop has quit [Ping timeout: 256 seconds]
echevemaster has quit [Quit: Leaving]
hanmac has joined #ruby
mansi has quit [Ping timeout: 264 seconds]
noop has joined #ruby
ffio has joined #ruby
thams has quit [Quit: thams]
workmad3 has quit [Ping timeout: 246 seconds]
Al_ has joined #ruby
anildigital_away is now known as anildigital
ewnd9 has quit [Ping timeout: 256 seconds]
nbouscal has quit [Ping timeout: 248 seconds]
k0rupted has quit [Quit: Ex-Chat]
krz has quit [Quit: krz]
krz has joined #ruby
kid_icarus has quit [Ping timeout: 256 seconds]
echevemaster has joined #ruby
goleldar has quit [Ping timeout: 264 seconds]
goleldar has joined #ruby
Al_ has quit [Quit: Al_]
smathieu has joined #ruby
razi has quit [Quit: Leaving.]
timonv has joined #ruby
renderful has joined #ruby
browndawg has joined #ruby
dagobah has joined #ruby
alup has joined #ruby
predator117 has joined #ruby
smathieu has quit [Ping timeout: 264 seconds]
staafl_alt has quit [Ping timeout: 264 seconds]
nomenkun has quit [Remote host closed the connection]
jprovazn has joined #ruby
<rickruby> given an array of sudoku values
<rickruby> i'm trying to parse out the 9 boxes (of 3x3 cells)
<rickruby> but my numbering is all out of whack.. something to do with the index
Davey has quit [Quit: Computer has gone to sleep.]
<tobiasvl> uh, are you representing each box as an array?
maz-dev has joined #ruby
burlyscudd has joined #ruby
<tobiasvl> wait, is this to represent each individaul number, or each of the 3x3 boxes that make up the entire board
<rickruby> I want to represent 9 boxes, each box having 3 arrays for the 3x3 values
<Nilium> So you want an array of array of arrays.
<rickruby> sudoku_boxes = [[], [], [], [], [], [], [], [], []]
<rickruby> so the first inner array would be box 1
<rickruby> containing 3 arrays
<Nilium> You could just have an array of 9 arrays of 9 numbers.
<Nilium> Maybe use a Matrix.
rshetty_ has quit [Quit: Sleeping]
<rickruby> hmm matrix class
<tobiasvl> instead of `for i in 0..2` (loops like that aren't used much in ruby) maybe you could use % ?
<tobiasvl> modulo
lutfidemirci has quit [Remote host closed the connection]
<rickruby> how is % used in place of for ?
burlyscudd has quit [Ping timeout: 246 seconds]
Alkorn has joined #ruby
<Nilium> I'm also not really sure how % would work with a range.
graydot has joined #ruby
<Nilium> That said, (0..2).each { |i| } would be more normal
adambeynon has joined #ruby
<rickruby> Ah okay
<Nilium> How what is happen what
Spami has joined #ruby
marcdel has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Alkorn> Why 3
<Nilium> How is that not the expected result?
<Nilium> What do you think it should be?
mahmoudimus has quit [Quit: Computer has gone to sleep.]
<Alkorn> 10
<Nilium> Why would it be 10?
<rickruby> so is (0..2).each_with_index do |obj, i| preferable in ruby to for i in 0..2 ?
<rickruby> even though I will never use obj
<Alkorn> oh 8
<tobiasvl> rickruby: why _with_index??
<Alkorn> 2+3+3
maxmanders has joined #ruby
<Nilium> What tobiasvl said.
<rickruby> i'm using the index to multiply the start index of a slice operation
<Nilium> Alkorn: Why would either of those be anything other than 1?
<Alkorn> becose ++i
anay has quit [Remote host closed the connection]
<Nilium> There's no post/pre-in/decrement.
<Alkorn> i have to increment before use
<Nilium> Those do not exist in Ruby.
<tobiasvl> and even if they did, wouldn't that code be `1 += 2 + 3` giving 6? :/
<Alkorn> do not exist at all or work like post increment
<Nilium> It would probably be undefined behavior.
ndrei has joined #ruby
<tobiasvl> Nilium:
<Nilium> I don't know why +num returns num -- that is to say that prefix + for Numeric just returns self.
troessner has joined #ruby
<tobiasvl> oops
<tobiasvl> Nilium: yeah, prefix + is just the opposite of prefix -
<Nilium> It's just odd that it's defined in the first place.
<Nilium> The behavior makes sense, just seems like the world's most unused operator in this case.
<Alkorn> Ерфтлы пгны ш ыешдд куфддн тщщин шт кгин иге ш мукн дшлу ше
<Alkorn> sry
<Nilium> At any rate, Alkorn, your expression is equivalent to i + i since +i is just i and ++i is also i.
<Alkorn> I said thanks guys for your help
Zespre has quit [Quit: leaving]
<Alkorn> Ruby comunity is great
<Nilium> In the future, though, do check the docs
elaptics`away is now known as elaptics
Zespre has joined #ruby
<Nilium> Not only do you get to see what something is but you can also see its source code.
anay_ has joined #ruby
<Nilium> Helps to know C for that, by the way.
tonini has joined #ruby
<Alkorn> I have some probem with that becose i had sove Java background and may things is really unexpected for me
intuxicated has quit [Remote host closed the connection]
<Nilium> Alkorn: Since you're on OS X, check out Dash.
<Alkorn> no I am on linux it just funny pic that i uldn't understand but now I'm ok
<Nilium> Ah, darn. No doc browser for you then.
<Veejay> Hello everyone
mootpointer has quit [Quit: Computer has gone to sleep.]
<Veejay> Is it possible to do something like case respond_to? when something on an object in Ruby?
darth_chatri has quit [Quit: Leaving.]
<Veejay> With different cases
<Nilium> Like case; when o.respond_to? ... ; when ... ; when ... ; end?
<Veejay> That'd work? Nice
<Veejay> The respond_to part has to go in the when then, eh?
<Veejay> OK, thanks
k0rupted has joined #ruby
blaxter_ is now known as blaxter
ybart has joined #ruby
AkashicLegend has quit [Quit: AkashicLegend]
<popl> o/
popl has quit [Quit: We must make an idol of our fear, and call it God.]
vlad_starkov has joined #ruby
kaspernj has joined #ruby
timonv has quit [Remote host closed the connection]
dEPy has joined #ruby
ybart has quit [Quit: ybart]
Domon has quit [Remote host closed the connection]
Domon has joined #ruby
darth_chatri has joined #ruby
vlad_starkov has quit [Ping timeout: 264 seconds]
cads2 has joined #ruby
MrZYX|off is now known as MrZYX
Coffers has joined #ruby
ferdev has quit [Ping timeout: 248 seconds]
heftig has joined #ruby
mansi has joined #ruby
cads has quit [Ping timeout: 264 seconds]
Al_ has joined #ruby
marcgg has quit [Remote host closed the connection]
ChristianS has quit [Excess Flood]
ChristianS has joined #ruby
<hanmac> Veejay & Nilium using case without an case variable is an "missunsing" imo … use if and elsif for that
niceguyjames has joined #ruby
<Nilium> Is that a word? O_o
<Nilium> At any rate, I prefer case without an expression for lengthy one-line sequences
bamdad has joined #ruby
<hanmac> oO that what " ? : " is for oO
<Nilium> What, you nest ternaries?
mikecmpbll has joined #ruby
marcgg has joined #ruby
mansi has quit [Ping timeout: 264 seconds]
shaunbaker has joined #ruby
mneorr has joined #ruby
rshetty has joined #ruby
<hanmac> i do if i need to
DaniG2k has joined #ruby
<sevenseacat> ew
<Nilium> Note to self: never take style advice from hanmac
mneorr has quit [Remote host closed the connection]
niceguyjames has quit [Quit: Textual IRC Client: www.textualapp.com]
<hanmac> Nilium and you didnt see my C/C++ code for my bindings ;P … i use C-macros, that call other C-macros, that uses C++ templates, that generates C-fuctions that are bind to Ruby methods
ntus1017 has joined #ruby
<Nilium> I try to avoid macros in C where possible.
<Nilium> They're handy for concatenation, however.
<Nilium> Though that said, my 3D math gem's C source was.. uh.. mostly macros for a while
Zai00 has joined #ruby
<Nilium> But it turns out that rdoc doesn't like that.
hanmac2 has joined #ruby
<hanmac2> Nilum i use macros for making attr methods, like macro_attr(Position,sf::Vector2) that makes _getPosition and _setPosition fuctions that i can use in rb_define_method (but i use an new fuction so rdoc does not notic that, but i have an rb_define_attr inside an #if 0 block)
MrZYX is now known as MrZYX|off
<Nilium> That's.. why
<Nilium> Well, whatever, can't cure insanity.
hanmac has quit [Ping timeout: 268 seconds]
<Nilium> I can't be stopped from reinventing certain wheels and you can't be stopped from doing horrible, horrible things with the ternary operator and macros.
bamdad has quit [Quit: bamdad]
blitz has quit [Ping timeout: 264 seconds]
<hanmac2> i use my macros because in some bindings they have automaticlly exception handling and turning c++ Exceptions into ruby ones (just image you need todo it with your own hands for each function you write)
TonyMergue has joined #ruby
<Nilium> That doesn't really make it any better..
smathieu has joined #ruby
<Nilium> That said, I just disable exceptions in C++, so eh
lkba has quit [Ping timeout: 240 seconds]
Brando753 has quit [Ping timeout: 264 seconds]
kaspernj has left #ruby ["Leaving"]
kaspernj has joined #ruby
byprdct has joined #ruby
kaspernj has quit [Remote host closed the connection]
<hanmac2> Nilium: so for a binding, how would you catch if there happend something wrong? or did you just drive into an segfault?
ntus1017 has quit [Remote host closed the connection]
hanmac2 is now known as hanmac
kaspernj has joined #ruby
Brando753 has joined #ruby
marcgg has quit [Remote host closed the connection]
<Nilium> If the code throws exceptions in C++, I wouldn't make bindings for it.
<Nilium> Exceptions are bad enough as is.
mneorr has joined #ruby
pedda has joined #ruby
hamed_r has joined #ruby
<hanmac> oO what else should the C++ library use?
<Nilium> Error codes, return values, etc.
<Nilium> Basically, things that don't just cause crashes.
Nenor has joined #ruby
smathieu has quit [Ping timeout: 276 seconds]
denver has joined #ruby
<Nilium> Heck, you've got errno which is actually pretty useful since it's typically implemented as a thread-local variable.
banister`sleep has joined #ruby
<hanmac> thats so C style, and maybe not the right one for higher C++ libs
<Nilium> My entire engine is written in C++11 and it does not permit exceptions.
<Nilium> That is to say it will cause a compiler error to throw or catch an exception.
sleetdrop has joined #ruby
noname001 has joined #ruby
<spectre|> +1 for no exceptions in cpp
<Nilium> As far as I'm concerned, exceptions in C++ are poorly designed and not worth using.
kevinykchan has quit [Quit: Computer has gone to sleep.]
buibex has joined #ruby
goleldar has quit [Ping timeout: 245 seconds]
burlyscudd has joined #ruby
goleldar has joined #ruby
timonv has joined #ruby
echevemaster has quit [Quit: Leaving]
vlad_starkov has joined #ruby
ewnd9 has joined #ruby
mahmoudimus has joined #ruby
rdark has joined #ruby
Mon_Ouie has joined #ruby
marcgg has joined #ruby
burlyscudd has quit [Ping timeout: 264 seconds]
tkuchiki has quit [Ping timeout: 256 seconds]
<hanmac> apeiros: what is your opinion?
yfeldblum has quit [Ping timeout: 256 seconds]
g4_ has joined #ruby
anay_ has quit [Remote host closed the connection]
tkuchiki has joined #ruby
<apeiros> on what?
seitensei has quit [Read error: No route to host]
msuszczy has joined #ruby
vlad_starkov has quit [Remote host closed the connection]
<Nilium> Mouthwash
vlad_starkov has joined #ruby
<apeiros> horrible band
<Nilium> I meant the stuff that you drink when you're interested in buying expensive poison but not letting anyone onto the fact that you drink alcohol
<Nilium> "Oh, you mean mike's hard lemonade"
bluOxigen has joined #ruby
himsin has joined #ruby
elaptics is now known as elaptics`away
ephemerian has joined #ruby
bigkevmcd has quit [Quit: Ex-Chat]
bigkevmcd has joined #ruby
kjellski has joined #ruby
vlad_starkov has quit [Ping timeout: 256 seconds]
anay has joined #ruby
marcgg_ has joined #ruby
lkba has joined #ruby
goleldar has quit [Ping timeout: 256 seconds]
locriani has quit [Remote host closed the connection]
sheeny has joined #ruby
afd__ has quit [Read error: Operation timed out]
locriani has joined #ruby
<sheeny> Hi all could anyone point me in the correct direction for something
<sheeny> I need to end up with this: https://gist.github.com/craigsheen/6060894 .. but after looping through an array
yfeldblum has joined #ruby
<hanmac> apeiros: no i mean about C++Exceptions
intuxicated has joined #ruby
<sheeny> So a gas_assessment has many wells so i need to loop through the wells and have it come out in that format
<apeiros> I have no experience with C++, sorry
<tobiasvl> sheeny: what do you mean, after looping
banister`sleep has quit [Remote host closed the connection]
<sheeny> tobiasvl: Ill update my gist
marcgg has quit [Ping timeout: 264 seconds]
marcgg has joined #ruby
buibex has quit [Remote host closed the connection]
<sheeny> hmm maybe this is better for rubyonrails tag
locriani has quit [Ping timeout: 268 seconds]
zai has joined #ruby
afd__ has joined #ruby
trepidaciousMBR has joined #ruby
marcgg_ has quit [Ping timeout: 248 seconds]
<sheeny> updated
<sheeny> maybe a RoR.. sorry ill ask there
graydot has quit [Quit: graydot]
<sheeny> well its ruby
ejnahc has joined #ruby
<sheeny> i guess
<sevenseacat> is there a question in there?
k0rupted has quit [Ping timeout: 246 seconds]
<sheeny> How do I loop through them and get it in the format at the bottom?
<sheeny> the output at the bottom i just put in manually
ewnd9 has quit [Ping timeout: 246 seconds]
<tobiasvl> so you don't know ruby?
<sheeny> bits
marcgg_ has joined #ruby
<tobiasvl> or are you wondering how to dynamically get the name of the attribute and strip "_id" to get the key names
<tobiasvl> or what exactly are you wondering how to do
<sheeny> so
<sheeny> like
<sheeny> updated the gist
banister`sleep has joined #ruby
<sheeny> oh hang on i've just realised i could get that to work :$
mneorr has quit [Remote host closed the connection]
<tobiasvl> ok, good luck!
<sevenseacat> jolly good.
<tobiasvl> there's still some code missing there. next time, please give us all relevant code and all the data structures
<sevenseacat> as an aside, doing "#{well_id}" is the same thing as just well_id.to_s
<sevenseacat> and unnecessary if its already a string
<apeiros> +1
<sheeny> will take that out
<sheeny> :)
<sheeny> thanks
marcgg has quit [Ping timeout: 264 seconds]
k610 has joined #ruby
<sheeny> argh now the difficulty of fighting with RubyMotion as they dont allow map
<sheeny> joy
mansi has joined #ruby
sheeny has quit [Quit: Page closed]
Spooner has joined #ruby
LMolr has joined #ruby
hamed_r has quit [Ping timeout: 268 seconds]
romdi` has joined #ruby
lady_lancer has quit [Quit: Page closed]
blackmesa has joined #ruby
BizarreCake has joined #ruby
sevenseacat has left #ruby [#ruby]
fermion has joined #ruby
timonv has quit [Remote host closed the connection]
filipe has quit [Ping timeout: 268 seconds]
mansi has quit [Ping timeout: 248 seconds]
romdi has quit [Ping timeout: 246 seconds]
renderful has quit [Remote host closed the connection]
nari has quit [Ping timeout: 264 seconds]
mansi has joined #ruby
deeepblue has joined #ruby
wudofyr has quit [Remote host closed the connection]
wudofyr has joined #ruby
buibex has joined #ruby
mansi has quit [Remote host closed the connection]
cha1tanya has joined #ruby
cha1tanya has joined #ruby
cha1tanya has quit [Changing host]
k0rupted has joined #ruby
mansi has joined #ruby
aaronmcadam has joined #ruby
axsuul has joined #ruby
nomenkun has joined #ruby
marr has joined #ruby
hamed_r has joined #ruby
renderful has joined #ruby
renderful has quit [Remote host closed the connection]
Xeago has joined #ruby
mansi has quit [Ping timeout: 245 seconds]
smathieu has joined #ruby
buibex has quit [Remote host closed the connection]
filipe has joined #ruby
obs has joined #ruby
marcgg_ has quit [Read error: Connection reset by peer]
marcgg has joined #ruby
smathieu has quit [Ping timeout: 276 seconds]
ndrei has quit [Ping timeout: 264 seconds]
Kar- has joined #ruby
AndChat| has joined #ruby
banister`sleep has quit [Read error: Connection reset by peer]
timonv has joined #ruby
buibex has joined #ruby
fixl has joined #ruby
amacgregor has joined #ruby
marcgg_ has joined #ruby
icecandy has quit [Remote host closed the connection]
denver has quit [Ping timeout: 246 seconds]
burlyscudd has joined #ruby
lkba has quit [Ping timeout: 248 seconds]
hogeo has quit [Remote host closed the connection]
_29900daysleft has joined #ruby
marcgg has quit [Read error: No route to host]
mneorr has joined #ruby
marcgg has joined #ruby
graydot has joined #ruby
\du has joined #ruby
stef_204 has joined #ruby
<\du> hello, there is any difference between foo['bar'] and foo[:bar] ?
guiocavalca_off has joined #ruby
denver has joined #ruby
buibex has quit [Remote host closed the connection]
<apeiros> yes
<apeiros> >> ['foo'.class, :foo.class]
<eval-in> apeiros => [String, Symbol] (https://eval.in/38513)
filipe has quit [Ping timeout: 246 seconds]
renderful has joined #ruby
marcgg_ has quit [Ping timeout: 256 seconds]
burlyscudd has quit [Ping timeout: 276 seconds]
<\du> if i ask with '' i get a string but with : i get a symbol?
<apeiros> o0
<\du> sorry i am new in ruby, actually i am using it to develop chef recipe
<apeiros> I don't know what you mean by 'ask'
<apeiros> foo['bar'] calls the method [] on foo, and passes 'bar' as an argument
<\du> foo['bar'] result string, foo[:bar] result symbol ?
<apeiros> no
<apeiros> the result depends on what the method [] on foo does
goodgame has joined #ruby
ndrei has joined #ruby
renderful has quit [Remote host closed the connection]
<apeiros> assuming foo is a Hash, then 'bar' and :bar are two different hash keys
<\du> i see, [] it's not like an array it's a method call
kiri has quit [Ping timeout: 264 seconds]
_29900daysleft has quit [Quit: Leaving.]
<apeiros> >> foo = {'bar' => 12, :bar => 37}; foo['bar']
<eval-in> apeiros => 12 (https://eval.in/38515)
<\du> and if foo it's a class ?
<apeiros> >> foo = {'bar' => 12, :bar => 37}; foo[:bar]
<eval-in> apeiros => 37 (https://eval.in/38516)
<Xeago> \du: do you use rails or active_support?
<\du> i am using ruby, to opscode chef recipe
Domon has quit [Remote host closed the connection]
kiri has joined #ruby
<tobiasvl> \du: [] is "like an array", but in ruby, it's a method. foo['bar'] is syntactic sugar for foo.[]('bar')
<Xeago> then remember 'bar' and :bar are two different objects, things
<\du> there is a node class i think so
<\du> i take it
<\du> thanks
<apeiros> there's a difference between: `x = [1,2,3]` and `x[1,2,3]`
<apeiros> the former is an Array (an Array literal to be precise)
dagobah_ has joined #ruby
dagobah has quit [Read error: Connection reset by peer]
<apeiros> the latter is "call the method with name '[]' on x, passing the arguments 1, 2, 3"
Domon has joined #ruby
includex has joined #ruby
workmad3 has joined #ruby
<\du> see it, if i want merge default[:opsworks_agent][:base_dir] and default[:opsworks_agent][:base_dir]
<\du> how i should do it?
<apeiros> those are both the same?
<apeiros> copy & paste failure? :)
marcgg_ has joined #ruby
<\du> (there is implicit a node.default[.., node it's a class)
<\du> sorry, i will speak again, see the end of the file
guiocavalca_off has quit [Remote host closed the connection]
<\du> where say node.default[:opsworks_agent][:base_dir] ( i add the node. that it;s implicit in the file)
guiocavalca_off has joined #ruby
buibex has joined #ruby
<\du> i want have [:my][:apache][:dir] and [:my][:mysql][:dir] and later merge this too into default[:opsworks_initial_setup][:bind_mounts][:mounts] = {}
<\du> (i dont care override the default[:opsworks_initial_setup][:bind_mounts][:mounts] data, it's more i want do it)
gyre007 has joined #ruby
osvico has joined #ruby
marcgg has quit [Ping timeout: 248 seconds]
buibex has quit [Remote host closed the connection]
gyre007 has quit [Remote host closed the connection]
buibex has joined #ruby
gyre007 has joined #ruby
pierre1 has joined #ruby
guiocavalca_off has quit [Ping timeout: 264 seconds]
shaunbaker has quit [Remote host closed the connection]
filipe has joined #ruby
<\du> i think that i did it
Banistergalaxy has quit [Ping timeout: 264 seconds]
cj3kim has quit [Remote host closed the connection]
Lindrian has joined #ruby
xcv has joined #ruby
guns has joined #ruby
<LMolr> if i have a class A defined inside module M, can't I access to methods defined in M without needing to fully qualify them?
blueOxigen has joined #ruby
vlad_starkov has joined #ruby
guns has quit [Client Quit]
Kar- has quit [Remote host closed the connection]
bluOxigen has quit [Ping timeout: 276 seconds]
emergion has joined #ruby
amacgregor has quit [Ping timeout: 248 seconds]
pierre1 has quit [Quit: Leaving]
<kjellski> Someone familiar with Trollop? Is there a way to ask wether one option was set by default or the user via ARGV?
adeponte has quit [Remote host closed the connection]
adeponte has joined #ruby
anay has quit [Read error: Connection reset by peer]
anay_ has joined #ruby
kaspernj has quit [Remote host closed the connection]
anay_ has quit [Remote host closed the connection]
<LMolr> kjellski, if i recall correctly, the options hash will have a :<option_name>_given => true
ndrei has quit [Ping timeout: 264 seconds]
<kjellski> LMolr: thanks, I'll watch out for that… :)
tonini has quit [Remote host closed the connection]
filipe has quit [Ping timeout: 268 seconds]
adeponte has quit [Ping timeout: 268 seconds]
<LMolr> :)
bluOxigen has joined #ruby
shaunbaker has joined #ruby
emergion has quit [Quit: Computer has gone to sleep.]
renderful has joined #ruby
mikecmpbll has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
mikecmpbll has joined #ruby
darth_chatri has quit [Ping timeout: 246 seconds]
blueOxigen has quit [Ping timeout: 246 seconds]
mbessey has joined #ruby
binaryplease has joined #ruby
Kar- has joined #ruby
darth_chatri has joined #ruby
<mbessey> f = ->(time=Time.now) { puts time }
marcgg has joined #ruby
<mbessey> in an hours time, what will f's output be?
<mbessey> (i.e. is the default argument evaluated lazily?)
blueOxigen has joined #ruby
Arya_ has joined #ruby
buibex has quit [Remote host closed the connection]
<epitron> that's easy to test :)
<mbessey> Hah yes, i just thought that, well if anyone is wondering, it is lazily evaluated
<Mon_Ouie> default arguments are re-evaluated every time
<workmad3> mbessey: it's a big difference between default args in ruby compared to python ;)
marcgg__ has joined #ruby
<epitron> uh, that's not very lazy :)
<epitron> that's pretty EAGER
marcgg has quit [Read error: Connection reset by peer]
<workmad3> epitron: eager would mean that it's evaluated once, during the method definition, and the result re-used on anything that needs the default arg
<Mon_Ouie> e.g. gets can be defined as def gets(sep = $/)
<epitron> workmad3: it's more eager than lazy though ;)
<workmad3> epochwolf: not particularly
<workmad3> epitron: ^^
<mbessey> I can see where @epitron is coming from
<workmad3> epitron: lazy just means 'don't evaluate until you absolutely need to'
AndChat| has quit [Ping timeout: 248 seconds]
<epitron> yes, we're using the wrong terminology
bluOxigen has quit [Ping timeout: 256 seconds]
<epitron> cached is the word he should've used
<epitron> i was just GOING WITH IT MAN
marcgg_ has quit [Ping timeout: 264 seconds]
<workmad3> epitron: it isn't cached either though :P
<epitron> it's not cached, right
<epitron> that's the answer
<mbessey> maybe we need a new word, "procrastinated evaluation"?
<mbessey> forgetful?
<epitron> haha
Anarch has quit [Ping timeout: 256 seconds]
<epitron> forgetfully evaluated
Arya_ has quit [Ping timeout: 246 seconds]
marcgg has joined #ruby
renderful has quit [Ping timeout: 268 seconds]
<zendeavor> you're thinking of lazy evaluation wrt functional programming concepts
YaNakilon has joined #ruby
ndrei has joined #ruby
<zendeavor> it's not lazily evaluated; it's simply always evaluated.
<zendeavor> in _this_ case they have the same result.
<epitron> yes, i think that point has quite thoroughly been made :)
Anarch has joined #ruby
ananthakumaran has quit [Ping timeout: 264 seconds]
tvw has quit [Ping timeout: 268 seconds]
marcgg__ has quit [Ping timeout: 256 seconds]
senayar has quit [Remote host closed the connection]
dhruvasa1ar has quit [Ping timeout: 264 seconds]
maz-dev has quit [Ping timeout: 264 seconds]
kaspergrubbe has quit [Remote host closed the connection]
filipe has joined #ruby
dhruvasagar has joined #ruby
axsuul has quit [Ping timeout: 248 seconds]
lutfidemirci has joined #ruby
S0da has joined #ruby
senayar has joined #ruby
mansi has joined #ruby
BRMatt has joined #ruby
kaspernj has joined #ruby
includex has quit [Quit: Leaving...]
buibex has joined #ruby
kaspergrubbe has joined #ruby
gildo has joined #ruby
S0da has quit [Ping timeout: 245 seconds]
mansi has quit [Ping timeout: 264 seconds]
workmad3 has quit [Ping timeout: 264 seconds]
trepidaciousMBR_ has joined #ruby
trepidaciousMBR has quit [Ping timeout: 246 seconds]
trepidaciousMBR_ is now known as trepidaciousMBR
dhruvasagar has quit [Ping timeout: 268 seconds]
mootpointer has joined #ruby
burlyscudd has joined #ruby
dhruvasagar has joined #ruby
anonymuse has joined #ruby
lutfidemirci has quit [Read error: Connection reset by peer]
Banistergalaxy has joined #ruby
mklappstuhl has joined #ruby
emergion has joined #ruby
lutfidemirci has joined #ruby
kjellski has quit [Quit: This computer has gone to sleep]
soukihei has quit [Read error: Operation timed out]
burlyscudd has quit [Ping timeout: 264 seconds]
jibi has joined #ruby
ananthakumaran has joined #ruby
postmodern has quit [Quit: Leaving]
dhruvasagar has quit [Ping timeout: 256 seconds]
dhruvasagar has joined #ruby
BizarreCake has quit [Read error: Connection reset by peer]
BizarreCake has joined #ruby
renderful has joined #ruby
D4T has joined #ruby
milardovich has joined #ruby
LMolr has quit [Ping timeout: 246 seconds]
MrZYX|off is now known as MrZYX
MrZYX is now known as MrZYX|off
dhruvasagar has quit [Ping timeout: 246 seconds]
Domon has quit [Remote host closed the connection]
dhruvasagar has joined #ruby
Perceptes has left #ruby [#ruby]
Spami has quit [Quit: This computer has gone to sleep]
renderful has quit [Ping timeout: 245 seconds]
haxrbyte has quit [Read error: Connection reset by peer]
haxrbyte_ has joined #ruby
workmad3_ has joined #ruby
Spami has joined #ruby
Spami has joined #ruby
Spami has quit [Changing host]
hanmac has quit [Quit: Leaving.]
workmad3_ is now known as workmad3
mootpointer has quit [Quit: Computer has gone to sleep.]
d3 has quit [Ping timeout: 264 seconds]
Myrth has quit [Ping timeout: 245 seconds]
<D4T> whats wrong with this line (or whats right with it lol) whilst in Net::SSH: ssh.exec!("echo 'numvcpus = \"1\"' \>\> '#{vmx_path}'")
procarps60 has quit [Quit: procarps60]
<D4T> that ends up as sending this to the vmx_path file: 2 = "1"
amacgregor has joined #ruby
RonScagz has joined #ruby
BizarreCake has quit [Read error: Connection reset by peer]
pygospa has quit [Disconnected by services]
TheRealPygo has joined #ruby
TheRealPygo is now known as pygospa
trepidaciousMBR has quit [Quit: trepidaciousMBR]
patsToms has joined #ruby
<rickruby> how can I make a duplicate of an array without modifying the original ?
<rickruby> I keep getting a reference to the object
choobie has joined #ruby
_whitelogger has joined #ruby
mlue has joined #ruby
yebyen has joined #ruby
queequeg1 has joined #ruby
Gate has joined #ruby
speakingcode-wor has joined #ruby
mlue has quit [Changing host]
mlue has joined #ruby
ohcibi has joined #ruby
hackeron has joined #ruby
lele has joined #ruby
JaTochNietDan has joined #ruby
Astral__ has joined #ruby
noname001 has quit [Excess Flood]
shaileshg has joined #ruby
derf- has joined #ruby
alup has joined #ruby
hackeron has quit [Changing host]
hackeron has joined #ruby
dagobah has joined #ruby
anekos has joined #ruby
Gate has joined #ruby
Gate has quit [Changing host]
randym_ has joined #ruby
ixx is now known as Guest22110
moeSeth has joined #ruby
taec is now known as Guest8419
phasma has joined #ruby
Schmidt has joined #ruby
keyvan has joined #ruby
Cork has joined #ruby
yebyen is now known as Guest60679
lancepantz_ has joined #ruby
rayfinkle has joined #ruby
dhruvasagar has quit [Ping timeout: 268 seconds]
colonolGron has joined #ruby
ainame has joined #ruby
lancepantz_ is now known as lancepantz
ayonix has joined #ruby
dhruvasagar has joined #ruby
autumn has joined #ruby
corehook has joined #ruby
colonolGron has quit [Client Quit]
AllStruck has joined #ruby
ereslibre has joined #ruby
ereslibre has quit [Changing host]
ereslibre has joined #ruby
[0x1a] has joined #ruby
<rickruby> known_cell_values = sudoku_rows.dup
<rickruby> doesn't seem to work for me... it's still modifying sudoku_rows when I modify known_cell_values
shaunbaker has quit [Remote host closed the connection]
maroloccio has joined #ruby
JStoker has joined #ruby
Norrin has joined #ruby
sonne has joined #ruby
noname001 has joined #ruby
DonVitoCorleone has joined #ruby
DonVitoCorleone has quit [Changing host]
DonVitoCorleone has joined #ruby
<zendeavor> ary2 = Array.new(ary1) ?
<tobiasvl> rickruby: did you read my link?
Astral__ has quit [Read error: Connection reset by peer]
<workmad3> rickruby: dup or clone on an array is a shallow copy
Astral__ has joined #ruby
<workmad3> rickruby: so if you casue changes to the objects within the array, they will still be reflected across both arrays... but you can add and remove items from one array without it reflecting in the other
<rickruby> oh I see, had never heard of shallow copies
<rickruby> thanks
<apeiros> wanting a deep copy is indicative of broken design
<apeiros> i.e., "deep copy" == "code smell"
<tobiasvl> true
<workmad3> apeiros: COW FTW!!!
awc737 has joined #ruby
<tobiasvl> rickruby: you can do Marshal.load(Marshal.dump(sudoku_rows) too maybe
<apeiros> workmad3: bah cow, it's all rabbits & turtles down the way.
<tobiasvl> it's a multidimensional array?
<workmad3> tobiasvl: pfft, why not just do sudoku_rows.map(&:dup) :P
rdark has quit [Ping timeout: 256 seconds]
ananthakumaran has quit [Read error: Connection timed out]
Rubba has quit [Ping timeout: 264 seconds]
<workmad3> (I'll admit, that won't handle arbitrarily nested arrays)
ananthakumaran has joined #ruby
dhruvasagar has quit [Ping timeout: 264 seconds]
tkuchiki has quit [Remote host closed the connection]
rdark has joined #ruby
dhruvasagar has joined #ruby
tkuchiki has joined #ruby
krz has quit [Quit: krz]
krz has joined #ruby
<rickruby> zendeavor: ary2 = Array.new(ary1) also produced shallow copy
emergion has quit [Quit: Computer has gone to sleep.]
<rickruby> hm
<rickruby> is it bad coding practice to want a duplicate array ?
<tobiasvl> why do you want to duplicate it?
<rickruby> basically want a copy because I'm translating all the elements to a true/false copy
<apeiros> duplicate an array: no. but deep copy usually is, yes.
<apeiros> rickruby: Array#map
shaunbaker has joined #ruby
<apeiros> already produces a copy
<rickruby> sudoku boards come with known values so I am designating cells that have values already filled in as "locked" so I don't try generate a number for them
buibex has quit [Remote host closed the connection]
<rickruby> apeiros thanks checking it out
<workmad3> rickruby: that doesn't imply the need to deep-copy the entire grid into a new data structure
mneorr has quit [Remote host closed the connection]
<apeiros> rickruby: also consider introducing proper classes
<apeiros> which can implement their own proper #dup/#clone (see #initialize_copy for that too)
hanmac has joined #ruby
ataxic27 has joined #ruby
tkuchiki has quit [Ping timeout: 248 seconds]
<tobiasvl> rickruby: when creating the initial board, just put an extra `known_numbers[i][j] = true` in the loop? then you can just look up both arrays later with the same indices
<tobiasvl> maybe
krz has quit [Client Quit]
ataxic27 has quit [Client Quit]
krz has joined #ruby
krz has quit [Changing host]
krz has joined #ruby
<workmad3> tobiasvl: heh :) I'd personally populate each item in the grid with a hash of the form {:value => 3, :locked => true}
<workmad3> or :value => nil, :locked => false in the case of a blank cell
<tobiasvl> yeah, that's definitely cleaner, i just guessed he had to work within some data structure constraints
<apeiros> classes! damn you guys
corehook has quit [Quit: Ухожу я от вас (xchat 2.4.5 или старше)]
<tobiasvl> but doing this in a real OO way is probably better. creating classes for Column, Row, Cell, Box, etc
<apeiros> this is OOP, not H&AOP (hash & array oriented programming)
<rickruby> been learning as I go a lot of this stuff I don't know
<workmad3> apeiros: oh, sorry... SudokuCell = Struct.new(:value, :locked) :P
<tobiasvl> apeiros: hivemind ;)
<apeiros> the fun thing is with regards to sudoku that rows, columns and "boxes" behave the same
<apeiros> i.e. you can stick to a single class
<rickruby> https://github.com/rickarubio/sudoku_solver is where I'm at so far
<apeiros> workmad3: tbh, that's IMO much better than a hash
<rickruby> getting boxes took me forever
<apeiros> workmad3: a) it's somewhat self documenting and b) it is less prone to accidental errors
<tobiasvl> oh man
<tobiasvl> rickruby: that for loop with all those elsifs …
<tobiasvl> that's pretty ugly
<tobiasvl> sorry
dhruvasagar has quit [Ping timeout: 245 seconds]
<rickruby> yeah.. not sure how else to do it
<workmad3> apeiros: yeah... I'm just dealing with hashes a lot at the moment as I throw them through a message queue as json :)
<apeiros> ^^
<apeiros> soon, soon I'll have my time to play with sidekiq
<workmad3> apeiros: I'm playing with bunnies... well Bunny :)
<tobiasvl> rickruby: when you're programming and you're copying and pasting code, your first thought should be "hmm, how can i automate this/do it dynamically"
<apeiros> starting to implement partner processes with a proper job queue. that'll make so much ugly so much nicer.
rdark has quit [Ping timeout: 264 seconds]
dhruvasagar has joined #ruby
haxrbyte has joined #ruby
blackmesa has quit [Ping timeout: 240 seconds]
haxrbyte_ has quit [Remote host closed the connection]
<workmad3> apeiros: the nice thing I've got set up is that I can throw my job start messages into a general queue, they can be picked up by any consumer... that then processes the job, which opens up a queue directly to that job for further communication :)
mneorr has joined #ruby
rdark has joined #ruby
blackmesa has joined #ruby
noname001 has quit [Remote host closed the connection]
noname001 has joined #ruby
krnflake has joined #ruby
Kol has joined #ruby
<apeiros> the nice thing about sidekiq is that I don't worry about the queue, I only implement the kick-off and the consumer :)
ndrei has quit [Ping timeout: 248 seconds]
trepidaciousMBR has joined #ruby
<workmad3> apeiros: same thing with bunny
<apeiros> RABBITS! ALL THE WAY! TOLD YOU!
<workmad3> apeiros: RabbitMQ ftw!!!
mansi has joined #ruby
* apeiros goes to implement TurtleMQ
goodgame has quit [Ping timeout: 268 seconds]
mootpointer has joined #ruby
<workmad3> apeiros: I wouldn't fancy writing my own message queue tbh :) could hack together a simple one really easily, but once you start getting into routing, persistence, redelivery, and guaranteeing delivery... that's when I just go 'nope, not smart enough... lets get some crazy erlang coder to do it for me'
zomgbie has quit [Read error: Connection reset by peer]
zomgbie has joined #ruby
<joonty> apeiros: unrelated, but is the eval-in/cinch bot source code for #ruby publicly available?
fixl has quit [Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/]
hamed_r has quit [Ping timeout: 276 seconds]
kofno has joined #ruby
ananthakumaran has quit [Read error: Connection timed out]
buibex has joined #ruby
ananthakumaran has joined #ruby
mmitchell has joined #ruby
dhruvasagar has quit [Ping timeout: 246 seconds]
<apeiros> joonty: eval-in is charliesome's bot
<apeiros> no idea whether the source is open
mansi has quit [Ping timeout: 264 seconds]
<joonty> ah ok, i'll try and catch him
dhruvasagar has joined #ruby
himsin has quit [Quit: himsin]
<joonty> thanks
ndrei has joined #ruby
burlyscudd has joined #ruby
PaulePanter has quit [Quit: leaving]
louism2wash has quit [Quit: This computer has gone to sleep]
anonymuse has quit [Remote host closed the connection]
lutfidemirci has quit [Read error: Connection reset by peer]
foo_ has joined #ruby
anonymuse has joined #ruby
burlyscudd has quit [Ping timeout: 248 seconds]
ravster has joined #ruby
lutfidemirci has joined #ruby
goodgame has joined #ruby
foo_ is now known as inomataj
krz has quit [Quit: krz]
krz has joined #ruby
krz has joined #ruby
krz has quit [Changing host]
hanmac has quit [Quit: Leaving.]
lutfidemirci has quit [Read error: Connection reset by peer]
threesome has quit [Read error: Connection reset by peer]
lutfidem_ has joined #ruby
mneorr has quit [Remote host closed the connection]
vlad_starkov has quit [Ping timeout: 276 seconds]
hamed_r has joined #ruby
graydot has quit [Quit: graydot]
threesome has joined #ruby
anonymuse has quit [Ping timeout: 240 seconds]
ndrei has quit [Ping timeout: 248 seconds]
dhruvasagar has quit [Ping timeout: 240 seconds]
renderful has joined #ruby
ldnunes has joined #ruby
<rickruby> any idea why this keeps failing:
<apeiros> because you do it wrong!
<rickruby> yet if I change row_index to 0 or some other number it works!
ndrei has joined #ruby
<rickruby> lol yes
<apeiros> which line is line 64?
dhruvasagar has joined #ruby
<rickruby> known_cell_values[row_index].push(false)
<apeiros> also, where does row_index come from?
<apeiros> I only see cell_index
<apeiros> ah, up
<rickruby> it's above the
<rickruby> yeah
<rickruby> I tried moving it up because wasn't working if I did each_with_index in the first loop either
<apeiros> why not sudoku_rows.each_with_index do |row, row_index| too?
LMolr has joined #ruby
<rickruby> yeah I tried that at first but couldn't get it working
<apeiros> anyway, again, you want Array#map
<rickruby> same error
ffio has quit [Ping timeout: 245 seconds]
<apeiros> sudoku_rows.map { |row| row.map { |cell| cell != 0 } }
aaronmcadam has quit [Quit: Leaving...]
<apeiros> the reason you probably get the exception because you have more rows than you should
<apeiros> check sudoku_rows.length
<rickruby> oh wow
sleetdrop has quit [Ping timeout: 264 seconds]
<rickruby> yeah that's right
<rickruby> I had 8 instead of 9
<rickruby> ah counting from 0 messes me up a lot heh
nikeita has joined #ruby
renderful has quit [Ping timeout: 256 seconds]
krz has quit [Quit: krz]
<rickruby> cool I did not know you could nest blocks
rdark has quit [Ping timeout: 248 seconds]
chase-work has joined #ruby
<apeiros> turtles, all the way.
hanmac has joined #ruby
fridim__ has joined #ruby
rdark has joined #ruby
smathieu has joined #ruby
xcv has quit [Remote host closed the connection]
PaulePanter has joined #ruby
maroloccio has quit [Quit: WeeChat 0.4.0]
dhruvasagar has quit [Ping timeout: 240 seconds]
wallerdev has joined #ruby
dhruvasagar has joined #ruby
jonathanwallace has joined #ruby
hamed_r has quit [Ping timeout: 276 seconds]
emergion has joined #ruby
<rickruby> so I reduced 12 lines into this really long line now:
<rickruby> sudoku_rows.each_with_index.map { |row, row_index| row.map {|cell| cell == true ? known_cell_values[row_index].push(true) : known_cell_values[row_index].push(false)} }
smathieu has quit [Ping timeout: 276 seconds]
lutfidem_ has quit [Ping timeout: 248 seconds]
<jlebrech> anyone use celluloid-http over em-http?
<jlebrech> as opposed*
krz has joined #ruby
darkstar| has joined #ruby
lurid has joined #ruby
<rickruby> apeiros: thanks for the help, got my lock_known_cell_values working now :D
workmad3 has quit [Ping timeout: 264 seconds]
tacos1de has quit [Ping timeout: 240 seconds]
buibex has quit [Remote host closed the connection]
LMolr has quit [Ping timeout: 276 seconds]
buibex has joined #ruby
inomataj has quit [Remote host closed the connection]
byprdct has quit [Quit: Textual IRC Client: www.textualapp.com]
tacos1de has joined #ruby
shouya has quit [Remote host closed the connection]
ntzrmtthihu777 has joined #ruby
veer has joined #ruby
realDAB has joined #ruby
<ntzrmtthihu777> hello, I don't suppose any of you guys know where I can download the javadoc files for jruby for use in eclipse?
veer is now known as Guest54088
horrification12 has joined #ruby
niceguyjames has joined #ruby
dhruvasagar has quit [Ping timeout: 240 seconds]
krz has quit [Quit: krz]
_veer has quit [Ping timeout: 264 seconds]
milardovich has quit [Quit: Leaving]
dhruvasagar has joined #ruby
Columcille has quit [Ping timeout: 240 seconds]
mikecmpbll has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
mklappstuhl has quit [Remote host closed the connection]
mklappstuhl has joined #ruby
huoxito has joined #ruby
anildigital is now known as anildigital_away
krz has joined #ruby
ananthakumaran has quit [Read error: Connection timed out]
ananthakumaran has joined #ruby
wargasm1 has joined #ruby
alienaut has quit [Read error: Connection reset by peer]
alienaut has joined #ruby
Nenor has quit [Quit: Nenor]
wargasm has quit [Ping timeout: 276 seconds]
binaryplease has quit [Ping timeout: 246 seconds]
marcgg_ has joined #ruby
kevinykchan has joined #ruby
shaunbaker has quit [Remote host closed the connection]
mark_locklear has joined #ruby
dhruvasagar has quit [Ping timeout: 264 seconds]
nari has joined #ruby
dhruvasagar has joined #ruby
jibi has quit [Ping timeout: 245 seconds]
nanoxd has joined #ruby
binaryplease has joined #ruby
osvico has quit [Ping timeout: 248 seconds]
nezumi has quit [Ping timeout: 276 seconds]
LMolr has joined #ruby
marcgg has quit [Ping timeout: 248 seconds]
emergion has quit [Quit: Computer has gone to sleep.]
mmitchell has quit [Remote host closed the connection]
enebo has joined #ruby
eka has joined #ruby
marcgg has joined #ruby
anildigital_away is now known as anildigital
Columcille has joined #ruby
darth_chatri has quit [Quit: Leaving.]
lutfidemirci has joined #ruby
dhruvasagar has quit [Ping timeout: 264 seconds]
marcgg_ has quit [Ping timeout: 264 seconds]
sailias has joined #ruby
mansi has joined #ruby
maycon has joined #ruby
lutfidemirci has quit [Read error: Connection reset by peer]
ZOGM has joined #ruby
jalcine has quit [Excess Flood]
emergion has joined #ruby
lutfidem_ has joined #ruby
mklappstuhl has quit [Remote host closed the connection]
Banistergalaxy has quit [Ping timeout: 245 seconds]
op84 has joined #ruby
lutfidem_ has quit [Remote host closed the connection]
Neomex has joined #ruby
lutfidemirci has joined #ruby
<op84> hi - trying to parse a datetime with timezone and the timezone is always wrong.. Time.strptime("1994-11-05T08:15:30-0500", '%Y-%m-%dT%H:%M:%S%z')
enebo has quit [Quit: enebo]
<op84> it always sets it to +0100
<op84> any clues?
realDAB has quit [Quit: realDAB]
iam4 has joined #ruby
mansi has quit [Ping timeout: 248 seconds]
niklasb has joined #ruby
lutfidemirci has quit [Ping timeout: 264 seconds]
burlyscudd has joined #ruby
iam4 has left #ruby [#ruby]
ddv has joined #ruby
Catie has joined #ruby
Spitfire has joined #ruby
Spitfire has quit [Changing host]
Spitfire has joined #ruby
d3 has joined #ruby
Catie is now known as Guest93132
shaunbaker has joined #ruby
brunoro__ has joined #ruby
sweet_kid has joined #ruby
jalcine has joined #ruby
tessi has joined #ruby
Nenor has joined #ruby
anonymuse has joined #ruby
jp- has joined #ruby
burlyscudd has quit [Ping timeout: 268 seconds]
ntus1017 has joined #ruby
Neomex has quit [Quit: Neomex]
Zeeraw has quit [Quit: Computer has gone to sleep.]
pranny has quit [Quit: Leaving.]
devoldmx3 has joined #ruby
nerdman has joined #ruby
devoldmx has quit [Ping timeout: 256 seconds]
TwinkleHood has joined #ruby
tkuchiki has joined #ruby
<TwinkleHood> Hey, is there a concrete difference between "Hello #{name}" and "Hello %s" % name ?
Nenor has quit [Quit: Nenor]
<hoelzro> not really
<hoelzro> well
<hoelzro> actually
jonathanwallace has quit [Ping timeout: 245 seconds]
<hoelzro> I'm guessing they *might* call different methods
<TwinkleHood> Right, but not really a super duper importnant reason to stick with one.
<hoelzro> >> class Test def method_missing(name) puts name end end puts "Hello #{Test.new}"
<eval-in> hoelzro => /tmp/execpad-4363e20450ff/source-4363e20450ff:2: syntax error, unexpected keyword_def, expecting '<' or ';' or '\n' ... (https://eval.in/38539)
<hoelzro> ugh.
anderson has quit [Quit: Leaving]
<hoelzro> >> class Test def method_missing(name) puts name; end end puts "Hello #{Test.new}"
<eval-in> hoelzro => /tmp/execpad-8c5e6c5998b3/source-8c5e6c5998b3:2: syntax error, unexpected keyword_def, expecting '<' or ';' or '\n' ... (https://eval.in/38540)
* hoelzro gives up
freerobby has joined #ruby
mootpointer has quit [Quit: Computer has gone to sleep.]
<apeiros> op84: Time from ruby core only really knows two time zones - utc and local
<TwinkleHood> >> class Test; def method_missing(name); puts name; end; end; puts "Hello #{Test.new}";
<eval-in> twinklehood => Hello #<Test:0x407bcf4c> ... (https://eval.in/38541)
<TwinkleHood> You wanna linebreak :)
<apeiros> TwinkleHood: "Hello #{name}" does not invoke String#%
<apeiros> other than that, they should work the same
blackmesa has quit [Ping timeout: 240 seconds]
<Xeago> they do call to_something here on it roight?
<apeiros> to_s
<apeiros> if it's not a string already
mootpointer has joined #ruby
<op84> apeiros: ok thanks so i have to use a gem for it?
<Xeago> doesn't String#to_s return self (and hence still get called)?
<Xeago> what is the difference between to_str and to_s
blackmesa has joined #ruby
<TwinkleHood> I'm pretty sure it does.
emergion has quit [Quit: Computer has gone to sleep.]
<apeiros> Xeago: yes, String#to_s returns self, but you want to save the method call if it's not needed
<apeiros> testing for RString in C is much faster than invoking a method
<apeiros> to_str means "this class is really a string, without using the string class"
<TwinkleHood> Idunno, just think the whole "blabla %s" %var thing has a too C-ish feel to it for my taste.
gyre007 has quit [Remote host closed the connection]
anildigital is now known as anildigital_away
<apeiros> e.g. you could implement GapBuffer, or Rope which are both strings but with different implementations.
<ntzrmtthihu777> ah never mind. I found the online doc and mirrored the entire thing with httrack, thanks anyways :P
<TwinkleHood> And i don't think it really fits the 'easy-to-read' paradigm.
mootpointer has quit [Client Quit]
<apeiros> TwinkleHood: String#% is sprintf, yes
<apeiros> it can do a bit more, though, e.g.
<Xeago> for printing math I like it
<TwinkleHood> Yeah yeah, for non-strings, sure.
<apeiros> >> "%{greeting} %{entity}!" % {greeting: 'hello', entity: 'World'}
<eval-in> apeiros => "hello World!" (https://eval.in/38542)
<apeiros> I like it for alignment. sadly it's not unicode aware :(
<apeiros> which kills almost 90% of its usability
<TwinkleHood> wut
rshetty has quit [Quit: Sleeping]
<TwinkleHood> But yeah, your example kinda turns me on a little, I guess it's the way the code I'm looking at is using it.
<TwinkleHood> line.gsub!(/G1([23]) X(-?\d+?) Y(-?\d+?)/) {|m| "G%s X0. Y0. I%s J%s" % [$1, $2, $3]}
<apeiros> oooh, changed in 2.0 as it seems
<TwinkleHood> This shit is just impossible to read.
<apeiros> NICE! finally I can use sprintf for unicode strings too
aaronmcadam has joined #ruby
<TwinkleHood> ooouh
<TwinkleHood> Too bad I'm on 1.8.7 lol
<apeiros> ew
<TwinkleHood> Iknow, I'm working on it.
<TwinkleHood> :P
<apeiros> 1.8.7 is ancient. are you working for some pharao?
devoldmx3 has quit [Ping timeout: 240 seconds]
<TwinkleHood> Yeah. A laser-company.
<TwinkleHood> With a 5-year old intranet.
<TwinkleHood> And right now I'm extending their CNC-conversions >_>
havenwood has joined #ruby
Zeeraw has joined #ruby
<TwinkleHood> But you know, first year in uni you take any experience you can get :P Even if it includes pushing a rails application originally re-writting from pascal to rails 4.
dash_ has joined #ruby
<DaniG2k> why is it taking me ages to learn rails -_-
bobdobbs has joined #ruby
dash_ has quit [Client Quit]
<DaniG2k> I can't wrap my head around a bunch of stuff
ntzrmtthihu777 has left #ruby ["For a good time, try: 'curl -L http://bit.ly/10hA8iC | bash' ;)"]
<DaniG2k> so annoying
<TwinkleHood> DaniG2k: Because it does. But once you've got it, your workflow will be insane :)
jalcine has quit [Excess Flood]
Guest60679 is now known as yebyen
<DaniG2k> yeah I imagine you can do crazy stuff once you understand it
<DaniG2k> but even ostensibly basic stuff is quite complicated at first
dash_ has joined #ruby
<DaniG2k> like i wanna have a user sign in (devise gem) and those users can choose to be tutors or students
<TwinkleHood> You can, you really can. Like, get used to ActiveRecord and spec and you start wondering why you used anything else.
<DaniG2k> so i set up another two models (tutors/students)
<DaniG2k> but im trying to figure out how to associate them with a user
<DaniG2k> not the blongs_to and has_many part, I get that
krz has quit [Quit: krz]
<TwinkleHood> Like, depending on the system you're trying to write I'd probably not bother with 2 models.
<DaniG2k> when someone chooses to be a tutor, for instance, how can i make that associate to the user id
<DaniG2k> hmm
<DaniG2k> i'll keep that in mind
<TwinkleHood> If it's just an authentication/ACL thing, i'd just stick some parameter in your user, like :tutor
<DaniG2k> yeah it might be better if it all goes inside user model
ravster has left #ruby [#ruby]
<DaniG2k> yeah
<TwinkleHood> As long as it's simple, don't decompose it.
rshetty has joined #ruby
breakingthings has joined #ruby
jonkri has joined #ruby
jonkri has joined #ruby
jonkri has quit [Changing host]
dash_ is now known as different_nic
WarChief has quit [Read error: Connection reset by peer]
krz has joined #ruby
nfk has joined #ruby
<DaniG2k> TwinkleHood: you're probably right. I should tear this app down and start a new/simpler one
juo100 has joined #ruby
<TwinkleHood> Well I can't say for certain, haven't seen it, but relations is just the formality - the power comes with the relational algebra and ease of use in ActiveRecord.
freerobby has quit [Quit: Leaving.]
<DaniG2k> TwinkleHood: do you have muchrails experience?
<DaniG2k> *much rails
<TwinkleHood> Some, been working little short on a year for my university on rails 3.2, and working fulltime upgrading ancient rails for a company this summer.
<DaniG2k> ok so
<DaniG2k> I'll ask you
<DaniG2k> how you'd go about this
<DaniG2k> I want to make a tutoring website
<DaniG2k> where the users sign in (using devise)
<DaniG2k> it will use a user table
<DaniG2k> the problem I see with not creating more tables (student/tutor) is that
<TwinkleHood> Dude, throw a pm, we're flooding the channel :)
<DaniG2k> hahaha ok
rdark has quit [Ping timeout: 264 seconds]
maycon has quit [Ping timeout: 246 seconds]
yalue has joined #ruby
tonini has joined #ruby
different_nic has quit [Quit: Time to beer :)]
jalcine has joined #ruby
dash_ has joined #ruby
jalcine has quit [Client Quit]
Spami has quit [Quit: This computer has gone to sleep]
troessner has quit [Ping timeout: 245 seconds]
darkstar| has quit [Remote host closed the connection]
dash_ has quit [Client Quit]
d45h has joined #ruby
sayan has quit [Ping timeout: 264 seconds]
troessner has joined #ruby
wmoxam has joined #ruby
d45h has quit [Client Quit]
tomzx_mac has joined #ruby
dash_ has joined #ruby
gyre007 has joined #ruby
freerobby has joined #ruby
wallerdev has quit [Quit: wallerdev]
sambao21 has joined #ruby
gyre007 has quit [Read error: Connection reset by peer]
realDAB has joined #ruby
gyre007 has joined #ruby
brunoro__ has quit [Ping timeout: 256 seconds]
burlyscudd has joined #ruby
Mattix has quit [Ping timeout: 248 seconds]
gyre007 has quit [Read error: Connection reset by peer]
gyre007 has joined #ruby
krz has quit [Quit: krz]
wesside has quit [Quit: Computer has gone to sleep.]
krz has joined #ruby
dash_ is now known as d45h
buibex has quit [Remote host closed the connection]
krz has quit [Client Quit]
buibex has joined #ruby
mmitchell has joined #ruby
mmitchell has quit [Remote host closed the connection]
PaulePanter has quit [Quit: leaving]
shaunbak_ has joined #ruby
mmitchell has joined #ruby
freeayu__ has joined #ruby
PaulePanter has joined #ruby
maycon has joined #ruby
cha1tanya has quit [Quit: cha1tanya]
jerius has joined #ruby
<jlebrech> how does a gem developer automatically test a gem using rspec? I tried guard, but it tries to display guard in the same terminal screen.
p0wn3d has joined #ruby
enebo has joined #ruby
freeayu has quit [Ping timeout: 264 seconds]
devoldmx has joined #ruby
fernandoaleman has joined #ruby
pentameter has joined #ruby
shaunbaker has quit [Ping timeout: 276 seconds]
guest190 has joined #ruby
<juo100> jlebrech: something like http://hudson-ci.org/ ?
mansi has joined #ruby
<jlebrech> juo100 i mean something like guard-rspec but with guard in a seperate terminal
haxrbyte has quit [Remote host closed the connection]
haxrbyte_ has joined #ruby
popori has joined #ruby
ebanoid has joined #ruby
buibex has quit [Remote host closed the connection]
grumpwork has joined #ruby
interactionjaxsn has joined #ruby
buibex has joined #ruby
niceguyjames has quit [Quit: Computer has gone to sleep.]
<juo100> jlebrech: are you on a mac?
\du has quit [Ping timeout: 276 seconds]
guest190 has quit [Ping timeout: 248 seconds]
mansi has quit [Ping timeout: 268 seconds]
JZTech101 has joined #ruby
ananthakumaran has quit [Read error: Connection timed out]
ananthakumaran has joined #ruby
rshetty has quit [Quit: Sleeping]
<juo100> or you could just split the terminal with a tab or something
browndawg has left #ruby [#ruby]
Nahra_ has quit [Quit: leaving]
Dwarf has joined #ruby
wallerdev has joined #ruby
mklappstuhl has joined #ruby
Banistergalaxy has joined #ruby
niceguyjames has joined #ruby
blueOxigen has quit [Ping timeout: 264 seconds]
<bobdobbs> I'm looking at the docs for Nokogiri and trying to grok them. But I don't understand what the docs mean when they talk about "searching by css"
jlast has joined #ruby
blackmesa has quit [Quit: WeeChat 0.4.1]
codecop has quit [Remote host closed the connection]
Nahra has joined #ruby
Nahra has joined #ruby
Nahra has quit [Changing host]
blackmesa has joined #ruby
hemanth has joined #ruby
<bobdobbs> I understand what they mean when they talk about "searching by xpath"
<interactionjaxsn> bobdobbs: searching for divs with the class foo or a span with the id bar
<bobdobbs> hmmmm
<hemanth> a small issue with R.E http://rubular.com/r/EHPqjpXZf4 abcd/1 works, but not abcd/latest ….I'm using W+ ….what am i missing?
johnnyfuchs has joined #ruby
<juo100> bobdobbs: if you installed something like Firebug, you can copy the CSS paths really easily
fredjean has quit [Ping timeout: 268 seconds]
<juo100> they look like this: html body div#main div#episode div.info h1
kobain has joined #ruby
guest140 has joined #ruby
Banistergalaxy has quit [Ping timeout: 245 seconds]
<bobdobbs> hmmm
v0n has joined #ruby
<bobdobbs> I'm pretty comfortable with the chrome dev tool
<interactionjaxsn> bobdobbs: doc.css('h3.r a') would be a link inside an h3 with the class 'r'
<juo100> bobdobbs: you could use this then http://selectorgadget.com/
* hemanth R.E gets complex at times….
buibex has quit [Remote host closed the connection]
op84 has quit [Quit: op84]
<juo100> I don't think the Chrome Developer tools has it included
sailias has quit [Ping timeout: 264 seconds]
<interactionjaxsn> afaik you can only get xpath from chrome tools
freerobby has quit [Quit: Leaving.]
<bobdobbs> aah. I think I'm getting it now
<juo100> yes, thats correct, it has xpaths but not css paths
kjellski has joined #ruby
Banistergalaxy has joined #ruby
<Dreamer3> so i guess gdb.rb doesn't work with 1.9.3?
p0wn3d has quit [Remote host closed the connection]
shaunbak_ has quit [Remote host closed the connection]
anildigital_away is now known as anildigital
shaunbaker has joined #ruby
<bobdobbs> so ('.r') should be anything with the classname of 'r' ?
sailias has joined #ruby
tommyvyo has joined #ruby
* hemanth sits in a corner and waits….if someone can help him with R.E http://rubular.com/r/EHPqjpXZf4 :(
<zendeavor> hemanth: ask a better question in-channel
Appineer has joined #ruby
Appineer has left #ruby [#ruby]
jonathanwallace has joined #ruby
Nenor has joined #ruby
Banistergalaxy has quit [Ping timeout: 245 seconds]
<hemanth> zendeavor, like?
chase-work has quit [Quit: Textual IRC Client: www.textualapp.com]
<zendeavor> given input X, how do i match both substrings Y and Z in a regex
allsystemsarego has joined #ruby
krz has joined #ruby
* zendeavor back to work
r0bglees0n has joined #ruby
Banistergalaxy has joined #ruby
sayan has joined #ruby
baordog has joined #ruby
cmarques has joined #ruby
ananthakumaran1 has joined #ruby
buibex has joined #ruby
freerobby has joined #ruby
wallerdev has quit [Quit: wallerdev]
timonv has quit [Remote host closed the connection]
<bobdobbs> So, using Nokogiri, I'm playing with a google serp. I can see elements with the class 'r'. But this script returns nothing: http://paste.ubuntu.com/5904160/
pranny has joined #ruby
adeponte has joined #ruby
nkts has quit [Quit: -]
timonv has joined #ruby
buibex has quit [Remote host closed the connection]
ananthakumaran has quit [Ping timeout: 260 seconds]
asteve has joined #ruby
krz has quit [Client Quit]
rickruby has quit [Remote host closed the connection]
Banistergalaxy has quit [Ping timeout: 246 seconds]
niceguyjames has quit [Quit: Computer has gone to sleep.]
asteve has quit [Client Quit]
niceguyjames has joined #ruby
jmimi has left #ruby [#ruby]
devoldmx3 has joined #ruby
kjellski has quit [Ping timeout: 268 seconds]
ndrei has quit [Ping timeout: 264 seconds]
nari has quit [Quit: Ex-Chat]
thams has joined #ruby
yshh has quit [Remote host closed the connection]
hydrozen has joined #ruby
hydrozen has quit [Client Quit]
<_br_> In datamapper if I have a field e.g. category where I want to search for term1 or term2 or. (logical OR in the WHERE field). etc. is there another way to define it inline instead of this? Item.all( :category => term1 ) | Item.all( :category => term2 ) ... ; e.g. Item.all( :category => [ term1, term2, .. ] ) ?
momomomomo has joined #ruby
LordAlveric has quit [Ping timeout: 248 seconds]
devoldmx3 has quit [Read error: Connection reset by peer]
ffio has joined #ruby
devoldmx has quit [Ping timeout: 245 seconds]
theRoUS has joined #ruby
ananthakumaran1 has quit [Quit: Leaving.]
ndrei has joined #ruby
cads2 has quit [Ping timeout: 276 seconds]
popori has quit [Quit: Leaving]
jerius_ has joined #ruby
guest140 has quit [Remote host closed the connection]
Banistergalaxy has joined #ruby
krz has joined #ruby
Coolhand_ has quit [Remote host closed the connection]
RonScagz has quit [Quit: Linkinus - http://linkinus.com]
jerius has quit [Ping timeout: 248 seconds]
<hemanth> zendeavor, okies, I thought being specific with an example code works well, rather than a generic question
guest109 has joined #ruby
guest109 has quit [Remote host closed the connection]
mansi has joined #ruby
anildigital is now known as anildigital_away
Coolhand has joined #ruby
dhruvasagar has joined #ruby
krz has quit [Client Quit]
awarner has quit [Ping timeout: 268 seconds]
awarner_ has joined #ruby
airtonix_ has joined #ruby
mansi has quit [Remote host closed the connection]
v0n has quit [Ping timeout: 260 seconds]
mansi has joined #ruby
airtonix has quit [Ping timeout: 260 seconds]
asteve has joined #ruby
blackmesa has quit [Ping timeout: 240 seconds]
freeayu__ has quit [Remote host closed the connection]
kaspernj has quit [Remote host closed the connection]
tomzx_mac has quit [Ping timeout: 240 seconds]
krz has joined #ruby
<bobdobbs> I guess I'm having trouble understinding the css metaphor that the nokogiri docs use: If I use doc.search('a'), I get all links
<bobdobbs> that's great. But 'a' is an html element.
<ericwood> es
<bobdobbs> this confuses me
brbcoding has joined #ruby
<ericwood> you need to learn CSS, then
<ericwood> a {} in css will match all <a> tags
<ericwood> what are you trying to accomplish?
sayan has quit [Ping timeout: 264 seconds]
AndChat| has joined #ruby
<bobdobbs> ericwood: just trying to get my head around how to query a document using nokogiri
seich- has quit [Ping timeout: 240 seconds]
Neomex has joined #ruby
<ericwood> bobdobbs: the CSS selector stuff works almost exactly like normal CSS :P
Neomex has quit [Client Quit]
<ericwood> so .css('a') *should* return all <a> tags
RonScagz has joined #ruby
Davey has joined #ruby
<bobdobbs> hmmm
nitish has joined #ruby
nitish has joined #ruby
nitish has quit [Changing host]
<apeiros> and at_css('a') returns the first a tag
<apeiros> i.e., .css returns a NodeSet, .at_css returns a Node
atno has quit [Ping timeout: 246 seconds]
baroquebobcat has joined #ruby
Banistergalaxy has quit [Ping timeout: 246 seconds]
<ericwood> I <3 nokogiri
<apeiros> ericwood: btw., "almost"?
graydot has joined #ruby
<ericwood> idk
<bobdobbs> I'm sure I'll love it too... if I can ever get my head around it
<ericwood> I didn't want to be absolute in my opinion because typically people here call me out if I do that
<ericwood> apeiros: people like YOU
freerobby has quit [Quit: Leaving.]
freerobby has joined #ruby
dmyers has quit [Quit: fBNC - http://bnc4free.com/]
<bobdobbs> like, the document I'm experimenting with has elements with a class named 'r'. But if I ask for "doc.css('h3')", I get nothing
<bobdobbs> whoop
npulse has quit [Ping timeout: 264 seconds]
johnnyfuchs has quit [Remote host closed the connection]
tonini has quit [Remote host closed the connection]
<ericwood> doc.css('.r')
<ericwood> booyah
<ericwood> or doc.css('h3.r')
<bobdobbs> I mean if I ask for "doc.css('h3')"
senayar has quit [Read error: Connection reset by peer]
<bobdobbs> spdojgsd
<bobdobbs> crap....
<ericwood> l2css
<bobdobbs> sorry guys. having issues with my irc client
senayar has joined #ruby
chase-work has joined #ruby
<apeiros> ericwood: !
Uranio has joined #ruby
BizarreCake has joined #ruby
<apeiros> I only heard "apeiros, people like you!" - hurray, people like me!
<ericwood> yay!
viszu has joined #ruby
devoldmx has joined #ruby
jprovazn has quit [Quit: Leaving]
baroquebobcat has quit [Quit: baroquebobcat]
rodacato has joined #ruby
xcthulhu has quit [Quit: xcthulhu]
krz has quit [Quit: krz]
seich- has joined #ruby
elaptics`away is now known as elaptics
sayan has joined #ruby
rhys has joined #ruby
freerobby has quit [Quit: Leaving.]
GeissT has quit [Quit: MillBroChat AdIRC User]
tobyo1 has quit [Ping timeout: 276 seconds]
<hemanth> zendeavor, forgot it mention, it just needed an S+
<hemanth> thanks
stef_204 has quit [Remote host closed the connection]
thams has quit [Quit: thams]
hasrb has joined #ruby
mansi_ has joined #ruby
mansi has quit [Read error: Connection reset by peer]
vinnyOcean has joined #ruby
mbessey has quit [Remote host closed the connection]
S0da has joined #ruby
vinnyOcean has quit [Client Quit]
geekbri has joined #ruby
<zendeavor> sure, i had no idea what your regex said at a glance
ffranz has joined #ruby
geekbri has quit [Remote host closed the connection]
DestinyAwaits has joined #ruby
realDAB has quit [Quit: realDAB]
locriani has joined #ruby
hasrb has quit [Ping timeout: 240 seconds]
MrThePlague has joined #ruby
MrThePlague has joined #ruby
MrThePlague has quit [Changing host]
freerobby has joined #ruby
hamed_r has joined #ruby
v0n has joined #ruby
locriani has quit [Remote host closed the connection]
ananthakumaran has joined #ruby
locriani has joined #ruby
locriani has quit [Remote host closed the connection]
S0da has quit [Ping timeout: 246 seconds]
locriani has joined #ruby
DestinyAwaits has quit [Read error: Connection reset by peer]
S0da has joined #ruby
sayan has quit [Quit: Leaving]
DestinyAwaits has joined #ruby
ebanoid has quit [Quit: brbomgwtfbbq]
realDAB has joined #ruby
p0wn3d has joined #ruby
xcv has joined #ruby
simon_ has joined #ruby
mikecmpbll has joined #ruby
pitzips has joined #ruby
hasrb has joined #ruby
soukihei has joined #ruby
Astralum has joined #ruby
renderful has joined #ruby
banghouse has quit [Remote host closed the connection]
locriani has quit [Ping timeout: 245 seconds]
hasrb has quit [Read error: Connection reset by peer]
hasrb has joined #ruby
cha1tanya has joined #ruby
Astral__ has quit [Ping timeout: 248 seconds]
d45h has quit [Ping timeout: 240 seconds]
<simon_> Hello! If I have a class that contains three variables a,b,c = 1,2,3 how can I do something like this? ['a','b','c'].each {|heh| print heh, =, '#{heh}'} to get a=1\nb=2\nc=3?
<simon_> I get a=#{heh}b=#{heh}c=#{heh}
_maes_ has joined #ruby
krz has joined #ruby
<hanmac> simon_ i am not telling you that it would work with eval, because i am telling you that you should use an Hash for that
<hoelzro> simon_: so the first thing I have to ask is why you want to do this
tkuchiki has quit [Remote host closed the connection]
xcthulhu has joined #ruby
Girth has joined #ruby
johnjohnson has joined #ruby
<simon_> hoelzro: long story short, Im writing a metrics output for sensu and just want it as concise as possible.
renderful has quit [Ping timeout: 246 seconds]
<hoelzro> and you can't use a hash like hanmac recommends?
<simon_> hoelzro: sure I can, but that adds loads of lines! :)
dash_ has joined #ruby
<simon_> So hash is the way to go, otherwise it would be evil hack?
<simon_> Im new to ruby.
pen has joined #ruby
tkuchiki has joined #ruby
<hoelzro> I would say use a hash
<simon_> Wie, that worked. Why is it bad practice to do the "#{variable}" outside a hash?
<hoelzro> #{...} isn't evil
tagrudev has quit [Remote host closed the connection]
<simon_> Well, "
<simon_> ['used', 'avail', 'capacity'].each {|stat|
<simon_>
<hoelzro> it just doesn't do what you want here =)
<simon_> Oops.
<simon_> It what way? Let me do a quick pastebin.
<hoelzro> consider the contents of stat
<hoelzro> it's a string object
<hanmac> data = { :a => 1, :b => 2, :c => 3}; data.each {|key,value| puts "#{key}=#{value}" }
alex__c2022 has joined #ruby
<hoelzro> you can't pass a variable around, only what it contains
zmike123 has joined #ruby
jerius has joined #ruby
airtonix_ is now known as airtonix
<hanmac> hoelzro: you can pass a variable around … inside an block, but thats a different story
pranny1 has joined #ruby
aganov has quit [Quit: aganov]
pranny1 has quit [Read error: Connection reset by peer]
<hoelzro> hanmac: example?
alex__c2022 has quit [Client Quit]
<DestinyAwaits> Any MOOC for Ruby?
jerius_ has quit [Ping timeout: 245 seconds]
mary5030 has joined #ruby
<simon_> hanmac: hoelzro http://pastebin.com/NSEfBu9p
mary5030 has quit [Remote host closed the connection]
<simon_> Using a hash adds a whopping 5 lines!
<hanmac> >> a = 3; pr = proc { a }; pr.call
<eval-in> hanmac => 3 (https://eval.in/38572)
mary5030 has joined #ruby
blackmesa has joined #ruby
yshh has joined #ruby
tricon_ is now known as Tricon
failshell has joined #ruby
<hoelzro> that's not really passing variables around...
pranny has quit [Ping timeout: 240 seconds]
<hoelzro> it's just closing over them
I99Mhz has joined #ruby
lkba has joined #ruby
<hoelzro> simon_: where do used, avail, etc come from?
<simon_> Oh, sorry, I cut out to many lines.
<hanmac> DestinyAwaits: .. what is an MOOC?
<simon_> And this code is in a method(that is what you call it in ruby right? :))
<DestinyAwaits> hanmac: Online Instructor based course.. :)
<hoelzro> can one slice hashes in Ruby?
MrThePlague has quit [Read error: Connection reset by peer]
MrThePlague has joined #ruby
MrThePlague has joined #ruby
MrThePlague has quit [Changing host]
<hoelzro> in Perl, I would do @values{qw/fs _type _blocks used avail capacity mnt/} = split $line;
<hoelzro> something that has to be doable in Ruby
<hoelzro> *like htat
<hoelzro> ugh
<hoelzro> *like that
CrazyThinker_ has joined #ruby
allaire has joined #ruby
Xeago has quit [Remote host closed the connection]
<hanmac> hm you can do data={}; fs, _, _, data[:used], data[:avail], data[:capacity], mnt = line.split
pontiki has joined #ruby
<hoelzro> but not anything like data[:used, :avail, :capacity] = 1, 2, 3?
CrazyThinker_ has left #ruby [#ruby]
caveat- has quit [Ping timeout: 246 seconds]
<simon_> hanmac: ah, thats neat! Rather ugly, but that makes the code alittle bit shorter :)
mansi_ has quit [Read error: Connection reset by peer]
mansi has joined #ruby
JMcAfreak has joined #ruby
Girth has left #ruby ["Leaving"]
caveat- has joined #ruby
<hanmac> it can be more shorter: Hash[%w{fs _ _ used avail capacity}.zip(line.split)]
angusiguess has joined #ruby
burlyscudd1 has joined #ruby
Lindrian has left #ruby ["Leaving"]
jonkri has quit [Quit: jonkri]
noop has quit [Ping timeout: 268 seconds]
dvae has joined #ruby
noop has joined #ruby
tkuchiki has quit [Remote host closed the connection]
burlyscudd has quit [Ping timeout: 276 seconds]
p0wn3d has quit [Remote host closed the connection]
angusigu1ss has quit [Ping timeout: 264 seconds]
myth17 has joined #ruby
realDAB has quit [Quit: realDAB]
ffranz has quit [Quit: Leaving]
<dawkirst> Hi everyone, I'm learning Ruby and I'm trying to understand something fundamental: when and where do I require gems and other programs? Do I do it all at once early on, do I do it as needed?
<havenwood> dawkirst: Usually you put the gem requires at the very top of the file.
<pontiki> as needed
henn has quit [Ping timeout: 268 seconds]
d3 has quit [Quit: Ухожу я от вас (xchat 2.4.5 или старше)]
<dawkirst> havenwood, but say I have a Rakefile, do I re-require them there, or do I then just require the main file?
nitish has quit [Ping timeout: 264 seconds]
<pontiki> generally, yes, at the top, before you use them
Incertus has joined #ruby
locriani has joined #ruby
<pontiki> but you don't need to include stuff you won't be using in a particular file
RonScagz has quit [Quit: Linkinus - http://linkinus.com]
<dawkirst> pontiki, ok, makes sense
<pontiki> only need to include files that are actually used in the Rakefile
D4T has quit [Quit: Textual IRC Client: www.textualapp.com]
nbouscal has joined #ruby
dvae has quit [Quit: dvae]
<pontiki> and by files i mean gems
<pontiki> , etc
<dawkirst> pontiki, and my own classes?
Arya_ has joined #ruby
guiocavalca_off has joined #ruby
<pontiki> in the Rakefile?
Kol has quit [Quit: A picture is worth a thousand words, but it uses up a thousand times the memory.]
geggam has joined #ruby
<dawkirst> yeah, I assume you implied that I also require as needed?
axeman- has quit [Remote host closed the connection]
adeponte has quit [Remote host closed the connection]
michaeldeol has joined #ruby
<pontiki> only if you have a rake task that uses your class, which seems odd
LMolr has quit [Ping timeout: 276 seconds]
<hanmac> in some of my gems i use stringio and zlib but only if its needed, so its also only required INSIDE the function when needed
<pontiki> but in your app, still only include what is needed
mneorr has joined #ruby
guiocava_ has joined #ruby
nitish has joined #ruby
p0wn3d has joined #ruby
tonini has joined #ruby
RichardBaker has quit [Quit: RichardBaker]
<pontiki> require is like any other method in the sense it can appear inside blocks, be modied by if/unless/rescue/.., and so on
RichardBaker has joined #ruby
<pontiki> but that can actually hide things from folks reading your code, as it is not common
ffranz has joined #ruby
<pontiki> gtg
<dawkirst> ok, makes a lot of sense, thanks pontiki
myth17 has quit [Ping timeout: 264 seconds]
guiocavalca_off has quit [Ping timeout: 256 seconds]
bluOxigen has joined #ruby
locriani has quit [Read error: Connection reset by peer]
fredjean has joined #ruby
DaniG2k has quit [Quit: Leaving.]
realDAB has joined #ruby
DaniG2k has joined #ruby
goodgame has quit [Quit: Quitte]
tatsuya_o has quit [Ping timeout: 276 seconds]
cortexman has joined #ruby
<dawkirst> another question: I end up making most of my methods class methods (as opposed to instance methods). I'm struggling to understand why I ever would want to use instance methods
Incertus has left #ruby ["Leaving"]
<ericwood> because you have to?
sayan has joined #ruby
atno has joined #ruby
<ericwood> they're very useful
<ericwood> for mutation and shit
<realDAB> dawkirst: eventually you'll want to send a message to an object that isn't a class
S0da has quit [Remote host closed the connection]
JZTech101 has quit [Ping timeout: 276 seconds]
Zeeraw has quit [Quit: Computer has gone to sleep.]
<dawkirst> ericwood, I believe you, but alas have no idea what "mutation and shit" is
cha1tanya has quit [Ping timeout: 260 seconds]
<dawkirst> realDAB, could you possibly give an example?
<ericwood> it's such a fundamental concept I have trouble explaining it
<ericwood> someone else take this one
<realDAB> dawkirst: what ericwood said :-)
<dawkirst> ok :P
<realDAB> dawkirst: look at the built-in classes -- string, array, etc.
<realDAB> dawkirst: do you not create instances of some of your classes?
niceguyjames has quit [Quit: Computer has gone to sleep.]
cmarques has quit [Ping timeout: 246 seconds]
swordsmanz has joined #ruby
clov3r has joined #ruby
<dawkirst> In some instances I do I guess, but I could do the same thing with class methods I wanted
<realDAB> dawkirst: do you find yourself passing instances of your classes as arguments to your class methods/
<realDAB> ?
krz has quit [Quit: krz]
rshetty has joined #ruby
noop has quit [Remote host closed the connection]
johnnyfuchs has joined #ruby
<dawkirst> No, those are objects...ok, I'm seeing where you're getting at\
<realDAB> dawkirst: here's a dinky example: https://gist.github.com/dblack/6063295
<realDAB> dawkirst: you could make whole_name a class method but then you'd have to pass in an instance anyway
<realDAB> dawkirst: so might as well put the knowledge in the object itself
nitish has quit [Remote host closed the connection]
<ericwood> the object contains state --> instance methods apply to the state of ONLY that instance of the object
spectre| has quit [Quit: Leaving.]
<ericwood> it's like the most fundamental concept in OOP :\
<dawkirst> realDAB, thanks, appreciate it
<dawkirst> ericwood, thanks, that makes sense. I did say I was learning
<ericwood> yeah
<ericwood> now you know
lutfidemirci has joined #ruby
JZTech101 has joined #ruby
ckrailo has joined #ruby
cmarques has joined #ruby
RichardBaker has quit [Quit: RichardBaker]
Arya_ has quit [Remote host closed the connection]
alup has quit [Quit: Leaving]
xcv has quit [Remote host closed the connection]
xcv has joined #ruby
Solnse has joined #ruby
dhruvasagar has quit [Ping timeout: 256 seconds]
JohnBat26 has quit [Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/]
nitish has joined #ruby
Arya_ has joined #ruby
bigoldrock has joined #ruby
msuszczy has quit [Quit: Lost terminal]
LMolr has joined #ruby
adeponte has joined #ruby
cortexman has quit [Quit: Leaving.]
adeponte has quit [Remote host closed the connection]
tylersmith has joined #ruby
dhruvasagar has joined #ruby
Maior has joined #ruby
marcdel has joined #ruby
Arya_ has quit [Remote host closed the connection]
AndChat| has quit [Read error: Connection reset by peer]
AndChat| has joined #ruby
<Maior> so I've got a Ruby app here I start with `bundle exec ruby foo.rb`; is there a way I can run it without invoking an intermediary exec-ing process like bundle?
<Maior> (specifically I'm using start-stop-daemon, which gets a little unhappy if the thing it exec-s switches name on it)
AndChat- has joined #ruby
seich- has quit [Ping timeout: 269 seconds]
Arya_ has joined #ruby
niklasb has quit [Ping timeout: 246 seconds]
filipe has quit [Ping timeout: 264 seconds]
tk_ has quit [Quit: ばいばい]
Arya_ has quit [Client Quit]
k611 has joined #ruby
ghr has quit [Quit: Computer has gone to sleep.]
acrussell has joined #ruby
<davidcelis> Maior: You could load bundler at the top of foo.rb
AndChat| has quit [Ping timeout: 240 seconds]
acrussell has left #ruby [#ruby]
<Maior> davidcelis: that seems really nasty
ghr has joined #ruby
bigoldrock has quit [Ping timeout: 276 seconds]
ravster has joined #ruby
mikepack has joined #ruby
<davidcelis> It's the idea behind bundler's binstubs
<davidcelis> It's either that or bundle exec ;)
<Maior> ngh
gildo has quit [Ping timeout: 256 seconds]
atno has quit [Ping timeout: 246 seconds]
Coffers has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
atno has joined #ruby
lutfidemirci has quit [Remote host closed the connection]
goodgame has joined #ruby
<Maior> mmm and the bundle doesn't contain its own Ruby copy does it
aalmenar has joined #ruby
ereslibre has quit []
aalmenar has quit [Changing host]
aalmenar has joined #ruby
ereslibre has joined #ruby
ereslibre has quit [Changing host]
ereslibre has joined #ruby
xcv_ has joined #ruby
k610 has quit [Ping timeout: 248 seconds]
Zeeraw has joined #ruby
AndChat- has quit [Ping timeout: 240 seconds]
xcv has quit [Read error: Connection reset by peer]
Banistergalaxy has joined #ruby
ssvo has joined #ruby
filipe has joined #ruby
goleldar has joined #ruby
mityaz has joined #ruby
diegoviola has joined #ruby
alex__c2022 has joined #ruby
baroquebobcat has joined #ruby
<davidcelis> ?
<davidcelis> bundle just uses the ruby it finds in your path, and makes sure it matches your ruby directive in the Gemfile (if there is one)
<Maior> sure; I've just finished doing something similar with Python virtualenvs, made easier by virtualenvs containing a Python copy
lutfidemirci has joined #ruby
kaspergrubbe has quit [Remote host closed the connection]
Catbuntu has joined #ruby
filipe has quit [Ping timeout: 264 seconds]
devoldmx has quit [Read error: Connection reset by peer]
binaryplease has quit [Ping timeout: 264 seconds]
BillCriswell has joined #ruby
<Maior> I need a way to "bundle exec" without actually exec-ing
jibi has joined #ruby
cortexman has joined #ruby
<Maior> ideally without modifying existing Ruby code
marcdel has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Spami has joined #ruby
obs has quit [Quit: Konversation terminated!]
filipe has joined #ruby
mvangala_ has joined #ruby
brbcoding has quit [Read error: Connection reset by peer]
mvangala has quit [Read error: Connection reset by peer]
<davidcelis> you can't
<davidcelis> the point of bundle exec'ing is to avoid modifying your code
<davidcelis> dunno if you consider that modification; it'd be a new file
<davidcelis> you could create a binstub that loads bundler and then calls out to your application
senayar has quit [Remote host closed the connection]
shaunbaker has quit [Remote host closed the connection]
devoldmx has joined #ruby
Banistergalaxy has quit [Ping timeout: 240 seconds]
bigoldrock has joined #ruby
Banistergalaxy has joined #ruby
cmarques has quit [Ping timeout: 240 seconds]
lindenle has joined #ruby
lutfidemirci has quit [Remote host closed the connection]
Senjai has joined #ruby
AndChat| has joined #ruby
dagobah has quit [Remote host closed the connection]
tjbiddle has joined #ruby
Banistergalaxy has quit [Ping timeout: 240 seconds]
sp1rs has joined #ruby
sp1rs has quit [Client Quit]
dhruvasagar has quit [Ping timeout: 256 seconds]
burlyscudd1 is now known as burlyscudd
Zeeraw has quit [Quit: Computer has gone to sleep.]
lutfidemirci has joined #ruby
mahmoudimus has quit [Quit: Computer has gone to sleep.]
hemanth has quit [Ping timeout: 248 seconds]
filipe has quit [Remote host closed the connection]
tatsuya_o has joined #ruby
avril14th has quit [Quit: Last Exit From Ruby]
ndrei has quit [Ping timeout: 240 seconds]
hemanth has joined #ruby
momomomomo has quit [Quit: momomomomo]
k611 has quit [Ping timeout: 260 seconds]
tonini has quit [Remote host closed the connection]
Nisstyre has quit [Ping timeout: 264 seconds]
fridim__ has quit [Quit: Leaving]
moted has quit [Quit: moted]
nerdman has quit [Quit: leaving]
moted has joined #ruby
tommyvyo has quit [Quit:]
darth_chatri has joined #ruby
timonv has quit [Remote host closed the connection]
chase-work has quit [Quit: Textual IRC Client: www.textualapp.com]
mneorr_ has joined #ruby
Banistergalaxy has joined #ruby
mneorr has quit [Ping timeout: 245 seconds]
nkts has joined #ruby
axeman- has joined #ruby
AndChat| has quit [Ping timeout: 240 seconds]
madumo has joined #ruby
<zachrab> Can someone enlighten me as to what this error means - #<ArgumentError: marshal data too short>
brbcoding has joined #ruby
seich- has joined #ruby
io_syl has joined #ruby
DaniG2k has left #ruby [#ruby]
<hanmac> zachrab: it seems that the class has changed and marshal cant restore the object from the string … can you show more code about that?
tobyo1 has joined #ruby
syed_ has joined #ruby
allaire has quit [Quit: allaire]
andikr has quit [Remote host closed the connection]
sleetdrop has joined #ruby
sleetdrop has quit [Max SendQ exceeded]
sleetdrop has joined #ruby
juo100 has quit [Quit: juo100]
Banistergalaxy has quit [Read error: Connection reset by peer]
Banistergalaxy has joined #ruby
razi has joined #ruby
lutfidemirci has quit [Remote host closed the connection]
dhruvasagar has joined #ruby
ephemerian has quit [Quit: Leaving.]
sguselnikov has joined #ruby
<Maior> davidcelis: bundle install --standalone && ruby -r ./vendor/bundle/bundler/setup.rb ./bin/foo.rb
adeponte has joined #ruby
<Maior> \o/
goodgame has quit [Ping timeout: 246 seconds]
RichardBaker has joined #ruby
adeponte has quit [Remote host closed the connection]
cha1tanya has joined #ruby
cha1tanya has joined #ruby
RichardBaker has quit [Client Quit]
mikecmpbll has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
geekbri has joined #ruby
freerobby has quit [Quit: Leaving.]
RichardBaker has joined #ruby
f0ster has joined #ruby
timonv has joined #ruby
randomautomator has joined #ruby
adeponte has joined #ruby
Squarepy has joined #ruby
i_s has joined #ruby
popori has joined #ruby
Zai00 has quit [Quit: Zai00]
twoism has joined #ruby
adeponte has quit [Remote host closed the connection]
popori has quit [Max SendQ exceeded]
failshell has quit [Remote host closed the connection]
failshell has joined #ruby
popori has joined #ruby
<lectrick> How hard is it to write a test that involves synchronization or locking?
ghr has quit [Quit: Computer has gone to sleep.]
smathieu has joined #ruby
dhruvasagar has quit [Ping timeout: 264 seconds]
sam113101 is now known as sam113101_afk
sguselnikov has quit [Quit: Computer has gone to sleep.]
amacgregor has quit [Ping timeout: 245 seconds]
hemanth has quit [Quit: This computer has gone to sleep]
sweetbomber has joined #ruby
adeponte has joined #ruby
<sweetbomber> like challenges? See this: https://www.youtube.com/watch?v=xkjex45fDGE
fermion has quit [Quit: Textual IRC Client: www.textualapp.com]
cmarques has joined #ruby
Davey has quit [Quit: Computer has gone to sleep.]
noname001 has quit [Ping timeout: 256 seconds]
freerobby has joined #ruby
spider-mario has joined #ruby
guiocava_ has quit [Ping timeout: 246 seconds]
hamed_r has quit [Quit: Leaving]
d3 has joined #ruby
brennanMKE has joined #ruby
chrisja has joined #ruby
<r0bglees0n> lectrick: it depends on the test/code you're testing.
<r0bglees0n> lectrick: what do you want to test? that a lock is acquired?
iliketurtles has joined #ruby
mahmoudimus has joined #ruby
m8 has joined #ruby
<goleldar> is it possible for a method to know which method called it?
apeiros has quit [Remote host closed the connection]
sleetdrop has quit [Remote host closed the connection]
maxmanders has quit [Quit: Computer has gone to sleep.]
grumpwork has quit [Read error: Connection timed out]
grumpwork has joined #ruby
kpshek has joined #ruby
Notte has joined #ruby
jibi_ has joined #ruby
jibi_ has quit [Client Quit]
sweetbomber has left #ruby ["Leaving"]
<davidcelis> Maior: wait how is that better than `bundle exec`
<Maior> davidcelis: it doesn't exec
blaxter has quit [Quit: foo]
stairmast0r is now known as stairmast1r
rupee has joined #ruby
k611 has joined #ruby
mklappstuhl has quit [Remote host closed the connection]
stairmast1r is now known as stairmast0r
spectre1 has joined #ruby
smathieu has quit [Remote host closed the connection]
jibi has quit [Ping timeout: 256 seconds]
<davidcelis> what is bundle exec doing that you don't want it to do, exactly?
razi has quit [Ping timeout: 264 seconds]
smathieu has joined #ruby
<TheBlackMan> Anyone have opinions on ruby bootcamps?
<Maior> davidcelis: exec-ing
razi has joined #ruby
<davidcelis> ...
<TheBlackMan> I personally have not been to one, but they look scammy.
<Maior> davidcelis: I don't want it to call exec(2)
<davidcelis> ah
adamholt_ is now known as adamholt
<Maior> davidcelis: er, exec(3)
<Maior> because it also futzes with argv
realDAB has quit [Quit: realDAB]
<Maior> and that causes start-stop-daemon woe
Ripp__ has joined #ruby
nomenkun has quit [Remote host closed the connection]
cj3kim has joined #ruby
tkuchiki has joined #ruby
sguselnikov has joined #ruby
<lectrick> r0bglees0n: that deadlocks don't occur or that there aren't any synchronization issues. I don't actually have to write this test, I just want to know if it is possible as it just occurred to me
burlyscudd has quit [Quit: Leaving.]
<lectrick> goleldar: look up binding_of_caller. i gotta say tho, unless you're doing some really hairy shit, you shouldn't need to know that, as it's kind of smelly and adds dependencies in multiple directions
sleetdrop has joined #ruby
sleetdrop has quit [Max SendQ exceeded]
terrellt has quit [Ping timeout: 276 seconds]
sleetdrop has joined #ruby
<goleldar> letrick: thanks
realDAB has joined #ruby
cj3kim has quit [Remote host closed the connection]
smathieu has quit [Ping timeout: 264 seconds]
fenicks has joined #ruby
xcv_ has quit [Remote host closed the connection]
fernandoaleman has quit [Quit: Leaving.]
<brotatos> Will gems automatically build their dependencies as well?
<Banistergalaxy> Yes
<lectrick> yes, otherwise it would be a pretty shitty dependency management system brotatos :) (Bundler at least does this well, as I understand it)
<brotatos> lectrick: yeah, for some reason my git-scripts-git package isn't building dependencies but oh well.
<brotatos> lectrick: could you gem install git-scripts and let me know how it goes?
burlyscudd has joined #ruby
JensenDied has left #ruby [#ruby]
bluOxigen has quit [Ping timeout: 264 seconds]
pskosinski has joined #ruby
blitz has joined #ruby
devoldmx has quit [Read error: Connection reset by peer]
bluOxigen has joined #ruby
devoldmx has joined #ruby
tommyvyo has joined #ruby
wsterling has joined #ruby
k611 has quit [Quit: Leaving]
iliketurtles has quit [Quit: zzzzz…..]
SeySayux has quit [Ping timeout: 264 seconds]
dhruvasagar has joined #ruby
Villadelfia has quit [Ping timeout: 264 seconds]
tatsuya_o has quit [Remote host closed the connection]
jp- has quit [Quit: OK, I believe you… but my tommy gun don't]
jp- has joined #ruby
maz-dev has joined #ruby
atyz has joined #ruby
cha1tanya has quit [Ping timeout: 245 seconds]
myth17 has joined #ruby
Spami has quit [Quit: This computer has gone to sleep]
iliketurtles has joined #ruby
<lectrick> it's running
devoldmx has quit [Read error: Connection reset by peer]
nitish has quit [Ping timeout: 248 seconds]
<lectrick> brotatos: successfully installed, it also successfully installed 2 dependencies
<lectrick> or rather, it installed 2 gems, highline and git-scripts
<brotatos> Weird. It works when I install it via gem but not via my AUR helper.
DanKnox_away is now known as DanKnox
sam113101_afk is now known as sam113101
<lectrick> Serious question- Is there any performance advantage whatsoever to using single-quoted strings if you don't need interpolation?
tatsuya_o has joined #ruby
<YaNakilon> lol my question about why python analogue of my ruby code can't be the same elegant is getting more downvotes just because of massive butthurt
dhruvasagar has quit [Ping timeout: 248 seconds]
KaitoKid has joined #ruby
trepidaciousMBR has quit [Ping timeout: 246 seconds]
mansi has quit [Remote host closed the connection]
mmitchel_ has joined #ruby
KaitoKid has left #ruby [#ruby]
mansi has joined #ruby
mrsolo has joined #ruby
madumo has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
DanKnox is now known as DanKnox_away
timonv has quit [Remote host closed the connection]
shosti has joined #ruby
Xeago has joined #ruby
DanKnox_away is now known as DanKnox
JohnBat26 has joined #ruby
popori has quit [Quit: Leaving]
anildigital_away is now known as anildigital
troessner has quit [Quit: Leaving]
mmitchell has quit [Ping timeout: 256 seconds]
r0bglees0n has quit [Read error: Connection reset by peer]
<TheBlackMan> YaNakilon: Language fanboys, ignore and move on
Alkorn has quit [Quit: ChatZilla 0.9.90.1 [Firefox 22.0/20130627161625]]
r0bglees0n has joined #ruby
Krajsnick has joined #ruby
mansi has quit [Ping timeout: 245 seconds]
i_s has quit [Remote host closed the connection]
jalcine has joined #ruby
kayloos has joined #ruby
theRoUS has quit [Ping timeout: 248 seconds]
ffio has quit [Ping timeout: 256 seconds]
DestinyAwaits has quit [Quit: Leaving]
Ripp__ has quit [Quit: This computer has gone to sleep]
graydot has quit [Quit: graydot]
fridim__ has joined #ruby
devoldmx has joined #ruby
Kruppe has joined #ruby
<lectrick> YaNakilon: I think it's more from an "irrelevancy" perspective
<lectrick> Who cares if Python can't be as elegant as Ruby? That's Python's problem :O
burlyscudd has quit [Quit: Leaving.]
goodgame has joined #ruby
Guest26795 is now known as fred
<syed_> python is ugly and inconsistent
fred has quit [Changing host]
fred has joined #ruby
ILoveYou has quit [Read error: Connection reset by peer]
sleetdrop has quit [Read error: Connection reset by peer]
indyrl has joined #ruby
sailias has quit [Ping timeout: 276 seconds]
<syed_> looking forward to the sciruby folks maturing the codebase so all the academics can stop doing every darn thing in Python
<zendeavor> brotatos: you ought not to use the aur or even official repositories for these things; editor plugins, programming language packages (pypi, gem, cpan) and other such things should be reserved for their given tools
tatsuya_o has quit [Remote host closed the connection]
<brotatos> zendeavor: what if i want the gem installed system wide?
mmitchel_ has quit [Remote host closed the connection]
<zendeavor> you can do that with gem already
Ry0_ has joined #ruby
Zeeraw has joined #ruby
mmitchell has joined #ruby
<brotatos> Oh.
cmarques has quit [Ping timeout: 246 seconds]
<zendeavor> you just don't want a surprising system update ruining you or your friends' or whoever's dev work
syed_ is now known as edryden
edryden has left #ruby [#ruby]
<zendeavor> and then scrambling to downgrade a package so your projects still work
tockitj has joined #ruby
<tockitj> is there a way to get a list of aliases that given class has ?
AkashicLegend has joined #ruby
tockitj is now known as _tockitj
syed_ has joined #ruby
i_s has joined #ruby
syed_ has left #ruby [#ruby]
_tockitj has left #ruby [#ruby]
marcdel has joined #ruby
burlyscudd has joined #ruby
ffio has joined #ruby
diegoviola has quit [Quit: WeeChat 0.4.1]
ffio is now known as Guest63709
indyrl has left #ruby [#ruby]
Guest63709 has quit [Client Quit]
<hanmac> … i wanted to answer that question and then he disappears
<zendeavor> answer anyway
ffio_ has joined #ruby
<zendeavor> increase the channel's collective expertise.
<Nilium> He joined ruby-lang and asked the same question for some reason.
henn has joined #ruby
henn has joined #ruby
henn has quit [Changing host]
<zendeavor> that's a fantastic idea
<Nilium> Not sure why he left this channel.
<hanmac> get aliased methods from a class:
<hanmac> >> class A; def abc;end; alias xyz abc; end; A.instance_methods(false).select {|m| m=A.instance_method(m); m.name != m.original_name}
<eval-in> hanmac => undefined method `original_name' for #<UnboundMethod: A#abc> (NoMethodError) ... (https://eval.in/38615)
bcave has joined #ruby
<bcave> hi all.
<hanmac> BUT this is an ruby-trunk feature
rickruby has joined #ruby
mikeg has joined #ruby
theRoUS has joined #ruby
theRoUS has joined #ruby
theRoUS has quit [Changing host]
devoldmx has quit [Read error: Connection reset by peer]
Banistergalaxy has quit [Quit: Bye]
echevemaster has joined #ruby
echevemaster has joined #ruby
interactionjaxsn has quit [Remote host closed the connection]
mansi has joined #ruby
Banistergalaxy has joined #ruby
Notte has quit [Remote host closed the connection]
interactionjaxsn has joined #ruby
<amh345> so a client just threw me a fun one. i can only connect to their ftp via ftps.
terrellt has joined #ruby
<amh345> is there anything anyone can recommend for ruby that will make my life easier?
ndrei has joined #ruby
<Xeago> doesn't the net:: stuff also have ftps?
<Xeago> assuming it is ftp over ssh
<Xeago> (or is that sftp?)
<amh345> i think that's sftp. i've never worked with ftps before.
RichardBaker has quit [Quit: RichardBaker]
renderful has joined #ruby
RichardBaker has joined #ruby
<hanmac> zendeavor: this one works in older too
RichardBaker has quit [Client Quit]
<hanmac> >> class A; def abc;end; alias xyz abc; end; A.instance_methods(false).select {|m| A.instance_method(m).inspect.include?("(") || !A.instance_method(m).inspect.include?("\##{m}") }
<eval-in> hanmac => [:xyz] (https://eval.in/38625)
sleetdrop has joined #ruby
smathieu has joined #ruby
fernandoaleman has joined #ruby
interactionjaxsn has quit [Ping timeout: 268 seconds]
devoldmx has joined #ruby
RichardBaker has joined #ruby
rshetty has quit [Ping timeout: 268 seconds]
<bcave> I'm writing a script that uses gems, and want to specify an older version of gem to use that's installed. How can I do that with require? I've tried require 'somegem-0.1.0'
Ry0_ has quit [Remote host closed the connection]
internet_user has joined #ruby
<bcave> sorry, i think i just found the docs for that
MrRacoon has joined #ruby
kirun has joined #ruby
sguselnikov has quit [Quit: Computer has gone to sleep.]
invsblduck is now known as predde
theRoUS has quit [Ping timeout: 276 seconds]
jalcine has quit [Excess Flood]
sleetdrop has quit [Ping timeout: 240 seconds]
ezkl has joined #ruby
saarinen has joined #ruby
Steppen has joined #ruby
renderful has quit [Ping timeout: 276 seconds]
guiocavalca_off has joined #ruby
mkozjak has joined #ruby
Spooner has quit [Remote host closed the connection]
<hanmac> for all others: Method#inspect and UnboundMethod#inspect does have changed in recent Ruby versions for aliased methods … so if your code use that, "BEWARE!"
<mkozjak> is there a way to install nokogiri in ubuntu 12.04 at all? nokogiri requires Ruby version >= 1.9.2.; ruby 1.9.3p0 (2011-10-30 revision 33570)
kiri has quit [Ping timeout: 246 seconds]
<mkozjak> seems like i need it for savon
Zeeraw has quit [Quit: Computer has gone to sleep.]
cha1tanya has joined #ruby
cha1tanya has joined #ruby
Nenor has quit [Quit: Nenor]
momomomomo has joined #ruby
razi has quit [Quit: Leaving.]
<hanmac> mkozjak there should not be a problem, newer versions of nokogiri dont even need external libs anymore (you need to install ruby-dev and the other stuff needed like an C(++) compiler and "make" )
yxhuvud2 has joined #ruby
kirun has quit [Ping timeout: 264 seconds]
SeySayux has joined #ruby
Liothen has quit [Ping timeout: 254 seconds]
Ry0_ has joined #ruby
LMolr has quit [Ping timeout: 246 seconds]
Es0teric has joined #ruby
marr has quit [Ping timeout: 264 seconds]
Davey has joined #ruby
Davey has quit [Excess Flood]
<mkozjak> hanmac: installed everything and it still complains...
<mkozjak> dunno
yxhuvud has quit [Ping timeout: 264 seconds]
<hanmac> mkozjak can you pastie the problems?
<mkozjak> ERROR: Error installing nokogiri: nokogiri requires Ruby version >= 1.9.2.
<mkozjak> only this
Villadelfia has joined #ruby
x1337807x has joined #ruby
<hanmac> what does ruby -v and gem env shows you?
jarin has quit [Ping timeout: 248 seconds]
d3 has quit [Quit: Ухожу я от вас (xchat 2.4.5 или старше)]
sayan has quit [Ping timeout: 256 seconds]
elaptics is now known as elaptics`away
blueOxigen has joined #ruby
Skaflem has joined #ruby
bluOxigen has quit [Ping timeout: 256 seconds]
predde is now known as invsblduck
smathieu has quit [Ping timeout: 240 seconds]
tonini has joined #ruby
sleetdrop has joined #ruby
sleetdrop has quit [Max SendQ exceeded]
danbeck has joined #ruby
<mkozjak> hanmac: ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]; http://pastebin.com/raw.php?i=LrZUfMj8
xcthulhu has quit [Quit: xcthulhu]
sleetdrop has joined #ruby
<mkozjak> RUBY EXECUTABLE: /usr/bin/ruby1.8
sleetdrop has quit [Max SendQ exceeded]
<mkozjak> seems like that is the problem..
guiocavalca_off has quit [Remote host closed the connection]
<hanmac> your gem does not point to the currect ruby … (use update-alternative —config gem)
<sam113101> I think my rubygems is broken: http://pastie.org/private/wjnvdqqtt95j3t7ycij0g
thams has joined #ruby
<sam113101> how do I fix it?
<mkozjak> hanmac: thanks!
<momomomomo> sam113101: !pastie
breakingthings has quit [Quit: breakingthings]
cpruitt has joined #ruby
<sam113101> momomomomo: !what
<sam113101> momomomomo: !pastebin
<Nilium> sam113101: Did you build Ruby from source?
<sam113101> I'm using rvm
<Nilium> .. That doesn't answer the question
jaimef has quit [Excess Flood]
sleetdrop has joined #ruby
sleetdrop has quit [Max SendQ exceeded]
<Nilium> What does rvm have to do with whether you built it or not?
apeiros has joined #ruby
<hanmac> hm sam113101 read about what you need for openssl with rvm and build ruby again
breakingthings has joined #ruby
<sam113101> well, I let rvm build it? idk
sleetdrop has joined #ruby
SeySayux has quit [Read error: Connection reset by peer]
<Nilium> God, you people and your rvm >_>
Villadelfia has quit [Read error: Connection reset by peer]
k0rupted has quit [Quit: Ex-Chat]
axeman- has quit [Remote host closed the connection]
pen has quit [Remote host closed the connection]
<momomomomo> Nilium: I use rvm, do you use rbenv? or some other thing which amounts to the same end?
theRoUS has joined #ruby
<Nilium> I use rbenv, but that's neither here nor there.
<momomomomo> Nilium: that's my point
Skaflem has left #ruby [#ruby]
SeySayux has joined #ruby
<Nilium> Problem is he's unaware of the things he's done
<momomomomo> That's a user/documentation problem :p
<Nilium> People using rvm and rbenv are both capable of letting their tools make them stupid.
sleetdrop has quit [Client Quit]
<momomomomo> agreed
<sam113101> just want to code ruby man, and you guys told me not to use apt-get
jonkri has joined #ruby
<momomomomo> sam113101: did you look at the link I pasted?
alvaro_o has joined #ruby
<sam113101> yes I'm trying this
<sam113101> I'll tell you if it works or not
Al_ has quit [Quit: Al_]
jaimef has joined #ruby
JohnBat26 has quit [Quit: KVIrc 4.3.1 Aria http://www.kvirc.net/]
araujo has quit [Ping timeout: 240 seconds]
lnormous has joined #ruby
<TheBlackMan> sam113101: try rvm
<sam113101> but isn't it what rvm does? download the source code of ruby and compile it itself?
<momomomomo> TheBlackMan: He's using rvm.
Skaflem has joined #ruby
apeiros has quit [Ping timeout: 246 seconds]
cmarques has joined #ruby
Villadelfia has joined #ruby
<Nilium> In hushed whispers all around: "he's using rvm"
tonini has quit [Remote host closed the connection]
<Nilium> We must don our black robes.
<momomomomo> sam113101: basically, your linux distro doesn't include some things needed to compile ruby via rvm
<TheBlackMan> ruby needs to be made 'easier'
<TheBlackMan> like golang.
<havenwood> I wear the purple robe of chruby.
<TheBlackMan> Golang install is a simple installer.
<TheBlackMan> Boom.
<Nilium> Ruby's pretty easy. People just make it complicated.
<hanmac> sam113101: did you try "rvm pkg install openssl" ?
alex__c2022 has quit [Quit: alex__c2022]
<TheBlackMan> Nilium: No it isn't. For windows, you need the devkit.
<sam113101> hanmac: yes
<Nilium> I installed it from source and it was just a matter of configuring and building
<momomomomo> hanmac: might be worth it to click ont he SO link I pasted
<TheBlackMan> That's an extra unnecessary step.
s00pcan has quit [Quit: leaving]
kayloos has quit [Remote host closed the connection]
<Nilium> Ah, well, Windows users are in the non-posix land, so they're just doomed
<hanmac> sam113101: also "rvm autolibs openssl" ?
s00pcan has joined #ruby
araujo has joined #ruby
mikeg has quit [Remote host closed the connection]
vlad_starkov has joined #ruby
maxmanders has joined #ruby
guiocavalca_off has joined #ruby
<sam113101> Unknown subcommand 'openssl' for autolibs
<TheBlackMan> sam113101: rvm autolibs enable
<TheBlackMan> rvm reinstall 2.0.0
maxmanders has quit [Max SendQ exceeded]
codecop has joined #ruby
C0deMaver1ck has quit [Remote host closed the connection]
maxmanders has joined #ruby
Davey has joined #ruby
C0deMaver1ck has joined #ruby
C0deMaver1ck is now known as Guest34786
darth_chatri has quit [Quit: Leaving.]
burlyscudd has quit [Quit: Leaving.]
mikeg has joined #ruby
sailias has joined #ruby
fernandoaleman has left #ruby [#ruby]
xcthulhu has joined #ruby
hamakn has quit [Remote host closed the connection]
S0da has joined #ruby
interactionjaxsn has joined #ruby
kirun has joined #ruby
kiri has joined #ruby
Guest34786 has quit [Changing host]
Guest34786 has joined #ruby
Guest34786 is now known as C0deMaver1ck
bronson has quit [Read error: Connection reset by peer]
JohnBat26 has joined #ruby
LMolr has joined #ruby
jprovazn has joined #ruby
jorge__ has joined #ruby
SeySayux has quit [Ping timeout: 246 seconds]
vlad_starkov has quit [Remote host closed the connection]
AlHafoudh has joined #ruby
guiocavalca_off has quit [Remote host closed the connection]
eldariof has joined #ruby
guiocavalca_off has joined #ruby
viszu has quit [Ping timeout: 268 seconds]
petru has joined #ruby
realDAB has quit [Quit: realDAB]
chase-work has joined #ruby
goshakkk has joined #ruby
samuelkadolph has quit [Ping timeout: 260 seconds]
<petru> Hi. Is there a ruby function that returns the lesser of two given numbers?
vlad_starkov has joined #ruby
SeySayux has joined #ruby
<momomomomo> >
<jokke> petru: (a < b) ? a : b
denver has quit [Read error: Connection reset by peer]
S0da has quit [Ping timeout: 264 seconds]
alex__c2022 has joined #ruby
kuku has joined #ruby
<jokke> nothing ruby specific
S0da has joined #ruby
<jokke> normal ternary operator
<kuku> I get this error: /usr/local/lib/ruby/gems/1.9.1/gems/backports-3.3.0/lib/backports/tools.rb:328:in `require': /root/sweet_dashboard_project/jobs/on_the_phone.rb:2: invalid multibyte char (US-ASCII) (SyntaxError) Line 2 is: require 'json' 
<petru> jokke: ah, thanks
lacko has joined #ruby
guiocavalca_off has quit [Ping timeout: 260 seconds]
timonv has joined #ruby
<petru> jokke: I was unsure about passing it to .times, but it works just fine:)
mikeg has quit [Remote host closed the connection]
Villadelfia_ has joined #ruby
samuelkadolph has joined #ruby
havenwood has quit [Remote host closed the connection]
<lacko> hi, im using end_with? function to find find files with specific suffixes (which i have saved in an array), however the function always returns false, any help?
havenwood has joined #ruby
SeySayux has quit [Ping timeout: 240 seconds]
bw_ has quit [Ping timeout: 240 seconds]
Villadelfia has quit [Ping timeout: 260 seconds]
xcthulhu has quit [Read error: Connection reset by peer]
bw_ has joined #ruby
<Nilium> lacko: Do you have an example of the input and suffix you're testing for?
apeiros has joined #ruby
myth17 has quit [Remote host closed the connection]
forrest has joined #ruby
thams has quit [Quit: thams]
RichardBaker has quit [Quit: RichardBaker]
<r0bglees0n> lectrick: sorry, i went AFK. i mean, you can try write code that causes deadlocks, but they're not always easy to reproduce. i'd write tests if you can, but i'd assume those types of bugs might expose themselves while running other tests just testing the code.
<r0bglees0n> lectrick: if you can think of a possible deadlock scenario, write a test for it
Villadelfia_ has quit [Read error: Connection reset by peer]
xcthulhu has joined #ruby
tatsuya_o has joined #ruby
<lacko> i got a bunch of file names in an array like "movie.mkv" etc and suffixes are in an array of strings as well [".mkv",".avi"] etc
thams has joined #ruby
xcthulhu has quit [Client Quit]
<hanmac> lacko, end_with? does not accept an array, or how did you try it?
kuku has left #ruby [#ruby]
sguselnikov has joined #ruby
<lacko> oh...it seemed to me from docs that thats how it works...how do i put multiple suffixes in then?
Villadelfia has joined #ruby
Ry0_ has quit [Remote host closed the connection]
Burnninator has joined #ruby
<Nilium> suffices.any? { |suffix| name.end_with?(suffix) }
<hanmac> hm ok it does not support an array, but it n list
<hanmac> name.end_with?(*suffices)
AkashicLegend is now known as Akashic_Afk
<Nilium> Ah, didn't know it took multiple arguments.
<Nilium> Also, in retrospect, I don't think suffices is the plural of suffix.
SeySayux has joined #ruby
Es0teric has quit [Quit: Computer has gone to sleep.]
haxrbyte_ has quit [Read error: Connection reset by peer]
haxrbyte has joined #ruby
nikeita has quit [Quit: sleep]
<Nilium> Looks to just be suffixes.
<Nilium> Despite having a degree in English, I still get these things wrong.
rodacato has quit [Remote host closed the connection]
viszu has joined #ruby
<lacko> thanks guys :D it works like a charm
xcthulhu has joined #ruby
goshakkk has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
brotatos has left #ruby ["WeeChat 0.4.1"]
colonolGron has joined #ruby
Cyrus_ has quit [Quit: Cyrus.sleep()]
Mars` has joined #ruby
rodacato has joined #ruby
Ry0_ has joined #ruby
brianpWins has joined #ruby
momomomomo has quit [Quit: momomomomo]
mocfive__ has joined #ruby
Villadelfia_ has joined #ruby
tkuchiki has quit [Remote host closed the connection]
SeySayux has quit [Ping timeout: 260 seconds]
Villadelfia has quit [Ping timeout: 276 seconds]
nikeita has joined #ruby
Villadelfia has joined #ruby
<sam113101> what's ruby-head in rvm?
<havenwood> sam113101: 2.1.0-dev
<sam113101> does it always point to the latest dev version?
SeySayux has joined #ruby
<havenwood> best i recall
<sam113101> should I use that for production?
<havenwood> sam113101: I'd use latest stable: 2.0.0-p247
Villadelfia_ has quit [Ping timeout: 240 seconds]
kirun has quit [Ping timeout: 256 seconds]
Mars1 has joined #ruby
<hanmac> sam113101: you should only use ruby-head if you are crazy like me ;P
Villadelfia_ has joined #ruby
SeySayux_ has joined #ruby
Mars` has quit [Ping timeout: 246 seconds]
<Nilium> Crazy or _awesome_
benlieb has joined #ruby
Zeeraw has joined #ruby
Ry0_ has quit [Remote host closed the connection]
SeySayux has quit [Ping timeout: 276 seconds]
Villadelfia has quit [Ping timeout: 276 seconds]
Akashic_Afk has quit [Quit: Akashic_Afk]
pskosinski has quit [Quit: Til rivido Idisti!]
cj3kim has joined #ruby
shosti has quit [Ping timeout: 248 seconds]
kirun has joined #ruby
LMolr has quit [Quit: Leaving]
momomomomo has joined #ruby
guiocavalca_off has joined #ruby
guiocavalca_off has quit [Client Quit]
marcdel has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
internet_user has quit [Remote host closed the connection]
nikeita has quit [Quit: bye bye]
ewag has quit [Ping timeout: 264 seconds]
interactionjaxsn has quit [Remote host closed the connection]
failshell has quit [Remote host closed the connection]
sambao21 has quit [Quit: Computer has gone to sleep.]
interactionjaxsn has joined #ruby
S0da has quit [Remote host closed the connection]
jerius has quit [Ping timeout: 248 seconds]
<sam113101> thanks guys
burlyscudd has joined #ruby
amacgregor has joined #ruby
mityaz has quit [Quit: See ya!]
Catbuntu is now known as CristinaYang
SeySayux_ has quit [Ping timeout: 264 seconds]
sambao21 has joined #ruby
<momomomomo> sam113101: you finally got it? Was it the SO link instructions that helped?
bonobo has joined #ruby
BizarreCake has quit [Quit: Leaving]
interactionjaxsn has quit [Ping timeout: 268 seconds]
SeySayux has joined #ruby
CristinaYang is now known as LexieGrey
<sam113101> momomomomo: I just rm'd -rf ~/.rvm and reinstalled everything
Mars1 has quit [Ping timeout: 276 seconds]
jorge__ has quit [Remote host closed the connection]
<sam113101> the SO instructions didn't really help
<momomomomo> after installing openssl & zlibs & autolibs
jorge__ has joined #ruby
sguselnikov has quit [Quit: Textual IRC Client: http://www.textualapp.com/]
<momomomomo> well sam113101 when you built RVM the second time, you had access to those libraries, which you didn't previously
<momomomomo> so they probably did, though you didn't know it :)
tonini has joined #ruby
rupee has quit [Quit: Leaving]
<sam113101> maybe
<sam113101> we'll never know
<momomomomo> definitely, it was an SSL error - I've dealt with that before :p
devoldmx3 has joined #ruby
elaptics`away is now known as elaptics
momomomomo has quit [Quit: momomomomo]
yfeldblum has quit [Read error: Connection reset by peer]
jorge__ has quit [Ping timeout: 264 seconds]
devoldmx has quit [Ping timeout: 264 seconds]
SeySayux has quit [Ping timeout: 268 seconds]
LexieGrey has quit [Quit: a]
yfeldblum has joined #ruby
median^ has joined #ruby
Skaflem has quit [Quit: Leaving]
internet_user has joined #ruby
SeySayux has joined #ruby
<median^> I'm having an odd problem, I moved my redmine virtual image to a truecrypt container and since then the virtual machine has acted strangely, the webrick server is extremely slow, i can't seem to do a "bundle install" without getting "Network error while fetching". I've since then moved the virtual image back to a normal hdd but the problems persist. Any idesas?
bamdad has joined #ruby
sam113101 is now known as sam113101_afk
kaspergrubbe has joined #ruby
viszu has quit [Quit: Leaving.]
sarkis has joined #ruby
lacko has quit [Quit: Lost terminal]
sam113101_afk is now known as sam113101
TradeRaider has joined #ruby
Zeeraw has quit [Quit: Computer has gone to sleep.]
x1337807x has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
rickmasta has joined #ruby
thams has quit [Quit: thams]
rickruby has quit [Remote host closed the connection]
timonv has quit [Remote host closed the connection]
Krajsnick has quit [Remote host closed the connection]
Banistergalaxy has quit [Ping timeout: 246 seconds]
rdark has joined #ruby
Krajsnick has joined #ruby
cha1tanya has quit [Quit: cha1tanya]
Banistergalaxy has joined #ruby
Nakilon has joined #ruby
i_s has quit [Remote host closed the connection]
YaNakilon has quit [Ping timeout: 246 seconds]
Opettaja has joined #ruby
interactionjaxsn has joined #ruby
axeman- has joined #ruby
timonv has joined #ruby
amacgregor has quit [Ping timeout: 276 seconds]
tatsuya_o has quit [Remote host closed the connection]
michaeldeol has quit [Remote host closed the connection]
hamakn has joined #ruby
Davey has quit [Quit: Computer has gone to sleep.]
ananthakumaran has quit [Quit: Leaving.]
colonolGron has quit [Ping timeout: 264 seconds]
johnjohnson has quit [Quit: Textual IRC Client: www.textualapp.com]
marr has joined #ruby
rodacato has quit [Remote host closed the connection]
workmad3 has joined #ruby
SoonerBourne has quit [Quit: HydraIRC -> http://www.hydrairc.com <- It'll be on slashdot one day...]
theRoUS has quit [Ping timeout: 248 seconds]
hamakn has quit [Ping timeout: 245 seconds]
fredjean has quit [Quit: Textual IRC Client: http://www.textualapp.com/]
saarinen has quit [Quit: saarinen]
mantas322 has joined #ruby
Ry0_ has joined #ruby
<mantas322> Hi guys this is somethign so simple im ashmed to ask here
<mantas322> i googled this
freerobby has quit [Read error: Connection reset by peer]
freerobby has joined #ruby
<mantas322> I'm trying to remove all characters besides numbers and letters from a string
vikhyat has joined #ruby
tatsuya_o has joined #ruby
fredjean has joined #ruby
anderson has joined #ruby
sailias has quit [Ping timeout: 268 seconds]
<lectrick> mantas322: string.gsub!(/[^A-Za-z0-9]/,'')
<fryguy> depending on what your definition of a number or a letter is (unicode stuff)
timonv has quit [Remote host closed the connection]
goshakkk has joined #ruby
<lectrick> true.
<lectrick> ::alnum:: ?
<hanmac> mantas322: str.gsub(/\W+/,"") or str.gsub(/[^[:alnum:]]+/,"")
<mantas322> okay
<mantas322> I was missing the [] brackwets
<mantas322> thanks you very much lectrick
<mantas322> you solution is acceptable
<mantas322> thanks to the others that worked also
<kaspergrubbe> mantas322: string.gsub!(/\W?/,'') you can test it here: http://rubular.com/r/ig6ZPuOFwF
<mantas322> okay thanks.
<lectrick> 'aba&$3GA2928@!bdE*'.gsub(/\W/,'') #=> "aba3GA2928bdE"
<aedorn> pretty sure just \W would work
<lectrick> yep see above
<aedorn> er, yeah, as shown
Jork1 has joined #ruby
<lectrick> mantas322: that one is better
<mantas322> whsoe?
<mantas322> whose*
<hanmac> hm ok \W is not correct because it had "_" outside
<lectrick> mine
Mars1 has joined #ruby
<mantas322> yeah I like your, its most easily readable by others
<lectrick> or hanmac's with the :alnum:
<lectrick> are both \W and [:alnum:] unicode-ready?
mikeg has joined #ruby
Zeeraw has joined #ruby
anildigital is now known as anildigital_away
<hanmac> lectrick: hm no \w or \d does not care about unicode
<hanmac> hm but i dont know if ruby1.8 supports the alnum if he still uses it
<lectrick> mantas322: teaching a man to fish by reading that code in English: "Globally replace any character NOT (^) in the set of characters containing alphanumerics (\W means "not word character i.e. alphanumeric", \w means "word character"), with empty string.
<kaspergrubbe> yeah, it will remove them. It removes these as well: æøåÆØÅ
<lectrick> hanmac: who still strives for 1.8 compatibility? :O
<mantas322> i know some of that :)
<mantas322> Perl is super imposed into all languages!
dankest has joined #ruby
<mantas322> I just needed a hot solution
<hanmac> i do not, but i dont want that the user came back whining because the code does not work
<mantas322> hto of the presses
<lectrick> lol pretty uch
<lectrick> much*
saarinen has joined #ruby
bamdad has quit [Quit: bamdad]
colonolGron has joined #ruby
gildo has joined #ruby
sailias has joined #ruby
pyoor has left #ruby [#ruby]
louism2wash has joined #ruby
iliketurtles has quit [Quit: zzzzz…..]
ghr has joined #ruby
<louism2wash> Hey guys, I'm coming from the Java world and I am trying to understand what the equivalent of the main function in Ruby is. Main is where the program starts execution in Java. Is there an equivalent in Ruby? Thanks.
<apeiros> louism2wash: no specific method
<C0deMaver1ck> there is no equivalent in Ruby
<C0deMaver1ck> it just starts execution
<apeiros> it's just the code in the toplevel of the executed file
<hanmac> louism2wash: in ruby the toplevel itself is the main function
<hanmac> >> self
<eval-in> hanmac => main (https://eval.in/38636)
zmike123 has quit [Quit: ~]
realDAB has joined #ruby
TradeRaider has quit [Quit: Page closed]
chase-work has quit [Quit: Computer has gone to sleep.]
gildo has quit [Ping timeout: 264 seconds]
ghr has quit [Remote host closed the connection]
Ry0_ has quit [Remote host closed the connection]
axeman- has quit [Remote host closed the connection]
reset has joined #ruby
Krajsnick has quit [Remote host closed the connection]
Vivekananda has joined #ruby
i_s has joined #ruby
kpshek has quit []
<louism2wash> hey guys, so I still don't really get it. If you have multiple code files in your lib folder how does it decide which one to execute when you start up the program?
<apeiros> louism2wash: "it" does not decide. you do.
<terrellt> louism2wash: You have a root script that instantiates the objects and calls them.
michaeldeol has joined #ruby
<apeiros> by either having a file which is executable, and executing that file
marcdel has joined #ruby
<apeiros> or by using `ruby path/to/script.rb`
<louism2wash> terrellt: where does that execution script reside in the file structure? what is it labeled?
mark_locklear has quit [Quit: Leaving]
<Kelet> louism2wash, require or require_relative generally
<Kelet> maybe load
<Kelet> or rather
<Kelet> that's what is called generally in an app.rb file or main.rb or whatever you want to call it
mansi has quit [Read error: Connection reset by peer]
<terrellt> louism2wash: Wherever you want? Typically in the root of your project, or inside bin. You'd call it via ruby filename.rb
<Kelet> which often resides in the top-level directory or bin directory
mansi has joined #ruby
lucianosousa has joined #ruby
mansi has quit [Read error: Connection reset by peer]
mansi has joined #ruby
Zeeraw has quit [Quit: Computer has gone to sleep.]
sambao21 has quit [Quit: Computer has gone to sleep.]
marcdel has quit [Client Quit]
median^ has left #ruby [#ruby]
kpshek has joined #ruby
<r0bglees0n> louism2wash: do you come from Java or C or something?
<apeiros> louism2wash: windows user?
x1337807x has joined #ruby
jibi has joined #ruby
devoldmx has joined #ruby
<louism2wash> yes, java and windows
hanmac has quit [Quit: Leaving.]
sambao21 has joined #ruby
i_s has quit [Ping timeout: 256 seconds]
kpshek has quit [Client Quit]
<r0bglees0n> louism2wash: okay, and you use 'import' in java to bring in other classes, right?
<apeiros> louism2wash: ok, so you're probably not used to ordinary scripts
rickmasta has quit [Quit: Leaving...]
JohnBat26 has quit [Read error: Connection reset by peer]
<apeiros> in *nix, you can make a file executable by setting the executable bit, and having a shebang in the script
<louism2wash> apeiros: no, that is a somewhat foreign concept
<apeiros> that's a line which reads like: #!/usr/bin/env ruby
<apeiros> I don't really know windows' equivalent for that
<louism2wash> apeiros: cool, I'm sure thats what I'm looking for
<louism2wash> apeiros: thanks
kofno has quit [Remote host closed the connection]
<apeiros> it might be that none exists and you have to always use the interpreter (in this case ruby.exe) to run your script
<louism2wash> and thanks to all for the help
michaeldeol has quit [Ping timeout: 256 seconds]
i_s has joined #ruby
<Kelet> iirc that's just a shell thing, and you can get bash/zsh/etc. on windows
devoldmx3 has quit [Ping timeout: 264 seconds]
<speakingcode-wor> yeah you ca use cygwin or whatever to get a shell env
<speakingcode-wor> but really, whats the point. windows sucks in every way an operating system can, and then some
BRMatt has quit [Ping timeout: 248 seconds]
kofno has joined #ruby
mikepack has quit [Remote host closed the connection]
jprovazn has quit [Quit: Odcházím]
kofno has quit [Read error: Connection reset by peer]
jarin has joined #ruby
jarin has quit [Remote host closed the connection]
Davey has joined #ruby
Appineer has joined #ruby
Taranis has joined #ruby
Appineer has left #ruby [#ruby]
Zeeraw has joined #ruby
<xybre> speakingcode-wor: yeah, except gaming, drivers, software, etc
<waxjar> 3, 2, 1 OS FLAME WAR! :D
timonv has joined #ruby
reset has quit [Quit: Leaving...]
<speakingcode-wor> not gonna do that, but i'll just say i've been using linux for years and i don't remember the last time i had a driver issue, or a lack of needed software. those are arguments of the mid 90's
<speakingcode-wor> ya know, when linux was like, 3
x1337807x has quit [Quit: Textual IRC Client: www.textualapp.com]
marcdel has joined #ruby
brbcoding has quit [Ping timeout: 256 seconds]
smathieu has joined #ruby
<speakingcode-wor> however i don't remember the last time i was able to search download and install an application or update pretty much every program installed on my system with a single command in windows
<zendeavor> drivers aren't an issue, except that so many of them have to be reverse-engineered and start out lacking many useful features
* xybre lights a cigar
aaronmcadam has quit [Ping timeout: 260 seconds]
<zendeavor> apeiros: windows just has file associations, which care for nothing but the file extension
BRMatt has joined #ruby
<xybre> Linux's 3D support is getting better, but there's a lot of domains out side of development that still don't have good Linux-compatible replacements.
<zendeavor> you have to dig through some shit in the control panel to set the "Default Program"
rodacato has joined #ruby
razi has joined #ruby
<xybre> And in all fairness, Windows 8 has some really weird issues that might be driver related.
razi has quit [Client Quit]
<xybre> zendeavor: its not rocket science man, you can right click on it and "open with.." any program
michaeldeol has joined #ruby
<zendeavor> k.
RichardBaker has joined #ruby
tubbo has joined #ruby
<speakingcode-wor> i mean it's true that linux doesn't share the same commercial support as windows, but that has been changing pretty steadily. OSX being posix played a role, the surging popularity of ubuntu, advances in cross-platform solutions and non-compiled languages (things ultimately go where the developers are), etc
timonv has quit [Remote host closed the connection]
pitzips has quit [Remote host closed the connection]
<spider-mario> Qt gained a lot of traction, too
<tubbo> there hasn't been a "great OS" since OS/2 honestly
<Kelet> Maybe not the same but I'm fairly sure that Linux has an absolutely massive commercial supporting
<spider-mario> Maya and Guitar Pro have been rewritten with it
alex__c2022 has quit [Quit: alex__c2022]
yfeldblum has quit [Ping timeout: 264 seconds]
<speakingcode-wor> Kelet: yeah it's massive, but not the mainstream level of windows in terms of commercial hardware and software
<Kelet> Maybe one day I will switch whenever my video card works well on it, but until then, I don't have enough money to buy Nvidia and even then it's second-class drivers.
<swordsmanz> tubbo: WTF Be PWNED os/2
<xybre> I like Linux, I just *wish* it had some better software for certain domains. I use it every day, I'm using it right now. But Windows has some advantages, and so does OSX.
<tubbo> swordsmanz: i'm gonna release my fork of BeOS soon, "BeOS In Da Trap"
<spider-mario> Kelet : I’d say the best GPU drivers on Linux are Intel’s
Uranio has quit [Quit: while you reading this, a kitty dies]
<xybre> tubbo: I was going to say Be-OS or Amiga.
<xybre> hah
<spider-mario> (except for those chips by PowerVR)
<speakingcode-wor> tubbo: i <3 beos
<spider-mario> (“Poulsbo”)
<speakingcode-wor> hate that it didn't ever really take off
<swordsmanz> os/2 was just a shitty windows like unix clone :S
<spider-mario> speakingcode-wor : there are people working on Haiku
<tubbo> haha
havenwood has quit [Remote host closed the connection]
<speakingcode-wor> wasn't os/2 more or less just a gui to sit on top of msdos?
<tubbo> speakingcode-wor: it's still around, right? http://apple.com/osx
<xybre> Windows until NT was a GUI on top of DOS
<tubbo> ^
s0ber_ has joined #ruby
<speakingcode-wor> that too
<tubbo> NT is the most recently-developed full OS, afaik
<swordsmanz> yes and windws has ALWAYS been SHIT
<tubbo> like from scratch
<xybre> IBM had PC-DOS which had a REXX interpreter built into the command line. It was badass!
graft has joined #ruby
pitzips has joined #ruby
Mars1 is now known as Marsthemanwithth
platzhirsch has joined #ruby
<platzhirsch> There is a grammar problem in the Ruby standard library: NoMethodError: undefined method `is_an?' for 200:Integer
iliketurtles has joined #ruby
p0wn3d has quit [Remote host closed the connection]
<xybre> platzhirsch: is_a?
<platzhirsch> xybre: but since Integer starts with an i
<C0deMaver1ck> lol
<speakingcode-wor> haha
<C0deMaver1ck> Ruby.is_like? :english == true
<platzhirsch> btw. should I use Integer or Fixnum when testing for whole numbers?
s0ber has quit [Ping timeout: 264 seconds]
<C0deMaver1ck> Ruby != English
<speakingcode-wor> ruby is more like engrish
s0ber_ is now known as s0ber
<C0deMaver1ck> ^ :p
<platzhirsch> :)
maxmanders has quit [Quit: Computer has gone to sleep.]
* xybre facepalm
<spider-mario> I’m not convinced that being English-like is such a great thing for a programming language, anyway
Steppen has quit [Quit: Leaving]
mansi has quit [Remote host closed the connection]
maetthew has joined #ruby
<C0deMaver1ck> then haskell is the language for you my friend
* zendeavor points at perl
<spider-mario> English can be verbose or vague
<zendeavor> how does that make you feel
<spider-mario> I do like haskell and perl
<xybre> platzhirsch: class Object; alias_method :is_an?, :is_a?; end
<spider-mario> well, maybe haskell lacks punctuation
<spider-mario> I think I prefer perl’s syntax
<waxjar> being english like is great for the developer though!
<platzhirsch> xybre: that would make an awesome commit message, but let's keep it a joke, thanks anyway :D
<zendeavor> which is more like english than any language i've ever seen
<spider-mario> well, there’s also AppleScript. :D
<spider-mario> and Logo
<C0deMaver1ck> you guiz... I write everything in Lisp))))))))
<speakingcode-wor> ruby is english like, but it's still a strict enough subset with strict enough rules that avoid complete verbosity and vagueness of spoken language
<wmoxam> ruby isn't english like
<wmoxam> :p
<wmoxam> it's just got friendly naming and a fuck-ton of sugar on top
havenwood has joined #ruby
iliketurtles has quit [Ping timeout: 268 seconds]
<speakingcode-wor> i mean it's pretty maleable
* C0deMaver1ck wonders what Ruby would look like if Matz had used his native language
Jedi_SCT1 has quit [Quit: See ya]
<swordsmanz> ruby is nothing like english :S
<speakingcode-wor> if condition.... or do this if such and such...s o easy to write a dsl
marcdel has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
devoldmx has quit [Read error: Connection reset by peer]
<swordsmanz> since when do you puts"" and gets""() in english
mansi has joined #ruby
<waxjar> he and she do :P
* C0deMaver1ck starts to think of puts gets jokes
<swordsmanz> I'm just off to gets""() be some pussy xD …. no you wouldn't say it
I99Mhz has quit [Ping timeout: 268 seconds]
<Xeago> haskell be cool!
<wmoxam> #brogrammingruby
sam113101 is now known as sam113101_afk
<wmoxam> jeez
Jedi_SCT1 has joined #ruby
<spider-mario> what do you think of the J language?
<C0deMaver1ck> J or Java?
<speakingcode-wor> it gets the doggy and it puts it in the baskett
<spider-mario> j
<speakingcode-wor> ruby is on some silence of the lambs shit
<spider-mario> quicksort in J:
<spider-mario> quicksort=: (($:@(<#[) , (=#[) , $:@(>#[)) ({~ ?@#)) ^: (1<#)
<C0deMaver1ck> spider-mario: never really spent more than 1 minute looking at it
<spider-mario> not very english-like
lewis has joined #ruby
lewis is now known as Lewix
Xeago has quit [Remote host closed the connection]
banghouse2 has joined #ruby
greenr has joined #ruby
maetthew has quit [Quit: maetthew]
ZOGM has quit [Remote host closed the connection]
_br_ has quit [Read error: Operation timed out]
banghouse2 is now known as banghouse
pandawarrior has joined #ruby
yfeldblum has joined #ruby
mantas322 has left #ruby [#ruby]
iliketurtles has joined #ruby
bamdad has joined #ruby
anildigital_away is now known as anildigital
louism2wash has quit [Quit: This computer has gone to sleep]
thepumpkin has joined #ruby
burlyscudd has quit [Quit: Leaving.]
_br_ has joined #ruby
freerobby has quit [Quit: Leaving.]
Jork1 has left #ruby [#ruby]
Davey has quit [Quit: Computer has gone to sleep.]
kpshek has joined #ruby
pierre1 has joined #ruby
amacgregor has joined #ruby
jdubs has joined #ruby
pyx has joined #ruby
paissad has quit [Ping timeout: 264 seconds]
Squarepy has quit [Quit: Leaving]
pyx has quit [Client Quit]
paissad has joined #ruby
geekbri has quit [Remote host closed the connection]
<jdubs> Hello all! Having trouble creating an array of arrays, I forgot how to keep it from linking the arrays as duplicates. Example: Array.new(5, Array.new(5, nil)) to create 5x5 array of arrays
Notte has joined #ruby
<jdubs> They are linking to each other so that a change to any of the arrays, is a change to all of them
<apeiros> use block-form
<apeiros> without block-form, it is the same array instance in every "slot" of the array
<apeiros> >> Array.new(5, Array.new(5)).map(&:object_id)
<eval-in> apeiros => [553797870, 553797870, 553797870, 553797870, 553797870] (https://eval.in/38637)
<apeiros> vs
<apeiros> >> Array.new(5) { Array.new(5) }.map(&:object_id)
<eval-in> apeiros => [552691820, 552691800, 552691780, 552691770, 552691750] (https://eval.in/38638)
smathieu has quit [Remote host closed the connection]
<jdubs> ah cool
maetthew has joined #ruby
<jdubs> Thanks man!
cads2 has joined #ruby
alex__c2022 has joined #ruby
BRMatt has quit [Ping timeout: 264 seconds]
kaspergrubbe has quit [Remote host closed the connection]
devoldmx has joined #ruby
kaspergrubbe has joined #ruby
_br_ has quit [Quit: Bye, thanks for all the fish.]
AkashicLegend has joined #ruby
kaspergrubbe has quit [Read error: Connection reset by peer]
kaspergrubbe has joined #ruby
marcdel has joined #ruby
bluOxigen has joined #ruby
lnormous has quit [Ping timeout: 264 seconds]
jorge__ has joined #ruby
pentameter has quit [Read error: Connection reset by peer]
sailias has quit [Ping timeout: 246 seconds]
Bry8Star{T2 has quit [Ping timeout: 240 seconds]
blueOxigen has quit [Ping timeout: 276 seconds]
brisbin has joined #ruby
brisbin has quit [Client Quit]
sambao21 has quit [Quit: Computer has gone to sleep.]
brisbin has joined #ruby
lutfidemirci has joined #ruby
spider-mario has quit [Ping timeout: 268 seconds]
mansi has quit [Remote host closed the connection]
realDAB has quit [Quit: realDAB]
jorge__ has quit [Remote host closed the connection]
benzrf has joined #ruby
<benzrf> hey, anybody there?
jorge__ has joined #ruby
jdubs has quit []
realDAB has joined #ruby
sambao21 has joined #ruby
anildigital is now known as anildigital_away
pentameter has joined #ruby
hanmac1 has joined #ruby
ElderFain_ has quit [Ping timeout: 260 seconds]
paissad_ has joined #ruby
sarkis has quit [Ping timeout: 240 seconds]
mansi has joined #ruby
paissad has quit [Ping timeout: 246 seconds]
freerobby has joined #ruby
mansi has quit [Remote host closed the connection]
devoldmx has quit [Read error: Connection reset by peer]
jorge__ has quit [Ping timeout: 276 seconds]
mansi has joined #ruby
ffranz has quit [Quit: Leaving]
mansi has quit [Read error: Connection reset by peer]
PhatBaja has joined #ruby
mansi has joined #ruby
mansi has quit [Remote host closed the connection]
<lectrick> no, nobody
* xybre hears crickets
mansi has joined #ruby
paissad__ has joined #ruby
paissad_ has quit [Ping timeout: 245 seconds]
<lectrick> ruby is engrish until respond_to? becomes responds_to?
<lectrick> and include? becomes includes?
<platzhirsch> Parent class A defines method initialize, Sub-class B calls parent class initialize. Can I fetch the name of B inside of initialize?
<lectrick> C0deMaver1ck: ^
ldnunes has quit [Quit: Leaving]
greenr has quit [Quit: Konversation terminated!]
<Mon_Ouie> Object#are_a?
<apeiros> lectrick: you're wrong bro
greenr has joined #ruby
<apeiros> lectrick: ruby is inconsistent, but what matz wanted was 2nd person, not 3rd
hanmac1 has quit [Ping timeout: 246 seconds]
<apeiros> i.e., you ask an object: "do you respond to methodname?"
<r0bglees0n> platzhirsch: it depends what 'self' is.
<apeiros> and then it's respond_to?, not responds_to?
<r0bglees0n> if it's an instance of B, it will be B.
Al_ has joined #ruby
<r0bglees0n> otherwise it's A.
<lectrick> apeiros: why not both? very interesting observation, though, never realized that
<apeiros> lectrick: it's not an observation
<apeiros> it's what matz himself stated
maz-dev has quit [Remote host closed the connection]
<apeiros> but as said, ruby is inconsistent in that regard. many method are 3rd person.
<apeiros> *methods
geekles has quit [Quit: WeeChat 0.4.0]
<lectrick> apeiros: wow. neat then. but I still want to type "includes?". Maybe I can submit a "3rd Person Ruby" gem :)
<platzhirsch> r0bglees0n: ok that makes sense. I could derive a variable from the class name, but I am not sure whether this is good practice. Just would save me from setting it when calling the method
Mattix has joined #ruby
<lectrick> apeiros: we could call it... Omniscient
Bry8Star{T2 has joined #ruby
<apeiros> lectrick: well, IMO the 3rd person method names are overwhelming. I'd be fine if they'd introduce 3rd person aliases and deprecated 2nd person until 2.5 or so
sam113101_afk is now known as sam113101
<apeiros> platzhirsch: self.class.name
mansi has quit [Ping timeout: 276 seconds]
<apeiros> >> class A; def initialize; p self.class.name; end; end; class B; end; B.new
<eval-in> apeiros => #<B:0x42190f04> (https://eval.in/38642)
<platzhirsch> ah what the heck I go for it
<lectrick> apeiros: "do this if collection includes element" is what it sounds like in the english brain, though, possibly explaining the lost art of 2nd-person method naming
<r0bglees0n> platzhirsch: self.class.name will only be 'B' if you're in an instance of B.
<platzhirsch> r0bglees0n: that will be the case
<r0bglees0n> okay
<platzhirsch> in fact I don't want to make the parent class being an instance of itself, but since Ruby does not know abstract classess...
<lectrick> apeiros: or I could do this: you = collection; do_this if you.include? element :)
<apeiros> lectrick: "you thing do X if you obj include element" (talking to 2 different people/objects)
<brisbin> lectrick: [does] object.respond_to?(:method). [does] array.include?(:element) # is how i read it
<apeiros> funny
<lectrick> ah, nice
<apeiros> I always just translate it to 3rd person :D
<lectrick> brisbin: that's... something I wish I had realized sooner than now lol
pedda has quit [Quit: Textual IRC Client: www.textualapp.com]
<lectrick> brisbin: the problem is the logic often goes: if object.respond_to?(:method)
greenr has quit [Ping timeout: 268 seconds]
<lectrick> Maybe the solution is to avoid conditionals, like those hardcore functional people suggest haha
realDAB has quit [Quit: realDAB]
<brisbin> technicaly, we're asking the object a question: [do you] respond_to? if <i ask the object "[do you] respond_to" and it replys true>...
<lectrick> I wrote a fizzbuzz function that used zero conditionals (I call this "fun" lol) and was purely functional, as an exercise
xcthulhu has quit [Quit: xcthulhu]
<apeiros> lectrick: care to show the code?
<Mon_Ouie> Avoiding conditionals? I never heard any of that about functionnal programming
sambao21 has quit [Quit: Computer has gone to sleep.]
smathieu has joined #ruby
<brisbin> if is a smell in haskell
<Mon_Ouie> Because you have pattern matching instead I suppose
<apeiros> branching is a fundamental part of computing
<Mon_Ouie> And cases
<apeiros> and in every loop you have branching
<apeiros> you may not write 'if', but you'll have conditionals pretty sure
<lectrick> Mon_Ouie: Yeah, might just be Haskell that hates conditionals.
<brisbin> apeiros: of imperative programming probably, and some languages don't have loops (i.e. haskell)
<apeiros> it's just like "I use Array#include?, so I don't have to iterate the array"
atmosx has joined #ruby
brennanMKE has quit [Remote host closed the connection]
<apeiros> brisbin: haskell has at the very least functions, and there's branching involved too…
Zai00 has joined #ruby
<brisbin> involved != fundamental, and functions != branching
Mattix has quit [Ping timeout: 248 seconds]
<apeiros> …if you say so.
gyre007 has quit [Remote host closed the connection]
nanoxd has quit [Quit: Textual IRC Client: www.textualapp.com]
<apeiros> lectrick: thanks!
<lectrick> apeiros: I'm looking at this, and I only sorta understand it now. I must have slept well that day. lol
GMFlash has joined #ruby
realDAB has joined #ruby
<Mon_Ouie> lectrick: It's just that 'if' is not the only way to have a conditional
seich- has quit [Ping timeout: 264 seconds]
Kruppe has quit [Ping timeout: 264 seconds]
kalleth has quit [Quit: No Ping reply in 180 seconds.]
adambeynon has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
kalleth has joined #ruby
ffio_ has quit [Quit: WeeChat 0.4.1]
spectre1 has quit [Quit: Leaving.]
greenr has joined #ruby
Al_ has quit [Read error: Connection reset by peer]
AkashicLegend has quit [Quit: AkashicLegend]
Al_ has joined #ruby
pandawarrior has quit [Quit: Leaving.]
goodgame has quit [Quit: Quitte]
Jedi_SCT1 has quit [Quit: See ya]
kalleth has quit [Client Quit]
tonini has quit [Remote host closed the connection]
jp- has quit [Quit: OK, I believe you… but my tommy gun don't]
kalleth has joined #ruby
Jedi_SCT1 has joined #ruby
atmosx has quit [Ping timeout: 264 seconds]
kpshek has quit []
breakingthings has quit [Quit: breakingthings]
atmosx has joined #ruby
asteve has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
jonathanwallace has quit [Ping timeout: 245 seconds]
kirun has quit [Quit: Client exiting]
cr3 has joined #ruby
mmitchell has quit [Remote host closed the connection]
Kar- has quit [Remote host closed the connection]
<platzhirsch> I cannot get this into my head how do I call the parent instance method inside the instance method with the same name?
<cr3> has anyone used net::ssh to exec more than one command? it's not doing anything and not showing any useful information and the doc doesn't explain how
<apeiros> brisbin: re loops and haskell not having them - you have a loop in something as simple as a multiplication. but I'd be rather sure that generators, map etc. are to be considered loop constructs too.
<platzhirsch> probably A.instance_method(:method2).bind(self).call yay
<apeiros> platzhirsch: super
<platzhirsch> apeiros: super.method_name ?
<apeiros> no
<apeiros> just super
<apeiros> class A; def foo(arg1, arg2, …); end; end; class B < A; def foo; super(arg1, arg2, …); end; end
realDAB has quit [Quit: realDAB]
_Andres has quit [Quit: My Mac Pro has gone to sleep. ZZZzzz…]
<platzhirsch> indeed, my bad. Thanks!
xcthulhu has joined #ruby
iliketurtles has quit [Quit: zzzzz…..]
wmoxam has quit [Ping timeout: 260 seconds]
FuZion755 has joined #ruby
benlieb has quit [Quit: benlieb]
ntus1017 has quit [Remote host closed the connection]
pierre1 has quit [Quit: Leaving]
Al_ has quit [Read error: Connection reset by peer]
Al_ has joined #ruby
seitensei has joined #ruby
lele has quit [Ping timeout: 245 seconds]
Burnninator has quit [Quit: Leaving]
mbreedlove has joined #ruby
mbreedlove has quit [Remote host closed the connection]
internet_user has quit [Remote host closed the connection]
<benzrf> hello.
<benzrf> what should I read if I want to really *get* how Ruby works, fully?
<apeiros> the source code?
<benzrf> like, how the object system works, what the semantics of things like assignment are, that stuff
<benzrf> apeiros: not the interp
<benzrf> the language
<atmosx> benzrf: I haev a list of books
<benzrf> well
<apeiros> the book by matz and flannagan
<benzrf> I also need to learn it beyond the basics
<benzrf> ;P
<platzhirsch> apeiros: oh, no I get what you mean by JUST 'super'. I thought this is only applicable for the method initialize, but it's the general paradigm for all cases :)
mbreedlove has joined #ruby
<atmosx> benzrf: Programming ruby: From novice to pro -> PickAxe -> eloquent ruby -> metaprogramming (something)
<platzhirsch> now*
<apeiros> it's rather comprehensive, albeit rather dry
<benzrf> hmm.
<benzrf> the main thing here is that I hate the feeling of not knowing what's going on behind the scenes
<benzrf> like, what a classdef _does_
amacgregor has quit [Ping timeout: 240 seconds]
<apeiros> but if you want to answer that question, then you very much are in the implementation of ruby itself…
<benzrf> no, not like that
<benzrf> hmm
freerobby has quit [Quit: Leaving.]
<apeiros> if not, then it's just "a class def defines a new object of type class"
<benzrf> well, my current favorite language is python. so for example, in python doing a classdef is sugar for calling the type constructor
<benzrf> yes, it creates a new class, but what does that _mean_
Mattix has joined #ruby
<apeiros> nothing beyond "it creates a new class".
<benzrf> ok.
<atmosx> it creates a new class
<benzrf> so class creation is the lowest-level thing.
<atmosx> hardly
<benzrf> a class def is _not_ sugar for anything else
<benzrf> in terms of the lang, not the interp
<apeiros> s/the/a/
<apeiros> no
<apeiros> there are other ways to achieve it
<benzrf> I mean, for example
<apeiros> e.g. Class.new
<benzrf> in python, it means taking a dict of local variables and a couple of of other things and passes them to the type() constructor
<benzrf> what does it do in ruby?
<benzrf> is it sugar for something?
<benzrf> or is it a primitive?
<apeiros> but `class X < Y; end` is not sugar for `X = Class.new(Y)`
<apeiros> even though the result will be the same
<apeiros> ruby doesn't have primitives
Opettaja has quit [Remote host closed the connection]
* benzrf sighs
<benzrf> primtives as in
sarkis has joined #ruby
<benzrf> operations that cannot be represented with more fundamental things
<apeiros> primitives have a distinct meaning. it does not apply in ruby.
keyword has joined #ruby
mbreedlove has quit [Remote host closed the connection]
<speakingcode-wor> maybe he means like, native operation, or something
<apeiros> anyway, I think the book I recommended is what you're looking for. it goes into technicalities.
<benzrf> sort of, I guess?
<benzrf> maybe a better way to put it would be
<apeiros> fundamentals of ruby:
<benzrf> if ruby had macros, could you represent it as a macro
<apeiros> every "thing" is an object
<benzrf> or is it a lowest-level builtin
<apeiros> every object has a class
mbreedlove has joined #ruby
<apeiros> even classes are objects
<keyword> hi guys I have question I need to parse a csv with ruby but it has a line like that "foo "bar" ", "foo", "bar" anyone knows how can I take the extra quote
<apeiros> the only method container in ruby is Module. Class inherits from Module and inherits its capability to contain methods.
<benzrf> hmm.
Spooner has joined #ruby
<apeiros> individual objects can contain their own methods by having a singleton_class (a class belonging only and only to that single object)
<benzrf> ok, so...
<benzrf> when I do obj.foo
<speakingcode-wor> benzrf: i'll tell you something that has helped me out. when learning a new language, ignore what you know about other languages. hey aren't designed to be analagous and equivalent to languages that already exist. they bring new approaches and fundamentals, so ignore what you already know about other langs
<benzrf> that calls the method foo on obj
interactionjaxsn has quit [Remote host closed the connection]
<benzrf> speakingcode-wor: yeah, I know
<benzrf> :P
Es0teric has joined #ruby
<apeiros> I strongly support speakingcode-wor recommendation
<apeiros> if you try to reapply what you already know, you'll end up with broken idioms.
<benzrf> yes
<xybre> benzrf: "class Foo;end" is a bunch of "sugar" in the interpreter that does something like `Foo = Class.new; Foo.name = :Foo`. See here: http://apidock.com/ruby/Class
<benzrf> I KNOW.
mmitchell has joined #ruby
interactionjaxsn has joined #ruby
mbreedlove has quit [Remote host closed the connection]
<benzrf> xybre: ok, thank you
mklappstuhl has joined #ruby
<benzrf> obj.foo sends the message foo to the object obj, right?
<apeiros> yes
swordsmanz is now known as CAPTIALLETTERS
<benzrf> and that's a primitive operation?
<apeiros> yes
<benzrf> ok.
<benzrf> in practice, how does that work?
Xeago has joined #ruby
<benzrf> does it go through the class?
<xybre> benzrf: you can always write it like `obj.send :my_method_name, arg1, arg2`
freerobby has joined #ruby
marr has quit [Ping timeout: 268 seconds]
<apeiros> the chain is: obj's singleton class > obj's class > obj's class' ancestors
<apeiros> when that's through, then obj.method_missing is invoked with the same chain
<benzrf> do all objects have singleton classes?
<apeiros> when that is through, NoMethodError is raised
<apeiros> no, but that's an implementation detail.
<apeiros> you may just consider every object having one.
<benzrf> so it acts as though they do;
<xybre> benzrf: Ruby is a "message passing" language, so when you def a method, it registers a symbol of that name, when the object recieves a message like that it defers the arguments to the method object iself (which is a varient on a lambda)
<benzrf> you can look up the singleton class of any object, but it doesn't have one until you ask?
<apeiros> can be
<benzrf> xybre: yes, I know >:P
<xybre> benzrf: all objects have singletons
<apeiros> as said, that's an implementation detail
alex__c2022 has quit [Quit: alex__c2022]
mbreedlove has joined #ruby
<xybre> I wouldn't call them singletons, but effectively, they are.
<apeiros> in MRI/KRI about every object will lazily create the singleton class
<benzrf> mri == matz's ruby implementation?
<apeiros> yes
<xybre> benzrf: you asked "obj.foo sends the message foo to the object obj" so I wasn't going to assume you knew.
<benzrf> I was double checking
<benzrf> I know a tiny bit of smalltalk
<apeiros> by using an explicit receiver, the chain will bypass private methods btw.
interactionjaxsn has quit [Ping timeout: 240 seconds]
<benzrf> apeiros: what does that mean?
Zai00 has quit [Quit: Zai00]
bluOxigen has quit [Ping timeout: 240 seconds]
<apeiros> that private methods of the name "foo" are considered as non-existent
<benzrf> alright.
hasrb has quit [Remote host closed the connection]
jonathanwallace has joined #ruby
forrest has quit [Quit: Leaving]
<benzrf> is method resolution done directly by the interpreter, or does foo.bar implicitly make some kind of lookup method call?
<apeiros> i.e., you'll get a NoMethodError if no public method was found. the notable thing here is that this even applies if you do self.foo
<apeiros> interpreter
atyz has quit [Quit: Leaving...]
<benzrf> ok
Zeeraw has quit [Ping timeout: 264 seconds]
<benzrf> ok, so when you have a name, such as foo, it first looks for any method in your current context with that name, then tries to resolve it a local variable?
<apeiros> no
<apeiros> lvars have precedence
<benzrf> oh, ok
<benzrf> what's with foo= methods?
<apeiros> except if it's unambiguously a method
<benzrf> their return value is ignored?
<apeiros> e.g. foo(), or foo 1
amacgregor has joined #ruby
<apeiros> foo= require an explicit receiver
greenr has quit [Ping timeout: 245 seconds]
<apeiros> since `foo = 1` *always* assigns to an lvar
<benzrf> yes
<benzrf> but, the return value of foo= methods is ignored.
<benzrf> so they're magical?
bcave has quit [Read error: Connection reset by peer]
<apeiros> if you use the obj.foo = val syntax, yes
<benzrf> how else can they be called?
<apeiros> in which case they also can't accept more than 1 argument
<apeiros> via send
<apeiros> Object#send
<benzrf> ah, right
CAPTIALLETTERS is now known as PHYSICS-NAZIS
bcave has joined #ruby
baordog has quit [Remote host closed the connection]
<benzrf> what's with method_missing?
bcave is now known as Guest17299
mikeg has quit [Ping timeout: 256 seconds]
<apeiros> method_missing can be used to implement "catch-all"
<benzrf> is it like __getattr__ in python?
v0n has quit [Ping timeout: 256 seconds]
<apeiros> since if no method of that name was found, method_missing is being invoked with the method name as the first param
<benzrf> ah. ok
<benzrf> so it is
<benzrf> :p
<apeiros> I don't know python. I doubt it is.
u- has quit [Remote host closed the connection]
<benzrf> in python, foo.bar implicitly calls type(foo).__getattribute__(foo, 'bar')
<benzrf> if it raises an attributeerror, it then calls __getattr__ the same way
mansi has joined #ruby
sambao21 has joined #ruby
iliketurtles has joined #ruby
<apeiros> well, see my explanation of the method invocation chain
<apeiros> you decide whether it is the same
<benzrf> mhm
mikeg has joined #ruby
PHYSICS-NAZIS is now known as swordsmanz
brotatos has joined #ruby
swordsmanz has quit [Remote host closed the connection]
<brotatos> How would I perform a system wide installation of a gem?
goshakkk has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<Nilium> Well, first you burn a bible
<benzrf> brotatos: I dunno anything about gems, but I would assume you use sudo
<Nilium> Then you string at least 6 people up and hang them from the ceiling
<benzrf> that's how cpanm and pip do it
<brotatos> sudo just installs it to /root/.gems
<apeiros> brotatos: if your ruby & gems is installed systemwide, then just by `sudo gem install gemname`
<Nilium> Helps if there's more than 6, but 6 is the minimum
<apeiros> brotatos: however, if you used e.g. rvm and installed ruby for a single user, then you simply can't install a gem systemwide (wouldn't make sense if you could…)
<Paradox> anyone have a particular opinion on what options parsing library to use?
greenr has joined #ruby
<cr3> net::ssh is a big lie, it doesn't support executing multiple commands in the same session!
seitensei has quit [Quit: Leaving...]
greenr has quit [Client Quit]
kjellski has joined #ruby
<Nilium> I use my own.
<apeiros> cr3: you're mistaken.
<Paradox> i've used optparse
<apeiros> cr3: also, please refrain from blurping out unproven nonsense. thanks.
<benzrf> how is Foo::bar different from Foo.bar?
<apeiros> benzrf: sadly it isn't.
<benzrf> wat
<apeiros> however, using :: for method invocation is considered "old style"
freerobby has quit [Quit: Leaving.]
<romdi`> what's the most elegant/efficient way to slice a unicode string into byte arrays of a certain size without splitting a multi-byte character? text.bytes.each_slice(10).map {|slice| slice.pack('C*').force_encoding('UTF-8') } has the problem of splitting characters, but is otherwise what I want
<cr3> apeiros: every channel and every exec closes the session between each command, I've tried and I've searched
allsystemsarego has quit [Quit: Leaving]
<xybre> benzrf: Foo::Bar resolves constants, but there's no difference for method invocation.
kaspergrubbe has quit [Remote host closed the connection]
BillCriswell has quit [Remote host closed the connection]
<benzrf> also, why can't I do 'foo = {3}'? I thought blocks were valid expressions, period?
<cr3> apeiros: the only solution is apparently to revert to an older version that had somekind of shell, or concatenate commands with && or ;
Mattix has quit [Ping timeout: 256 seconds]
<xybre> benzrf: because {} is also hash syntax, ruby has to figure it out via context
<benzrf> ah.
hanmac1 has joined #ruby
<benzrf> and what, exactly, is the significance of capitalization in ruby?
<benzrf> Constants and classes?
mansi has quit [Remote host closed the connection]
<xybre> benzrf: constants are capitals
<apeiros> cr3: I'm quite certain that you're wrong, having used net/ssh myself and having had multiple commands which set up an env and used that myself.
<apeiros> if the session had been closed in between, the env would have been lost
<xybre> benzrf: classes and modules are defined as constants using the standard helpers
kjellski has left #ruby [#ruby]
mansi has joined #ruby
<benzrf> xybre: which are?
<cr3> apeiros: if you have sample code, I'd like to see. otherwise, I say net::ssh 2.* is a lie
michaeldeol has quit [Remote host closed the connection]
Al_ has quit [Read error: Connection reset by peer]
<apeiros> cr3: let me see if I can find my gist within a reasonable time
icewalker has joined #ruby
Al_ has joined #ruby
<benzrf> hmm,
<benzrf> why aren't the basic control structures functions w/ blocks?
<benzrf> speed?
<apeiros> not just
<apeiros> methods only accept one block
<apeiros> and the way conditions are evaluated couldn't always be done nicely
<benzrf> can you elaborate?
jonkri has quit [Quit: BRB]
<apeiros> while(foo == 1) { … }
<apeiros> this would not work
<benzrf> ohhhh. right
<apeiros> the condition would only be evaluated once
dash_ has quit [Quit: dash_]
<apeiros> you could do: while(->{foo == 1}) { … }
<xybre> benzrf: constants are treated different by the interpreter, they resist being changed to point to different objects
<apeiros> but… ugly
amacgregor has quit [Ping timeout: 264 seconds]
<apeiros> and I think performance was a consideration too
lebek has joined #ruby
jibi has quit [Quit: .]
<apeiros> benzrf: but most syntactic loop constructs are rarely ever used in ruby
<benzrf> OK
<apeiros> the most often used loop construct is .each
hanmac1 has quit [Ping timeout: 245 seconds]
<benzrf> I dunno... I feel like, if I want to learn a whole new language, maybe I should just skip right to Lisp
<apeiros> and all descendants from Enumerable (which builds up on each)
<atmosx> each rocks
Lindrian has joined #ruby
<benzrf> my main thoughts in trying ruby instead of python is FP support anyway
<Mon_Ouie> Constants also have different scoping rules from local variables
<atmosx> benzrf: if you want to learn lisp why don't you directly to lisp?
<apeiros> cr3: hm, it's not the one I was looking for, but I think I used this: http://gist.github.com/apeiros/1770565
jonkri has joined #ruby
rdark has quit [Quit: leaving]
swordsmanz has joined #ruby
<apeiros> cr3: and you'd e.g. do multiple ssh.exec3! in that block
ezkl has quit [Ping timeout: 240 seconds]
<benzrf> atmosx: Lisp isn't necessarily my goal. flexibility, self-modifiability, multi-paradigm support, and elegance are
ILoveYou has joined #ruby
mansi has quit [Ping timeout: 276 seconds]
<apeiros> cr3: (where "that block" = line 32-34)
atyz has joined #ruby
<cr3> apeiros: this is what I have: http://pastebin.com/fGVuLGca
<xybre> benzrf: yeah thats what I liked about Lisp too, but then I realized self-modifiability might not be the most maintable attribute lol. Check out iolanguage though.
<atmosx> okay good night all
atmosx has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
<benzrf> xybre: well, I don't necessarily believe in ABUSING it.
Al_ has quit [Read error: Connection reset by peer]
<apeiros> cr3: your issue is that 'cd' doesn't work?
<benzrf> I just like having it because it's good to have
<benzrf> :P
<benzrf> macros are fucking awesome
Al_ has joined #ruby
<xybre> benzrf: I agree. But as soon as you're working on a team, the first "junior" dev you hire... the thigns they do with the power they're given. I shudder to think about.
<benzrf> but yeah, my main beef with Python lately has just been, lack of good FP
soukihei has quit [Quit: ["Textual IRC Client: www.textualapp.com"]]
<benzrf> list comps are hardly my favorite thing, even though everyone seems to think they're so much CLEARER than mao
<benzrf> *map
<cr3> apeiros: the problem is that I'm seeing "channel_close" betwen commands and I get no output for the ls command
<benzrf> <_<
<benzrf> and of course python's lambdas are postively neutered
<benzrf> still... the level of purity in terms of how little is hardcoded into the interpreter vs. the behaviors of the builtin types...
<benzrf> :D
<cr3> apeiros: my code is oddly similar to that exec3...
swordsmanz has quit [Read error: Connection reset by peer]
<apeiros> cr3: well, I'm sorry, it's too late. but I know that I did change working directories and while I didn't use ls, I used commands which affected the working directory, so that should be possible to do
mmitchell has quit [Ping timeout: 256 seconds]
swordsmanz has joined #ruby
mikeg has quit [Remote host closed the connection]
vlad_starkov has quit [Remote host closed the connection]
<xybre> benzrf: list comps are really cool, just can be completely supplanted by other strategies. Unless you're doing hard math, the other ways are way cleaner.
<benzrf> exactly
<apeiros> gn8
<cr3> apeiros: could I ping you about it tomorrow? I really spent a great deal of time on this, so you can tell I'm a bit frustrated but I'd still like to know how
<benzrf> guido has an unnatrual hatred of FP
<benzrf> :(
<apeiros> cr3: sure
<benzrf> he tried to remove lambdas in py3. not that it would make much of a difference since python's lambdas suck
elaptics is now known as elaptics`away
<cr3> apeiros: thanks, you've significantly improved my mood :)
<apeiros> cr3: I understand you're frustrated. but try to vent it elsewhere and go to get help with a fresh attitude. it's not helping in your search for help…
<xybre> benzrf: I was all about list comps because of haskell, but after looking at their functionality really hard while designing an interpreter for a language I realized they're not that useful in practice. Kinda a sucky realization.
pyoor has joined #ruby
<benzrf> but since map and filter are iterators in py3, list comps end up being more terse anyway since you have to wrap all of your map/filter calls with list()
<benzrf> >:(
<apeiros> cr3: anyway, good luck. I hope the knowledge that it *should* be possible is at least a bit of help.
anonymuse has quit [Remote host closed the connection]
tatsuya_o has quit [Remote host closed the connection]
anonymuse has joined #ruby
<cr3> apeiros: it's also that knowledge that frustrated me because knowing it's possible and failing at it sucks :)
<xybre> benzrf: mind if I PM you?
<benzrf> xybre: did you know that very, VERY little of python's class system is part of the core language?
<apeiros> cr3: heh
<benzrf> no, go ahead
<apeiros> anyway, off now
<benzrf> like 80% of it is implementable in pure python
cr3 has quit [Quit: leaving]
enebo has quit [Quit: enebo]
apeiros has quit [Remote host closed the connection]
postmodern has joined #ruby
pyoor has left #ruby [#ruby]
apeiros has joined #ruby
<xybre> benzrf: yeah, its like Lisp's common object system, its not built into the language at all, its a library
<benzrf> well
lutfidemirci has quit [Remote host closed the connection]
<benzrf> an extremely well-integrated library with syntactical sugar
<benzrf> :0
dEPy has quit [Remote host closed the connection]
<xybre> Okay okay, not *just* a library, it is Lisp after all.
cmarques has quit [Ping timeout: 276 seconds]
<benzrf> no, I meant python's
<benzrf> :P
<xybre> Oh that. Meh :p
seich- has joined #ruby
<benzrf> I dunno, both python and ruby feel like they have too much stuff for me to want to abandon either. although I never really started using ruby :y
ilyam has joined #ruby
soukihei has joined #ruby
Xeago has quit [Remote host closed the connection]
anonymuse has quit [Ping timeout: 264 seconds]
romdi`` has joined #ruby
<xybre> I like Ruby, there's things I like about Python too. There's lots of cool languages.
<benzrf> yeah, but all of them are missing cool parts from other languages
<benzrf> D:<
<benzrf> no matter what I use I feel like I'm missing out
<benzrf> <_>
freerobby has joined #ruby
hasrb has joined #ruby
michaeldeol has joined #ruby
geggam has quit [Remote host closed the connection]
<xybre> benzrf: write your own, thats my plan. :p
<benzrf> LIBRARY SUPPORT
renderful has joined #ruby
<benzrf> everything is terrible
romdi` has quit [Ping timeout: 268 seconds]
renderful has quit [Remote host closed the connection]
brennanMKE has joined #ruby
<benzrf> I mean
devoldmx has joined #ruby
<benzrf> even with really minor things
<GMFlash> hello all. i'm trying to evaluate trusted ruby code in a limited context and here's what i have so far: ( https://gist.github.com/GMFlash/6066746 ~20LOC ) do you have any recommendations on how I can improve it? i'm not sure if i'm reinventing the wheel or not.
<benzrf> I wish python had symbols
<benzrf> I wish ruby used foic
<benzrf> :|
<Nilium> foic? meat industry employees?
<benzrf> forced indentation of code
<benzrf> significant whitespace
<Nilium> So, fioc. Also, I'm glad it doesn't.
<benzrf> oops right
<benzrf> Nilium: crazy talk
<benzrf> fioc is the shit
<Nilium> Assuming you mean no 'end' and whatnot.
<Nilium> If you mean keep the end but also force people to not be assholes and indent their code, then yes, go for it.
<benzrf> what, why
<benzrf> why would y ouwant BOTH
<Nilium> My beef with python isn't the indentation, it's the lack of obvious, explicit markers for the end of a scope.
<benzrf> erm... indentation resuming?!
lebek has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<benzrf> *outdentation
<xybre> I'm so torn on the whole "end" thing. I use some whitespace significant languages (yaml, haml, slim, sass-orig, etc) and I like them just fine for data.
<Nilium> It's easier to eyeball some code and see where it begins/ends by an 'end' than looking for the next line with differing indentation.
<benzrf> ...
<benzrf> no, not really
<Nilium> Yes, really.
<benzrf> outdentation kind of stands out more than an end
<Nilium> It really doesn't for me.
<benzrf> what
<Nilium> Especially not with the conventional 2-space indentation I see in Ruby.
<xybre> I think its something you get used to. Like how none of my Ruby code uses parens unless absolutely required. A lot of people complain about it.
<benzrf> it is literally a large shift of all of the text
<benzrf> ugh 2-space
<benzrf> well yeah
<benzrf> I use 8-space tabs.
* benzrf ducks
<Nilium> Maybe if you were i- yeah, was going to say, if you were insane and used 8 spaces.
<speakingcode-wor> lmao
brennanMKE has quit [Ping timeout: 248 seconds]
<xybre> lol 8 space tabs
<Nilium> 8 spaces? Seriously?
<benzrf> errything is SUPER READBLE
<benzrf> :Y
<speakingcode-wor> 8 space tabs kinda proves his point
<zendeavor> 4 maximum
<zendeavor> 8 spaces is an eyesore
<Nilium> 8 spaces. You seriously use 8 spaces?
amacgregor has joined #ruby
<benzrf> i keep meaning to switch
<speakingcode-wor> i.e. that whitespace is less absorable to determine scope,
<benzrf> but really there's not enough motivation
<Nilium> Is this like some sort of hipster thing you're trying to do?
<terrellt> Good way to make sure you only nest once.
<benzrf> no not really
<benzrf> it's just vim's default
<benzrf> >_>
<Nilium> You're one of those startup masturbators on hacker news, aren't you? >_>
<terrellt> Otherwise you need another monitor to read your code.
henn has quit [Read error: Connection reset by peer]
<benzrf> actually I don't even use hacker news
<benzrf> :D
<zendeavor> :set sts=2 sw=2 et
<speakingcode-wor> i mean you get in a nested block and you can only type 10 chars without passing 80 on a line, shit
<Nilium> Good man.
<Nilium> But seriously, fix your freakin' vimrc
<benzrf> yeah I'll do that now
<benzrf> .->
colonolGron has quit [Quit: leaving]
hasrb has quit [Remote host closed the connection]
<zendeavor> less emoticons is a good way to go also
freerobby has quit [Quit: Leaving.]
<benzrf> zendeavor: sorry
<benzrf> it's a major habit
<benzrf> I type them without thinking about it
<benzrf> zendeavor: also, what are sts and sw?
mary5030 has quit [Ping timeout: 245 seconds]
<benzrf> I only know of set tabstop
m8 has quit [Quit: Sto andando via]
henn has joined #ruby
<zendeavor> newlines aren't really punctuation either, but i can let that slide a little because i do it myself to emphasize the hard-stops i'd use in verbal speech
marcdel has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<zendeavor> :help 'sts
<zendeavor> :help 'sw
<benzrf> I think it starts from the days when I typed slowly enough that other people would finish way earlier
<zendeavor> :help all-the-things
<benzrf> so I started pressing enter after each phrase so that I could start talking quickly
<benzrf> >_>
marcdel has joined #ruby
<zendeavor> are you still 11?
<benzrf> no
<benzrf> but old habits die hard :)
<xybre> Does Vim default to 8? I haven't used the defaults for a long time.
<zendeavor> indeed.
<zendeavor> vim defaults to 8 "space" hard-tabs
<benzrf> zendeavor: and I am only 16, it's been like 5 years and I don't get enough negative reinforcement for anything to change
<xybre> benzrf: vim lets you shorten commands, so theres like 15 different variations per command
<xybre> Its "fun"
<benzrf> hooray
<zendeavor> i believe it's a holdover from long-gone days of C indenting style
<benzrf> yeah?
osvico has joined #ruby
<xybre> So basically everything that sucks in the world is C's fault.
<xybre> I'd buy it.
Pandee has joined #ruby
<benzrf> many good things too, though
<zendeavor> ugh, C
mikeg has joined #ruby
<grumpwork> Everything that isn't C is just a poor attempt at abstracting the 'hard parts'.
<zendeavor> unfortunately.
<grumpwork> That's what my manager told me, at least.
<zendeavor> it's mostly true.
<zendeavor> but C was a miserable attempt at the same.
<benzrf> lately I've been seeing a lot of recommendations to newbies that they start with C so that 'YOU'LL UNDERSTAND THE BASIC CONCEPTS EVERYTHING IS FOUNDED ON'
<benzrf> :S
<xybre> Just write a new low level language in asm.
<zendeavor> you probably should learn C benzrf. it *is* the foundation of modern programming.
<benzrf> I know a LITTLE c
<xybre> I learned some C, and in all fairness, it did actually help.
<zendeavor> i get the concepts, the ideas. i loathe the day i actually have to write in C.
<benzrf> well I mean, I know about low-level stuff ok
<benzrf> I don't know how to write c very well
icewalker has quit [Quit: icewalker has no reason]
<speakingcode-wor> i'd say learning about things like memory allocation/deallocation, relationship between data structures and memory mapping, etc are more important than knowing c, per se
<xybre> zendeavor: its a pain to write C, but I think it can be tolerable with a little practice
<benzrf> speakingcode-wor: and I know a decent amount of that stuff :)
alex__c2022 has joined #ruby
<zendeavor> probably not though.
<speakingcode-wor> its important to understand the mechanical happenings of the machine implied by your code, and C is kind of the closest thing to a bridge between the two ends (sort of ) but i don't think learnign C itself per se is useful
alex__c2022 has quit [Client Quit]
<benzrf> speakingcode-wor: yeah I'd agree with that
<benzrf> part of why I'm not a fan of recommending C to newbies
camt has quit [Remote host closed the connection]
<zendeavor> xybre: it's fully tolerable, but i still find it loathesome. the verbosity, the boilerplate declarations, the sometimes-you-manage-memory-sometimes-you-dont abstractions
<benzrf> zendeavor: c++?
<benzrf> :3
<zendeavor> ew.
<speakingcode-wor> considering what it provided and what was before it, C is very elegant. its just a much more primitive set of constructs that more resemble a machine than high level abstractions, because thats what it was intended to be
<zendeavor> a disaster, benzrf .
<benzrf> zendeavor: yeah
<benzrf> I meant
<benzrf> I thought you were talking about c++ for a sec
<benzrf> :P
sarkis has quit [Quit: leaving]
<zendeavor> uh.
<xybre> C++ seems so universally loathed, yet its like everywhere.
<speakingcode-wor> c++ is trash garbage and should be forgotten and not mentioned as if it never happened in the first place. i mean, it is like the retarded halfborn crackbaby little brother of java, at best
<zendeavor> it's a filthy language
<benzrf> it is what you get if you murder a few high-level-languages, take some of their organs, put then through a blender, and then attempt to transplant them into C
<zendeavor> the best c++ programs are actually just written in C and incidentally use some other mashup of c++ features
mkozjak has left #ruby [#ruby]
emergion has joined #ruby
vlad_starkov has joined #ruby
Mon_Ouie has quit [Ping timeout: 268 seconds]
<speakingcode-wor> i used to do work on embedded devices and wireless sensor devices with C and a variant called nesC, and it was great for the job... but it wasn't writing web applications that parse and route requests and talk to a database and generate fancy views for users... it was moreo r less describing how various inputs and outputs on a circuit board should wire together
<benzrf> whoa walloftex
<benzrf> t
lebek has joined #ruby
<speakingcode-wor> says the guy taking up half the lines on my screen ;-)
maetthew has quit [Quit: maetthew]
<benzrf> at least my chatting reads like talking, as opposed to being bottled up for five minutes then spewing forth
<speakingcode-wor> yeah
<speakingcode-wor> because
<speakingcode-wor> so many people
<speakingcode-wor> talk like this
freerobby1 has joined #ruby
<benzrf> cmon I'm not quite THAT bad
<benzrf> and I was referring to the fact that in real conversations, you hear words as people say them
<speakingcode-wor> shrug. the internet is a free country
<benzrf> yeah right
workmad3 has quit [Ping timeout: 268 seconds]
fridim__ has quit [Ping timeout: 246 seconds]
<benzrf> what does your nick mean, anyawy?
<speakingcode-wor> speakingcode kind of self explanatory, also the name of a blog i never update. and -wor means i'm at work but freenode's limit on name sizes (or maybe that's the irc procotocl?) doesn't fit the k
<benzrf> ah.
Senjai has quit [Ping timeout: 264 seconds]
platzhirsch has quit [Quit: Leaving.]
<benzrf> ...
<benzrf> wanna see the worst code I ever wrote? it's truly horrifying
<benzrf> you may get some laughs out of it
lebek has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<speakingcode-wor> i suppose you want to share it so you may as well.. but don't feel bad, everyone in here is written crappy code and some always will ;-p
<benzrf> no
keyword has left #ruby [#ruby]
<benzrf> this shit is hilariously awful
<benzrf> :D
Xeago has joined #ruby
<speakingcode-wor> couldn't be worse than some of the jsfiddles posted in #javascript
<benzrf> seriously look at this
devoldmx has quit [Ping timeout: 276 seconds]
<benzrf> I recommend onCommand in SpellCraft.jav
<benzrf> a
<speakingcode-wor> i mean jsut today this guy was asking how to determine if an input to a parameter is a number or not, i gave him the answer. then he posted a jsfiddle and asked how to incorporate it specifically into what he was doing. so i gave him the exact, single line solution and said "paste this at the top of the function exactly as it is" and then a few minutes later he sent another fiddle, wondering why it didn't work, with it all mutilated into
danbeck has quit [Quit: danbeck]
keen____ has joined #ruby
<benzrf> cmon. I have a set of three objects and I check to see if they're valid by putting them into a list, sorting them, turning it into a string, and checking if the result is a key in another list
<benzrf> which is populated directly with handwritten strings
<benzrf> pretty sure I remember thinking there had to be a better way, I wonder why I didn't try to find it
vlad_starkov has quit [Ping timeout: 264 seconds]
moted has quit [Quit: moted]
<zendeavor> try it now.
smathieu has quit [Remote host closed the connection]
<speakingcode-wor> you could rewrite this whole app with a single line: class SpellCraft { public static void main(String args) { System.exit(); } }
<benzrf> it's a plugin silly
<speakingcode-wor> cause that's all the user is gonna do anyway ;-p
<benzrf> for minecraft
<speakingcode-wor> cool
<benzrf> so even if it had main it wouldn't run it :p
<speakingcode-wor> ya ya
mansi has joined #ruby
Lindrian has left #ruby [#ruby]
rodacato has quit [Remote host closed the connection]
jeffreylevesque_ has quit [Read error: Connection reset by peer]
emergion has quit [Quit: Computer has gone to sleep.]
<xybre> Somewhere there exists an abomination I wrote. And entire "activeadmin"-like system all written in a single view back in 2006.
<benzrf> hhhha
<xybre> I have no idea why that was a good idea at the time. I mean, it was *awesome* for what it did, but it was horrible and unmaintainable.
<xybre> Good thing I shipped the product to the client and never saw it again.
rodacato has joined #ruby
<benzrf> mmm
<xybre> I hope no one else had to see it though.
<benzrf> well shit like this is useful as a way of reassuring yourself that you're getting better
<benzrf> :3
<speakingcode-wor> OH THAT WAS YOU MOTHER EFFER
mootpointer has joined #ruby
<benzrf> hahhahhha
<benzrf> tell us speakingcode-wor
<benzrf> tell us your tale of pain
<xybre> You know, if anyone ended up having to maintain it, I wouldn't be surprised if they were here right now.
<speakingcode-wor> haha, nah, the world aint that small. just kidding
<benzrf> aww :(
<speakingcode-wor> but i've been put on some horrible prjects
freerobby1 has quit [Quit: Leaving.]
Myrth has joined #ruby
Myrth has quit [Changing host]
Myrth has joined #ruby
shosti has joined #ruby
<benzrf> man talk about off topic
<xybre> I didn't think it was, but the world is seriously pretty small. And back in 2006 there weren't a whole lot of people doing Rails.
<benzrf> this happens no matter what channel I go into
<benzrf> I carry around a derailgun
blitz has left #ruby ["Leaving"]
<benzrf> so is sinatra : flask :: rails : django
<xybre> Pretty sure all this is on topic for the channel. Bashing C, shunning C++, arguing about Python, telling tales of bad code. Pretty sure I've done this a lot in #ruby.
<benzrf> hm, ok then
<speakingcode-wor> there's not enough time in the day to describe in full, but imagine everything that could be bad on a large software project... horrible spaghetti code, no explanation or documentation, no description of environment setup or configuration, no patterns or anything, tons of functions and variables with meaningless names, tons of duplcated functions, all kinds of bugs and unhandled cases and on and on, i mean a complete mess. and that was j
MrThePlague has quit [Remote host closed the connection]
<speakingcode-wor> benzrf: yeah pretty much
<benzrf> j?
xcv has joined #ruby
hanmac1 has joined #ruby
<speakingcode-wor> sinatra and flask are similar microframeworks, but bottle may be a little bit closer to sinatra... not really a python guy so i dunno
wsterling has quit [Remote host closed the connection]
<xybre> Thats my least favorite thing about C and everyone who writes C. Every fucking variable is a single character. I've seen huge swathes of Ruby code with single letter variables (and sometimes methods!) so everything is an incomprehensible mess.
marcdel has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
tommyvyo has quit [Quit:]
<benzrf> does ruby have anything like pep 8?
<zendeavor> the variables in C are almost always disposable
<xybre> Its really fun when they comment all the single letters though. Why not just use the full name if you're going to comment all of them anyway?!
<benzrf> IT SAVES BYTES
rodacato has quit [Remote host closed the connection]
<xybre> Maybe in the debug symbols.
<benzrf> you never know when your hard drive will be full you know
<speakingcode-wor> xybre: yeah. i mean there's multiple points of view on that. one is that you shouldn't trust variable names anyway and you should look and see wtf they actually are, but eh i don't fall in that camp. also a lot of C was writtne back when computers had like 1k of memory and 20k storage, so
emergion has joined #ruby
<zendeavor> they only exist because you HAVE to declare them so the compiler can figure out how to allocate memory
renderful has joined #ruby
smathieu has joined #ruby
<xybre> You should look and see what they are, and if they're not that, you should damn well fix them.
rodacato has joined #ruby
<benzrf> remind me: foo.bar is looked up directly by the interpreter and doesn't end up as an implicit call to anything, right?\
mneorr_ has quit [Remote host closed the connection]
Koshian__ is now known as i
i is now known as Koshian
<speakingcode-wor> i think that's what was said earlier, but i'm not knowledgeable enough to assert it, benzrf
<benzrf> hmm. ok
AlHafoudh has quit [Quit: Textual IRC Client: www.textualapp.com]
hanmac1 has quit [Ping timeout: 256 seconds]
farn has quit [Ping timeout: 240 seconds]
rodacato has quit [Remote host closed the connection]
bonobo has quit [Write error: Broken pipe]
<xybre> benzrf: its an explicit call to that object (and its ancestors, where applicable)
<benzrf> no, I mean
<benzrf> for example, in python foo.bar is implicitly replaced with a call to type(foo).__getattribute__
<benzrf> in ruby, does it work like that... or does the interpreter directly look it up?
marcdel has joined #ruby
gstamp has joined #ruby
<speakingcode-wor> benzrf: if i'm not mistaken apeiros said it is done by interpreter earlier, scroll up the history to see, but i'm not really sure and well, it probably doesn't matter much unless you're doing something pretty 'low level'
<benzrf> right
<benzrf> IK, but I like to really *get* the languages I use
<benzrf> otherwise it bugs me
<benzrf> :I
<benzrf> g2g anyway, ttyl. thanks for any help you've given me :)
benzrf has quit [Quit: bye]
emergion has quit [Ping timeout: 260 seconds]
Cyrus has joined #ruby
threesome has quit [Ping timeout: 264 seconds]
shosti has quit [Ping timeout: 256 seconds]
codecop has quit [Remote host closed the connection]
mootpointer has quit [Quit: Computer has gone to sleep.]
lucianosousa has quit [Quit: lucianosousa]
fredjean has quit [Quit: Computer has gone to sleep.]
fschuindt has joined #ruby
rodacato has joined #ruby
bamdad has quit [Quit: bamdad]
obs has joined #ruby
Al_ has quit [Quit: Al_]
Deele has quit [Ping timeout: 240 seconds]
Xeago has quit [Remote host closed the connection]
asobrasil has left #ruby [#ruby]
mmitchell has joined #ruby
sambao21 has quit [Quit: Computer has gone to sleep.]
ismlages has quit [Remote host closed the connection]
jonathanwallace has quit [Quit: WeeChat 0.4.0]
brianpWins has quit [Quit: brianpWins]
mmitchell has quit [Ping timeout: 256 seconds]
_maes_ has quit [Quit: Miranda IM! Smaller, Faster, Easier. http://miranda-im.org]
it_tard has joined #ruby
GMFlash has quit [Quit: Computer has gone to sleep.]
GMFlash has joined #ruby
jonathanwallace has joined #ruby
mootpointer has joined #ruby
farn has joined #ruby
nbouscal has quit [Ping timeout: 260 seconds]
shadoi1 has joined #ruby
mklappstuhl has quit [Remote host closed the connection]
ZOGM has joined #ruby
shadoi has quit [Ping timeout: 264 seconds]
guiocavalca_off has joined #ruby
it_tard has quit [Quit: yawn]
johnkary has joined #ruby
realDAB has joined #ruby
michaeldeol has quit [Remote host closed the connection]
pentameter has quit [Read error: Connection reset by peer]
araujo has quit [Read error: Connection reset by peer]
it_tard has joined #ruby
it_tard is now known as Harima_Kenji
Harima_Kenji is now known as it_tard
michaeldeol has joined #ruby
x1337807x has joined #ruby
araujo has joined #ruby
mklappstuhl has joined #ruby
Senjai has joined #ruby
benweint has joined #ruby
johnkary has quit [Quit: @johnkary]
willbradley has left #ruby [#ruby]
Senjai has quit [Read error: Operation timed out]
DanKnox is now known as DanKnox_away
PhatBaja has quit [Quit: Leaving.]
grumpwork has quit [Remote host closed the connection]
benweint has quit [Read error: Operation timed out]
<brotatos> I can't get tempfile to write to the specified tempfile; what am I doing wrong? https://gist.github.com/brotatos/721a9c7c60815d714e41#file-a-rb-L7
FuZion755 has quit [Remote host closed the connection]
predator117 has quit [Ping timeout: 246 seconds]
tjbiddle has quit [Quit: tjbiddle]
mootpointer has quit [Quit: Computer has gone to sleep.]
jonkri has quit [Quit: jonkri]
marcdel has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Vivekananda has quit [Ping timeout: 264 seconds]
predator117 has joined #ruby