Topic for #ruby-lang is now Ruby 1.9.3p0: http://ruby-lang.org | Paste >3 Lines of Text on http://pastie.org
steveklabnik [steveklabnik!~steveklab@c-67-165-87-244.hsd1.pa.comcast.net] has joined #ruby-lang
<steveklabnik> hello everyone
<steveklabnik> anyone good with the C api in here?
<manveru> steveklabnik: plenty who hate it
<zenspider> define "good" :P
<steveklabnik> hahah
<dreinull> see the #rubinius channel
<steveklabnik> my question is pretty basic.
<dreinull> plenty of love there
<zenspider> dreinull: describes map to TestCase classes. its map to test methods
<steveklabnik> i'm changing some stuff that's implemented in C into ruby instead.
meth [meth!~meth@li66-197.members.linode.com] has joined #ruby-lang
<meth> what am I supposed to do about, "licenses must not be nil" ?
<steveklabnik> but sometimes, the C needs to reference the Ruby.
<zenspider> meth: define a license
<meth> idk i just fetched a gem and made a small change
<steveklabnik> I used to have a constant, when the class was being defined by the C api itself. Now I have to grab that from Ruby instead. any pointers?
<steveklabnik> rb_cont_get, I assume
<manveru> lianj: what the hell is that cod even supposed to do?
<zenspider> steveklabnik: just paste
<zenspider> manveru: shock and awe!
<dreinull> zenspider: ok, thanks
<zenspider> ah. you pushed up a rb_define_class and you still have C code that needs the class (or something similar)
<steveklabnik> yeah
<steveklabnik> is what used to exist
<steveklabnik> for example
<steveklabnik> but some of the C code uses those methods and constants
<meth> zenspider: do you know how i can do that ?
<zenspider> rb_const_get(VALUE, ID) will work for top level stuff, you'll need to do the equivalent of the inject hackery to walk down a const tree if it is namespaced
<steveklabnik> it is almost all namespaced.
<steveklabnik> :/
<steveklabnik> what is the inject hackery?
<zenspider> name.split(/::/).inject(Object) { |k,n| k.const_get n }
<zenspider> in your case, you'll just have multiple statics
<steveklabnik> mmm.
<zenspider> one for the top level namespace
<zenspider> and for each one directly under that, etc
<steveklabnik> i'm about to do a METRIC FUCKTON of that
<steveklabnik> over the next few months.
<zenspider> inline.rb has:
<zenspider> ext << @mod.name.split("::").map { |n|
<zenspider> " c = rb_const_get(c, rb_intern(\"#{n}\"));"
<zenspider> }.join("\n")
<steveklabnik> so i guess there's no time like the present to learn...
<erikh> look at strsep()
meth [meth!~meth@li66-197.members.linode.com] has quit [#ruby-lang]
<zenspider> if you don't care about overall speed right now, you can do the inject hack directly
<erikh> that should make it pretty easy
<steveklabnik> speed is totally irrelevant.
<zenspider> but eventually, you should move to static definitions directly
<ged> Anyone have a recommendation for an inifile library that works under 1.9.3?
<steveklabnik> erikh: hrm. what's that?
<erikh> man 3 strsep
<steveklabnik> ahh, nice.
<erikh> basically strtok++
dous [dous!~dous@unaffiliated/dous] has joined #ruby-lang
* steveklabnik nods
<zenspider> steveklabnik: what all are you pushing up to ruby?
<steveklabnik> eventually, almost everything.
<steveklabnik> i picked the smallest class
<steveklabnik> to get started
<steveklabnik> the only thing I want left in C (someday) are the things that are under the shoes_native namespace.
<steveklabnik> it should be a reasonably mechanical transformation.
<steveklabnik> I'm just not that experienced with the C api yet.
<steveklabnik> so it's gonna take me a while.
<steveklabnik> i managed to port that entire class's methods to ruby.
<steveklabnik> it's just the extraneous references that are the issue right this second.
<lantins> erikh: I found this alright https://github.com/TwP/inifile . should work with 1.9.3, though I had to stop using it and just deal with my .ini files direct as they were a bit ... well lets say unreliable
<erikh> I think you want ged ^^
envygeeks [envygeeks!~envygeeks@pdpc/supporter/professional/envygeeks] has joined #ruby-lang
<lantins> erikh: shit
<lantins> ged: see above ;-)
<ged> lantins: Thanks, I'll give it a try. :P
<steveklabnik> oh, and zenspider, how are the rest of the reviews going? I want to try to get another patch or two in this week, but i've stepped away from rubygems for a while
<lantins> ged: it explains the 'rules' of the ini files it expects, if thats fine with your files/input you should find it decent
<ged> lantins: Yeah, mine aren't fancy at all, so I'm hopeful.
<drbrain> steveklabnik: I'm figuring out how to merge Gem::Builder, Gem::Format and Gem::Package into something non-sucky
<steveklabnik> drbrain: hmm, that sounds exciting.
<steveklabnik> i'm not sure i read any of that code.
<erikh> it's eeeeeevil
<drbrain> the tar code itself is ok
<drbrain> but there's some weirdness
<steveklabnik> there's always weirdness.
<steveklabnik> :)
dejongge1 [dejongge1!~jonke@pD9E0DF67.dip0.t-ipconnect.de] has joined #ruby-lang
RickHull [RickHull!~rhull@pdpc/supporter/active/rickhull] has quit [#ruby-lang]
<ged> lantins: It works great; it turns out it's a more up-to-date version of the library I was initially trying to use ('ini'), so I didn't even have to change anything.
<envygeeks> is there a way to segregate threads so that they c an't access variables in the function that created them?
<lantins> ged: sweet dude :)
<steveklabnik> okay, i'm out again while i toil away at this
<steveklabnik> thanks guys.
<drbrain> envygeeks: threads are also closures, so no
<envygeeks> damn :(
<drbrain> except by reducing the number of local variables in-scope when the thread is created
<envygeeks> yeah think I'm gonna have to to use a hash to reduce local variables
<drbrain> envygeeks: well, you can probably work with this: def m() p :woo end; t = Thread.new(&method(:m)); t.join
<drbrain> or by using a pre-defined proc in a clean scope
andrewhl [andrewhl!~andrew@24-246-15-43.cable.teksavvy.com] has joined #ruby-lang
<drbrain> s/in/from
<jorgenpt> What's the preferred way of creating a bin/foo in a gem that works when run during development (using ./bin/foo) and also when deployed as a gem?
<jorgenpt> Works as in finds lib/foo.rb
<drbrain> jorgenpt: ruby -Ilib bin/foo
<jorgenpt> Hrm :/
<jorgenpt> Ok, thanks. :-)
<drbrain> bin/foo should have these three lines:
<drbrain> #!/usr/bin/env ruby
<drbrain> require 'something_in_your_library'
<drbrain> SomthingInYourLibrary.run ARGV
<andrewvos> Amen
dv310p3r [dv310p3r!~dv310p3r@adsl-65-3-161-18.mia.bellsouth.net] has joined #ruby-lang
<andrewvos> Wish I had done that in my projects :(
<deryl> sois that a ruby hail mary or our father?
<erikh> parse error
<deryl> nm, far left orbital location is where i be
dv310p3r [dv310p3r!~dv310p3r@adsl-65-3-161-18.mia.bellsouth.net] has joined #ruby-lang
<lantins> jorgenpt: https://github.com/lantins/postbin/blob/master/bin/postbin ... thats how I done it, main reasion for that project was to build a gem with a executable. couldn't say its the preferred way though =)
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
<drbrain> NO, NO, NEVER
<drbrain> that's what rubygems does for you
<drbrain> and, if you don't have rubygems, -I will do it
<drbrain> … because you're developing
<andrewvos> I imagine this is what rue is doing when he's not in ruby-lang http://www.youtube.com/watch?v=VIs00QjiJZQ
<shevy> lol
<shevy> how do you find such things andrewvos
<drbrain> adding load paths just slows everything down with more stats
<drbrain> stat(2)
<andrewvos> shevy: Reddit.com
<lantins> drbrain: thanks!
neoesque [neoesque!~neoesque@210.59.147.232] has joined #ruby-lang
<drbrain> lantins: yeah, it puts me in AAAAACK mode when I see stuff like that ☹
<lantins> drbrain: heh, I'm just happy to learn something =)
<drbrain> lantins: the other reason I recommend having only 3 lines in bin/foo is that you can test all of it
takaokouji [takaokouji!~takaokouj@nat35.mable.ne.jp] has joined #ruby-lang
<drbrain> you can't test the option parsing stuff as easily as if it were in lib/
<drbrain> I usually put that code in parse_args that hands back a hash
<drbrain> my structure is:
<drbrain> class method ::run which accepts ARGV, class method ::parse_args which returns a Hash of options
<drbrain> then ::run calls ::new with the options hash
<lantins> oh okay, I've always pondered how you'd go around building something with cli options with the ability to test more of it
<lantins> i'll crack open the editor later and have a play :)
<drbrain> I wonder if I have a good example...
dv310p3r [dv310p3r!~dv310p3r@adsl-65-3-161-18.mia.bellsouth.net] has joined #ruby-lang
<drbrain> here's an ok example, every executable has slightly different needs :/
<lantins> drbrain: thanks, can more easily see what you mean
<drbrain> this one probably doesn't have tests, though
SuperTaz_work [SuperTaz_work!~supertaz_@38.99.52.59] has joined #ruby-lang
Carmivore [Carmivore!~carmivmor@ec2-50-19-203-12.compute-1.amazonaws.com] has joined #ruby-lang
jasox [jasox!~jasox@178.239.26.139] has joined #ruby-lang
<ReinH> drbrain: DISAPPOINT
<lantins> heh
<drbrain> ReinH: I know ☹
<drbrain> envygeeks: heh :)
<drbrain> only 165 lines and it's already got code rot!
bglusman [bglusman!~bglusman@c-71-224-192-35.hsd1.pa.comcast.net] has joined #ruby-lang
<envygeeks> inject({}) doesn't work on Ruby 1.8.7?
<drbrain> the diff support is pretty damn sweet, though
<drbrain> envygeeks: ew
<envygeeks> drbrain: was just to stringify keys for comparison
<drbrain> it should work, that's my default reaction to inject
<drbrain> unless you're actually folding
<envygeeks> hmmm it doesn't seem to be working for me :(
<envygeeks> [6] pry(main)> {:herro => 'you'}.inject({}) { |hush, (key, value)| hush[key.to_s] = value } => "you" is what I get
<envygeeks> fixed it, rob reminded me I need to return hush in 1.8.7
dv310p3r [dv310p3r!~dv310p3r@adsl-65-3-161-18.mia.bellsouth.net] has joined #ruby-lang
<manveru> >> {herro: 'you'}.each_with_object({}){|(k,v),o| o[k.to_s] = v }
<manveru> => {"herro"=>"you"}
<manveru> >> {herro: 'you'}.inject({}){|o,(k,v)| o.merge(k.to_s => v) }
<manveru> => {"herro"=>"you"}
savage- [savage-!~savage-@209.118.197.220] has joined #ruby-lang
savage- [savage-!~savage-@209.118.197.220] has joined #ruby-lang
perryh [perryh!~perryh@unaffiliated/perry753] has joined #ruby-lang
jmontross [jmontross!~Adium@static-96-236-65-137.snfcca.dsl-w.verizon.net] has quit [#ruby-lang]
jessemc [jessemc!~jessemc@S01060018396a08f6.ed.shawcable.net] has joined #ruby-lang
igotnolegs [igotnolegs!~igotnoleg@75-162-83-166.slkc.qwest.net] has joined #ruby-lang
toretore [toretore!~toretore@80.163.251.212.customer.cdi.no] has joined #ruby-lang
jessemc [jessemc!~jessemc@S01060018396a08f6.ed.shawcable.net] has joined #ruby-lang
mkscrg [mkscrg!~mkscrg@76-218-100-21.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
<josh9> "6.00".to_f => 6.0 how to always get 2 gidits after the decimal point?
<manveru> >> class Float; def inspect; "%.02f" % self; end; end; "6.00".to_f
<manveru> => 6.00
Carmivore [Carmivore!~carmivmor@ec2-50-19-44-249.compute-1.amazonaws.com] has joined #ruby-lang
<josh9> manveru: sweet!
<josh9> i'll try doing it without opening the Float
<josh9> it's not a good practice, riht
<josh9> right
<manveru> yeah
mkscrg [mkscrg!~mkscrg@76-218-100-21.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
<josh9> manveru: what do u think of "6.00".to_f.round(2)
<erikh> you could use singleton classes
<josh9> erikh: nice
<erikh> f = 6.0; class << f; def inspect ... end; end
<erikh> probably a memory hog though
burgestrand [burgestrand!~burgestra@81-229-85-235-no66.tbcn.telia.com] has joined #ruby-lang
<josh9> how to make this assertion to fail? assert_equal 6.00, 6.0
<josh9> .to_s makes both 6.0
<heftig> they are equal.
<josh9> heftig: not from the user standpoint
<josh9> i want to save everything with 2 digits
<heftig> then save strings.
<josh9> (in my domian objects and db)
<josh9> heftig: or convert in the UI
<canton7> a float is a float, regardless of how it's displayed. When it's displayed, it's converted to a string. During that conversion, you can specify things like the number of decimal places... specifying that for the float itself makes no sense
<josh9> canton7: got it. so it's better to keep it as float and when it's displayed, tweak the presentation
burgestrand1 [burgestrand1!~burgestra@81-229-85-235-no66.tbcn.telia.com] has joined #ruby-lang
<canton7> exactly
burgestrand [burgestrand!~burgestra@81-229-85-235-no66.tbcn.telia.com] has joined #ruby-lang
lsegal [lsegal!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
headius [headius!~headius@71-210-151-185.mpls.qwest.net] has joined #ruby-lang
wkdown [wkdown!wkdown@75.60.4.77] has joined #ruby-lang
looopy [looopy!~looopy@static-71-166-232-207.washdc.east.verizon.net] has joined #ruby-lang
looopy_ [looopy_!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
wimplash [wimplash!~Adium@wireless.sit-co.net] has joined #ruby-lang
jessemc [jessemc!~jessemc@S01060018396a08f6.ed.shawcable.net] has joined #ruby-lang
dfr|mac [dfr|mac!~dfr|work@ool-18baf7e7.dyn.optonline.net] has joined #ruby-lang
jimmyy111 [jimmyy111!jimmy@112.237.26.89] has joined #ruby-lang
<josh9> i am using this: sprintf('%#.2f', "6.0")
<matti> manveru: I did solved the problem :)
<matti> manveru: I can push > 10k events in more or less ~1 second. EventMachine is so amazing :)
jessemc [jessemc!~jessemc@S01060018396a08f6.ed.shawcable.net] has joined #ruby-lang
<bougyman> nice, idn't it?
<matti> bougyman: You mean, the EM?
<bougyman> yah
<matti> Indeed it is :)
<bougyman> i got familiar with it on a project and fell in lust
<bougyman> now i'm like: What's a raw socket?
<matti> bougyman: Haha
<bougyman> cause EM just does all that for me.
<matti> bougyman: And it is so very little code most of the time.
<bougyman> yep
<matti> bougyman: Its is just... magic ;] Unicorns and rainbows.
<matti> I wish Firefox could be that awesome.
<matti> Right now it is about to crash... causing 100% CPU utilisation.
<matti> Meh ;]
<bougyman> if it weren't for the comments https://github.com/rubyists/freeswitcher/blob/master/examples/generic_outbound_router.rb would be like 7 lines of code.
<bougyman> ok, maybe 10
<matti> Haha
<matti> It is also eimpler to use than Twisted in Python.
<matti> I keep finding Twisted... a little twisted.
<matti> ;]
<bougyman> have you seen Untwisted?
<bougyman> the author of that brags about it daily, i haven't really looked at it much.
<matti> I haven't.
<matti> Its a blog?
<bougyman> nah, a python competitor(maybe?) to twisted.
<matti> Ah.
<bougyman> again, haven't looked much, just hear the guy's rant all the time.
<matti> I have came across Eventd (or something like that? citation needed) for Ruby as well.
<bougyman> eventlet
<bougyman> it looked nice.
<bougyman> and revactor
<bougyman> overall EM wins because it's what I use :)
<matti> ;]
<matti> AH.
<matti> No more.. select and Co.
<matti> Life is so nice right now.
<matti> ;]
<matti> bougyman: LOL http://coolio.github.com/ :)
burgestrand1 [burgestrand1!~burgestra@81-229-85-235-no66.tbcn.telia.com] has joined #ruby-lang
burgestrand2 [burgestrand2!~burgestra@81-229-85-235-no66.tbcn.telia.com] has joined #ruby-lang
futureshocked [futureshocked!~futuresho@115-64-72-228.static.tpgi.com.au] has joined #ruby-lang
burgestrand [burgestrand!~burgestra@81-229-85-235-no66.tbcn.telia.com] has joined #ruby-lang
jasox [jasox!~jasox@178.239.26.139] has joined #ruby-lang
ramonmaruko [ramonmaruko!~marco@122.52.126.66] has joined #ruby-lang
tenderlove [tenderlove!~tenderlov@pdpc/supporter/active/tenderlove] has joined #ruby-lang
pabloh [pabloh!~pablo@186.22.82.39] has joined #ruby-lang
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
corsican [corsican!corsican@c-67-161-78-60.hsd1.ca.comcast.net] has joined #ruby-lang
Swimming_Bird [Swimming_Bird!~textual@cpe-68-173-86-46.nyc.res.rr.com] has joined #ruby-lang
burgestrand1 [burgestrand1!~burgestra@81-229-85-235-no66.tbcn.telia.com] has joined #ruby-lang
headius [headius!~headius@71-210-151-185.mpls.qwest.net] has joined #ruby-lang
burgestrand2 [burgestrand2!~burgestra@81-229-85-235-no66.tbcn.telia.com] 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
Natch| [Natch|!~natch@178.73.217.171] has joined #ruby-lang
dr0id [dr0id!~andy@unaffiliated/dr0id] has joined #ruby-lang
ryanf [ryanf!~revfitz@50.0.160.40] has joined #ruby-lang
jimmyy111 [jimmyy111!jimmy@112.237.26.89] has joined #ruby-lang
plusk [plusk!~plusk@201-67-85-241.gnace703.dsl.brasiltelecom.net.br] has joined #ruby-lang
x0F__ [x0F__!~x0F@unaffiliated/x0f] has joined #ruby-lang
jessemc [jessemc!~jessemc@S010678cd8e6f175f.ed.shawcable.net] has joined #ruby-lang
<lantins> making changes to code that was 1.9+ to support 1.8, in my test files is it better to include my helper like this `require File.expand_path('../test_helper', __FILE__)` or another way?
<lantins> tests are run from a Rakefile using Rake::TestTask.new
<lantins> ignore that
jimmyy111 [jimmyy111!jimmy@112.237.26.89] has joined #ruby-lang
<robgleeson> lantins: so then your test helper is available for ya
<robgleeson> you can change the load order if you want
<lantins> i see you can add the test dir to TestTake using `libs`
<robgleeson> you could do that, yeah
<robgleeson> or make sure 'test_helper' is the first element of the array given to files=
<drbrain> I have taken to writing lib/my_library/test_case.rb and having all my tests require that instead of test/test_helper.rb
<drbrain> I don't have to worry about having test/ in my load path and MyLibrary::TestCase is also reusable by people extending my library, which I think is a nice benefit
<lantins> robgleeson: ahhh, yeah i see both work. any reasion to do one method over the other?
amerine [amerine!~mturner@bc171197.bendcable.com] has joined #ruby-lang
<robgleeson> not really
<lantins> robgleeson: okay, thanks
<robgleeson> np
<lantins> drbrain: not sure i follow?
<lantins> are you saying what people usually have in there test/test_helper.rb you put in a file inside your lib directory?
<drbrain> and
Natch| [Natch|!~natch@178.73.216.150] has joined #ruby-lang
<drbrain> lantins: correct
<robgleeson> drbrain: so all your tests are subclasses of TestCase?
<drbrain> lantins: so if you wanted to write some extension to opengl you could use my test helper methods
<drbrain> robgleeson: yeah
<robgleeson> drbrain: is that not awkward with something like minitest/spec?
<drbrain> I think RubyGems has 3 different TestCase subclasses
<lantins> drbrain: okay, but have that extension inside your own projects dirs rather then adding it to the libs test suite?
<drbrain> robgleeson: I think this strategy only works for unit-style tests ☹
<robgleeson> ah
<lantins> drbrain: if i was making an extension of my own that is
<lantins> think I understand what your saying :)
<drbrain> opengl/test_case lives in opengl, and your extension simply requires it
<drbrain> … which will also load opengl
<drbrain> (because you'll probably need that for your extension)
<drbrain> I don't know if I answered your question
<lantins> yeah thats a good summary, I thaught I got it before, now I'm sure =)
<lantins> thanks :)
<drbrain> my tests and your tests would be separate, but you'd get the advantage of all my work getting a proper setup/teardown and other utilities I may need
<lantins> yup, i think thats really cool!
<drbrain> robgleeson: for minitest/spec-type tests could you have lib/my_library/spec_helpers.rb ?
<drbrain> and require that from each spec file?
<drbrain> robgleeson: you just use top-level methods, right?
<robgleeson> you could have TestCase be a subclass of MiniTest::Spec, then create a subclass of TestCase
<robgleeson> but it'd be bit annoying to do that for every test case
<drbrain> or MyLibrary::Spec
<robgleeson> yeah
<drbrain> yeah, I can see it being annoying
Rich_Morin [Rich_Morin!~rdm@cfcl.com] has joined #ruby-lang
<drbrain> the downside of this approach is that it locks extension writers into using my preferred test framework
<drbrain> they either use minitest or reinvent the wheel
gregmore_ [gregmore_!~gregmoren@S01067444012f4469.vc.shawcable.net] has joined #ruby-lang
<drbrain> a module providing setup/teardown and utilities that's included into MyLibrary::TestCase may be sufficient, though, since you could include it where necessary
andrewhl [andrewhl!~andrew@24-246-15-43.cable.teksavvy.com] has joined #ruby-lang
andrewhl [andrewhl!~andrew@24-246-15-43.cable.teksavvy.com] has joined #ruby-lang
krz [krz!~foobar@unaffiliated/krz] has joined #ruby-lang
ksinkar [ksinkar!~ksinkar@117.195.107.159] has joined #ruby-lang
Natch| [Natch|!~natch@178.73.216.150] has joined #ruby-lang
mkscrg [mkscrg!~mkscrg@76-218-100-21.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
lsegal [lsegal!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
kitallis [kitallis!~kitallis@122.172.248.47] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
Marco [Marco!~marco@Marco-2.Kiewit.Dartmouth.EDU] has joined #ruby-lang
<josh9> how to implement << on an array that is an instance variable of my class?
<josh9> class User @products = [] end
<josh9> usr.products << product1
vmatiyko [vmatiyko!~vmatiyko@178.120.67.145] has joined #ruby-lang
burgestrand1 [burgestrand1!~burgestra@81-229-85-235-no66.tbcn.telia.com] has joined #ruby-lang
<lantins> josh9: use `attr_accessor :products` and init it to an empty array inside your initialize method?
<lantins> josh9: https://gist.github.com/1558714 - does that help?
<josh9> lantins: let me see
<josh9> lantins: i want my products array to be unique, so i want to add some code right after << is used.
<josh9> i was thinking of singletone method - def @products.<<(product)
<josh9> but it's not callind it.
<josh9> calling
Banistergalaxy [Banistergalaxy!~AndChat@222.153.223.45] has joined #ruby-lang
<Banistergalaxy> Hai2u
<lantins> josh9: when you say it needs to be unique how do you mean? prevent duplicate products from being in it?
<sj26> josh9: this is about as close as you'll get: class User; def add_product product; @products << product; end; end
<sj26> unless you expose the whole products array
yxhuvud [yxhuvud!mongo@h-17-181.a149.priv.bahnhof.se] has joined #ruby-lang
<lantins> josh9: you could always do something like this: https://gist.github.com/1558714/25311dcd643b34676969c3cd9e4514cf79a8c952
<sj26> wait, that's an instance variable on the eigenclass?
<sj26> josh9: why don't you just use a set instead of an array?
<bougyman> a product is likely going to have attributes, anyway.
<bougyman> a hash would guarantee uniqueness, though not in any orderly way.
benwoody [benwoody!~ben@ln.benwoodall.com] has quit [#ruby-lang]
m2querd [m2querd!~m2querd@41.183.20.202] has joined #ruby-lang
gianlucadv [gianlucadv!~gianlucad@host175-49-dynamic.1-79-r.retail.telecomitalia.it] has joined #ruby-lang
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
havenn [havenn!~skipper@pool-72-67-31-69.lsanca.fios.verizon.net] has joined #ruby-lang
<josh9> lantins: unique in my case is product.url
<josh9> sj26: i can use add_product but i thought it's nice to use <<
<sj26> josh9: the only way to achieve that is as lantins suggests, create a custom array class and override <<
<sj26> or include a module into the eigenclass of the specific array you construct
<sj26> josh9, this works: https://gist.github.com/1558806
<josh9> lantins: nice idea, the inherintance one
<josh9> sj26: yeah, that's what i wanted to do. let me see
Rich_Morin [Rich_Morin!~rdm@cfcl.com] has quit [#ruby-lang]
<sj26> updated with an example in a class: https://gist.github.com/1558806
<sj26> or a more practical and probably applicable example now at the end: https://gist.github.com/1558806
<sj26> try to mixin a module, saves replicating methods for every instance
<josh9> sj26: OMG! instance_eval
<josh9> never used it but maybe it's about time...
gasbakid [gasbakid!~gasbakid@41.96.98.89] has joined #ruby-lang
<drbrain> it's never time to instance_eval
<josh9> (:
arthurlockhart [arthurlockhart!~cinch@60-242-128-8.static.tpgi.com.au] has joined #ruby-lang
<josh9> is it dangerous? i don't see the reason to use it in this case. i can just do blah.a << 2
<drbrain> it's not dangerous
<drbrain> there's often (not always) a simpler way
<drbrain> it's easy to abuse is all
herrclark [herrclark!~herrclark@59-112-212-56.dynamic.hinet.net] has joined #ruby-lang
savage-_ [savage-_!~savage-@209.118.197.220] has joined #ruby-lang
mdel_ [mdel_!~mdel@pool-71-175-17-16.phlapa.fios.verizon.net] has joined #ruby-lang
sandelius [sandelius!~textual@90-231-202-62-no214.tbcn.telia.com] has joined #ruby-lang
jkprg [jkprg!~jarda@ip-62-245-93-150.net.upcbroadband.cz] has joined #ruby-lang
gasbakid [gasbakid!~gasbakid@41.96.73.175] has joined #ruby-lang
twittard [twittard!~twittard@cpe-76-169-74-39.socal.res.rr.com] has joined #ruby-lang
<josh9> sj26: so a mixed module is shared? that's cool
Rich_Morin [Rich_Morin!~rdm@cfcl.com] has joined #ruby-lang
thone_ [thone_!~thone@g225087199.adsl.alicedsl.de] has joined #ruby-lang
headius [headius!~headius@71-210-151-185.mpls.qwest.net] has joined #ruby-lang
savage- [savage-!~savage-@c-67-180-11-89.hsd1.ca.comcast.net] has joined #ruby-lang
retro|cz [retro|cz!~retro@106.142.broadband6.iol.cz] has joined #ruby-lang
Randroid [Randroid!~gregory@static-72-91-82-26.tampfl.fios.verizon.net] has joined #ruby-lang
solars [solars!~solars@clnet-kmu02-090.ikbnet.co.at] has joined #ruby-lang
mdel_ [mdel_!~mdel@pool-71-175-17-16.phlapa.fios.verizon.net] has joined #ruby-lang
perryh [perryh!~perryh@unaffiliated/perry753] has joined #ruby-lang
cyri_ [cyri_!~cyri_@236.200.72.86.rev.sfr.net] has joined #ruby-lang
shevy [shevy!~shevy@194-166-100-13.adsl.highway.telekom.at] has joined #ruby-lang
zmack [zmack!~zmack@109.99.235.103] has joined #ruby-lang
mytrile [mytrile!~mytrile@94.26.28.135] has joined #ruby-lang
thrcka [thrcka!~thrcka@ip-89-102-34-33.net.upcbroadband.cz] has joined #ruby-lang
whatasunnyday [whatasunnyday!~whatasunn@c-24-130-81-47.hsd1.ca.comcast.net] has joined #ruby-lang
<josh9> i am extending an array variable with a module that overrides << i just figure out that if i want to change self inside my method, i should use self.replace.. just wanted to share..
kyrylo [kyrylo!~kyrylo@46.118.220.94] has joined #ruby-lang
WiiW [WiiW!~sevkzh@unaffiliated/sevkme] has joined #ruby-lang
<WiiW> how to read a large file, on it's pos at 2000000 ?
<yorickpeterse> pos as in character number of line number?
<WiiW> yorickpeterse: pos as byte number
<yorickpeterse> #read() takes a limit and offset I believe
<yorickpeterse> (File#read/IO.read)
Manhose [Manhose!~Manhose@dial-b1-238-132.telepac.pt] has joined #ruby-lang
ramonmaruko [ramonmaruko!~marco@122.52.126.66] has joined #ruby-lang
<WiiW> yorickpeterse: ok
<yorickpeterse> For IO that would be IO.read('file', length, offset)
<WiiW> yorickpeterse: and but IO.write as the same ?
<WiiW> replace at that pos to write .
<rue> Or just seek
<yorickpeterse> Hm, seems File#read doesn't take an offset
<rue> #seek, that is.
<WiiW> yorickpeterse: I find File.seek , but File.write does't write at that pos
<yorickpeterse> rue: ah
<WiiW> rue: File.read can follow that pos . But File.write always write at end , not on pos .
daglees [daglees!~belvedere@unaffiliated/daglees] has joined #ruby-lang
retro|cz [retro|cz!~retro@106.142.broadband6.iol.cz] has joined #ruby-lang
<rue> You said read :P
<WiiW> I will need write next time
tychobrailleur [tychobrailleur!~sebastien@176.61.72.130] has joined #ruby-lang
<rue> WiiW: You need to open the file r+
Asher [Asher!~asher@98.158.127.150] has joined #ruby-lang
<WiiW> rue: oh , got it . thanks
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby-lang
Locke23rus [Locke23rus!~quassel@128-70-109-104.broadband.corbina.ru] has joined #ruby-lang
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby-lang
jjp [jjp!~jjp@info-1.adm.espci.fr] has joined #ruby-lang
darkswoop [darkswoop!~darkswoop@31-19-44-89-dynip.superkabel.de] has joined #ruby-lang
WillMarshall [WillMarshall!~willmarsh@ppp121-44-64-47.lns20.syd6.internode.on.net] has joined #ruby-lang
brahmana [brahmana!3b5cb04e@gateway/web/freenode/ip.59.92.176.78] has joined #ruby-lang
<brahmana> Hi all
<brahmana> Is there a way to update an installed gem to a particular version?
<brahmana> I do not see a --version option in the help doc of update command and when I tried it, I got an error saying "no such gem as version"
srbartlett [srbartlett!~srbartlet@124-168-200-61.dyn.iinet.net.au] has joined #ruby-lang
<brahmana> To be precise I have rails 3.0.0 and want to update to 3.0.11
gnufied [gnufied!~gnufied@122.172.246.117] has joined #ruby-lang
<brahmana> where as the latest rails gem is 3.1.3
<josh9> brahmana: are u using bundler and Gemfile?
<brahmana> josh9: Yes, I am. But I was wondering if I can do it from the command line via "gem update"
<josh9> brahmana: not sure.. i would just modify the Gemfile
<Asher> i believe you can do gem install rails-3.0.11
<brahmana> Asher: Wouldn't that keep both v3.0.0 and v3.0.11?
<Asher> yes but if you're using bundler then you can specify which one you want
<Asher> you can also do gem uninstall rails-3.0.0
<brahmana> Ok
<brahmana> Which one will come into action when using the "rails" command from the shell?
* brahmana wonders if that question should go to #rubyonrails
<Asher> the newest one should
<brahmana> Ok
<Asher> rubygems should take care of hte install path to point to the newest one
<Asher> but bundler doesn't use rubygems
charper [charper!u1691@gateway/web/irccloud.com/x-dutbucsnanhhxwjx] has joined #ruby-lang
PhilCK [PhilCK!~anonymous@cpc2-sgyl30-2-0-cust158.sgyl.cable.virginmedia.com] has joined #ruby-lang
tla [tla!~tla@toelboell-lund.dk] has joined #ruby-lang
hzlocky [hzlocky!~me@dynamic-vpdn-93-125-16-28.telecom.by] has joined #ruby-lang
|Vargas| [|Vargas|!~luke@host17-129-dynamic.54-79-r.retail.telecomitalia.it] has joined #ruby-lang
|Vargas| [|Vargas|!~luke@pdpc/supporter/profesional/vargas] has joined #ruby-lang
canton7 [canton7!~canton7@95.150.107.113] has joined #ruby-lang
canton8 [canton8!~canton7@95.150.107.113] has joined #ruby-lang
ddfreyne [ddfreyne!~denisdefr@stoneship.org] has joined #ruby-lang
publicvoid_ [publicvoid_!~publicvoi@p4FCAEA34.dip.t-dialin.net] has joined #ruby-lang
gnufied [gnufied!~gnufied@122.172.246.117] has joined #ruby-lang
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby-lang
Codif [Codif!~codif@84.120.204.160.dyn.user.ono.com] has joined #ruby-lang
micha-- [micha--!~micha--@i59F6A59B.versanet.de] has joined #ruby-lang
<micha--> hi, is there an easy way to make a gui dialog on linux? i just need a ok/cancel box...
<Asher> shoes might suit you
<charper> or ruby-gnome .
<micha--> Asher: i tried to install that once, didn't succeed
<Asher> "didn't succeed"?
<micha--> Asher: as far as i remember, it's installable only in windows
<Asher> it works on mac… i would be quite surprised if it didn't work on linux
<Asher> there is even a screenshot there of it running on… gnome i think
<Asher> if you want to pastie the error or whatnot we can probably help you figure it out
<Asher> and the shoes maintainer is a regular here
<micha--> ok, I'll try again...
<micha--> the installer from shoesrb.com stops with "./shoes-3.1.0.run: Zeile 391: ./shoes: Datei oder Verzeichnis nicht gefunden"
<micha--> which means "File or directory not found"
<Asher> how about "gem install shoes"
<dreinull> how do I properly do this in RDoc: <tt>hash[key]</tt> withouth creating a link?
<micha--> hm. i read somewhere that shoes doesn't work that way -- seems like that's wrong :-)
daglees__ [daglees__!~belvedere@unaffiliated/daglees] has joined #ruby-lang
sora_h [sora_h!~sora_h@mayfield.privs.net] has joined #ruby-lang
Locke23rus_ [Locke23rus_!~quassel@128-70-119-37.broadband.corbina.ru] has joined #ruby-lang
davidw [davidw!~davidw@host228-251-static.95-94-b.business.telecomitalia.it] has joined #ruby-lang
<micha--> Asher: require 'shoes' tells me "Sorry, this gem currently does nothing. Team Shoes is working on Gemifying Shoes, and this is just a placeholder until then."
<Asher> ah i see
RomD [RomD!~Roman@nrbg-4d0774f1.pool.mediaWays.net] has joined #ruby-lang
<Asher> what dist are you using
<micha--> Debian
<workmad3> micha--: install the green_shoes gem
<workmad3> micha--: it's a gemified shoes implementation for the QT framework
<micha--> workmad3: looks good
<micha--> but it seems to install a lot of gtk/gnome stuff, even better than qt for me
<workmad3> micha--: ah, I guess it's GTK then :)
<workmad3> micha--: I think I got confused with green_shoes and capybara-webkit for UI frameworks :)
<micha--> :-)
kvs [kvs!~kvs@naboo.binarysolutions.dk] has joined #ruby-lang
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby-lang
uniqanomaly [uniqanomaly!~ua@dynamic-78-8-91-63.ssp.dialog.net.pl] has joined #ruby-lang
jensn [jensn!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby-lang
canton7 [canton7!~canton7@95.150.107.113] has joined #ruby-lang
RomD [RomD!~Roman@nrbg-4d0774f1.pool.mediaWays.net] has joined #ruby-lang
chrismcg [chrismcg!~chrismcg@pdpc/supporter/active/chrismcg] has joined #ruby-lang
dous [dous!~dous@unaffiliated/dous] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
tcurdt [tcurdt!~tcurdt@dslb-188-097-009-235.pools.arcor-ip.net] has joined #ruby-lang
thrcka [thrcka!~thrcka@ip-89-102-34-33.net.upcbroadband.cz] has joined #ruby-lang
Foxmaster [Foxmaster!~root@c-83-219-199-232.cust.bredband2.com] has joined #ruby-lang
looopy [looopy!~looopy@pool-141-156-46-253.washdc.btas.verizon.net] has joined #ruby-lang
<erikh> rue: uh, if you want some chef help, I'm happy to help
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby-lang
vereteran [vereteran!~vereteran@static.88-198-170-117.clients.your-server.de] has joined #ruby-lang
daglees___ [daglees___!~belvedere@unaffiliated/daglees] has joined #ruby-lang
savage- [savage-!~savage-@c-67-180-11-89.hsd1.ca.comcast.net] has joined #ruby-lang
kitallis [kitallis!~kitallis@122.172.248.47] has joined #ruby-lang
naz [naz!~n@70.44.2.190.res-cmts.bus.ptd.net] has joined #ruby-lang
daglees___ [daglees___!~belvedere@unaffiliated/daglees] has joined #ruby-lang
alois [alois!~alois@188.80.broadband5.iol.cz] has joined #ruby-lang
mantono [mantono!~mantono@83.251.126.234] has joined #ruby-lang
cyri_ [cyri_!~cyri_@236.200.72.86.rev.sfr.net] has joined #ruby-lang
kitallis [kitallis!~kitallis@122.172.248.47] has joined #ruby-lang
mark_locklear [mark_locklear!~jlocklear@ab-tech-lan-to-ab-tech-gw.ncren.net] has joined #ruby-lang
tomzx [tomzx!~tomzx@dsl-216-221-39-59.aei.ca] has joined #ruby-lang
mark_locklear [mark_locklear!~jlocklear@ab-tech-lan-to-ab-tech-gw.ncren.net] has joined #ruby-lang
dustin_ [dustin_!~ddeyoung@99-7-24-156.lightspeed.iplsin.sbcglobal.net] has joined #ruby-lang
Pip [Pip!~Pip@host-190-146-66-217.spbmts.ru] has joined #ruby-lang
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
tbuehlmann [tbuehlmann!Tobias@unaffiliated/tovias] has joined #ruby-lang
looopy_ [looopy_!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
tommyvyo_ [tommyvyo_!~tommyvyo@38.123.129.115] has joined #ruby-lang
tommyvyo [tommyvyo!~tommyvyo@38.123.129.115] has joined #ruby-lang
tcurdt [tcurdt!~tcurdt@dslb-188-097-009-235.pools.arcor-ip.net] has joined #ruby-lang
niklasb [niklasb!~codeslay0@p5B310A49.dip0.t-ipconnect.de] has joined #ruby-lang
cantbecool [cantbecool!~cantbecoo@173-15-164-136-BusName-Philadelphia.hfc.comcastbusiness.net] has joined #ruby-lang
yfeldblum [yfeldblum!~Jay@pool-71-246-76-76.bltmmd.east.verizon.net] has joined #ruby-lang
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
Austin__ [Austin__!~austin@CPE0016cbc30e9c-CM001ceacff6ba.cpe.net.cable.rogers.com] has joined #ruby-lang
jasox [jasox!~jasox@178.239.26.139] has joined #ruby-lang
malev [malev!~malev@190.210.138.237] has joined #ruby-lang
toretore [toretore!~toretore@crr06-3-82-231-12-81.fbx.proxad.net] has joined #ruby-lang
micha-- [micha--!~micha--@i59F6A59B.versanet.de] has joined #ruby-lang
gearaholic [gearaholic!~gearaholi@c-71-238-98-243.hsd1.mi.comcast.net] has joined #ruby-lang
wkdown [wkdown!~Adium@63.146.80.82] has joined #ruby-lang
micha-- [micha--!~micha--@i59F6A59B.versanet.de] has joined #ruby-lang
takaokouji [takaokouji!~takaokouj@nat35.mable.ne.jp] has joined #ruby-lang
indstry [indstry!~apple@c-71-238-98-243.hsd1.mi.comcast.net] has joined #ruby-lang
dv310p3r [dv310p3r!~dv310p3r@216.199.155.226.nw.nuvox.net] has joined #ruby-lang
sepp2k [sepp2k!~sexy@g224101025.adsl.alicedsl.de] has joined #ruby-lang
bglusman [bglusman!~bglusman@c-68-80-200-61.hsd1.pa.comcast.net] has joined #ruby-lang
zerokarmaleft [zerokarmaleft!zkl@morpheus.net] has joined #ruby-lang
Asher [Asher!~asher@98.158.127.150] has joined #ruby-lang
Asher [Asher!~asher@98.158.127.150] has joined #ruby-lang
seii [seii!~sei@user-3c2h3m6.cable.mindspring.com] has joined #ruby-lang
uncle_billy [uncle_billy!~Adium@static-224.service.govdelivery.com] has joined #ruby-lang
plusk [plusk!~plusk@201-34-211-49.gnace703.dsl.brasiltelecom.net.br] has joined #ruby-lang
mccraig [mccraig!u574@gateway/web/irccloud.com/x-bszuuvhbsehgjisr] has joined #ruby-lang
dfr|mac [dfr|mac!~dfr|work@ool-18baf7e7.dyn.optonline.net] has joined #ruby-lang
llaskin [llaskin!~Leo@c-24-128-198-93.hsd1.ma.comcast.net] has joined #ruby-lang
<llaskin> hi, can someone help me with this gist: https://gist.github.com/1560250 ?
<llaskin> it doesn't seem to output a valid CSV
<llaskin> it just ends up being a series of numbers in the CSV file
cantbecool [cantbecool!~cantbecoo@173-15-164-136-BusName-Philadelphia.hfc.comcastbusiness.net] has joined #ruby-lang
cantbecool [cantbecool!~cantbecoo@173-15-164-136-BusName-Philadelphia.hfc.comcastbusiness.net] has joined #ruby-lang
<rue> erikh: Thanks, I'm still kinda deciding between it and Puppet… I've to move servers in a while, and I figured I'd do it right this time
looopy [looopy!~looopy@pool-141-156-46-253.washdc.btas.verizon.net] has joined #ruby-lang
davidw [davidw!~davidw@apache/committer/davidw] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
virunga [virunga!~virunga@151.64.15.224] has joined #ruby-lang
janissary [janissary!~user@adsl-98-85-0-232.mco.bellsouth.net] has joined #ruby-lang
flip_digits [flip_digits!~textual@c-76-122-14-228.hsd1.fl.comcast.net] has joined #ruby-lang
leonL [leonL!~leonl@CPE0024a5b652a3-CM000f21205d86.cpe.net.cable.rogers.com] has joined #ruby-lang
Marco [Marco!~marco@pat32.dartmouth-secure.border1-cfw.Dartmouth.EDU] has joined #ruby-lang
canton7 [canton7!~canton7@95.150.107.113] has joined #ruby-lang
headius [headius!~headius@71-210-151-185.mpls.qwest.net] has joined #ruby-lang
enebo [enebo!~enebo@75-168-34-188.mpls.qwest.net] has joined #ruby-lang
imperator [imperator!~Daniel@63-225-247-192.hlrn.qwest.net] has joined #ruby-lang
<erikh> rue: yar. just let me know if you have any questions
<erikh> I know the chef stuff pretty well at this point; pretty much have been spending all day in it for the last 6 months or so
sora_h [sora_h!~sora_h@mayfield.privs.net] has joined #ruby-lang
looopy_ [looopy_!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
Swimming_Bird [Swimming_Bird!~textual@64.70.114.89] has joined #ruby-lang
Spooner [Spooner!~Miranda@host-78-144-139-130.as13285.net] has joined #ruby-lang
<robgleeson> what do you use Chef for? Sys admin tasks?
bjensen [bjensen!~brianj@0x3e87c9ee.terminal.tdcmobil.dk] has joined #ruby-lang
<bjensen> When using Rails. Is there a big performance gain on using jruby compared to ruby 1.9.3p0?
<shevy> bjensen not sure about rails, I think jruby is faster than 1.9.3 everywhere though, startup time ignored
<imperator> shevy, not necessarily true
<imperator> besides, the web server and/or the database is usually the bottleneck, not the language
llaskin [llaskin!~Leo@c-24-128-198-93.hsd1.ma.comcast.net] has quit [#ruby-lang]
<bjensen> well Im using nginx + unicorn, I can't come up with anything faster than that
<bjensen> caching excluded
<imperator> alright, when did chrome start getting confused by .tar.gz file extensions? weird
<imperator> bjensen, is your app Fast Enough?
<shevy> down with chromers!
<bjensen> Its never fast enough :D
<bjensen> Im dev AND a product owner ;-)
<shevy> imagine matz
jacobwg [jacobwg!~jacobwg@143.sub-75-224-219.myvzw.com] has joined #ruby-lang
<shevy> every time he has to hear "ruby is too slow"
<shevy> :D
<imperator> bjensen, well, there's one sure fire way to find out, eh?
<bjensen> Well Im sure people have walked that path before so I was just hoping some of them were in here :)
<bjensen> to tell me about it
<imperator> maybe in #rails ?
<imperator> er, i guess it's #rubyonrails
zmack [zmack!~zmack@78.97.129.175] has joined #ruby-lang
* imperator builds 1.9.3-p-uh-oh
<shevy> lol
outoftime [outoftime!~mat@50.57.10.189] has joined #ruby-lang
scampbell [scampbell!~scampbell@mail.scampbell.net] has joined #ruby-lang
<imperator> alright, wtf is this libyaml shit?
<bougyman> bjensen: what's your r/s on the raw rails app?
<bougyman> and what do you want it to be?
cschneid [cschneid!~cschneid@72.1.92.57] has joined #ruby-lang
<bjensen> I haven't measured lately. I just noticed that render time was increased from rails 3.0 to rails 3.1
confounds [confounds!~confounds@CPE78cd8e667600-CM78cd8e6675fd.cpe.net.cable.rogers.com] has joined #ruby-lang
spleeze [spleeze!~Spleeze@173-15-131-114-BusName-Philadelphia.hfc.comcastbusiness.net] has joined #ruby-lang
mitchty [mitchty!~mitchty@ec2-50-19-41-37.compute-1.amazonaws.com] has joined #ruby-lang
<shevy> haha imperator :D
<shevy> psych.rb needs it
<imperator> and rubygems packaged with 1.9.3 needs it
<imperator> apparently
<imperator> and, even though i installed it and rebuilt and reinstalled psych, it's still whining
<shevy> yeah
<shevy> I had that too
<imperator> this is crap
leonL [leonL!~leonl@CPE0024a5b652a3-CM000f21205d86.cpe.net.cable.rogers.com] has joined #ruby-lang
<shevy> I dunno, I think I removed it, and installed it again... and compiled ruby again... and somehow it worked suddenly
lele [lele!~lele@fangorn.windmill.it] has joined #ruby-lang
Asher [Asher!~asher@98.158.127.150] has joined #ruby-lang
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
<imperator> yep, and to install :(
<imperator> er, *had*
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
Marco [Marco!~marco@pat32.dartmouth-secure.border1-cfw.Dartmouth.EDU] has joined #ruby-lang
RickHull [RickHull!~rhull@209.119.14.25] has joined #ruby-lang
Marco__ [Marco__!~marco@pat32.dartmouth-secure.border1-cfw.Dartmouth.EDU] has joined #ruby-lang
lsegal [lsegal!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
andrewhl [andrewhl!~andrew@24-246-15-43.cable.teksavvy.com] has joined #ruby-lang
Asher [Asher!~asher@98.158.127.150] has joined #ruby-lang
jarrod__ [jarrod__!~jarrod@rrcs-24-153-217-133.sw.biz.rr.com] has joined #ruby-lang
RickHull [RickHull!~rhull@pdpc/supporter/active/rickhull] has joined #ruby-lang
<imperator> anyone know of a standard sparse file location on osx?
artOfWar [artOfWar!~artofwar@nat/yahoo/x-nyputugdffusnple] has joined #ruby-lang
Swimming_Bird [Swimming_Bird!~textual@64.70.114.89] has joined #ruby-lang
nofxx [nofxx!~nofxx@unaffiliated/nofxx] has joined #ruby-lang
apeiros_ [apeiros_!~apeiros@77-58-113-31.dclient.hispeed.ch] has joined #ruby-lang
<imperator> oh, nm, hfs doesn't support sparse file creation :|
Jade [Jade!~jade@unaffiliated/jade] has joined #ruby-lang
<erikh> robgleeson: automation
<erikh> configuring servers and networks
micha-- [micha--!~micha--@i59F6A59B.versanet.de] has joined #ruby-lang
outoftime [outoftime!~mat@50.57.10.189] has joined #ruby-lang
slyphon [slyphon!~weechat@unaffiliated/slyphon] has joined #ruby-lang
bjensen [bjensen!~brianj@3007ds3-ar.0.fullrate.dk] has joined #ruby-lang
tenderlove [tenderlove!~tenderlov@pdpc/supporter/active/tenderlove] has joined #ruby-lang
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
slyphon [slyphon!~weechat@unaffiliated/slyphon] has joined #ruby-lang
arium [arium!~Vitaly@124-56-221-62.static.lviv.farlep.net] has joined #ruby-lang
<Rich_Morin> I'm using rubygems-mirror and see something odd. All of the (>100K) gems live in a single directory. Is this the way they are actually stored on rubygems.org?
<arium> Guys, how to make my class to behave like an array? I have TodoList class and want just to push instances of Todo class as into array: todolist_instance << Todo.new("make coffee") and then get it: todolist_instance[1,2,5] (should return first, second end fifth todos)
<apeiros_> arium: << and [] are just plain methods
<apeiros_> def <<(value); …; end
<apeiros_> and: def [](*keys); …; end
<arium> apeiros_: Thanks! What about mixing Enumerable and then overriding << and [] methods? Isn't it a way?
<apeiros_> arium: Enumerable does not define << nor []
<apeiros_> so you wouldn't be overriding them
<apeiros_> but yes, mixing Enumerable is a good idea
<apeiros_> don't forget, you need to define `each` for Enumerable to work.
<arium> apeiros_: thank you
enebo [enebo!~enebo@97-127-70-138.mpls.qwest.net] has joined #ruby-lang
<apeiros_> you're welcome
livinded [livinded!~lolwut@pool-108-23-242-132.lsanca.fios.verizon.net] has joined #ruby-lang
dejongge [dejongge!~jonke@pD9E0DF67.dip0.t-ipconnect.de] has joined #ruby-lang
headius [headius!~headius@71-210-151-185.mpls.qwest.net] has joined #ruby-lang
tenderlove [tenderlove!~tenderlov@pdpc/supporter/active/tenderlove] has joined #ruby-lang
thrcka [thrcka!~thrcka@ip-89-102-34-33.net.upcbroadband.cz] has joined #ruby-lang
tenderlove [tenderlove!~tenderlov@pdpc/supporter/active/tenderlove] has joined #ruby-lang
spleeze [spleeze!~Spleeze@173-15-131-114-BusName-Philadelphia.hfc.comcastbusiness.net] has joined #ruby-lang
arium1 [arium1!~Vitaly@124-56-221-62.static.lviv.farlep.net] has joined #ruby-lang
<Tasser> arium, I'd start with 0
<Tasser> arium, otherwise your class won't behave like an array
butchanton [butchanton!~butchanto@vpn-sanfran.exacttarget.com] has joined #ruby-lang
<erikh> Rich_Morin: they're on S3, but more or less
Marco [Marco!~marco@pat160.dartmouth-secure.border2-cfw.Dartmouth.EDU] has joined #ruby-lang
<Rich_Morin> Well, S3 (IIRC) is basically a flat namespace, so this makes sense. I was wondering about the efficiency of having a directory with that many items...
Marco_ [Marco_!~marco@pat32.dartmouth-secure.border1-cfw.Dartmouth.EDU] has joined #ruby-lang
<apeiros_> Rich_Morin: depends on the file system
<apeiros_> afaik many don't cope well with more than a couple of hundred files per directory
<apeiros_> which is why you occassionally see hashed directory structures
<Rich_Morin> yep
<Rich_Morin> In V7 Unix, IIRC, the directory was a linear list of name/inode tuples. Didn't handle large directories well. BSD added inode caching, etc.
bjensen [bjensen!~brianj@3007ds3-ar.0.fullrate.dk] has joined #ruby-lang
outoftime [outoftime!~mat@ip-160-79-101-2.autorev.intellispace.net] has joined #ruby-lang
SuperTaz_work [SuperTaz_work!~supertaz_@38.99.52.59] has joined #ruby-lang
darkf [darkf!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
cylence [cylence!~cylence@64-71-24-18.static.wiline.com] has joined #ruby-lang
malev [malev!~malev@190.210.138.237] has joined #ruby-lang
dustin_ [dustin_!~ddeyoung@118.sub-174-253-29.myvzw.com] has joined #ruby-lang
<arium1> How to implement events in Ruby? Each time I add value to array I want it be saved to database. Could I set something like event 'on push' on array and describe saving to database code in it?
<apeiros_> ruby is not an AOP language. one way to do it is to override the methods in question, another way is to wrap the whole object into a proxy.
<RickHull> also, seems like a bad idea. arrays strictly within ruby interpreter have few failure modes. talking to an external DB introduces many more. you probably won't want to treat this thing "like an array"
Rich_Morin [Rich_Morin!~rdm@cfcl.com] has quit [#ruby-lang]
<RickHull> similar to how RPC seems great in theory but tends to be troublesome in practice
diegoviola [diegoviola!~viola@host-1-211.b15.cvc.com.py] has joined #ruby-lang
<arium1> Should I just write method 'array_save' with saving to database implementation and call it each time I add something to array?
frangiz [frangiz!~frangiz@user26.77-105-206.netatonce.net] has joined #ruby-lang
<shevy> seems like one simple way to solve it
mkscrg [mkscrg!~mkscrg@76-218-100-21.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
benanne [benanne!~rijdier@ip-213-49-106-58.dsl.scarlet.be] has joined #ruby-lang
aarkerio [aarkerio!~aarkerio@201.141.94.20] has joined #ruby-lang
<aarkerio> hi! I am noob in ruby, in:
slyphon [slyphon!~weechat@unaffiliated/slyphon] has joined #ruby-lang
<aarkerio> @current_ability ||= Ability.new(current_user)
<aarkerio> what "||=" means ?
<apeiros_> works the same as +=
<apeiros_> a ||= b --> a = a || b
<aarkerio> is a concatenate operator?
<apeiros_> ummmm nooooo? || is or
<apeiros_> you really should know ||. if you don't, it's high time to learn ruby basics…
<apeiros_> zenspiders quickref eg. is helpful to get an overview of rubys syntax.
<aarkerio> ok, let me google
<aarkerio> thanks!
amerine [amerine!~mturner@67.204.184.82] has joined #ruby-lang
<aarkerio> I found it:
<aarkerio> x ||= "default" #=>"default" : value of x will be replaced with "default", but only if x is nil or false
<aarkerio> thx!
BanHammer [BanHammer!~Adrien@S010600238b791368.cg.shawcable.net] has joined #ruby-lang
sersuz [sersuz!~whatasunn@64.175.137.28] has joined #ruby-lang
sersuz [sersuz!~whatasunn@64.175.137.28] has joined #ruby-lang
whatasunnyday [whatasunnyday!~sunny@64.175.137.28] has joined #ruby-lang
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
aroop [aroop!~aroop@67.139.104.203] has joined #ruby-lang
dustin__ [dustin__!~ddeyoung@64.134.168.249] has joined #ruby-lang
bjensen [bjensen!~brianj@3007ds3-ar.0.fullrate.dk] has joined #ruby-lang
mikeric [mikeric!~mike@96.49.104.11] has joined #ruby-lang
<rue> aarkerio: As he said, a
<rue> Er. a ||= b is the same as a = a || b (or not exactly, I think it's more like a = b unless a)
bradland [bradland!~bradland@c-69-247-235-233.hsd1.fl.comcast.net] has joined #ruby-lang
boxmo [boxmo!~box@186-210-022-004.xd-dynamic.ctbcnetsuper.com.br] has joined #ruby-lang
fayimora [fayimora!~fayimora@109.175.187.141] has joined #ruby-lang
mkscrg [mkscrg!~mkscrg@76-218-100-21.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
<shevy> rue has his confused day
brahmana [brahmana!7ab2c781@gateway/web/freenode/ip.122.178.199.129] has joined #ruby-lang
aarkerio [aarkerio!~aarkerio@201.141.94.20] has quit ["Leaving"]
<apeiros_> rue: a || a = b
<brahmana> Hi all
<apeiros_> (the sole exception in the <op>= family afaik)
<brahmana> Is it possible to tell rake to not print a stack trace if the task exits with a non-zero value?
<apeiros_> brahmana: um, don't use --trace?
<apeiros_> kinda the default…
outoftime [outoftime!~mat@50.57.10.189] has joined #ruby-lang
<brahmana> Specifically I am running cucumber features for a rails app and whenever a feature fails a big trace is dumped.
<brahmana> I am not using the -t switch..
setmeaway [setmeaway!setmeaway3@119.201.52.190] has joined #ruby-lang
<apeiros_> then it's probably cucumber, not rake, which emits the trace.
<brahmana> So I do not who is turning that feature on..
<brahmana> ok
<apeiros_> run cucumber by the cucumber command directly then and use its command line options…
<apeiros_> I'd assume it has one to suppress traces.
<brahmana> Ok.. will look into cucumber docs
robgleeson [robgleeson!~rob@subtle/contributor/robgleeson] has joined #ruby-lang
<apeiros_> `cucumber -h` is probably sufficient
<shevy> cucumber -h banana
<rue> apeiros_: No, there's something different there
<rue> Or was at some point
<rue> Oh er yes. Misread
<rue> That
<shevy> see!
<apeiros_> rue: :)
<shevy> rue isn't his usual self today!
kain [kain!~kain@151.64.233.209] has joined #ruby-lang
* apeiros_ wonders whether a &&= b expands that way too…
<shevy> ewww
<shevy> never saw that yet
Jay_Levitt [Jay_Levitt!~Jay_Levit@c-24-63-250-125.hsd1.ma.comcast.net] has joined #ruby-lang
<yxhuvud> apeiros_: should be easy to test. I believe it does
<apeiros_> I'm lame today. but yes, should
<apeiros_> and should
savage- [savage-!~savage-@209.118.197.220] has joined #ruby-lang
<rue> Last time we pondered about usability of &&=, someone came in about 17 minutes later and their problem was exactly solved by &&=
<apeiros_> hammer searched for a nail and found one…
corsican [corsican!corsican@c-67-161-78-60.hsd1.ca.comcast.net] has joined #ruby-lang
<rue> I dunno why everyone sees nails everywhere. You can use a hammer to bang at lots of other things besides nails
<apeiros_> heads, f.ex.
<apeiros_> maybe hammers are rasistic
<apeiros_> *racist
<Asher> dude you didn't know hammers are racist?
<Asher> haven't you seen The Wall??
<Asher> :)
<apeiros_> what's a "Wall"?
Marco [Marco!~marco@pat32.dartmouth-secure.border1-cfw.Dartmouth.EDU] has joined #ruby-lang
<Asher> pink floyd...
cyri_ [cyri_!~cyri_@jem75-1-87-88-118-80.dsl.sta.abo.bbox.fr] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@46.118.220.94] has joined #ruby-lang
<rue> I don't remember a Pink Floyd in Game of Thrones
savage- [savage-!~savage-@209.118.197.220] has joined #ruby-lang
<Asher> they kept in the shadows
<whatasunnyday> I'm having my regular expression match too much. Anyone mind taking a look? http://pastebin.com/xsqtzpq4
<rue> You probably meant () around the exts.
<brahmana> apeiros_: Running cucumber directly does not print stack trace. Like rake it too has a switch to print backtrace
<brahmana> any chance rails is turning it on?
<apeiros_> no. but cucumber != cucumber rake task
<whatasunnyday> rue: do you mean i should drop #{..}?
<rue> whatasunnyday: I mean you should enclose that part in ()
<apeiros_> brahmana: I'm almost certain it is *not* rake printing the trace. note, *anything* in rake can print whatever it wants, that doesn't make it *rake* that prints it.
<whatasunnyday> oh okay
<whatasunnyday> perfect
<whatasunnyday> i'll try it
<ReinH> apeiros_: yes, ||= and &&= both expand to a <op> a = b rather than a = a <op> b
bjensen [bjensen!~brianj@3007ds3-ar.0.fullrate.dk] has joined #ruby-lang
BanHammer [BanHammer!~Adrien@S010600238b791368.cg.shawcable.net] has quit [#ruby-lang]
outoftime [outoftime!~mat@50.57.10.189] has joined #ruby-lang
<apeiros_> ReinH: thanks for the info :)
<ReinH> mainly for performance reasons although there are edge cases where this causes a change in behavior
<apeiros_> well, all "foo=" methods…
<ReinH> right
<ReinH> so lasgn and foo= methods have this behavior
dbernar1 [dbernar1!~dbernar1@205-200-13-84.static.mtsallstream.net] has joined #ruby-lang
<whatasunnyday> rue: if i may ask one more question, should (..) include the \. or $?
<brahmana> apeiros_: The reason I suspected rake is because of this error message : rake aborted! Command failed with status (1): <stack trace starts>
<apeiros_> I think I became first aware of the special casing due to a hash with default_proc set.
<rue> whatasunnyday: Just the options. /.(foo)
<rue> Damn it.
<rue> /.(foo|bar)$/
<whatasunnyday> thanks
<dbernar1> Hi. I'm looking for confirmation, or otherwise, for HighLine as the library of choice for command-line interaction with users. Any opinions/alternatives?
mkscrg [mkscrg!~mkscrg@76-218-100-21.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
<rue> dbernar1: It's…old
<dbernar1> old could mean good or bad
<whatasunnyday> thank you rue!
<dbernar1> which do you mean?
<whatasunnyday> it worked exactly as planned
<rue> If you're going interactive, maybe something in ripl? If a CLI program, then I like main
<dbernar1> what's the diff with CLI and interactive, rue?
<dbernar1> rue: thank you for the references.
<dbernar1> ha, ripl, like a repl. Interesting. Probably I want main then
<rue> CLI = just using it like any program. myprogram subcommand --some-argument=yay and so on
<dbernar1> rue: and not thor?
<rue> I don't like Thor
<dbernar1> Cause that is what I was sent on a mission to implement so far
<dbernar1> Cool, good to know about the alternative
<rue> It'd probably work, too
<brahmana> rake --versoin prints "rake, version 0.8.7", but I only see rake gems of version 0.9.2 and 0.9.2.2. Where is the 0.8.7 version gem?
<dbernar1> It "works"
<rue> brahmana: System rake?
<dbernar1> Just I have some beefs with the highline stuff inside it...like, it doesn't even do as good a job as highline (spitting out passwords in plain text when prompting for a password.
<RickHull> brahmana: try `which rake`
<brahmana> RickHull: I did, it points to a wrapper script
<RickHull> you can follow it to the executable then
<brahmana> And the wrapper just requires rake and calls run
mkscrg [mkscrg!~mkscrg@76-218-100-21.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
<brahmana> So as rue said it is probably packed with ruby installation
<RickHull> yep
<brahmana> got it..
<freedrull> i have an encoding that returns UTF-8 for encoding? and returns false for valid_encoding?. it has two umlauts that print as \xF6 when i simply inspect the value in irb, but when i call `puts` on it, it prints the umaluts fine. why does it print fine using `puts`, is it because my terminal understands the encoding even though it is techincally invalid as UTF-8? http://pastebin.com/R2AgX1pG
jasox [jasox!~jasox@178.239.26.139] has joined #ruby-lang
<rue> It could be, yes
tychobrailleur [tychobrailleur!~sebastien@176.61.72.130] has joined #ruby-lang
<rue> #valid_encoding? is a stupid name
<rue> I think I cursed it before
<freedrull> does it not do what i think it does
<apeiros_> freedrull: \xF6 is certainly not an umlaut in utf
<rue> It tells you if the string is correct for the encoding
<apeiros_> umlauts in utf (any utf) take multiple bytes to encode.
<freedrull> umlaut in utf is the umlaut + the roman letter right, so two bytes?
<Asher> isn't the umlaut one byte and the character another?
<apeiros_> so ruby says that you told it your string was utf-8 (.encoding returns UTF-8), but ruby tells you that it contains byte sequences that are not valid in that encoding (.valid_encoding? returns false)
<apeiros_> freedrull: depends on the normalization
<apeiros_> "\xF6".force_encoding('iso-8859-1').encode('utf-8') # => "ö"
<apeiros_> I'd assume what you have is that… and that your terminal is set to iso-8859-1, not to utf-8.
thrcka [thrcka!~thrcka@ip-89-102-34-33.net.upcbroadband.cz] has joined #ruby-lang
<freedrull> apeiros_: hmmm yes that works...my terminal appears to be utf-8 however.
<freedrull> ┐('~`;)┌
mkscrg [mkscrg!~mkscrg@76-218-100-21.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
<freedrull> anyway thanks for the help...i'll have to go fix my database now :)
Marco_ [Marco_!~marco@129.170.93.139] has joined #ruby-lang
darkswoop [darkswoop!~darkswoop@31-19-44-89-dynip.superkabel.de] has joined #ruby-lang
mkscrg [mkscrg!~mkscrg@76-218-100-21.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
Sailias [Sailias!~jonathan@s72-38-77-178.static.comm.cgocable.net] has joined #ruby-lang
outoftime [outoftime!~mat@50.57.10.189] has joined #ruby-lang
wkdown [wkdown!~Adium@63.146.80.82] has quit [#ruby-lang]
malev [malev!~malev@190.210.138.237] has joined #ruby-lang
twittard [twittard!~twittard@wc.lax.truecarcorp.com] has joined #ruby-lang
postmodern [postmodern!~postmoder@c-71-237-178-98.hsd1.or.comcast.net] has joined #ruby-lang
Carnage\ [Carnage\!~carnage@84-75-163-211.dclient.hispeed.ch] has joined #ruby-lang
slant [slant!~cylence@64-71-24-18.static.wiline.com] has joined #ruby-lang
arium [arium!~Vitaly@194.44.120.1] has joined #ruby-lang
indstry [indstry!~apple@c-71-238-98-243.hsd1.mi.comcast.net] has joined #ruby-lang
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
<brahmana> apeiros_: That backtrace is printed by rake. There is this code in rake.rb - http://pastie.org/3126788
<arium> I develop application wich I will pack into gem. This gem could be used for command line applications, web applications or gui applications. It requires DB to save data. Which 'bridge' should I use to provide possibility for users to configure and use database they want? It can be SQLite, MySQL, MongoDB and so on. But here is important note: I think in most cases it will be used inside Rails apps.
<arium> Should I use ActiveRecord which is also used in Rails?
<apeiros_> brahmana: great, you've found a line in rake that prints a backtrace… that 'or true' is suspicious however…
<rue> arium: Hm. All rails installs don't use ActiveRecord, either`
<mrneighborly> arium: there's a data_objects gem that provides a universal database api but i don't know how maintained it is (haven't used it by itself in a little while)
<rue> Most, naturally, but not all.
<rue> mrneighborly: Hidyho!
* mrneighborly waves
<brahmana> apeiros_: Yeah, I wonder why that code is there in the first place.. !! Nevertheless a puts around that line confirmed that it is the line from where the backtrace is being printed.
<rue> arium: Is your gem going to be the *whole* thing, or is it embedded into some other app?
<apeiros_> brahmana: what rake version and what file is that?
<rue> As in, is it realistic to assume the app is already using some ORM/similar?
<brahmana> apeiros_: 0.8.7 . File - ruby-1.9.2-p136/lib/rake.rb or after installing - <install-dir>/lib/ruby/1.9.1/rake.rb
<arium> rue: it's going to be some kind of project managment tool but without any interface - interface should be built on top of it - interface may be command line, web or gui. My app will provide only business logic
<arium> mrneighborly: thanks, i will take a look at it
jensn_ [jensn_!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby-lang
<brahmana> arium: Take a look at the devise gem (or anything like that which supports multiple ORMs). That will give you an idea about how you can support multiple dbs
<apeiros_> brahmana: seems buggy, try a newer rake
<arium> brahmana: thanks, i missed this way
<rue> arium: ^ That's probably the way you have to go
<rue> There's impedance if you provide an ORM the rest of the app doesn't (want to) use
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
imperator [imperator!~Daniel@63-225-247-192.hlrn.qwest.net] has joined #ruby-lang
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby-lang
indstry [indstry!~apple@c-71-238-98-243.hsd1.mi.comcast.net] has joined #ruby-lang
dejongge [dejongge!~jonke@pD9E0DF67.dip0.t-ipconnect.de] has joined #ruby-lang
Codif [Codif!~codif@84.120.204.160.dyn.user.ono.com] has joined #ruby-lang
<brahmana> apeiros_: Previous to 0.8.7 I had tried 0.9.2.2 but it just errors out saying at this line undefined method `deprecate' for #<Rake::Application:0x8bd3898> : https://github.com/jimweirich/rake/blob/ffb760195a7ee22d7363583585c94421a38abc9a/lib/rake/rdoctask.rb#L4
<brahmana> It's a method call within the rake gem which is defined here : https://github.com/jimweirich/rake/blob/ffb760195a7ee22d7363583585c94421a38abc9a/lib/rake/application.rb#L165
<brahmana> And yet it is not able to find that method... !
havenn [havenn!~skipper@pool-71-189-126-188.lsanca.fios.verizon.net] has joined #ruby-lang
arium [arium!~Vitaly@194.44.120.1] has quit [#ruby-lang]
hagabaka [hagabaka!~hagabaka@unaffiliated/hagabaka] has joined #ruby-lang
outoftime [outoftime!~mat@50.57.10.189] has joined #ruby-lang
mrsolo [mrsolo!~mrsolo@64.125.181.73] has joined #ruby-lang
arthurlockhart [arthurlockhart!~cinch@60-242-128-8.static.tpgi.com.au] has joined #ruby-lang
jensn_ [jensn_!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby-lang
Skif [Skif!~Skif@72.1.92.57] has joined #ruby-lang
indeterminate [indeterminate!~sei@user-3c2h3m6.cable.mindspring.com] has joined #ruby-lang
wasnotrice [wasnotrice!~wasnotric@174-143-152-175.static.cloud-ips.com] has quit ["Leaving..."]
arthurlockhart [arthurlockhart!~cinch@60-242-128-8.static.tpgi.com.au] has joined #ruby-lang
CoverSli1e [CoverSli1e!~richard@216.2.249.50] has joined #ruby-lang
<hzlocky> what is best solution to parse text via some rules?
solars [solars!~solars@mk089144206205.a1.net] has joined #ruby-lang
<hzlocky> maybe some gem that regex wrapper
<rue> Guys, is there a way to make a question even vaguer?
<Asher> which guy, the one with glasses?
<rue> More vague…
<Sailias> rue: sure, eg. why?
CoverSlide [CoverSlide!~richard@216.2.249.50] has joined #ruby-lang
<rue> hzlocky: Elaborate
<rue> Parse what, how…why?
<rue> By whom?
<rue> Regexps? XML?
<rue> Structured, unstructured?
<hzlocky> I am written a special Chat Bot for geeks.
<rue> Natural language parsing?
<hzlocky> that would be some nice girl, that will for phrases like: "Kiss me tomorrow at 7Am", "Call me today at 19 45" will parse it
<Asher> are you the chat bot?
jbwiv [jbwiv!~wellsj@world.timcogso.com] has joined #ruby-lang
<rue> Yeah, NLP.
<hzlocky> and in proper time(7:00, 19:45) will just reply: "You are just ***cken looser!"
<Sailias> lol, this is great
<hzlocky> rue: kind of)
<rue> Chronic would probably be able to extract the time
<shevy> I wanna ban him
<mrneighborly> hzlocky: use the nickel gem
<hzlocky> rue: yeah, but what about other part of phrase? I got some rules for phrases, but of course trying to regex it - it is too much
<mrneighborly> that will pull the time out, give you the phrase by itself which you could then use regex or a parser like treetop on
<rue> Well, yeah. Human languages aren't regular :P
<brahmana> :D
<Asher> at least not regular enough :P
<Asher> or regular in the ways we expect...
<rue> There are some libraries for at least basic NLP, like the various Elizas
<Asher> alice is the best for your purposes
<Asher> AIML
<hzlocky> mrneighborly: thanks, I hope there is possibility with this gem to define rules
<mrneighborly> there isn't. :) but if oyu're wanting something that fancy, i highly doubt you'll find it. you'll just have to write
<mrneighborly> it
<hzlocky> mrneighborly: thanks! awesome!
<mrneighborly> perhaps in the process, i'll learn to write english. sigh.
<shevy> too optimistic
<rue> Once you extract and remove the time, you can just do fuzzy matching against the remainder… check for verbs and objects…
<shevy> settle for very simple english
<hzlocky> rue: I cant use NLP, it is just goverment project to decrease suicides among geeks.
<rue> hzlocky: I think you should reconsider your response, then
<RickHull> hzlocky: that's hilarious
<hzlocky> rue: no, who cares about geeks...
<rue> RickHull: Maybe it's a secret project to drive geeks to suicide by trying to get them to implement good NLP
<hzlocky> rue: thats not so simple, actually
<RickHull> rue, exactly
* brahmana wonders if hzlocky is actually a very smart bot already.. !
My_Hearing [My_Hearing!~Mon_Ouie@subtle/user/MonOuie] has joined #ruby-lang
<rue> hzlocky: There's a reason Siri – limited as it is – is exciting
<RickHull> here's a project with poorly defined and likely unattainable goals. it's your job to complete it, but you can only use a highly restricted set of tools
<Asher> are we talking about natural language processing or neuro linguistic programming?:P
<rue> The voice recognition isn't the cool part
<Asher> or both ;)
<rue> Asher: Only nerds talk about neurolamer programming
<hzlocky> brahmana: I am bender. I want to kill all humans!
<brahmana> RickHull: lolz
<Asher> rue - well he was talking about geek suicides...
<shevy> chaotic projects are the best
<hzlocky> rue: Siri is just stupid tool to find gay bar
kyrylo [kyrylo!~kyrylo@46.118.220.94] has joined #ruby-lang
<shevy> every day the specification and feature list changes
<brahmana> and the tools list gets shorter
<rue> hzlocky: Until your bot can find a gay bar…
robbyoconnor [robbyoconnor!~wakawaka@guifications/user/r0bby] has joined #ruby-lang
dRbiG [dRbiG!drbig@insomniac.pl] has joined #ruby-lang
mikeric [mikeric!~mike@96.53.33.22] has joined #ruby-lang
tychobrailleur_ [tychobrailleur_!~sebastien@176.61.72.130] has joined #ruby-lang
tenderlove [tenderlove!~tenderlov@pdpc/supporter/active/tenderlove] has joined #ruby-lang
tenderlove [tenderlove!~tenderlov@pdpc/supporter/active/tenderlove] has joined #ruby-lang
outoftime [outoftime!~mat@50.57.10.189] has joined #ruby-lang
sandelius [sandelius!~textual@90-231-202-62-no214.tbcn.telia.com] has joined #ruby-lang
<jaimef> def pdebug puts "#{__method__} args:#{ARGV}" end # how does one print out the arguments passed to a method ?
<shevy> jaimef ARGV is passed to a file, not a method
<RickHull> def method(*args); p args; end #?
<jaimef> shevy: yeap
<jaimef> was looking for a __method__ equivalent for *args as a means of debugging
<shevy> I dont think there is something like __method__ available for methods
<shevy> I mean, for the arguments to it
<jaimef> ok
<shevy> there is .arity to find out how many arguments a method accepts
mark_locklear [mark_locklear!~jlocklear@ab-tech-lan-to-ab-tech-gw.ncren.net] has joined #ruby-lang
<shevy> "sss".method(:concat).arity # => 1
savage-_ [savage-_!~savage-@209.118.197.220] has joined #ruby-lang
benanne [benanne!~rijdier@ip-83-134-146-140.dsl.scarlet.be] has joined #ruby-lang
<RickHull> quite sensible :)
<RickHull> could have made one large expression with 'and' instead, no?
<RickHull> this probably looks nicer, though
<drbrain> I could have, but it would have been unreadable
tbuehlmann [tbuehlmann!~Tobias@unaffiliated/tovias] has joined #ruby-lang
zmack [zmack!~zmack@188.26.128.139] has joined #ruby-lang
outoftime [outoftime!~mat@50.57.10.189] has joined #ruby-lang
enebo [enebo!~enebo@97-127-70-138.mpls.qwest.net] has joined #ruby-lang
cored [cored!~homer@201.229.129.61] has joined #ruby-lang
cored [cored!~homer@unaffiliated/cored] has joined #ruby-lang
lsegal [lsegal!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
mikeric [mikeric!~mike@96.53.33.22] has joined #ruby-lang
<shevy> whoa
<shevy> ok &&=
<shevy> have_header('GL/glu.h') ||
<shevy> have_header('OpenGL/glu.h')
<shevy> that boggles the mind
spuk [spuk!~spuk@187.65.176.82] has joined #ruby-lang
<erikh> it skips if it already found the header. if it hasn't, it looks in those two dirs
jensn_ [jensn_!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby-lang
<rue> N-uh
<erikh> UH HUH
<erikh> oh wait
<erikh> I need to sleep
<rue> Me too
<rue> Sleep buddies!
<lantins> oooo-errr
<tbuehlmann> let's make some waffles
<lantins> waffels, now your talking!
<RickHull> could do: still_ok = true; still_ok &&= ...
<RickHull> I prefer waffles
ttilley [ttilley!~ttilley@unaffiliated/lv] has joined #ruby-lang
<jaimef> so [/\w+\"$/] matches what I want but includes the " in the results which I want to match, but not include
burgestrand [burgestrand!~burgestra@81-229-85-235-no66.tbcn.telia.com] has joined #ruby-lang
<manveru> so use ()
<jaimef> ahh. thanks
<manveru> [/(\w+)"$/, 1]
<lantins> dumb question, but what is &&= ? its only set if everything returns non false/nil?
<manveru> no need for \ either
<jaimef> oh for the " yeah it's a font-lock issue
<manveru> lantins: ι ~ % ruby -e 'a, b = nil, 1; a &&= 2; b &&= 3; p [a, b]'
<manveru> [nil, 3]
<lantins> manveru: aahhhhhhh, thanks!
Carnage\ [Carnage\!~carnage@84-75-163-211.dclient.hispeed.ch] has joined #ruby-lang
<shevy> yeah my brain is still trying to wrap itself around &&=
srbartlett [srbartlett!~srbartlet@202.146.7.239] has joined #ruby-lang
canton8 [canton8!~canton7@95.150.107.113] has joined #ruby-lang
<RickHull> "andgets" ?
<RickHull> orbits ||= "andgets"
<lantins> i can't say ive ever seen anyone use it, its a new one on me
fayimora [fayimora!~fayimora@95.175.159.21] has joined #ruby-lang
<drbrain> using &&= is extremely rare
<lantins> I sware there's gonna be no slates left on this roof once this evenings over if this wind keeps it up
<oddmunds> but it's just sets the variable if it's not nil nor false?
<lantins> oddmunds: thats how i understood it from manveru' example
<oddmunds> it just has less obvious use cases?
<RickHull> yep, did you see drbrain's example?
<oddmunds> no, but looking now
<shevy> lantins, you in europe?
<lantins> shevy: yup, the lovely rainy Lake District in the UK =)
<lantins> population: mostely sheep
<oddmunds> &&<< could be useful too, i guess
shapeshed_ [shapeshed_!~shapeshed@host-84-9-125-3.dslgb.com] has joined #ruby-lang
<oddmunds> ||++ :P
<lantins> shevy: how about you?
<shevy> hehe some news station here in austria reported heavy storm crossing over middle europe
<lantins> yeah its been heavy for about 2 days now
<tbuehlmann> yup
<canton8> hmm.... a ||= b is short for a = a || b... But a << a && b, and a = a++ b make no sense methinks
savage- [savage-!~savage-@209.118.197.220] has joined #ruby-lang
<oddmunds> ||++ was a joke
<burgestrand> canton8: not quite, a ||= b is more like a || a = b
<canton7> :P
mkscrg [mkscrg!~mkscrg@76-218-100-21.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
<shevy> this boggles the mind
<canton7> burgestrand, it literally means a = a || b
<RickHull> canton7: that's the C convention. ruby is implemented differently
<shevy> that one looks easier
<zenspider> meh... it is a pedantic distinction
<zenspider> canton7: no
<oddmunds> canton++ D:
<canton7> hehe, fair play
confounds [confounds!~confounds@199.243.188.2] has joined #ruby-lang
<manveru> :)
<manveru> well, it becomes more important once you do things like: "foo.bar ||= baz"
<manveru> "a = a || b" would call foo.bar and foo.bar= in any case, while "a || a = b" will only call foo.bar in any case
davidw [davidw!~davidw@adsl-ull-188-127.51-151.net24.it] has joined #ruby-lang
RomD [RomD!~Roman@nrbg-4d0774f1.pool.mediaWays.net] has joined #ruby-lang
<zenspider> s(:op_asgn2, s(:call, nil, :a, s(:arglist)), :b=, :"||", s(:call, nil, :c, s(:arglist)))
<RickHull> manveru: in 1.8.7 -- a = nil; a ||= b #=> NameError
<manveru> because there's no b?
<zenspider> ... um. duh?
<RickHull> ok, i was thinking the assignment wouldn't happen
<zenspider> nil is false
<manveru> if a is nil?
<RickHull> shoot me plz
<manveru> lol
fayimora [fayimora!~fayimora@95.175.159.21] has joined #ruby-lang
AndChat- [AndChat-!~AndChat@222.153.223.47] has joined #ruby-lang
* zenspider hands RickHull another coffee
Axsuul [Axsuul!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby-lang
* RickHull -= 6 beers
<RickHull> (from last night)
<RickHull> i guess you don't need a headache to be hung over
<erikh> rue: for some reason I think our wives would disapprove
cjs226 [cjs226!~cjs226@99-61-65-242.lightspeed.austtx.sbcglobal.net] has joined #ruby-lang
<muzone> manveru: any chance you could check your pms?
naz [naz!~n@70.44.2.190.res-cmts.bus.ptd.net] has joined #ruby-lang
<RickHull> manveru: true ||= b # ha!
outoftime [outoftime!~mat@50.57.10.189] has joined #ruby-lang
crankharder [crankharder!~crankhard@ip68-100-194-214.dc.dc.cox.net] has joined #ruby-lang
<manveru> RickHull: ?
ahs3- [ahs3-!~ahs3-@adsl-065-005-193-158.sip.rdu.bellsouth.net] has joined #ruby-lang
Pip_ [Pip_!~Pip@unaffiliated/pip] has joined #ruby-lang
zmack [zmack!~zmack@188.26.128.139] has joined #ruby-lang
outoftime [outoftime!~mat@50.57.10.189] has joined #ruby-lang
perryh [perryh!~perryh@unaffiliated/perry753] has joined #ruby-lang
<manveru> muzone: /qumu
WillMars_ [WillMars_!~willmarsh@203.48.101.90] has joined #ruby-lang
naz [naz!~n@70.44.2.190.res-cmts.bus.ptd.net] has joined #ruby-lang
aroop [aroop!~aroop@67.139.104.203] has joined #ruby-lang
tychobrailleur__ [tychobrailleur__!~sebastien@176.61.72.130] has joined #ruby-lang
davidw [davidw!~davidw@apache/committer/davidw] has joined #ruby-lang
codewrangler [codewrangler!~codewrang@pool-108-28-240-83.washdc.fios.verizon.net] has joined #ruby-lang
sendnoflowers [sendnoflowers!~sendnoflo@redounding.playing.volia.net] has joined #ruby-lang
mdel [mdel!~mdel@pool-71-175-17-16.phlapa.fios.verizon.net] has joined #ruby-lang
havenn [havenn!~skipper@pool-72-67-31-69.lsanca.fios.verizon.net] has joined #ruby-lang
yfeldblum [yfeldblum!~Jay@c-98-218-48-253.hsd1.md.comcast.net] has joined #ruby-lang
<RickHull> manveru: it "attempts" the assignment
canton7 [canton7!~canton7@95.150.107.113] has quit [#ruby-lang]
<manveru> RickHull: no
wasnotrice [wasnotrice!~wasnotric@174-143-152-175.static.cloud-ips.com] has joined #ruby-lang
<RickHull> "Can't assign to true" I never asked it to ;)
<manveru> it raises a parse error
<RickHull> SyntaxError: compile error
<workmad3> RickHull: ||= counts as an assignment to the compiler
<manveru> ι ~ % ruby -e 'def x; true ||= 1; end'
<RickHull> hence the scare quotes
<workmad3> s/compiler/interpreter
<manveru> you don't even have to execute it
<manveru> ruby will not allow any possible scenario where you displace true
<workmad3> manveru: 'true ||= false' will never displace true though :)
RomD` [RomD`!~Roman@nrbg-4dbe2cb5.pool.mediaWays.net] has joined #ruby-lang
<RickHull> the right side doesn't matter
<manveru> ?
<manveru> well, that's... true :)
<RickHull> for appropriate values of true
<drbrain> … ignoring the whole problem of the syntax error
<manveru> >> class X; attr_reader :h; def initialize; @h = []; end; def a; h << :a; end; def a=(n); h << :a=; end; end; x = X.new; x.a ||= :b; x.h
<manveru> => [:a]
<manveru> if you return nil/false from a instead, a= will be called
<manveru> i guess there's a shorter way to demonstrate that
<manveru> but i'm out of coffee :(
mikeric [mikeric!~mike@96.53.33.22] has joined #ruby-lang
ben [ben!~v@dslb-088-066-000-219.pools.arcor-ip.net] has joined #ruby-lang
<ben> Where do I learn to use DL?
<erikh> r. kelly
<manveru> ben: do you need DL or would FFI suffice?
<ben> manveru: I am trying to get an old library to work that uses DL. Ideally I'd just learn how to use DL and make a minimum of changes, but I'm not sure where to start. I've been out of the loop with ruby for a while.
<manveru> 1.9.3?
<ben> yes
<manveru> well, dl changed an awful lot since 1.8, and uses FFI now
<ben> well then
<manveru> i haven't kept up with all the changes either, but if you can provide the source of the lib i might be able to help
<ben> Specifically the library is using DL::Importer's struct() to define a few structs, and one of them now has an anoynmous union in an anonymous struct in an anonymous union and I don't know how to represent that since the library only seems to defin flat structs so far.
<manveru> ouch
sora_h [sora_h!~sora_h@mayfield.privs.net] has joined #ruby-lang
sendnoflowers [sendnoflowers!~sendnoflo@redounding.playing.volia.net] has joined #ruby-lang
Skif [Skif!~Skif@72.1.92.57] has joined #ruby-lang
Marco [Marco!~marco@Marco-2.Kiewit.dartmouth.edu] has joined #ruby-lang
tomzx [tomzx!~tomzx@dsl-216-221-39-59.aei.ca] has joined #ruby-lang
<lantins> guys, is there a 'nicer' way to format this string? "0000000000000100".scan(/(.{2})(.{6})(.{6})/).join('-') # => "00-000000-000001"
<lantins> by nicer I guess im asking if it can be more easily done without a regex
<drbrain> lantins: IMO, that's the best way
<drbrain> nicest
<lantins> okay, im fine with how it is, just something ive always pondered about
sepp2k [sepp2k!~sexy@g231141146.adsl.alicedsl.de] has joined #ruby-lang
<drbrain> there's also: "0000000000000100".gsub(/(.{2})(.{6})(.{6}).*/, '\1-\2-\3')
Carnage\ [Carnage\!~carnage@84-75-163-211.dclient.hispeed.ch] has joined #ruby-lang
<lantins> think i find the first easier to understand. imo. prob just because im use to it. though i didn't know about \1 stuff for match results ;-)
mikeric [mikeric!~mike@96.53.33.22] has joined #ruby-lang
<sendnoflowers> drbrain: sub is enough and should be the fastest among scan/gsub/sub
<drbrain> sendnoflowers: yeah, I just forget
<drbrain> I type gsub 10x more than sub
bglusman [bglusman!~bglusman@c-68-80-200-61.hsd1.pa.comcast.net] has joined #ruby-lang
<sendnoflowers> and probably you don't need gsub every time ;)
<jaimef> output = output.split("\n\n").select { |l| l.match(filter) } if filter # This seems to fail to match if filter is say "Ubuntu (32 bit)"
<sendnoflowers> and?
<jaimef> output contains the string that is filter. however fails to match
<shevy> divide and conquer
andrewhl [andrewhl!~andrew@24-246-15-43.cable.teksavvy.com] has joined #ruby-lang
<drbrain> jaimef: ri String#match
perryh_ [perryh_!~perryh@76-230-52-253.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
perryh_ [perryh_!~perryh@unaffiliated/perry753] has joined #ruby-lang
<drbrain> the first example illustrates your problem
<jaimef> having to escape the () in the string seems like a limitation to be found in bash and not ruby. </ignorance>
<drbrain> jaimef: you're using a method that matches strings to regular expressions but are passing in the wrong type
<drbrain> hint: Regexp.escape
<sendnoflowers> bash really?
<jaimef> drbrain: thanks.
RickHull [RickHull!~rhull@pdpc/supporter/active/rickhull] has quit [#ruby-lang]
<lantins> sendnoflowers: quite a diff in speed with `#sub` like you said, just checked it out, thanks =)