Topic for #ruby-lang is now Ruby 1.9.3p0: http://ruby-lang.org | Paste >3 Lines of Text on http://pastie.org
Tick-Tock [Tick-Tock!~Tick-Tock@lunari.us] has joined #ruby-lang
* muzone is now playing: Muzone - Call Girl (http://home.no/mritz/Untitled.mp3)
<wallerdev> muzone: might want to turn that off
Banistergalaxy [Banistergalaxy!~AndChat@222.153.223.44] has joined #ruby-lang
<muzone> sorry about that!
<lianj> too late, kitten died
<any-key> :(
Kero [Kero!~kero@31-151-127-178.dynamic.upc.nl] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@46.118.236.196] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@subtle/user/kyrylo] has joined #ruby-lang
crudson [crudson!~doug@c-67-171-219-209.hsd1.or.comcast.net] has joined #ruby-lang
<rue> No worries, I'm playing some Dylan. That should take care of resuscitating the kitten
brownies [brownies!~brownies@unaffiliated/brownies] has joined #ruby-lang
Jarred [Jarred!~Administr@c-71-198-139-210.hsd1.ca.comcast.net] has joined #ruby-lang
Dreamer3 [Dreamer3!~Dreamer3@74-134-34-116.dhcp.insightbb.com] has joined #ruby-lang
<andrewvos> Whoa what's going on here
SpyvSpy [SpyvSpy!~SpyvsSpy@66.165.126.130] has joined #ruby-lang
crassus [crassus!u4275@gateway/web/irccloud.com/x-mitovlurhrfgezjw] has joined #ruby-lang
aarkerio [aarkerio!~aarkerio@201.141.63.148] has joined #ruby-lang
Kero [Kero!~kero@31-151-127-178.dynamic.upc.nl] has joined #ruby-lang
<aarkerio> hi! in : if !news_object.save
<aarkerio> what "!" means?
<aarkerio> if not?
<Kero> not
<bougyman> not
<aarkerio> cool!
<aarkerio> thanks
livinded [livinded!~lolwut@pool-108-23-242-132.lsanca.fios.verizon.net] has joined #ruby-lang
slyphon [slyphon!~weechat@unaffiliated/slyphon] has joined #ruby-lang
<Kero> ruby allows you to write "if not news_object.save" as well, which I usually do, because I find it easier to read
<slyphon> injekt: hey, slop question
<slyphon> injekt: usually i like long-opts to have hyphens instead of underscores, but that sucks on the ruby side for obvious reasons
<lianj> Kero: dislike unless?
<slyphon> injekt: how would you feel about a parse option that did that transformation?
<rue> Kero: Where you been?
<Kero> lianj: sometimes :)
<rue> aarkerio: Also, yeah, that'd usually be unless news_object.save
<shevy> "if not" reads easier because if is very straightforward and does not require the brain to rethink the model
<slyphon> i prefer unless to "if not", but not unless/else/end
neoesque [neoesque!~neoesque@210.59.147.232] has joined #ruby-lang
<rue> What's that one rule called, that you should always have the terminating case as the default so as to not accidentally pass something through?
<slyphon> the Hound of the Baskervilles?
<shevy> the rule of default returning?
<Kero> in this particular case, I would probably even do "saved = news_object.save; if not saved ..."
<rue> To use a poor example, if user.save?; blah; else; meh; end rather than if !user.save?; meh; else; blah; end
<slyphon> yes
<slyphon> you put the expected action first
<shevy> the if without "!" reads easier to my poor old brain
<Kero> rue: mostly not watching this channel :)
<shevy> !!!
<rue> slyphon: Not the expected, as such. Basically you don't want user.save? failing (or succeeding) in some unexpected way to trigger the wrong case
<Kero> can not even call it lurking...
<rue> Again, poor example.
<shevy> Kero.exit!!!
<shevy> I want method names with multiple !!!
<slyphon> rue: uhmmm
<shevy> the more !, the more important their actions are
<drbrain> Kernel.exit!!!true
<lianj> if !u.save!
<slyphon> rue: so just "sufficient paranoia"?
<slyphon> y_u_no_save?
<drbrain> yeah, that works
<shevy> hehe ... never seen !u.save! before actually :)
<slyphon> h
<slyphon> m
<slyphon> usually ! methods don't return useful values though
<Kero> rue: and even now, I just saw a simple Q right after rebooting. bed-time, too. Would it help if I promise to be back soon?
* slyphon may not have qualified that statement enough
<drbrain> slyphon: Rails makes its own rules
<rue> Kero: Slightly, you've lots of time to make up for!
<slyphon> drbrain: ok, but in non-DHH-distortion-field-ville
<slyphon> where databases use transactions and concurrency problems actually exist
<Kero> rue: I know. and done things with Java, Javascript and C, too...
<drbrain> s/ville/empire/
<slyphon> fuck DHH
<slyphon> fuck him *and* his fucking hair
<shevy> lol
* slyphon has had an AWESOME day
<Kero> no, I'd rather not f him.
<slyphon> brb, gotta finish putting the boy to sleep
<shevy> admit it!
<shevy> deep inside we all want to Kero!
<Kero> ttyl
jbsan_ [jbsan_!~jbsan@c80-216-213-130.bredband.comhem.se] has joined #ruby-lang
href_ [href_!~self@ec2-176-34-206-227.eu-west-1.compute.amazonaws.com] has joined #ruby-lang
piglop_ [piglop_!~piglop@del63-1-82-243-95-115.fbx.proxad.net] has joined #ruby-lang
bastlfreenode [bastlfreenode!bastl@ve621924175.ihrserver.de] has joined #ruby-lang
gentz_ [gentz_!ilab@72.20.41.70] has joined #ruby-lang
mtkd_ [mtkd_!znc@209-20-90-74.slicehost.net] has joined #ruby-lang
srbaker_ [srbaker_!~srbaker@184.66.82.213] has joined #ruby-lang
devn_ [devn_!~devn@rot13.pbqr.org] has joined #ruby-lang
jhchabra1 [jhchabra1!~jh@bne75-11-88-189-148-57.fbx.proxad.net] has joined #ruby-lang
spleeze [spleeze!~Spleeze@173-15-131-114-BusName-Philadelphia.hfc.comcastbusiness.net] has joined #ruby-lang
jaska__ [jaska__!jaska@f948.ip11.netikka.fi] has joined #ruby-lang
zumbi_ [zumbi_!~zumbi@77.230.237.25] has joined #ruby-lang
lele` [lele`!~lele@fangorn.windmill.it] has joined #ruby-lang
samuelkadolph_ [samuelkadolph_!~samuelkad@unaffiliated/samuelkadolph] has joined #ruby-lang
jxie [jxie!~jxie@115.198.161.223] has joined #ruby-lang
plusk [plusk!~plusk@201-34-214-235.gnace703.dsl.brasiltelecom.net.br] has joined #ruby-lang
zigidias_ [zigidias_!~zigidias@75.126.182.129-static.reverse.softlayer.com] has joined #ruby-lang
jarib_ [jarib_!~jarib@109.74.192.179] has joined #ruby-lang
tomzx [tomzx!~tomzx@dsl-156-68.aei.ca] has joined #ruby-lang
zigidias [zigidias!~zigidias@unaffiliated/zigidias] has joined #ruby-lang
aarkerio [aarkerio!~aarkerio@201.141.63.148] has quit ["Leaving"]
masterkorp [masterkorp!~masterkor@static.34.107.46.78.clients.your-server.de] has joined #ruby-lang
EvilJStoker [EvilJStoker!jstoker@unaffiliated/jstoker] has joined #ruby-lang
kmmndr [kmmndr!~tomtom@bro67-2-82-227-110-8.fbx.proxad.net] has joined #ruby-lang
turboladen [turboladen!~kvirc@12.104.148.2] has joined #ruby-lang
ramonmaruko [ramonmaruko!~marco@122.52.126.66] has joined #ruby-lang
cyri_ [cyri_!~cyri_@jem75-1-87-88-118-80.dsl.sta.abo.bbox.fr] has joined #ruby-lang
dv310p3r [dv310p3r!~dv310p3r@c-98-203-41-91.hsd1.fl.comcast.net] has joined #ruby-lang
plusk [plusk!~plusk@201-34-214-235.gnace703.dsl.brasiltelecom.net.br] has quit ["Leaving"]
spuk [spuk!~spuk@187.65.185.104] has joined #ruby-lang
Caius [Caius!~Caius@about/apple/macbookpro/Caius] has joined #ruby-lang
<andrewhl> if I have a string with letters and spaces, and I want to convert all the spaces to +s, how would I do that?
<drbrain> gsub
RomyEatsDrupal [RomyEatsDrupal!~stickycak@cpe-67-247-12-233.nyc.res.rr.com] has joined #ruby-lang
<andrewhl> ok thanks
Jarred [Jarred!~Administr@c-71-198-139-210.hsd1.ca.comcast.net] has joined #ruby-lang
<drbrain> ri String#gsub will get you started, if you can't get something to work, paste where you've gotten to and we can help more
<drbrain> -"ten to" # well that was clumsy wording
guns [guns!~guns@c-98-228-72-208.hsd1.il.comcast.net] has joined #ruby-lang
RomyEatsDrupal [RomyEatsDrupal!~stickycak@NYUFGA-WLESSAUTHCLIENTS-01.NATPOOL.NYU.EDU] has joined #ruby-lang
<andrewhl> gsub works, but I need a slight adjustment
krz [krz!~foobar@unaffiliated/krz] has joined #ruby-lang
<andrewhl> there are occasionally spaces at the end of the string, and I want to skip/remove those
<bougyman> .chomp it
<drbrain> see String#strip
<bougyman> or strip, i meant, woops
<andrewhl> chomp is cool
<drbrain> newlines are for chomps!
<andrewhl> but yes, strip seems to be the right method
<bougyman> because it is
looopy [looopy!~looopy@pool-141-156-50-23.washdc.btas.verizon.net] has joined #ruby-lang
RomyEatsDrupal [RomyEatsDrupal!~stickycak@rrcs-69-193-183-238.nyc.biz.rr.com] has joined #ruby-lang
darkf_ [darkf_!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
m0nki3 [m0nki3!~c0wCr@gateway/tor-sasl/m4tastati] has joined #ruby-lang
brianpWins [brianpWins!~brianpWin@S01060014bf8930ea.vc.shawcable.net] has joined #ruby-lang
<m0nki3> \quit
m0nki3 [m0nki3!~c0wCr@gateway/tor-sasl/m4tastati] has quit ["Leaving"]
darkf_ [darkf_!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
JackNorris [JackNorris!~JackNorri@92.48.86.35] has joined #ruby-lang
ujihisa [ujihisa!~ujihisa@96.49.96.171] has joined #ruby-lang
cynosure [cynosure!~cynosure@centrumnet.hu] has joined #ruby-lang
lantins [lantins!~lantins@mx0.lividpenguin.com] has joined #ruby-lang
<shevy> sexy_girl = SexyGirl.new ' whaaaaa....'; sexy_girl.strip!
esufan [esufan!~nekid@c-24-6-170-1.hsd1.ca.comcast.net] has joined #ruby-lang
<esufan> how do I keep the prompt open after program exectures
<esufan> executes
<wallerdev> depends on your IDE
<wallerdev> but you can add "gets" to the end to wait for user input
<wallerdev> which will keep your prompt open
<rue> esufan: If it's windows, I think rubyw might? Or open a prompt first
<rue> Dunno if there's even a rubyw nowadays
<rue> What's the proper negation of anymore?
<wallerdev> nevermore
<wallerdev> lol
<rue> Any longer?
<wallerdev> yeah thats close enough
<wallerdev> i don't think theres one word for it
setmeaway [setmeaway!stemearay@118.45.149.247] has joined #ruby-lang
S2kx [S2kx!~S1kx@ip-95-223-80-198.unitymediagroup.de] has joined #ruby-lang
takaokouji [takaokouji!~takaokouj@2001:268:306:1:225:bcff:fedc:e1fe] has joined #ruby-lang
RubyHead [RubyHead!~rubyhead@pool-98-109-5-109.nwrknj.fios.verizon.net] has joined #ruby-lang
ryez [ryez!81c0c418@gateway/web/freenode/ip.129.192.196.24] has joined #ruby-lang
JackNorris [JackNorris!~JackNorri@92.48.86.35] has joined #ruby-lang
cynosure [cynosure!~cynosure@centrumnet.hu] has joined #ruby-lang
<shevy> if it would be ruby code
<shevy> ! anymore
<shevy> should do the trick!
queequeg1 [queequeg1!~chatzilla@c-71-202-152-67.hsd1.ca.comcast.net] has joined #ruby-lang
looopy_ [looopy_!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
SuperTaz_work [SuperTaz_work!~supertaz_@38.99.52.59] has joined #ruby-lang
Banistergalaxy [Banistergalaxy!~AndChat@222.153.223.47] has joined #ruby-lang
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
wallerdev [wallerdev!~wallerdev@72.44.102.30] has joined #ruby-lang
jacobwg [jacobwg!~jacobwg@157.sub-75-222-119.myvzw.com] has joined #ruby-lang
slaytani1 [slaytani1!~slaytanic@host226.190-31-167.telecom.net.ar] has joined #ruby-lang
<shevy> is there an easy way to turn this case menu http://pastie.org/3176255 into a hash? I would like to store that hash in a yaml file then
livinded [livinded!~lolwut@pool-108-23-242-132.lsanca.fios.verizon.net] has joined #ruby-lang
<stderr-> Have any emacs users used flymake in conjunction with bundle exec and/or rvm for a buffer contextual ruby executable?
igotnolegs [igotnolegs!~igotnoleg@75-162-83-166.slkc.qwest.net] has joined #ruby-lang
RomyEatsDrupal [RomyEatsDrupal!~stickycak@rrcs-69-193-183-238.nyc.biz.rr.com] has joined #ruby-lang
slaytanic [slaytanic!~slaytanic@host226.190-31-167.telecom.net.ar] has joined #ruby-lang
x0F_ [x0F_!~x0F@unaffiliated/x0f] has joined #ruby-lang
dr0id [dr0id!~andy@unaffiliated/dr0id] has joined #ruby-lang
SuperTaz_work [SuperTaz_work!~supertaz_@38.99.52.59] has joined #ruby-lang
SuperTaz_work [SuperTaz_work!~supertaz_@38.99.52.59] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@46.118.236.196] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@subtle/user/kyrylo] has joined #ruby-lang
rippa [rippa!~splitta@85.158.54.234] has joined #ruby-lang
<andrewhl> I'm getting the error mentioned on this page, using open-uri. Is there any way around it? http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/102527
<andrewhl> is this a google thing?
darkf [darkf!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
gnufied [gnufied!~gnufied@122.172.224.153] has joined #ruby-lang
lantins [lantins!~lantins@mx0.lividpenguin.com] has joined #ruby-lang
imperator [imperator!~Daniel@63-225-247-192.hlrn.qwest.net] has joined #ruby-lang
Pip [Pip!~Pip@176.214.13.82] has joined #ruby-lang
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
SuperTaz_work [SuperTaz_work!~supertaz_@38.99.52.59] has joined #ruby-lang
kitallis [kitallis!~kitallis@122.172.248.47] has joined #ruby-lang
RomyEatsDrupal [RomyEatsDrupal!~stickycak@cpe-69-203-115-155.nyc.res.rr.com] has joined #ruby-lang
gianlucadv [gianlucadv!~gianlucad@host61-81-dynamic.245-95-r.retail.telecomitalia.it] has joined #ruby-lang
yumike [yumike!~yumike@213.154.168.130] has joined #ruby-lang
<erikh> google does that with their search results
<erikh> open-uri can take a hash of options, although I'd have to do a source dive to find out how to specify them
<erikh> I have some code around here that does it
<erikh> at least sometime this month I did something resemblingt hat
<erikh> ah I see
<erikh> just specifying an unrecognized option makes it a header
<erikh> andrewhl: ^^
<andrewhl> hmm
<erikh> so open(uri, "User-Agent" => "MSIE bla bla")
<andrewhl> oh, very cool
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
<andrewhl> what are valid user agents? Is there a list somewhere?
<RomyEatsDrupal> hi...
<RomyEatsDrupal> anyone in this room hear of Hungry Academy?
darkf [darkf!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
kylemcgill [kylemcgill!~kylemcgil@static-ip-202-90-56-14.watchdog.net.nz] has joined #ruby-lang
<esufan> is there a fast way to get the directory of a file open in a folder?
<crassus> RomyEatsDrupal: yeah why
<RomyEatsDrupal> crassus: i wonder if thy are changing the program
<RomyEatsDrupal> at first they wrote 5 months, and then 'you may be offered a position here'
<imperator> esufan, not sure what you mean exactly; if you just want the directory of a file, File.dirname
<RomyEatsDrupal> then i saw they had changed that to '18 month commitment required post acadmey'
savage- [savage-!~savage-@c-67-180-11-89.hsd1.ca.comcast.net] has joined #ruby-lang
<esufan> C:\x\x\x\x\x\
<crassus> RomyEatsDrupal: that was all there before
<esufan> i want co copy
<crassus> and besides, the application date has passed
<esufan> and say cd
<esufan> cd
<esufan> cd \x\x\x\x
<imperator> esufan, Dir.chdir(File.basename(dir)) - like that?
<RomyEatsDrupal> crassus no, it had said '5 months, and then you may be offered a position here'
<imperator> er, File.dirname(file)
<crassus> right, and part of that offer means signing on for 18 months with them, if you get offered even
<RomyEatsDrupal> crassus: yes, i already submitted my application. but after the program i wanted to be able to go back to New York instead of being trapped in DC
* imperator looks up hungry academy
<crassus> well, America is the land of at-will employment RomyEatsDrupal, no-one's gonna chain you to a desk ;)
hallucinations [hallucinations!~hallucina@111.93.148.118] has joined #ruby-lang
<crassus> imperator: salve
<imperator> crassus, heard the persians got ya
<crassus> only my head
<RomyEatsDrupal> crassus: i hope so. one of my friends said there might be substantial legal issues if one doesn't follow through with the commitment or leave early
<crassus> RomyEatsDrupal: maybe you want to ask in #startups, there's probably people who've applied there
dfr|mac [dfr|mac!~dfr|work@ool-18baf7e7.dyn.optonline.net] has joined #ruby-lang
dreinull [dreinull!~dreinull@ip-78-94-220-161.unitymediagroup.de] has joined #ruby-lang
<shevy> so I have a time object ... like Wed Jan 04 05:49:12 0000 2012
<shevy> how to easily fetch just the "05:49" part?
<shevy> oh wait
<shevy> got it
<shevy> .strftime works
<shevy> x.strftime "%H:%M"
ovnimancer [ovnimancer!~anton@212.59.96.38] has joined #ruby-lang
hallucinations [hallucinations!~hallucina@111.93.148.118] has joined #ruby-lang
JackNorris [JackNorris!~JackNorri@92.48.86.35] has joined #ruby-lang
cynosure [cynosure!~cynosure@centrumnet.hu] has joined #ruby-lang
<shevy> anyone knows offhand... how to use a Range object in yaml?
esufan [esufan!~nekid@c-24-6-170-1.hsd1.ca.comcast.net] has joined #ruby-lang
<shevy> oh
<shevy> I guess I can write this in irb, then save it into yaml and have a look
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
<shevy> for anyone curious, this is how 1..100 looks in yaml: http://pastie.org/3176700
<shevy> whatever the "excl" means
<rippa> shevy: excl is 1...100
<rippa> exclusive/inclusive
<shevy> ah
<shevy> makes sense
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
JackNorris [JackNorris!~JackNorri@92.48.86.35] has joined #ruby-lang
|Vargas| [|Vargas|!~luke@pdpc/supporter/profesional/vargas] has joined #ruby-lang
gianlucadv [gianlucadv!~gianlucad@109.53.190.170] has joined #ruby-lang
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
JohnBat26 [JohnBat26!~Eugene@89.175.77.79] has joined #ruby-lang
dhruvasagar [dhruvasagar!~dhruvasag@65.98.79.137] has joined #ruby-lang
thrcka [thrcka!~thrcka@ip-89-102-34-33.net.upcbroadband.cz] has joined #ruby-lang
esufan [esufan!~nekid@c-24-6-170-1.hsd1.ca.comcast.net] has joined #ruby-lang
<esufan> is it practical to do all my ruby/rails on vmware lion osx
<esufan> or fucking ridiculous
michael_mbp [michael_mbp!~Marin@31.203.206.19] has joined #ruby-lang
solars [solars!~solars@194.208.132.118] has joined #ruby-lang
mytrile [mytrile!~mytrile@94.26.28.135] has joined #ruby-lang
Locke23rus [Locke23rus!~quassel@188.162.162.83] has joined #ruby-lang
tla [tla!~tla@toelboell-lund.dk] has joined #ruby-lang
ianvaughan [ianvaughan!~chatzilla@host109-145-182-81.range109-145.btcentralplus.com] has joined #ruby-lang
thone [thone!~thone@g225087180.adsl.alicedsl.de] has joined #ruby-lang
ovnimancer [ovnimancer!~anton@212.59.96.38] has quit [#ruby-lang]
<Harzilein> uhm
<Harzilein> is it not possible to break on things that are not yet defined in ruby-debug?
<Harzilein> (ruby-debug19)
Jade [Jade!~jade@unaffiliated/jade] has joined #ruby-lang
<masterkorp> time for C today :D
ksinkar [ksinkar!~ksinkar@115.242.78.105] has joined #ruby-lang
frangiz [frangiz!~frangiz@user26.77-105-206.netatonce.net] has joined #ruby-lang
WillMarshall [WillMarshall!~willmarsh@203.118.179.237] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@46.118.236.196] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@subtle/user/kyrylo] has joined #ruby-lang
roadkith [roadkith!~kith@unaffiliated/kith] has joined #ruby-lang
thrcka [thrcka!thrcka@nat/redhat/x-znonfqnagwlkyert] has joined #ruby-lang
tychobrailleur [tychobrailleur!~sebastien@176.61.72.130] has joined #ruby-lang
robbyoconnor [robbyoconnor!~wakawaka@guifications/user/r0bby] has joined #ruby-lang
cyri_ [cyri_!~cyri_@236.200.72.86.rev.sfr.net] has joined #ruby-lang
gianlucadv [gianlucadv!~gianlucad@2.197.146.112] has joined #ruby-lang
alexeyKolosov [alexeyKolosov!~quassel@www.zbku.ru] has joined #ruby-lang
yxhuvud [yxhuvud!mongo@h-176-10-225-154.na.cust.bahnhof.se] has joined #ruby-lang
michael_mbp [michael_mbp!~Marin@149.147.102.32] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@46.118.236.196] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@subtle/user/kyrylo] has joined #ruby-lang
WillMarshall [WillMarshall!~willmarsh@203.118.179.237] has joined #ruby-lang
companybot [companybot!~companybo@login1.powertech.no] has joined #ruby-lang
uniqanomaly [uniqanomaly!~ua@dynamic-78-8-81-252.ssp.dialog.net.pl] has joined #ruby-lang
<manveru> hmm
<manveru> relativity breaks down if you to_yaml it
<jaska> einstein was wrong?
<manveru> >> DayTime.new(5, 49).to_yaml
<manveru> => "--- !ruby/object:DayTime\nseconds_since_start: !ruby/object:BigDecimal {}\n"
<manveru> wow, that gem is awful
<manveru> def nano_seconds
<manveru> Integer((@seconds_since_start % 1) * 1000000000)
<manveru> one wtf after another
molgrew [molgrew!~bozo20@85.182.139.18] has joined #ruby-lang
<manveru> why is that using BigDecimal anyway, he's never using decimal
<manveru> time for some hardcore forking action
<yorickpeterse> "elsif version.to_str.starts_with? '1.1.3'" the fuck is this shit
<manveru> :P
<manveru> does anyone know what that silly Guardfile stuff is?
<manveru> :q
<yorickpeterse> Eh, it's some test tool if I believe
kitallis [kitallis!~kitallis@122.172.248.47] has joined #ruby-lang
thrcka [thrcka!~thrcka@ip-89-102-34-33.net.upcbroadband.cz] has joined #ruby-lang
<manveru> what was the gem to control time again?
<manveru> ah, timecop
gnufied [gnufied!~gnufied@122.172.224.153] has joined #ruby-lang
dc5ala [dc5ala!~dc5ala@stgt-5f70c875.pool.mediaWays.net] has joined #ruby-lang
jasox [jasox!~jasox@178.239.26.139] has joined #ruby-lang
<manveru> maybe time-warp is nicer
enikar [enikar!~gil@cl-140.mrs-01.fr.sixxs.net] has joined #ruby-lang
davidw [davidw!~davidw@host228-251-static.95-94-b.business.telecomitalia.it] has joined #ruby-lang
shevy [shevy!~shevy@194-166-29-132.adsl.highway.telekom.at] has joined #ruby-lang
ovnimancer [ovnimancer!~anton@212.59.96.38] has joined #ruby-lang
ovnimancer [ovnimancer!~anton@212.59.96.38] has quit [#ruby-lang]
ryez [ryez!81c0c418@gateway/web/freenode/ip.129.192.196.24] has joined #ruby-lang
zmack [zmack!~zmack@78.97.143.6] has joined #ruby-lang
uniqanomaly [uniqanomaly!~ua@dynamic-78-8-82-230.ssp.dialog.net.pl] has joined #ruby-lang
<yorickpeterse> There we go, pull request sent. Now lets hope this redmine plugin author is still active (last commit was in May :[)
ryez [ryez!81c0c418@gateway/web/freenode/ip.129.192.196.24] has joined #ruby-lang
<ddfreyne> i don't have enough time to handle all the pull requests and issues that i get :(
<ddfreyne> nor all the mailing list messages
<ddfreyne> it's frustrating
<yorickpeterse> I'd be happy to get any at all :)
hallucinations1 [hallucinations1!~hallucina@111.93.148.118] has joined #ruby-lang
<ddfreyne> hehe
<ddfreyne> it also tends to get a bit tedious since i don't get paid for it (apart from the occasional donation)
<ddfreyne> and i'd have to spend a lot of time handling issues and pull requests
<ddfreyne> 74 threads (not messages) in my inbox, and that's for nanoc only (not my general inbox)
<ddfreyne> i'd need a few fulltime days to go through all that
zmack_ [zmack_!~zmack@78.97.129.28] has joined #ruby-lang
zmack [zmack!~zmack@78.97.143.6] has joined #ruby-lang
robgleeson [robgleeson!~rob@subtle/contributor/robgleeson] has joined #ruby-lang
rippa [rippa!~splitta@85.158.54.234] has joined #ruby-lang
crudson [crudson!~doug@c-67-171-219-209.hsd1.or.comcast.net] has quit [#ruby-lang]
<yorickpeterse> jezus
gianlucadv [gianlucadv!~gianlucad@rna.bio.disco.unimib.it] has joined #ruby-lang
WillMarshall [WillMarshall!~willmarsh@203.118.179.237] has joined #ruby-lang
<rue> ddfreyne: Time to pass on maintainership?
<ddfreyne> rue: nope, I still work on it, but I just can't cope with the volume of community related work
<ddfreyne> still, a second maintainer would be useful
<josh9> how to delete elements from array and save the deleted elements while doing it? b = a.delete_if{|num| num == 2 } set both a and b to the array without the elements.
<josh9> and reject! is the same
<manveru> josh9: partition
<manveru> >> [1,1,2,2,3,3].partition{|e| e == 2 }
<manveru> => [[2, 2], [1, 1, 3, 3]]
<rue> Need to reassign, then, but it's better than doing a #reject + #reject! or something…
<manveru> yeah, it's not destructive
<rue> Or I suppose. #dup.select might too?
<rue> s/
<josh9> manveru: partition looks great!
<manveru> well, you can implement partition with select by running it twice and inverting the condition... but that's neither concise nor fast
<rue> Same problem as #reject, yes
<manveru> so yeah, you could do it with inject in one pass... but that would look quite mind-bending
<rue> Damn it, I'm still not used to this FI layout keyboard. It's got a small enter key, so \, | is where enter normally is on a US keyboard, and the left shift is small, with ~ next to it instead of top left
<rue> #partition is indeed probably the clearest
<manveru> >> [1,1,2,2,3,3].each_with_object([[],[]]){|e,(i,o)| e == 2 ? i << e : o << e }
<manveru> => [[2, 2], [1, 1, 3, 3]]
RomD [RomD!~Roman@nrbg-d9322fd4.pool.mediaWays.net] has joined #ruby-lang
<manveru> now i'm down to writing code i hate myself :)
<rue> I think a better solution would probably be to have a method for that
<rue> Or repurpose Array#delete_if since it's not bound by Enumerable
<manveru> for what?
<rue> To return the deleted items
<manveru> nah
<manveru> >> deleted = []; arr = [1,1,2,2,3,3].reject!{|e| deleted << e if e == 2 }; [deleted, arr]
<manveru> => [[2, 2], [1, 1, 3, 3]]
<manveru> that's hardly worth making a new method for
<rue> Well, the thing is, #delete_if and #reject! are the same except the latter can return nil; instead of that duplication, it might be useful to support this case instead
<rue> It could be useful in a queue-type situation where you e.g. want to do something final with the removed elements. You can do it manually, sure
<josh9> manveru: very nice implementation of partition!
Spooner [Spooner!~Miranda@host-78-144-139-130.as13285.net] has joined #ruby-lang
tekin [tekin!~tekin@cpc8-with5-2-0-cust208.1-4.cable.virginmedia.com] has joined #ruby-lang
havenn [havenn!~skipper@pool-72-67-31-69.lsanca.fios.verizon.net] has joined #ruby-lang
<manveru> don't use the time-warp gem if you want nanosecond precision
<havenn> If anyone has any advice or direction on refactoring, I'd love to get feedback!: https://gist.github.com/1605450
<havenn> **I've gotten pawn and knight rules mostly working, still a work in progress** >.>
<andrewvos> mumble tdd mumble mumble
<robgleeson> havenn: too much code for a quick review :)
<havenn> aye, and TDD fail. Was too much of a meandering adventure to know what I was speccing. =P
<havenn> I do love Minitest. =)
kyrylo [kyrylo!~kyrylo@46.118.236.196] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@subtle/user/kyrylo] has joined #ruby-lang
WillMarshall [WillMarshall!~willmarsh@203.118.179.237] has joined #ruby-lang
<havenn> I should probably stop at this point, and add test coverage. Lack-thereof if getting painful, and there is a long way to go. It is congealed enough it should be painless.
gasbakid [gasbakid!~gasbakid@41.96.81.181] has joined #ruby-lang
<IanV> can anyone help me re mocking a Web Server? basics etc. ie stubbing/mocking http requests, i currently use WEBrick::HTTPServer
<manveru> IanV: using rack?
<IanV> I not to sure what to use atm
dr0id [dr0id!~andy@unaffiliated/dr0id] has joined #ruby-lang
<IanV> i was going to stub WEBrick::HTTPServer calls, bit low level i know, but still learning
<IanV> i have a WEBRick server
<manveru> well, rack provides Rack::Mock, which makes things a bit easier
<manveru> also then you can use gems like rack-test, that help with multipart, cookies, and the like
jMCg [jMCg!~hiro@apache/committer/igalic] has joined #ruby-lang
<IanV> do you know of any good tuts/egs? the search I didnt seem to help me mock out the request
<manveru> plus you're not tied to webrick, you can use any other ruby server
<matti> manveru: :)
<rue> Hmm, Rack on WEBrick?
<manveru> IanV: not sure about anything specific
<manveru> i can write a blog post about it, if you want
<IanV> lol
niklasb [niklasb!~codeslay0@p5B310883.dip0.t-ipconnect.de] has joined #ruby-lang
<IanV> ok, im wording(thinking) about what my actually problem is! ...be back..
gokulnath [gokulnath!~gokulnath@115.111.177.122] has joined #ruby-lang
<manveru> ok, timecop also handles nanoseconds
ramonmaruko [ramonmaruko!~marco@122.52.126.66] has joined #ruby-lang
<andrewvos> IanV: Either use VCR, or perhaps BBC/rest-assured
<andrewvos> IanV: Use VCR if you're writing ruby
gix [gix!~gix@e180025047.adsl.alicedsl.de] has joined #ruby-lang
stamina [stamina!~stamina@ip5452a9bc.speed.planet.nl] has joined #ruby-lang
chrismcg [chrismcg!~chrismcg@pdpc/supporter/active/chrismcg] has joined #ruby-lang
burgestrand [burgestrand!~burgestra@host.62.65.124.23.bitcom.se] has joined #ruby-lang
saLOUt [saLOUt!~rriemann@naqasl.physik.hu-berlin.de] has joined #ruby-lang
ryez [ryez!b49d0926@gateway/web/freenode/ip.180.157.9.38] has joined #ruby-lang
chrismcg [chrismcg!~chrismcg@devilfish.octopod.info] has joined #ruby-lang
dnyy [dnyy!u2106@gateway/web/irccloud.com/x-vjjdquvwomjirblj] has joined #ruby-lang
<vereteran> is there any gem able to parse config like this: http://pastebin.com/vrUNJ1Hm ?
<whitequark> vereteran: treetop
judofyr [judofyr!~judofyr@195.159.219.65] has joined #ruby-lang
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
WillMarshall [WillMarshall!~willmarsh@203.118.179.237] has joined #ruby-lang
zz_chrismcg [zz_chrismcg!~chrismcg@devilfish.octopod.info] has joined #ruby-lang
chrismcg [chrismcg!~chrismcg@pdpc/supporter/active/chrismcg] has joined #ruby-lang
<IanV> I looked at VCR, looked more suited to rec/playback
<IanV> but will have another look!
dejongge [dejongge!~jonke@pD9E0CDB8.dip0.t-ipconnect.de] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
davidw [davidw!~davidw@apache/committer/davidw] has joined #ruby-lang
adambeynon [adambeynon!~adambeyno@82-69-1-211.dsl.in-addr.zen.co.uk] has joined #ruby-lang
roadkith [roadkith!~kith@unaffiliated/kith] has joined #ruby-lang
cjs226 [cjs226!~cjs226@rrcs-71-40-79-154.sw.biz.rr.com] has joined #ruby-lang
visof [visof!~visof@unaffiliated/visof] has joined #ruby-lang
<visof> hello
<visof> is it possible to convert ruby syntax to c syntax? , and if we do this, will that be a benefit for ruby over other?
<visof> you will get the code running as fast as C
<yorickpeterse> No
<yorickpeterse> There are some projects that do it up to a certain level but they're very limited
<yorickpeterse> If you want the performance of C, use C
mark_locklear [mark_locklear!~jlocklear@ab-tech-lan-to-ab-tech-gw.ncren.net] has joined #ruby-lang
<bnagy> ...
<bnagy> there's no such thing as the 'performance of C'
<bnagy> there's the performance of binaries emitted by xxx compiler
<bnagy> and I think that answer gives a pretty unfair slap to pretty much all of the non-MRI interpreters out there :P
<manveru> i doubt it'd make ruby faster much... just ask the jruby or rbx guys :)
<yorickpeterse> True, but you probably got what I was trying to say :)
<bnagy> well I don't really know what angle visof was coming at, just thought it was a bit one dimensional as an answer, sry
<bnagy> could be the G&T talking
<hrnt> well, facebook did convert php syntax to c++ syntax ;P
<tobiasvl> i don't really understand visof's question either
<tobiasvl> the SYNTAX?
westernanalog [westernanalog!~westernan@109.179.114.49.tmi.telenormobil.no] has joined #ruby-lang
malev [malev!~malev@190.210.138.237] has joined #ruby-lang
<manveru> hrnt: does php have method_missing ? :)
<burgestrand> manveru: yes
<hrnt> and anyways, implementing method_missing wouldn't be _that_ hard in C
<hrnt> you just convert foo.bar to call_method("foo", "bar") and then have massive if (!strcmp)) hack inside call_method ;)
_inc [_inc!~inc@unaffiliated/-inc/x-0498339] has joined #ruby-lang
<lianj> very fast
<manveru> combine that with const_missing
<manveru> and Proc#binding
<manveru> there's a ton of features in ruby that make static analysis hard
jasox [jasox!~jasox@178.239.26.139] has joined #ruby-lang
<manveru> converting bytecode to C is possible of course, but it won't give you much of a performance boost
<hrnt> yeah, it depends on what you are planning to accomlpish
<hrnt> it is not that hard to do the conversion if you don't care about the performance
<manveru> exactly
<hrnt> but if you want to map the ruby semantics to C semantics, then you are going to have problems
<hrnt> i believe what hiphop does for PHP is that it basically just ignores the "hard" parts of PHP
<manveru> that's why jruby offers options to relax the MRI adherence for massive performance boosts
krz [krz!~foobar@unaffiliated/krz] has joined #ruby-lang
<manveru> if you know your code never redefines a method or reopens a class, you can disable an army of guards
<manveru> being able to do 1 + 1 without checking that Fixnum.+ still is what it was last time...
<judofyr> MRI already optimizes operators
<judofyr> e.g. if you haven't redefined +
<manveru> yeah, it does method caching until you modify the class hierarchy
<judofyr> then Fixnum + Fixnum doesn't invoke a methid
<manveru> dunno if it still flushes the whole cache if you just do someinstance.extend(bar)
<judofyr> I believe constant cache is different from the redefined-method-cache…
<judofyr> ruby_vm_redefined_flag
beawesomeinstead [beawesomeinstead!u1643@gateway/web/irccloud.com/x-moybtnghygnxzmfd] has joined #ruby-lang
tommyvyo [tommyvyo!~tommyvyo@38.123.129.115] has joined #ruby-lang
hallucinations [hallucinations!~hallucina@115.249.98.157] has joined #ruby-lang
JosephRuby [JosephRuby!~joseph@46.33.36.243] has joined #ruby-lang
rippa [rippa!~rippa@93-181-222-22.adsl.yaroslavl.ru] has joined #ruby-lang
rushed [rushed!~rushed@99-73-225-9.lightspeed.austtx.sbcglobal.net] has joined #ruby-lang
mkscrg_ [mkscrg_!~mkscrg@ool-18e4f9d6.dyn.optonline.net] has joined #ruby-lang
Okasu [Okasu!~okasu@s094127069016.m.truevds.ru] has joined #ruby-lang
dv310p3r [dv310p3r!~dv310p3r@host-208-68-238-122.biznesshosting.net] has joined #ruby-lang
yfeldblum [yfeldblum!~Jay@pool-71-246-76-76.bltmmd.east.verizon.net] has joined #ruby-lang
RomD [RomD!~Roman@nrbg-d9322fd4.pool.mediaWays.net] has joined #ruby-lang
RomD` [RomD`!~Roman@nrbg-d9322fd4.pool.mediaWays.net] has joined #ruby-lang
andrewhl [andrewhl!~andrew@24-246-14-26.cable.teksavvy.com] has joined #ruby-lang
hagabaka [hagabaka!~hagabaka@unaffiliated/hagabaka] has joined #ruby-lang
jensn [jensn!~Jens@ip225-88.wireless.lu.se] has joined #ruby-lang
hagabaka [hagabaka!~hagabaka@cblmdm24-53-178-92.buckeyecom.net] has joined #ruby-lang
hagabaka [hagabaka!~hagabaka@unaffiliated/hagabaka] has joined #ruby-lang
<shevy> LONG LIVE RUBY!
MistyM [MistyM!~mistym@50.museumforhumanrights.com] has joined #ruby-lang
voker57 [voker57!~voker57@128-70-23-32.broadband.corbina.ru] has joined #ruby-lang
voker57 [voker57!~voker57@kvirc/developer/Voker57] has joined #ruby-lang
jensn [jensn!~Jens@ip225-88.wireless.lu.se] has joined #ruby-lang
<rue> Oops, it ded
beiter [beiter!~beiter@manz-590ee8b3.pool.mediaWays.net] has joined #ruby-lang
<imperator> well shit; guess it's back to BASIC for me then
leonL [leonL!~leonl@CPE0024a5b652a3-CM000f21205d86.cpe.net.cable.rogers.com] has joined #ruby-lang
<akahn> is there something like readlines, but that chomps newlines off for me?
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby-lang
<rue> IO#foreach might?
<rue> Apparently not
anjen [anjen!~anjen@99-29-152-246.lightspeed.bcvloh.sbcglobal.net] has joined #ruby-lang
outoftime [outoftime!~mat@ip-160-79-101-2.autorev.intellispace.net] has joined #ruby-lang
<shevy> akahn File.readlines("foo.txt").map(&:chomp)
<shevy> or ... class File;def self.chomplines(i); readlines(i).map(&:chomp)
voker57 [voker57!~voker57@128-70-23-32.broadband.corbina.ru] has joined #ruby-lang
voker57 [voker57!~voker57@kvirc/developer/Voker57] has joined #ruby-lang
stephenp [stephenp!~stephenp@gatepost.hos.net] has joined #ruby-lang
<akahn> thanks, yeah, that's what i'm doing
<shevy> :)
<akahn> i just thought there might be something already for that, like print vs. puts
imajes [imajes!~imajes@is.imaj.es] has joined #ruby-lang
<manveru> File.open('foo.rb'){|io| io.each_line.map(&:chomp) }
<stephenp> is there a library for doing affine transforms in ruby? I need to take a rectangle, rotate it 30 and get the new coordinates of the vertices.
<manveru> should be a lot faster for large files
<manveru> hm, not much
<lianj> if you want all lines anyway than then start processing these lines, why not split("\n")?
<manveru> because it might be \r\n
<lianj> hm, not in my world ;)
<manveru> :)
<manveru> uh
<manveru> why is /usr/share/dict/finnish in codepage 1250?
<shevy> because reindeers don't understand unicode
<manveru> /usr/share/dict/french is UTF-8
<manveru> german is ISO-8859-2
<shevy> ONE ENCODING TO BIND THEM
<shevy> ONE ENCODING TO RULE THEM
<manveru> spanish is UTF-8
<manveru> srsly, who is responsible for that mess?
<imperator> tim bray
gianlucadv [gianlucadv!~gianlucad@109.53.215.226] has joined #ruby-lang
<shevy> DHH
RomyEatsDrupal [RomyEatsDrupal!~stickycak@cpe-69-203-115-155.nyc.res.rr.com] has joined #ruby-lang
jacobwg [jacobwg!~jacobwg@204.sub-75-254-157.myvzw.com] has joined #ruby-lang
elux [elux!~peter@96.45.198.150] has joined #ruby-lang
rayners [rayners!~rayners@38.102.22.194] has joined #ruby-lang
<rue> manveru: You're still reading the whole file
<andrewhl> so I'm trying to use open-uri to access a google scholar page with certain get attributes. I'm getting a 503 error. I believe the issue can be resolved by declaring a user-agent, but I'm not sure on the syntax for it, or what user-agent to declare. Anyone have some insight into this?
<manveru> rue: of course
<manveru> andrewhl: i doubt you can set it with open-uri
<manveru> use Net::HTTP, or just skip to mechanize
<manveru> or if you like overkill, selenium :)
<any-key> open-uri is a wrapper around Net::HTTP to make things really easy
<andrewhl> ahh
<andrewhl> it's working now. It wasn't working last night
<andrewhl> must be google had blocked me temporarily
<any-key> which API are you using?
<any-key> there's quotas on a lot of them
<andrewhl> i'm using nokogiri
<rippa> manveru: you can set it with open-uri
<rippa> it treats unrecognised options as headers
<andrewhl> how can I avoid getting blocked? where's the information on it? Is it basically a certain amount of time between requests?
<any-key> andrewhl: first of all, what website are you interacting with?
<andrewhl> google scholar
<any-key> have you read the API terms of service?
<any-key> assuming you're using an API
<rippa> open("whatever", "User-Agent" => "whatever")
<any-key> andrewhl: it's trivial for google to detect someone scraping them and throttle as a result
<any-key> because you're without a doubt violating their TOS unless you're using an API
tomzx [tomzx!~tomzx@dsl-156-68.aei.ca] has joined #ruby-lang
<any-key> you need to space out your requests, and distribute them across multiple boxes
<any-key> and request other pages as well to mimic the activity of a real user
<andrewhl> i see
<any-key> also, all of this is sketchy as fuck
<any-key> I said nothing!
* any-key has *never* gotten banned for such activities
<any-key> ;)
<andrewhl> lol. It's not illicit, really. Just checking how many results various journal names turn up
<andrewhl> does that qualify as sketchy?
tommyvyo [tommyvyo!~tommyvyo@38.123.129.115] has joined #ruby-lang
<any-key> you absolutely *must* read the TOS
<any-key> it's the responsible thing to do
<andrewhl> ok
<any-key> and check to see if there's an API
enikar [enikar!~gil@cl-140.mrs-01.fr.sixxs.net] has joined #ruby-lang
<any-key> it'll make your life easier and you're less likely to piss them off
<lianj> piss off google? thats hard
<andrewhl> google probably gets scraped by millions of boxes a day
<manveru> it's easier than pissing off the dalai lama, but harder than pissing off RMS
<any-key> and they'll throttle you
dfr|mac [dfr|mac!~dfr|work@ool-18baf7e7.dyn.optonline.net] has joined #ruby-lang
<any-key> I've had it happen...
<any-key> I also got permabanned from yelp :P
<manveru> lol
<any-key> well, got a bunch of boxes permabanned :(
<manveru> well, google is stingy
<manveru> they still have no search api
<any-key> they used to iirc
<manveru> yeah
<any-key> albeit a highly rate-limited one
<manveru> now they have the google site search api
<manveru> which is pretty useless for most
<manveru> oh, they made it paid?
<lianj> "100 queries per day." lol, f' that
<rippa> old api still works too
<rippa> Note: The Google Web Search API has been officially deprecated as of November 1, 2010. It will continue to work as per our deprecation policy, but the number of requests you may make per day will be limited.
<manveru> yeah, it had a big fat deprecation notice there a year ago
<any-key> don't call it fat, that's meaaannn
savage- [savage-!~savage-@c-67-180-11-89.hsd1.ca.comcast.net] has joined #ruby-lang
<manveru> so is life
<rue> Wah-waaaaa
<manveru> and rue
<rue> Mwah-moiii
<imperator> phat!
butchanton [butchanton!~butchanto@adsl-71-146-134-251.dsl.pltn13.sbcglobal.net] has joined #ruby-lang
<manveru> rippa: the custom search is what i meant with useless
robgleeson [robgleeson!~rob@subtle/contributor/robgleeson] has joined #ruby-lang
<any-key> I kind of wish Enumerable::include? took a block
<any-key> even though that wouldn't make sense
<manveru> how about any?
<any-key> yeah that's what I used instead
<any-key> makes more sense :P
<andrewhl> is it possible to use nokogiri to open a locally saved html file?
<andrewhl> i guess it must be... it's all dependent on what open-uri can do, no?
<burgestrand> yes, yes, no
<manveru> :)
<any-key> you can feed nokogiri a raw string
<any-key> so open the file and throw the results at nokogiri
<manveru> also an IO
<any-key> it'll gobble them up
<andrewhl> what's the syntax for opening a local file then?
<manveru> open('foo.txt'){|io| Nokogiri::HTML(io) }
<andrewhl> i see
<andrewhl> thanks
<manveru> i usually write File.open, but they're pretty much the same in this case
<Cool_Fire> How many threads can a single Ruby process run simultaneously?
<manveru> 1
<Cool_Fire> ...
<Okasu> Cool_Fire: thereads in ruby futile, use fibers
takaokouji [takaokouji!~takaokouj@nat35.mable.ne.jp] has joined #ruby-lang
<burgestrand> fibers can’t run in parallel
<manveru> and you have to schedule them yourself
<burgestrand> Cool_Fire: you can only run one thread in parallel on CRuby, but you can run many many concurrently
<Cool_Fire> how many many?
<burgestrand> My guess would be it’s limited to how many you can create before you run out of memory
<Cool_Fire> My guess would be it's limited by the amount of file descriptors
<burgestrand> But even if you do that, you can only run so many before the time it takes for ruby to manage the thread outweighs the benefits
<burgestrand> It also depends a bit on which version of ruby you run, 1.8 or 1.9
<Cool_Fire> It's not a matter of benefit in this case, but of being able to process all received input
<Cool_Fire> In fact, it'd be faster without any threading
virunga [virunga!~virunga@151.64.16.113] has joined #ruby-lang
<burgestrand> *shrug*
<burgestrand> Anybody ever managed to up a vagrant box successfully?
<manveru> aye
<burgestrand> manveru: you ever had problems with the box not responding to SSH?
<manveru> when you mentioned it the last time :)
<burgestrand> :p
<manveru> no
<manveru> i only played with it a bit, sorry
<burgestrand> third time doing it, third time new machine I’m testing it out on, third time it fails with the same issue :*
<manveru> what do you do to keep ssh alive?
<burgestrand> At least I’m not alone having this issue, but nobody appears to know how to fix it and the author of vagrant kind of closed it yesterday with the response "I don’t know how to fix it so closing" :(
<Cool_Fire> Also, about threading, doesn't 1.9 use native OS threads?
<burgestrand> Cool_Fire: it does
<burgestrand> Cool_Fire: keeps a lock around it to make sure only one thread is running ruby code at a time, but if you write a C extension you can write truly parallel code, as long as it doesn’t execute any ruby
<burgestrand> Cool_Fire: ruby does it for bignum, for example
<burgestrand> manveru: essentially this issue: https://github.com/mitchellh/vagrant/issues/391
<Cool_Fire> So regardless of the actual amount of cores your system has, Ruby only executes one thread at a time, even with 1.9.x?
<burgestrand> Cool_Fire: CRuby, yes
<Cool_Fire> That seems ... odd to say the least
<burgestrand> Cool_Fire: so you won’t see a difference if you run 64 cores or if you run 1 core
<bougyman> unless you run multiple interpreters, or an alternate ruby (jruby)
<manveru> bougyman: well, looks like it was resolved then?
<burgestrand> manveru: acknowledged, but not resolved
<manveru> burgestrand: is that only on ubuntu?
<manveru> i've only used arch
<manveru> sorry not gonna read all of that until i have to use vagrant again
<burgestrand> manveru: not sure, I’m trying different ones at the moment :)
<burgestrand> manveru: great tip with arch, appears to have had better luck with that one, ruby 1.9.3 didn’t seem to like net-ssh though, but 1.9.2 works fine
Pip_ [Pip_!~Pip@unaffiliated/pip] has joined #ruby-lang
* imperator is baffled by a _mktemp failure on windows
<Cool_Fire> imperator: I have a mouse by your name.
ascarter [ascarter!~ascarter@209.119.253.66] has joined #ruby-lang
andrewhl [andrewhl!~andrew@67.230.167.29] has joined #ruby-lang
<imperator> Cool_Fire, que?
<Cool_Fire> ^ that
<imperator> ah, right
<shevy> the remote choke mouse
<shevy> imperator sithlord rises again
RomyEatsDrupal [RomyEatsDrupal!~stickycak@cpe-69-203-115-155.nyc.res.rr.com] has joined #ruby-lang
<imperator> dammit, netflix sound and picture are out of sync! i hate that!
* imperator can't go on
SuperTaz_work [SuperTaz_work!~supertaz_@38.99.52.59] has joined #ruby-lang
kain [kain!~kain@151.64.233.209] has joined #ruby-lang
shivamib [shivamib!~darkside@187.45.255.123] has joined #ruby-lang
eydaimon [eydaimon!~eydaimon@unaffiliated/anywho] has joined #ruby-lang
flip_digits [flip_digits!~textual@c-76-122-14-228.hsd1.fl.comcast.net] has joined #ruby-lang
<eydaimon> http://pastie.org/3179408 <-- this behavior always throws me off. thoughts on why it's like this?
<eydaimon> am I missing something fundamental
<stderr-> get hasn't been called, what's to miss?
wallerdev [wallerdev!~wallerdev@72.44.102.30] has joined #ruby-lang
<eydaimon> huh?
<eydaimon> the problem is Moo::FOO
<eydaimon> not 'get'
<imperator> you haven't set FOO to anything
<imperator> oh, i see what you're saying
<shevy> he is saying Moo
<RomyEatsDrupal> hi room, can anyone recommend an online hosting solution that allows root access so I can install gems and rails/etc via SSH/command line for affordable prices? I am NOT a company, just a single web developer/designer. I'd like to use it to deploy multiple blogs, CMS's, rails apps of my own curiosities, etc. Preferably pretty cheap, I do not anticipate more than a hundred hits a day (I'm only at 30 hits a day on my own per
<RomyEatsDrupal> wordpress website). I heard people recommend Rackspace and Linode, anyone prefer one over the other? Thanks! <3 Romy
<eydaimon> shevy: I often use a Cow class in my examples too :)
<RomyEatsDrupal> (currently i use MediaTemple but it does NOT give root access which SUCKS)
apeiros_ [apeiros_!~apeiros@77-58-113-31.dclient.hispeed.ch] has joined #ruby-lang
<andrewhl> basic question: I have a CSV I'm reading: CSV.foreach("test.csv") do |row|... how can I just read say the first 30 rows?
<andrewhl> I guess this is a general question about loops... how do you restrict them to only running a certain number of times?
<apeiros_> CSV.enum_for(:foreach, "test.csv").first(30).each do |row| …
<andrewhl> wow, ok
<andrewhl> .first can take an argument? cool
Yu\2 [Yu\2!~Yu@ubi-1-50-54.zif.uni-bielefeld.de] has joined #ruby-lang
<eydaimon> no opinions about that anyone?
<apeiros_> eydaimon: on what?
IanV [IanV!~chatzilla@host109-145-182-81.range109-145.btcentralplus.com] has joined #ruby-lang
mrsolo [mrsolo!~mrsolo@64.125.181.73] has joined #ruby-lang
<eydaimon> apeiros_: http://pastie.org/3179408 <-- this behavior always throws me off. thoughts on why it's like this?
wmoxam [wmoxam!~wmoxam@pdpc/supporter/active/wmoxam] has joined #ruby-lang
davidw [davidw!~davidw@adsl-ull-122-110.51-151.net24.it] has joined #ruby-lang
<apeiros_> eydaimon: use self.class::Foo
<apeiros_> but no, I don't have an opinion on it.
toretore [toretore!~toretore@crr06-3-82-231-12-81.fbx.proxad.net] has joined #ruby-lang
mark_azevedo [mark_azevedo!~mark_azev@adsl-76-228-82-246.dsl.pltn13.sbcglobal.net] has joined #ruby-lang
indstry [indstry!~apple@c-71-238-98-243.hsd1.mi.comcast.net] has joined #ruby-lang
amerine [amerine!~mturner@67.204.184.82] has joined #ruby-lang
spleeze [spleeze!~Spleeze@173-15-131-114-BusName-Philadelphia.hfc.comcastbusiness.net] has joined #ruby-lang
darkf [darkf!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
macmartine [macmartine!~macmartin@069-064-227-254.pdx.net] has joined #ruby-lang
brianpWins [brianpWins!~brianpWin@S01060024369f54ba.vn.shawcable.net] has joined #ruby-lang
Weems [Weems!~the@nat.resnet.mc.edu] has joined #ruby-lang
Weems [Weems!~the@unaffiliated/weems] has joined #ruby-lang
lsegal [lsegal!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
abentspoon [abentspoon!~micah@173.247.201.130] has joined #ruby-lang
<slyphon> injekt: ping?
bglusman [bglusman!~bglusman@c-71-224-192-35.hsd1.pa.comcast.net] has joined #ruby-lang
mark_azevedo [mark_azevedo!~mark_azev@adsl-76-228-82-246.dsl.pltn13.sbcglobal.net] has joined #ruby-lang
<slyphon> drbrain: around?
<drbrain> hi
<slyphon> hey, quick question
<slyphon> sooo, i've written this internal rubygems distribution thing
<drbrain> and?
<slyphon> sorry, i'm getting there
<slyphon> we have an openstack storage cluster, and i wrote something to sync gems down and reindex
<slyphon> teh syncing down works, but when i run a "quick update" for the indexes, sometimes it doesn't "show up"
<slyphon> new gems that is
<slyphon> so i run gem generate_index --update -d /path/to/gems
<slyphon> i'm not sure what to check
<drbrain> it should print out more stuff with -V
robgleeson [robgleeson!~rob@subtle/contributor/robgleeson] has joined #ruby-lang
<slyphon> hm, mmkay
* slyphon tries that
shevy [shevy!~shevy@194-166-29-132.adsl.highway.telekom.at] has joined #ruby-lang
cylence [cylence!~cylence@64-71-24-18.static.wiline.com] has joined #ruby-lang
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby-lang
lsegal [lsegal!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
kamalreddy [kamalreddy!~coder@202.3.77.231] has joined #ruby-lang
<kamalreddy> hi
g0bl1n [g0bl1n!~g0blin@unaffiliated/g0bl1n] has joined #ruby-lang
robbrit [robbrit!~rob@38.108.76.250] has joined #ruby-lang
andrewhl [andrewhl!~andrew@67.230.167.24] has joined #ruby-lang
<andrewhl> I have this: CSV.enum_for(:foreach, "test.csv").first(5).each do |row|, which does the first five rows. How can I do a range of rows, like say rows 30-50?
kyrylo [kyrylo!~kyrylo@46.118.222.71] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@subtle/user/kyrylo] has joined #ruby-lang
<rue> Depending, you might just do a #to_a, or then drop n and then grab m
tychobrailleur [tychobrailleur!~sebastien@176.61.72.130] has joined #ruby-lang
dfr|mac [dfr|mac!dfr|work@nat/google/x-pkwmhyvcdkkhjhux] has joined #ruby-lang
<apeiros_> andrewhl: .first(50).last(20)
<andrewhl> will that start at #50?
<apeiros_> since the size of a row is undefined, you can't do something akin to skipping
<apeiros_> no, that'll give you 30-50
<andrewhl> I see
<apeiros_> it first takes the first 50, and the last 20 out of those 50
<andrewhl> ah
<andrewhl> and if I want to say go from #30 to the end?
<apeiros_> chaining always works on the result of the former method
<rue> I'd go .drop(29).first(20) :)
<rue> Or something.
<apeiros_> probably more efficient…
<rue> Or perhaps you want #each_slice instead
mdel [mdel!~mdel@pool-71-175-17-16.phlapa.fios.verizon.net] has joined #ruby-lang
<apeiros_> andrewhl: if you need to do lots of index based operations on the csv, why don't you read it all into a table and use the normal [] method?
<andrewhl> the csv is really simple, it's just one column
<apeiros_> I think it was something like: csv = CSV.read(path); csv[row][cell]…
<apeiros_> uh, then… read it all and use .transpose
niklasb_ [niklasb_!~codeslay0@p5B310883.dip0.t-ipconnect.de] has joined #ruby-lang
<andrewhl> all I need to do is start at x and go to the end at this point
<andrewhl> that should be easy enough, no?
<apeiros_> drop(n).each, as rue suggested
<andrewhl> ah interesting
<apeiros_> or drop(n).to_a
<apeiros_> if you just want it in an array.
<apeiros_> also [[1],[2],[3]].transpose # => [[1, 2, 3]]
niklasb [niklasb!~codeslay0@p5B310883.dip0.t-ipconnect.de] has joined #ruby-lang
<andrewhl> ok cool. thanks
<apeiros_> oh wow, drop returns an Array? that's sad…
<rippa> yes
<rippa> we need new drop
<apeiros_> I expected Enumerable#drop # => Enumerator
<rippa> and lazy versions of other enumerable methods
<rippa> like map
<rippa> and select
<apeiros_> mhm
<apeiros_> would be more unixy too
<rue> Hm, #drop hasn't been Enumeratorized yet?
<rue> That's silly.
<manveru> it doesn't take a block
<shevy> drop('cats') { ' and bunnies' }
flip_digits [flip_digits!~textual@c-76-122-14-228.hsd1.fl.comcast.net] has joined #ruby-lang
<rue> Well, the block isn't necessarily the point of an Enumerator
<rue> Consider the #next-type generator usage
<apeiros_> Enumerator vs. Enumerable
<rue> (And obviously in this case, laziness to avoid reading who knows how many rows up front)
leonL [leonL!~leonl@CPE0024a5b652a3-CM000f21205d86.cpe.net.cable.rogers.com] has joined #ruby-lang
cschneid [cschneid!~cschneid@li291-24.members.linode.com] has joined #ruby-lang
robgleeson [robgleeson!~rob@subtle/contributor/robgleeson] has joined #ruby-lang
cschneid [cschneid!~cschneid@li291-24.members.linode.com] has joined #ruby-lang
zmack [zmack!~zmack@78.97.133.243] has joined #ruby-lang
benanne [benanne!~rijdier@2.185-241-81.adsl-dyn.isp.belgacom.be] has joined #ruby-lang
dfr|mac [dfr|mac!dfr|work@nat/google/x-rkljpvjisyiitpca] has joined #ruby-lang
<manveru> well, try (1..(1/0.0)).drop(10)
<manveru> drop relies on #each, just as everything else
<apeiros_> manveru: yes, cases like that are kinda the point of wanting drop return Enumerator
<apeiros_> that OTOH is not the point :)
<apeiros_> of course it relies on .each, it doesn't need to try to convert the result to an array…
<apeiros_> +but
shivamib [shivamib!~darkside@187.45.255.123] has quit ["Leaving"]
<manveru> it can't be lazy if it has to find the last element first
<apeiros_> hu?
<apeiros_> it doesn't have to find the last element
adambeynon [adambeynon!~adambeyno@82-69-1-211.dsl.in-addr.zen.co.uk] has joined #ruby-lang
<apeiros_> drop(n) drops the first n elements in the enumeration
<rue> Precis
<manveru> oh, not the last?
<manveru> damnit
<apeiros_> :)
<apeiros_> but even with the last, it could be lazy
<apeiros_> it'd need a buffer of size N, though
<rue> Well, not lazy, but it wouldn't need to retain the dropped values
<apeiros_> using a ringbuffer, that can be implemented relatively efficient
<manveru> hm
<manveru> drop_while returns an enum
<rue> Ah! There's maybe a good reason for it being separate
<rue> Probably not.
<rue> s/separate/different/
<manveru> well, only if you don't pass a block
<manveru> so... not very helpful
guns [guns!~guns@c-98-228-72-208.hsd1.il.comcast.net] has joined #ruby-lang
ricardovaleriano [ricardovaleriano!~ricardova@189-69-29-244.dsl.telesp.net.br] has joined #ruby-lang
<dreinull> it's geting late. I have users in my Array and want to group by user, not by role: {:admins => ary1, :moderators => ary2, users => ary3}
<apeiros_> dreinull: you mean in aryN's you have users? or what?
<apeiros_> so you want {user => roles, …}?
<dreinull> apeiros_: yes, my fault. And there is no hierarchy
<dreinull> apeiros_: yup
<dreinull> I do have to sort them somehow, right? There is no readymade method for that I can think of right now.
<apeiros_> by_user = Hash.new { |h,k| h[k] = [] }; by_roles.each do |role, users| users.each do |user| by_user[user] << role end end
* apeiros_ still doesn't get why there's no Hash#default_proc=
<manveru> >> h = {admins: [1,2,3], moderators: [4,2,3], users: [7,5,4,1]}.invert
<manveru> => {[1, 2, 3]=>:admins, [4, 2, 3]=>:moderators, [7, 5, 4, 1]=>:users}
<apeiros_> manveru: problem if users are in multiple roles
<manveru> might not be helpful, but i guess i don't understand the problem
<manveru> dreinull: what output do you want?
<apeiros_> also I guess he wants single users as keys
<dreinull> sec
<dreinull> yes, users as keys and users can be in different roles
<dreinull> manveru: no, I'm not looking for inversion.
spleeze [spleeze!~Spleeze@173-15-131-114-BusName-Philadelphia.hfc.comcastbusiness.net] has joined #ruby-lang
<manveru> .each_with_object(Hash.new{|k,v| k[v] = []}){|(k,v),o| v.each{|u| o[u] << k }}
<manveru> but yeah, same as apeiros_
<dreinull> great, I had to reformat to see how it works :)
<dreinull> thanks a lot.
<manveru> yw
<dreinull> {manveru:"<3", apeiros_:"<3"}
<rue> Oh, anyone know about the keyword args proposal for 2.0?
<rue> I think igrigorik was saying it'd replace the hash syntax, but that can't be…
<robgleeson> they're always optional arguments
<robgleeson> entire thread on redmine about them
robbrit [robbrit!~rob@38.108.76.250] has quit [#ruby-lang]
dejongge1 [dejongge1!~jonke@pD9E0DEED.dip0.t-ipconnect.de] has joined #ruby-lang
eydaimon [eydaimon!~eydaimon@unaffiliated/anywho] has quit ["WeeChat 0.3.6"]
zmack [zmack!~zmack@78.97.143.6] has joined #ruby-lang
dv310p3r [dv310p3r!~dv310p3r@host-208-68-238-122.biznesshosting.net] has joined #ruby-lang
butchanton [butchanton!~butchanto@vpn-sanfran.exacttarget.com] has joined #ruby-lang
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby-lang
queequeg1 [queequeg1!~chatzilla@c-71-202-152-67.hsd1.ca.comcast.net] has joined #ruby-lang
Filuren [Filuren!~Filuren@x1-6-e0-46-9a-1f-97-a2.k617.webspeed.dk] has joined #ruby-lang
<Filuren> Hello
cyri_ [cyri_!~cyri_@jem75-1-87-88-118-80.dsl.sta.abo.bbox.fr] has joined #ruby-lang
<visof> Filuren: hi
<Filuren> Is this a dead IRC? Lots of peeps connected, but no talk
<apeiros_> we're using telepathy
<rippa> that's called "IRC"
<rippa> that's how it usually is
<apeiros_> after years of bad questions and lots of assumptions in the sense of "it's obvious what I mean/everybody knows that", we finally developed that power…
<Filuren> Would like to learn telepathy
<visof> apeiros_: can i ask you question?
<visof> it will be another bad question
<apeiros_> visof: as long as it's in the channel, just go ahead
<visof> yeah it's
<visof> how many years you coded in Ruby?
<Filuren> Is this the place to ask some noobish question? I am new to ruby
<apeiros_> ~7 I think
<visof> Filuren: yeah sure
<apeiros_> Filuren: yes. just ask.
<visof> apeiros_: wonderful
<Filuren> Cool! Okay, I recently joined the learning of Ruby and I really like the simplicity (only skimmed other languages, I have no prior experience in programming)
<Filuren> What I fail to see, for what real world examples can Ruby be used? Which problems can it solve?
<apeiros_> Filuren: ruby is a general purpose language, meaning you can use it for about everything
<apeiros_> you wouldn't want to use it on embedded or other resource constrained machines, though.
<visof> apeiros_: everything?
<apeiros_> everything. note that this doesn't mean it is the best tool for everything.
<visof> OK
<wmoxam> program all the things with Ruby!
<Filuren> wmoxam: lol
<Filuren> apeiros_: do you have any great 'projects' for a noob? I know about loops, class, methods etc.
<Filuren> Nothing complex, just something where I can try out the skills I learned
<apeiros_> Filuren: nope, sorry. I think my first project was an irc bot
<apeiros_> but what you could do - no idea. scratch an itch of yours?
<Filuren> not familiar with that expression, what does "scratch an itch of yours" mean?
<visof> Filuren: do you like Math?
<Filuren> visof: Going to mention Project Euler? :P
<visof> Filuren: yep
<Filuren> I've taken a look, and I gotta say, I won't even know how I should approach with an advanced calculator
<Filuren> The first few are simple, but I just don't know the algorithms to solve it
<visof> Filuren: you can even write brainfuck interpreter
<Filuren> ++++,++++,> or how it looks
<visof> maybe you can write regular expressions interpreter too
<apeiros_> Filuren: it means if you have something that you need solved for yourself, try to solve that.
<apeiros_> I needed something to operate an irc channel, that's why I wrote an irc bot. I scratched my own itch.
<shevy> butler!
<apeiros_> yes
<Filuren> apeiros_: Ahh, I do have one thing I could try to make. Not sure if it's too complexed, but I will find out
<Filuren> visof: What is regular expressiosns interpreter? Is it the same as regex?
<Filuren> apeiros_: How did you teach yourself Ruby? Books, school or a personal trainer?
<visof> Filuren: maybe
<apeiros_> Filuren: irb, trial & error, irc, pickaxe - about in that order
<apeiros_> oh, forgot ri
petercooper [petercooper!~petercoop@82.144.254.2] has joined #ruby-lang
<apeiros_> I found ruby to be quite intuitive, and irc helped me a ton getting to write idiomatic ruby and undo years of php mutilation.
<apeiros_> but having known perl before php and ruby helped
<apeiros_> (ruby is highly influenced by perl)
artOfWar_ [artOfWar_!~artofwar@108-205-201-30.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
WillMarshall [WillMarshall!~willmarsh@203.118.179.237] has joined #ruby-lang
<Filuren> apeiros_: If I explained the application I wanted to develop, do you think you could tell if it's complex or simple?
<Filuren> The idea is simple, not sure how simple it would be to write though
<apeiros_> I doubt it. but try to reduce it to its barest minimum.
heftig [heftig!jan@archlinux/developer/heftig] has joined #ruby-lang
<apeiros_> start there. when you've done the minimum you can start evolving it.
<Filuren> Load a .txt file, scan for specific symbols, delete line if found, save to same .txt
<apeiros_> a one liner for an experienced ruby programmer ;-)
<drbrain> ARGF can do "in-place" edits
<Filuren> So you think it's doable? I could use and eventually expand it
<apeiros_> but yes, that surely works as a starting point
<Filuren> What's ARGF?
<apeiros_> and it's perfectly fine if you use a hundred lines for your first version
<drbrain> Filuren: ri ARGF
<drbrain> it's a virtual file stream for the files given to ruby on the command line
<Filuren> What's a virtual file stream? New to Ruby/programming, not aware of those expressions yet
<drbrain> Filuren: it acts like an IO but it's not a real IO
<drbrain> if you list two files they appear to be one
<drbrain> Filuren: there's no formal "virtual" in ruby like in C++
burgestrand [burgestrand!~burgestra@h-45-63.a155.priv.bahnhof.se] has joined #ruby-lang
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
jacobwg [jacobwg!~jacobwg@111.sub-75-227-140.myvzw.com] has joined #ruby-lang
ricardovaleriano [ricardovaleriano!~ricardova@177.33.17.13] has joined #ruby-lang
handygandy [handygandy!~handygand@adsl-76-193-165-222.dsl.chcgil.sbcglobal.net] has joined #ruby-lang
<handygandy> Hello I have to do a topological sort in 1.9.1 is there alibrary that can help me?
<yorickpeterse> Don't use 1.9.1
<yorickpeterse> It's buggy and not supported anymore
<drbrain> handygandy: tsort.rb in the standard library
<handygandy> yorickpeterse: Until I fix my debian installation and upgrade it's what I am stuck with.
<drbrain> handygandy: but, yeah, upgrade to 1.9.3
<jarib> tsort works fine, if you need something more advanced, look at rgl
<yorickpeterse> Wait, debian is still on 1.9.1? Ugh
<drbrain> at one time it was debian policy to have ruby 1.9.2 ship in the ruby 1.9.1 package
<drbrain> handygandy: does ruby -v say 1.9.1?
<wmoxam> drbrain: still is
<wmoxam> 1.9.1 refers to compatibility version
<wmoxam> handygandy: drbrain is correct, you are likely are running 1.9.2 unless you are running an ancient version of Debian
naz [naz!~n@70.44.2.190.res-cmts.bus.ptd.net] has joined #ruby-lang
Axsuul [Axsuul!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby-lang
Axsuul [Axsuul!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby-lang
Axsuul [Axsuul!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby-lang
Axsuul [Axsuul!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby-lang
Axsuul [Axsuul!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby-lang
mark_azevedo [mark_azevedo!~mark_azev@70-36-215-74.dsl.dynamic.sonic.net] has joined #ruby-lang
slyphon [slyphon!~weechat@pool-96-224-232-158.nycmny.fios.verizon.net] has joined #ruby-lang
slyphon [slyphon!~weechat@unaffiliated/slyphon] has joined #ruby-lang
context [context!context@november.xen.prgmr.com] has joined #ruby-lang
<context> would anyone know what is going on with this? :x word_representation_accumulator
<context> err
<context> 11200 and 9200 work, but not 10200
<apeiros_> context: didn't get help in #rubyonrails? :)
<context> no
<context> hah
<apeiros_> anyway, 10200 goes to write "two hundred" into the accumulator, then when you hit the 1, you go into the elsif ten_to_twenty?(digit_as_number, digit_count)
<apeiros_> there you backtrack, so byebye 200
<apeiros_> 100200 fails too, it says "one hundred and two hundred" - the thousand goes missing…
* apeiros_ thinks that algorithm is flawed
dfr|mac [dfr|mac!dfr|work@nat/google/x-nmiyfhwsodkxptip] has joined #ruby-lang
<apeiros_> I mean, beyond the obvious bugs.
<context> i got it fixed up
<context> hmmm
<context> kk. yeah 20200 failed also , i didnt try 30200 though
<apeiros_> if you need that productive, you probably better use some existing lib
<apeiros_> if it's an exercise, I'd consider starting over
leonL [leonL!~leonl@CPE0024a5b652a3-CM000f21205d86.cpe.net.cable.rogers.com] has joined #ruby-lang
<lsegal> messy looking.
<apeiros_> lsegal: no more argv[0]?
<lsegal> not since a while ago
<lsegal> i would parse the number in triplets, and attach the "trillion" "million" "thousand" qualifier to the specific triplet you're on, not make it part of the standard digit parsing inside of the triplet
<context> lsegal: yeah i found a fix for it, or shall i say, replacement
<context> thats a lot easier to read
<lsegal> then you only have to handle 0-999 per triplet
<lsegal> which is fairly easy to do
<context> eyah
postmodern [postmodern!~postmoder@c-71-237-178-98.hsd1.or.comcast.net] has joined #ruby-lang
<lsegal> i feel like golfing this for fun
<context> lsegal: its cause of the ten_to_twenty, is backtracking the accumulator, and pop'ing the 200 off
<context> :x
* context hides
wingless2434 [wingless2434!~chris@c-174-61-224-227.hsd1.wa.comcast.net] has joined #ruby-lang
wingless2434 [wingless2434!~wing@c-174-61-224-227.hsd1.wa.comcast.net] has joined #ruby-lang
RomyEatsDrupal [RomyEatsDrupal!~stickycak@dyn-207-10-142-100.dyn.columbia.edu] has joined #ruby-lang
<jaimef> http://pastie.org/private/rrp75yasqpbvtzm1a7kjq this looks very ugly to me so I assume it can be done more properly.
adgar [adgar!~adgar@carbonica.xen.prgmr.com] has joined #ruby-lang
context [context!context@november.xen.prgmr.com] has joined #ruby-lang
sora_h [sora_h!~sora_h@mayfield.privs.net] has joined #ruby-lang
<apeiros_> jaimef: I don't think the ",0" in [/\w+/,0] has any purpose…
<apeiros_> s/purpose/functionality/
freedrull [freedrull!~freedrull@freedrull.xen.prgmr.com] has joined #ruby-lang
spectra [spectra!~spectra@debian/developer/spectra] has joined #ruby-lang
<apeiros_> jaimef: if walk_pod is idiomatic (= returns an enumerator if no block is passed), you can use .select instead
voker57 [voker57!~voker57@128-70-27-250.broadband.corbina.ru] has joined #ruby-lang
voker57 [voker57!~voker57@kvirc/developer/Voker57] has joined #ruby-lang
<apeiros_> walk_dna(pod).select { |hash,results| hash['run_list'].include?(role) }.map { |hash,results| File.basename(hash[:node])[/\w+/,0] }
<apeiros_> (that'd be the complete method code then)
<drbrain> if it doesn't return an enumerator then make the first line return enum_for __method__, pod unless block_given?
<apeiros_> jaimef: also, prefixes like get_/set_/is_ are not very idiomatic in ruby.
<apeiros_> we have foo, foo= and foo? instead
<drbrain> ^^ that looks much more awesome when there's no arguments
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
<shevy> apeiros_
<shevy> do we also have
<shevy> moo, moo= moo?
<apeiros_> I don't. but you can make some for yourself.
<shevy> mooooooooooo!
<apeiros_> even that :)
<zzak> oom!
<any-key> ooooooooom!
<any-key> what's happening :|
RomD` [RomD`!~Roman@nrbg-4dbe099b.pool.mediaWays.net] has joined #ruby-lang
<shevy> hmm
flowerpot [flowerpot!~nobody@c-174-61-224-227.hsd1.wa.comcast.net] has joined #ruby-lang
outoftime [outoftime!~mat@ip-160-79-101-2.autorev.intellispace.net] has joined #ruby-lang
mdel [mdel!~mdel@pool-71-175-17-16.phlapa.fios.verizon.net] has joined #ruby-lang
toretore [toretore!~toretore@crr06-3-82-231-12-81.fbx.proxad.net] has joined #ruby-lang
dnyy [dnyy!~u2106@gateway/web/irccloud.com/x-vcxuxvwggijrqjlz] has joined #ruby-lang
ascarter [ascarter!~ascarter@209.119.253.66] has joined #ruby-lang
Spooner [Spooner!~Miranda@host-78-144-139-130.as13285.net] has joined #ruby-lang
srbartlett [srbartlett!~srbartlet@124-170-53-195.dyn.iinet.net.au] has joined #ruby-lang
rushed [rushed!~rushed@cpe-70-116-11-35.austin.res.rr.com] has joined #ruby-lang
RomD`` [RomD``!~Roman@nrbg-4dbe099b.pool.mediaWays.net] has joined #ruby-lang
lsegal` [lsegal`!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
setmeaway2 [setmeaway2!setmeaway3@118.45.149.247] has joined #ruby-lang
bglusman_ [bglusman_!~bglusman@c-71-224-192-35.hsd1.pa.comcast.net] has joined #ruby-lang
Keltia_ [Keltia_!roberto@aran.keltia.net] has joined #ruby-lang
elux_ [elux_!~peter@96.45.198.150] has joined #ruby-lang
Spooner_ [Spooner_!~Miranda@host-78-144-139-130.as13285.net] has joined #ruby-lang
wallerdev_ [wallerdev_!~wallerdev@72.44.102.30] has joined #ruby-lang
morticed [morticed!~Tom@li300-55.members.linode.com] has joined #ruby-lang
jalljo_ [jalljo_!jalljo@im.a.noo-b.com] has joined #ruby-lang
piglop_ [piglop_!~piglop@del63-1-82-243-95-115.fbx.proxad.net] has joined #ruby-lang
bryanl_ [bryanl_!~bryanl@li362-49.members.linode.com] has joined #ruby-lang
lele [lele!~lele@fangorn.windmill.it] has joined #ruby-lang
Indian_ [Indian_!~Indian@unaffiliated/londonmet050] has joined #ruby-lang
a3li [a3li!~alex@gentoo/developer/a3li] has joined #ruby-lang
thrcka [thrcka!~thrcka@ip-89-102-34-33.net.upcbroadband.cz] has joined #ruby-lang
outoftime [outoftime!~mat@ip-160-79-101-2.autorev.intellispace.net] has joined #ruby-lang
spleeze [spleeze!~Spleeze@173-15-131-114-BusName-Philadelphia.hfc.comcastbusiness.net] has joined #ruby-lang
niklasb [niklasb!~codeslay0@p5B310883.dip0.t-ipconnect.de] has joined #ruby-lang
dnyy [dnyy!u2106@gateway/web/irccloud.com/x-fqcutbsdriecpnav] has joined #ruby-lang
hagabaka [hagabaka!~hagabaka@unaffiliated/hagabaka] has joined #ruby-lang
schroedinbug [schroedinbug!~schroedin@71-212-191-172.hlrn.qwest.net] has joined #ruby-lang
dhruvasagar [dhruvasagar!~dhruvasag@65.98.79.137] has joined #ruby-lang
spuk [spuk!~spuk@189.6.30.65] has joined #ruby-lang
<zzak> drbrain: when can we have unicode gem names?
<apeiros_> hopefully not ever
<zzak> im already sitting on λ: http://github.com/zzak/lambda
<drbrain> zzak: probably never
<zzak> :{
<robgleeson> I can see it now
<robgleeson> ráils
arthurlockhart [arthurlockhart!~cinch@60-242-128-8.static.tpgi.com.au] has joined #ruby-lang