ChanServ changed the topic of #ruby-lang to: Ruby 1.9.3-p125: http://ruby-lang.org | Paste >3 lines of text on http://pastie.org or use a gist
mistym has joined #ruby-lang
<zenspider> woo! 496 lines o' parser diff
meise has joined #ruby-lang
aef has joined #ruby-lang
denysonique has joined #ruby-lang
pandora17 has joined #ruby-lang
jmontross has quit [#ruby-lang]
mistym has joined #ruby-lang
flori has joined #ruby-lang
jakko has joined #ruby-lang
denysonique has joined #ruby-lang
z3r00ld has quit [#ruby-lang]
<asahi1> I just ran some ruby and it was using 2 gigs of RAM, grinding my machine to a halt. how can I prevent this from happening?
<zenspider> don't do that
<asahi1> what would cause a ruby script to use a lot of ram?
shevy has joined #ruby-lang
<_tca> probably by putting a lot of data in ram
<zenspider> asahi1: you're asking such huge abstract questions that we can't possibly help you
<zenspider> "a" * 2**3**4
<zenspider> that must be what did it
<_tca> gave me an error, liar
<asahi1> I'm looping through data while performing calculations on it
<zenspider> well there you go. if you don't loop or perform calculations, you won't have this problem
jfelchner has joined #ruby-lang
<zenspider> see?
<zenspider> we can't help with this line of questioning
<_tca> how much data asahi1
<zenspider> oh! I know. double your ram! then at least it won't grind to a halt
<zenspider> asahi1: the best way to ask a question is to have a very specific question with enough data/context that we can understand ... using pastie.org and providing actual code would be a first step
<asahi1> okay, I don't know if this will help but here is the code: https://gist.github.com/2425083
tomzx has joined #ruby-lang
rdavila has joined #ruby-lang
<zenspider> change to: container = Hash.new { |h,k| h[k] = 0 }
<zenspider> then get rid of the ||=0 line
<asahi1> why was that part using a lot of memory?
<zenspider> I'm an idiot... container = Hash.new 0
<zenspider> it wasn't using a lot of memory
<zenspider> it's just in need of improvement
<zenspider> I assume this is railsy code
<asahi1> yeah it is
nif has joined #ruby-lang
<zenspider> you're pulling in all comments for a given category, and then asking for all the tags on each of the comments
<zenspider> there are at least 3 things that can blow up there
<zenspider> the tag.name values might be huge
<zenspider> category.comments might be huge
<zenspider> and comments.includes(:tags) might be huge
<zenspider> I'm not even sure what that last one is
<_tca> wpi;dm
<zenspider> I thought you'd normally do something more like: category.comments :include => tags
<zenspider> but again, that pulls in everything all at once
<asahi1> nothing here is bigger than maybe 15bytes
<asahi1> and my whole db is no bigger than 100mbs
<zenspider> I'll bet you're wrong :)
<erikh> just curious, are you on a mac?
<asahi1> yes, I am
<erikh> how far are you into swap?
<asahi1> think it said 4gb of swap
<erikh> not saying it's your problem, but it's probably significantly slowing you down.
<erikh> esp. if you're doing database work.
<zenspider> I'd look at the logfile to see how many times you're pulling from the db... I'd guess that you're doing it a lot more than you think you are.
<zenspider> and that second line is still suspect to me
<erikh> yeah, good idea. also check the slow query log if you're on mysql.
<zenspider> also: category.comments.includes(:tags).explain
<erikh> fwiw, arel should floptimize the includes
<erikh> IIRC.
<asahi1> zenspider: that second line is how rails does it. I'll try those other suggestions
<asahi1> erikh: i'm on postgres
<asahi1> thanks
<zenspider> asahi1: it does it many ways. the one I gave above will pull the comments and tags in one fell swoop and you won't have an extra copy sitting around in a local variable for no reason
<zenspider> also, for god's sake, use better variable names
<zenspider> container and a SUCK as names
<zenspider> also... can't you just do this via the count method?
<zenspider> or sum
<erikh> he's summing each tag as I read it
<asahi1> .includes(:tags) does the same thing as :include => :tags. they both perform joins
<erikh> but there's #max, and while I don't think arel can express the sql required, the sql for it is not particularly complicated.
<asahi1> I don't see how I can do this with a simple counter method
<erikh> select max(count(foo)) etc
<zenspider> I would think that a group & sum would do this on the db side straight up
<erikh> well he wants the top value
<erikh> but yes, you're probably correct
<seanstickle> count and order and first
petercooper has joined #ruby-lang
<erikh> asahi1: regardless of which approach, the point here is to let the DB do the hard work.
<erikh> it's good at it.
<seanstickle> Indeed
<zenspider> eg Categories.find(:all, :joins => :animals, :select => "categories.*, SUM(animals.weight) as weight_sum", :group => "categories.id")
<seanstickle> Will not work in all DBMSes
<zenspider> it doesn't need to work on all... it needs to work on his
<zenspider> I hate that argument
<asahi1> okay, got it. thank you for the suggestions. i'll try to get the db to do it
<seanstickle> What argument? Unless you know if it works on his, it's a pretty iffy suggestion.
<zenspider> it isn't remotely iffy as-is AND he uses postgres... nothing in that example is rocket surgery
<seanstickle> Per the PostreSQL docs, "When GROUP BY is present, it is not valid for the SELECT list expressions to refer to ungrouped columns except within aggregate functions, since there would be more than one possible value to return for an ungrouped column."
<seanstickle> Is all I'm saying
dv310p3r has joined #ruby-lang
<zenspider> pedant much?
<seanstickle> When it comes to database programming? Yes.
<zenspider> yeah. well... have fun with that.
<seanstickle> Dealt with too much shit left behind by code monkeys who think varchars are a good place to store numbers.
<zenspider> which has absolutely no relevance to anything going on here...
<zenspider> so take your emotional baggage elsewhere
<seanstickle> Sloppy database programming?
<zenspider> or actually help out.
<seanstickle> Sounds the same to me.
<zenspider> again... personal problem. move on. get therapy. something.
<seanstickle> Uh huh.
<erikh> chill out folks. it's just programming.
<asahi1> zenspider: thanks
<bnagy> erikh: ONE DOES NOT SIMPLY PROGRAM
<zenspider> bnagy: haha
<erikh> hehehe
<seanstickle> :)
datanoise has joined #ruby-lang
<erikh> YOU SHALL NOT PASS (unit tests)
<_tca> doesn't postgres have an embedded scheme
<bnagy> :D
<_tca> just do the mapreduce with that
<erikh> it has recursive queries too. this isn't that complicated.
igotnolegs has joined #ruby-lang
bryancp has joined #ruby-lang
<erikh> and if you bust out recursive queries you probably know that already.
<zenspider> UGH ruby has a fucking ugly grammar... this is going to be the death of me
<heftig> what's not to like?
<zenspider> sooo much
<zenspider> current example is that there is now a lambda node... for no good reason.
<zenspider> it's only created if you use -> , not lambda, not Proc.new, not proc...
<heftig> for the stabby, i assume
<zenspider> otherwise, it's mostly the same
<heftig> stabby is ugly, i agree there
<zenspider> and the block arg syntax / semantic changes are a bitch to deal with
SkramX has joined #ruby-lang
<zenspider> the new optional arg syntax is semantically different from optional arg values...not sure how I should map that
tr-808 has joined #ruby-lang
m3nd3s has joined #ruby-lang
krzkrzkrz has joined #ruby-lang
fgomez has joined #ruby-lang
fgomez_ has joined #ruby-lang
Sailias has joined #ruby-lang
felipe__ has joined #ruby-lang
Joeysomo has joined #ruby-lang
publicvoid__ has joined #ruby-lang
fgomez has joined #ruby-lang
Z33K|Lux has joined #ruby-lang
jobicoppola has joined #ruby-lang
<slyphon> argh
<slyphon> fuck C
<slyphon> fuck pthreads
* slyphon overturns a table
<shevy> hehehe
<drbrain> slyphon: you mean:
* drbrain (╯°□°)╯︵ ┻━┻
<slyphon> :D
<_tca> upvoted
<slyphon> yes, yes i did
<slyphon> argh, such a pain in the ass
<slyphon> esp considering that ^C does *nothing*
tomzx has joined #ruby-lang
asahi1 has quit [#ruby-lang]
mistym has joined #ruby-lang
ilyam has joined #ruby-lang
mbriggs has joined #ruby-lang
ttilley has joined #ruby-lang
ttilley has joined #ruby-lang
gnufied1 has joined #ruby-lang
brianpWins has joined #ruby-lang
indeterminate has joined #ruby-lang
m10zart has joined #ruby-lang
fgomez has joined #ruby-lang
<m10zart> how can i input utf-8 in a ruby program without it being modified? Like when I input "\n\u001C\u0018\t\u001C" it automatically converts it to "\\n\\u001C\\u0018\\t\\u001C"
<m10zart> when i do gets.
<m10zart> it works on the irb just fine. but not when i do it from running a .rb file
Weems has joined #ruby-lang
<drbrain> m10zart: did you add the magic encoding comment?
<drbrain> # coding: UTF-8 at the very top of your file (or after #! line)
rdavila has joined #ruby-lang
x0F has joined #ruby-lang
<m10zart> ty ill look to see if it works. im a beginner in ruby. thank you
petercooper has joined #ruby-lang
<WillMars_> What's the shortcut for converting an integer to something like 0004
<WillMars_> 4.to_something == "0004"
<drbrain> WillMars_: sprintf
<drbrain> ruby -e 'puts "%04d" % 4'
<WillMars_> Cheers
<drbrain> % is another way to sprintf
dankest has joined #ruby-lang
slaytani1 has joined #ruby-lang
dr0id has joined #ruby-lang
dr0id has joined #ruby-lang
<m10zart> the magic encoding comment did not work. i know that my file can understand utf-8 encoded characters but for some reason, when I input a utf-8 format as a string to the program from the command line after doing ruby "filename", it reads it differently. "\n\u001C\u0018\t\u001C" to "\\n\\u001C\\u0018\\t\\u001C".
hagabaka has joined #ruby-lang
<bnagy> it's probably just displaying \ as \\
<bnagy> check the length of the string
<m10zart> it reads it as a longer string
<m10zart> or a longer utf-8 input for that matter.
<bnagy> wait, you're typing that stuff in? You're probably feeding the program '\' 'n' not \n
<bnagy> anyway, flight boarding, 'luck
dhruvasagar has joined #ruby-lang
achiu has joined #ruby-lang
mbriggs has joined #ruby-lang
t has joined #ruby-lang
Doobie has joined #ruby-lang
savage- has joined #ruby-lang
rippa has joined #ruby-lang
m10zart has quit [#ruby-lang]
ramonmaruko has joined #ruby-lang
ramonmaruko has joined #ruby-lang
Radium_ has joined #ruby-lang
ilyam has joined #ruby-lang
cdnz has joined #ruby-lang
jakko has joined #ruby-lang
dhruvasagar has joined #ruby-lang
asahi1 has joined #ruby-lang
asahi1 has quit [#ruby-lang]
fragmachine has joined #ruby-lang
<fragmachine> Hey how can I use self in my class methods? For example if the Foo class bar method is 'puts self', how can I do "foo = Foo.new; "says this".foo.bar"
<fragmachine> or even better "say this".bar
Radium_ has joined #ruby-lang
rohit has joined #ruby-lang
fattastic has joined #ruby-lang
tonesfrommars has joined #ruby-lang
jxie has joined #ruby-lang
mksm has joined #ruby-lang
TheMoonMaster has joined #ruby-lang
Rizzle has joined #ruby-lang
yxhuvud has joined #ruby-lang
rohit has joined #ruby-lang
JohnBat26 has joined #ruby-lang
kitallis has joined #ruby-lang
gouthamvel has joined #ruby-lang
gouthamvel has quit [#ruby-lang]
brushbox has joined #ruby-lang
rohit has joined #ruby-lang
Raul-Duke has joined #ruby-lang
<Raul-Duke> hello
<Raul-Duke> Есть тут кто живой?
achiu has joined #ruby-lang
fgomez has joined #ruby-lang
hahuang65 has joined #ruby-lang
deobald_ has joined #ruby-lang
x0F_ has joined #ruby-lang
apeiros_ has joined #ruby-lang
francisfish has joined #ruby-lang
andrewhl has joined #ruby-lang
solars has joined #ruby-lang
yibe has joined #ruby-lang
dhruvasagar has joined #ruby-lang
memonservices has joined #ruby-lang
IPGlider has joined #ruby-lang
apeiros_ has joined #ruby-lang
JackNorris has joined #ruby-lang
workmad3 has joined #ruby-lang
dc5ala has joined #ruby-lang
sandbags has joined #ruby-lang
sandbags has joined #ruby-lang
sandbags has joined #ruby-lang
dhruvasagar has joined #ruby-lang
achiu has joined #ruby-lang
ttilley has joined #ruby-lang
kings has joined #ruby-lang
<Defusal> i wonder if anyone actually uses em-websocket
michael_mbp has joined #ruby-lang
<michael_mbp> hi all
<michael_mbp> I've got a SuperHero class that's including a module SuperPowers. #<SuperHero:0x007fdb8c96a838; @alias="Batman", @energy=100, @name="Bruce Wayne", @powers="powerless"> // how can I setup a class method in SuperPowers to deplete the energy of all SuperHeros? I've got SuperHero.die returning "foo" for now.
jstemmer has joined #ruby-lang
dhruvasagar has joined #ruby-lang
achiu has joined #ruby-lang
<drbrain> michael_mbp: define #initialize in SuperPowers and have it register the superhero in a class-level list
<drbrain> or, have ::new in SuperHero add each instance to a list and have SuperPowers use it
apeiros_ has joined #ruby-lang
<michael_mbp> oh awesome one sec
<drbrain> if it's only to harm superheros it seems like SuperHero is a better place for it than SuperPower
<drbrain> especially if a SuperVillian has SuperPowers
<michael_mbp> hah yeah I'm going that way :)
<michael_mbp> thing is this
<michael_mbp> what I'm having trouble seeing is how a class can store information, well until you suggested 'define #initialize in SuperPowers and have it register the superhero in a class-level list'
<michael_mbp> I'm seeing it as only instantiated objects hold info via their attributes
<drbrain> classes are instantiated objects too
<apeiros_> drbrain: you take the whole magic out of it… :( ;-)
<michael_mbp> hmm good point
Kero has joined #ruby-lang
<michael_mbp> so I can setup attr_reader/writer on the class too and initialize it
<michael_mbp> how does '::new in SuperHero' work ?
dhruvasagar has joined #ruby-lang
<drbrain> you use super just like for instance methods
<michael_mbp> ah
<drbrain> class SuperHero; @super_heros = []; def self.new(*args, &block); super_hero = super; @super_heros << super_hero; super_hero end; end
<michael_mbp> hmm
<michael_mbp> so new is a class method in SuperHeros.
<michael_mbp> I have to add attr_accessor for :super_heros
<apeiros_> class << self; attr_reader :super_heroes; end
<michael_mbp> ah of course
<michael_mbp> I was adding it to instance objs.
nofxxx has joined #ruby-lang
toretore has joined #ruby-lang
<michael_mbp> hmm.
<michael_mbp> SuperHero.super_heros still getting ndefined method `super_heros' for SuperHero:Class
<apeiros_> pastie.org
<apeiros_> or gist
<michael_mbp> one sec
<michael_mbp> I need to setup new in the super class
<drbrain> I don't see where there's an accessor for @super_heroes on the class
<drbrain> oh, there
<michael_mbp> super_hero = super; // isn't that it?
<michael_mbp> and Homosapien isn't implementing it...
<apeiros_> michael_mbp: super_heroes vs super_heros
<apeiros_> typos ftl
<michael_mbp> hah lol yes
<michael_mbp> jeeze.
<michael_mbp> success
dhruvasagar has joined #ruby-lang
<michael_mbp> I could move def self.new(*args, &block); inside the class << self as def new...
<michael_mbp> …and @super_heroes << self;
<bnagy> oh wow, that's barfy
<bnagy> looks like that design's superpower is to defy OO idiom and encapsulation
<michael_mbp> yeah :/
<bnagy> I'm fine with homosapien and superpowers as a module, that's nice
<drbrain> bedtime
<bnagy> but why should a superhero know about all other superheros?
<michael_mbp> yeah that's needs to move elsewhere
<bnagy> you could make a LeaguOfJustice which is a delegate to Array, that would be ok as an exercise
<michael_mbp> ah nice
<michael_mbp> thanks drbrain nn
<michael_mbp> bnagy: super_hero = super; what does that do, I mean in what context. I've not defined self.new in Homosapien
<bnagy> it just supers the creation, klass.new always ends up calling initialize
<michael_mbp> ah
<apeiros_> it calls Class#new, since Class is SuperHero's superclass
<apeiros_> errr
<bnagy> yeah talking about superclass and super in this context is weird :)
<apeiros_> since SuperHero's class is Class
<michael_mbp> SuperHero.superclass => Homosapien
<bnagy> like SuperHero's superclass is not super :P
<michael_mbp> LOL
<apeiros_> (you have a method on SuperHero's singleton_class, and the lookup-chain is obj.singleton_class, obj.class, and then obj.class' ancestors
<apeiros_> )
<michael_mbp> ah...
<bnagy> I don't think you need to jump through hoops to get hash args working with that weird railsy stuff either
<bnagy> but whatever, minor thing
<michael_mbp> yeah
dankest has joined #ruby-lang
<michael_mbp> thanks guys brb 10 mins
francisfish has joined #ruby-lang
dhruvasagar has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
Indian has joined #ruby-lang
achiu has joined #ruby-lang
tjadc has joined #ruby-lang
gnufied has joined #ruby-lang
Indian has joined #ruby-lang
burgestrand has joined #ruby-lang
savage-_ has joined #ruby-lang
ramonmaruko has joined #ruby-lang
jenrzzz has joined #ruby-lang
gouthamvel has joined #ruby-lang
gouthamvel has quit [#ruby-lang]
<michael_mbp> apeiros_: SuperHero.class.ancestors => [Class, Module, Object, PP::ObjectMixin, Kernel, BasicObject]
<apeiros_> michael_mbp: there's a difference between natural language and code :-p
<michael_mbp> SuperHero.class.superclass => Module // so it's #<Class:SuperHero> (the singleton) <--- Class <--- Module
<michael_mbp> apeiros_: :p
<michael_mbp> right this makes perfect sense..awsome!
<apeiros_> obviously SomeClass.ancestors.first # => SomeClass - someclass is NOT an ancestor of SomeClass
<apeiros_> but I always wondered why ancestors includes self
<michael_mbp> hmm that's interesting
<apeiros_> (because even if there are gaps between natural and computer language, those should be avoided if possible)
<michael_mbp> [SuperHero, SuperPowers, Homosapien, Object, // that brings back memories of the metaprogramming book
<michael_mbp> how the module sits just one up of where it's included
Hakon|mbp has joined #ruby-lang
Ethan has joined #ruby-lang
<michael_mbp> just tweeted you :p apeiros_
<apeiros_> :)
<michael_mbp> LeagueOfJustice sounds like a nice idea, do you think it'd be better of as a module?
<michael_mbp> and SuperHero include LeagueMember
futurechimp has joined #ruby-lang
workmad3 has joined #ruby-lang
rohit has joined #ruby-lang
<michael_mbp> rohit o/
<michael_mbp> workmad3: o/
lele|w has joined #ruby-lang
dhruvasa1ar has joined #ruby-lang
dhruvasagar has joined #ruby-lang
rohit has joined #ruby-lang
dhruvasa1ar has joined #ruby-lang
kedare has joined #ruby-lang
shachaf has joined #ruby-lang
jxie_ has joined #ruby-lang
matti has joined #ruby-lang
matti has joined #ruby-lang
judofyr has joined #ruby-lang
knu has joined #ruby-lang
Pupeno has joined #ruby-lang
rolfb has joined #ruby-lang
ilyam has joined #ruby-lang
michael_mbp has joined #ruby-lang
apeiros_ has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
<apeiros_> interesting pattern: def something(callback=Proc.new)
zmack has joined #ruby-lang
<apeiros_> (via @tenderlove)
<matti> apeiros_: How was Railsberry?
<FastJack> have you tried the local food? :)
* matti was born is the city where Railsberry is being held.
QaDeS has joined #ruby-lang
<FastJack> I've been there once
michael_mbp has joined #ruby-lang
<michael_mbp> aye thanks
<michael_mbp> def foo(&block) // foo.call(Proc.new(…)) converts the Proc to a block anyways.
<apeiros_> matti: still is
<apeiros_> good so far
<michael_mbp> oops, foo(Proc.new(…))
<apeiros_> matti: ah, any recommendations on what to visit after railsberry? I stay another 3 days here
<apeiros_> michael_mbp: just Proc.new, no arguments are being passed to it. especially no block :)
DMKE has joined #ruby-lang
<michael_mbp> ah no, I mean't version 1
<michael_mbp> :)
<apeiros_> I'm refering to (…) in your Proc.new(…)
<michael_mbp> ah right.
<apeiros_> since … is usually meant as "put your stuff here", and there's definitively no stuff to be put there ;-)
<michael_mbp> indeed heh
<michael_mbp> you at rails berry now then?
<apeiros_> yes
<michael_mbp> wow awesome
<apeiros_> yeah, awesome, wifi works :-p
<michael_mbp> haha
<apeiros_> (they had troubles with it yesterday)
<michael_mbp> oh...
<judofyr> what? wifi works on a conference??
<judofyr> that's not the way it's supposed to be…
<michael_mbp> sadly, I've never been to any ruby conf. …yet :'(
riffraff has joined #ruby-lang
achiu has joined #ruby-lang
dhruvasagar has joined #ruby-lang
<judofyr> I fear that nobody took my Liskov joke :( https://twitter.com/#!/judofyr/status/193262865027829760
<michael_mbp> apeiros_: can you think of anything I can do in line 40 as an example. Hmm…. https://gist.github.com/b900e4460b92dd2d9db1
<michael_mbp> bit brain dead to even think of an example… damn I need sleep.
<michael_mbp> hey judofyr
<apeiros_> judofyr: I didn't get it :(
<michael_mbp> ok I'm following you :p
<apeiros_> aw, aw, aaaw - judofry!
<apeiros_> soooryyy
<michael_mbp> wow I'm 1,100th judofyr
<michael_mbp> do I get a cookie?
<judofyr> michael_mbp: nice!
<judofyr> michael_mbp: I can even get you a signed one!
<michael_mbp> hehe xD
<judofyr> apieros: inheritance… Liskov's substitution principle?
<michael_mbp> hmm
<anildigital_work> How to know how much CPU % is being used from Ruby?
<anildigital_work> and also memory
<michael_mbp> top
<michael_mbp> and filter the ruby processes
<andrewvos> jodufry is a better name. Sorry judofyr
<ddfreyne> I like judofry personally
<anildigital_work> michael_mbp: filter?
<michael_mbp> hit h
<michael_mbp> and you can choose what attrubut
<michael_mbp> *attributes you want to filter by
apeiros_ has joined #ruby-lang
<apeiros_> yay, balloon hero @ railsberry
<apeiros_> awesome :D
srbartlett has joined #ruby-lang
rohit has joined #ruby-lang
<judofyr> andrewvos: I know, I know
<judofyr> andrewvos: I was young and silly
mattyoho has joined #ruby-lang
mattyoho has joined #ruby-lang
m3nd3s has joined #ruby-lang
PhilCK has joined #ruby-lang
seanstickle has joined #ruby-lang
stu314 has joined #ruby-lang
flgr_ has joined #ruby-lang
dv310p3r has joined #ruby-lang
<stu314> hi. ruby_1_9_3-r35412 segfaults once upon a time in one of the thread tests (bootstraptest/test_thread.rb): http://pastie.org/3822208 here is a backtrace: http://pastie.org/3822188 i can provide more information.
jondot_ has joined #ruby-lang
bryancp has joined #ruby-lang
jondot_ has joined #ruby-lang
flgr__ has joined #ruby-lang
Fullmoon_ has joined #ruby-lang
mssola has joined #ruby-lang
srbartlett has joined #ruby-lang
rohit-sharma has joined #ruby-lang
Ratyof has joined #ruby-lang
fattastic has joined #ruby-lang
apeiros_ has joined #ruby-lang
mistym has joined #ruby-lang
<darix> stu314: report it via http://bugs.ruby-lang.org/
gouthamvel has joined #ruby-lang
<stu314> darix: ok, thanks
<darix> stu314: 2 questions 1. it looks like it crashes in libc. 2. are you in low memory situations when it crashes?
<stu314> darix: no, this is a 8 GB RAM desktop computer, so it has a lot of free memory. the system is NetBSD, amd64.
codewrangler has joined #ruby-lang
virunga has joined #ruby-lang
m10zart has joined #ruby-lang
jondot_ has joined #ruby-lang
<darix> stu314: but as i said ... it could be a libc bug
<stu314> darix: sure. i'll try to ask on a netbsd maillist. thanks.
<darix> stu314: bt full might be interesting
<darix> and if possible
tbuehlmann has joined #ruby-lang
<darix> get the libc with debugsymbols or the debugsymbols for the libc
<darix> so one can see the params for the calls in it
<stu314> darix: i've compiled everything with "-g", is that not enough? (not sure)
morozovm has joined #ruby-lang
<darix> see frames 0-2 and 5-6 in the backtrace
mattyoho has joined #ruby-lang
<darix> the information in the () is missing
<darix> unlike for the ruby parts
<stu314> darix: ok, i'll try to do something about it.
jtoy has joined #ruby-lang
x0F_ has joined #ruby-lang
nofxxx has joined #ruby-lang
m10zart has joined #ruby-lang
mistym has joined #ruby-lang
<Ratyof> Omfg.
dv310p3r has joined #ruby-lang
hynkle has joined #ruby-lang
PhilCK has joined #ruby-lang
gouthamvel has joined #ruby-lang
gouthamvel has quit [#ruby-lang]
sockmonk has joined #ruby-lang
jondot_ has joined #ruby-lang
<sockmonk> are there any guides listing changes between ruby 1.9.2 and 1.9.3 that would force code changes? i.e., updated or removed syntax, that sort of thing?
slyphon has joined #ruby-lang
fattastic has joined #ruby-lang
<sockmonk> judofyr: thanks
Joeysomo has joined #ruby-lang
Joeysomo has joined #ruby-lang
<sockmonk> looks like very few compatibility issues, especially compared to going from 1.8.7 to 1.9.2
<apeiros_> sockmonk: 1.9.2 -> 1.9.3 is mostly additions
<apeiros_> I don't think anything got actually removed
<sockmonk> that NEWS link listed a change in Rational#to_d, and some changes in net/http and openssl... doubt I have anything that would impact though
<sockmonk> will accessing an internal gem server become a problem, if that internal gem server uses a self-signed ssl cert?
mstratman has joined #ruby-lang
<sockmonk> nm, our internal gem server is just using plain http
hynkle has joined #ruby-lang
Indian_ has joined #ruby-lang
singpolyma has joined #ruby-lang
banister has joined #ruby-lang
zmack has joined #ruby-lang
singpolyma has joined #ruby-lang
divoxx has joined #ruby-lang
Sailias has joined #ruby-lang
datanoise has joined #ruby-lang
tomzx has joined #ruby-lang
Austin__ has joined #ruby-lang
enebo has joined #ruby-lang
mistym has joined #ruby-lang
mistym has joined #ruby-lang
gregf has joined #ruby-lang
DMKE has joined #ruby-lang
futurechimp has joined #ruby-lang
outoftime has joined #ruby-lang
<wwalker> require 'foo-etc'; require 'etc'; Etc.getpwnam('bar') => undefined method `getpwnam' for Foo::Etc:Module | require 'etc'; Etc.getpwnam('bar') => 503
<wwalker> How to tell ruby to stop being stupid and use the FULL match that is there instead of a non-existent partial match it pulled out of a crack pipe?
<singpolyma> ::Etc
<wwalker> I can use ::Etc.getpwnam('bar') but I shouldn't have to
<wwalker> singpolyma: :-) thank you
zmack has joined #ruby-lang
<wwalker> that indicates that in order to have deterministic calling of ruby class methods, one would have to Always use ::Foo::Bar.methodname
<singpolyma> no
<singpolyma> Ruby deterministically resolves namespaces
<singpolyma> just not in the way you prefer in this case, that doesn't make it nondeterministic
mattyoho has joined #ruby-lang
<singpolyma> you have to use :: when you live inside a module named the same as the module you're trying to reach
<TTilus> wwalker: its just like paths
bryancp has joined #ruby-lang
<TTilus> wwalker: absolute paths start with ::
<TTilus> wwalker: otherwise they are relative
thone_ has joined #ruby-lang
ericmuyser has joined #ruby-lang
jbwiv has joined #ruby-lang
mark_locklear has joined #ruby-lang
<shevy> hmm
<shevy> anything that forces you to do require 'foo-etc' should be removed anyway simply because it includes a '-'
dejongge has joined #ruby-lang
jperry has joined #ruby-lang
michael_mp has joined #ruby-lang
futurechimp has joined #ruby-lang
michael_mbp has joined #ruby-lang
<wwalker> TTilus: so it tries to fit in the current namespace, then each parent till it hits the top?
<wwalker> Because I was in Foo::Bar::Bim namespace when I called Etc.getpwnam() and was told that Foo::Etc.getpwnam didn't exist
<sockmonk> if so, then relative naming would be fragile. you might get away with just Foo::Bar at first, until a parent module added its own Foo, thus later forcing you to use ::Foo::Bar to get the right module
<wwalker> sockmonk: that is my problem. Code in Foo::Bar::Bim called Etc.getpwnam. Later Foo::Etc was created, so now Etc.getpwnam fails :(
kvirani has joined #ruby-lang
bglusman has joined #ruby-lang
m10zart has joined #ruby-lang
rdavila has joined #ruby-lang
<sockmonk> hmm. could use :: consistently and avoid relative class names altogether.
<sockmonk> or (much worse probably), something like class Foo::Etc; def getpwnam; ::Etc.getpwnam; end; end
<shevy> sounds like a fragile module
petercooper has joined #ruby-lang
IPGlider has joined #ruby-lang
replore_ has joined #ruby-lang
Radium has joined #ruby-lang
grin has joined #ruby-lang
_Andres has joined #ruby-lang
hagabaka has joined #ruby-lang
hagabaka has joined #ruby-lang
m3nd3s has joined #ruby-lang
cdnz has joined #ruby-lang
rdavila has joined #ruby-lang
alexkane has joined #ruby-lang
Psyche^ has joined #ruby-lang
Z33K|Lux has joined #ruby-lang
Rich_Morin_ has joined #ruby-lang
retro|cz has joined #ruby-lang
rippa has joined #ruby-lang
kiddorails has joined #ruby-lang
rolfb has joined #ruby-lang
jxie has joined #ruby-lang
<Rich_Morin_> I've been wondering about ways to code in a more modern style than Google SketchUp's embedded 1.8.6 interpreter allows. backports might let me use some 1.9ish methods, but that doesn't address syntactic issues. Are there any projects to do 1.9.x->1.8.6 code translation?
macmartine has joined #ruby-lang
<shevy> Rich_Morin_ hehehehe
<shevy> for the most part there is not much syntax difference
<shevy> but some people write in 1.9.x exclusively style
alexkane has joined #ruby-lang
<Rich_Morin_> http://www.oreillynet.com/pub/a/ruby/excerpts/ruby-best-practices/writing-backward-compatible.html lists several differences. Some of them look pretty easy to translate.
<shevy> not quite sure why you need 1.9ish methods btw, if it is ruby code, it works in 1.8.6 unless it specifically uses things like foo: "bla"
<Rich_Morin_> It's not that I _need_ 1.9ish methods, just that it's becoming annoying to have half of my Ruby development stuck in an old version.
andrewhl has joined #ruby-lang
butchanton has joined #ruby-lang
savage- has joined #ruby-lang
<shevy> I am still on ruby 1.8.7 (2012-02-08 patchlevel 358) [x86_64-linux]
<shevy> most of my code works on 1.9.x as-is too
<shevy> save some annoying warnings
dejongge has joined #ruby-lang
rockpapergoat has joined #ruby-lang
<Rich_Morin_> Yep; forward compatibility isn't much of a problem.
crackity_jones has joined #ruby-lang
t has joined #ruby-lang
robbyoconnor has joined #ruby-lang
r0bby has joined #ruby-lang
Mikoangelo has joined #ruby-lang
z3r00ld has joined #ruby-lang
guns has joined #ruby-lang
rippa has joined #ruby-lang
francisfish has joined #ruby-lang
brianpWins has joined #ruby-lang
judofyr has joined #ruby-lang
lchi has joined #ruby-lang
zmack has joined #ruby-lang
<wwalker> shevy: which module? Foo::Bar::Bim should not be affected because Foo::Etc comes into existence I would understand if it was grabbing Foo::Bar::Bim::Etc, but not Foo:Etc
replor___ has joined #ruby-lang
<shevy> wwalker that 'foo-etc' thing you are using
m3nd3s has joined #ruby-lang
Rich_Morin_ has quit [#ruby-lang]
Zolrath has joined #ruby-lang
divoxx has joined #ruby-lang
flgr_ has joined #ruby-lang
<singpolyma> What's the best/popular Markdown library these days?
<andrewvos> singpolyma: Use tilt
<singpolyma> andrewvos: seems a bit heavy when I just need Markdown support, no?
<Mon_Ouie> You can just use Kramdown
<singpolyma> also, even if I use tilt, I have to choose a Markdown backend to install for it to use :)
mrsolo has joined #ruby-lang
fvollero has joined #ruby-lang
<andrewvos> meh, go to the tilt page and you'll see all the markdown parsers
r0bby has joined #ruby-lang
<singpolyma> Yeah, Kramdown looks pretty good
<singpolyma> mostly, I'm using BlueCloth, but it sucks a bit
<ged> singpolyma: How so?
<singpolyma> ged: well, last I checked, it doesn't support 1.9 encodings at all
RegEchse has joined #ruby-lang
<singpolyma> it just forgets what encoding the string had and the output gets set to binary
m3nd3s has joined #ruby-lang
zmack has joined #ruby-lang
benanne has joined #ruby-lang
moxiemk1 has joined #ruby-lang
<z3r00ld> is prabhu around or still in shift
Austin__1 has joined #ruby-lang
<z3r00ld> wrong window, please excuse and ignore
<andrewvos> NEVER FORGET
<z3r00ld> there will be no next time :)
<z3r00ld> sry guys
z3r00ld has quit [#ruby-lang]
dfr|mac has joined #ruby-lang
<ged> singpolyma: http://pastie.org/3823903
Guest97786 has quit [#ruby-lang]
Defusal has joined #ruby-lang
<singpolyma> ged: interesting
<singpolyma> ged: on my system Kramdown is not exhibiting that bug
gouthamvel has joined #ruby-lang
Sailias has joined #ruby-lang
<ged> singpolyma: But BlueCloth is?
mrsolo has joined #ruby-lang
<singpolyma> it was last time I used it. it may be fixed now
m3nd3s has joined #ruby-lang
<singpolyma> that was some time ago
kvirani has joined #ruby-lang
divoxx has joined #ruby-lang
<ged> So yeah, i guess if you last used it before then...
headius has joined #ruby-lang
judofyr has joined #ruby-lang
burgestrand has joined #ruby-lang
dankest has joined #ruby-lang
qpingu has quit [#ruby-lang]
alex_k has joined #ruby-lang
kain has joined #ruby-lang
qpingu has joined #ruby-lang
gouthamvel has joined #ruby-lang
krz has joined #ruby-lang
kiddorails has quit [#ruby-lang]
anildigital has joined #ruby-lang
<Defusal> does anyone know what the fastest way to create checksums of files that are 150MB and smaller is?
<anildigital> why is this class not threadsafe? https://gist.github.com/293c8ce191d75b903b1b
<drbrain> Defusal: Digest on mmap?
<judofyr> Defusal: the openssl command line tool?
<drbrain> anildigital: because you access @actors_array without a mutex
<anildigital> drbrain: hmm..
<anildigital> drbrain: isn't there any way to write threadsafe class without mutex?
<anildigital> drbrain: is it because it's Singletone?
<drbrain> you could use monitor instead of mutex
<judofyr> hehe
<anildigital> /s/Singletone/Singleton
<drbrain> I meant mutex as short for "mutual exclusion"
<anildigital> drbrain: :D
<anildigital> I want to initialize some data at Rails startup .. so that my app can use it..
<anildigital> is that right way to initialize data.. I had to use Singleton class...
<anildigital> so that it returns me same data?
<anildigital> but now my requirement is that this should be threadsafe too
hagabaka has joined #ruby-lang
hagabaka has joined #ruby-lang
<Defusal> drbrain, thanks, i guess that could work
<drbrain> anildigital: the Singleton in ruby provides thread-safe initialization but does not provide thread-safe access in instance variables in methods besides #initialize
<drbrain> if you rename get_actors_array to initialize, fine
<drbrain> Defusal: I'm only guessing
<anildigital> drbrain: hmm.. initialize in Singleton?
<Defusal> judofyr, hows fast is that?
<anildigital> it's disabled right
<drbrain> you should be sure to benchmark against File.read or reading a file in chunks
<drbrain> anildigital: it will only be called once
<judofyr> Defusal: dunno, but probably pretty fast
<anildigital> drbrain: okay.. but how to read data back..
macmartine has joined #ruby-lang
<anildigital> trying it out
<drbrain> attr_reader :actors_array
achiu has joined #ruby-lang
<anildigital> yeah same
gouthamvel has quit [#ruby-lang]
<drbrain> anildigital: http://paste.segment7.net/si.html
<Defusal> judofyr, it is pretty fast
gix has joined #ruby-lang
<anildigital> drbrain: cool..
<Defusal> interestingly enough, the speed of Zlib.crc32(File.read(...), 0) is consistently very close to one of two values
<drbrain> anildigital: this works for me, so it should work for you
<anildigital> drbrain: yep... that's nice..
<Defusal> it is either 0.13, or about 0.7
<Defusal> that is a large difference, i'm not sure what would cause that
<Defusal> openssl md5 takes 0.22
<drbrain> Defusal: you're probably hitting cache eviction behavior
apeiros_ has joined #ruby-lang
<drbrain> openssl is going to use streaming reads
<judofyr> Defusal: md5 is quite a different beast from crc32 though. a plain C-version of crc32 is probably even faster.
<Defusal> drbrain, ah i just timed the File.read
<Defusal> if i execute it about once a second, every second read is fast, and every other read is slow
<drbrain> File.read is going to create a huge String which may evict the OS cache as ruby requires more memory
<Defusal> yeah
<drbrain> judofyr: Zlib.crc32 is from libz, so it's in C
<Defusal> CRC is better than MD5 for files is it not?
<judofyr> drbrain: yeah, and I guess the overhead from opening files isn't that bad (compared to I/O)
<Defusal> i'd rather not read the file into a ruby string
<drbrain> Defusal: it depends on your needs
<Defusal> it is an eventmachine application, so if i have to, i will have to read it in chunks
<drbrain> Defusal: if you want a simple checksum, crc32 is fine. If you need a value that cannot be modified, sha1
<drbrain> rather, a value that you can check modification with
<drbrain> or sha2
<Defusal> the chance of two files having the same CRC is pretty damn small, so it should be ok
<Defusal> in fact, i'll use the checksum to check a file by name
<drbrain> Defusal: what are you using the CRC for?
<Defusal> so it would just be to tell two files that have the same name apart
<Defusal> drbrain ^
<drbrain> Defusal: then so long as the checksums never leave your program, sounds fine
marcostoledo has joined #ruby-lang
<Defusal> yeah, but i still don't know what the fastest way to generate it is
<Defusal> is there a native gem?
<Defusal> or should i just spawn `crc32 #{path}`
<drbrain> Defusal: something like this: http://paste.segment7.net/sj.html
<Defusal> drbrain, i don't want to read the file from ruby
<Defusal> at the very least i want to use a native gem
<Defusal> as i said, it is an EventMachine platform
<drbrain> it's hard to get more native than libz
<drbrain> I don't see what that has to do with reading a file in chunks
<drbrain> it's not like EventMachine magically doesn't work with IO#read
<drbrain> nor with libz
<Defusal> ok, then i will roll my own solution
<Defusal> i'll use libz, but read the file in chunks over multiple reactor ticks
<Defusal> else the reading will block the eventloop
ridders24 has joined #ruby-lang
kurko_ has joined #ruby-lang
<ridders24> Why do I get the following error: http://pastie.org/3816573 with this code: http://pastie.org/3816005. Im also getting some dir's copied more than once for some reason
<mistym> Hey again ridders24!
<ridders24> mistym: hello
<ridders24> hows things mistym?
<mistym> Pretty good, thanks.
<mistym> It's Friday. :V
<ridders24> thats a good point
<mistym> OK, I see where you're getting the error from.
<mistym> So your Find.find is looping through every directory and file in E:\ and C:\, then copying to a temporary directory in C:\tmp. Right?
Ethan has joined #ruby-lang
<ridders24> correct
<mistym> So take a look at the cp_r error. What is it complaining about?
<mistym> (PS - I see that you upgraded to Ruby 1.9. Good call!)
<ridders24> thanks. its complaining about the block?
<mistym> Do you know how to grok the stack trace?
raph_io has joined #ruby-lang
<ridders24> I have no idea what that means
<mistym> OK. Basically, an error message can be traced back through multiple layers of code, since code is typically made up of small pieces ("methods") calling each other.
srbaker has joined #ruby-lang
PhilCK has joined #ruby-lang
<mistym> That's why there are multiple levels of errors - it's starting from the error itself, then tracing it back to each level at which it was called.
<mistym> In this case, we want to focus on the very first line, which is the immediate error. It's an easy one to understand, so you don't need to trace it back to where you called it in your code to understand.
<mistym> It tells you the type of error (ArgumentError), which lets you understand what *kind* of error it is; it provides a specific error message ("same file: C:/tmp/1010/LKRL-24-2 and C:/tmp/1010/LKRL-24-2"); and it tells you on what line of code the error occurred.
<mistym> So. What this tells you is that there is something wrong with the argument you passed to cp_r - note what the error message is. Do you understand the problem?
<ridders24> that would make sence as in this instance E and C are indentical regarding the files and dir
<mistym> Even more so, actually - note the two filenames given.
<ridders24> i was testing the copying and didnt bother to alter the dirs, but should it just overwrite the other one?
<ridders24> ooo?! its found a C:/tmp/1010/LKRL-24-2?, ohh i know why
<ridders24> becuase its going through C where the tmp dir is
<ridders24> ahh ok
Muz has joined #ruby-lang
<ridders24> i didnt think of that
<ridders24> in practical use it wont be copying to the same dir as where it is
<mistym> You should make sure to guard against that though!
<ridders24> okay
<ridders24> how?
gouthamvel has joined #ruby-lang
gouthamvel has quit [#ruby-lang]
Radium_ has joined #ruby-lang
<ridders24> I still have the problem too, that its repeating some of the Dir's. So for example I have 1234/ABC-1-2 dir in the root of tmp, and then it repeats ABC-1-2 in tmp
<mistym> ridders24: That's because Find.find iterates through every subdirectory and file!
lsegal has joined #ruby-lang
<ridders24> mistym: what should i use instead?
<ridders24> mistym: dir.glob ?
<mistym> You have two options here: a) if there's only one place or a set of places files come from, you probably want something other than Find.find. b) If you do need to search anywhere, you should make sure Find stops looking deeper into a directory after you copy it.
<judofyr> current status: str.gsub(%r|(</?)super(super)*textarea\b|, '\1\2textarea')
<drbrain> ridders24: hint: Find.prune
<matti> apeiros_: I not sure.
futurechimp has joined #ruby-lang
<matti> apeiros_: I moved from Poland long time ago ;]
<matti> s/I/I am/
<ridders24> mistym: I doesnt like Find.prune instead of Find.find. I get an error.
<mistym> ridders24: Find.prune is a method you should use inside the Find.find block.
<mistym> See if you understand how it works from the sample code there.
<mistym> (ps - ruby-doc.org is really useful!)
<ridders24> I'll have a read
<mistym> It's short!
<ridders24> ahh ok, I try that
frangiz_ has joined #ruby-lang
tommyblue has joined #ruby-lang
Oloryn_lt2 has joined #ruby-lang
cdnz has joined #ruby-lang
<ridders24> Mistym: why does nothing happen now? http://pastie.org/3816005
<mistym> ridders24: Because your Find.prune is coming *before* the rest of your if statement!
<mistym> Check the docs - Find.prune ends execution of that iteration of the block. So, it's skipping the rest of your code.
workmad3 has joined #ruby-lang
<erikh> also, don't require fileutils with studly caps
<erikh> it won't work on systems that have case-sensitive filesystems.
<ridders24> cheers
<erikh> enjoy!
rdavila has joined #ruby-lang
mattyoho has joined #ruby-lang
sandbags has joined #ruby-lang
cdnz has joined #ruby-lang
jfelchner has joined #ruby-lang
nif has joined #ruby-lang
<ridders24> Mistym: thanks. I've noticed some problems with my script and need to go away and rethink this.
<mistym> ridders24: OK! Let me know if you need any more help.
<TTilus> ridders24: you might just rethink aloud here
<TTilus> in case others have ideas on how to overcome the problems and improve your script
jtoy has joined #ruby-lang
<ridders24> I need to think over the use of the script first, thanks anyway
andkerosine has joined #ruby-lang
<andkerosine> drbrain: Present?
<drbrain> andkerosine: for a little while longer
<andkerosine> Bless the fates.
<andkerosine> I'm running into a strange issue with net-http-pipeline.
<drbrain> ok
<andkerosine> Sending requests as instances of Net::HTTP::Get works just fine.
<andkerosine> If I send them as Posts, however, the server becomes non-pipelined?
<drbrain> correct, since a POST is not idempotent
<mistym> Anyone have opinions on the Ruby Best Practices book?
<andkerosine> Ah... duh.
<drbrain> I don't think I have a "trust me, I know what I'm doing" override like net-http-persistent has to treat POST as non-idempotent
<drbrain> err, as idempotent
<andkerosine> What does including that sort of trust entail?
<drbrain> andkerosine: a pull request
<andkerosine> Haha, right on.
ttilley has joined #ruby-lang
<drbrain> andkerosine: net-http-persistent has "attr_accessor :retry_change_requests"
<drbrain> so I think "pipeline_change_requests" would be a fine method name
nahhh has joined #ruby-lang
headius_ has joined #ruby-lang
nif has joined #ruby-lang
<andkerosine> drbrain: Why does this work? https://gist.github.com/2431441
<andkerosine> Content-Length of 0 makes POST pretend to be GET?
fukushima has joined #ruby-lang
<drbrain> andkerosine: per spec, I can't pipeline POST by default at all
<drbrain> it doesn't matter if there's no content or not
datanoise has joined #ruby-lang
<andkerosine> But that... does pipeline POST, no?
<drbrain> andkerosine: no, each request will wait for a response before continuing with the next request
<andkerosine> Ah.
nif has joined #ruby-lang
<drbrain> pipeline is "make requests without waiting for responses" then "process responses as they come back"
Indian has joined #ruby-lang
<drbrain> andkerosine: the spec says that POST may be pipelined if the client has proper knowledge of the application-specific behavior
dankest has joined #ruby-lang
fgomez has joined #ruby-lang
<andkerosine> drbrain: Pipelining GETs that POST is probably frowned upon, huh?
<drbrain> I don't understand
<drbrain> GET is (should be) idempotent by default
<drbrain> if you change server state based on a GET you're doing it wrong
<erikh> some caching tools will ... not play well with that
<erikh> also robots.
<drbrain> robots clicking your GET links that change data caused data loss in rails apps some time back
<drbrain> DHH wrote a blog post about how google was breaking stuff but got educated
<drbrain> it was rails' fault, not google's
<judofyr> drbrain: do you know how to use Racc?
<drbrain> andkerosine: if can GET GET GET POST GET GET
<drbrain> oops, "if you ..."
<andkerosine> It's a GET, a POST, then 100 POSTS before starting again...
<drbrain> andkerosine: net-http-pipeline does: GET GET GET, wait for responses, POST, wait for response, GET GET, wait for responses
<drbrain> judofyr: it's like yacc or bison
<judofyr> drbrain: I was thinking more in running the compiler etc.
postmodern has joined #ruby-lang
<judofyr> I just setting basic things up
<judofyr> and*
<drbrain> judofyr: … ditto ☺
<drbrain> judofyr: try race -v -l -o out.rb out.y
<drbrain> oops, racc
<drbrain> lunch time for me
<judofyr> "If you have not use yacc, also racc is too difficult."
hynkle has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
burgestrand1 has joined #ruby-lang
divoxx has joined #ruby-lang
<Harzilein> *sigh*
<Harzilein> is there any good rake example code for how to recursively make one directory from another one? (what i'm trying to do is make a doc directory for a collection of puppet modules)
<andkerosine> Harzilein: Would Dir.entries + File.mkdir_p not suffice?
<Harzilein> andkerosine: uhm, it's about adding puppetdoc tasks for the individual manifests after scanning the directory
<Harzilein> andkerosine: and then depending on them
<Harzilein> andkerosine: rake doc should depend on a generated file for every manifest
stu314 has quit [#ruby-lang]
<Harzilein> andkerosine: currently i'm just unconditionally rebuilding all docs, that's not something i want in a make-like system :)
headius has joined #ruby-lang
<manveru> Harzilein: it's kinda tedious
<Harzilein> manveru: hm?
<manveru> just that in this case you also itereate the manifests and add a file rule for each
<manveru> err, a file dependency
andkerosine has quit [#ruby-lang]
butchanton1 has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
DMKE has joined #ruby-lang
butchanton has joined #ruby-lang
hynkle has joined #ruby-lang
matt_yoho has joined #ruby-lang
outoftime has joined #ruby-lang
mattyoho has joined #ruby-lang
frangiz has joined #ruby-lang
hagabaka has joined #ruby-lang
bglusman has joined #ruby-lang
lchi has quit [#ruby-lang]
gix has joined #ruby-lang
havenn has joined #ruby-lang
heftig has joined #ruby-lang
hackingoff has joined #ruby-lang
jakko has joined #ruby-lang
towski has joined #ruby-lang
<Harzilein> manveru: *sigh*
<Harzilein> manveru: it _is_ tedious %-)
RegEchse has joined #ruby-lang
havenn_ has joined #ruby-lang
mattyoho has joined #ruby-lang
andrewhl has joined #ruby-lang
havenn has joined #ruby-lang
jakko_ has joined #ruby-lang
headius has joined #ruby-lang
headius has joined #ruby-lang
jakko_ has joined #ruby-lang
bryancp has joined #ruby-lang
Sailias has joined #ruby-lang
<drbrain> Harzilein: look at ZenWeb
<drbrain> it builds documentation using rake something like what you are describing
jakko_ has joined #ruby-lang
tomzx has joined #ruby-lang
<Harzilein> drbrain: thanks
workmad3 has joined #ruby-lang
kish has joined #ruby-lang
burgestrand has joined #ruby-lang
kish has joined #ruby-lang
guns has joined #ruby-lang
Pip has joined #ruby-lang
Pip has joined #ruby-lang
kish has joined #ruby-lang
kish has joined #ruby-lang
kish has joined #ruby-lang
mrsolo has joined #ruby-lang
kish has joined #ruby-lang
rdavila has joined #ruby-lang
divoxx has joined #ruby-lang
kish has joined #ruby-lang
shaman42 has joined #ruby-lang
vmoravec has joined #ruby-lang
WillMarshall has joined #ruby-lang
gregmoreno has joined #ruby-lang
dumfries has joined #ruby-lang
mistym has joined #ruby-lang
kish has joined #ruby-lang
postmodern has joined #ruby-lang
jfelchner has joined #ruby-lang
fireglow has joined #ruby-lang
mephux has joined #ruby-lang
kish has joined #ruby-lang
alindeman has joined #ruby-lang
jakko_ has joined #ruby-lang
fgomez has joined #ruby-lang
Skif has joined #ruby-lang
s0ra_h has joined #ruby-lang
Xzyx987X has joined #ruby-lang
bougyman has joined #ruby-lang
nofoo has joined #ruby-lang
mtkd has joined #ruby-lang
ixx has joined #ruby-lang
jaimef has joined #ruby-lang
L0rdShrek has joined #ruby-lang
thorncp has joined #ruby-lang
youngin has joined #ruby-lang
ohsix has joined #ruby-lang
_ko1 has joined #ruby-lang
mahlon has joined #ruby-lang
mrb_bk has joined #ruby-lang
mitchty has joined #ruby-lang
kish has joined #ruby-lang
jarred has joined #ruby-lang
<dontbecold_> what's the "best" method for enforcing a timeout on IO#gets (technically a Socket)?
nofxxx has joined #ruby-lang
<erikh> ri Timeout
petercooper has joined #ruby-lang
kish has joined #ruby-lang
<dontbecold_> erikh: I thought Timeout was considered "bad"?
<erikh> bad for what?
<erikh> you could always use the old sigalrm pattern
<erikh> I don't think that's any better, though.
<dontbecold_> not to be considered good practice is what I meant :)
<erikh> eh
<erikh> it's contextual
<erikh> Timeout uses a thread
<erikh> that has consequences
<drbrain> dontbecold_: Timeout is bad when you can't restore state inside the Timeout
<erikh> drbrain: diablo beta this weekend!
<andrewhl> ["name1", "name2", "name3", "name4"].inject { |r,n| r + " " + n.capitalize } outputs: "name1 Name2 Name3 Name4". ["name1", "name2", "name3", "name4"].inject { |r,n| r.capitalize + " " + n.capitalize } outputs: "Name1 name2 name3 Name4". I don't really understand what's going on here, but how would I use inject to capitalize all the names?
<drbrain> erikh: I was never into Diablo
<erikh> meh
<dontbecold_> this is already threaded so I'm not too worried about using threads, but what are the consequences you speak of?
seanstickle has joined #ruby-lang
<drbrain> andrewhl: don't use inject
<drbrain> andrewhl: use map + join
<andrewhl> maybe it's a stupid exercise
<drbrain> dontbecold_: a problem I've run across personally is with using Net::SMTP
<drbrain> dontbecold_: when you're delivering a mail if there's a Timeout you have to ditch the connection and create a new one
<drbrain> dontbecold_: you can't trust that the timeout didn't corrupt the internal state of Net::SMTP
kish has joined #ruby-lang
<drbrain> andrewhl: that final example is not a good example of a use of inject
<dontbecold_> drbrain: Hmm, OK, what I'm trying to do is close a Socket object after a timeout of 5 minutes, would Timeout be OK for that?
<drbrain> andrewhl: if you want to continue with it, start_from in the final example code is your clue
<drbrain> dontbecold_: yes
<drbrain> dontbecold_: since you're closing the socket upon timeout you won't be able to corrupt state
<drbrain> dontbecold_: another option is to use IO.select to implement the timeout
<dontbecold_> drbrain: that looks a tad complex, but I suppose it's better than having enough threads to knit a jumper with
<drbrain> dontbecold_: but using #gets with IO.select may still cause you to block
<drbrain> you'd need to do your own buffering to ensure you got to the newline
phlipper has joined #ruby-lang
kish has joined #ruby-lang
<andrewhl> drbrain: the example uses integers, but i'm dealing with strings. Do I need to use a regex or something to indicate the start of the line? /^/ or something like that?
<dontbecold_> drbrain: OK, thank you for the advice
<drbrain> here's a skeleton for using IO.select: readers, = IO.select [io], nil, nil, 5; buffer << readers.first.read_nonblock
<freedrull> ok i tried using GC::Profiler, and I'm pretty sure I have a 'memory leak'. I'm basically looping over some objects and the number of Total Objects to get larger and larger...is there any more detailed memory profiling available for 1.9 so I can figure out what is causing this?
<drbrain> dontbecold_: often it's easier to start by using threads
replore has joined #ruby-lang
<drbrain> andrewhl: if you're summing a list of numbers, what is a number you can start with that won't affect the total?
<andrewhl> 0...
<dontbecold_> drbrain: OK, thank you
<drbrain> andrewhl: if you're creating a string, what is a string you can start with that won't affect the result?
<dontbecold_> phlipper: the same phlipper who works/worked for Appoxy?
<andrewhl> but inject(0) gives me: String can't be coerced into fixnum
<andrewhl> ah
<andrewhl> ""?
<drbrain> andrewhl: try it :)
<andrewhl> thank you!
_Andres has joined #ruby-lang
kish has joined #ruby-lang
<drbrain> freedrull: there's a few
<drbrain> freedrull: look for memprof
virunga has joined #ruby-lang
<freedrull> drbrain: thanks
kish has joined #ruby-lang
kyrylo has joined #ruby-lang
kish has joined #ruby-lang
kish has joined #ruby-lang
kish has joined #ruby-lang
Dreamer3 has joined #ruby-lang
dv310p3r has joined #ruby-lang
replore_ has joined #ruby-lang
kish has joined #ruby-lang
kish has joined #ruby-lang
gsav has joined #ruby-lang
kish has joined #ruby-lang