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
seanstickle has joined #ruby-lang
WillMarshall has joined #ruby-lang
mistym has joined #ruby-lang
asahi1 has joined #ruby-lang
ilyam has joined #ruby-lang
ericmuyser has joined #ruby-lang
bryancp has joined #ruby-lang
jmcphers has joined #ruby-lang
rdavila has joined #ruby-lang
dontbecold_ has joined #ruby-lang
m3nd3s has joined #ruby-lang
shevy has joined #ruby-lang
spuk has joined #ruby-lang
mistym has joined #ruby-lang
drumond19 has joined #ruby-lang
t has joined #ruby-lang
banister has joined #ruby-lang
replore has joined #ruby-lang
mattyoho has joined #ruby-lang
Z33K|Lux has joined #ruby-lang
<banister> sup peeps
<Asher> lions and tigers and banisters - oh my
bousquet has joined #ruby-lang
slimfit has joined #ruby-lang
urbanmonk has joined #ruby-lang
nif has joined #ruby-lang
asahi1 has quit [#ruby-lang]
fayimora has joined #ruby-lang
bryancp has joined #ruby-lang
rdavila has joined #ruby-lang
ilyam_ has joined #ruby-lang
srbaker has joined #ruby-lang
<banister> Asher: how are jou?
Zerkz has joined #ruby-lang
<crankharder> how do i dynamically define a method that has optional args, e.g., statically defined: def foo(bar=nil)
<banister> crankharder: do you know the name of the method before hand?
<banister> crankharder: or is the name determined dynamically?
<banister> crankharder: is the content of the metho dnkown beforehand too, or isthat determined at runtime as well?
<Zerkz> I'm reading in a binary file using Ruby (jruby, specfically), and I understand there is a external encoding setting that can be set at creation of a File object.... can this setting be changed later?
rdavila has joined #ruby-lang
neoesque has joined #ruby-lang
<bnagy> crankharder: it should just work, least in 1.9, what have you tried?
<bnagy> blocks take defaults in 1.9
<bnagy> Zerkz: if I am working with binary I use the 'b' flag on the File object and then a parser
<drbrain> Zerkz: you can use set_encoding to change it later
raph_io has joined #ruby-lang
<banister> drbrain: you might be interested in a ruby-aware 'ack' we have now (find-method) https://groups.google.com/forum/#!topic/pry-rb/L-kXX-T0OGY :P
<Zerkz> I see. Thanks. Any tips on what IDE to use when writing Ruby? I'm currently using the Eclipse plugin ( I'm a comp sci senior, coming from a java heavy background). It seems alot of the content assistance I was used to in java is non-existant in this environment, though :(
<bnagy> vim, and 'man the fsck up'
<drbrain> banister: groups.google.com always makes me sad
<drbrain> why do I have to sign in?
<drbrain> what is with the #! in the URL?
<drbrain> etc., etc.
<drbrain> oh, and now I'm not even on the link I originally clicked on after signing in
<banister> drbrain: ah no idea sorry, it was just set up today...i wouldn't have posted it on there either, but the guy decided to..sorry
<drbrain> banister: meh
surfprimal has joined #ruby-lang
<drbrain> banister: I just remember back when everyone used mailman and archives just worked
<bnagy> drbrain: and yet you don't remember usenet? ;)
<banister> drbrain: nm ill just show u a gist: https://gist.github.com/2417846
<drbrain> I remember usenet too, but after the AOL thing mailing lists became easier to use
<banister> drbrain: basically it can seearch through all methods in a namespace looking for code that you specify, and return the list of methods that contain that piece of code
<drbrain> that's different from the announcement
<drbrain> dang, that's nice
<bnagy> I quite like google groups, tbh - if it's low traffic then you can fold it into gmail and it kind of 'just works'
<banister> it can also do it based on a regex of method name rather than sourcecode content
<banister> but the code match is cooler
<banister> it's also searching through C code
elalande has joined #ruby-lang
gsav has joined #ruby-lang
havenn has joined #ruby-lang
<drbrain> I noticed
<ged> And the new groups interface is only a month or so old, and it's already improved quite a bit.
<ged> I like that you can aggregate a bunch of groups together like RSS feeds.
<banister> drbrain: show-source -a, can also show all monkeypatches for a class/module: https://gist.github.com/2405083 pretty cool too
publicvoid_ has joined #ruby-lang
<ged> I anticipate that alone is going to save me much hair-pulling.
<banister> ged: cool :)
<drbrain> ged: other than that I have to sign in every damn time
<drbrain> I am unsure what benefit I get from signing in every time I want to read an email
<bnagy> drbrain: it doesn't matter, because since you are using chrome and gmail and google docs you will already be signed in all the time, anyway
pabloh has joined #ruby-lang
jobicoppola has joined #ruby-lang
<ged> Yeah, I don't have to sign in every time. That sucks.
jarred has joined #ruby-lang
<drbrain> bnagy: but I'm not using chrome since chrome doesn't sync with my iPhone's reading list
<drbrain> oh, and I'm not using gmail either
felipe__ has joined #ruby-lang
<bnagy> that makes no sense! EVERYONE uses email!
<ged> gmail != email
Kero has joined #ruby-lang
<bnagy> see, if you were using gIRC you would have been able to see the sarcasm font
<bnagy> also, it automatically signs you in to google groups, so, win
<ged> I count font-stripping as a win. :P
<ged> Though admittedly I would love to see the sarcasm font.
<bnagy> there should be a support group for this
<bnagy> where you can go and explain the joke you just made, and they would be like 'no way bro, that's a super funny joke, that other guy's just a tard'
<bnagy> ... oh wait imgur
<ged> Oh, nice. Well serves me right for trying to be friendly.
<bnagy> ged: It's ok. I'm joking. Actually, I kind of was all along
<bnagy> I don't think you're a tard, that was just required for the setup and reveal for the joke
<bnagy> doesn't work otherwise
<ged> Heh. I GET IT. :P
<bnagy> ok, well I wasn't sure
<bnagy> thought you might be a republican or something
<bnagy> ... ok I should really get my coat before someone bans me.
rdavila has joined #ruby-lang
bglusman has joined #ruby-lang
Ethan has joined #ruby-lang
jasonw22 has joined #ruby-lang
rdavila has joined #ruby-lang
zmack has joined #ruby-lang
igotnolegs has joined #ruby-lang
FiXato|VPS has joined #ruby-lang
Kero has joined #ruby-lang
zmack has joined #ruby-lang
publicvoid_ has joined #ruby-lang
Joeysomo has joined #ruby-lang
kvirani has joined #ruby-lang
havenn has joined #ruby-lang
zmack has joined #ruby-lang
wilkie has joined #ruby-lang
ltd- has joined #ruby-lang
brianpWins has joined #ruby-lang
savage- has joined #ruby-lang
robgleeson|mba has joined #ruby-lang
robgleeson|mba has joined #ruby-lang
robgleeson|mba has joined #ruby-lang
robgleeson|mba has joined #ruby-lang
qpingu has joined #ruby-lang
havenn has joined #ruby-lang
hagabaka has joined #ruby-lang
ilyam has joined #ruby-lang
slimfit has joined #ruby-lang
countskm has joined #ruby-lang
msisk_ has joined #ruby-lang
cdnz has joined #ruby-lang
dr0id has joined #ruby-lang
jakko has joined #ruby-lang
rippa has joined #ruby-lang
rohit has joined #ruby-lang
tonesfrommars has joined #ruby-lang
jakko has joined #ruby-lang
jakko has joined #ruby-lang
jakko has joined #ruby-lang
rdavila has joined #ruby-lang
brushbox has joined #ruby-lang
fayimora has joined #ruby-lang
fukushima has joined #ruby-lang
jakko has joined #ruby-lang
babinho has joined #ruby-lang
andrewhl has joined #ruby-lang
<andrewhl> if I want to get all the permutations of an array, like [1,2,3], including 1,2, 2,1, 3, 1, as well as all 3 digit permutations, how can I do that?
<andrewhl> I mean, using .permutation
<shachaf> Use .permutation with each argument from 0 to [1,2,3].length
<andrewhl> is there a way to do that inline? like, using a proc or something? I'm currently doing: array.permutation(number.to_s.length), where number is passed in as the argument of a function
yxhuvud has joined #ruby-lang
<rippa> andrewhl: behold the monstrosity
<rippa> a=[1,2,3];a.each_with_index.inject([]){|m,(_,i)|m<<a.permutation(i+1).to_a}.flatten(1)
<andrewhl> oh, wow
<yxhuvud> I think I have to kill you now.
<andrewhl> no please don't! hah
<andrewhl> I tried this, it works: i = 1; while i <= array.length; array.permutation(i).to_a.map { |x| x.join.to_i }; i += 1; end
<bnagy> don't write loops like that in ruby :(
<andrewhl> oh no? how should I write it?
<bnagy> (1..array.length).each {|i|
<bnagy> but you asked for it as one line :> It's easy with each and an external varuiable to store the results
<andrewhl> true. I only asked because I'm a moron and am still learning:)
<andrewhl> but thank you rippa for obliging
<rippa> I'd write 1.upto(array.length)
<rippa> actually, my example is not in one line
<bnagy> yeah I dislike upto and it's my own personal problem
<bnagy> (1..a.size).inject([]) {|res,i| res << a.permutation(i).to_a}.flatten(1)
<andrewhl> what does flatten do?
<bnagy> I like that better, as golf
<bnagy> try it without and see :)
<andrewhl> Also, #reduce is synonymous with #inject, right?
<andrewhl> what does .reduce(0) do? I've seen it in a few places and it puzzles me
<burgestrand> andrewhl: yes, and .reduce(anything) sets anything to the initial value of the accumulator
<burgestrand> (the first parameter)
<andrewhl> ok
<burgestrand> andrewhl: http://19pad.charlie.bz/1080
<andrewhl> I see. Cool
<bnagy> (1..a.size).inject([]) {|r,i| a.permutation(i) {|p| r << p};r}
<bnagy> ha!
<rippa> (1..a.size).inject([]){|r,i|a.permutation(i){|p|r<<p};r} # 6 symbols shorter
<bnagy> dude removing spaces doesn't count :)
<rippa> counts in my book
<bnagy> XD
kitallis has joined #ruby-lang
<bnagy> (1..a.size).map{|i|a.permutation(i).to_a}.flatten(1)
_santana has joined #ruby-lang
dc5ala has joined #ruby-lang
flgr_ has joined #ruby-lang
havenn has joined #ruby-lang
ryanf has joined #ruby-lang
robgleeson|mbp has joined #ruby-lang
<robgleeson|mbp> rue: ping.
flgr_ has joined #ruby-lang
frangiz_ has joined #ruby-lang
x0F_ has joined #ruby-lang
frangiz has joined #ruby-lang
<bnagy> rippa: (1..a.size).map{|i|[*a.permutation(i)]}.flatten(1) I think I'm out of ideas
|Vargas| has joined #ruby-lang
|Vargas| has joined #ruby-lang
<bnagy> wait! a.map{|i|[*a.permutation(i)]}.flatten(1)
<rippa> cool
JohnBat26 has joined #ruby-lang
frangiz has joined #ruby-lang
<rippa> but only works for arrays of format [1,2,...n]
<bnagy> true
<bnagy> and if you add _each_index it's longer than 1..a.size again :(
<bnagy> ok I give up, I can't find a way to shorten that flatten
cdnz has joined #ruby-lang
flgr_ has joined #ruby-lang
solars has joined #ruby-lang
jakko has joined #ruby-lang
flgr_ has joined #ruby-lang
workmad3 has joined #ruby-lang
wardrop has joined #ruby-lang
<wardrop> For some reason, Ruby is applying daylight savings corrections to my Time's. My system timezone on Ubuntu is set to a region that doesn't have daylight savings. Can anyone offer a guess as to why Ruby may be incorrectly adjusting for daylight savings.
<Fullmoon> wardrop: Is this plain ruby, or are you using ActiveSupport::TimeZone?
<wardrop> I've tested in irb without loading any gems and the problem still exists.
<wardrop> My timezone on Ubuntu is set to Brisbane, Australia
<Fullmoon> wardrop: What do you expect and see? Do you mean the output of Time.local, or it's #to_s?
<wardrop> A date like 14/04/2012 produces sometihng like "14/04/2012 00:00:00 +1000", where as a date like 24/11/2012 produces "14/11/2012 00:00:00 +1100"
judofyr has joined #ruby-lang
<wardrop> I meant "24/11/2012 00:00:00 +1100" obviously
<wardrop> Fullmoon: just #to_s in this case
<Fullmoon> wardrop: So this is about date parsing? Maybe you could just post whatever it is you typed into IRB
<Fullmoon> wardrop: Also what is your TZ env variable set to? ENV['TZ']
<wardrop> No, it's not related to date parsing at all. Date's are passed correctly, it's just dates within a certain range of months are +1100 instead of +1000
<Fullmoon> wardrop: OK, what's your Time.now.zone?
<wardrop> ENV['TZ'] is nil
<wardrop> It's set to "EST"
MDmalLION has joined #ruby-lang
<Fullmoon> EST? Doesn't sound right, does it?
<Fullmoon> Should be AEST, right?
<MDmalLION> Child, Boy, Grol < Humans
<bnagy> darwin is not aest
<wardrop> That's an american timezone, yet my why is the offset of +1000 correct. It's like it's using the an Australia timezone offset, but is getting it's daylight saving rules from EAST
<MDmalLION> can u subclass many children at one tine
<wardrop> *EST
<bnagy> wardrop: just to double confirm, can you check Time.now.dst? and (Time.now + (3600 * 24 * 30 * 9)).dst?
<Fullmoon> That's very weird... cool
flgr_ has joined #ruby-lang
<Fullmoon> @wardrop Seems that way, yeah
<wardrop> Time.now.dst? #=> false
<wardrop> (Time.now + (3600 * 24 * 30 * 9)).dst? #=> false
<bnagy> oh crap that's a bad test sorry, it's southern hemisphere
<Fullmoon> @wardrop I assume the output of `date' in the shell includes the incorrect time zone shorthand (EST) as well?
<wardrop> Time.parse('27/11/1971').dst? #=> true
<wardrop> Time.parse('27/04/1971').dst? #=> false
<bnagy> buh
<wardrop> Fullmoon: correct, $ date produces "Thu Apr 19 17:00:38 EST 2012
<wardrop> "
<Fullmoon> @wardrop If you restart your IRB with `TZ=AEST irb' everything works es expected?
<Fullmoon> Hey wait a second, I have an idea, what is the output of Time.now.utc ? Maybe your time per se is incorrect, but corrected with the incorrect time zone
<wardrop> Fullmoon: Yep, TZ=AEST produces an offset of +0000 across all times of the year.
<wardrop> Time.now.utc #=> 2012-04-19 07:04:15 UTC
<wardrop> That's without TZ=AEST
<Fullmoon> wardrop: That's correct allright, yeah
<bnagy> EST has daylight savings in australia
<bnagy> darwin is cst
<Fullmoon> No sorry, I have no idea
<bnagy> sounds like a linux problem, no?
<wardrop> Oh well, at least Ruby seems to be behaving correctly. I'll need to find where in Ubuntu Ruby's getting EST
<bnagy> ubuntu is being a pain in the ass about a lot of locale stuff in general, for me
<Fullmoon> Maybe AEST is also the incorrect time zone identifier? It didn't work under OS X 10.7.3, but did under Ubuntu and Arch Linux for me..
<wardrop> Thanks for your help anyway guys.
<Fullmoon> @wardrop $ cat /etc/timezone
<wardrop> #=> Australia/Brisbane
<wardrop> I need to go somewhere now. Thanks for your help again guys.
<MDmalLION> WHERE
<bnagy> whoa...
<MDmalLION> class Child, Monster < Parent
<MDmalLION> is this posible?
<bnagy> sort of
<MDmalLION> wh===how do i need to phrase it
<bnagy> but only with anonymous classes afaik
retro|cz has joined #ruby-lang
<judofyr> MDmalLION: what are you trying to do?
<MDmalLION> im trying to make a program that will let u alzheimers.symp #=> symtoms
<MDmalLION> and parkinsons.etio => nigrostriatal da deppletion
<MDmalLION> and do this by first making class Disease
<bnagy> isn't alzheimers an instance of disease?
<bnagy> it is a lot easeir to code if you do it that way :)
<MDmalLION> it is an instance hmm
<bnagy> alzheimers=Disease.new %w( forgetfulness, shaking, forgetfulness )
kings has joined #ruby-lang
<bnagy> and have a single Disease class that handles the logic from there
<bnagy> if you want to get fancy you can check out some of the method_missing tricks you can do, but that stuff can also lead to really bad code
<bnagy> in general, you only subclass (or delegate) when you need to make an object that has all the methods of another object, but either extra ones or some that behave a bit differently
<Defusal> bleh
<Defusal> back to debugging this impossible issue :(
Fullmoon_ has joined #ruby-lang
tjadc has joined #ruby-lang
<bnagy> Defusal: I never have that problem anymore, got an awesome new technique
<Defusal> "that problem" :P
<Defusal> code that has worked fine for more than a month while i've been developing the project just decided to break 98% of the time now
<Defusal> i've checked the protocol, i've checked the data, the event order
<Defusal> i just don't get it :/
<Defusal> even tried updating eventmachine now
apeiros_ has joined #ruby-lang
<Defusal> basically, eventmachine seems to only be firing the recieve_data event when the websocket connection closes 98% of the time
<Defusal> so the data never arrives until after the browser has disconnected
<Defusal> so damn annoying :(
<bnagy> and what changed?
<Defusal> nothing...
<Defusal> i havn't touched the code in 48 hours
<Defusal> i was working on nothing else, but using this all the time
<Defusal> i even restarted this app many times
<Defusal> yet the next morning, the fundamental protocol it uses is screwed
<Defusal> s/nothing else/something else
<Defusal> the thing is
<bnagy> sounds like IO / buffering etc but you knew that already
<Defusal> i have debug enabled, so the first thing it does when EM calls the receive_data method is print it out
<bnagy> just go round sending flush to everything that support flush :)
<Defusal> so EM is never firing receive_data until the connection closes, at least 98% of the time
<Defusal> its websockets...
<Defusal> i don't know if the client api even supports flushing
<Defusal> but it sure shouldn't be necessary either way
tjadc has joined #ruby-lang
<bnagy> no help on #eventmachine?
<Defusal> have you been in that channel?
<bnagy> not since I dropped EM :)
<bnagy> used to be good though
<Defusal> you'd have better luck getting your paint on your wall to respond
tjadc has joined #ruby-lang
<Defusal> the EM authors have neglected the project :(
tjadc has joined #ruby-lang
toretore has joined #ruby-lang
tjadc_ has joined #ruby-lang
<Defusal> i don't see how it can just randomly break all of a sudden
<bnagy> it didn't, obviously, you just can't work out what changed
<bnagy> which, I'll admit is not amazingly helpful :)
solars has joined #ruby-lang
<bnagy> the reason I moved away from EM for a reasonably complex distributed system was mainly that it was often very hard to debug
<Defusal> i don't find that an issue most of the time
<Defusal> you just have to know where to look
<Defusal> but in this case, i don't see EM firing the events at all
<seoaqua> is there any package to get the clean uri?i dont wanna repeat the work, although i've done it e.g. 'http://abc.com' => 'http://abc.com/' 'http://abc.com/path/to/file#anchor' => 'http://abc.com/path/tofile'
JohnBat26 has joined #ruby-lang
digestives has joined #ruby-lang
apeiros_ has joined #ruby-lang
QaDeS has joined #ruby-lang
JohnBat26 has joined #ruby-lang
<manveru> seoaqua: the uri lib?
<seoaqua> <manveru>
francisfish has joined #ruby-lang
<seoaqua> manveru, there seem to be no clean like functions
<manveru> well, because you have to tell it what to clean :)
<manveru> it's not like those are invalid uris
<manveru> there's normalize
<manveru> but it'll only append the '/'
<manveru> if path is ''
<seoaqua> normalilze ? the name of the function?
<manveru> >> u = URI('http://abc.com/path/to/file#anchor').normalize; u.fragment = nil; puts u
<manveru> something like that?
<seoaqua> ok let me check
<seoaqua> yes
Fullmoon has joined #ruby-lang
<Defusal> bnagy, easy for you to say something has changed, but looking at a diff between today and the 14th, the only changes to anything remotely related are loads of additional debug prints to try and figure out how this could be possible
<seoaqua> its in URI::Generic, thanks maybe it could work
<seoaqua> manveru, yes ,as u said ,it can't remove what's after the #, i'm using Regx to remove it. and i need to know if there are better ways. so ,any more ideas?
beiter has joined #ruby-lang
<bnagy> Defusal: yeah but you know stuff doesn't just randomly behave differently, you're just upset. I didn't say that your code changed, just that _something_ did
flgr_ has joined #ruby-lang
<manveru> seoaqua: i told you already
<Defusal> bnagy, im a lot more than just upset, i was just upset when it happened more than 24 hours ago
<Defusal> every hour i am losing huge amounts of money
<Defusal> and i have almost no savings left
<Defusal> im ready to throw up at this point
<Defusal> and im out of ideas, all i can do is stare at it now
<manveru> Defusal: you use chrome?
<Defusal> yes, but i have tested with FF too
<manveru> ok, just checking it wasn't pesky auto-update
<Defusal> i also made sure the latest chrome beta update which enabled compression by default was not the issue
<Defusal> my websocket server does not support any extensions, so chrome will not be allowed to use them
solars has joined #ruby-lang
<Defusal> but it works like 2% of the time
<Defusal> it makes no sense :(
replore_ has joined #ruby-lang
<manveru> any way i can help?
<Defusal> i doubt it
<Defusal> any way you can think of a way of being able to help? :P
<manveru> you looked at wireshark trace of the ws conn?
<bnagy> sounds like problem burnout
<bnagy> you have anyone you know can come do teddybear debugging?
<Defusal> i wanted to, but being on windows 7, it wont allow me to sniff on my PPPOE interface
<Defusal> the thing is
<Defusal> i can see more or less what is happening
<Defusal> but if EM is not firing the receive_data event, it doesn't help-
<manveru> you run EM on windows too?
<Defusal> no
<Defusal> my application runs on a linux server
fgomez has joined #ruby-lang
<Defusal> the weird part is that EM fires all its events when the client connection closes
<Defusal> so it is buffering the received data, but isn't firing the receive event?
<manveru> do you use some proxy in front?
<Defusal> not for the websocket server
<bnagy> how does the data get from windows to em?
<manveru> with a browser :)
<Defusal> chrome or firefox
<manveru> anw, i think wireshark works headless too
<manveru> so you can trace it on the linux box and use wireshark on windows to display it
<Defusal> well i can use something else serverside i guess
<Defusal> dunno how much it's gonna help, but i'll give it a shot
<bnagy> oh, I thought the browser was being automated on windows
<bnagy> ahh I see
<manveru> but yeah, sounds like a buffer issue somewhere along the line, important is just to find out where
<Defusal> according to the tcpdump
<Defusal> theres no data received after the handshake
<Defusal> well
<Defusal> there actually is some kind of keep alive by the look of it
<seoaqua> manveru, what should i do if i need to change the normallize function? like 'class URI::Generic \n def nomalize \n end \n end' ?
<bnagy> so it's a client issue maybe?
<Defusal> and when i close the browser tab, the data is received
<seoaqua> manveru, i'm really a newbie :P
<manveru> seoaqua: write a new method
<bnagy> s/maybe//
<manveru> seoaqua: not on URI::Generic though
<manveru> Defusal: buggy home router?
<Defusal> manveru, definitely not
<Defusal> the data is sent when the browser tab closes
<seoaqua> manveru, ok then :)
<Defusal> but it is also sent correctly like 2% of the time
<Defusal> keep in mind
<manveru> yeah, but some routers try to be smart
<Defusal> this has worked fine for over a month
<Defusal> until it just broke yesterday
gouthamvel has joined #ruby-lang
<bnagy> but it shouldn't have changed...did windows autoupdate?
<Defusal> i have used it heavily while developing the platform
gouthamvel has quit [#ruby-lang]
<Defusal> bnagy, no
<bnagy> do you have another windows box you can test with?
<Defusal> i should be able to use an ubuntu live session running of a flash drive
<bnagy> linux shouldn't lie about whether it's getting data...sounds like EM is telling you the truth
<Defusal> yes
<manveru> Defusal: it's best if you can try from another network
<Defusal> but browsers cant just break
<bnagy> dude, it's windows
<Defusal> you have a point :P
<bnagy> I mean I presume that if you could automate the client on not-windows you'd be doing that already
<Defusal> manveru, i have used multiple ISPs, i can be almost sure its not the network
<Defusal> if i had any network issues, i would know about it
<Defusal> bnagy, theres no automation required?
<bnagy> big shame about pppoe - don't suppose your router supports non-bridge mode?
<Defusal> it just needs a HTML5 websocket compatible browser
<bnagy> ohhh, you're manually clicky clicky in the browser?
<Defusal> i load the page
<Defusal> or just leave it
<Defusal> it'll reconnect the websocket every 3 seconds
<bnagy> can you get someone else to test for you from a different network then?
<Defusal> s/load/reload
<Defusal> i'll test from a different machine fire
<Defusal> first
<bnagy> also, not to teach you to suck eggs, but you restarted the windows box etc I guess
<Defusal> as i said, the chance of it being the network is 0.01%
<bnagy> any windows problem I always do retry restart reinstall before I expend any serious brainpower
sandbags has joined #ruby-lang
<manveru> :)
<manveru> Defusal: does the echo work?
<bnagy> the reason I said it's a shame about pppoe is that it means you (apparently) can't sniff from the windows end, not that I think the network gear is broken
<bnagy> it would be really useful to have a sniff at both ends
<bnagy> although my money is currently on the browser
<bnagy> but I can't back that
<bnagy> up
<Defusal> ok that live install doesn't have websocket support
<Defusal> i'll have to get someone else to test it
<manveru> well, you got two volunteers here :)
<Defusal> manveru, how is the echo supposed to work
<bnagy> I would suggest restarting windows and reinstalling the browser
<Defusal> it does not seem to work
<bnagy> even if it sounds stupid
workmad3_ has joined #ruby-lang
<manveru> Defusal: you click the connect button, and send the messages
<Defusal> bnagy, while one browser could corrupt or break with an update, i doubt ff and chrome would
<manveru> they should show up in the log textarea
<Defusal> only output is CONNECTED
<Defusal> SENT: Rock it with HTML5 WebSocket
<Defusal> nothing received
<Defusal> gonna test with FF
<manveru> so you know it's not your server
<Defusal> "Uh-oh, the browser you're using doesn't have native support for WebSocket. That means you can't run this demo."
<manveru> that should make your brainache a lot better :)
<Defusal> the echo page does not support MozWebSocket
<manveru> old ff?
<bnagy> Defusal: even so, I'd do it anyway. It's part of standard network voodoo
<Defusal> new FF doesnt use "WebSocket"
<Defusal> it uses MozWebSocket
<bnagy> and it's quick and mindless
<manveru> no, new ff went to WebSocket again
<Defusal> now new?
<manveru> ff 11, that is
<Defusal> how*
<Defusal> hmm
<Defusal> will update
<Defusal> manveru, latest FF does the same
<Defusal> so just when i thought i could blame it on the latest chrome
<Defusal> its more likely windows
CoverSlide has joined #ruby-lang
<Defusal> the echo page works correctly in FF a small percentage of the time
<Defusal> just like my site
<Defusal> argh
<Defusal> so i guess if the echo works fine for you manveru, it has to be my pc
<manveru> yep
<Defusal> time for another reboot
<Defusal> good ol' windows
<bnagy> look on the bright side - you have a line of investigation now
<Defusal> indeed, for which i am grateful
snafoo has joined #ruby-lang
snafoo has joined #ruby-lang
futurechimp has joined #ruby-lang
<seoaqua> any ways to encode the uri automatically? i mean to encode only non-ascii chars, to ignore #,%,:,= etc
Fullmoon_ has joined #ruby-lang
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
<manveru> what encoding?
<Defusal> rebooting didnt help :(
<Defusal> im not sure what else i can try
<canton7> seoaqua, CGI::escape iirc
<seoaqua> canton7, iirc?
<canton7> if i recall
<seoaqua> canton7, is CGI::escape eql? URI::encode?
<seoaqua> canton7, is CGI::escape eql? URI::encode
<Defusal> manveru, interesting, the echo page seems to work everytime with TLS enabled
<bnagy> require TLS, call it a security feature, job done ;)
<canton7> seoaqua, apparently CGI::escape(foo) == URI.escape(foo, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
futurechimp has joined #ruby-lang
<Defusal> bnagy, i don't know what is required and what limitations it has for WebSockets
<Defusal> can it still use any port?
<manveru> Defusal: yes
<seoaqua> canton7, cool, thanks
<manveru> just use wss in the schema
<Defusal> doesn't seem to work
<Defusal> there must be more to it
<manveru> yeah, you have to use it on the server
<Defusal> Uncaught Error: INVALID_STATE_ERR: DOM Exception 11 jquery.websocket-0.0.1.js:40
<Defusal> WebSocket is closed before the connection is established.
<Defusal> i did enable secure: true
<Defusal> i guess it may need a custom certificate
<manveru> only for safari
<manveru> hm
<manveru> maybe it really needs port 443?
<Defusal> well ssl does
<Defusal> so i'd guess that is possible
<Defusal> though i havnt seen anything saying that
<manveru> so they pretty much say that wss has way higher success rates
<Defusal> bleh
burgestrand has joined #ruby-lang
gnufied has joined #ruby-lang
solars has joined #ruby-lang
WillMarshall has joined #ruby-lang
francisfish has joined #ruby-lang
dvorak has joined #ruby-lang
drumond1_ has joined #ruby-lang
MDmalLION has joined #ruby-lang
<MDmalLION> how do I make it such that I don't have to type an underscore
<tobiasvl> MDmalLION: what do you mean?
<MDmalLION> Osteogenesis_Imperfecta: Set.new(%w[blue_sclera]),
<MDmalLION> i want them to be able to type blue sclera
<MDmalLION> not always have to blue_sclera
<tobiasvl> oooookay
<tobiasvl> i'm not sure what you're talking about here, but you could take a look at gsub
<tobiasvl> "blue sclera".gsub(" ", "_")
<tobiasvl> will return "blue_sclera"
<rippa> MDmalLION: how would it distinguish between ["blue sclera"] and {"blue", "sclera"]?
<MDmalLION> hm
<rippa> maybe, better use a string
<MDmalLION> sets of strings>
<rippa> Set.new("blue sclera,some other shit")
<rippa> then split on comma
<manveru> rippa: why on earth do you use a set for a single string?
<rippa> eh, i mean
<rippa> Set.new("blue sclera,some other shit".split(","))
<manveru> :)
<canton7> am I missing something, or what's wrong with the old Set.new(['blue sclera', 'some other shit'])?
drumond19 has joined #ruby-lang
Asher has joined #ruby-lang
justinmcp has joined #ruby-lang
Defusal has joined #ruby-lang
<andrewvos> canton7: Works for me
rohit has joined #ruby-lang
echoprinter has joined #ruby-lang
Defusal has joined #ruby-lang
kyrylo has joined #ruby-lang
tmi has joined #ruby-lang
<Defusal> manveru, i was able to capture the packets clientside using another machine as a gateway, the handshake completes, it receives the first data sent from the server and keepalive packets and their acks work fine after that, but the client data is never sent
ngw has joined #ruby-lang
ngw has joined #ruby-lang
Defusal_ has joined #ruby-lang
Defusal_ has joined #ruby-lang
Defusal__ has joined #ruby-lang
Defusal__ has joined #ruby-lang
<manveru> Defusal: yeah, might be some intermediary using http1.0 or the like
<manveru> who knows :)
<Defusal> does the same on multiple ISPs :(
<manveru> what does that mean?
<manveru> did you traceroute?
WillMarshall has joined #ruby-lang
<Defusal> internet service providers
<Defusal> ie. different backbones in my country
<manveru> well, that i understand :)
<manveru> but what does it mean for the route you take to the server?
<manveru> chances are that you still go through a couple of the same nodes
<Defusal> depending on the ISP, i am 5 - 15ms away from my server
<Defusal> about a 25 minute drive
<Defusal> but the echo page does the same
<manveru> so you use a vpn for that?
<Defusal> no?
kings has joined #ruby-lang
<manveru> well, anyway, someone is messing with your websocket
<manveru> the only option seems to be secure websockets
<Defusal> then it must be something on my pc :/
<Defusal> but that doesn't make any more sense
<manveru> some firewall?
apeiros_ has joined #ruby-lang
<Defusal> cant be
futurechimp has joined #ruby-lang
srbartlett has joined #ruby-lang
replore has joined #ruby-lang
Ethan has joined #ruby-lang
<ridders24> How can I get my script to copy a few dir's back from the one its copying: http://pastie.org/3816005 so currently its copying just the dirLKRL-100-2, however I want it to copy 5745/LKRL-100-2. The full path is C:/DATA/5745/LKRL-100-2
Ethan has joined #ruby-lang
mattyoho has joined #ruby-lang
Ethan has joined #ruby-lang
Ethan has joined #ruby-lang
brushbox has joined #ruby-lang
slyphon_away has joined #ruby-lang
kings has joined #ruby-lang
seanstickle has joined #ruby-lang
francisfish has joined #ruby-lang
anbz has joined #ruby-lang
rohit_ has joined #ruby-lang
rohit_ has joined #ruby-lang
hexo has joined #ruby-lang
Fullmoon has joined #ruby-lang
<apeiros_> isn't peter cooper on irc occasionally? by what nick does he go again?
<apeiros_> pcooper? petercooper?
grin has joined #ruby-lang
<TTilus> ridders24: "copy a few dir's back"?
<ridders24> TTilus: yh so atm it only copies for example the dir LKRL-100-2 but i want to copy all these dirs: 5745/LKRL-100-2, and the full path is C:/DATA/5745/LKRL-100-2
<TTilus> ridders24: sorry, still confused
<TTilus> ridders24: so it does now `cp LKRL-100-2 C:/tmp`
<TTilus> ridders24: right?
<TTilus> ridders24: and you want it to do what?
<ridders24> TTilus: yh, but i need it to do cp 5745/LKRL-100-2 C:/tmp
<ridders24> but 5745 is contained in C:/DATA
rohit_ has joined #ruby-lang
<TTilus> ridders24: but `cp LKRL-100-2 C:/tmp` and `cp 5745/LKRL-100-2 C:/tmp` do exactly the same thing, right?
<TTilus> ridders24: they only expect different cwd's
<ridders24> TTilus: I don't know how to do that though with the code I have now
<TTilus> ridders24: both end up with C:/tmp/LKRL-100-2
<TTilus> ridders24: and i dont understand what you are trying
<ridders24> TTilus: why? i need to keep the dir structure from 5745
<TTilus> ridders24: is C:/DATA/5745/LKRL-100-2 --> C:/tmp/LKRL-100-2 what you want?
<ridders24> TTilus: no i need C:/DATA/5745/LKRL-100-2 --> C:/tmp/5745/LKRL-100-2
<TTilus> ridders24: is there stuff inside C:/DATA/5745 that you do not want to copy?
<ridders24> TTilus, yes there could be other dir's like LKRL-100-2 that I do not wish to copy, thats why I specify in the code the dir Im looking for, but I need to copy some of the dir structure that its in
S1kx has joined #ruby-lang
S1kx has joined #ruby-lang
<TTilus> ridders24: does "some" mean "one step upwards"?
<ridders24> TTilus: yh
<TTilus> ridders24: topdir = dir.split('/')[-2]
justinmcp has joined #ruby-lang
<TTilus> ridders24: target = "C:/tmp/#{topdir}"
<TTilus> ridders24: FileUtils.mkdir_p(target) unless File.directory?(target)
<TTilus> ridders24: then copy
<TTilus> ridders24: are you aware that Find.find yieds every file, so you get the same dir several times
MDmalLION has joined #ruby-lang
rdavila has joined #ruby-lang
m3nd3s has joined #ruby-lang
<ridders24> TTilus: what have I done wrong? http://pastie.org/3816005 it create a dir called 5745 but has no contents and then creates another dir called LKRL-100-2
Takia has joined #ruby-lang
<TTilus> ridders24: well, if you copy C:/DATA/5745/LKRL-100-2 to 'C:/tmp' it does just that
batmanian has joined #ruby-lang
<TTilus> ridders24: you should copy it into C:/tmp/5745/
<TTilus> ridders24: FileUtils.cp_r dir, target
apeiros_ has joined #ruby-lang
<ridders24> TTilus: ah cool, and why do I get duplicates regarding LKRL-100-2 ?
<TTilus> ridders24: where?
<ridders24> so in the tmp dir, i get the result im after 5745 which contains LKRL-100-2, but also in tmp i have a dir called LKRL-100-2
m3nd3s has joined #ruby-lang
brushbox1 has joined #ruby-lang
<ridders24> TTilus: what do you recon?
<rue> <3 great file names
<TTilus> ridders24: was C:/tmp/LKRL-100-2 from the previous run?
<TTilus> ridders24: nuke C:/tmp/ and run again
<ridders24> TTilus: no I deleted all the dirs and started again before running the updated script
<TTilus> ridders24: you might also want to add debug logging
<ridders24> TTilus, Im getting an error too
kvirani has joined #ruby-lang
slyphon has joined #ruby-lang
<TTilus> don't you dare to tell us more
<ridders24> TTilus: what?
seanstickle has joined #ruby-lang
m3nd3s has joined #ruby-lang
PawelPacana has joined #ruby-lang
PawelPacana has quit [#ruby-lang]
<rue> Suspense is killing me
<ridders24> TTilus: what?
apeiros_ has joined #ruby-lang
tommyvyo has joined #ruby-lang
codewrangler has joined #ruby-lang
mattyoho has joined #ruby-lang
mstratman has joined #ruby-lang
<TTilus> ridders24: 15:37 < ridders24> TTilus, Im getting an error too
<TTilus> ridders24: it has been 20 minutes and we still don't know what error you got
<TTilus> ridders24: thats why rue feels like watching a thriller ;)
ericmuyser has joined #ruby-lang
m3nd3s has joined #ruby-lang
<ridders24> TTilus: sorry from you comment "don't you dare to tell us more" I thought you were getting frustrated at me
<tobiasvl> i think they were being sarcastic
<ridders24> TTilus: heres the error: http://pastie.org/3816573
sandbags has joined #ruby-lang
tomzx has joined #ruby-lang
hynkle has joined #ruby-lang
zenChild has joined #ruby-lang
mark_locklear has joined #ruby-lang
<TTilus> ridders24: cp_r complains that source and dest are the same file
<TTilus> ridders24: you have done rerun without nuking c:/tmp first
<TTilus> ridders24: your finder matches stuff inside c:/tmp also
<TTilus> ridders24: you might wanna exclude that
m3nd3s has joined #ruby-lang
ridders24 has joined #ruby-lang
mattyoho has joined #ruby-lang
mattyoho has joined #ruby-lang
<andrewvos> What's a good gem for colourising things in the terminal?
<andrewvos> Thinking of using rainbow. Is there anything you guys can recommend?
<judofyr> andrewvos: I just re-implement the color escape codes everytime…
<judofyr> andrewvos: but hey, I like to read http://invisible-island.net/xterm/ctlseqs/ctlseqs.html just to see what's actually possible
<yorickpeterse> andrewvos: ANSI
<andrewvos> heh
<andrewvos> yorickpeterse: Thanks looks good.
morozovm has joined #ruby-lang
<andrewvos> judofyr: You crazyyyyy
diegoviola has joined #ruby-lang
codewrangler has joined #ruby-lang
<yorickpeterse> :)
Gekz has joined #ruby-lang
replore_ has joined #ruby-lang
crankharder has joined #ruby-lang
jtoy has joined #ruby-lang
retro|cz has joined #ruby-lang
fattastic has joined #ruby-lang
nofxx has joined #ruby-lang
grin has joined #ruby-lang
moutaman has joined #ruby-lang
<dr0id> twitter is at twitter.com
<any-key> I feel like it'd be trivial to autoban people who use scripts like that
JEG2 has joined #ruby-lang
enebo has joined #ruby-lang
MDmalLION has joined #ruby-lang
Sailias has joined #ruby-lang
kvirani has joined #ruby-lang
DEac- has joined #ruby-lang
outoftime has joined #ruby-lang
dv310p3r has joined #ruby-lang
thone_ has joined #ruby-lang
gouthamvel has joined #ruby-lang
gouthamvel has quit [#ruby-lang]
francisfish has joined #ruby-lang
lsegal has joined #ruby-lang
virunga has joined #ruby-lang
nofxx has joined #ruby-lang
diegoviola has joined #ruby-lang
jtoy has joined #ruby-lang
jxie has joined #ruby-lang
malev has joined #ruby-lang
bglusman has joined #ruby-lang
mbriggs has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
Sailias has joined #ruby-lang
flgr_ has joined #ruby-lang
wmoxam has joined #ruby-lang
slyphon has joined #ruby-lang
rippa has joined #ruby-lang
rdavila has joined #ruby-lang
<andrewvos> How can I tell whether a string contains a scheme or not? I need to tell the difference between "/news" and "http://m.bbc.co.uk/news"
<andrewvos> Is there a simple way using URI?
<manveru> andrewvos: what schemes do you worry about?
<andrewvos> manveru: http[s]
<andrewvos> Hmmm, I just almost answered my own question.
<manveru> extract :)
<manveru> >> URI.extract('https://foo ftp://foo http://foo', %w[http https])
<manveru> => ["https://foo", "http://foo"]
<manveru> though of course you can use start_with? instead
<andrewvos> manveru: Hmm, what I actually want to do is just issue a get on the url whether it's a /url or http://sdf/url.
<andrewvos> Maybe I should just: if url.start_with? '/'
<rippa> start_with? always confuses me
<manveru> >> u = URI('/foo'); u.scheme ||= 'http'; u.host ||= 'm.bbc.co.uk'; u
<manveru> => #<URI::Generic:0x000000015f9e88 URL:http://m.bbc.co.uk/foo>
<rippa> I instinctively write it as starts_with?
<manveru> rippa: spend some time in japan :)
<manveru> i just thing 'do you start with?'
<manveru> *think
<rippa> sutaato
<andrewvos> rippa: Yeah me too!
<manveru> andrewvos: helping?
<andrewvos> manveru: Sorry missed that.. Looking now
<andrewvos> manveru: Hmm not really. Some of the links point to bbc.co.uk so I don't need those
<manveru> damn, my 3yo son somehow sneaked soap into the cookies :(
<whitequark> manveru: URI.extract is cool!
<andrewvos> nooooooo
<whitequark> didn't know about it
cdnz has joined #ruby-lang
<manveru> some are fine, some have a soapy aftertaste...
joast has joined #ruby-lang
<manveru> andrewvos: well, it only sets the host if there isn't one
<andrewvos> hmmm
<andrewvos> This is true
hagabaka has joined #ruby-lang
<andrewvos> manveru: You did use semicolons though. SHUN HIM
hagabaka has joined #ruby-lang
<manveru> s/;/\n/
<manveru> how else do you use irc :P
<andrewvos> manveru: It's too late. Pull request CLOSED
andrewhl has joined #ruby-lang
rolfb has joined #ruby-lang
<manveru> heh
<manveru> ok, see you at rizzoma :)
<andrewhl> can someone explain the following code to me: http://pastie.org/3817206 ... specifically, what is being passed to the variable |j| in the all? block?
dv310p3r has joined #ruby-lang
<andrewhl> oh I get it, nevermind
<andrewvos> hehehe
<andrewvos> manveru: :(
<andrewvos> manveru: bad URI(is not URI?): mailto:?subject=Shared from BBC Mobile&body=http://www.bbc.co.uk/mobile/privacy/index.shtml?SThisEM
<andrewvos> manveru: Guess I just need to do the "/"
<andrewvos> Oh wait maybe that's HTTParty
<andrewvos> Yeah it is
<andrewvos> Sorry I doubted you manveru bro
rushed has joined #ruby-lang
<manveru> how dare you!
* andrewvos bows head in shame
<manveru> RANDOM REMARK ABOUT ANDREWVOS MOTHER
zenChild has quit [#ruby-lang]
jenrzzz has joined #ruby-lang
<andrewvos> NOOOOO
hagabaka has joined #ruby-lang
hagabaka has joined #ruby-lang
crankharder has joined #ruby-lang
jarvis141 has joined #ruby-lang
<jarvis141> Greetings! Anyone who would give me some example code for wxRuby using wxVListBox/wxHtmlListBox?
<jasiek> jarvis141: whatdya need?
<jarvis141> Some basic example code. I'm trying to get wxVListBox working, but with no success. I've some example for Python which runs fine, but by simply rewriting it to Ruby I can't get that component working...
gouthamvel has joined #ruby-lang
gouthamvel has quit [#ruby-lang]
<jasiek> jarvis141: brb
<Defusal> does anyone here use em-websocket with TLS?
olesu has joined #ruby-lang
<Defusal> i've even tried running it as root and using port 443, yet it does not work
mistym has joined #ruby-lang
<Defusal> if wss:// test echo server works, so it must be em-websocket :(
<manveru> Defusal: you turned logging on?
<Defusal> manveru, debug for em-websocket?
<Defusal> of course
<manveru> what does it say?
<Defusal> [[:initialize]] when it starts
<Defusal> thats it
hagebake has joined #ruby-lang
hagebake has joined #ruby-lang
<Defusal> the browser does not log the http connection it makes for the handshake
<manveru> what's your browser complaining about?
<manveru> hm
<Defusal> but when my code tries to send ping a little later it complains
<Defusal> Uncaught Error: INVALID_STATE_ERR: DOM Exception 11. WebSocket is closed before the connection is established.
<Defusal> sigh
<manveru> what events did you subscribe to?
<manveru> onmessage/onerror/onclose/onopen/ the whole shebang?
<Defusal> all
<Defusal> yup
<Defusal> i disabled by specific message event handling and made a console.debug catchall
<Defusal> i must be having the most unlucky time ever with this :
<Defusal> :|
<manveru> well dude, sounds like you're screwed
<matti> Hi manveru
<manveru> matti: hoi
<Defusal> manveru, thats what people have been telling me for the last 2 days :(
m3nd3s has joined #ruby-lang
<Defusal> best solution i've gotten is still "buy a new computer"
<Defusal> sigh
<manveru> i don't think that would help much
<Defusal> it may not help with this workaround
<Defusal> but it would probably solve the issue in the first place
<manveru> nope
<manveru> i seriously doubt that the problem is with your computer
Psyche^ has joined #ruby-lang
<manveru> i still think that it's some node in between
<Defusal> it just started doing it randomly a day and a half ago
crankharder has joined #ruby-lang
skryking has joined #ruby-lang
<Defusal> that is caching the data?
<Defusal> it cant be
<Defusal> because the wireshark dump showed the sent data never leaves my machine until the connection closes
<Defusal> if it was something in between, the data would be sent but never received?
<manveru> you said you didn't do wireshark on your machine
<Defusal> i have since
<Defusal> its been almost 2 days :|
<manveru> it's been maybe 5 hours
crankharder has quit [#ruby-lang]
<Defusal> since the issue started
<manveru> well, for me :)
<Defusal> :P
<Defusal> i setup a gateway on a headless linux machine and used that so i could capture the data
<manveru> well then
<Defusal> didnt help too much, but i can see the handshake, first data the server sends and the keepalive packets + their acks are received by the client machine
<manveru> you run virus scanner or firewall?
<Defusal> i tried disabling firewall
<Defusal> my AV software is up to date and active
crankharder has joined #ruby-lang
Natch| has joined #ruby-lang
crankharder has joined #ruby-lang
<manveru> well, i'm kinda out of ideas, wanna try archlinux? :)
grin has joined #ruby-lang
<Defusal> lol
<Defusal> i've been out of ideas for like a day :(
<Defusal> im considering installing a linux virtual machine
crankharder has joined #ruby-lang
crackity_jones has joined #ruby-lang
grin has quit [#ruby-lang]
<manveru> that would be a nice test, but somehow i'm not sure it'll work :P
<Defusal> i rate it would
<Defusal> :P
<manveru> then what are you waiting for?
<Defusal> VirtualBox to download :)
<manveru> lol
<Defusal> 1.5 mins @ 880KB/s
<Defusal> guess that leaves time for breakfast
crankharder has joined #ruby-lang
m3nd3s has joined #ruby-lang
crankharder has joined #ruby-lang
crankharder has joined #ruby-lang
grin has joined #ruby-lang
crankharder has joined #ruby-lang
butchanton has joined #ruby-lang
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
grin has quit [#ruby-lang]
grin_ has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
malev_ has joined #ruby-lang
kain has joined #ruby-lang
thone has joined #ruby-lang
savage- has joined #ruby-lang
crankharder has joined #ruby-lang
achiu has joined #ruby-lang
crankharder has joined #ruby-lang
crankharder has joined #ruby-lang
jarvis141 has quit [#ruby-lang]
kitallis has joined #ruby-lang
turboladen has joined #ruby-lang
jbwiv has joined #ruby-lang
RegEchse has joined #ruby-lang
m3nd3s has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
kitallis has joined #ruby-lang
Fullmoon has joined #ruby-lang
Zolrath has joined #ruby-lang
rippa has joined #ruby-lang
kitallis has joined #ruby-lang
michael_mp has joined #ruby-lang
Austin__ has joined #ruby-lang
morozovm has joined #ruby-lang
morozovm has joined #ruby-lang
divoxx has joined #ruby-lang
ViperMaul has joined #ruby-lang
achiu has joined #ruby-lang
Rizzle has joined #ruby-lang
rockpapergoat has joined #ruby-lang
dfr|mac has joined #ruby-lang
xcyclist has joined #ruby-lang
<xcyclist> Anyone out there using minitest?
<bnagy> no
fattastic has joined #ruby-lang
<xcyclist> What test suite then?
<bnagy> zenspider basically wasted his life
<mitchty> bacon!
<bnagy> 0 users
aef has joined #ruby-lang
francisfish has joined #ruby-lang
replore__ has joined #ruby-lang
<erikh> heh
aef has joined #ruby-lang
<manveru> everybody loves bacon!
<manveru> i KNEW it :D
aef has joined #ruby-lang
<mitchty> its true!
<bnagy> who doesn't like bacon, though?
<bnagy> I mean, software testing is for retards
<bnagy> but...mmmm. bacon.
<rue> xcyclist: Yes, minitest is reasonably popular
<any-key> am I missing a connection between bacon and software testing?
<rue> Are you compiling use statistics or was there a point to this? :)
<rue> any-key: why_
<xcyclist> Okay, so here is my pastie: http://pastebin.com/uYF4ceGU
<any-key> ah
<any-key> thanks
<xcyclist> Please excuse the vulgarity.
<mitchty> i actually do use it because of the tap output, but really picked it because it installs a bacon command
<mitchty> and every time i do rake bacon, i get hungry
<any-key> hah
<xcyclist> I've messed with this since last night, and it appears the validation method runs from a script call to the a2s method, but not from the minitest call.
<rue> EVARIABLENAMES
<xcyclist> It appears that the minitest call loses the include state somehow of the included module inside the included module.
<xcyclist> rue:?
<xcyclist> I don't get anything for EVARIABLENAMES from google...
<bnagy> hhaha
aef has joined #ruby-lang
malev has joined #ruby-lang
jbwiv has joined #ruby-lang
<shevy> lol
<xcyclist> The identifiers I've used have not made a difference. I've changed them twice and have gotten the same results.
<xcyclist> Also, the pastie may not be perfect. I tried to get it so, but was having troubles with the pastie.org site earlier today.
<xcyclist> Perhaps I'll put it together again under less vulgar identifiers just to solidify the example...
<xcyclist> You guys have a preferred pastie site?
rdavila has joined #ruby-lang
<bnagy> the identifiers aren't ewhat make it suck
<xcyclist> Okay, well, the matter is, I have a general set of validation methods I want to define in a module for use in checking arguments to methods before they are used.
<xcyclist> Best way to do that is have a separate file of them, and include the file where needed.
aef has joined #ruby-lang
krz has joined #ruby-lang
<xcyclist> I have the minitests all working for the validation method module.
<xcyclist> But when they are called within the including modules, in class and object methods, though they work fine from programs, they fail from minitest.
judofyr has joined #ruby-lang
<xcyclist> This kind of type-checking is talked about as normal in the literature.
<bnagy> 'the literature'?
<bnagy> imho Ruby favours 'duck typing'
<any-key> The Book Of Literature
<xcyclist> Type checking and testing of passed arguments?
<any-key> ™
<bnagy> which means ideally checking respond_to or at worst kind_of
<xcyclist> Yes, but you also check your data as it is used, right?
<bnagy> you shouldn't care what that actual class is, only if it does what you need it to do
<xcyclist> Okay, I'll look at those.
<bnagy> they should both have ? I was just lazy
<xcyclist> I care whether a string is a stripped URL.
<xcyclist> And I need to check URLs and clean off spaces all over the map in an application.
aef has joined #ruby-lang
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
burgestrand has joined #ruby-lang
apeiros_ has joined #ruby-lang
<xcyclist> bnagy: You're right. kind_of? is a better choice, however, I fail to see how that applies to this bug.
outoftime has joined #ruby-lang
judofyr has joined #ruby-lang
<bnagy> xcyclist: well probably respond_to? is a better choice, and tbh I didn't even try to find the bug
matflores has joined #ruby-lang
Sailias has joined #ruby-lang
<xcyclist> What does "tbh" mean?
<apeiros_> to be honest
<bnagy> mainly cause I know 0 about testing frameworks, not because I'm not trying to help
<apeiros_> acronymfinder.com & urbandictionary.com ftw ;-)
<bnagy> but hey, I gave you advice about duck typing, so that's a plus
kvirani has joined #ruby-lang
<xcyclist> Ok. Thanks. The latest one has kind_of?, and I am welcoming further criticisms to use respond_to?, but perhaps I'm obtuse, it appears to apply to methods, not classes.
surfprimal has joined #ruby-lang
<apeiros_> xcyclist: the point is, that you shouldn't test against classes in ruby
<bnagy> uh.. most everything should respond to respond_to?, but to be fair I am drunk as a monkey
<erikh> ha
<apeiros_> you test against whether something can perform what you want from it.
<xcyclist> At any rate, my bug is a matter of running a method in a file included in another file: NoMethodError: undefined method `vns' for PKit::DClass:Class
<apeiros_> xcyclist: so either your method is not defined as a class method, or the required code isn't loaded.
<xcyclist> bnagy, well, despite your state, that sounds helpful, and makes sense.
guns has joined #ruby-lang
<xcyclist> Good point. However, I seem to recall horrible failures when I got a null argument. Presumably you check for that, or does respond_to? handle that?
<apeiros_> respond_to? only checks whether an object responds to a method
<apeiros_> (hence the name…)
<apeiros_> also, nil in ruby, not null :-p
<xcyclist> So, you cannot run respond_to? on nil. You need to take the step to check for nil, right?
<apeiros_> yes, you can
<apeiros_> nil is an object
<any-key> nil is special
<apeiros_> nil is not special
<any-key> just like shevy
<any-key> :P
<apeiros_> shevy otoh is special :)
<xcyclist> Now I am more confused. Can I run nil.respond_to?
<any-key> yes
<apeiros_> yes
<apeiros_> irb
<apeiros_> use it. it's great to try stuff like that.
<any-key> when in doubt, irb it out
<apeiros_> and it doesn't even bit you!
<bnagy> it won't respond to much though :)
<apeiros_> or pry. actually nowadays I should recommend using pry for stuff like that :)
<any-key> I reaaaallllyyyy need to get good with pry
<any-key> it does so much but I haven't had time to read up on it :(
<bnagy> apeiros_: that just gives banister too much ego trip
raph_io has joined #ruby-lang
<apeiros_> bnagy: so what. pry's nice. he deserves all the testosterone he gets from it.
<xcyclist> Okay, irb says it fails, from what I can see, implying my original deduction is correct: I need to check for nil.
<bnagy> I like the idea. and really respect the work
<any-key> waaait banister was behind it?
<bnagy> but warn should be enough for anyone :D
<any-key> so I have to high-five banister?
<apeiros_> xcyclist: hu?
<any-key> damnit
<apeiros_> xcyclist: irb says nil.respond_to? fails?
<any-key> respond_to? requires an argument
<apeiros_> was gonna say… makes no sense without…
<xcyclist> > nil.respond_to?
<xcyclist> ArgumentError: wrong number of arguments (0 for 1..2)
<xcyclist> from (irb):1:in `respond_to?'
<xcyclist> from (irb):1
<xcyclist> from /usr/local/rbenv/versions/1.9.2-p290/bin/irb:12:in `<main>'
<apeiros_> xcyclist: …
tbuehlmann has joined #ruby-lang
<bnagy> nil.respond_to? :nil? => true
<bnagy> phew
<apeiros_> of *course* - respond to is checking whether an object responds to a specific method - how can respond_to? know which method you want to know if you don't tell it…
<apeiros_> so you have to pass the method's name as an argument
<any-key> "wrong number of arguments" should make that pretty clear :P
<xcyclist> What is :nil?
<bnagy> actually, on scrollback... I'm pretty sure nil is special
<bnagy> for a few reasons
<bnagy> but not responding to respond_to? isn't one of them :P
<any-key> xcyclist: respond_to? can take arguments in the form of strings and symbols
<shevy> xcyclist a symbol called nil
<any-key> :nil? would be the same as passing it "nil?"
<bnagy> xcyclist: :nil? is the symbol that represents the 'is is nil?' method that almost everything responds to
<apeiros_> bnagy: nil is special in being one of two falsy values, it is also special in being an immediate. but the latter is an implementation detail.
datanoise has joined #ruby-lang
<apeiros_> but other than that, nil is a pretty normal object…
<bnagy> but a special one!
sockmonk has joined #ruby-lang
<apeiros_> bnagy: have another drink :-p
<bnagy> not as special as like Module I guess
* apeiros_ sends some virtual beer
<shevy> hmm
<shevy> why not real beer :(
<bnagy> but nil is prety badass
<apeiros_> yeah, on the "being special" scale, module is quite high
<judofyr> bnagy: how is Module special?
<xcyclist> Okay, so nil? nil is true, and you're saying in your way that I use that instead of checking if it's false.
<apeiros_> judofyr: how about: it's the only thing that can hold methods?
<apeiros_> err, judofry
<xcyclist> I will have to go to work. I'll try again later. Thanks guys.
<judofyr> apeiros_: oh, you're talking about instances of Module?
<judofyr> err, apieros
<apeiros_> that's a new mutilation…
<apeiros_> nickilation
<judofyr> hm? I've been saying apieros forever
<apeiros_> well, Module.is_a?(Module) :-p
<apeiros_> (ok, it's a class, but since Class < Module…)
<judofyr> :)
<judofyr> Class < Module is *really* weird though
<judofyr> Liskov would've shit her pants
<bnagy> I'm glad there were smarter people around to answer this question
<bnagy> including the person that asked it
<bnagy> I just knew I was right :D
<yxhuvud> liskov was a she?
<judofyr> pretty sure
<judofyr> Barbara Liskov
<apeiros_> judofyr: I like Class < Module
<apeiros_> makes a lot of sense
<judofyr> apieros: except for "include Class.new" doesn't work…
<apeiros_> yxhuvud: not 'was', 'is'
<apeiros_> she's still alive
<judofyr> which it totally should if Liskov ruled the world
jmontross has joined #ruby-lang
<yxhuvud> I see
<jmontross> h.map {|k,v| [:name,:service,:function].include?(k)? { k => v } }
<apeiros_> judofyr: yeah, that part is a bit sad
<judofyr> that she doesn't rule the world?
<jmontross> is invalid
<apeiros_> jmontross: yes, of course
<bnagy> jmontross: yes, so is jbghiyftuoiyftfygio
<apeiros_> you're having half a ternary. also, bad code.
<jmontross> if you do a bool statement followed by ? you can then do "something" : "something else"
<apeiros_> it's `cond ? iftrue : iffalse`, not `cond ? iftrue`
<jmontross> h.map {|k,v| [:name,:service,:function].include?(k)? {k=>v} : ''"}
<jmontross> but I dont want anything to happen if it's not ther
<jmontross> is there a better way to only accept certain keys from a hash?
<bnagy> I should go to sleep
<jmontross> I want to cleanse my hash to only have what it should
<apeiros_> jmontross: using rails? Hash#slice then
<bnagy> ...but the bats that come out at this time of night fascinate me :(
<jmontross> not using rails.
<bnagy> jmontross: select?
<bnagy> that's how we did it back in my day
<apeiros_> then Hash[keys.zip(hash.values_at(*keys))]
<apeiros_> or select
<Harzilein> hmm... is there any rubyist equivalent to that "educational" part of the python community? i mean one specifically addressing non-programmers etc.
<judofyr> Harzilein: Hackety probably
snafoo has joined #ruby-lang
snafoo has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
<bnagy> tons of the basic ruby stuff I read is aimed at 'this is my first language' people
<bnagy> ...like, in a good way
<Harzilein> judofyr: hmm... that's indeed interesting
<judofyr> Harzilein: also #mendicant
<judofyr> Harzilein: http://mendicantuniversity.org/
<jmontross> mendicant should check out canvas-lms
<jmontross> actually make courses using rails
<bnagy> :<
<bnagy> or maybe, since it's supposed to be education, they could avoid the worst thing that's ever happened to ruby
<bnagy> cf, above, drunk sa monkey
<judofyr> jmontross: that looks awesome. so much better than It's Learning that we used…
<jmontross> cf above?
<jmontross> It's Learning? never heard of htat one
<jmontross> bnagy: "drunk sa monkey?"
<judofyr> jmontross: Norwegian; mostly used in Europe
<judofyr> jmontross: tons of fun security holes \o/
<bnagy> jmontross: *drunk as monkey
<judofyr> lol: "Built on an OPEN architecture that enables seamless integration of Web 2.0 and 3rd party tools"
andrewhl has joined #ruby-lang
<jmontross> that's open.
<judofyr> \o/
<jmontross> btw that hash.select didnt work for me
babinho_ has joined #ruby-lang
<bnagy> how did you write it, and what do you think it should do?
Fullmoon_ has joined #ruby-lang
<bnagy> naively it looks like smaller=hsh.select {|k,v| [:my,:dog,:rufus].include? k}
fgomez has joined #ruby-lang
<bnagy> but rufus is a very willful beast
matt_yoho has joined #ruby-lang
brianpWins has joined #ruby-lang
moxiemk1 has joined #ruby-lang
divoxx has joined #ruby-lang
mssola has joined #ruby-lang
jfelchner has joined #ruby-lang
<jmontross> are you talking about cold fusion?
<shevy> hot fusion!
<shevy> millions of degrees
Carnage\ has joined #ruby-lang
dejongge has joined #ruby-lang
olesu has joined #ruby-lang
<jmontross> h.select {|k,b| [:name,:service,:function].include?(k) }.flatten
<jmontross> yields an array
<jmontross> bnagy : I want a hash out of a hash
<shevy> I want gold out of carbon
<rippa> easy
<rippa> I'll just need 1.21 jiggawatts
kalleth has joined #ruby-lang
<manveru> jmontross: how about using Hash[]
<manveru> >> ks = [:name, :service, :function]; Hash[ks.zip(h.values_at(*ks))]
<manveru> => {:name=>1, :service=>2, :function=>3}
<manveru> >> ks.each_with_object({}){|k,m| m[k] = h[k] }
<manveru> => {:name=>1, :service=>2, :function=>3}
<manveru> lots of fun ways :)
<jmontross> Hash is news to me
<jmontross> never done that/... same as Hash.mew?
<manveru> no
<Defusal> so manveru, im gonna use a VM in seamless mode then
<Defusal> pain im the ass to have to use a VM just for a web browser, but at least it works
solars has joined #ruby-lang
<shevy> Defusal likes pain!
<Defusal> ...
babinho_ has joined #ruby-lang
ilyam has joined #ruby-lang
mattyoho has joined #ruby-lang
<jmontross> ks = [:name, :service, :function]; Hash[ks.zip(h.values_at(*ks))] ===> totally worked. thanks!
bradland has joined #ruby-lang
snafoo has joined #ruby-lang
babinho has joined #ruby-lang
canton7 has joined #ruby-lang
mytrile has joined #ruby-lang
alex_k has joined #ruby-lang
rdavila has joined #ruby-lang
nif has joined #ruby-lang
justinmcp has joined #ruby-lang
fattastic has joined #ruby-lang
Fullmoon has joined #ruby-lang
olesu has joined #ruby-lang
Slackwise has joined #ruby-lang
nif has joined #ruby-lang
Radium_ has joined #ruby-lang
<bradland> I found a great little script for searching my Rails logs, but it exhibits a behavior I don't understand when piped to other utilities. https://github.com/bradland/rails-log-block-grep/blob/master/rails-log-block-grep.rb
<bradland> if i pipe the output of that script to less, i get a broken pipe error when i exit less
<bradland> can anyone help me understand why?
<zenspider> because it is written poorly
<zenspider> looking
<bradland> yeah, this is written in a style i'm definitely not used to
<bradland> it uses gets("") to implicitly read the file from ARGV (I think)
<bradland> i think the `while gets("")` approach is what's causing the broken pipe error
<zenspider> the loop with a gets isn't handling the Interrupt exception
<zenspider> try this:
<zenspider> ruby -e 'gets' | less
<zenspider> then hit ^c
<bradland> would a `rescue Errno::EPIPE` block suffice?
<zenspider> vs: ruby -e 'begin; gets; rescue Interrupt; nil; end' | less
<bradland> awesome
<erikh> Interrupt is a parent class of the Errno stuff?
<erikh> oh derp
<erikh> f me for not reading
<bradland> i had to use `rescue Errno::EPIPE; nil; end` in the script
<bradland> rescuing Interrupt didn't do the trick
workmad3_ has joined #ruby-lang
Zolrath has joined #ruby-lang
raph_io has joined #ruby-lang
workmad3_ has joined #ruby-lang
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
<rue> bradland: It's ARGF.gets, to be exact.
postmodern has joined #ruby-lang
<bradland> rue: i was wondering about that as well. when gets is called without an explicit class, is it IO.gets or Kernel.gets? I'm guessing Kernel?
<rue> That's correct
<erikh> it'd be IO actually, and I think the Kernel.gets is just a wrapper for $stdin.gets
<erikh> oh
<erikh> really?!
<chris2> yes
<chris2> like <> in perl
<erikh> weird.
<erikh> sure.
<chris2> occasionally
<chris2> when you decide to add command line parameters :P
<bradland> yeah, and you really want your mind blown? Kernel.gets will read from files passed as arguments to the script
<erikh> yeah, I get the ARGF thing.
<chris2> thats the point of ARGF...
<erikh> just was surprised it was Kernel and not IO
<chris2> lots of stuff is in kernel :)
<chris2> test too
<erikh> yeah, I saw some silly bitching about that on the twooter
<chris2> chop :)
<chris2> Available only when -p/-n command line option specified. thats new in 1.9
<erikh> chop is on kernel?
<erikh> huh.
<chris2> yes
Sidertown has joined #ruby-lang
<chris2> chomp too
<judofyr> gsub too
<chris2> yeah
<chris2> sprintf
<savage-> [3] pry(main)> "".method(:chomp).owner
<savage-> => String
<erikh> just surprised I guess
<erikh> I guess they really want ruby -e to be easy
<judofyr> savage-: it's overridden in String
rdavila has joined #ruby-lang
<chris2> putc
<savage-> judofyr: oh wow, good point
<judofyr> savage-: also: echo 1 | ruby -ne'p method(:chomp).owner'
<judofyr> savage-: it's only there for -n and -p
<chris2> that owner must be new too
<savage-> [3] pry(main)> Kernel.instance_methods(false).include?(:chomp)
<savage-> => false
<savage-> oh okay
<chris2> spawn, huh
newOne_german has joined #ruby-lang
<erikh> savage-: I'm pretty sure you want methods and not instance methods
<rue> chris2: There're lots of useful and poorly publicized methods in 1.9
<chris2> yep
<newOne_german> hi hello
<erikh> Process.spawn is amazing
<chris2> write a blog post please
<chris2> erikh: works without Process too :P
<erikh> neat.
<newOne_german> i need some help with ruby on rails and stylesheets
<newOne_german> who can help
<rue> #rubyonrails
<erikh> newOne_german: #rubyonrails is typically the place we send those questions to.
<rue> Old man slow
<erikh> meh
<erikh> I discovered nose hair today
<erikh> ear hair is next. already got a grey beard
<rue> It's all that Perl, arthritis kicking in
<judofyr> why does this print "false", but doesn't raise an error? echo 1 | ruby -ne'p methods.include?(:chomp); chomp'
<erikh> indeed.
nif has joined #ruby-lang
<newOne_german> thanks
<rue> Implicit something or other?
<erikh> judofyr: isn't object implicit and kernel is a static class?
<chris2> its an instance_method
<erikh> oh.
<shevy> today is big ruby confusion day
<erikh> not a bad thing.
<rue> judofyr: Which error were you expecting?
<erikh> learning is good.
<judofyr> chris2: not on self.
<chris2> true
<judofyr> rue: I just assume that when methods.include?(:chomp) returns false (and there's no method_missing magic), just calling "chomp" should give a NoMethodError
hach has joined #ruby-lang
<savage-> judofyr: echo 1 | ruby -ne 'p private_methods.include?(:chomp)' # => true
surfprimal has joined #ruby-lang
<chris2> nice
<judofyr> savage-: oh, #methods don't return private methods? didn't knew that…
<savage-> judofyr: right
<judofyr> but there's public_methods too
<savage-> right
<judofyr> it doesn't make sense that methods is an alias…
<savage-> I can't even find where "methods" is documented
<judofyr> hm…
<savage-> [1] pry(main)> method(:methods).owner
<savage-> => Object
<judofyr> savage-: what version? I get Kernel here
<judofyr> in 1.9.3
<rue> Fascinating world of the Ruby object model
<savage-> 1.9.3 for me
<judofyr> what?
<savage-> crazy!
<judofyr> [3] pry(main)> method(:methods).owner # => Kernel
<shevy> I am on 1.8.7 and I get method(:methods).owner # => Kernel
<savage-> ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
<rue> Kernel in .125
<savage-> judofyr: puts RUBY_DESCRIPTION
<judofyr> ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.2.0]
<savage-> weird
achiu has joined #ruby-lang
<savage-> I _am_ using a patched version of 1.9.3 though for those performance gains
<rue> You two are broken and also why are you out of date?
<shevy> I get Kernel in pry too
<shevy> long live 1.8.7!!!
<judofyr> rue: never really upgraded. at least I'm on 1.9.3…
<judofyr> alright
<judofyr> GOOD NIGHT EVERYBODY
<shevy> no!
<shevy> stay here!
<judofyr> 5% battery
<shevy> hmm
<judofyr> girl friend in bed
<judofyr> so, for once, I think I'm able to disconnect from Freenode without feeling lonely
<judofyr> \o/
QaDeS has joined #ruby-lang
tekin has joined #ruby-lang
<shevy> !!!
<shevy> the Matrix lost another one
musl has joined #ruby-lang
<rhizmoe> guh
<rhizmoe> "target of repeat operator is not specified"
<rhizmoe> google is no help
<rhizmoe> shall I read some source?
<manveru> >> /*/
<manveru> SyntaxError: (irb):1: target of repeat operator is not specified: /*/
<manveru> how about showing the full error? :)
<rhizmoe> sure: target of repeat operator is not specified: /\/(*?)\.png$/
<manveru> well, see the repeat operator?
<manveru> maybe you meant .*? :)
<rhizmoe> yes, it's what i'm trying to snatch.
<rhizmoe> guh. oh crap.
<manveru> File.basename(path, '.png') should work too
<rhizmoe> good point
<Patterner> the configure script of elinks uses “/usr/bin/ruby19 -e 'exit((VERSION or RUBY_VERSION) >= "1.6.0")'” to check if ruby is recent enough…
<Patterner> What would be a better way?
<manveru> Patterner: /usr/bin/env ruby ?
gnufied has joined #ruby-lang
grin has joined #ruby-lang
<shevy> I dont know of a better way than RUBY_VERSION
<Patterner> Ruby 1.8.x works, but 1.9.x dies with “-e:1:in `<main>': uninitialized constant VERSION (NameError)”
<manveru> ah, ok :)
<shevy> checking for 1.6 man that is archaic
<manveru> does it still have to be a oneliner?
heftig has joined #ruby-lang
<drbrain> Patterner: it's RUBY_VERSION these days
<manveru> 1.8 also has RUBY_VERSION
<manveru> but 1.6...
<Patterner> and Rubies < 1.8?
<drbrain> you're unlikely to encounter a 1.6 anymore
<Patterner> (I used eselect to switch to 1.8 before emerging elinks and then back to 1.9)
<manveru> ruby -e 'begin; exit(VERSION >= "1.6.0"); rescue NameError; exit(RUBY_VERSION >= "1.6.0"); end'
<manveru> ruby -e 'exit((begin; VERSION; rescue NameError; RUBY_VERSION; end) >= "1.6.0")'
<Patterner> manveru++
<manveru> ruby -e 'exit((defined?(RUBY_VERSION) ? RUBY_VERSION : VERSION) >= "1.6.0")
<manveru> '
<manveru> not sure you can make that smaller
corundum has joined #ruby-lang
mattyoho has joined #ruby-lang
<Patterner> small is not the primary objective. correctness is :)
<manveru> well, then i think i prefer the last one :)
<manveru> but really, it's 2012, i haven't even needed 1.8 in years
<chris2> ruby -v is too easy?
<zenspider> hah
<manveru> yeah
<Patterner> “819754 Sep 19 2000 ruby-1.6.0.tar.gz” :)
<zenspider> awwww
<zenspider> that takes me back
<erikh> to the year 2000?
<chris2> good days
* Patterner remembers working on Python 1.4 for the Amiga…
<manveru> chris2: ruby -v would still need awk or something :P
* erikh channels andy richter
<manveru> chris2: and String#<=> is guaranteed to compare ruby versions the DWIM way
raph_io has joined #ruby-lang
<chris2> i bet autoconf can compare versions already
<manveru> you think links uses that?
<zenspider> and you can't be sure it's called ruby...
<chris2> thats why you allow overriding of the binary name
<chris2> PCREVERSION=`pcre-config --version`
<chris2> AS_VERSION_COMPARE(${PCREVERSION}, ${CMPV}, [PCRE_POST_8_0=-1], [PCRE_POST_8_0=0],[PCRE_POST_8_0=1])
<erikh> ruby uses pkg-config doesn't it?
* Harzilein intends to forget everything about pre-1.9.1-ruby once 1.8 is no longer default system ruby in debian stable :)
<manveru> wtf is pkg-config
<erikh> it's exactly what you think it is
<manveru> please, no
<erikh> it's pretty nice, at least in cmake-y stuff
<manveru> you even used cmake and nice in a single line
<chris2> erikh: ruby-1.9 is
<erikh> yeah, but you hate C manveru
<Harzilein> pkg-config was a gnome (iirc) invention to supersede all those package specific xyz-config utilities
<erikh> chris2: ah
<chris2> pkg-config once was a small shell script
<Harzilein> instead packages (well, programs/projects) stick .pc-files in a known location
<erikh> apt was a small perl program at one point too
<Patterner> hmm... they stole this ruby detection code from VIM...
<chris2> erikh: openbsd pkg-config still is
<erikh> ha, nice.
<chris2> now, it depends on glib
<chris2> Harzilein: s/a known/one of at least three/
bryancp has joined #ruby-lang
<manveru> hum
<Patterner> and the next line has a nice “puts "#{VERSION rescue RUBY_VERSION}"”…
<manveru> lol
<chris2> heh
srbaker has joined #ruby-lang
<chris2> Patterner: ever coded ruby for elinks btw?
<Patterner> nope
<manveru> wonder why it uses "#{}" though
* chris2 wants tab autosave
Austin__ has joined #ruby-lang
Austin__ has quit [#ruby-lang]
<Patterner> don’t use elinks a lot these days…
* chris2 uses w3m mainly
rdavila has joined #ruby-lang
* manveru uses curl mostly
* Harzilein tried to implement a function until he noticed it's already there
<Harzilein> (elinks-ruby)
* Harzilein even wrote a kazehakase improvement once
Axsuul has joined #ruby-lang
nif has joined #ruby-lang
<shevy> Harzilein hmm why didn't pkg-config replace libtool?
petercooper has joined #ruby-lang
<manveru> nothing ever dies in linux-land
aef has joined #ruby-lang
<zenspider> omg I'm actually enjoying working on ruby_parser again... who knew?!?
Hakon|mbp has joined #ruby-lang
<rue> drbrain knew, but kept it a secret
rdeshpande has joined #ruby-lang
<Harzilein> shevy: uhm, libtool is a compatibility thing for compilers, pkg-config is about decoupling vendor directory policy from the build framework, those are different tasks
<zenspider> he's a jerkface that way
<Harzilein> regarding why nobody sane replacement for libtool took over yet, i can't tell. i like the point in the libtool info file about how they came up with it after they decided that the solution should be elegant.
<Harzilein> s/nobody/no/
akahn has joined #ruby-lang
m3nd3s has joined #ruby-lang
ilyam has joined #ruby-lang
<zenspider> elegant? hahaha
deobald_ has joined #ruby-lang
<shevy> Harzilein libtool breaks because it assumes that .la files are stored in absolute paths
<shevy> if I compile into /bla/ble and then the .la is no longer there where libtool assumes it has to be, the whole .la crap breaks down
<drbrain> shevy: it's simpler than that
<drbrain> libtool breaks because when there's a compile error I have no way to determine which compiler arguments caused the failure
SkramX has joined #ruby-lang
gix has joined #ruby-lang
m3nd3s has joined #ruby-lang
Skif has joined #ruby-lang
WillMars_ has joined #ruby-lang
Skif has joined #ruby-lang
<zenspider> and that draws to conclusion that working on ruby_parser is enjoyable... fuckin' LR grammars suck
rolfb has joined #ruby-lang
m3nd3s_ has joined #ruby-lang
asahi1 has joined #ruby-lang
<asahi1> hello, is there a shorthand way of writing the following? if x.nil?; x = 1; else; x +=1; end
<FiXato|VPS> x = x.nil? ? 1 : x + 1
<zenspider> x ||= 0; x+=1
rushed has joined #ruby-lang
<FiXato|VPS> zenspider's solution looks cleaner ;-)
Rizzle|afk has joined #ruby-lang
<asahi1> ah okay. what does the ||= mean?
<zenspider> "or-equals"
<zenspider> think of it as x = x || 0
fattastic has joined #ruby-lang
<zenspider> just like += means x = x + 1
<asahi1> ah I see. thank you
<zenspider> n/p
benanne has joined #ruby-lang
Rizzle|afk has joined #ruby-lang
<asahi1> got one more question. if I have a hash, how do I find the element with the biggest value, assuming all values are numbers?
codewrangler has joined #ruby-lang
m3nd3s has joined #ruby-lang
<Patterner> hash.values.max
<zenspider> do you want the key of the biggest value? or the biggest value?
<asahi1> the key
jmeeuwen_ has joined #ruby-lang
<asahi1> sorry I wasn't clear
<zenspider> hash.max_by { |k,v| v }.first
<zenspider> you could also do
<zenspider> hash.keys.max_by { |k| hash[k] }
<zenspider> but that does a lot of extra work for no good reason
<asahi1> I see. thanks!
<zenspider> clearer in thought tho
<zenspider> asahi1: ri Enumerable
<zenspider> lots of good stuff in there
<asahi1> to that point, I've got another noob question. ri Enumerable gives me Nothing known about Enumerable. am I just as well off looking at the online docs?
<zenspider> imo it is better to fix the problem so your data is always immediate
<zenspider> gem install rdoc rdoc-data
<zenspider> follow the instructions post-install
<zenspider> or... if you're using rvm... there's something you do there instead
<zenspider> I don't know rvm... it's messy
<asahi1> ahh. yeah I'm using rvm
<asahi1> most install guides i've seen use rvm
<zenspider> meh
<shevy> eww
<shevy> most the time it is like this (1) guy using a distribution based on debian has trouble with ruby (2) RVM is recommended to him, guy uses rvm since that day
<rolfb> anyone familiar with Parslet? having trouble making two rules to match "12345.pdf" => "12345" and ".pdf"
<shevy> imagine if debian wouldn't exist, the RVM guys would have nothing to do anymore!
<zenspider> rolfb: are you really using a parser generator to parse file names?
<asahi1> is osx based on debian?
<zenspider> asahi1: no... but osx ships with ruby so what's the point?
<rolfb> zenspider: YES :)
<zenspider> (it's based on freebsd + nextstep btw)
<rolfb> i have some elaborate filenames
<drbrain> OS X is based on FreeBSD
<zenspider> rolfb: that seems like massive overkill
<rolfb> zenspider: possibly, but the regex version gets rather ugly
<zenspider> it might be ugly, but you'd be done by now
<zenspider> done > pretty
<rolfb> zenspider: experimenting > done
<rolfb> in this case
<manveru> parslet isn't even that pretty :P
<Patterner> OS X is based on Darwin (which is BSDish)
<rolfb> zenspider: other than that i agree
<rolfb> :)
<asahi1> zenspider: sometimes the packages that come with osx are old and need to be upgraded. and rvm seemed to be the path of least resistance ;-)
<zenspider> Patterner: darwin is a fork of nextstep with userland freebsd (and some kernel stuff) thrown on top... apple has employed jordan hubbard for about 8-9 years now
rolfb has joined #ruby-lang
<rolfb> uhm, i lost power
<rolfb> zenspider: either way, matching ".pdf" should be easy?
<drbrain> Patterner: you can see Darwin's FreeBSD heritage from the man pages, like `man mtree`
<zenspider> rolfb: in parselet? I don't have any experience with that
<rolfb> parslet, yes
<rolfb> :)
<zenspider> I do know that you need to be using trunk if you want ANY speed. I don't think he's released any of his optimizations yet
<manveru> rolfb: str('.pdf')
batmanian has joined #ruby-lang
<rolfb> manveru: works if i >> on my expression, thinking i've misunderstood something basic about building up the expression
<manveru> rolfb: no, you need >> if you have more than one
<manveru> but you asked how to match .pdf
<rolfb> manveru: i was more explicit earlier on, but barely. so yes, it did ask how to match .pdf :)
<rolfb> s/it /i /
<manveru> heh
<manveru> well, what more do you need?
<rolfb> manveru: "12345.pdf" to { :integers => "12345", :filetype => ".pdf" } as an example
<rolfb> manveru: simplest solution would be parse(str(12345).as(:integer) >> str(".pdf").as(:filetype))
<rolfb> with "" around those integers :)
<manveru> yeah
<rolfb> i just made different rules and expected them to work in concert
<rolfb> without telling them to
<rolfb> it seems :)
<manveru> well, PEG is all about order
<manveru> that's why it can't ever be ambigous
<zenspider> god I wish I could use a peg
<manveru> ruby syntax is the arch nemesis of peg it seems
<manveru> though i think perl might be worse
<zenspider> perl IS worse... but just barely
<zenspider> it still kills me to this day that the lexer and the parser have to talk to each other
brushbox has joined #ruby-lang
<shachaf> In Ruby?
<zenspider> yup
<rolfb> zenspider: the comment about optimizations in trunk was for me?
<zenspider> rolfb: yes
<rolfb> ok
<rolfb> thanks
retro|cz has joined #ruby-lang
urbanmonk has joined #ruby-lang
urbanmonk has joined #ruby-lang
t has joined #ruby-lang
savage-_ has joined #ruby-lang
pandora17 has joined #ruby-lang
apeiros_ has joined #ruby-lang
Boohbah has joined #ruby-lang
drumond19 has joined #ruby-lang
nofxxx has joined #ruby-lang
mackk has joined #ruby-lang
<andrewvos> MWUAHAHAHAH https://twitter.com/#!/ForFill1000
<andrewvos> Wish I could somehow get paid for these things.
<drbrain> andrewvos: :D
<drbrain> that was almost worth waiting the 30s it takes twitter to load on coffee-shop wifi
gsav has joined #ruby-lang
replore has joined #ruby-lang
srbartlett has joined #ruby-lang
<andrewvos> hahaha
<drbrain> it was a close thing, I enjoy such bots
<andrewvos> It's the best for me, because I get all the angry reply emails in the morning.
<shevy> "I want my office to be quiet. The loudest thing in the room ? by far ? should be the occasional purring of the cat"
<shevy> anyone here has a very loud cat? we should send that to him
<andrewvos> haha
justinmcp has joined #ruby-lang
Joeysomo has joined #ruby-lang
<lianj> hearing loss brings back desktop pcs
felipe__ has joined #ruby-lang
z3r00ld has joined #ruby-lang
rdeshpande has joined #ruby-lang
kyrylo_ has joined #ruby-lang
kyrylo_ has joined #ruby-lang
<z3r00ld> hi, i have to ssh 100-1000 machines and want to use multithreading, any good document reference or rubygem i can use to do this parallely
<zenspider> shevy: oh god do I ... one of my fosters is a fucking yowler
<zenspider> aren't there tools that solve this problem already?
tr-808 has joined #ruby-lang
<z3r00ld> zenspider: if its for me, i want to integtate it in ruby code, not like another shell script, but pls let me know if any rubygem exists, i know pdsh is one tool
<lianj> net/ssh?
seanstickle has joined #ruby-lang
<andrewvos> parallely
<apeiros_> and? net/ssh should work fine in threads.
<lianj> what a myth
<apeiros_> afaik it doesn't share global state…
<lianj> apeiros_: i mean andrewvos :)
<apeiros_> lianj: me too :)
<shevy> we all do!
<apeiros_> it read to me like it was "lianj: use net/ssh; andrewvos: no, don't use net/ssh if you want to do it parallely. it won't work in parallel".
slyphon has joined #ruby-lang
<andrewvos> I was merely commenting on the word "parallely"
<shevy> parallely
<lianj> waaah
<apeiros_> o0
<apeiros_> repeating a word is commenting it? fun :)
<apeiros_> was
<savage-_> apeiros_: how's poland?
<apeiros_> savage-_: nice, so far. pretty inexpensive.
<savage-_> apeiros_: sweet!
<apeiros_> but I'm not seeing much of it.
<apeiros_> will change sat-mon
<savage-_> apeiros_: btw, did you see my most recent project? https://github.com/ryanlecompte/redis_failover
<savage-_> apeiros_: awesome, hope railsberry has been fun. i'm seeing the slides that people are posting.
<apeiros_> savage-_: not using redis, hence no, didn't.
<apeiros_> yeah, railsberry so far is good. they could/should learn a trick or two from railsconf, though
<savage-_> apeiros_: oh no worries, for some reason I thought you guys were using it.
<apeiros_> e.g. having a single entry for ~500ppl == bad idea
<apeiros_> *entrance
<savage-_> apeiros_: haha :-) are you hearing a lot of polish?
<savage-_> apeiros_: or is the primary language there english?
<apeiros_> savage-_: oh, yeah, maybe because I experimented with it for some autocompletion thingy
<apeiros_> english and swiss german
<apeiros_> found a good dozen eidgenossen :D
<savage-_> haha, sweet :-)
<apeiros_> but I'll not go to a conf alone again. it's stupid.
<apeiros_> you need somebody to bounce what you've heard.
<apeiros_> I never realized that before.
<apeiros_> (or: I need …)
WillMars_ has joined #ruby-lang
snafoo has joined #ruby-lang
snafoo has joined #ruby-lang
<savage-_> hehe, but I guess you could always make new friends and head off to the dinners, after parties, etc.
<apeiros_> savage-_: you go to any conf this year?
<apeiros_> savage-_: yeah, still getting off that stupid med. doesn't put me in the mood :(
<savage-_> apeiros_: i have never been to a ruby/rails conf before :-(
<savage-_> I promised myself to go to rubyconf though next year.
<apeiros_> :) ok
<savage-_> I have only been doing ruby for about 5 months.
<savage-_> but I really gotta go to one.
<apeiros_> sure? I thought I'd seen you here for longer…
<drbrain> savage-_: RubyConf is good, so are the local conferences
<apeiros_> but maybe I'm confusing nicks…
<savage-_> apeiros_: wait, 7 months now.
<savage-_> yes, 7 months.
<savage-_> drbrain: cool. I am going to a local SF ruby meetup tonight though.
mbriggs has joined #ruby-lang
<zenspider> yay! < 600 lines o diff between ruby_parser and 1.9's parser! :(
<andrewvos> zenspider: Context?
qpingu has joined #ruby-lang
mbriggs has joined #ruby-lang
<drbrain> savage-_: awesome
<zenspider> how to answer that? that has context
<andrewvos> no_idea_dog.jpg
<zenspider> drbrain: do you think for syntax removals (do's colon) we should have a negative test?
<erikh> savage-_: went to carbon five's hackfest last night, it was pretty good
<zenspider> god there is a lot of stupid shit in mri's parser. they "refactored" a bunch of stuff for no good reason
<savage-_> erikh: omglol you're in sf?
<erikh> in silicon valley
<savage-_> erikh: ah sweet
<erikh> so not that far away.
<savage-_> that's great!
<savage-_> erikh: i've never gone to one of those hackfests before.
<erikh> yeah, like 60 people there, hacking like crazy
<erikh> it was pretty wild.
<savage-_> erikh: are you going to this tonight? http://www.meetup.com/SFRails/events/55416322/?a=co1_grp&rv=co1
<erikh> nah. I need to space my time out
<erikh> caltrain is a bit of a trek.
<erikh> I'm in menlo park to be precise.
<savage-_> oh wow, yeah that's a bit far.
<savage-_> i just moved here about 4 months ago from Boston.
<savage-_> it's pretty cool
<andrewvos> Whoa I was in Menlo Park last year
<andrewvos> Anyway bedtime peace
<erikh> cool. I moved out here from philly myself.
<erikh> about a year ago.
achiu has joined #ruby-lang
chendo_ has joined #ruby-lang
heftig has joined #ruby-lang
nofxxx has joined #ruby-lang