<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?
<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.
<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.]
<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.
<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]
<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
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>
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
<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| .
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]
<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]
<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]
<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
<\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]
<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
<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
<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?
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>
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.
<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
<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]
<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_>
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
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\
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
<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
<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}
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.]
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...
<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?
<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.]
<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
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]
<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
<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?
<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
<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
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
<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
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)
<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?
<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.
<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
<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
<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
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]