Topic for #ruby-lang is now Ruby 1.9.3p0: http://ruby-lang.org | Paste >3 Lines of Text on http://pastie.org
georgerb joined #ruby-lang
<georgerb> Hi!
<georgerb> Can you guys tell me about any official Ruby certificate? (sorry for my english btw)
<epitron> the Epitron School of Ruby would be happy to certify you
<epitron> our certificates run anywhere from --- $900 for basic ruby, to $5000 for a full rails certification
<georgerb> epitron, thanks for the fast reply, I will check it out ^_^
<rue> :D
<lianj> ^^
<epitron> no problemo!
<petercooper> Yeah, the Epitron school is one of the best
<georgerb> xD
<epitron> it's a very prestigious and selective institution, so there is no website
<rue> epitron: You need to work on your trolling
<georgerb> hehehe
<petercooper> I heard they also offer a masters degree in bullshit
<epitron> we don't want to get overrun with applicants
<envygeeks> oh shhi
<rue> Your pricing implies Rails is a rarer skill than Ruby, and that's obviously incorrect
tenderlo_ joined #ruby-lang
<petercooper> I wondered that but then realized it's because the median Rails dev is stupid enough to pay it.
<rue> Ah, true
<epitron> ;)
<petercooper> I say median because you are all awesome, of course
<epitron> also, companies pay for this stuff
<epitron> and companies want rails sites
<epitron> i'm using the same system as microsoft
<envygeeks> What did I say about using rails? Life is meant to be hard, so build everything from the ground up, rewrite it 30 times and stop using new relic
tenderlo_ joined #ruby-lang
* epitron revokes envygeeks' certificate
<georgerb> epitron, xD
saLOUt joined #ruby-lang
StevenRingo joined #ruby-lang
georgerb left #ruby-lang
<rue> epitron: Great disrupt/pivot idea: revocable certificates
<rue> Universities'll love it.
andrewvos joined #ruby-lang
<andrewvos> omfg
<andrewvos> My irssi instance crashed apparently
<andrewvos> First time in like 6-8 months
<epitron> in -2 months
<andrewvos> epitron: how so?
<epitron> infix operator
<andrewvos> epitron: You lost me
<drbrain> 6 - 8 = -2
replore_ joined #ruby-lang
* epitron gives drbrain a gold star
<epitron> hah.. i was reading something about teaching the other day, and apparently boys and girls need different rewards
<rue> Days without a restart: -60
<Asher> different rewards b/c we tell them that boy rewards don't plug into girls and vice versa
<epitron> girls tend to be a bit insecure, so you have to be supportive and encouraging
<Asher> gender is programmed
<andrewvos> sexist
<epitron> while boys tend to be egotistical, so support makes that worse
<epitron> they need to be brought down to earth a bit
<steveklabnik> boy/girl is a false dichotomy. ;)
<epitron> butch/femme
<epitron> whatever you wanna call it
<Asher> haha
<envygeeks> what happens if I have both parts?
<andrewvos> magic?
<steveklabnik> parts have nothing to do with gender.
<steveklabnik> ;)
<epitron> parts do have a little to do with gender
<steveklabnik> nope
<steveklabnik> zero.
<andrewvos> Pretty sure they do?
<epitron> yeah, they kinda do
<steveklabnik> gender is about presentation
<steveklabnik> sex is about parts.
<rue> Really, just label everything top/bottom and let people switch :/
<steveklabnik> totally separate axes
<epitron> gender: n. the properties that distinguish organisms on the basis of
<epitron> their reproductive roles;
<Asher> top/bottom/versatile makes way more sense than male/female :P
<steveklabnik> hahahaha
<steveklabnik> Asher: that's something else entirely
<Asher> we like to say so
<Asher> but really it's waht male/female come down to
<Asher> that and babies :P
<steveklabnik> Gender is a range of characteristics used to distinguish between males and females, particularly in the cases of men and women and the masculine and feminine attributes assigned to them.
<Asher> gender is what we get when we map political relations by the uterus
<steveklabnik> Depending on the context, the discriminating characteristics vary from sex to social role to gender identity.
<rue> Gender is a grammar thing.
<steveklabnik> ;)
phlipper joined #ruby-lang
Heimidal_ joined #ruby-lang
<epitron> wow
<epitron> you're putting a lot of shit into that one word
<Asher> grammar?
<epitron> i hope it can hold it
<rue> Asher: Sex is biology, gender is grammar
<Asher> grammar is what holds
<Asher> rue - nah sex is the immanence of desire, gender is its grammar
<Asher> biological is a product of gender
<Asher> biology rather
<andrewvos> immanence?
<envygeeks> sweet, I started a war
<Asher> immanence = like sun flares
<envygeeks> I've been planning this carefully all day
<Asher> energy welling up
<Asher> biology is the systematization of the grammar of vital processes
<Asher> vital processes are instances of negative entropy
<jensn> All great languages have at least four genders.
<Asher> four?
<rue> And lots of sex!
<jensn> Asher: Four, yes.
cjs226 joined #ruby-lang
<Asher> masculine, feminine, neuter sometimes, waht would be the fourth
<envygeeks> Male, Female, Unicorn and Wizard?
<Asher> i mean i know there are languages that have like 17 genders (thai i believe it is)
<jensn> masculine, feminine, neuter, uter.
<Asher> uter?
<envygeeks> what is uter?
<andrewvos> fuck
<andrewvos> I don't even
<steveklabnik> lol
<jensn> Asher: Thai doesn't even inflect for genders.
<Asher> right they aren't grammatical genders
<Asher> they are genders of bodies
<samuelkadolph> I thought this was #ruby-lang and not #lang
<steveklabnik> ActiveGender
<Asher> language theory is always relevant
<steveklabnik> ::Inflector
<steveklabnik> ;)
<andrewvos> I don't understand how I come here, say that my irssi session has died, and then this.
<Asher> you didn't gather that we were talking about you?
<steveklabnik> hahahahahahah
<envygeeks> Are you a wizard?
<jensn> I wish I was.
<andrewvos> Yes. Yes I am envygeeks.
<andrewvos> I can magic up some crazy shit in a chatroom in seconds.
<drbrain> D:
<rue> Hm, did you know that ruby-lang = gums?
<rue> "ruby".each_byte.zip("lang".each_byte).map {|a, b| ((a - b).abs + "a".ord).chr }.join
<andrewvos> 0_0
igotnolegs joined #ruby-lang
<andrewvos> rue: You have too much time on your hands.
<envygeeks> I think he's high right now
<andrewvos> Kind of doubt that
<rue> That took like 15 seconds to write :/
<envygeeks> I still think you're high
<andrewvos> That took me like 60 seconds to read
<andrewvos> rue: You are not a stoner right?
<rue> No, I use LSD exclusively
dejongge1 joined #ruby-lang
<andrewvos> I hadn't picked you for a stoner. Otherwise your jokes would be more shevy-like.
zmack joined #ruby-lang
<rue> You should assign a stoner probability rating to everyone
<erikh> stoner quotient
<erikh> 8 courics.
takaokouji joined #ruby-lang
<rue> From Katie Couric, mother of all stoners?
<erikh> it's a bit of a south park reference
<erikh> but yes, it's related to katie couric.
<erikh> also I love linkinus because i don't have to click on these funny pictures anymore
<erikh> andrewvos: !im herp derp
<erikh> c'mon, respond bot
<andrewvos> erikh: ...
<rue> South Park? That's the series from the 90's right?
<erikh> it still has its moments
<andrewvos> rue: It is.
<erikh> a bit like family guy in that regard
<rue> Family Guy's gone to the shitter in exact inverse relation to the Simpsons getting better again
<rue> Although the time travel episode was pretty good
<andrewvos> rue: The Simpsons has not got better.
<lianj> haha
<andrewvos> erikh: You pay for linkinus?
<erikh> yes
<andrewvos> erikh: There's Textual which is free I think
<samuelkadolph> andrewvos: It's not
<samuelkadolph> But you can compile it yourself
<andrewvos> Ah
<andrewvos> Limechat then. Or irssi. Lasts about -2 months.
<envygeeks> I'd rather stick with irssi personally
<drbrain> dircproxy + * > *
<envygeeks> or if push comes to shove Pidgin/Adium
slyphon joined #ruby-lang
<samuelkadolph> drbrain: I'm using znc + colloquy push for my phone
looopy joined #ruby-lang
<drbrain> (dircproxy | znc) + * > *
<drbrain> :D
Heimidal joined #ruby-lang
<samuelkadolph> lol
<erikh> I just prefer linkinus' ui
<erikh> very easy to use and looks like not-as
<erikh> s
<andrewvos> drbrain: IRSSI!
<j`ey> ^
<andrewvos> drbrain: irssi on an ec2 instance :)
<andrewvos> Even better
<erikh> irssi in screen is the most annoying thing
<drbrain> andrewvos: (dircproxy | znc | ec2) + irssi > irssi
<erikh> haha
<j`ey> erikh: what?!
<andrewvos> drbrain: Yes
<erikh> drbrain: I'm interested to see what your append method is like
<drbrain> but, I think (dircproxy | znc) > ec2
<erikh> * > ec2
<drbrain> dircproxy or znc on ec2 + local IRC is better
<andrewvos> drbrain: How so?
<drbrain> andrewvos: it's easier and more efficient to get IRC running on a random device than a shell
<andrewvos> hmm
<andrewvos> ok :0
lightcap joined #ruby-lang
<andrewvos> :0=:)
<andrewvos> typing one handed
<erikh> that is a man with a very odd top hat
<drbrain> erikh: it's the head of his greatest enemy
<erikh> dark
<erikh> it must be beer:30
uniqanomaly joined #ruby-lang
<drbrain> with SSH I need to type in a huge-ass password or get public keys moved around everywhere
<drbrain> with IRC I connect with a stupid dumb password
<rue> IRC > SSH
<erikh> I think znc can do the oftc cert thingy
<erikh> and sasl if you're feeling masochistic
looopy joined #ruby-lang
kalleth joined #ruby-lang
wyhaines joined #ruby-lang
sulo joined #ruby-lang
magicbeef joined #ruby-lang
magicbeef left #ruby-lang
ryanf_ joined #ruby-lang
imajes joined #ruby-lang
resetexistence joined #ruby-lang
reset joined #ruby-lang
andrewhl joined #ruby-lang
jkyle joined #ruby-lang
yfeldblum joined #ruby-lang
marcostoledo joined #ruby-lang
macmartine joined #ruby-lang
Pip joined #ruby-lang
Pip joined #ruby-lang
<imperator> ffi and solaris, just not getting along :(
<mitchty> heh, solaris is never easy
looopy joined #ruby-lang
sulo joined #ruby-lang
headius joined #ruby-lang
wyhaines joined #ruby-lang
jkyle joined #ruby-lang
looopy joined #ruby-lang
gregmoreno joined #ruby-lang
magicbeef joined #ruby-lang
magicbeef left #ruby-lang
curtism joined #ruby-lang
artOfWar joined #ruby-lang
looopy_ joined #ruby-lang
macmartine joined #ruby-lang
<mitchty> i'm drawing a blank, what was the gem that inserted comments after you feed it stupid simple ruby files with the lines output?
<mitchty> as comments iirc
jkyle joined #ruby-lang
<drbrain> irb ?
jkyle joined #ruby-lang
livinded joined #ruby-lang
<mitchty> https://gist.github.com/1441323 no like that basically, only just throw the comments into the file, and not read on $stdin for example
<mitchty> i thought there was a gem already that basically did that and updated the ruby file with comments after it, it might just be me smoking something though
jkyle joined #ruby-lang
<mitchty> le sigh, i know of irb/pry/repls
<drbrain> this is all I've got
<mitchty> yeah no worries, i'll just make a quick hack
<mitchty> it was just to show my coworkers what each line of an example ruby file did easily, they fear the idea of repls
<imperator> postmodern, you are fucking people's shit up
jimmy1980 joined #ruby-lang
<postmodern> imperator, what?
<steveklabnik> on twitter, i think
<imperator> postmodern, gem dependencies, you broke them
<steveklabnik> ahh, something else ;)
<postmodern> imperator, i yanked rubyzip2
<imperator> like i said
<postmodern> imperator, it was a fork to fix 2 Ruby 1.9 bugs
<imperator> yep
<postmodern> imperator, mainline rubyzip fixed those and is ahead of my fork
<postmodern> imperator, let me unyank
<imperator> yep
<mitchty> drbrain: irb -f --inf-ruby-mode --noprompt --prompt-mode xmp gets close though
<imperator> postmodern, dunno if you can unyank, but man, gotta give people warning
<postmodern> there's a --undo option
<whitequark> any ideas of how to clean pathnames to prevent directory traversal vulnerabilites?
<whitequark> I'm not sure if .sub(%r{[/\\]}, '') is enough
dr0id joined #ruby-lang
<imperator> whitequark, not sure what you mean by "directory traversal vulnerabilities"
<imperator> there's the pathname lib, dunno if that helps you
<whitequark> imperator: http://domain.com/get_file?file=../../../../../etc/passwd
<whitequark> I don't see anything in pathname lib which would help me
srbaker joined #ruby-lang
amerine joined #ruby-lang
<drbrain> whitequark: ignore all relative paths
<drbrain> whitequark: or, add the website root to the user path then ignore if it's not still under the website root
<envygeeks> if I was brave enough to accept something as dangerous as that url I would record my root path and then expand_path the accepted input and compare the starts with starts_with
<envygeeks> or create a glob of accepted files in the folder you want and check against that glob
x0F_ joined #ruby-lang
Kichael joined #ruby-lang
* imperator though chroot calls and/or jails made that sort of crap impossible anyway
<postmodern> imperator, adding significantly annoying post_install_message, to hopefully people will migrate off
rohit joined #ruby-lang
<imperator> postmodern, excellent
<postmodern> imperator, try installing it now
simon_weber joined #ruby-lang
<imperator> postmodern, so, you're saying it's deprecated? :-P
<postmodern> imperator, do you think i should copy/paste those lines some more :)
<postmodern> maybe throw in some ascii art
lightcap joined #ruby-lang
<imperator> add sound
<imperator> and blinking text
wyhaines joined #ruby-lang
<imperator> wyhaines, greetings
<wyhaines> imperator: Evening.
Ruthenium joined #ruby-lang
rane_ joined #ruby-lang
riush joined #ruby-lang
amerine joined #ruby-lang
snikch1 joined #ruby-lang
jkyle joined #ruby-lang
<snikch1> Has anybody encountered issues where the response for http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz is actually just the uncompressed tarball?
<snikch1> I get a content length of 59535360
<imperator> nope
<imperator> you using a standard web browser to retrieve it?
<snikch1> I've had it failing with ruby-build this morning
<snikch1> Chrome on my mac gives me the correct file
<snikch1> wget on my mac got me the correct file
<imperator> what's ruby-build?
<snikch1> but curl is giving me the wrong one
<steveklabnik> imperator: sam stephenson's ruby build scripts
<steveklabnik> basically
<snikch1> It just uses wget
<snikch1> I've found that appending a query string will give me the correct response
rohit left #ruby-lang
<imperator> dunno enough about ruby-build to comment
<snikch1> Two curl calls
<snikch1> both the same except one has a query string on the ruby file
<snikch1> the query stringed one has the correct content-length
<snikch1> the first one, is much larger
<snikch1> and it's actually uncompressed
<imperator> looks like a bash script, not a ruby lib
<snikch1> Yea, that's just me trying to download the Ruby source
jmontross left #ruby-lang
S2kx joined #ruby-lang
diegoviola joined #ruby-lang
<erikh> use ftp
<erikh> works great for e
<erikh> me
<snikch1> yea, except that this is now happening from a gem that needs the ruby source headers or something
<snikch1> so I have no control over the delivery method
<snikch1> it seems like a bug at ruby-lang.org
<erikh> oh, hrm
<erikh> what gem is it?
dgs_ joined #ruby-lang
<imperator> doesn't look like ruby-build is even gemified
<snikch1> linecache19
<snikch1> You can see it grabs the source, and also has a gzip error
<snikch1> there's plenty of examples of people getting that error
<erikh> right
<snikch1> imperator ruby-build is a script to compile ruby for you
<snikch1> use it with rbenv to manage versions
<snikch1> nice and clea
<erikh> I use chef
<snikch1> removes need for rvm
Rakko joined #ruby-lang
<steveklabnik> yes, two tools to replace one, so much simpler. ;)
<steveklabnik> trololololol
<erikh> hehehe
<Rakko> ash nazg durbatul�k
<erikh> I use chef and a very small shell script
<snikch1> more like, two very simple tools that cleanly do exactly what they're suppsoed to
<erikh> that does more or less what both of those tools do
<steveklabnik> sure
<steveklabnik> that's why you were asking for help
<snikch1> rather than one large bloated tool ;)
<steveklabnik> because it works so well.
<erikh> rvm works great
<snikch1> anyway, this is all beside the point
<erikh> I use it for dev
<steveklabnik> truth. <3
<snikch1> I was hoping somebody might have seen issues with ruby-lang.org returning the wrong file
<erikh> snikch1: the short: I don't think anyone in here is equipped or willing to solve your issue
<snikch1> roger that
mksm_ joined #ruby-lang
<erikh> fwiw, rvm is a lousy tool for server deployment.
<erikh> that's not really wayne's fault though, it's just the nature of the beast
<steveklabnik> eh.
<steveklabnik> i use it (via sm) for that too, but i dont think it's as essential as it is for dev
<snikch1> I loved rvm when I started, but I like the slimmed down approach of rvm, since I use bundler for my gems
mksm joined #ruby-lang
<erikh> it's very hard to get working right, especially with multiple rubies.
<erikh> like, n rubies running n rails stacks running n gems
<steveklabnik> i'm not going to get into an argument about this right now
<steveklabnik> :)
<erikh> oh sure. I wasn't trying to start one.
<steveklabnik> and you dont have the time to, since you have to go fix your tool.
<steveklabnik> ;)
<erikh> eh?
<erikh> my shit works great.
<steveklabnik> not you
<snikch1> me
<erikh> ha
<steveklabnik> i'm glad it works most of the time though. i hear some people do have problems with rvm breaking.
<erikh> that said I hacked it together this morning and nobody has used it yet
<imperator> rvm caused me no end of grief, uninstalled it as fast as i could
<erikh> so it's "working great"
artOfWar joined #ruby-lang
<whitequark> drbrain: thanks
<snikch1> thanks to the guys who had a look at my prob
<snikch1> will try find another workaround :D
<erikh> best of luck
<imperator> chef? :-P
<erikh> you might just want to send a patch out
JosephRuby joined #ruby-lang
<erikh> imperator: yeah, I wrote a provider this morning to build rubies
<imperator> patches good
<erikh> then, a small switching tool that works similarly to rvm for the devs
<imperator> erikh, still hoping my former colleague publishes his lib that handles all that stuff
<erikh> (it's literally 10 LOC)
<snikch1> haha, the issue is with the ruby-lang.org ftp server, or somewhere in between there and my house
<erikh> ohsnap
lightcap joined #ruby-lang
<erikh> imperator: i'm all for better approaches, rvm is a hacky tool but it does a pretty good job for my uses
<erikh> imperator: so are you still hell-bent on working on the east coast?
havenn joined #ruby-lang
woollyams joined #ruby-lang
JosephRuby joined #ruby-lang
<mitchty> i've had weird issues where rvm seems to forget i have rubies installed, doesn't work until rvm implode and reinstall
wmoxam joined #ruby-lang
GolF joined #ruby-lang
georgerb joined #ruby-lang
heppy joined #ruby-lang
kitallisii joined #ruby-lang
<imperator> hehe, there's a gem called "awesome"
Sailias joined #ruby-lang
georgerb left #ruby-lang
jimmy1980 joined #ruby-lang
nuclearsandwich joined #ruby-lang
levifig joined #ruby-lang
<imperator> mitchty, got ffi working on solaris...by using a different function call :)
<shevy> hmm
<bnagy> imperator: so you never figured out the issue?
<imperator> bnagy, not really, it's like it's chopping off information; using sysinfo worked around it
<imperator> i could see it using FFI::MemoryPointer, but even there it was getting confused
<imperator> i dunno if it's a glibc issue or what
<imperator> bnagy, btw, work on those example programs?
<bnagy> I've been doing zeromq
<bnagy> I just need to improve the comments, right?
<imperator> bnagy, i would remove the relative requires
<imperator> and add an "examples" namespace, plus tasks, to the Rakefile
<imperator> er, relative requires in the examples code
<imperator> i can take care of that tomorrow if you like
<imperator> but yes, definitely add some comments if you don't mind :)
ksinkar joined #ruby-lang
<imperator> shevy, yeah, coulnd't get structs to work as expected; resorted to using sysinfo + flag
<imperator> that worked
levifig joined #ruby-lang
marting joined #ruby-lang
mgingras joined #ruby-lang
yxhuvud joined #ruby-lang
mgingras left #ruby-lang
imperator left #ruby-lang
fridim_ joined #ruby-lang
resetexistence joined #ruby-lang
replore joined #ruby-lang
solars joined #ruby-lang
agib joined #ruby-lang
<agib> will FileUtils.cp overwrite the destination?
<Asher> believe so
<Asher> try it
<agib> :)
<shevy> agib yes
<agib> good call
<agib> thank you
<shevy> hmm speeeeed tricks for ruby
<shevy> @var = "local variable, which is cached by Ruby, and requires a single lookup"
<shevy> self.var = "requires walking the AST, and results in multiple lookups"
<shevy> hmmm
<shevy> ----
<shevy> puts "This string embeds #{var1} and #{var2} through interpolation" # faster
<shevy> puts "This string concatenates " << var1 << " and " << var 2 # slower
<shevy>
<Rakko> I thought Symbol#to_proc was fixed to be fast in 1.9
<Rakko> #6 is the most important
<shevy> Rakko no idea yet
<shevy> I am writing some benchmarks and then a file that runs all those benchmarks
<Rakko> oh, yeah... says so in the comments
RomyEatsDrupal joined #ruby-lang
srbaker joined #ruby-lang
Austin__ left #ruby-lang
chris2 joined #ruby-lang
michael_mbp joined #ruby-lang
scottschecter joined #ruby-lang
ankurgel joined #ruby-lang
<whitequark> shevy: no it does not require walking the AST
<whitequark> it did in 1.8, which has ast-walked everything
<whitequark> and it does not in 1.9, which compiles to bytecode
<whitequark> method invocation is still slightly slower than ivar lookup, through
<whitequark> the interpolation/concatenation variants produce almost identical bytecode, so no point in #2 either
<whitequark> *#3
<whitequark> and #5 is fixed, yes
<whitequark> so that's pretty outdated
<drbrain> method invocation on 1.9 is so much improved that there's very little difference between attr_accessor :foo and def foo; @foo; end
<drbrain> it was under 20% when I last tested in 1.9.2
<drbrain> … IIRC
<yxhuvud> interesting.
<Rakko> uh, I thought attr_accessor just defined a foo just like that, drbrain
<drbrain> Rakko: no, it cheats
<Rakko> oh, cool
<drbrain> Rakko: it doesn't do any setup for method dispatch
<drbrain> you can see the cheating better in 1.8 where it's 0.9s vs 1.4s
JohnBat26 joined #ruby-lang
<Rakko> ok
kmeehl joined #ruby-lang
ryanf joined #ruby-lang
<drbrain> oh, my new machine is a lot faster than that old benchmark, I ran 10 million iterations
RomyEatsDrupal joined #ruby-lang
<shevy> drbrain you speed junkie :P
<shevy> though I have to say, fast computers are pretty cheap these days
<wmoxam> ou'd say the same in 1990 if you had bought PCs through the 80s
heftig joined #ruby-lang
<drbrain> you'd say the same thing in the 2020s if you buy PCs through the 2010s
<wmoxam> exactly
<wmoxam> I just try to not buy computers
<wmoxam> :P
<erikh> I farted in 1980
<Rakko> congrats
<erikh> actually I have the hackintosh here which is really nice
<erikh> 512GB ssd, i7 with hyperthreading, 16GB ram
<erikh> pretty much complete overkill
<shevy> wmoxam dunno, compiling from source is really fast on my current machine
<shevy> 16Gig RAM?!?
<erikh> cost me $100
<erikh> pc hardware is cheeeeaaaaap right now
<wmoxam> shevy: it's just faster, as it has been with each new generation of machine
<drbrain> read an article the other day about how (in part) the iPad crush RAM prices
<shevy> the time from 2003-2006 sucked
<drbrain> crushed
<drbrain> than combined with the Windows flop
<erikh> actually, I bought it by accident
<erikh> I saw the modules on newegg and thought they were hte ones I bought before for a gaming pc (8GB total), and bought two of them
<erikh> turns out I missed the size and they were the same price
<erikh> ($50 apiece)
<wmoxam> man, the first RAM I bought was 8MB, and it cost $80
<erikh> I bought 1MB of push ram for my first build
<wmoxam> heh
<erikh> I traded a bicycle for it
<erikh> I had a paper route and paid for my BBS that way.
<shevy> hmm
<shevy> "will code for a bicycle"
<erikh> meeeeemories
<erikh> I've been up since 6am
<erikh> time for bed. night all!
<Rakko> night
<shevy> hmm question
<shevy> p "hello 2011!".match(/(?<year>\d+)/)[:year] # => "2011"
<shevy> what is the "?" meaning there?
jayne joined #ruby-lang
<Rakko> I somehow convinced my dad to buy me some number of megabytes and then find someone to buy the amount I already had
Pip joined #ruby-lang
<Rakko> nowadays I just chuck old memory in a Solo cup... not worth selling
<Rakko> shevy: it's a named capture
<shevy> ah
<shevy> it is part of the <> thing ?
<Rakko> yeah
<shevy> ok thanks
<shevy> I thought the <> was enough
<shevy> hmm
<shevy> f = -> a,b { p [a,b] }
<shevy> looks very odd :\
<Rakko> I hate ->
Neil joined #ruby-lang
<shevy> yeah it's odd
<Asher> what is -> ?
<shevy> as long as I can avoid it myself I don't mind too much
<Rakko> new syntax for lambda
<shevy> Asher, a "stabby proc" (I like that name)
<shevy> f = -> a,b { p [a,b] }
<shevy> p f.call(1,2) # => [1, 2]
<Rakko> it makes more sense in coffeescript
<shevy> ok... I absolutely hate "var = ->"
<shevy> how is it used in coffeescript?
<Asher> omg that's ugly
<Rakko> coffeescript: square = (x) -> x * x
<Rakko> where the arrow *points at* the definition of the function
<shevy> hmm
takaokouji joined #ruby-lang
<shevy> yeah Asher
<shevy> === ->
<shevy> I wonder if that would be valid syntax
<Rakko> heh
takaokouji joined #ruby-lang
Pip_ joined #ruby-lang
dc5ala joined #ruby-lang
singpolyma joined #ruby-lang
solars joined #ruby-lang
gnufied joined #ruby-lang
jimmy1980 joined #ruby-lang
brianpWins joined #ruby-lang
yorickpeterse joined #ruby-lang
molgrew joined #ruby-lang
towski joined #ruby-lang
levifig joined #ruby-lang
heppy joined #ruby-lang
Manhose joined #ruby-lang
RomyEatsDrupal joined #ruby-lang
RomyEatsDrupal_ joined #ruby-lang
RomyEatsDrupal joined #ruby-lang
resetexistence joined #ruby-lang
jasox joined #ruby-lang
srbaker joined #ruby-lang
cyri_ joined #ruby-lang
towski joined #ruby-lang
Manhose_ joined #ruby-lang
thrcka joined #ruby-lang
workmad3 joined #ruby-lang
jimmy1980 joined #ruby-lang
Pip joined #ruby-lang
adambeynon joined #ruby-lang
empity joined #ruby-lang
adambeynon joined #ruby-lang
zmack joined #ruby-lang
towski joined #ruby-lang
michael_mbp joined #ruby-lang
S1kx joined #ruby-lang
S1kx joined #ruby-lang
Manhose joined #ruby-lang
jsaak joined #ruby-lang
benanne joined #ruby-lang
mytrile joined #ruby-lang
Diaoer joined #ruby-lang
Diaoer joined #ruby-lang
Diaoer left #ruby-lang
roadkith joined #ruby-lang
dwo joined #ruby-lang
Pip joined #ruby-lang
RomD joined #ruby-lang
gnufied1 joined #ruby-lang
Pip joined #ruby-lang
Pip joined #ruby-lang
saLOUt joined #ruby-lang
<shevy> "[...] we both agreed that Ruby's blocks are amazing design but for many reasons don't work that well in Python in its current design."
<roadkith> whats "the direction python is heading"?
<shevy> not sure
<shevy> but I think other languages can learn from that
<shevy> the python2 to python3 transition seems to be more pain than ruby 1.8 to 1.9 transition
<shevy> "Obviously the big change in Python 3 is how Unicode is being handled. While it appears that forcing Unicode on everybody is great, it's also a very unrealistic view of the world."
<shevy> Hah!
<shevy> Encodings!
<shevy> take that lianj !!!
<shevy> :P
<roadkith> In fact if you go back in time and look at some of the first versions of Python it's a very, very ugly language and it does not come as a surprise that not too many people took notice of Python in the early days. <--hahaha :D
<shevy> well actually...
<shevy> perl5 to perl6 also seems to have many people who don't want to switch to perl6
<shevy> I had a perl developer say that. He continues to contribute to the perl 5 codebase and just does not care about perl 6 at all. He said it was like a different language (for him)
<roadkith> oh there will always be those ppl that condemn new technology as evil :D
<shevy> roadkith I often wonder what early ruby looked like :)
<roadkith> anyone who doesnt care for future technology is going to not cut it anymore at some point :D
<shevy> hehe
x0F_ joined #ruby-lang
solars joined #ruby-lang
<yango> http://pastie.org/2980123 <-- I'm having a problem with def initialize(*params) idiom
<yango> and I guess I've understood it :)
geoffw8_ joined #ruby-lang
<yango> I need shift instead of pop
Kanolesic joined #ruby-lang
io_syl joined #ruby-lang
ankurgel joined #ruby-lang
io_syl joined #ruby-lang
jasox joined #ruby-lang
flip_digits joined #ruby-lang
cynosure joined #ruby-lang
Wardrop_ joined #ruby-lang
<Wardrop_> Why doesn't the following work (complains about "no block given"), and how do I "yield" work in the context of a proc?
<Wardrop_> proc { yield }.call { puts 'block called' }
<Wardrop_> This is essentially the same thing, but it does work:
<Wardrop_> proc { |&y| y.call }.call { puts 'block called' }
<Tasser> Wardrop_, no, it isn't. Looks like #call doesn't pass blocks implictly...
<yango> can I supply two blocks to a method?
<Wardrop_> I thought it may have been a binding issue, but you think it may be the behaviour of the #call method
<Tasser> yango, as variables, not as implicit blocks
<Tasser> Wardrop_, yep, I'd guess so
<yango> method(a,b) where a = begin blah() end ?
<Tasser> yango, begin/end doesn't construct blocks
<steveklabnik> yango: you can not supply two blocks to a method
<steveklabnik> you can supply a block and 0*N procs
<steveklabnik> though
<Wardrop_> yango: Can you think of any other way I could call the block to make "yield" work as expected.
RomyEatsDrupal joined #ruby-lang
<Tasser> Wardrop_, no idea, I'd use the |&y| because it works. probably goto stackoverflow :-)
<Wardrop_> The problem is, this is for a DSL, so "yield" is a much nicer idiom than requiring users to capture the given block, etc.
<steveklabnik> Wardrop_: what happens if you do/end on the second one
<Wardrop_> Same thing
<steveklabnik> okay
<Wardrop_> It's not a syntax issue
<steveklabnik> on rbx-head, that code works
<steveklabnik> blocks and {} have differnet precidence
<Tasser> steveklabnik, file a bug then ;-)
<Wardrop_> oh ok
<steveklabnik> on 1.9.3, that code works
<Tasser> steveklabnik, on jruby (1.8) it's got the mri behaviour
<steveklabnik> Wardrop_: what ruby are you using?
<steveklabnik> oh wait
<Wardrop_> 1.9.3
<Tasser> ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
<steveklabnik> i copied the one with the &
<steveklabnik> derp.
<steveklabnik> sorry, i just woke up
<Tasser> steveklabnik, :-P
<Wardrop_> lol
<Wardrop_> I did that when I tried do … end; I thought it worked for 5 seconds there.
<steveklabnik> my morning brain still feels like this is a parsing issue
<steveklabnik> The catch - implicitly invoking a block from within another block does not work
<heftig> yield is associated with methods.
<heftig> procs don't have that "invisible" proc variable
<heftig> s/proc variable/block variable/
krz joined #ruby-lang
<Wardrop_> I'm sure I've seen DSL which seem to make this work.
<Wardrop_> Unless they were using #define_method
Guest35080 joined #ruby-lang
mksm joined #ruby-lang
jensn joined #ruby-lang
JosephRuby joined #ruby-lang
<JosephRuby> anyone step a unix noob thru getting gnome2/gtk2 installed w/ rvm on ubuntu?
<JosephRuby> or have a good link?
<JosephRuby> I am drawing blanks on google :(
mark_locklear joined #ruby-lang
malev joined #ruby-lang
KU0N joined #ruby-lang
<KU0N> hello
<KU0N> I've been googling for a bit now, but I can't find how to call a method with current bindings. like def foo; puts a;end a = 4; foo ; #which should print 4
Pip joined #ruby-lang
Natch| joined #ruby-lang
<steveklabnik> KU0N: you'd have to pass the binding in.
<steveklabnik> JosephRuby: telling us your errors (in pastie) would help
<KU0N> steveklabnik: yea, but how?
<steveklabnik> KU0N: one second, lemme whip up an example
<KU0N> steveklabnik: thanks a lot. I've been hitting the wall for a while now.
<shevy> KU0N so that was that odd noise in the other house!
<KU0N> shevy: yea
<roadkith> guys does something like "#{foo #{bar}}" look fucked up or is it okay?
<steveklabnik> that wont even work.
<steveklabnik> or does it?
<steveklabnik> that's crazy
<roadkith> it does
<steveklabnik> i would -1 you on code review. honestly
<steveklabnik> just "#{foo} #{bar}"
<steveklabnik> much clearer.
<roadkith> no
<roadkith> hmmm
<steveklabnik> KU0N: that gist was for you, btw
<roadkith> well... okay :D
<shevy> roadkith every time I see code like this I have to kill a kitten
<shevy> why do you want to make me sad roadkith, why :(
<roadkith> nono dont kill a kitten
<KU0N> steveklabnik: yea thanks, that's what I feared
<roadkith> i'm already changing it
<shevy> though I have never seen it before actually
Natch| joined #ruby-lang
<steveklabnik> KU0N: i just puts-ed another version that's a little simpler
<steveklabnik> err, re-pasted. whatever. you get the idea.
<shevy> one day I should make some #{voo{-> lala()}} thing with the stabby proc
<KU0N> steveklabnik: not really practical, if I want to use the binding, it's because I have a gazillion variable (math algorithm)
<steveklabnik> ahhh.
<steveklabnik> i'm toying around with a thing
<steveklabnik> gimme a few minutes, and no garuntees, as i'm still waking up ;)
<erikh> I am too
<KU0N> I have things like a = a * b - c + d, and some of them are reapeating a lot
<roadkith> why didnt i think of it myself?
<erikh> just don't do it in public. pro tip.
<KU0N> so I'd like to do things like do_the_thing_to_a
<KU0N> and it should be replaced like a C macro
<roadkith> why does my brain make up something like "#{ #{}}" instead "#{}" + "#{}"?
<KU0N> I know it's not "ruby like"
<roadkith> the first one is so not natural
<roadkith> am i weird?
<KU0N> but if I design it object oriented, it would require a lot of classes and makes everything less readable in mathematical sense
<KU0N> I could use instance variable in 1 big class, but having to prefix all the variable with @ renders the thing hard to read for the math guys
jasox joined #ruby-lang
<steveklabnik> got it
<steveklabnik> seriuosly, this is a terrible idea
<steveklabnik> my ethics wouldnt be so loose if it wasn't so early. ;)
<erikh> :)
<steveklabnik> i'd tell you it wasn't possible.
<KU0N> yea I think it's a terrible idea too
<steveklabnik> this is one of those things where 'if you cant write it yourself, you shouldnt be doing it'
<erikh> hell
<erikh> if you can write it yourself, you should have the common sense not to
<steveklabnik> that too
<erikh> or the wisdom. you pick.
<erikh> now it's time to turn on some sweet slow jams and start writing awesome for the day
<yango> http://pastie.org/2980422 I'd like to let the caller to provide do_a and do_b
<shevy> roadkith dunno, sometimes when I write code, I don't think. When I am not in front of the computer though, I think much better suddenly
<yango> how to do so?
<KU0N> I'll try to figure out another solution
<roadkith> shevy: same here
<steveklabnik> yango: one second
<KU0N> steveklabnik: thanks a lot for the help. At least you convinced me not to do it this way
<JosephRuby> steveklabnik: my error is that I don't have gtk2 installed, which I need for a project, Ive googled rvm + gtk2 and everything that comes up is other people asking the same question w/o results.
<shevy> hehe
<shevy> JosephRuby ruby-gtk works
<shevy> but perhaps people should consider stop using rvm
TvL2386 joined #ruby-lang
<steveklabnik> yango: http://pastie.org/2980431
<steveklabnik> JosephRuby: that doesnt help. i need like a real error.
<steveklabnik> ruby-gtk works fine with rvm, at least for me, in the past.
<steveklabnik> KU0N: :)
<steveklabnik> KU0N: terrible things are still fun to figure out.
<steveklabnik> yango: i left off a ) in my example call, you get the idea
<yango> steveklabnik: I have to nil check in case the caller provides nil?
<yango> I mean send(nil, item) will raise?
<steveklabnik> i'm not sure
<steveklabnik> id assume so
<steveklabnik> dont nil check
<steveklabnik> just set them as default args
<steveklabnik> meth_one = :do_stuff, meth_two = :do_stuff_two
<erikh> 1.8.7 :001 > send(nil)
<erikh> TypeError: nil is not a symbol
<erikh> 1.9 is the same
<yango> oh, that's another question I have. How are all those << and > operators called?
<yango> I want to read about them
<erikh> wakkas
<erikh> it's more fun than chevron
<erikh> "so I used left wakka wakka to append to a string"
<steveklabnik> KU0N: becasue it's the morning, i forgot about this:
<steveklabnik> KU0N: the block form _already_ caputures the binding.
Spooner joined #ruby-lang
tommyvyo joined #ruby-lang
<yango> googling for wakka ruby does not give you nice results
<erikh> I don't dispense help, just jokes
<steveklabnik> yango: i hear people call << 'shovel'
<steveklabnik> and nobody uses >>
<steveklabnik> ;)
<yango> I supposed so, but I was explaining that the results were a more disappointing that just unhelpful
<shevy> wakka ruby?
<shevy> what is that
<shevy> shakira coding in ruby?
<yango> google for it and watch the videos :6
<erikh> heh
<KU0N> steveklabnik: ha yea
Natch| joined #ruby-lang
<erikh> that's what you get for watching videos about a programming language instead of reading about it :)
<yango> nope, they weren't about a programming language
<yango> they were about people called ruby dancing the waka waka
<erikh> ok now I'm interested
<erikh> haha this is awesome
<shevy> wtf
<shevy> erikh is dancing like crazy there
ankurgel joined #ruby-lang
<erikh> heh yes
jensn_ joined #ruby-lang
yfeldblum joined #ruby-lang
<erikh> when you serve my drink please stick it in the fridge
<muzone> lol
<muzone> the same girl, 15 years later: http://www.youtube.com/watch?v=97PR4gtisjw
<yango> now things get interesting: what if I want people to be able to yield from do_a? steveklabnik
<steveklabnik> i am not awake enough to properly consider that without some code ;)
<yango> http://pastie.org/2980533 <-- of course not working, but the idea is to be able to do that
<yango> I would like :do_a and :do_b to be selectors of the items the user is interested in. So a yield for the interesting items looks like a right thing to try
<erikh> root.items.compact.each(&:call)
<erikh> actually
<erikh> root.items.compact.each(&:to_proc).each(&:call)
<erikh> meh, change the first each to a map
<erikh> it's early.
<steveklabnik> welll
<steveklabnik> the first thing is that you approach is kinda bad.
<steveklabnik> i'd just make a custom Enumerator
Manhose joined #ruby-lang
<yango> and that is user customizable how?
<steveklabnik> but secondly, yeah, this is hurting my brain a biiiit too much right now
<steveklabnik> well, you make a factory method
<steveklabnik> lemme pastie
<erikh> that recursion will explode
<steveklabnik> oh?
<steveklabnik> http://pastie.org/2980546 <-
<steveklabnik> would be the general form.
<erikh> it won't take very large arrays to get that to explode
<erikh> also it'll blow up first hit because there's no defaulted arguments
<yango> steveklabnik: you aren't using selector anywhere
<erikh> but that's trivial to fix
<yango> erikh: it's currently working for small arrays
<erikh> horseshit
<steveklabnik> yango: yeah, just giving you a start. you can then use selector inside the enumerator.new call
<erikh> anyhow, gone
<yango> erikh: okay, but it is...
<erikh> you have an arity mismatch
<yango> erikh: depends on where
<yango> steveklabnik: okay
<erikh> you never hit the second block and you're on 1.9 then
<erikh> anyhow, I need to get work done
<erikh> err, 1.8
robbrit joined #ruby-lang
sepp2k joined #ruby-lang
wyhaines joined #ruby-lang
<yango> I am in 1.8 indeed, where is the arity mismatch?
tommyvyo joined #ruby-lang
mksm joined #ruby-lang
Manhose_ joined #ruby-lang
Manhose__ joined #ruby-lang
dRbiG left #ruby-lang
Natch| joined #ruby-lang
<erikh> in your call to iterate()
Manhose_ joined #ruby-lang
dRbiG joined #ruby-lang
<jtoy> whats a nicer way to create a string of x 1k times? i do this now: (1...1000).collect{|x| "hi " }.join(" ")
mdel joined #ruby-lang
<steveklabnik> "x * 1000
<steveklabnik> "x " * 1000
<steveklabnik> really
<shevy> hehe
<jtoy> cool
<jtoy> reakky?
<jtoy> really?
<erikh> yep
<shevy> jtoy also you should use irb
<erikh> there's an off by one in that range too I think
<jtoy> shevy: i do, i meant "what was meant by really earlier", not "does that really work"
<steveklabnik> i didnt notice your example had a space
<steveklabnik> and i'm still finishing cup of coffee #1
<jtoy> ic
<jtoy> i practically live in irb all day long
workmad3 joined #ruby-lang
tomzx joined #ruby-lang
Manhose__ joined #ruby-lang
<andrewvos> jtoy: That's nice. I live in HELL
jensn joined #ruby-lang
<workmad3> andrewvos: sounds nice and warm
aleksi joined #ruby-lang
<jtoy> andrewvos: how so? java?
Austin__ joined #ruby-lang
boodle joined #ruby-lang
<aleksi> Hello. Why "a = a", where "a" is undefined, is a valid Ruby code?
<Austin__> It's a bit of a parsing behaviour that's held over for years.
slyphon joined #ruby-lang
<yango> is that the only place where autovivification occur¡s?
<Austin__> Sort of.
<Austin__> in irb, type: b = a
<Austin__> then b
<yango> yes b is nil
<Austin__> you'll see that b is nil.
<Austin__> so it's not that a = a is special, but that assignment is special.
<workmad3> 'a = ...' defines a
<yango> but defines it to an undefined value
<yango> it could perfectly error out
<workmad3> yango: it defines a and defaults it to nil
<workmad3> but yes, things can then error out in the ... and leave a as nil :)
saLOUt joined #ruby-lang
thrcka joined #ruby-lang
<aleksi> thanks!
outoftime joined #ruby-lang
Manhose joined #ruby-lang
Manhose_ joined #ruby-lang
MistyM joined #ruby-lang
duckinator joined #ruby-lang
rippa joined #ruby-lang
<yango> http://pastie.org/2980838 <--- I don't mind entering an infinite loop, I just want that if an exception is raised, to retry (done is initted above). I'm sure this can be written in better Ruby
dnjaramba joined #ruby-lang
<workmad3> yango: you mean maybe with 'until done' ?
<yango> okay, okay
<yango> but I'm looking for more deep improvements :)
<yango> yes, and that's deeper, not more deep
<yango> :)
<workmad3> yango: well, you can pull some parts out... you start off with 'done=false' before the loop, right?
<yango> yes
<workmad3> yango: then you don't need to set it to false again in the rescu
<yango> ideally, I'd like to abstract this construct to put whatever Proc I want in it to be retried
wyhaines_ joined #ruby-lang
niklasb joined #ruby-lang
stepnem joined #ruby-lang
Manhose joined #ruby-lang
imajes joined #ruby-lang
jkyle joined #ruby-lang
macmartine joined #ruby-lang
cristian joined #ruby-lang
leonL joined #ruby-lang
niklasb_ joined #ruby-lang
shevy joined #ruby-lang
kmeehl joined #ruby-lang
RomD` joined #ruby-lang
<shevy> hmm
andrewhl joined #ruby-lang
Silowyi joined #ruby-lang
<rue> yango: How about retry?
<rue> def foo; yield; rescue Blah; retry if meh; end
arooni-mobile joined #ruby-lang
<rue> Unless you have some external condition, though, you'll still need a counter or something for the retry
kmeehl joined #ruby-lang
arooni-mobile joined #ruby-lang
heppy joined #ruby-lang
retro|cz joined #ruby-lang
oilpastels joined #ruby-lang
KU0N joined #ruby-lang
looopy joined #ruby-lang
slyphon joined #ruby-lang
nofxx joined #ruby-lang
<andrewvos> jtoy: No, php :)
petercooper joined #ruby-lang
workmad3 joined #ruby-lang
srbaker joined #ruby-lang
beiter joined #ruby-lang
<yango> rue: total ruby newbie, so not familiar with many idioms/libs
kitallisii joined #ruby-lang
<erikh> while yield
<erikh> return nil to stop the loop
<erikh> (or false, I suppose)
<erikh> the only advantage I see over the exception based approach is that you're not using exceptions for flow control
<erikh> depending on who you talk to, that matters
<yango> I want it to retry until it either succeeds or the process dies
<erikh> while !yield
<erikh> :P
<erikh> anyhow, there are some options there
<erikh> use what you think is best
<rue> erikh: That assumes you've control over what the block returns
Dreamer3 joined #ruby-lang
<rue> Which would probably be a reasonable assumption
<rue> yango: How do you know if the “process dies”?
<rue> I've not followed far up if you mentioned that before
<rue> Generally, def retry_until_success; yield; rescue WhateverError; retry; end
Z3RO_ joined #ruby-lang
<rue> If you're dealing with exceptions, that is, not return values
<yango> rue: the process itself doesn't know
<yango> it's actually an infinite loop if it always fails
<petercooper> Thank you Mario, but our process is in another server!
slyphon joined #ruby-lang
robbyoconnor joined #ruby-lang
Z3RO_ left #ruby-lang
<rue> You're-a welcome-a!
nofxx joined #ruby-lang
io_syl joined #ruby-lang
headius joined #ruby-lang
kmeehl joined #ruby-lang
thone joined #ruby-lang
yorickpeterse joined #ruby-lang
solars joined #ruby-lang
rushed joined #ruby-lang
robbyoconnor joined #ruby-lang
<shevy> rue.drunk? # => true
<shevy> sad :(
<rue> Oops, you raised an error
lightcap joined #ruby-lang
kain joined #ruby-lang
vikoren joined #ruby-lang
fra000 joined #ruby-lang
spyvrsspy joined #ruby-lang
<spyvrsspy> how do i convert login_time to a unix time stamp
<deryldoucette> spyvrsspy: see the 3 urls I gave you
<spyvrsspy> "Dec 7 08:57:16"
<spyvrsspy> its not taking the string though, with Time.new
mrsolo joined #ruby-lang
<deryldoucette> 1.9.2p290 :002 > @date = Time.new => 2011-12-07 12:41:22 -0500
<deryldoucette> 1.9.2p290 :003 > @date.to_i
nuclearsandwich joined #ruby-lang
<deryldoucette> => 1323279682
<shevy> hmm
<shevy> first time I saw Time.new.to_i I think :)
<deryldoucette> a unix timestamp is just the number of seconds since epoch. which is found by converting to_i
<spyvrsspy> i need to get the string "Dec 7 08:57:16" into a workable format first no?
<deryldoucette> spyvrsspy: take the OBJECT (variable) holding it and convert
<deryldoucette> see hwo i put it into @date and then ran .to_i onit?
<deryldoucette> don't take the physical string because its a string.
amerine joined #ruby-lang
<deryldoucette> the rails timestamp objects will let you to_i them. and thats what you're doing in what you pasted into #rubyonrails
<spyvrsspy> so, in that pastebin is login_time an object?
<spyvrsspy> everything in ruby is an object right?
naz joined #ruby-lang
<yango> can you tell if a method has been called with a block?
<rippa> yes
<deryldoucette> to convert a string, see this snippet: http://snipplr.com/view/47615/
<yango> how? I want to yield only if I have a block
<rippa> yango: Kernel#block_given?
<deryldoucette> spyvrsspy: and then see http://snipplr.com/view/48552/ for how to convert a a Datestamp as well
<deryldoucette> that gives you 3 different ways to convert 3 different ways of storing a date
butchanton joined #ruby-lang
<yango> and can I disable output buffering on a ruby script?
<yango> that is, automatic $stdout.flush
<yango> after each write
fridim_ joined #ruby-lang
leopard_me joined #ruby-lang
hhatch joined #ruby-lang
<spyvrsspy> deryldoucette, okay, i understand now whats going on
livinded joined #ruby-lang
<spyvrsspy> but in the script itself, when I run it I get na error
heppy joined #ruby-lang
<spyvrsspy> -
<spyvrsspy> that works as expected, but when I do the same thing in the script, I get an error as follows:
towski joined #ruby-lang
Pupeno joined #ruby-lang
scottschecter joined #ruby-lang
solars joined #ruby-lang
<MistyM> Probably not related, but I notice your script is running in a different version of Ruby than the irb session.
<spyvrsspy> ya, i installed ruby from the ubuntu rebo
<spyvrsspy> repo*
<spyvrsspy> need to update it
brianpWins joined #ruby-lang
towski joined #ruby-lang
<spyvrsspy> i dont think login_time is a time object though at the point I try to parse it?
<spyvrsspy> thats the full script
<MistyM> Aha! It's a MatchData object, not a string.
<MistyM> You can #to_s it to get the matched string.
singpolyma joined #ruby-lang
<spyvrsspy> lol
<spyvrsspy> cool awesome thanks
Pupeno- joined #ruby-lang
benanne joined #ruby-lang
<shevy> MistyM, how long have you been using Ruby?
<MistyM> shevy: Since, like... April? I guess?
<shevy> whoa
<shevy> that's not that long
<spyvrsspy> ruby is tough
<spyvrsspy> I just started less then a month ago
<MistyM> Yeah, I feel like I've been learning pretty quickly. Ruby's my first "real" programming language.
<rippa> as opposed to what?
<MistyM> I dabbled in QBasic as a kid? :b
<shevy> :(
<MistyM> I did a little bit of Photoshop scripting and (ugh) AutoIt, but I approached them just from the angle of doing specific tasks, so I muddled through the syntax without really getting an understanding of a lot of what I was doing.
<shevy> I started with perl, then PHP ... and even after all the years in Ruby, I am just barely better than newcomers
<rippa> MistyM: I did Spectrum BASIC a bit as a kid
<rippa> BASIC is cool as a first language
<rippa> Pascal too
<MistyM> shevy: If you grok perl, I don't think you have to worry about your coding bona fides. ;)
<MistyM> rippa: Yeah, it was great that computers actually came with something kids could get started with back in The Day.
<rippa> I also tried assembler
<rippa> but it was too hard
<rippa> for 7 y.o. me
saysjonathan joined #ruby-lang
<yango> as they say, you can have either ten years of experience or one year of experience relived 10 times
<MistyM> rippa: I think asm is beyond most 7 year olds!
<shevy> hmm
<shevy> I think the better language makes it easier to learn and understand
<rippa> MistyM: I only managed to copy several programs and output something on screen
cynosure joined #ruby-lang
sepp2k1 joined #ruby-lang
<rippa> *copy from book by hand
heppy joined #ruby-lang
butchanton joined #ruby-lang
<Caius> https://gist.github.com/1443973 <- From my understanding of the method dispatching in ruby, I'd expect that to throw two NoMethodErrors. Any ideas why it doesn't?
leonL joined #ruby-lang
ttilley joined #ruby-lang
<Caius> nm, remembered about eigenclass of class being a super
<Caius> and it makes sense
solars joined #ruby-lang
rayners joined #ruby-lang
<shevy> hehe
<shevy> I so hate the word eigenclass
Defusal joined #ruby-lang
ttilley joined #ruby-lang
heftig joined #ruby-lang
geoffw8_ joined #ruby-lang
lightcap joined #ruby-lang
slackstation joined #ruby-lang
shivamib joined #ruby-lang
Weems joined #ruby-lang
<workmad3> shivamib: what do you have against eigenclasses?
<workmad3> shevy: ^^
<workmad3> (tab-complete #fail)
<shevy> workmad3 the word "eigen", it means self in german
<shevy> so its always selfclass
<shevy> so if I translate Caius ... he said ... "eigenclass of class being a super"
<shevy> wtf :D
<shevy> sorry
<shevy> "selfclass of class being a super"
<shivamib> heh
<workmad3> shevy: in a way, it makes sense though :)
<workmad3> shevy: and it's certainly less confusing than singleton class
<shevy> singleton exists only once or?
<shevy> a singleton class could have an eigenclass or?
<workmad3> shevy: singleton class is another term (the one actually in ruby now, annoyingly) for eigenclass
<shevy> oh man
<workmad3> shevy: some_object.singleton_class
<workmad3> that gives you the eigenclass
<shevy> can't I do object.eigenclass_class
<shevy> well ok
<shevy> still on 1.8.7 here :\
<workmad3> shevy: I suppose you could alias singleton_class to eigenclass
hahuang65 joined #ruby-lang
<shevy> what is some_object.singleton_class returning?
<workmad3> shevy: it's the same as doing class << some_object; self; end
<shevy> you know what we need
<shevy> a simplified ruby for kids
<shevy> Alan Kay should have promoted that, rather than smalltalk :)
<workmad3> heh
<shevy> hmm
<shevy> "object.singleton_class" is the same as "class << some_object; self; end" ?
<shevy> oh wait
<shevy> "object.singleton_class" is the same as "class << object; self; end" ?
<shevy> sorry, I had to get rid of "some_"
<workmad3> shevy: yeah :)
<shevy> hmm
<shevy> interesting
<shevy> it actually is more readable to my old eyes
looopy_ joined #ruby-lang
darkf joined #ruby-lang
queequeg1 joined #ruby-lang
nuclearsandwich joined #ruby-lang
Pip_ joined #ruby-lang
Pip_ joined #ruby-lang
lightcap joined #ruby-lang
jasox joined #ruby-lang
jmontross joined #ruby-lang
imperator joined #ruby-lang
workmad3 joined #ruby-lang
lsegal joined #ruby-lang
retro|cz joined #ruby-lang
robbrit joined #ruby-lang
sodani joined #ruby-lang
<sodani> if I have a Nokogiri::XML::Element, that contains a particular attribute, which is {name = "id", value = "bar" }, does anyone know how I can pull out the value?
<steveklabnik> []
<rue> elem[:value], in particular. I never remember if it only accepts symbols or if I'm cargo-culting that
<steveklabnik> it's not very much like a hash
<steveklabnik> i tried to use #fetch the other day, didnt work, i was bummed.
<rue> Also, it's not *actually* called value, is it? :/
<sodani> in the Nokogiri::XML::Element object, it's called value
macmartine joined #ruby-lang
<sodani> in the html it looks like id="bar"
<steveklabnik> right
<steveklabnik> so it's [:id]
<steveklabnik> then.
<sodani> hmm, but [:id] is returning nil
<steveklabnik> "id"
<steveklabnik> ?
<sodani> same thing
<sodani> actually [] works but only for the child element
<sodani> not decendents
<rue> Well, maybe they don't have the attribute?
<steveklabnik> right.
<sodani> not sure if I'm following. I can see that there's a decendent attribute named "id"
solars joined #ruby-lang
<sodani> in the output
<rue> I'm not sure what that means. What's the XML look like?
michael_mbp joined #ruby-lang
geoffw8_ joined #ruby-lang
fenicks joined #ruby-lang
nofxx joined #ruby-lang
<rue> sodani: That's not the XML ;) But based on that, it seems that the only element that has an id is the a
gregmoreno joined #ruby-lang
<sodani> rue: ah okay. so I guess I have to access the "id" through the "a"
<rue> Not so much through as in
<rue> It's an attribute of that element
<sodani> I thought that maybe there was a way to search the entire document for the attribute called id
<steveklabnik> sure
<steveklabnik> xpath would be /*[@attribute='id']
<steveklabnik> for example
<steveklabnik> * is very poor performance though
<sodani> oh, sometimes it misses?
<steveklabnik> err
<rue> Also, you'll probably want a *certain* id usually
<steveklabnik> //*[@attribute
workmad3 joined #ruby-lang
<sodani> yes, in this case, I'm looking for just the value of the id. //*[@attribute="id"] doesn't seem to work for me but at_css('a')[:id] does
curtism joined #ruby-lang
solars joined #ruby-lang
outoftime joined #ruby-lang
<sodani> question: how do I get better understanding of this type of stuff. read more about xml and xpath?
<steveklabnik> yep.
<steveklabnik> here's the tl;dr: xml is just a tree
<steveklabnik> with nodes.
<steveklabnik> you traverse it just like any other tree.
<steveklabnik> done.
<steveklabnik> ;)
<sodani> okay thanks
<sodani> appreciate it
fra000 joined #ruby-lang
<steveklabnik> xpath is a dsl for tree traversal.
<steveklabnik> :)
RORgasm joined #ruby-lang
<rue> sodani: Also, with Nokogiri you can use the CSS-style selectors which are often easier and more familiar
<steveklabnik> depending on what you do.
<rue> Mm. I'd use it by default and XPath when you can't
<sodani> yup, been using that to grab certain elements
geoffwright joined #ruby-lang
<steveklabnik> and i'd use the reverse.
<steveklabnik> it's really taste.
<rue> Yes, and XPath tastes icky
<steveklabnik> :p
havenn joined #ruby-lang
<rue> But for example this scenario, an unknown id value, is easier in XPath
<rue> Or, well, doc.css "a[id]" isn't terriby complex.
mark_locklear joined #ruby-lang
<sodani> so every "element" has a name, attributes and possibly child elements correct?
<rue> Possibly attributes, but yes
jasox joined #ruby-lang
<sodani> okay thx
<steveklabnik> but i glanced at it
<steveklabnik> and DeveloperWorks is usually pretty good
<rue> That one's quite reasonable
thrcka joined #ruby-lang
<sodani> i'll take a look
Jake232 joined #ruby-lang
ttilley joined #ruby-lang
ttilley joined #ruby-lang
robbrit left #ruby-lang
ttilley joined #ruby-lang
ttilley joined #ruby-lang
Dreamer3 joined #ruby-lang
roha joined #ruby-lang
Aphelion joined #ruby-lang
queequeg1 joined #ruby-lang
towski joined #ruby-lang
wallerdev joined #ruby-lang
Weems joined #ruby-lang
Pupeno joined #ruby-lang
RomD` joined #ruby-lang
kyrylo joined #ruby-lang
srbaker joined #ruby-lang
Pupeno joined #ruby-lang
Pupeno joined #ruby-lang
yfeldblum joined #ruby-lang
senj joined #ruby-lang
yfeldblum joined #ruby-lang
<zenspider> rawr
workmad3 joined #ruby-lang
roha joined #ruby-lang
saLOUt joined #ruby-lang
<dreinull> the biggest joke in writing tests is that I have to fix my test once I get to test my code.
<dreinull> hi zenspider, is autho.me still being worked on?
<dreinull> the website was kinda unresponsive when I tried yesterday
<zenspider> dreinull: I have no idea what you're talking about
<dreinull> zenspider: sorry, that was zed shaw
<shevy> hehe
<rue> dreinull: zedas, not ^
<shevy> they all start with ze
<dreinull> for some reason I mixed you up...
<dreinull> anyway, I do use minitest right now
ivanthuja joined #ruby-lang
<dreinull> so thanks for that zenspider!
<zenspider> I _love_ being confused with zed
<dreinull> :)
<yfeldblum> write the tests and then write the code to make the tests pass (no matter how crazy the tests); in case the tests do not compile, first write the compiler to make the tests compile ... Test Driven Dumb
towski joined #ruby-lang
<ReinH> ...
<rue> Dumb-driven testing?
<ReinH> don't confuse a problem with TDD with your own incompetence
<shevy> hehe
<andrewvos> Some of the people I work with are forced to do TDD, and they hate it. I call it Hate Driven Development
<shevy> real men don't need to test
<ReinH> that again is not a problem with TDD
<ReinH> it's a problem with forcing people to do things
<andrewvos> ReinH: Who me? I'm not arguing that it is.
<andrewvos> ReinH: That's a human problem.
<ReinH> right
<andrewvos> The problem only exists till they have their first testing epiphany.
<shevy> what epiphany is that?
<dreinull> testing is good. I don't argue against that but tests do consist of error prone code.
<shevy> hmmm
<shevy> how would one go about trying to do something like Microsoft's PowerShell with ruby?
<shevy> most specifically... to pipe objects rather than text
<steveklabnik> you dont.
<rue> Been there
<steveklabnik> l2unix
<steveklabnik> otherwise, Marshall.dump
<steveklabnik> ;)
<shevy> hmm
<rue> I figure the best way to do it is to allow plugins to transform i/o
nuclearsandwich joined #ruby-lang
<rue> For anything that doesn't support anything but text i/o, that is. That's where I was taking rs but meh.
fayimora joined #ruby-lang
outoftime joined #ruby-lang
<rue> So effectively ls | meh becomes meh(objectify(ls))
<andrewvos> steveklabnik: l2unix hahaha
<rue> Well, except it's still as stream, not a single object
<rue> BUT ANYWAY
<andrewvos> shevy: That TDD is faster, and better.
<shevy> rue hmmm
<shevy> andrewvos I think I still have to wait for an epiphany related to piping objects :(
<shevy> time to eat and ponder
gix joined #ruby-lang
<lupine_85> shevy, r, w = IO.pipe ; w.puts(random_object.to_json) ; JSON::parse(r.gets)
<lupine_85> om nom nom :)
<drbrain> may as well use Marshal
kyrylo joined #ruby-lang
<rue> May as well just not pipe it
postmodern joined #ruby-lang
tenderlove joined #ruby-lang
<andrewvos> If in doubt, pipe it
livinded joined #ruby-lang
Manhose joined #ruby-lang
lightcap joined #ruby-lang
singpolyma joined #ruby-lang
retro|cz joined #ruby-lang
outoftime joined #ruby-lang
Pip joined #ruby-lang
wallerdev joined #ruby-lang
macmartine joined #ruby-lang
headius joined #ruby-lang
geoffw8_ joined #ruby-lang
hagabaka joined #ruby-lang
Manhose_ joined #ruby-lang
nofxx joined #ruby-lang
woollyams joined #ruby-lang
scottschecter joined #ruby-lang
<zenspider> rawr
<zenspider> headius: oi!
<headius> hey there!
<zenspider> I've committed my test excludes code
<zenspider> seeing if it's pushed out yet
<zenspider> yup
<headius> sweet, I'll have a look
<headius> I just got most of our CI builds clean and green again, so I'm looking to mess them up with a new influx of tests
QaDeS joined #ruby-lang
fragrant joined #ruby-lang
fragrant left #ruby-lang
<zenspider> heh
<zenspider> looks good to go. take a whack at it. I'd like to release soon
<zenspider> I just forced my sync scripts to push the rest of my commits up
petercooper joined #ruby-lang
<headius> ok
<zenspider> time to take my kittens back to the shelter... bbl
fragrant joined #ruby-lang
macmartine joined #ruby-lang
<rue> headius: Hopefully your tests are up to snuff now ;)
<fragrant> Hi, i have to ask a newbie question , obj[:key] , is it a array or hash ? How can i check whether it's empty or not , blank or not has an element or not ?
<rue> fragrant: An Array is indexed by integers
<zenspider> fragrant: ri Array
<zenspider> ri is your friend (tm)
<zenspider> ri Hash
<headius> rue: you can never have enough tests
<rue> headius: You can have too many tests, if they're not well-made
<rue> Well-known fact, better to have none
<jmontross> better to have tests. that is not a fact.
<rue> Too
<headius> hey, no tests, no bugs
<headius> no users no bugs
<rue> Everybody wins!
<fragrant> obj[:key] , here key is not integer, rather a string, so is it array or hash ?
<headius> that's why I strongly recommended that other ruby impls never have any users
<headius> it's so much easier that way
<srbaker> jmontross: better to have no tests at all than to have poor tests
<fragrant> I can't understand what do after ri Array , zenspider
<jmontross> if you were going to have poor tests…. maybe you aren't writing code for others to read and improve very easily
macmartine joined #ruby-lang
<fragrant> It's confusing, is there any function named .blank? ?
<steveklabnik> fragrant: in rails there is
<steveklabnik> part of activesupport
<fragrant> .empty? and .blank? , are they same ?
<manveru> fragrant: sometimes
<manveru> why do you need it?
wallerdev joined #ruby-lang
<steveklabnik> no.
<manveru> it's mostly (a && a.empty?)
<fragrant> .nil? , .empty? , are they same ?
<manveru> no
<manveru> they define .blank? on NilClass as well, so nil.blank? returns true
<manveru> on String, Hash, and Array it calls empty? afaik
<manveru> anyway, it's just some silly railism, no need to use it
<headius> zenspider: so is this the way you picture it being run: EXCLUDE_DIR=blah/excludes jruby -Ilib -rminitest/excludes blah/test_bad_thing.rb
<headius> or the equivalent in rake
<headius> I have a working sample here
<rue> fragrant: Array is only indexed by integers, so if it's indexed by something other than integers, it's not an Array :)
<fragrant> Thank You.
<headius> zenspider: I'm going to POC using this for a couple MRI tests in our build and get back to you (shortly, I hope)
tomzx joined #ruby-lang
<fragrant> Why are there two different channels ? #ruby and #ruby-lang
<fragrant> What's the difference?
JosephRuby joined #ruby-lang
<headius> zenspider: for some reason my brain keeps wanting the env var to match the .rb file and be "EXCLUDES_DIR"
<headius> hot diggity, it works
<headius> zenspider: https://gist.github.com/1445234
<fragrant> Why are there two different channels ? #ruby and #ruby-lang , What's the difference?
<steveklabnik> #ruby sucks
<headius> zenspider: and the payoff: https://gist.github.com/1445238
<headius> with that patch, I'm cool with this version
<headius> exciting!
jbwiv_ joined #ruby-lang
<drbrain> fragrant: #ruby is where people go when they get banned for misbehaving on #ruby-lang
Indian joined #ruby-lang
<rue> Correction: used to
<rue> Now that they blatantly lie, a lot of newbs just end up there.
<andrewvos> :(
fragrant left #ruby-lang
<rue> drbrain: By the by: do you know if RubyCentral is an official representative (in some capacity) in the US?
urbanmonk joined #ruby-lang
<drbrain> rue: AFAIK they're a 501c3
roha joined #ruby-lang
<drbrain> which is a type of charitable organization
robbyoconnor joined #ruby-lang
tjgillies joined #ruby-lang
<tjgillies> how do i use "include" from an already instantiated object? http://cl.ly/1i3f3A0h1y1U3h2Q1R1S
<steveklabnik> ....
<steveklabnik> well, first of all
<steveklabnik> it's a method
twittard joined #ruby-lang
<drbrain> tjgillies: don't do that
<steveklabnik> Person.new.include Sniper
<drbrain> class Sniper < Person; end; class Melee < Person; end; Sniper.new or Melee.new
<steveklabnik> yes.
<tjgillies> drbrain: sniper isn't a person though. i want the ability to have a sniper panda
<steveklabnik> then you want a decorator!
<steveklabnik> not inheretance
<rue> steveklabnik: *slap*
<drbrain> tjgillies: yes ^^
<steveklabnik> inheretance is an is_a relationship
<tjgillies> ruby has decorators?
<steveklabnik> ri Forwardable
<drbrain> decorators are an OO pattern
<steveklabnik> ri SimpleDelegator
<drbrain> tjgillies: you have units and units have traits (melee, sniper)
<tjgillies> steveklabnik: is there a way to do multiple includes on Person.new?
<drbrain> so combine them that way instead of jumping through OO hoops
<steveklabnik> sure
<steveklabnik> just call it twice
<steveklabnik> it's a method.
<drbrain> I would do class Person; def initialize attack; @attack = attack; end; def range; @attack.range; end; end
lianj joined #ruby-lang
<tjgillies> Person.new.include(Sniper).include(UltimateFighterDude)?
<tjgillies> steveklabnik: ^
<steveklabnik> yep
<tjgillies> steveklabnik: thnx
FylGood joined #ruby-lang
rue joined #ruby-lang
<rue> Stupidisconnect
<tjgillies> steveklabnik: in `<main>': undefined method `include' for #<Person:0x0000010084e2b0> (NoMethodError)
<tjgillies> drbrain: and "attack" would be some class that includes the appropriate module?
<drbrain> tjgillies: I'd make Sniper and Melee a class
<drbrain> well, instances of an Attack class
<drbrain> then they could have range, damage, whatever
<tjgillies> drbrain: this is an educational purposes kinda thing to help me learn to use mixins better, which is why im using modules
<drbrain> tjgillies: ah!
<rue> Also, #extend if it got cut off.
<drbrain> tjgillies: the best use of include takes functionality in the includee and provides extra behavior on top of it
sulo joined #ruby-lang
<drbrain> tjgillies: like Enumerable takes #each and adds #map or Comparable takes #<=> and adds #==