<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
<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
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 ...