Topic for #ruby-lang is now Ruby 1.9.3p0: http://ruby-lang.org | Paste >3 Lines of Text on http://pastie.org
<manveru> hipe: southern germany
<hipe> ah ok! didn't make it out to texas huh?
<hipe> i just moved to sanfrancisco and there are of course many jobs here and many foreigners w/ jobs here
banisterfiend [banisterfiend!~baniseter@115.189.57.66] has joined #ruby-lang
<manveru> yeah, moving there wouldn't be easy though
jkyle [jkyle!~krunk-@unaffiliated/krunk-] has joined #ruby-lang
<jkyle> heya, I'm not sure what this "rubyism" is doing => (app['database_master_role'] & node.run_list.roles).each do |dbm_role|. the two values from app[..] and node.run_list.roles should be strings, but that's a binary operator it's using
<manveru> jkyle: they are probably arrays
<manveru> & makes a set join
<jkyle> ah, that would make sense.
<jkyle> yeah, perfect sense. k
<jkyle> manveru: thanks
slackstation [slackstation!~eman@174-127-33-234.static-ip.telepacific.net] has joined #ruby-lang
<manveru> no problem
<cored> any of you having issues with rbenv compiling 1.8.7 ?
<cored> it's seems that the callback.func file is not complete or something like that
tomzx [tomzx!~tomzx@dsl-59-207.aei.ca] has joined #ruby-lang
voker57 [voker57!~voker57@kvirc/developer/Voker57] has joined #ruby-lang
wyhaines_ [wyhaines_!~wyhaines@65.39.118.15] has joined #ruby-lang
rjke88 [rjke88!~rjke88@adsl-74-160-113-177.asm.bellsouth.net] has joined #ruby-lang
gregmoreno [gregmoreno!~gregmoren@S0106001e58eab184.vc.shawcable.net] has joined #ruby-lang
yfeldblum [yfeldblum!~Jay@c-68-34-107-252.hsd1.md.comcast.net] has joined #ruby-lang
<csmrfx> whats rbenv
<deryldoucette> competitor to rvm
<deryldoucette> same job, different style
<csmrfx> kewl
Nisstyre [Nisstyre!~yours@infocalypse-net.info] has joined #ruby-lang
<csmrfx> mind me asking, in what way different style
<deryldoucette> it uses shims to do it
<csmrfx> heh, color me cluelsess, shims?
<banisterfiend> csmrfx: carl i always thought you were on the cutting edge, but you're only now asking questions that the rest of us were asking about 5 months ago
<banisterfiend> csmrfx: disappoint me
<banisterfiend> ;)
<cored> hehehe
<csmrfx> who me cutting edge?
<csmrfx> Im not even a programmer
looopy [looopy!~looopy@pool-141-156-47-88.washdc.btas.verizon.net] has joined #ruby-lang
<csmrfx> I'm just here for the drama
<deryldoucette> csmrfx: http:/niczsoft.com/2011/11/what-you-should-know-about-rbenv-and-rvm/
<deryldoucette> err //
<cored> yes that's cool and stuffs
<cored> but not much when you can't install Ruby 1.8.7
<csmrfx> thanks deryldoucette
<cored> I found a solution for my problem on stackoverflow
<deryldoucette> :shrug: i'm not part of rbenv. i'm part of rvm.
<cored> the only problem is that rbenv always download the .tar.gz for the Ruby version you want to install
<deryldoucette> with rvm we only do it the first time its attempted to be installed or after you rvm cleanup archives sources
replore [replore!~replore@203.152.213.161.static.zoot.jp] has joined #ruby-lang
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby-lang
<cored> deryldoucette: maybe rbenv should have that
<deryldoucette> otherwise the tarballs are saved and stored locally for future installs
<deryldoucette> could be
Spooner [Spooner!~Miranda@host-92-23-158-179.as13285.net] has joined #ruby-lang
<deryldoucette> make a ticket for it for them, or code it and make a pull request
<cored> the way I see it working is creating a timestamped directory name within tmp
<cored> I'm thinking in how to code it
cyri__ [cyri__!~cyri_@jem75-1-87-88-118-80.dsl.sta.abo.bbox.fr] has joined #ruby-lang
takaokouji [takaokouji!~takaokouj@2001:268:306:1:225:bcff:fedc:e1fe] has joined #ruby-lang
dv310p3r [dv310p3r!~dv310p3r@adsl-74-161-99-192.mia.bellsouth.net] has joined #ruby-lang
wmoxam [wmoxam!~wmoxam@pdpc/supporter/active/wmoxam] has joined #ruby-lang
wmoxam_ [wmoxam_!~wmoxam@75-119-252-238.dsl.teksavvy.com] has joined #ruby-lang
Spooner_ [Spooner_!~Miranda@host-92-23-158-179.as13285.net] has joined #ruby-lang
flip_digits [flip_digits!~textual@c-76-122-14-228.hsd1.fl.comcast.net] has joined #ruby-lang
<salamanderw> Yes, socket connections.
_whitelogger1 [_whitelogger1!~whitelogg@kaunan.whitequark.org] has joined #ruby-lang
_whitelogger1 [_whitelogger1!~whitelogg@kaunan.whitequark.org] has joined #ruby-lang
<robbrit> salamanderw: nope you don't need rails
<robbrit> although it's a good idea to look into libraries: i've been using eventmachine for socket-based apps, it seems to work really well
<salamanderw> OK so to clarify my understanding then, I only need Rails if I actually want to build some webpages or a web/browser interface to x database?
<robbrit> yeah rails is for database-backed web-apps mainly
<salamanderw> OK, here's part two of my question....
apeiros_ [apeiros_!~apeiros@77-58-115-24.dclient.hispeed.ch] has joined #ruby-lang
<salamanderw> Suppose I want to build some sort of app or *something* that does 2 things.... on one hand, via a website, it registers, logs in, and displays a list of users (I guess I'd use Rails for that). On the other hand, it also runs a socket-based server to connect to a different database. How do I run both programs on the same host? Do they have to be 2 different programs?
heppy [heppy!~heppy@75-101-31-55.dsl.dynamic.sonic.net] has joined #ruby-lang
Jake232 [Jake232!~textual@5e049611.bb.sky.com] has joined #ruby-lang
<robbrit> salamanderw: they can share code (classes, etc.) but yeah they would be two separate programs
<whitequark> salamanderw: not neccessarily
<whitequark> you can even use these two databases at the same time in Rails
<whitequark> of course, if you need some background jobs, you'll need to add a gem (dj, resque or something like that) to Rails and spawn a worker
<whitequark> that still leaves you with an unified codebase
<salamanderw> OK, I guess I can do things either way, my question is...which makes more sense, performance wise and architecture wise? 2 separate programs, 2 separate processes running of one main program? 1 main program running off rails with a spawned-off worker?
<robbrit> i'd think it would be simpler to have 2 separate programs, then you won't have to deal with rails' quirks with your separate app
<salamanderw> Thx robrit, instinct tells me the same....but then ok, sorry for the stupid question but, if I host my 2 programs on, say, bluehost or something...how do I get them to run concurrently? Or the socket program in the background (to accept connections) plus the website (rails program) also?
<whitequark> it depends on the kind of work you need to perform on that database
<whitequark> if it's e.g. some external dependency, like a gameserver (I've once had such setup) which you need to add accounts to, it's better to stick with Rails
<whitequark> if it's something completely different and not web-related, then a separate program may be better
<whitequark> but not neccessarily
<salamanderw> whitequark: That's it, it is precisely a game server. Let me explain more clearly what I'm trying to do...
<robbrit> salamanderw: you can run them both on the same server as separate processes, just have the socket connection listen on a different port than 80 (or whatever your rails app is listening on)
<whitequark> salamanderw: if it's a game server, then a separate process is _definitely_ a way to go
<whitequark> you can look at EventMachine+EM::Synchrony for implementing it
<salamanderw> @robrit & whitequark: ok thanks, what you said confirms my instinct of running them separately.
wmoxam_ [wmoxam_!~wmoxam@76.9.195.38] has joined #ruby-lang
<salamanderw> OK I have one more architecture question (sorry I'm such a noobzer, my background is embedded so I'm not very au-fait with server/client nor web stuff)...
<salamanderw> Let's say I have a "game" database, where each record is the "state" of one of n games that are being currently played.
<salamanderw> I want my game server to basically listen to users, and modify the state of game x according to a user's requrest and the rules of the game.
<salamanderw> So basically the game server has some port open where it waits for a user connection, and if the user sends a game "move", the server checks that the move is legal, and if it is, it updates the game state accordingly. So far so good?
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
<robbrit> salamanderw: is performance a goal? a DB might not be the best approach for maintaining game state
<salamanderw> My question is....suppose I have many, many games, and many, many more users...
<salamanderw> @robrit: ok, what's the alternative? Each game is a thread?
<salamanderw> @robrit: wait, let's say the game is something that is not time-critical, like say, chess instead of some shooter game.
<wmoxam_> salamanderw: in that case it could operate like a web app
<salamanderw> So let's say for now that I store the game state in a database (because wehther the command is executed at t=3 seconds vs t=5 seconds is not a big deal).
<wmoxam_> share nothing, load the game state per request
<salamanderw> Wait, I haven't asked my question!!!
<salamanderw> @wmoxam: Yes, precisely. Hold on...
<wmoxam_> .msg nickserv ghost wmoxam booga
<salamanderw> I indeed load the game state by request only, and only when required by a user.
wmoxam_ [wmoxam_!~wmoxam@206-248-153-55.dsl.teksavvy.com] has joined #ruby-lang
<salamanderw> My question is...because my game server is checking the game rules (i.e. the legality of the request) before actually doing the change on the database....when I have many users and many games running...then the rules checker becomes a huge bottleneck, no? Is there a way that I can handle each user request in parallel or something? Like each user connection is its own thread or something?
solars [solars!~solars@mk089144206081.a1.net] has joined #ruby-lang
chrismcg [chrismcg!~chrismcg@pdpc/supporter/active/chrismcg] has joined #ruby-lang
wmoxam [wmoxam!~wmoxam@pdpc/supporter/active/wmoxam] has joined #ruby-lang
<robbrit> salamanderw: if its not performant critical a webapp would work just fine
yorickpeterse [yorickpeterse!~yorickpet@pdpc/supporter/professional/yorickpeterse] has joined #ruby-lang
tla [tla!~tla@toelboell-lund.dk] has joined #ruby-lang
<robbrit> the rules checker probably won't use up a lot of overhead, and if it starts being problematic as you get more people you can just add more webservers
<robbrit> and yes, each user request is theoretically run in parallel, although i'm not a rails expert so i don't know how it would handle it
thone [thone!~thone@e179080081.adsl.alicedsl.de] has joined #ruby-lang
<salamanderw> OK so lemme explain/change the question. Suppose I get two users connecting to my "server"/webapp (for now assume it is using a port other than 80, so technically it is not a web app, just an interface to my database) at about the same time. How can I run my rules checker for each user at the same time? Or does it have to run first on one user and then once that check is finished it runs for the second user?
butchanton [butchanton!~butchanto@vpn-sanfran.exacttarget.com] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@46.118.220.90] has joined #ruby-lang
<darix> salamanderw: threads, multiple processes, if your checker is fast enough you can also soly work event based
<wmoxam> salamanderw: you could run threads, just make sure the you run an interpreter that supports something better than green threads
<robbrit> salamanderw: if you use a library like eventmachine, it manages requests in parallel
<wmoxam> like jruby
<robbrit> how's rubinius these days? i haven't checked it out in ages
<salamanderw> OK guys/gals, thanks for your help! Gave me stuff to think about....I shall check out EventMachine, but good to know that I can get things handled in parallel in Ruby, now I just need to figure out how! Thanks for all your tips!
<MistyM> wmoxam: How's jruby's threading compared to YARV?
<robbrit> MistyM: jruby uses java threads which are native
<MistyM> Aren't YARV threads native too? I know they've got some limitations on what can be done in parallel though.
<wmoxam> MistyM: YARV has a GIL
darkf [darkf!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
<erikh> fish have GILs too
<robbrit> does jruby have a GIL?
<erikh> what a hoot
<erikh> robbrit: no
<MistyM> erikh: No, owls have hoots.
<erikh> MistyM: you win an internet
Heimidal [Heimidal!~heimidal@factory-smtp.factorylabs.com] has joined #ruby-lang
<MistyM> wmoxam: Thanks,
<salamanderw> @wmoxam thanks for the link!
<wmoxam> MacRuby also lacks a GIL
<erikh> and newer versions of rubinius as I understand it.
<wmoxam> yeah
<yorickpeterse> It would be nice for Rubinius to be based on 1.9 one day
<yorickpeterse> Until then I don't really see it as anything but a nice experiment
twittard [twittard!~twittard@cpe-76-169-74-39.socal.res.rr.com] has joined #ruby-lang
<wmoxam> erikh: although I don't think anything has been released yet, it's still in development
<erikh> it's the 2.0 branch IIRC
<erikh> but yes, correct
<wmoxam> yeah
<wmoxam> yorickpeterse: that's a goal
<yorickpeterse> I know, but it has been a goal for quite a while now and sadly (as far as I know) there's no real working implementation available
<wmoxam> yorickpeterse: Rubinius is spawning some other langs/implementations as well: http://rubini.us/projects/
<yorickpeterse> I always wondered, what is the added value of writing a language on top of Rubinius?
<yorickpeterse> And not, say, MRI
<lianj> llvm
<Mon_Ouie> MRI doesn't provide you with an API to its bytecode compiler, etc.
<yorickpeterse> hmm
<wmoxam> yorickpeterse: Rubinius is kinda like Parrot
dhoss [dhoss!~dhoss@bruticus.dhoss.net] has joined #ruby-lang
<yorickpeterse> Ah, right
<yorickpeterse> Are there any docs on using Rubinius like that? Sounds pretty interesting
<yorickpeterse> Docs as in actual docs, not vague code examples :)
<wmoxam> speaking of Parrot, I never hear much about Cardinal
flexd [flexd!~flexd@dev.flexd.net] has joined #ruby-lang
<yorickpeterse> Seems they moved to /parrot/cardinal
<yorickpeterse> last commit was in November so it seems pretty active
ascarter [ascarter!~ascarter@67-42-84-171.tukw.qwest.net] has joined #ruby-lang
heppy [heppy!~heppy@fw.baysidebusinessplaza.com] has joined #ruby-lang
towski [towski!~towski@204-15-1-114-static.ipnetworksinc.net] has joined #ruby-lang
amerine [amerine!~mturner@208-100-137-147.bendbroadband.com] has joined #ruby-lang
<MistyM> Argh, what encoding did Excel save this CSV in?
<apeiros_> MistyM: most likely iso-8859-1
<apeiros_> (aka iso-latin-1)
<MistyM> No, doesn't seem to be iso-8859-1. That eats the French accents.
heppy [heppy!~heppy@fw.baysidebusinessplaza.com] has joined #ruby-lang
<shevy> mhmm french fries
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
kith_ [kith_!~kith@unaffiliated/kith] has joined #ruby-lang
<MistyM> Looks like it is one-byte though. The offending character is é, addressed as \X8E. That seems to be undefined in ISO-8859-1.
Heimidal_ [Heimidal_!~heimidal@factory-smtp.factorylabs.com] has joined #ruby-lang
<apeiros_> MistyM: do you mean 'é' is undefined in iso-8859-1 or \x8e?
<apeiros_> (because both are…)
<MistyM> apeiros_: I know é is in iso-8859-1. I thought \x8e was in the undefined rows? http://en.wikipedia.org/wiki/ISO-8859-1#Codepage_layout
<apeiros_> macroman has é as \x8e
<MistyM> Maybe that's it.
<MistyM> I loaded the csv and #force_encodinged it to 'macroman', but it still seems to be having trouble?
<apeiros_> you're using the stdlib csv lib with it?
<MistyM> Oh, I was doing it wrong. Still treating it as macRoman and trying to puts, but I should have just #encoded it to utf-8.
<apeiros_> data = File.read(path, :encoding => 'macroman').encode('utf-8') # then parse data
<MistyM> Thanks!
<ddfreyne> macro man eh
mrsolo [mrsolo!~mrsolo@64.125.181.73] has joined #ruby-lang
<MistyM> Look, up in the sky!
<JonnieCache> that was john mccarthys alter ego
<JonnieCache> why do you think he worse those glasses?
<JonnieCache> *wore
<shevy> *whore
<shevy> what is macro or micro man by the way?
<MistyM> One of Particle Man's nemeses.
<JonnieCache> its MacRoman, a character encoding scheme
<JonnieCache> Macro Man was a lisp joke
<JonnieCache> domnt get many opportunities for lisp jokes, gotta take em while you can
<JonnieCache> if i knew more lisp maybe id have more opportunities
<MistyM> Seriously, thanks Excel. macRoman is a perfect default encoding that I can't apparently change anywhere in the options.
<JonnieCache> heh what version of excel?
<MistyM> 2011 Mac.
<JonnieCache> fail
<corsican> haha
<shevy> rescue
<shevy> anyone throws in an 'end'?
<JonnieCache> ensure go_home() && have_dinner()
<JonnieCache> end
<corsican> I thought it was always try / rescue / end
JonnieCache [JonnieCache!~jonnie@87.252.60.35] has quit [#ruby-lang]
<shevy> hmmmm try?
<shevy> but that reminds me
<shevy> I always felt that catch/throw didn't fit into the rest of ruby code I wrote
DEac- [DEac-!~deac@81.16.104.86] has joined #ruby-lang
towski [towski!~towski@204-15-1-114-static.ipnetworksinc.net] has joined #ruby-lang
sodani [sodani!~shig@user-387hpcb.cable.mindspring.com] has joined #ruby-lang
artOfWar_ [artOfWar_!~artofwar@nat/yahoo/x-catglrrnpzluoogw] has joined #ruby-lang
<sodani> if I want "throw :done" to be triggered for any exception, would I do something like begin; <some code>; rescue throw :done; end ?
<Bottlecruiser> rescue without argument rescues not all exceptions
<sodani> but most?
tbuehlmann [tbuehlmann!~Tobias@unaffiliated/tovias] has joined #ruby-lang
<manveru> all that have StandardError as ancestor
looopy [looopy!~looopy@pool-141-156-47-88.washdc.btas.verizon.net] has joined #ruby-lang
<sodani> okay, thanks
looopy_ [looopy_!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
kith [kith!~kith@unaffiliated/kith] has joined #ruby-lang
butchanton [butchanton!~butchanto@vpn-sanfran.exacttarget.com] has joined #ruby-lang
chrishuntis [chrishuntis!~chrishunt@83-223-112-244.as29017.net] has joined #ruby-lang
netfeed [netfeed!~netfeed@li346-193.members.linode.com] has joined #ruby-lang
r0bby [r0bby!~wakawaka@guifications/user/r0bby] has joined #ruby-lang
nofxx [nofxx!~nofxx@unaffiliated/nofxx] has joined #ruby-lang
Heimidal [Heimidal!~heimidal@factory-smtp.factorylabs.com] has joined #ruby-lang
<shevy> hmm
<shevy> I've come to the conclusion that "write small methods" can be safely extended to classes as well
<shevy> write small classes
<erikh> yes
roha [roha!~phelot@84-75-49-50.dclient.hispeed.ch] has joined #ruby-lang
<erikh> I'm a big fan of "more classes that do one thing well"
<erikh> instead of things like... ActiveRecord::Base
twittard [twittard!~twittard@wc.lax.truecarcorp.com] has joined #ruby-lang
codefriar [codefriar!~codefriar@ip-200.it.rdu.bandwidth.com] has joined #ruby-lang
<codefriar> is there a way to statically compile the mysql2 gem ?
<yxhuvud> erikh: I find activerecord reasonably focused compared to activesupport
<erikh> well at least the requires are scoped for that
<erikh> I can't say I'm a fan either though
<erikh> err, activesupport 3.x is. I don't think 2.x had such luxury
<apeiros_> erikh: classes? who needs classes, tsssk…
<erikh> I need classes
<erikh> like one on cooking
<erikh> maybe another on woodworking
<yxhuvud> indeed. just think of those nice globally (well almost) scoped helpers
<apeiros_> oooh
sodani [sodani!~shig@user-387hpcb.cable.mindspring.com] has quit [#ruby-lang]
Axsuul [Axsuul!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby-lang
Manhose [Manhose!~Manhose@a94-132-167-54.cpe.netcabo.pt] has joined #ruby-lang
bjensen [bjensen!~brianj@3007ds3-ar.0.fullrate.dk] has joined #ruby-lang
Seich [Seich!~quassel@190.4.48.130] has joined #ruby-lang
d3vic3 [d3vic3!~quimzed@197.1.174.135] has joined #ruby-lang
heppy [heppy!~heppy@fw.baysidebusinessplaza.com] has joined #ruby-lang
heppy [heppy!~heppy@fw.baysidebusinessplaza.com] has joined #ruby-lang
gearaholic [gearaholic!~gearaholi@c-71-238-98-243.hsd1.mi.comcast.net] has joined #ruby-lang
reasonedink [reasonedink!~donnie@adsl-067-034-186-046.sip.mco.bellsouth.net] has joined #ruby-lang
<reasonedink> I'm probably a lot prouder of this than I ought to be: https://gist.github.com/1478065
My_Hearing [My_Hearing!~Mon_Ouie@subtle/user/MonOuie] has joined #ruby-lang
<reasonedink> I don't doubt it could be done much better, but the code is pretty tight by my standards, it works, and I learned quite a bit in the process.
<RickHull> maybe add a comment for the finder regex
<RickHull> i don't understand the multiple assignment on L13
adambeynon [adambeynon!~adambeyno@82-69-1-211.dsl.in-addr.zen.co.uk] has joined #ruby-lang
<reasonedink> There's a commented version beneath?
<RickHull> ah, ok :)
<reasonedink> I realize eval() is, for the most part, terrible, but the way Ruby does it makes it just bearable.
<RickHull> what's going on with L32/13 ? i've not used eval binding in my own code
erics [erics!~Skif@74.115.253.42] has joined #ruby-lang
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
<reasonedink> Well then you've not used eval() for variable assignment. : )
<reasonedink> Ruby's eval() has the added security that variables can only be eval'ed into existence within a binding, which is akin to scope.
<reasonedink> eval('a = 5'); puts a
<reasonedink> That doesn't work because the eval() didn't occur within the local scope.
kitallis [kitallis!~kitallis@122.167.88.254] has joined #ruby-lang
<reasonedink> eval('a = 5'); eval('puts a')
<reasonedink> That does work, because they're both bound.
<RickHull> local = binding; eval('a = 5', local) # also
<reasonedink> That's... exactly what I'm doing. : )
<reasonedink> Oh!
<reasonedink> No, no it's not.
<Mon_Ouie> binding.eval("a = 5")
<RickHull> (I am learning this stuff now, so excuse if i say anything bleedingly obvious)
<reasonedink> Yours doesn't work, Mon_Ouie.
<reasonedink> Oh, you meant on a predefined binding.
<Mon_Ouie> It does as well
<reasonedink> Mm-hmm.
<Mon_Ouie> Whether the binding exists or not
<RickHull> your L32, port is now an array?
<RickHull> is that really what you intended?
<reasonedink> Heh, I do so love watching somebody learn, especially from my own code.
<RickHull> a = 6, local; a #=> [6, #<Binding:0xb758db50>]
<reasonedink> << appends to strings, too.
outoftime [outoftime!~mat@50.57.10.189] has joined #ruby-lang
probst [probst!~probst@131.80-202-169.nextgentel.com] has joined #ruby-lang
<RickHull> i would use a different name than port, if it is in fact a structure/array
<reasonedink> It's a string.
<RickHull> my a is an array
<RickHull> using analagous code
<RickHull> (see above)
<RickHull> i'm on 1.8.7, maybe a 1.9 thing?
<reasonedink> I believe so, yes.
<reasonedink> For strings, << is synonymous with +=.
<RickHull> not exactly
<reasonedink> ?
<RickHull> << mutates, += assigns
<Mon_Ouie> i.e. += creates a new object
<RickHull> the effect is often equivalent
<reasonedink> << is marginally faster, then?
<RickHull> there can be an important semantic difference as well
<RickHull> i'm failing on an illustrative example
<erikh> += is copy and << more or less
<erikh> well it may be different underneath the hood
Skif [Skif!~Skif@72.1.92.57] has joined #ruby-lang
<erikh> also += on Array doesn't care about the encapsulating array you're assigning (it's an appender) where << will take the encapsulating array (creating a sub-array)
<erikh> which is something I always fuck up
<jlnr> << is +=!
<jlnr> just like sort is sort!
<jlnr> erm, the second "is" is wrong. :D
<reasonedink> Heh.
<reasonedink> But the gist was clear.
<jlnr> "<<" : "+=" = sort! : sort
<jlnr> for Strings, anyway.
<RickHull> except, bang doesn't mean mutate. just "be careful"
<reasonedink> "Be careful because this probably mutates."
<erikh> ^
<RickHull> ah, got an example of important semantic difference on << and +=, 1 sec
<shevy> and there RickHull walks down to his cellar ...
<RickHull> it's full of cobwebs and half-baked ideas.
<shevy> and dead bodies!!!
<RickHull> ideas have consequences, you know
nofxx [nofxx!~nofxx@unaffiliated/nofxx] has joined #ruby-lang
<erikh> heh
<erikh> alright mr. huxley
outoftime [outoftime!~mat@ip-160-79-101-2.autorev.intellispace.net] has joined #ruby-lang
bitrot [bitrot!~smd@rrcs-50-84-14-82.sw.biz.rr.com] has joined #ruby-lang
<RickHull> Thomas or Aldous?
tommyvyo [tommyvyo!~tommyvyo@38.123.129.115] has joined #ruby-lang
<erikh> Aldous
<outoftime> is there a simple way to figure out if reading from an IO would block before you attempt a read?
<outoftime> the best I can think of is read_nonblock and than catching the error
erics [erics!~Skif@74.115.253.42] has joined #ruby-lang
<RickHull> Errno::EWOULDBLOCK
<outoftime> RickHull: it appears to raise an Errno::EAGAIN
<outoftime> RickHull: huh, rescuing either seems to do the trick
<outoftime> but there's no way to ask an IO stream whether it has any data in its buffer?
<RickHull> you familiar with select?
<outoftime> RickHull: ah, yes, I've used it before. thanks for the reminder
NinoScript [NinoScript!~Adium@nat-wifi-voip.campus.utfsm.cl] has joined #ruby-lang
eydaimon [eydaimon!~eydaimon@unaffiliated/anywho] has joined #ruby-lang
ilyam [ilyam!~ilyam@eng.nat.mtv.ooyala.com] has joined #ruby-lang
r0bby [r0bby!~wakawaka@guifications/user/r0bby] has joined #ruby-lang
artOfWar_ [artOfWar_!~artofwar@nat/yahoo/x-pjxjgzvssawawvyf] has joined #ruby-lang
benanne [benanne!~rijdier@ip-213-49-105-229.dsl.scarlet.be] has joined #ruby-lang
sepp2k [sepp2k!~sexy@g224097220.adsl.alicedsl.de] has joined #ruby-lang
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
woollyams [woollyams!~woollyams@124-168-81-150.dyn.iinet.net.au] has joined #ruby-lang
piyasiii [piyasiii!piyasiii@175.110.111.97] has joined #ruby-lang
<piyasiii> HI
uniqanomaly [uniqanomaly!~ua@dynamic-78-8-214-151.ssp.dialog.net.pl] has joined #ruby-lang
<RickHull> Aloha!
<RickHull> damnit, missed my Hawaii joke
piyasiii [piyasiii!piyasiii@175.110.111.97] has joined #ruby-lang
diegoviola [diegoviola!~diego@host-1-211.b15.cvc.com.py] has joined #ruby-lang
piyasiii [piyasiii!piyasiii@175.110.111.97] has joined #ruby-lang
Spooner [Spooner!~Miranda@host-92-23-158-179.as13285.net] has joined #ruby-lang
havenn [havenn!~skipper@pool-72-67-31-69.lsanca.fios.verizon.net] has joined #ruby-lang
livinded [livinded!~lolwut@pool-108-23-242-132.lsanca.fios.verizon.net] has joined #ruby-lang
<jlnr> does anyone know if there are two PriorityQueue implementations in the Ruby universe?
<jlnr> I am looking at code that uses PriorityQueue#push, but to be honest, I can't see *any* mutators in the public priority_queue gem
piyasiii [piyasiii!piyasiii@175.110.111.97] has joined #ruby-lang
<oddmunds> damn. i found a gem so fucking horrid to work with that i'm just pasting all the code into my program. :(
<piyasiii> HI
piyasiii [piyasiii!piyasiii@175.110.111.97] has joined #ruby-lang
<jlnr> Turns out there is both a priority_queue gem as well as a PriorityQueue one
lsegal [lsegal!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
zarubin [zarubin!zarubin@94.27.78.233] has joined #ruby-lang
sodani [sodani!~shig@user-387hpcb.cable.mindspring.com] has joined #ruby-lang
<shevy> got a question ...
<sodani> can someone tell me how to get around the error in this lookbehind? /(?<=https?:\/\/).*/
<shevy> hmm or perhaps not. The question is odd because it is, whether ruby could use an import-scheme similar to python
<sodani> i know it's the "?' but not sure how to get around it
<manveru> shevy: and how do you think you could implement that?
<manveru> wrapping libs into anonymous modules?
<shevy> manveru me? I have no idea how
snuxoll [snuxoll!~stefan@63.227.129.124] has joined #ruby-lang
<livinded> what's an anonymous module? A lambda that defines one?
<reasonedink> What purpose does an anonymous module serve that a class can't?
<manveru> reasonedink: it doesn't have to be instantiated, so it's a little bit less overhead
<livinded> are modules ever instantiated?
<livinded> oh
<livinded> but you still need to include the module within a class which still takes the parsing time and memory doesn't it?
<manveru> well, not talking about including
<manveru> i was thinking more along the lines of require in nodejs or go
<livinded> how do you use a module if it's not included into a class? singletons?
<manveru> just for namespacing
<manveru> but not even sure if that'd work nicely
<manveru> something like that
<manveru> you can even use a::X and b::X this way
headius [headius!~headius@71-210-151-185.mpls.qwest.net] has joined #ruby-lang
srbartlett [srbartlett!~srbartlet@124-170-47-158.dyn.iinet.net.au] has joined #ruby-lang
ilyam [ilyam!~ilyam@eng.nat.mtv.ooyala.com] has joined #ruby-lang
<livinded> manveru: so ya, singletons
<livinded> singletons for classes shouldn't instantiate the class either
<manveru> ?
<livinded> defining a method with self in a class makes it a singleton (class method rather than instance)
<livinded> it wont instantiate the object
<manveru> well, right now,everybody puts stuff into the Module namespace
<manveru> that's why we have fancy names for libraries
<shevy> hehe
<shevy> like unicorn
<shevy> or god
<manveru> Tenjin, Thor, Yard, Webrat, Slippers, Sass, Rack, Innate, Nori, Nokogiri, Lokar, Hpricot, Haml, ...
robbrit [robbrit!~rob@38.108.76.250] has quit [#ruby-lang]
<manveru> unless you look at their description, the names make no sense... even if you know what they do, it's often not obvious
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
petercooper [petercooper!~petercoop@82.144.254.2] has joined #ruby-lang
lsegal [lsegal!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
ascarter [ascarter!~ascarter@67-42-84-171.tukw.qwest.net] has joined #ruby-lang
Skif [Skif!~Skif@72.1.92.57] has joined #ruby-lang
<livinded> wait why does namespacing == fancy names?
<manveru> well, because we don't use URIs or UUIDs, fancy names are making it less likely for two names to collide
<manveru> if i could say in my code: foo = uri_require('rubygems.org/manveru/foo')
<manveru> and use that throughout the file
<manveru> then we only have collisions if the author doesn't follow the rules
lsegal` [lsegal`!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
tommyvyo [tommyvyo!~tommyvyo@38.123.129.115] has joined #ruby-lang
<shevy> manveru Thor at least sounds mighty
<shevy> but Webrat? a RAT?!?!
<shevy> hmm I could fork it... and rename to Webmouse
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
<MistyM> Of Webmice and men
Sailias [Sailias!~jonathan@69.158.82.233] has joined #ruby-lang
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby-lang
<shevy> MistyM yeah
<shevy> webmen
<shevy> spiderman was the first pioneer of the web
dejongge [dejongge!~jonke@pD9E0E026.dip0.t-ipconnect.de] has joined #ruby-lang
NinoScript [NinoScript!~Adium@186-106-167-142.baf.movistar.cl] has joined #ruby-lang
NinoScript [NinoScript!~Adium@186-106-167-142.baf.movistar.cl] has quit [#ruby-lang]
tommyvyo [tommyvyo!~tommyvyo@38.123.129.115] has joined #ruby-lang
ascarter [ascarter!~ascarter@67-42-84-171.tukw.qwest.net] has joined #ruby-lang
<erikh> perl has this problem nailed
<erikh> namespaces are groups based on function and you can get creative as you want outside of that
chris2 [chris2!~chris@vuxu.org] has joined #ruby-lang
Defusal [Defusal!DeFi@unaffiliated/ecnerifed] has joined #ruby-lang
QaDeS [QaDeS!~mklaus@frbg-4d029531.pool.mediaWays.net] has joined #ruby-lang
srbartlett [srbartlett!~srbartlet@202.146.7.239] has joined #ruby-lang
vesan_ [vesan_!~vesan@maailmanlopun.modeemi.net] has joined #ruby-lang
<MistyM> I love how smart Ruby ranges are. Being able to do ("Foo1".."Foo5").to_a just feels right.
RickHull [RickHull!~rhull@209.119.14.25] has joined #ruby-lang
<shevy> indeed
<shevy> ruby is smart
<shevy> like a predator in the jungle
nofxx [nofxx!~nofxx@unaffiliated/nofxx] has joined #ruby-lang
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
zenspider [zenspider!~user@envy.zenspider.com] has joined #ruby-lang
oilpastels [oilpastels!~rafael@177.98.12.243] has joined #ruby-lang
saLOUt [saLOUt!~rriemann@91-65-223-29-dynip.superkabel.de] has joined #ruby-lang
<reasonedink> Well, sort of...
<reasonedink> ('foo1'..'foo99').to_a.size => 4707939
<reasonedink> ^_^
pabloh [pabloh!~pablo@186.22.82.39] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@46.118.220.205] has joined #ruby-lang
<pabloh> does anyone knows a visual class browser for ruby? (like smalltalk's)
<MistyM> reasonedink: Yeah, true. ('foo01'..'foo99').to_a is a little better behaved.
<diegoviola> class browser?
<zenspider> pabloh: no such thing afaik... ruby being file based and all
<reasonedink> I was just poking fun, Misty. Of course it could never be "context-sensitive", but ord-based is enough so long as you do it sensibly.
burgestrand [burgestrand!~burgestra@h-163-174.a155.priv.bahnhof.se] has joined #ruby-lang
<diegoviola> i love ctags for browsing through my classes, etc
<zenspider> ctags are great... but they're no match for a proper class browser
<pabloh> zenspider: i mean at least for brosing and having the docs at hand, no something for editing the code too
hagabaka [hagabaka!~hagabaka@unaffiliated/hagabaka] has joined #ruby-lang
<diegoviola> taglist? but that's too vim-specific
ascarter [ascarter!~ascarter@67-42-84-171.tukw.qwest.net] has joined #ruby-lang
<pabloh> s/brosing/browsing
<diegoviola> afaik
ilyam [ilyam!~ilyam@eng.nat.mtv.ooyala.com] has joined #ruby-lang
<zenspider> pabloh: if you just want to browse, then I'd suggest exuberant ctags
<pabloh> zenspider: with vim ?
<zenspider> having docs at hand... `gem server`? maybe
<zenspider> I use ri
<zenspider> pabloh: yes, tags work on all real text editors... in fact, that's the litmus test as to whether they're real or not
ivanoats [ivanoats!~ivanoats@pdpc/supporter/active/ivanoats] has joined #ruby-lang
woollyams [woollyams!~woollyams@203-206-165-21.perm.iinet.net.au] has joined #ruby-lang
cwd1 [cwd1!~cwd1@cpe-76-176-105-158.san.res.rr.com] has joined #ruby-lang
outoftime [outoftime!~mat@50.57.10.189] has joined #ruby-lang
postmodern [postmodern!~postmoder@c-71-237-178-98.hsd1.or.comcast.net] has joined #ruby-lang
r0bby [r0bby!~wakawaka@guifications/user/r0bby] has joined #ruby-lang
Heimidal_ [Heimidal_!~heimidal@factory-smtp.factorylabs.com] has joined #ruby-lang
thrcka [thrcka!~thrcka@ip-89-102-34-33.net.upcbroadband.cz] has joined #ruby-lang
thrcka_ [thrcka_!~thrcka@ip-89-102-34-33.net.upcbroadband.cz] has joined #ruby-lang
brianpWins [brianpWins!~brianpwin@74.198.150.153] has joined #ruby-lang
singpolyma [singpolyma!~singpolym@dsl-67-204-35-251.acanac.net] has joined #ruby-lang
looopy [looopy!~looopy@pool-141-156-47-88.washdc.btas.verizon.net] has joined #ruby-lang
Defusal [Defusal!DeFi@unaffiliated/ecnerifed] has joined #ruby-lang
RickHull [RickHull!~rhull@209.119.14.25] has quit [#ruby-lang]
JosephRuby [JosephRuby!~joseph@46.33.34.25] has joined #ruby-lang
chessguy [chessguy!~chessguy@pool-74-96-111-119.washdc.fios.verizon.net] has joined #ruby-lang
<freedrull> hmmmm :\ http://dpaste.com/673506/
<freedrull> if v is not true, then what exactly does "if v" do?
<freedrull> oh it just checks if v is not nil
<freedrull> right
<freedrull> woops
freedrull [freedrull!~freedrull@freedrull.xen.prgmr.com] has quit [#ruby-lang]
<rue> pabloh: Depending on situation, you can sort of use pry as a poor man's image editor
<pabloh> rue, may be a valid alternative
<pabloh> i was looking for a way to visually browse classes an live objects
<pabloh> though
<pabloh> s/an/and
Heimidal [Heimidal!~heimidal@factory-smtp.factorylabs.com] has joined #ruby-lang
thrcka_ [thrcka_!~thrcka@ip-89-102-34-33.net.upcbroadband.cz] has joined #ruby-lang
queequeg1 [queequeg1!~queequeg@c-71-202-152-67.hsd1.ca.comcast.net] has joined #ruby-lang
Manhose_ [Manhose_!~Manhose@a94-132-167-54.cpe.netcabo.pt] has joined #ruby-lang
<reasonedink> freedrull: Most languages have quite a few truthy and falsy values; Ruby only has two, false and nil.
twittard [twittard!~twittard@cpe-76-169-74-39.socal.res.rr.com] has joined #ruby-lang
outoftime [outoftime!~mat@50.57.10.189] has joined #ruby-lang
thrcka_ [thrcka_!~thrcka@ip-89-102-34-33.net.upcbroadband.cz] has joined #ruby-lang
Heimidal [Heimidal!~heimidal@factory-smtp.factorylabs.com] has joined #ruby-lang
thrcka [thrcka!~thrcka@ip-89-102-34-33.net.upcbroadband.cz] has joined #ruby-lang