ChanServ changed the topic of #ruby-lang to: Ruby 1.9.3-p125: http://ruby-lang.org | Paste >3 lines of text on http://pastie.org or use a gist
burns180 has joined #ruby-lang
lchi has joined #ruby-lang
macmartine has joined #ruby-lang
cdnz has joined #ruby-lang
justinmcp has joined #ruby-lang
Faris has joined #ruby-lang
seanstickle has joined #ruby-lang
fragrant has joined #ruby-lang
<fragrant> Hi, i have compiled ruby from source, make, ./ruby got error
<fragrant> <internal:gem_prelude>:1:in `require': cannot load such file -- rubygems.rb (LoadError)
<fragrant> from <internal:gem_prelude>:1:in `<compiled>'
<fragrant> What is the reason?
<drbrain> fragrant: you didn't `make install`
cdnz has joined #ruby-lang
raggi has quit ["Leaving..."]
<fragrant> drbrain: Yes, absolutely right.
<fragrant> drbrain: Can you tell me where is ruby_init function defined?
<fragrant> drbrain: http://pastebin.com/043DcHBL
<drbrain> fragrant: use crags, then vim -t ruby_init
<drbrain> or whatever for emacs
<drbrain> or, `ack ^ruby_init`
<fragrant> drbrain: What is crags?
<drbrain> oops, ctags
<fragrant> drbrain: That won't be a good solution to find out function from one file to another, how do you debug code?
facefox has joined #ruby-lang
<fragrant> drbrain: And jumping from one function to another ,
<fragrant> drbrain: gdb??
<drbrain> ctags
<drbrain> seriously
<drbrain> crags knows where all the functions, macros, structs, methods, classes, constants, etc are
<drbrain> ctags
<erikh> c rags
<drbrain> gdb knows this too, if you compile with debugging symbols (the default)
burns180_ has joined #ruby-lang
<drbrain> but debugging != reading the code and knowing where functions lives
<drbrain> I use ctags to jump between files in my editor… if you don't have ctags support in your editor, find one that does
<drbrain> that just builds for the current file, you don't need that script, vim has tags support built-in
<fragrant> drbrain: How would i jump to that function?
<fragrant> drbrain: I started that file with gvim.
<drbrain> :help tag
apeiros_ has joined #ruby-lang
<fragrant> CTRL+] = E433: No tags file
<fragrant> E426: tag not found: ruby_init
<drbrain> did you run ctags first?
<fragrant> No
<fragrant> How can i run it?
<drbrain> fragrant: try this script: http://paste.segment7.net/rp.html
thone_ has joined #ruby-lang
<fragrant> drbrain: From which directory?
<fragrant> drbrain: cd ~/ then that script?
<drbrain> fragrant: if you want to have tags for ruby's source code, which directory do you think you should be in?
<drbrain> fragrant: see also `man ctags`
<fragrant> cd ruby-1.9.3-p125 then that script, right?
<drbrain> yes
Sailias has joined #ruby-lang
<fragrant> /usr/bin/ctags: unrecognized option '--languages=Ruby,Lisp,YACC,C,C++'
<fragrant> Try `/usr/bin/ctags --help' for a complete list of options.
<iande> fragrant: are you on OS X?
<fragrant> linux
<drbrain> odd, you probably don't have exuberant ctags installed
<iande> okay, yeah, same issue drbrain said
<fragrant> ctags --help = http://pastebin.com/9X3WK3iU
<drbrain> that's etags, not ctags ☹
<drbrain> line 120
<fragrant> Ye
<fragrant> Now i installed , apt-get install ctags
<fragrant> Done,
<fragrant> drbrain: Cool
andkerosine has joined #ruby-lang
igaiga has joined #ruby-lang
<fragrant> drbrain: I think, i should start debugging to understand code, only reading would not do the job
<fragrant> There are 81 .c files there, aren't that the interpreter?
<drbrain> ruby uses a VM, not an interpreter
<drbrain> see vm*
cdnz has joined #ruby-lang
<andkerosine> ocra executes my gtk2-based application and then stops.
<andkerosine> If I run ocra on a file that just contains require 'gtk2', it works fine.
<andkerosine> How to tell ocra to keep going?
burns180 has joined #ruby-lang
<fragrant> drbrain: Should i start from C code or from ruby codes inside folders?
<fragrant> drbrain: How do you debug ruby code or c code?
<drbrain> the only time I debug C code is when I'm writing C code or segfault
<drbrain> usually it's ruby code that is the problem
<fragrant> drbrain: Which folder should i start from?
<fragrant> drbrain: How to debug/understand those ruby code?
<fragrant> drbrain: I mean the ruby code flow, how it works
fragrant has quit [#ruby-lang]
chimkan has joined #ruby-lang
machine1 has joined #ruby-lang
burns180_ has joined #ruby-lang
wallerdev has joined #ruby-lang
towski has joined #ruby-lang
machine1 has joined #ruby-lang
towski has joined #ruby-lang
shtirlic_ has joined #ruby-lang
rue has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
dv310p3r has joined #ruby-lang
burns180 has joined #ruby-lang
Sailias has joined #ruby-lang
postmodern has joined #ruby-lang
bglusman has joined #ruby-lang
<andkerosine> def hex_diff(a, b)
<andkerosine> (0...a.size).map { |i| (a[i].to_i(16) - b[i].to_i(16)).abs }.reduce(:+)
<andkerosine> end
<andkerosine> Is this the optimal way to determine the similarity of two colors?
<Banistergalaxy> andkerosine: why not use pythagoras
<andkerosine> Does that work in the RGB colorspace?
<Banistergalaxy> Why wouldn't it, theyre just spatial points
<andkerosine> Mm-hmm.
<shevy> yay!
<andshevy> the andies are back in town!
<andshevy> andrewvos dance with me baby!
<andandkerosine> Too much?
andandkerosine has quit [#ruby-lang]
Sailias has joined #ruby-lang
<andshevy> yeah switch back man
gregf has joined #ruby-lang
Tukeke has joined #ruby-lang
igaiga has joined #ruby-lang
lifestream has joined #ruby-lang
burns180_ has joined #ruby-lang
gix has joined #ruby-lang
fayimora has joined #ruby-lang
mikeric has joined #ruby-lang
curtism has joined #ruby-lang
curtism has joined #ruby-lang
achiu1 has joined #ruby-lang
gix has joined #ruby-lang
bglusman has joined #ruby-lang
MouseTheLuckyDog has joined #ruby-lang
burns180 has joined #ruby-lang
banister_ has joined #ruby-lang
gix has joined #ruby-lang
wallerdev has joined #ruby-lang
heppy has joined #ruby-lang
<MouseTheLuckyDog> I have a question about rspec. How can I simplify something like this? http://pastie.org/3568206
<banister_> MouseTheLuckyDog: %w[aaa bbb ccc].each { |v| it "should blah #{v}" do; arg = v.dup; foo!(arg); arg.should == v[0]; end; }
chimkan_ has joined #ruby-lang
dr0id has joined #ruby-lang
burns180_ has joined #ruby-lang
<MouseTheLuckyDog> banister_, is each of those counted as a seperate test?
<banister_> MouseTheLuckyDog: yeah
<MouseTheLuckyDog> banister_, what about http://pastie.org/3568296?
WillMarshall has joined #ruby-lang
<banister_> MouseTheLuckyDog: i thought that was the code we were refactoring?
Joeysomo has joined #ruby-lang
Nisstyre has joined #ruby-lang
<MouseTheLuckyDog> banister_, Tlo ber honest I have serious questions that you actually know what you are talking about. So I'll wait for someone else to answer.
igaiga has joined #ruby-lang
<banister_> MouseTheLuckyDog: why dont you just try it? :)
<banister_> MouseTheLuckyDog: it's not particularly difficult to try something out to verify if it works rather than just sitting her speculating
ilyam has joined #ruby-lang
<MouseTheLuckyDog> You do realise that this is rspec code right. Whether or not it "works" is irrelevant.
<MouseTheLuckyDog> In fact it shouldn't work at first.
<banister_> MouseTheLuckyDog: you seem to think 'rspec' code is different to normal ruby code. It's just ruby, what i typed out is metaprogramming to generate 'it' blocks - it's *exactly* the same as if you'd typed out those blocks separately.
<banister_> MouseTheLuckyDog: if you dont undersatnd that then you're clearly not as good at ruby as you think you are, and you can drop your arrogant condescending attitude. It doesn't befit a noob.
<theconartist> hehe
max_dev has joined #ruby-lang
<drbrain> MouseTheLuckyDog: banister_ is right, but I guess he's not going to want to help you anymore
ankurgel has joined #ruby-lang
tomb has joined #ruby-lang
robbyoconnor has joined #ruby-lang
rue has joined #ruby-lang
<erikh> where's guy ferrari when you need him
<andshevy> all that testing
r0bby has joined #ruby-lang
Sailias has joined #ruby-lang
<MouseTheLuckyDog> drbrain, frankly I don't care if he wants to help me anymore. If this is the kind of help I get-- the only solution that would be more brain dead would be %w[aaa bbb ccc].each { |v| it "should blah #{v}" do; arg = v.dup; foo!(arg); arg.should == foo!(arg); end; }
<erikh> I CAN GIVE YOU QUALITY HELP
<cout> MouseTheLuckyDog: I don't want to help you either.
<MouseTheLuckyDog> Which works too. Which was probably his dumbest comment.
<cout> MouseTheLuckyDog: you're being an ass.
<erikh> WEAR A RAINCOAT
<erikh> WASH BEHIND YOUR EARS
<drbrain> MouseTheLuckyDog: I don't see what's wrong with that, other than that newlines were removed
<erikh> don't forget to use a towel
<MouseTheLuckyDog> drbrain, ambiguous pronoun-- what's wrong with what? banisster_'s solution oir mine?
<erikh> love your neighbor, but don't love them too much
<erikh> that could land you in the slammer
<drbrain> MouseTheLuckyDog: either
looopy has joined #ruby-lang
<MouseTheLuckyDog> Well mine cannot fail. Any test that cannot fail is totally worthless.
<drbrain> MouseTheLuckyDog: responding to a solution with such negativity is a sure sign of being an ass
<drbrain> instead of just "your test cannot fail"
<erikh> hey now, he just needs help
<erikh> from ME
<shevy> remove all tests
<erikh> I'm a better mother than all of you
<shevy> just because you are old?!?!
* shevy hides
<erikh> shevy: lol
<banister_> MouseTheLuckyDog: what was braindead about it btw?
<erikh> I just really want a happy ending for this guy that's never been in here before and demands help that meets his high standards
<shevy> well
<shevy> perhaps rspec doesn't make him happy
m0nki3 has joined #ruby-lang
<erikh> rspec makes the baby jesus cry
lchi has joined #ruby-lang
rippa has joined #ruby-lang
<MouseTheLuckyDog> banister_, the first thing is that when I look at your tests I wonder why you wrote foo! in the first place instead of just taking the 0 th element in the places I called foo.
burns180 has joined #ruby-lang
<MouseTheLuckyDog> It's like writing #define BEGIN { in C.
davpoind_ has joined #ruby-lang
<banister_> MouseTheLuckyDog: i was just copying your test, all i did was abstracted it out into a loop that generated the it blocks
<banister_> MouseTheLuckyDog: i assumed you were testing whether foo!(arg) mutated arg properly
<banister_> MouseTheLuckyDog: whch is what your first pastie seemed to imply -- that foo!(arg) mutated arg such that it's truncated to its first character
<banister_> MouseTheLuckyDog: but in either case, the details of the tests aside, what i was showing you was how to DRY up tests by using a loop to generate similar tests
<banister_> MouseTheLuckyDog: the dteails weren't so important (though the details of my implemetnation did match the details of your first pastie).
Slackwise has joined #ruby-lang
<MouseTheLuckyDog> banister_: That's the second thing. One of the biggest criteria for tests is clarity. Metaprogramming in rspec is fine in a sense, but the way you do it reduces clarity.
<MouseTheLuckyDog> Also clarity is more important then DRY in tests.
<banister_> MouseTheLuckyDog: that's up to you and your own criteria; when i was generating around 30 tests that were very similar but different i used a metaprogramming approach, and that was fine for me.
<banister_> MouseTheLuckyDog: if it's not fine for you then you can say that, rather than acting like a spoiled child
<erikh> hey hey guys
<erikh> I AM TOTALLY NOT GETTING ENOUGH ATTENTION HERE
<dominikh> erikh: because you're unloved.
<erikh> dominikh: i know :(
uniqanomaly has joined #ruby-lang
achiu1 has joined #ruby-lang
<MouseTheLuckyDog> You further assumed that the way I wanted to mutate foos argument was to replace it by it's first element, which is more of an artifact of the example I showed then the actual structure of foo!.
<banister_> MouseTheLuckyDog: again, that's just details! i assumed that was what you were testing, big deal!
<MouseTheLuckyDog> Which you would have realised immediately iof you looked at the second example I posted.
<banister_> christ you're a bore
<banister_> forget it
<theconartist> your name is too long
<dominikh> banister_: you should be ashamed, not helping him properly.
<MouseTheLuckyDog> theconartist, get a irc client that allows tab completion of names. or if you want you can just call me Mouse.
dhruvasagar has joined #ruby-lang
gnufied has joined #ruby-lang
<theconartist> why not change your name to _dog
<theconartist> _why not*
burns180_ has joined #ruby-lang
<MouseTheLuckyDog> theconartist, My name is a collection of allusions, to change it would be to change it's meaning.
ryez has joined #ruby-lang
seanstickle has joined #ruby-lang
burns180_ has joined #ruby-lang
igaiga has joined #ruby-lang
<Boohbah> MouseTheLuckyDog: are you the author of why's poignant guide?
TheMoonMaster has joined #ruby-lang
<MouseTheLuckyDog> Boohbah: No.
<MouseTheLuckyDog> Though that is one of the allusion's.
burns180_ has joined #ruby-lang
brownies has joined #ruby-lang
looopy has joined #ruby-lang
gix has joined #ruby-lang
looopy_ has joined #ruby-lang
Sailias has joined #ruby-lang
JohnBat26 has joined #ruby-lang
x0F_ has joined #ruby-lang
burns180 has joined #ruby-lang
Banistertab has joined #ruby-lang
rohit has joined #ruby-lang
lchi has joined #ruby-lang
WillMars_ has joined #ruby-lang
cdnz has joined #ruby-lang
rue has joined #ruby-lang
A124 has joined #ruby-lang
r0bby has joined #ruby-lang
burns180_ has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
brownies has joined #ruby-lang
ankurgel has joined #ruby-lang
ankurgel has quit [#ruby-lang]
burns180 has joined #ruby-lang
cdnz has joined #ruby-lang
lchi has joined #ruby-lang
ylluminate has joined #ruby-lang
heppy has joined #ruby-lang
burns180_ has joined #ruby-lang
pemeon has joined #ruby-lang
tonesfrommars has joined #ruby-lang
JohnBat26 has joined #ruby-lang
manojhans has joined #ruby-lang
burns180 has joined #ruby-lang
cdnz has joined #ruby-lang
lsegal has joined #ruby-lang
Nss has joined #ruby-lang
Guest68355 has joined #ruby-lang
ankurgel has joined #ruby-lang
macmartine has joined #ruby-lang
sandbags has joined #ruby-lang
burns180_ has joined #ruby-lang
uniqanomaly has joined #ruby-lang
<erikh> this might be fun to learn FFI on: http://augeas.net/index.html
<erikh> this looks fun too: http://augeas.net/libfa/operations.html
PhilCK has joined #ruby-lang
LanceHaig has joined #ruby-lang
adambeynon has joined #ruby-lang
burns180 has joined #ruby-lang
tekin has joined #ruby-lang
dr0id has joined #ruby-lang
burns180_ has joined #ruby-lang
burns180_ has joined #ruby-lang
gianlucadv has joined #ruby-lang
apeiros_ has joined #ruby-lang
igaiga_ has joined #ruby-lang
Avanine has joined #ruby-lang
heftig has joined #ruby-lang
rushed has joined #ruby-lang
sandbags has joined #ruby-lang
xiefai has joined #ruby-lang
<xiefai> response = gets.chomp; if response == method; {method}; end
<xiefai> is there something like this?
<xiefai> to run the method when the method name is typed?
burns180 has joined #ruby-lang
lifestream has joined #ruby-lang
xiefai has joined #ruby-lang
toretore has joined #ruby-lang
xiefai has joined #ruby-lang
benanne has joined #ruby-lang
burns180_ has joined #ruby-lang
vesan has joined #ruby-lang
gray has joined #ruby-lang
<bnagy> eval
<bnagy> ps: you're mad
xiefai has joined #ruby-lang
<gray> shevy: hi! i solve task, but i still don't understand recursion :\
<gray> shevy: now program shows thousands and millions
<rippa> bnagy: also send
<bnagy> yes
<rippa> gray: recursion is very easy ...
<rippa> ... to exhaust stack with
<gray> rippa: i think my brain not able to write code...
<gray> rippa: because all says it' very easy but i don't understand.
<rippa> 8703
<rippa> SystemStackError: stack level too deep
<rippa> hm, not bad
<rippa> 8703 levels deep
<gray> 8703?
lifestream has quit ["Bye Bye!"]
<gray> so, i think, i need a tutor. may be i can find someone here?
xiefai has joined #ruby-lang
<gray> and how much it will cost. approx?
<xiefai> is there a {#method} to display a method after gets.chomp
<rippa> xiefai: send
manoj has joined #ruby-lang
<bnagy> gray: start with fibonacci or something
<bnagy> it's the canonical recursion hello world :>
burns180 has joined #ruby-lang
xiefai has joined #ruby-lang
<rippa> or factorial
<bnagy> the trick is working out the condition that starts popping the stack
<bnagy> but I'm mostly with rippa - I try and avoid pure recursion with ruby
ezkl has joined #ruby-lang
xiefai has joined #ruby-lang
carlosed has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
<gray> so, i can write but i feel like i don't understand...
xiefai has joined #ruby-lang
frangiz has joined #ruby-lang
heftig_ has joined #ruby-lang
xiefai has joined #ruby-lang
WillMarshall has joined #ruby-lang
<gray> i don't understand WHEN recursive function returns value. Because if function call self, self, self. If returns value each time when call self? or after last call?
<apeiros_> gray: you'll have a condition at which point you don't recurse
jxie has joined #ruby-lang
<gray> apeiros_: don't understand.
<gray> apeiros_: you talk about code? http://pastie.org/3569752 ?
<apeiros_> gray: the code you have, use a little bit smaller n (maybe 3, or 5)
<apeiros_> then add a couple of puts to it
<apeiros_> like puts "before recurring, with n=#{n}"
<apeiros_> same for after
<apeiros_> then run it again
xiefai has joined #ruby-lang
<ddfreyne> gray: take a piece of paper and write the call graph for a small n
<bnagy> (do fibonacci or factorial, like we said)
lsegal has joined #ruby-lang
xiefai has joined #ruby-lang
burns180 has joined #ruby-lang
xiefai has joined #ruby-lang
<matled> I try to generate the content of a gz file but Zlib::GzipWriter#close seems to close the io it writes to too, which is a StringIO in my case and therefore loses all its content...
xiefai has joined #ruby-lang
<matled> test.rb:9:in `seek': closed stream (IOError)
Banistergalaxy has joined #ruby-lang
<matled> at least with def output.close; end I can work around this... but why does GzipWrite choose to close MY io object.
ankurgel has joined #ruby-lang
xiefai has joined #ruby-lang
<rippa> matled: just close it after you saved the data
<matled> rippa: GzipWriter#close writes the gzip footer
mssola has joined #ruby-lang
<rippa> matled: try #finish
xiefai has joined #ruby-lang
<matled> rippa: ah, thanks.
<rippa> it was in Zlib::GzipFile
<matled> yeah, I missed it. I was already wondering why there was no #close method listed in the documentation :)
xiefai has joined #ruby-lang
xiefai has joined #ruby-lang
WillMarshall has joined #ruby-lang
xiefai has joined #ruby-lang
burns180 has joined #ruby-lang
Joeysomo has joined #ruby-lang
xiefai has joined #ruby-lang
<gray> bnagy: i can't :(
<gray> i don't understand how find fibonacci in ruby
<bnagy> ok, well F(0) is 0 F(1) is 1 and the rest are F(n)=F(n-1) + F(n-2)
Elixor has joined #ruby-lang
<bnagy> it's naturally recursive, right?
<bnagy> def recursion_template( arg ); return arg if arg==1; recursion_template(arg-1); end
<bnagy> see how eventually it will stop recursing because of the boundary condition?
<bnagy> see if you can write def fibonacci( n ). It should be 2 lies.
<bnagy> *lines
<rippa> 1 line
<gray> i don't understand last message, my english bad too
<bnagy> no, it _should_ be 2, you can write it in 1 less clearly to show off
<gray> aaaaaa
<gray> fuck
<bnagy> ;)
<rippa> bnagy: but ternary is clear
<rippa> it's not even nested
<gray> sorry guys, programming it's not for me.
<gray> now I understand it clearly, thank you for your tyime
<bnagy> recursion just takes getting used to
<gray> I spent two days that used to understand the "simple" algorithm, but i don't undrestand. Also ruby it was interesting in the beginning. And now when i think that recursion is simply - i don't want think about hard things
<gray> also... or you all genius here. or am I completely stupid
<bnagy> well most of the people here have quite a bit of experience programming - every time you solve similar problems they get burnt a little deeper into your brain
<Elixor> Hello people, please, can somebody tell me how is possible sort Array where i have instantions of some Class and i need sort them by their some atribut? For examle age? Thanks for help - and sorry for my english :P
<kyrylo> What a sissy.
<bnagy> Elixor: read Array#sort_by
<Elixor> thanks i will try
wubino has joined #ruby-lang
manojhans has joined #ruby-lang
<Elixor> <bnagy> i tryed and nothing. I dont understand this command... :( ... so, please look at this http://pastebin.com/guwTTg6b - its coppy of my Array and i need sort it by price. Can you show me command for this ?
<apeiros_> yummyumm: .sort(&Unicode.method(:strcmp))
<bnagy> %w( cat monkey frog bat ).sort_by {|w| w.length} => ["cat", "bat", "frog", "monkey"]
<apeiros_> stupid ruby, y u no have collation?!?
manoj has joined #ruby-lang
* apeiros_ angry! *trollface*
<Elixor> <bnagy> i dont have array of strings... i have array of instantions.
<bnagy> sigh
<bnagy> stocks.sort_by {|stock| stock.price}
<apeiros_> Elixor: the common term is 'objects'
<apeiros_> or better yet, the class of the objects you have
<Elixor> objects and instantions of some class is same .. or not?
<Elixor> right .. sorry * i have array of objects. :-)
burns180 has joined #ruby-lang
<apeiros_> Elixor: well, unless your class is named Instantion…
m3nd3s has joined #ruby-lang
m3nd3s has joined #ruby-lang
<Elixor> <bnagy> its worked :-) thank you so much
canton7 has joined #ruby-lang
<bnagy> no problem
<shevy> you two marry up!
gray has joined #ruby-lang
burns180_ has joined #ruby-lang
shtirlic has joined #ruby-lang
<Defusal> Exception: Too many open files
uniqanomaly has joined #ruby-lang
<Defusal> after seeing IO.read and File.read used in many places, i assumed it was safe to use for reading and closing files
<Defusal> after seeing that exception, i have my doubts :(
<bnagy> it should be
<Defusal> i guess i must change all File.read(path) expressions back to open(path, &:read)
<apeiros_> I doubt File.read caused that
<Defusal> well what else could?
<apeiros_> you probably had File/IO.open and didn't close them
<apeiros_> or you're using a 3rd party lib which does that
<Defusal> apeiros_, i am not a rookie :/
<bnagy> IO.read ensures close
<Defusal> bnagy, that's what i assumed
<apeiros_> Defusal: that may well be, but there's only so and so many ways to get that exception
<bnagy> are you threading massively or something?
<Defusal> the exception was on a File.read line
<apeiros_> you can use lsof to check what is open
<Defusal> bnagy, single threaded huge EM-based platform
burgestrand has joined #ruby-lang
<apeiros_> note that all kinds of filehandles count against that limit (sockets too e.g.)
<Defusal> hmm
<apeiros_> EM… that'd make sockets a likely issue
<bnagy> yeah, check your rlimits
<Defusal> then that sounds likely
<apeiros_> you can tell your OS to increase the limits
<Defusal> as i increased the frequency tcp connections are opened today, strange that EM is not destorying them though
<Defusal> i wouldnt want to do that
<Defusal> that would only delay the issue
<bnagy> I'd ask the #eventmachine guys
<erikh> you probably have SO_LINGER set too high
<erikh> I run into this with 0mq stuff.
<erikh> alternatively, just bump the value with ulimit
<erikh> if it's your own thing, you can get away with it.
iande has joined #ruby-lang
<Defusal> erikh, how long do EM connections stick around before getting destroyed usually?
<erikh> dunno, that's what that socket option is for
<Defusal> i would assume they're never being destroyed if this is happening
<erikh> find out what they set it to if anything
<erikh> use lsof and find out
<Defusal> yeah i just filtered lsof
<Defusal> there are a ton of tcp connections being left open
<erikh> of course
<erikh> they have a predetermined timeout
<erikh> you're probably just hitting a barrier because you're allocating too many fd's before they get reaped and reused
<Defusal> yup
<erikh> in ruby, that means that ruby has to let go of them, the C extensions (if any) have to let go of them, and SO_LINGER has to say it's ready to move on
<Defusal> i was wondering why after a number of connections the server it is connecting to was not responding quick enough, perhaps this is why
<erikh> possible, there is a global high water mark too
<erikh> I never can remember what it is, always have to look it up. it's a sysctl tunable
<erikh> you really have to work hard to hit it.
<erikh> netstat -an will show pages of shit in TIME_WAIT f.e.
<erikh> this probably isn't that.
<erikh> err, sorry. the amount of descriptors available for tcp connections isn't tunable IIRC, but the amount of time a socket stays in wait is
<erikh> (and *that* is tunable via sysctl)
<Defusal> alright
<erikh> you could start there if EM doesn't expose SO_LINGER, though.
<erikh> anyhow, hope this all helps, I think I need to hit the hay
<Defusal> cool, thanks
<Defusal> i will dig and see what i find :)
<gray> C:/Users/lenovo/Desktop/ruby/drafts/hello matz.rb:2:in `gets': No such file or d
<gray> irectory - 4 (Errno::ENOENT)
<gray> from C:/Users/lenovo/Desktop/ruby/drafts/hello matz.rb:2
<gray> code: counter = gets
<gray> why gets don't works
<gray> hhhhhhh
Banistergalaxy has joined #ruby-lang
gray has joined #ruby-lang
<bnagy> works fine for me
burns180_ has joined #ruby-lang
Tukeke has joined #ruby-lang
Tukeke has quit [#ruby-lang]
jxie has joined #ruby-lang
virunga has joined #ruby-lang
tbuehlmann has joined #ruby-lang
<Defusal> gray
<Defusal> i think i have experienced that issue myself
<gray> Defusal: ?
<Defusal> its strange, as it started occuring in a script that always worked fine
<Defusal> my only workaround so far is to not pass anything to it via command line
<Defusal> and then have it gets the input after starting
<Defusal> sorry i can't tell you anything more, i have far more important things to work on, but if you figure out the cause let me know
<gray> Defusal: ok, thx
<imperator> so, it seems if you close the wrong fd, the ruby vm blows up in 1.9.3
<Defusal> it doesn't make much sense how ARGV can break gets, but since it used to work fine, im even more clueless as to the cause
<shevy> hmm
ankurgel has joined #ruby-lang
AlHafoudh has joined #ruby-lang
voker57 has joined #ruby-lang
burns180 has joined #ruby-lang
voker57 has joined #ruby-lang
burns180 has joined #ruby-lang
beiter_ has joined #ruby-lang
seanstickle has joined #ruby-lang
justinxreese has joined #ruby-lang
shtirlic has joined #ruby-lang
rue has joined #ruby-lang
rippa has joined #ruby-lang
zmack has joined #ruby-lang
burns180_ has joined #ruby-lang
kyrylo has joined #ruby-lang
ankurgel has joined #ruby-lang
cdnz has joined #ruby-lang
cdnz has joined #ruby-lang
leonL has joined #ruby-lang
shtirli__ has joined #ruby-lang
burgestrand has joined #ruby-lang
burns180 has joined #ruby-lang
Stalkr_ has joined #ruby-lang
heppy has joined #ruby-lang
yxhuvud has joined #ruby-lang
dous_ has joined #ruby-lang
burns180_ has joined #ruby-lang
ankurgel has joined #ruby-lang
krz has joined #ruby-lang
manojhans has joined #ruby-lang
burns180 has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
manojhans has joined #ruby-lang
manojhans has joined #ruby-lang
manojhans has joined #ruby-lang
reitelles has joined #ruby-lang
reitelles has quit [#ruby-lang]
reitelles has joined #ruby-lang
manojhans has joined #ruby-lang
<rue> Feebonakkee
manojhans has joined #ruby-lang
manojhans has joined #ruby-lang
heftig has joined #ruby-lang
Glauconite has joined #ruby-lang
Glauconite has joined #ruby-lang
<Glauconite> hello
<andrewvos> Feebonatshee
<imperator> greetings Glauconite
<Glauconite> Just starting my journey into Ruby so decided to install mIRC and hang out here throughout :-)
* imperator is unfamilar with that mineral, looks it up, yep it's real
<imperator> windows user, eh? :)
<imperator> anyway, welcome to Ruby!
<Glauconite> Indeed, no prior experience so linux isn't up my street! Thanks however! Startup culture really interests me and I've been told to start off with Ruby before progressing to RoR :-)
<andrewvos> Glauconite: What languages do you use?
* andrewvos guesses .net
* Stereokitsune jealous such people
<Glauconite> I'm fluent in noob++ ;)
<Stereokitsune> because I'm too sociopathic and cannot understand English well to be able to take conversations in internet
<imperator> Stereokitsune, i don't think sociopathic means what you think it means ;)
<Stereokitsune> it's possible, I'm not an expert :)
* Stereokitsune started learning ruby about two months ago
burns180_ has joined #ruby-lang
<Glauconite> How are you finding the learning curve? Do you have prior programming experience?
<Stereokitsune> I haven't an experience in "serious" programming, just wrining simple bash and perl scripts to automatize my workdays :) and written simple dynamic pages on PHP+MySQL, almost just for fun
<Glauconite> Cool, I hope you're enjoying it.
robbrit has joined #ruby-lang
<Stereokitsune> I don't know why I hadn't tried ruby previously, but after understanding its syntax and attempts to write simple scripts I've understood that it is a language I enjoy writing on :)
S1kx has joined #ruby-lang
S1kx has joined #ruby-lang
<Glauconite> I'm just starting to learn it however my main goal is to get fluent enough to be able to make use of it's principles with RoR :)
<Stereokitsune> I haven't tried to learn RoR yet
<Stereokitsune> And sometimes when I see a samples of code from RoR projects, I scare that I won't be able to overcome it :(
<Glauconite> I heard it is somewhat possible to learn RoR without knowledge of Ruby though to me that seems a little difficult, I'd much prefer to learn the language to a certain extent that a framework is based upon. I really hope I pick both up within time because I'd love to be pushing things out onto the web that other people can use :)
<andrewvos> Glauconite: Meh. Just start with sinatra
<andrewvos> Glauconite: IT's so easy
<robbrit> Glauconite: i learned RoR while learning Ruby, in some ways it makes it easier to learn Ruby because it's easier to define a goal
<robbrit> although this was a while back, Rails is a fair bit more complicated now
<shevy> I think it is crazy to want to learn a framework but not the language
<Glauconite> Note taken andewvos, thank you. I think I will keep going with Ruby for now, as I am literally just learning the basics. I'm too inexperienced you see to be able to differentiate learning x over y, so I took the advice of some web entrepreuners to learn Rails
<shevy> if anything, then it should be drag and drop, rather than actual code, if people don't want to learn the language
heppy has joined #ruby-lang
<Glauconite> Shevy, I have no experience in programming. I want to develop for the web, if learning Ruby helps me learn Rails then what is the problem with that? Critisim appreciated :)
<shevy> the web is not homogeneous
<robbrit> ah, if you have no experience programming then yes, learn Ruby first ;)
<shevy> I dont think you can get far without knowing html css and at least understand what javascript is used for
<shevy> then you put in rails into it, suddenly you need to know some basics of ruby, you need to understand databases too quickly enough and the intricacies of rails
<lianj> some http
<shevy> AND FLASH!!!
<lianj> nah
<matled> lianj: ack :)
<Glauconite> html/css covered, I could go the traditional route and learn PHP however Rails is the advice I have been given. Thanks Robrit!
<andrewvos> No we don't need another php developer
<manveru> do we really need more rails folks?
<andrewvos> N
<andrewvos> o
<darix> manveru: yes please.
macmartine has joined #ruby-lang
burns180 has joined #ruby-lang
<bougyman> i couldn't believe all 4 devs at my new job thought Rails was a programming language.
<bougyman> as did the project manager.
<robbrit> did they also think AJAX was a language?
<bougyman> probably
<bougyman> they're seeing magic in nosql now, i predict a year of disaster.
xiefai has joined #ruby-lang
xiefai has joined #ruby-lang
dejongge has joined #ruby-lang
xiefai has joined #ruby-lang
canton7 has joined #ruby-lang
publicvoid__ has joined #ruby-lang
xiefai has joined #ruby-lang
hangingclowns has joined #ruby-lang
<hangingclowns> i'm looking for a way to dry up some ruby code
<hangingclowns> wanted to do some conversion
<hangingclowns> 5.dollars.in(:euros)
<hangingclowns> an example would be the above
<hangingclowns> i know hot to define the method, but not sure how to do the in part
xiefai has joined #ruby-lang
<Mon_Ouie> class Money; def in(currency); Money.new(@value * conversion_rate, currency); end; end
xiefai has joined #ruby-lang
<hangingclowns> i'm modifying numeric, though
<hangingclowns> and need to be able to get a syntax like that
<hangingclowns> idea is something like that
<hangingclowns> with method_missing
<hangingclowns> i understand how method missing works, but how to chain it together wtih the in method?
<hangingclowns> this way a bit confuses me
<hangingclowns> probably will have to use a @current_currency instance variable to keep track
<hangingclowns> makes sense to me i think
xiefai has joined #ruby-lang
<Mon_Ouie> Don't do anything like that
<Mon_Ouie> Even defining euro, yen, etc. on Numerics sounds bad to me
<Mon_Ouie> At least define only those you need, don't define method_missing there
<Mon_Ouie> And just make them return an instance of Money like Money.new(self, currency)
<andrewvos> Tired of programmers bitching about gender equality in programming. You know there are people getting raped and murdered around the world right now (not programming related)?.
<andrewvos> /rant over
looopy has joined #ruby-lang
xiefai has joined #ruby-lang
burns180_ has joined #ruby-lang
io_syl has joined #ruby-lang
<hangingclowns> no
<hangingclowns> it's what i need to do for homework
<hangingclowns> he's going to run some rspec tests against it
<hangingclowns> kind of SOL
<andrewvos> rippa: What?
xiefai has joined #ruby-lang
xiefai has joined #ruby-lang
Sailias has joined #ruby-lang
reitelles has quit [#ruby-lang]
<Mon_Ouie> hangingclowns: I'm not talking about changing the syntax
<Mon_Ouie> Just about using a Money class instead of defining it all on Numeric
<Mon_Ouie> (although I do think enforcing monkey patching is a bad idea…)
xiefai has joined #ruby-lang
<hangingclowns> yeah, but he wants us to work with open classes
<hangingclowns> that's what the point of this assignment is
<hangingclowns> i think I've got a pretty good base
<hangingclowns> he gave us conversion rates from currencies to dollars
<hangingclowns> but if I get a conversion from euro to rupees, how can I work between that?
<Mon_Ouie> You only need to define methods like euro and yen on Numerics
<hangingclowns> I would not to convert the euro into dollars, then divide by the rupees exchagne rate
<hangingclowns> okay, i think i know now
<hangingclowns> i think has works better
xiefai has joined #ruby-lang
InfiniteJest has joined #ruby-lang
xiefai has joined #ruby-lang
<hangingclowns> i think i got this
<hangingclowns> great
<hangingclowns> looks good
flak has joined #ruby-lang
looopy has joined #ruby-lang
rippa has joined #ruby-lang
xiefai has joined #ruby-lang
curtism has joined #ruby-lang
curtism has joined #ruby-lang
Luxx_ has joined #ruby-lang
Z33K|Lux has joined #ruby-lang
xiefai has joined #ruby-lang
adambeynon has joined #ruby-lang
xiefai has joined #ruby-lang
nofxx has joined #ruby-lang
xiefai has joined #ruby-lang
gray has joined #ruby-lang
<gray> hello, i am again about recursion. I understand how to write function that calls self and how to write exetion if for that function
<gray> that means i understand recursion? But i loser in math.
burns180 has joined #ruby-lang
justinxreese has joined #ruby-lang
<gray> i don't understand Fibonacci sequence
xiefai has joined #ruby-lang
<gray> also i solve all tasks from this chapter: http://pine.fm/LearnToProgram/?Chapter=08
<gray> could someone check?
achiu1 has joined #ruby-lang
dustacio_ has joined #ruby-lang
xiefai has joined #ruby-lang
xiefai has joined #ruby-lang
<shevy> gray fibonacci is easy
<shevy> gray simple fill in with numbers on paper. do this only once, your brain remembers it for the rest of its life
<gray> shevy: what should i write on paper?
<gray> 0
Sailias has joined #ruby-lang
<gray> 1; 1; 2; 3; 5; 8; 13; 21 ?
<gray> this?
<shevy> yeah
<shevy> well
<gray> shevy: yes, that simple
<shevy> good!
<shevy> the rest of math follows all that basic logic - bring things down to become simple
darkf has joined #ruby-lang
<shevy> gray when you write something like http://pastie.org/3572005
<shevy> always say what kind of problem there is, if there is one
<gray> shevy: don't understand last message
<gray> shevy: any problems with code?
<shevy> gray not that I can see
<shevy> which is why I am asking
<shevy> :)
xiefai has joined #ruby-lang
phlipper has joined #ruby-lang
<gray> shevy: well, my english very bad. If i correctly understand you. No problems in my code. And you ask what questions i have?
<shevy> nono
<shevy> I ask IF you have problems in that code
<shevy> :)
<rippa> I like writing fibonacci
<rippa> in different languages
<rippa> just wrote one
xiefai has joined #ruby-lang
<shevy> looks suspiciously like ruby
<rippa> because it is
<shevy> :)
cdnz has joined #ruby-lang
Karmaon has joined #ruby-lang
<rippa> that's insanely inefficient though
<shevy> seems fairly slow
<rippa> 20000 method calls for n=20
<rippa> recursive too
xiefai has joined #ruby-lang
<apeiros_> exponential
<apeiros_> at every level of recursion, you double the number of calls
xiefai has joined #ruby-lang
<rippa> This Fibonacci algorithm is a particularly poor example of recursion, because each time the function is executed on a number greater than one, it makes two function calls to itself, leading to an exponential number of calls (and thus exponential time complexity) in total.
<rippa> exactly
<rippa> factorial is better example
<rippa> lol
<rippa> in the wiki
<rippa> "Implemented in the Java or the C# programming language:"
<rippa> and a block of code
<rippa> it works in both
<rippa> apparently
xiefai has joined #ruby-lang
seacreature has joined #ruby-lang
xiefai has joined #ruby-lang
xiefai has joined #ruby-lang
retro-in-better- has joined #ruby-lang
<muzone> Ruby Piano starts with the Famous Yamaha C7 sound, Appearing on famous concert stages, international competitions and prestigious music events throughout the world.
<muzone> heheh
burns180 has joined #ruby-lang
seacreature has quit [#ruby-lang]
xiefai has joined #ruby-lang
looopy has joined #ruby-lang
tekin has joined #ruby-lang
deryldoucette has joined #ruby-lang
<rue> rippa: I'd probably go with a more iterative-looking version
xiefai has joined #ruby-lang
<rue> rippa: Also, off by one
Tearan has joined #ruby-lang
<rippa> oh damn
<rippa> lol
ewproctor has joined #ruby-lang
pxjorge has joined #ruby-lang
<rue> Quickly + ugly def fibimpl(n, minusone, remaining); return n if remaining <= 0; if n == 0; fibimpl(1, 0, remaining - 1); else; fibimpl(n + minusone, n, remaining - 1); end; end
<rue> Eugh, that's even uglier in writing
<Stereokitsune> you were perl developer before, aren't you :)?
<shevy> well
<shevy> this looks a lot better than your typical perl code
xiefai has joined #ruby-lang
dejongge has joined #ruby-lang
<shevy> just all the line noise from the $ alone
hahuang65 has joined #ruby-lang
<Stereokitsune> perl code for the same solution may look just a little more weird
xiefai has joined #ruby-lang
hahuang65 has joined #ruby-lang
<shevy> probably twice as long and eight times as ugly
hahuang65 has joined #ruby-lang
xiefai has joined #ruby-lang
<Stereokitsune> I wonder
<gray> shevy: so, from today i start learn ruby full time
<gray> shevy: no job, no girls, no sex)))) only ruby fuck...
<shevy> gray well you need to "think" in ruby
<Stereokitsune> I want it too, but if I cannot leave my job :(
<shevy> or a pseudo-code intermediate
<gray> shevy: after that book http://pine.fm/LearnToProgram/?Chapter=11 what i should do?
<shevy> two things
gsav has joined #ruby-lang
<Stereokitsune> this is the only way to get the costs to pay for my flat and food
<shevy> (1) write small scripts
<shevy> (2) start on a medium project that includes more scripts into that project
<shevy> Stereokitsune a perl job?
<Stereokitsune> no, I'm just demiindian technical support
<shevy> ah
<Stereokitsune> but I want to change my occupation to RoR developer
<rue> Demi-indian?
<Stereokitsune> possible, I've used the wrong word
<Stereokitsune> unfortunately, English isn't my native language, and I was too lazy to learn it to talk in it free
<gray> shevy: think in ruby? could you "show" example? :)
<gray> shevy: could you give me a tasks?
jacktrick has joined #ruby-lang
sysbeast has joined #ruby-lang
burns180_ has joined #ruby-lang
<gray> shevy: m?
pemeon has joined #ruby-lang
<erikh> man I am so tempted to sing a song from the movie "clerks" right now
<shevy> gray no that is a bad idea
<shevy> gray just write a todo list with things you want to write
<shevy> alternatively look at github for projects that have no maintainer... or just find anything that interests you
<shevy> Stereokitsune global English is very fault tolerant :)
<deryldoucette> if you do thins that don't interest you you'll end up just dropping it on the floor. shevy is trying to lead you ina direction that will keep your interest alive.
<deryldoucette> good plan
<Stereokitsune> shevy: I know but I have no other way to move up :)
<deryldoucette> gray: start with little things that you need in say your own environment. what do you do on your computer that automating might help you. think of how you'd do that in ruby. then try your hand at it
<deryldoucette> gray: try installing mysql, postgresql, and sqlite3 on your machine. install ruby 1.9.3. think of something like what shevy mentioned. a TODO list. write it without backing it with a database, then make it use a database on the backend to store the list(s).
<Stereokitsune> is it good to rewrite existing scripts/projects in ruby? just to increase my own level
gray has joined #ruby-lang
<deryldoucette> that way you learn A) how to write ruby, B) how to interact with a user, C) how to write the app itself, and then D) how to interact with databases (when you add the db support)
* Stereokitsune want to move all sinatra's documentation to his head
<deryldoucette> then go back over it all and think of ways you think it could be done better
DMKE has joined #ruby-lang
wallerdev has joined #ruby-lang
<deryldoucette> Stereokitsune: yes if your goal is to increase your ruby knowledge. and maybe that bash based set of scripts that does BLAH works better and can be extended easier with ruby
<deryldoucette> only one way to find out :) try
<Stereokitsune> thanks, I'll do :)
<Stereokitsune> that's bad that I'm worst free-lancer :( I think I'll need more "professional" development experience further
<deryldoucette> Stereokitsune: and don't let anyone tell you this or that is worthless to do. I have a crapload of projects that I did JUSt to see if I could. NO ONE else will EVER see or use them. and thats fine.
<deryldoucette> just do stuff that interests you and keep focused that you're doing this to improve YOU
<deryldoucette> thats all that counts
<shevy> Stereokitsune well that is hard to answer
<shevy> usually I hate other people's code
<Stereokitsune> I need more methods to improve my self-conception, yes :)
<deryldoucette> Stereokitsune: just keep in mind, you WILL fall flat on your face. multiple times. then you'll get better. part of the process. no one WANTS to go through it, but thats how we learn. its OK to fail as long as you take the time to figure out HOW you failed.
lifestream has joined #ruby-lang
<shevy> but I liked ruby-fpdf bindings, and I can't stand prawn (things tend to get bigger and bigger and depend on more and more other projects, which tend to break for me way too often), so one thing on my todo list is to maintain ruby-fpdf eventually (after I finished rewriting my main ruby project that is, which will still take some days)
<deryldoucette> anyways.. shower time. enjoy folks
<shevy> I dont think I could take over a project that does not interest me at all
<lianj> orly? :P
<deryldoucette> Stereokitsune: and talk to people. one reason i stay here in this channel. i ask stuff, even if they don't give me the answer they point me in the right direction. remember in your head, there is only you. we NEED outside feedback.
<deryldoucette> last thing i wanted to say. :)
<Stereokitsune> deryldoucette: thank you very much, you motivate me very good :)
<deryldoucette> good :)
<shevy> hehe
<shevy> deryldoucette, for some reason I always associate something to eat with your nick, something that tastes sweet
<deryldoucette> there's always assholes, sometimes I'm even one of them. just keep at it. no matter what
<deryldoucette> shevy: hehe
<deryldoucette> shevy: i *think* there is a pastry that is similar in the spelling. or a sweet cheese.
<shevy> yum
<deryldoucette> ok, done being a motivational speaker. i stink. time to fix that &
ankurgel has quit [#ruby-lang]
<A124> Anyone has in idea why Zlib::GzipWriter writes uncompressed stream for me instead of compressed?
m3nd3s has joined #ruby-lang
dfr|mac has joined #ruby-lang
<kyrylo> shevy, what are your projects?
burgestrand has joined #ruby-lang
ascarter has joined #ruby-lang
dejongge has joined #ruby-lang
dejongge has joined #ruby-lang
<shevy> kyrylo hmm the "build tools" project in ruby is my main one still (which I am rewriting right now), others are a ruby-like shell, a very primitive web framework, and a framework for pipes (parse and understand input like "*avi | filter huffyuff | cut 30-50 | save to /tmp")
dejongge has joined #ruby-lang
wallerdev has joined #ruby-lang
<shevy> kyrylo, for the last one have a look at http://avisynth.org/mediawiki/Getting_started - I loved avisynth when I was on windows
dejongge1 has joined #ruby-lang
burns180 has joined #ruby-lang
<Stereokitsune> sometimes I don't have enough avisynth on linux
<shevy> you used avisynth Stereokitsune ?
<shevy> I'd like to have all sorts of audio and video processing be done entirely scriptable
<Stereokitsune> yes, I did; up to writing simple automatizators on Windows batches :)
<shevy> even without something like virtualdub or avidemux
<shevy> cool
lifestream has joined #ruby-lang
gix has joined #ruby-lang
srbaker has joined #ruby-lang
tomzx has joined #ruby-lang
<kyrylo> shevy, are you an AviSynth contributor or what?
justinmcp has joined #ruby-lang
<rue> C)
igotnolegs has joined #ruby-lang
<muzone> At https://gist.github.com/1547595 - I need to add a separator (i.e. -----) between the diffs in git diff $old_commit HEAD -- $modified. Some dude told me: perl -pe 'print "----\n" if /^diff/ and $. > 1'
<muzone> What would the Ruby equivalent of that be?
<apeiros_> ruby -e '`perl -pe '\''print "----\n" if /^diff/ and $. > 1'\''`'
* apeiros_ hides
<rue> You could try just s/perl/ruby/
<Mon_Ouie> ruby -pe 'puts "----" if /^diff/ && i_dont_know_what_dollar_dot_is'
<muzone> Another told me: awk 'NR>1 && /^diff/ {print "----"} {print}'
<muzone> apeiros_: hehe
<Stereokitsune> The dollar is just another regexp
<muzone> Mon_Ouie: thats hot
<Stereokitsune> Oh, nwm, I'm stupid.
<Mon_Ouie> $<.lineno > 1, maybe
<muzone> Mon_Ouie: is there a prettier way perhaps?
<muzone> fuck it ill just use awk
<muzone> hehe
<shevy> kyrylo nope, I gave up on avisynth. they wanted to write avisynth 3, it died though.
<muzone> i mean it looks decent so..
<Mon_Ouie> "pretty" and "one-liner script" usually aren't very compatible
vmatiyko has joined #ruby-lang
burns180_ has joined #ruby-lang
<muzone> Mon_Ouie: heheh
<muzone> so true man
WillMarshall has joined #ruby-lang
<shevy> muzone ewwwwww awk
<muzone> hehe
<muzone> well i always say using ruby for shell operations is like taking a supersonic jet to visit your next-door neighbor
<muzone> hehe
<erikh> using ruby instead of shell script can be really nice when you're doing portable things.
<erikh> and considering most shells are faster than ruby, you might want to work on your analogy.
Karmaon has joined #ruby-lang
<muzone> hehe
<muzone> i just got a big mouth
<muzone> and an insane, burning passion for both zsh and ruby
<erikh> that's gonorrhea
<muzone> lol
t has joined #ruby-lang
<muzone> so ruby -pe 'puts "\n" + "----" if /^diff/ && $<.lineno > 1
<muzone> something like that?
<muzone> i mean
<Mon_Ouie> You can just do "\n----"
looopy has joined #ruby-lang
<muzone> ruby -pe 'puts "\n" + "###" if /^diff/ && $. > 1'
<muzone> Mon_Ouie: nice
<erikh> just puts with no arg will do that too
<erikh> and be line-ending friendly for platforms that-shall-not-be-named
<muzone> erikh: yeah that looks better too
<erikh> puts; puts "###" or w/e
<muzone> i dont like the way \n makes me feel
<muzone> got it
<erikh> anyhow, sorry to "well, actually" you.
<Mon_Ouie> Doesn't Ruby convert line-ending by default (i.e. unless the file is explicitly opened as binary)?
<muzone> thanks a lot guys!
<muzone> git diff $old_commit HEAD -- $modified | ruby -pe 'puts; puts "###" if /^diff/ && $. > 1' | less
Y_Ichiro has joined #ruby-lang
Y_Ichiro has joined #ruby-lang
<muzone> going for that then, no more awk
<Mon_Ouie> $. was the perl one
<Mon_Ouie> Or does it exist in Ruby too?
<drbrain> $. is in ruby
<muzone> cool
<drbrain> I think all the perl magic $ variable features are in ruby
<muzone> time to run this baby mama's mouth
<muzone> drbrain: is there a prettier way to do it maybe?
burns180 has joined #ruby-lang
<rue> muzone: Find out what $. does.
<muzone> well
<rue> (And/or any other parts that you don't know)
<drbrain> muzone: I don't know if there's a prettier way
<drbrain> maybe using ARGF
<muzone> ``Current line number for the last filehandle accessed.'' apaprently
<muzone> drbrain: interesting
<muzone> i like the sound of ARGF
<muzone> (reminds me of when i had an arabic girlfriend)
<erikh> drbrain: nah, but quite a few of them are.
<erikh> `perldoc perlvar` for the 800lb gorilla.
<muzone> for some reason though git diff $old_commit HEAD -- $modified | ruby -pe 'puts; puts "###" if /^diff/ && $. > 1' | less doublespaces everything
<drbrain> muzone: you add an an extra newline for every read line with "puts;"
<muzone> oh i see
<muzone> thats not good..
<erikh> what are you trying to do exactly?
<muzone> erikh: just to make it easier to browse all the diffs
<muzone> add some visual separators
<erikh> oh a colordiff tool or something?
<erikh> ah.
<erikh> well diff -u has that already, sort of.
<muzone> not familiar with colordif
<muzone> really?
<erikh> unified diff is what git outputs by default -- we may have a different idea of "readable"
<imperator> erikh, howdy
<muzone> git diff -u $old_commit HEAD -- $modified is all i need?
<erikh> imperator: yo
<erikh> muzone: no, `diff -u` is for the diff(1) tool.
<muzone> oh ok
<erikh> git diff outputs like `diff -u` already
<muzone> its just that there is no separation between the files
<muzone> so its very confusing to read
* imperator finds gitx handy for visualizing diffs
<muzone> imperator: strictly CLI over here bruh
WillMarshall has joined #ruby-lang
<muzone> drbrain: ruby -pe 'puts "\n###" if /^diff/ && $. > 1' then?
<imperator> muzone, why?
<muzone> and any suggestions on how to use ARGF instead of the $. thingie?
<muzone> imperator: hmm.. just for simplicity i guess
<muzone> imperator: id use githubs wonderful compare tool if i could
<muzone> but yeah i like this right here.. its nice
<muzone> i think its working!!
benanne has joined #ruby-lang
<drbrain> muzone: maybe: ARGF.each_line do |line| puts "\n###" if line =~ /^diff/ && ARGF.lineno > 1; puts line; end
<erikh> git diff | sed -e 's/^diff --git\(.*\)/^[[47;31mdiff --git\1^[[0m/'
<erikh> those ^[ need to be entered with ^V and then pressing escape
<erikh> \e might work for some versions of sed
<erikh> also git has a setting for color diffs
<erikh> color.diff
machine1 has joined #ruby-lang
<bougyman> vimdiff ftw
<bougyman> or ediff, if you prefer that os of an editor
<erikh> they're nice for merging but for just reading I prefer good ol' diff
igotnolegs has joined #ruby-lang
dejongge has joined #ruby-lang
<rue> Deeeefffff
<rue> Nerdcore company: Diff Jam?
vmatiyko has joined #ruby-lang
<muzone> hehe wow
<muzone> lots of options here
<muzone> thanks again yall
<muzone> i think im gonna go for the original one though, so here we go
nofxx has joined #ruby-lang
<muzone> Lo and behold, track_spree.sh: https://gist.github.com/1547595 and track_rails_skeleton.sh: https://gist.github.com/1547599 - I couldn't have done it without y'all! Beach party in Polynesia coming soon and you're all invited!
virunga has joined #ruby-lang
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
burns180_ has joined #ruby-lang
hagabaka has joined #ruby-lang
hagabaka has joined #ruby-lang
woollyams has joined #ruby-lang
volty has joined #ruby-lang
lsegal has joined #ruby-lang
nofxx has joined #ruby-lang
woollyams has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
volty has quit ["Konversation terminated!"]
NOKAH has joined #ruby-lang
burns180 has joined #ruby-lang
verto has joined #ruby-lang
petercooper has joined #ruby-lang
<erikh> oh, interesting
<erikh> so if Server_FQDN is missing, const_missing is fired
<erikh> and if server_FQDN is missing, method_missing is fired. do I understand that right?
<apeiros_> yes
<cout> more or less, yes
<apeiros_> you will also get method missing for Server_FQDN()
<erikh> right
<erikh> makes sense
<apeiros_> note that capitalized methods require an argument or parens
<erikh> just kind of threw me for a loop for a minute
<apeiros_> i.e., with capitalized identifiers, it's always unambiguous whether it's a method or a constant
<erikh> aye
<erikh> working on this silly thing that lets you exploit method missing with a dash of highline to ask questions during ERB template time
<erikh> it's a fugly hack but it's nice for generating scripts interactively, or so it appears to be at this point
igaiga has joined #ruby-lang
<imperator> cups update breaks printer on ubuntu...typical
looopy has joined #ruby-lang
<imperator> so much for using libreoffice
burns180_ has joined #ruby-lang
Stalkr_ has joined #ruby-lang
WillMarshall has joined #ruby-lang
chimkan has joined #ruby-lang
heppy has joined #ruby-lang
igotnolegs has joined #ruby-lang
lchi has joined #ruby-lang
looopy has joined #ruby-lang
<Defusal> never using Array.new([]) again in my life
<Defusal> err, Hash.new([])
<Defusal> it's been a very long day, and that just wasted quite a bit of my time
<lianj> :D
<Defusal> someone two different keys were resolving to the same values
<Defusal> changing it to a normal hash and using (hash[key] ||= []) << item solved it
<Defusal> s/someone/somehow
<Defusal> guess i can take a break now, seeing as its 1am
hangingclowns has joined #ruby-lang
<lianj> Defusal: its not somehow. its a feature in this case ;)
burns180 has joined #ruby-lang
<Defusal> i was under the assumption that it would make a new value of [] if there was no such key...
<Defusal> using that key, not some default key no matter what key is used
<RegEchse> Defusal: You know about Hash.new{|h,k| h[k]=[] } ?
<RegEchse> That would do what you described as your assumption.
<Defusal> RegEchse, i guess that is what i was thinking of, i've been using ruby too little over the last few months :(
<Defusal> thanks
<lianj> "If obj is specified, this single object will be used for all default values. If a block is specified, it will be called with the hash object and the key, and should return the default value. It is the block’s responsibility to store the value in the hash if required."
<RegEchse> no problem :)
<Defusal> i see
<RegEchse> and, Defusal: i once made this mistake myself. xD took me quite a while to figure it out. (long ago, but still in my memory -.-)
<Defusal> yeah, quite a pain
imperator has quit ["Leaving"]
apeiros_ has joined #ruby-lang
<Defusal> on well, my connection pool works great now and doesn't send data to random servers anymore :)
apeiros_ has joined #ruby-lang
<RegEchse> :D
hangingclowns has quit [#ruby-lang]
jacktrik has joined #ruby-lang
t_ has joined #ruby-lang
towski has joined #ruby-lang
postmodern has joined #ruby-lang
burns180_ has joined #ruby-lang
Jay_Levitt has joined #ruby-lang
shevy2 has joined #ruby-lang
WillMarshall has joined #ruby-lang
<WillMarshall> Hey! Is there any way I can do the following in Ruby?
<WillMarshall> my_class.object actually returns my_class.object.to_s
<WillMarshall> But I can also do my_class.object.some_other_method ?
havenn has joined #ruby-lang
vmatiyko has quit [#ruby-lang]
leonL has joined #ruby-lang