<davpoind>
anyone use ruby for system scripting? link me to some best practices similar to setting up bash aliases? Goal: write my aliases using ruby, not just bash. thx
<rue>
You can't write *aliases* in Ruby, per se
<rue>
There's a book about Ruby for sysadmins or scripting, think it's PragProg even
<davpoind>
i've seen it, not bought/read that one yet though
<davpoind>
just testing the waters here
<davpoind>
my system is getting a little out of hand :|
<rue>
Maybe you need something like Chef/Puppet instead?
<rue>
Or what was that new thing, Squiggles or Squidder or something like that
<davpoind>
lol wut?
<davpoind>
oh, is that the name?
<rue>
It's something like that.
<telemachus>
I thought the Ruby for sysadmins book was Apress. Maybe both?
<rue>
Probably both
<davpoind>
no, i know which one you mean
<davpoind>
it's prag prog
<davpoind>
trying to find it
<telemachus>
davpoind: I'm currently holding "Practical Ruby for System Administration" in my hands. It's Apress. So, they definitely have one too. ;)
<davpoind>
ha, well done!
<davpoind>
my mind is all over with creativity tonight
<headius>
I suppose OO isn't my primary question, but I'm trying to understand typical usage with an eye for optimization similar to how V8 does it
<headius>
like, there's also nested scopes, but my general impression is that most stuff doesn't use many levels of scoping
<headius>
at least not for heavy-hit properties
<headius>
some of that might be optimizable anyway...once closing over a scope it never changes
<headius>
hmmm
<workmad3>
headius: ok, I think you're wanting answers to questions that are deeper than 'newbie' level :/
<workmad3>
headius: may I suggest #jquery or #javascript? :)
<headius>
curses!
<workmad3>
headius: you're wanting to know about byte-code optimisation and JIT stuff if you want to get into the sort of optimization that v8 does... that's not newbie! :)
<andrewvos>
Right, please disregard teh previous question
<chendo_>
lol
<headius>
oh I suppose not
<chendo_>
headius is looking for ideas for jruby
<chendo_>
amirite?
<workmad3>
andrewvos: you were doing something silly? :)
<headius>
I guess I'm coming from the direction of optimizing JS and trying to learn the language :)
<workmad3>
headius: yeah... I would suggest that you forget about optimisation stuff when learning JS... start from scratch again :)
<workmad3>
headius: and also decide if you're more interested in JS on something like node (so server-side) or in the browser... they are quite different beasts in my experience (mostly browser)
<headius>
well, I'm not so interested in it as a user
<workmad3>
headius: I mean kudos on wanting to do an implementation of JS... and as a learning exercise I'd say go and do it... but if you want to improve on something like v8, you're going to be hard pressed as an individual I believe
<headius>
workmad3: well, I don't have to build a house to make a better hammer...I just need to understand the physics of nails and wood
<headius>
that's how much of JS I want to learn right now :)
<headius>
I don't think it would be difficult to beat V8 building atop JVM
<chendo_>
haha
<workmad3>
headius: seriously? heh
<chendo_>
laying down the gauntlet?
<headius>
yes, seriously
<chendo_>
workmad3, headius works on jruby
<chendo_>
he knows things
<workmad3>
chendo_: fair enough :)
<headius>
V8 has nothing on Java for perf, and invokedynamic makes dynamic calls as fast as Java
<headius>
so it's just a matter of getting invokedynamic to do what JS needs
* workmad3
bows out of the fight
<chendo_>
brb
<headius>
I'm working on a prototype of what V8 does, in a very simple form
<workmad3>
I don't know enough about this side of things... I'm under the impression that v8 is a pretty solid, performant implementation of JS, but I don't know many details
<headius>
if not for JS then for some new prototype language for when I don't have enough other stuff to work on :D
ioga_wrk has joined #ruby-lang
<headius>
V8 is definitely good
<headius>
I just have this thing for the JVM
<workmad3>
:)
<chendo_>
headius, can you add docstrings to jruby? :D
<headius>
easily
<chendo_>
sweet
<chendo_>
someone suggested something along the lines of %d{Docs here}
<chendo_>
kinda looks ugly though
<workmad3>
headius: quick question. Are you wanting to avoid current JS implementations on the JVM, or are you already looking at things like mozilla rhino?
gray has joined #ruby-lang
<chendo_>
holy shit, i think i just came up with a way to make python-style docstrings work in ruby
<headius>
%d would be easy to add to parser, but % stuff is still a little ugly to me
<chendo_>
yeah i don't like it
<chendo_>
i only use %Q or %r
<headius>
I don't want to get into a bikeshed about it, buy I have thought of stuff like &"..." and whatnot
<headius>
there's no unary &
<headius>
ruby used up all the good symbols
<headius>
hmmm
<headius>
@@@
<headius>
@@@This is a docstring@@@
<headius>
sorta like triple-quoting
<chendo_>
well yeah
<chendo_>
""" works
<headius>
maybe it's too noisy
<chendo_>
so """ blah """ is valid syntax
<chendo_>
all you need is a parser to get it out
<chendo_>
hold on
<apeiros_>
what purpose does it serve?
* apeiros_
thinks he's missing context…
<matti>
:>
tekin has joined #ruby-lang
<headius>
the reason I wouldn't try to do triple quotes is because ruby already has heinously complicated string parsing
<headius>
for heredocs and the like
<headius>
but I'm not a parser guy
_inc has joined #ruby-lang
<chendo_>
well it's not that bad i'm pretty sure
rue has joined #ruby-lang
<chendo_>
cause """ hello there """" evaluates to "" + " hello there " + ""
<dominikh>
that's hideous :/
<chendo_>
so?
<headius>
heheh
<chendo_>
it'll work
<chendo_>
i'm trying to write a parser for that now lol
<Mon_Ouie>
What about documentation that contains quotes that don't always match?
<chendo_>
theeen it's not so great heh
<chendo_>
use single quotes :D
<Mon_Ouie>
What if a method had an example like… gsub('"', '\\\\"')?
* apeiros_
still doesn't get the purpose of yet another string literal…
<apeiros_>
what would it do that current strings don't/can't?
<Mon_Ouie>
apeiros_: I guess the point is having the syntax for documentation actually be part of the language
<matti>
Hi Mon_Ouie
<Mon_Ouie>
'alut matti ;)
<workmad3>
apeiros_: yeah, it was a discussion about docstrings, python style ):
<apeiros_>
Mon_Ouie: ok, but then why invent something new?
<workmad3>
*:)
<apeiros_>
I mean we already *have* doc tools, which extract "docstrings"…
<apeiros_>
so why not standardize over that? o0
gray has joined #ruby-lang
c0n has joined #ruby-lang
<workmad3>
apeiros_: about the only thing I can think of that a python-style docstring adds is the ability to get it easily within code... however, I think you're right, especially as tools like pry let you get to docs within code and calling .docstring on a method isn't as nice in ruby as it is in python
Eising has quit [#ruby-lang]
<workmad3>
(well, pry lets you get to the docs within the REPL, which is about all the docstring stuff from python is really useful for :) )
<apeiros_>
workmad3: well, I think the use-case for docs accessibility is indeed only in REPL & debugging envs, so it'd be up to those to provide "nice" syntax for retrieval, for anything else, I wish for an inverted way of introspection for a while now
<apeiros_>
i.e. Introspection.instance_variables(object)
<apeiros_>
that'd allow inspecting things like BasicObject instances as well…
<dominikh>
well, and in testing
<apeiros_>
(and docs are just one kind of introspection)
<apeiros_>
dominikh: you mean as in automated testing of examples? or what's the use case there?
<dominikh>
apeiros_: right.
<dominikh>
I think Python/Python test frameworks do that
<chendo_>
Mon_Ouie, won't matter
<chendo_>
because unless the first line after the def method; starts with """
<chendo_>
it won't look for it
<apeiros_>
anyway, my 2 cents @ doc strings: just enhance existing doc comments, e.g. #doc to start a doc comment, I wouldn't hinge that on strings
<chendo_>
mine won't require a syntax change though :D
<apeiros_>
(especially since if you want anything halfway more decent, it'll be a structure anyway, see yard…)
<apeiros_>
chendo_: using comments doesn't either :-p
<workmad3>
dominikh: there are tools that let you run examples in docstrings as test cases... but you could probably do the same with a ruby tool looking at yard or similar
<chendo_>
yeah but that's no fun :p
<apeiros_>
also it gives the opportunity to easily harvest existing docs
<dominikh>
workmad3: true.
ttilley has joined #ruby-lang
<manveru>
does anybody know whether rtomayko has a new nick or something?
achamian has joined #ruby-lang
<shevy>
who is rotomoko
<chris2>
manveru: afaict no
<chris2>
manveru: but havent seen him on irc for a long time
<manveru>
nickserv says he hasn't been around in a year
<chris2>
he also didnt blog for a year :P
<manveru>
he hasn't merged my pull request for two months :P
Indian has joined #ruby-lang
francisfish has joined #ruby-lang
r3dskade has joined #ruby-lang
gianlucadv has joined #ruby-lang
dejongge has joined #ruby-lang
beiter has joined #ruby-lang
<chendo_>
so
<chendo_>
i present: python style docstrings in vanilla ruby
<darix>
chendo_: how do you handle generated code?
batmanian has joined #ruby-lang
<chendo_>
people use docstrings in generated code?
DMKE has joined #ruby-lang
rue has joined #ruby-lang
dr0id has joined #ruby-lang
<Defusal>
10000 calls to Process.getpgid take real: 0.001128
<Defusal>
a lot longer if the pid does not exist, probably because of an exception being raised
<Defusal>
but im very happy with that performance, it means i can poll many pids status very often without an issue
<chendo_>
okay...
pygmael has joined #ruby-lang
<manveru>
chendo_: been there, done that :)
<Defusal>
since EventMachine only supports kqueue for watching pids, which is only supported by OSX and BSD, this is great news for anyone who needs it
<chendo_>
manveru, hmm?
<Defusal>
maybe ruby can have an implementation which does not raise an exception one day, as exceptions are costly
<manveru>
Defusal: ffi?
<Defusal>
manveru, never used that
<Defusal>
i was considering implementing a eventmachine netlink interface for realtime process status updates
<Defusal>
but thats far too much effort, and now that i've benchmarked this, its more than good enough
<chendo_>
what are you writing?
<Defusal>
a daemon that installs, configures, spawns, watches and manages gaming servers
<Defusal>
manveru, cool, but slower than using getpgid
<manveru>
aaww :(
pygmael has joined #ruby-lang
<Defusal>
oh wait
<chendo_>
really?
<chendo_>
mapping to a C function is slower?
<chendo_>
impossible
<Defusal>
ok erll
<Defusal>
well*
<manveru>
well, ruby is mapping to a C function too, but it doesn't do dynamic dispatch i think
<chendo_>
yeah, but it'll throw an exception
<chendo_>
which is slow
<chendo_>
this should be pretty low level and faster
<Defusal>
manveru, it takes the same amount of time regardless of whether it exists or now
<Defusal>
not*
<Defusal>
so thats double as long when it does exist
<manveru>
Defusal: the ruby one?
<Defusal>
but 33.5x faster when it doesn't exist
<Defusal>
the C one
<manveru>
both are C
<Defusal>
well the ffi one
<manveru>
hm
<manveru>
lemme try the fiddle one
<Defusal>
i guess the performance hit is with the dynamic dispatch
<Defusal>
but the speed increase without the exception is cool
<Defusal>
im benchmarking 1 million calls
<chendo_>
i need to use that someday
<Defusal>
when it doesn't exist, stdlib versions takes 6.230000 0.130000 6.360000 ( 6.375920 )
<Defusal>
compared to ffi: 0.180000 0.010000 0.190000 ( 0.190158 )
<andrewvos>
What's a good pattern for launching a process at the beginning of a cucumber test run, ten killing it afterwards. The process is not a binary it's ruby code that has to be executed.
<andrewvos>
So, I don't mean "process" at all
<darix>
chendo_: no. but your code might encounter such thing
<chendo_>
what?
imajes has joined #ruby-lang
<chendo_>
if it doesn't have a source_location
<chendo_>
it will bail
<Defusal>
andrewvos, i'd say fork { require ... }, but you'll have to remember to kill the process afterwards
headius has joined #ruby-lang
<andrewvos>
Defusal: What's the best way to kill it afterwards?
<andrewvos>
Process.kill("KILL",meh) ?
<Defusal>
yeah, 'TERM' should work fine too
<andrewvos>
Defusal: That worked great thank you
<Defusal>
:)
Hakon|mbp has joined #ruby-lang
<chendo_>
you should trap signals etc to ensure that process gets killed properly
<chendo_>
i just thought there was a built in rather to do what i'm doing
<Mon_Ouie>
banister wrote the method_source gem Pry uses to get it
<headius>
I still think .source should just be added to Method and Proc
<headius>
it really wouldn't be hard to add to any impl
<manveru>
i'd be happy getting the arguments :)
<chendo_>
it'll use more memory though
<matti>
manveru: はい、そうです~ では、私は日本語を少しだけ話します。
<manveru>
but that was removed as well :(
<manveru>
matti: それでもたりる
<headius>
a bit more, but it could be compressed
<matti>
manveru: I am at begginer level in Japanese.
<headius>
as it is the AST holds on to almost the entirety of parsed bytes from files in one way or another
<Defusal>
headius, i guess i missed that then, i saw no question, i was just responding to what manveru said to me
<manveru>
matti: my wife is japanese, so we raise our son trilingual
<headius>
so i doubt it would be that much more
<Defusal>
manveru, interesting.. fiddle tried to require 'rails/engine'
<manveru>
the... what?
<Defusal>
i have rails 3.2.2 installed but it fails
<chendo_>
lol
<headius>
Defusal: if you'd like to actually talk about jruby, I'm happy to do so, but I'm satisfied having told manveru that we have DL partially supported in JRuby
<Defusal>
ok, so ffi is great if you need to check pids that may not exist
<Defusal>
but the stdlib version will be fine for watching pids until they disappear
<headius>
the overhead for missing is probably all exception raising
<Defusal>
yup, like my comment says :)
<headius>
comment?
<headius>
wow, fiddle is slow on 1.9.3
<Defusal>
next to that row on the benchmark results
<headius>
it's basically the same on jruby, and a lot faster than 1.9.3
<kke>
how come "foo" "bar" => "foobar"
<headius>
Defusal: ah
<headius>
kke: because shut up
<headius>
:)
<headius>
just one of those oddities in Ruby
<headius>
some other langs probably do it
<Defusal>
oh wow
<Defusal>
something i did not know about ruby :D
<Mon_Ouie>
That's useful in languages like C that don't have that many string literals
<Mon_Ouie>
In Ruby I'd use heredocs more often
<Defusal>
yeah
Joeysomo has joined #ruby-lang
<chendo_>
lol
<chendo_>
i'm abusing that oddity for my docstrings
Progster has joined #ruby-lang
<yorickpeterse>
meh, I personally would just stick with YARD docs
<Defusal>
im so happy i took the time to implement my interactive console over DRb
<Defusal>
makes working on the eventmachine platform a lot either, has coloured output and even autocomplete since its live
<Defusal>
cant compare to any editor, which can hardly ever complete anything, since the code is very dynamic
achamian has joined #ruby-lang
<chendo_>
Defusal, so.. pry-remote?
<chendo_>
which Mon_Ouie wrote
beiter has joined #ruby-lang
<Defusal>
i didn't know there was such a thing, im sure it would have saved some effort
gray has joined #ruby-lang
msisk has joined #ruby-lang
Fullmoon has joined #ruby-lang
<Defusal>
what would be the better option here: store database id in websocket connection instance and query the database everytime you need to interact with the model, or store the model instance and have the model make the cached instance reload everytime it writes to the db?
<Defusal>
i guess the best approach is an identity map and store the id
dv310p3r has joined #ruby-lang
headius has joined #ruby-lang
Sailias has joined #ruby-lang
bglusman has joined #ruby-lang
Tukeke has joined #ruby-lang
Tukeke has joined #ruby-lang
voker57 has joined #ruby-lang
voker57 has joined #ruby-lang
judofyr has joined #ruby-lang
<judofyr>
\o/
mdiedric has joined #ruby-lang
mztriz has joined #ruby-lang
<rue>
pry-remote-em no less.
fvollero has joined #ruby-lang
msisk has joined #ruby-lang
soahccc has joined #ruby-lang
JEG2 has joined #ruby-lang
<judofyr>
rue: interesting
jxie has joined #ruby-lang
mistym has joined #ruby-lang
noru has joined #ruby-lang
io_syl has joined #ruby-lang
outoftime has joined #ruby-lang
achamian has joined #ruby-lang
tekin has joined #ruby-lang
A124 has joined #ruby-lang
DMKE has joined #ruby-lang
rayners has joined #ruby-lang
<Defusal>
hmmm
<Defusal>
anyone know what under circumstances Process.kill('KILL', pid) will fail to kill the process
<Defusal>
i've just noticed it happen again
<rue>
When you use the wrong pid?
<Defusal>
oh that is a very good point :|
<Defusal>
i thought i had fixed the consistency issues
<Defusal>
guess not
<Defusal>
chances are the database just got out of sync while i was testing, hopefully that wont happen again
headius has joined #ruby-lang
<judofyr>
Defusal: sounds fun to debug when suddenly random processes (with recycled pids) gets killed
<Defusal>
indeed :P
<judofyr>
headius: what are your thoughts on the "we need a new (async) Rack" btw?
<Defusal>
im all for an async rack
<headius>
I hadn't heard about it
<Defusal>
neither had i
<Defusal>
but i havn't written a synchronous web application in years
<headius>
I know this has been going around and around in various forms though
<Defusal>
i learnt rails at the same time as ruby, back before rails 2... yet i have hardly used it ever :P
<Defusal>
i still keep up to date with it though, at the very least i can give some of my friends advice on it and gems to use with rails
<Mon_Ouie>
class Micropost < ActiveRecord::Base is just the syntax for inheritance in Ruby
Tukeke has joined #ruby-lang
Tukeke has joined #ruby-lang
<headius>
judofyr: async usually seems to lead people into coroutines
<headius>
because they want the execution stack to maintain state for them
<headius>
there's no way that's good for execution pipelines and memory caches
<rue>
But ASYNC IS FASTER THAN EVERYTHING
<Defusal>
gray, validates is an ActiveRecord helper method, all methods are documented on the above link i gave you
<gray>
judofyr: sorry, don't understand you
<rue>
Also, indeed, #ror
<headius>
rue: I've queued up your comment and will respond asynchronously some time in the future
<rue>
headius: Well, I dispute that
<rue>
headius: OK, I've queued my response
<judofyr>
headius: the truth is, when you have code that works in a purely sync-manner, using coroutines leads to easier-to-read code than state machines…
<judofyr>
headius: (and by "sync" I mean "fetch this thing from HTTP", "then fetch this thing from another place" and "then respond"
<judofyr>
)
<headius>
I exclude IO from my async wrath
<headius>
it's all the other crap people make async that's just silly
<Defusal>
the truth is, when your codebase is heavy on IO, threads are just unnecessary overhead and syncing is unnecessary complexity
<headius>
Defusal: syncing is necessary to use multiple cores on any shared resource
<Defusal>
headius, well thats their own faulty, people will do stupid shit no matter what tools they use
<headius>
async doesn't do crap to change that, either
<judofyr>
headius: aaaah. is this some rant against Celluloid?
<headius>
async just lets you slice your one core into finer chunks
<headius>
judofyr: no, celluloid actually does it right...it uses threads plus fibers
<Defusal>
headius, indeed it is, but you can design the platform with that in mind from the start
<judofyr>
headius: then I wonder where you've seen people doing async wrong…
<judofyr>
(if you're not talking about I/O)
<headius>
fibers are just there to allow worker threads to defer on some IO resource that's not ready
<headius>
judofyr: mostly stuff like ilya's making the entire rails request pipeline async with fibers just so it can defer on database queries
<Defusal>
database queries are still IO
<headius>
yeah, so maybe abstract the logic of sending queries to the database rather than swapping out the entire rails call stack to wait for it
<headius>
post queries to a queue for some smaller worker pool to handle
d3vic3 has joined #ruby-lang
<headius>
no, let's save off 100-odd call frames and swap them out every time
<headius>
that will be fast
<headius>
anyway
<judofyr>
headius: you still need the Rails stack to support asyncness though (you either need callbacks or fibers in the controller
<headius>
I think it's the third drink talking
<headius>
I should get dinner
adambeynon has joined #ruby-lang
dr0id has quit [#ruby-lang]
dous has joined #ruby-lang
outoftime has joined #ruby-lang
andrewhl has joined #ruby-lang
rolfb has joined #ruby-lang
<rue>
Where in the world is headius? India?
<headius>
You never know from day to day
Stalkr_ has joined #ruby-lang
<headius>
tomorrow I might be in Finland
<headius>
impossible to tell
_inc has joined #ruby-lang
<headius>
as it happens, yes, I'm in India
<rue>
Sweet, timezone extrapolation success
<headius>
listening to the wives of relocated american professionals gripe about the room service
<headius>
it's a thrill, let me tell you
dfr|mac has joined #ruby-lang
gray has joined #ruby-lang
wmoxam has joined #ruby-lang
<shevy>
hmmm
morozovm has joined #ruby-lang
rippa has joined #ruby-lang
havenn has joined #ruby-lang
shtirlic has joined #ruby-lang
igaiga has joined #ruby-lang
ridders24 has joined #ruby-lang
<ridders24>
hi all
<judofyr>
hi ridders24
rushed has joined #ruby-lang
mixandgo has joined #ruby-lang
headius has joined #ruby-lang
<ridders24>
is it possible in ruby to give it a .txt input containing colums of data which are part of file names, which is could then search network drive volumes and then produce an html output with the filepath of where that file is?
Indian_ has joined #ruby-lang
<mixandgo>
it's the first time ever I hear about dRuby and there's a book out from pragprog... any advice on what is it good for ? (I am mostly doing web app development with rails)
<headius>
there's a book on dRuby?
<headius>
I think you may be confusing your druby's
<headius>
ok...so dRuby to me means Diamondback Ruby, a research project to statically analyze and optimize Ruby code
Heimidal has joined #ruby-lang
scampbell has joined #ruby-lang
<headius>
so I guess it was my confusion
<mixandgo>
to me it sounds like wannabe nodejs :) but what do I know
<workmad3>
mixandgo: hardly
cdnz has joined #ruby-lang
<workmad3>
mixandgo: node.js is a concurrency model, DRb is a distributed computing model
<mixandgo>
workmad3: so in practice what would you use it for ?
<headius>
node.js is a ball of snot
<Defusal>
mixandgo, i used it a day ago to implement a remote console
achamian has joined #ruby-lang
<headius>
actually I think node is pretty clever, but bashing it is the fashion these days
<headius>
and I loves me some fashion
<workmad3>
mixandgo: I'd probably consider it for a grid-computing style system where I couldn't easily put the problem into map-reduce
<headius>
I still have a hard time recommending ruby for anything compute-intensive
<workmad3>
mixandgo: but basically, the difference between DRb and node.js is like the difference between scaling out and scaling up ;)
<Defusal>
mixandgo, i have a console that executes on my live EventMachine based platform and returns the result and anything output to std streams while its executing, it also colours the output and provides autocomplete by inspecting constants and methods when i press tab
<headius>
though if you're doing compute-intensive and not using JRuby, you're just playing in the dirt
<chendo_>
heh, ruby for anything compute intensive
<Defusal>
its just a easy way to run methods over a network on another ruby process
Jay_Levitt has joined #ruby-lang
<mixandgo>
I think I have a clearer picture now, thanks
<workmad3>
Defusal: well, that's one way to use it if you're not creating a drb cluster anyway ;)
<headius>
everyone should pump everything through Rinda
<headius>
it's the only way to be sure
<Defusal>
workmad3, i try use it as little as possible since the EM implementation of it sucks really badly :(
<Defusal>
and all my apps are EM
<Defusal>
so i only use it to connect to locally spawned processes
<Defusal>
the EM version basically doesn't only fail to reconnect when the connection is lost, but it actually never detects the connection being lost some of the time
<headius>
it's 100% wrong 50% of the time
<rue>
Welcome to TCP/IP
CarlosAkaRubyNoo has joined #ruby-lang
<Defusal>
rue, i have countless tcp protocols implemented just fine with EM ;)
<Defusal>
i spend 80% of my time working with such stuff when im using ruby
kain_ has joined #ruby-lang
<Defusal>
the EM version of DRb just seems to have been abandoned
<Defusal>
and not even after it was stable
<wmoxam>
headius: I'm going to switch a Rails app server to jruby and I want to be able to track the perfomance. Any tips as to what metrics I should track? I'm thinking render time, memory+CPU usage. Anything else?
<chendo_>
newrelic
<chendo_>
best tool for monitoring
<wmoxam>
(basically want to compare if it's worth switching)
slyphon has joined #ruby-lang
<Defusal>
wmoxam, let me know what results you find
* wmoxam
needs to read up on jruby+rails best practices
<wmoxam>
Defusal: I have a suspicion that it really depends on the app
andrewhl has joined #ruby-lang
<wmoxam>
the app that I'm going to try is Rails2+Ruby 1.8.7. I suspect that the results could be different for a Rails 3.x+Ruby 1.9 app
<Defusal>
yeah as far as i know, you'll only start seeing such a big difference if you use parts of the java framework
<Defusal>
but i'd be interested to hear performance and ram usage
<wmoxam>
yeah
<Defusal>
but yeah, 1.8 is many times slower than 1.9
<wmoxam>
Defusal: I've got a surplus of RAM ATM
kitallis has joined #ruby-lang
<Defusal>
should should upgrade to 1.9.3 first
<Defusal>
so do i.. my host gave me 16GB on my 8GB contract
<wmoxam>
as I can't run enough instances to use it (it's pointless to run more instances than cores)
toertore has joined #ruby-lang
<wmoxam>
RAM is super cheap
<Defusal>
yeah it is, but i don't like to waste it on java
<wmoxam>
I bought 8GB for my desktop for like $35
<Defusal>
i have far better things to waste it on :P
<Defusal>
hence why i don't even install JVM on my servers
<wmoxam>
Defusal: I'm totally willing to trade RAM for speed
<chendo_>
wmoxam, oh i wouldn't say it's pointless running more instances than cores
<chendo_>
unless your ruby does no IO whatsoever
<wmoxam>
chendo_: I would
achamian has joined #ruby-lang
<chendo_>
assuming your DB is on another box
<chendo_>
and assuming you're using standard mysql driver (non async)
<wmoxam>
yeah, I thought that too
<chendo_>
a core will be sitting there doing nothing while it waits for IO
<Defusal>
yeah better have a few extra instances since they're threaded
otertore has joined #ruby-lang
<wmoxam>
chendo_: in my testing it hasn't worked out that way
<wmoxam>
:/
<wmoxam>
you mostly end up with processes fighting for CPU time, making all requests slower
Teddy2steper has joined #ruby-lang
<chendo_>
what was your test app doing?
<wmoxam>
it's just a straight up web app
<chendo_>
if it was just a simple app that did nothing but render, then sure, since it's not really doing any IO
<wmoxam>
it was under heavy load
<wmoxam>
(this was a production app)
<imperator>
wmoxam, unless you have a mac, then ram is like $1500 per stick
<chendo_>
only if you bother buying from apple
<chendo_>
which nobody smart does
<imperator>
:-P
<wmoxam>
imperator: lol
* wmoxam
has a mac
* chendo_
too
<chendo_>
wmoxam, what were you using to monitor?
<chendo_>
we run 6 instances on a 2 core machines
<chendo_>
works great
<chendo_>
load stays below 1
<Defusal>
bleh
<wmoxam>
chendo_: this was an 8-core box
<Defusal>
something is making my spawned processes die on signal
<Defusal>
i thought i fixed this yesterday, but perhaps i didn't test manual ^C
<Defusal>
any ideas?
<Defusal>
i am using Process.detach(pid)
<chendo_>
wmoxam, what was the monitoring?
<wmoxam>
chendo_: munin
<wmoxam>
had a couple of boxes
<chendo_>
does it do deep app monitoring?
<wmoxam>
chendo_: I know about New Relic. I've used it before (f that's where you were going)
<chendo_>
yeah
looopy has joined #ruby-lang
<wmoxam>
basically I had one box with 8 instances, and one with 12. The one with 12 couldn't keep up
<wmoxam>
the one with 8 was fine. Same traffic to both (50/50 split)
<chendo_>
all depends on the app
<chendo_>
if your app doesn't do much IO, then it may well use more CPU time
<wmoxam>
rendering time > db time. :p
<chendo_>
lol
<chendo_>
well then
<Defusal>
render less?
<chendo_>
his point is that his app doesn't do much DB
<wmoxam>
...
<Defusal>
yeah :P
<wmoxam>
most of the traffic, yes
tr-808 has joined #ruby-lang
<wmoxam>
chendo_: you run the db on the same box?
<chendo_>
lol hell no
<wmoxam>
k, :D
<wmoxam>
yeah, that'll kill your box pretty quick :D
<chendo_>
step 1 of scaling: move db onto its own box
jmfcool has joined #ruby-lang
darkf has joined #ruby-lang
<wmoxam>
chendo_: I do a lot of stuff asyncronously
<chendo_>
nice
<chendo_>
threads?
<wmoxam>
queue + queue runner
<wmoxam>
seperate box
<chendo_>
i was thinking of doing my next app SOA
<chendo_>
a service for every part of the system
<Defusal>
wmoxam, you should look at moving the heaviest async stuff to an EventMachine platform
<chendo_>
rofl
<wmoxam>
Defusal: why is that?
<chendo_>
Defusal, EM is not your hammer
<chendo_>
well, not a hammer
<andrewvos>
How do I change the http host used in rack test?
<Defusal>
well, im assuming by "queue runner" you mean threaded
<chendo_>
so yeah, then in the web app itself, when you want something, you fire off the request in a thread, then wrap it in a future
<chendo_>
Defusal, it can be on another machine
<chendo_>
slash a cluster
<wmoxam>
Defusal: no, I mean a service that sits there and watches the queue for jobs to do
<Defusal>
it'll still scale better on the other machine if its EM based
<wmoxam>
and then does them
<chendo_>
why?
<chendo_>
why will it scale better?
<Defusal>
wmoxam, yeah well a threaded service
* wmoxam
blinks
<Defusal>
well again, it depends on the type of work
<chendo_>
wmoxam, i know, right?
<wmoxam>
there are no threads involved
<Defusal>
i guess i bad a bad assumption
<Defusal>
when he said he does a lot of stuff async
<Defusal>
i assumed that is IO
<wmoxam>
sure it is
<Defusal>
im guessing now it is not
<Defusal>
well then it will scale better with EM
<chendo_>
wat
<wmoxam>
like when I need to send an email I do it async
<chendo_>
reasons, Defusal
<chendo_>
use them
<Defusal>
faster, less overhead
Hakon|mbp has joined #ruby-lang
<wmoxam>
when I need to make calculations for a reporting table, I do it async
<chendo_>
when all you want is a distributed job processing system
<wmoxam>
basically anything that's not needed to service a request I do it async
<chendo_>
you wouldn't go straight to EM
<Defusal>
calculations are not IO, so if they are very heavy then threading is better of course
<chendo_>
cause that's a waste of time
<wmoxam>
lol
<chendo_>
lol
<Defusal>
chendo_, if you say so
<Defusal>
i start with EM
<chendo_>
Defusal, have you ever worked on a big production environment?
<Defusal>
and use threads later if heavy processing is needed
<wmoxam>
Defusal: are you an EM sales person?
<wmoxam>
WHAT ARE YOU TRYING TO SELL ME? ;)
<chendo_>
well, sizable production environment
<Defusal>
chendo_, yes, i designed it, EM based :P
<Defusal>
that was a while ago already
<chendo_>
how many servers?
<Defusal>
that depends how far up they are scaled
<chendo_>
how many physical servers?
<chendo_>
or virtual
<Defusal>
i was just contracted out for a few months to design and develop the backend and an interface to the frontend
<Defusal>
back then it was still beta, they'll have a few servers by now
<Defusal>
wmoxam, don't mind me, i just have a strong hatred towards using threading for IO-heavy stuff
<chendo_>
…. what?
<Defusal>
i hate unnecessary overhead
<chendo_>
why?
<Jay_Levitt>
Any Sublime Text 2 users? I just updated from 2189 to 2190 on Mac and now ST crashes at startup when the Ruby package is installed.. and the sublime forum is down :/
<Defusal>
same reason i hate bloated frameworks and languages
<wmoxam>
Defusal: I'm not threading anything
<Defusal>
wmoxam, yeah ok, well then you're doing one thing at a time i guess
<wmoxam>
unless you have a totally different definition of threading than I do
<Defusal>
in which case, if speed isnt an issue, it doesnt matter
<chendo_>
yeah i'm also confused
<chendo_>
there's nothing wrong with using threads for IO
<Defusal>
chendo_, keep telling yourself that :P
<Defusal>
theres a reason all the best scaling servers are async
<Defusal>
and there are many
<Defusal>
same reason i would never use apache, but nginx is awesome
<Defusal>
it uses a tiny fraction of the ram, and scales to the moon
* wmoxam
wanders off to be productive
<Defusal>
all the large platforms that were designed with scaling in mind scale perfectly well
<Defusal>
you just have to know how to approach scaling
* Defusal
goes back to getting nowhere with debugging this child process spawning
<chendo_>
Defusal, yeah i think you mean evented when you mean async
<Defusal>
yeah, i do
<Defusal>
it is often used in place of evented, so i guess i have picked up a bad habbit over the years
wallerdev has joined #ruby-lang
<Defusal>
my first async experience was hacking a windows scripting language to use winsock with windows gui events for sockets
<Defusal>
evented*
<Defusal>
a while after that i worked with a plain C evented game server, implementing new protocol that i reverse engineered
<Defusal>
but since moving from python and other languages to ruby, i use EM for almost every project, twisted just wasnt as nice
<chendo_>
so the thing is, most people don't like reinventing the wheel
<chendo_>
there's no real point for wmoxam to use EM because it's more work then necessary
<chendo_>
delayed job or resque will scale perfectly well and easily
<chendo_>
if you're looking for super duper ricing performance, then don't use ruby
<Defusal>
yeah well, it depends on many things
<Defusal>
but yeah, if you're not familiar with async evented architecture, the learning curve is gonna be too much of a pain
<chendo_>
it's not even the learning curve
<chendo_>
it's the actual effort required to implement it
<chendo_>
why not just use a job queuing system when you want one?
<chendo_>
unless it doesn't do something you want
<Defusal>
well for most of my personal platforms, they are a single application, so queuing jobs and getting data back after they are completed would be a lot more effort than using a single EM platform
<Defusal>
but mostly, what i do 90% of the time is IO-related
<Defusal>
and EM scales great with IO, has little overhead and doesn't require syncing
<chendo_>
so with your EM platform, does each part run in its own process?
<Defusal>
like i just said, most of my personal projects are a single EM reactor
<chendo_>
what about production?
<chendo_>
like apps that make money
<Defusal>
if it needs to scale more for ajax requests or something, seperate requests can be moved to a second reactor
<Defusal>
and so on
tsp has joined #ruby-lang
<chendo_>
is any of your EM stuff tested?
<Defusal>
of course...
tsp_ has joined #ruby-lang
mixandgo has joined #ruby-lang
ridders24 has joined #ruby-lang
<ridders24>
Im totally new to ruby, When i try and run this but of code http://pastie.org/3642271 I get the error "undifined method 'find' file:class <nomethoderror
khan12345674000 has joined #ruby-lang
khan12345674000 has quit [#ruby-lang]
thrcka has joined #ruby-lang
sandbags has joined #ruby-lang
jstemmer has joined #ruby-lang
<Defusal>
ok looks like i have finally pinpointed the issue
<Defusal>
even with Process.detach, the signals are being forwarded to the spawned process
rolfb has joined #ruby-lang
<Defusal>
does anyone know how to stop this? i'm already trapping the signals in the daemon so that it can exit cleanly
H2H has joined #ruby-lang
Indian has joined #ruby-lang
<Defusal>
i suppose i could try using a small ruby script that is spawned, which does the spawning and returns the actual processes id
<Defusal>
pid*
<Defusal>
but that should be unnecessary.. hopefully someone knows how to stop this behaviour
<rue>
Are you sure it's that way?
<Defusal>
i replaced the process with a ruby -e script rue
<Defusal>
if that script uses trap("INT", "IGNORE"); it is not killed when the daemon that spawned it traps a signal
Teddy2steper has joined #ruby-lang
<Defusal>
i'll be back in a bit, if anyone can think of anything else i can try, please let me know
achiu has joined #ruby-lang
<rue>
No, I mean that signals shouldn't be getting to a detached child
<rue>
So either you're not signaling right, or you're misinterpreting the problem
havenn has joined #ruby-lang
solars has joined #ruby-lang
io_syl has joined #ruby-lang
darkf has joined #ruby-lang
jmontross has joined #ruby-lang
butchanton has joined #ruby-lang
hagabaka has joined #ruby-lang
hagabaka has joined #ruby-lang
Tukeke has joined #ruby-lang
apeiros_ has joined #ruby-lang
mrneighborly has joined #ruby-lang
<Defusal>
rue, hence the test i described to you..
ascarter has joined #ruby-lang
Tukeke has quit [#ruby-lang]
mrneighborly has joined #ruby-lang
<Defusal>
the signal is definitely reaching to detached process, an only on ^C not when the daemon is killed in other ways
<Defusal>
so Process.detach does not actuall detach signals :(
deryl has joined #ruby-lang
<Defusal>
rue, i will make you a test case, since you don't believe me
<Defusal>
and anyone else who is interested, or may have some idea for a workaround
<Defusal>
still appears to me as if Process.detach is bugged
mrsolo_ has joined #ruby-lang
havenn has joined #ruby-lang
mssola has joined #ruby-lang
Tukeke has joined #ruby-lang
achiu has joined #ruby-lang
wallerdev has joined #ruby-lang
jasiek has joined #ruby-lang
malev has joined #ruby-lang
vpamulap has joined #ruby-lang
urbanmonk has joined #ruby-lang
Tukeke has quit ["Hackers and Workers of the World! Unite!"]
<rue>
.detach isn't the same as your typical double-fork detach, I think
<Defusal>
rue, well then, what is the solution?
<Defusal>
i need the pid, and i can't make the server binary that is spawned trap and ignore signals... so then the only way is to spawn a proxy script with traps signals, spawns the real process and returns its pid?
<Defusal>
*that traps signals
tbuehlmann has joined #ruby-lang
<Asher>
i'm confused what doesn't work with the standard approach?
<Defusal>
if that is the case, it is a pity ruby has no way to accomplish that
<Defusal>
i think Process.detach is just flawed and should be detaching those signals
<Defusal>
but either way, i need a workaround
<rue>
The .detach description clearly says what it does
joshkraemer has joined #ruby-lang
<Defusal>
rue, well then what is the best workaround you can suggest?
<Defusal>
a proxy ruby process?
<Asher>
i'm looking for code where i did similar recently give me a sec
<Defusal>
ok
havenn has joined #ruby-lang
<rue>
I'm really not sure this is even a fundamentally sound technique. It sounds like you have ever-increasing problems from trying to force an unsuitable solution
<rue>
But I haven't really been paying attention, sorry. I'm preoccupied by the airbender currently
<Asher>
so you want child processes to detach such that when the parent process ends they continue?
<Asher>
is that the issue?
publicvoid has joined #ruby-lang
francisfish has joined #ruby-lang
<Defusal>
Asher, yes, but specifically when the parent is killed with SIGINT
<rue>
Double-fork is the usual solution
<Defusal>
because Process.detach works, until i ^C
<Asher>
well if you trap INT before you fork then obviously both processes will trap the signal
<Defusal>
Asher, look at my test case :|
<Asher>
i am
<Asher>
you are forking on the signal
<Defusal>
rue, then a proxy script is the best solution
<Defusal>
since i need the pid
<rue>
How about pidfiles?
<Defusal>
Asher, that is for proving the process exists later
<Defusal>
please try actually read the whole testcase :|
<Asher>
i mean i set up a program recently that you load the main program, launch subprocesses, quit
<Asher>
the subprocesses continue
<Asher>
and i store a pidfile (although it's actually a yaml file w/data including the pid)
<rue>
Asher: That's not a problem if the processes are properly detached. In that case, signaling the parent has no effect on the child
<Asher>
right - so what prevents that here?
<Defusal>
rue, worse than a proxy process... the pids are stored in a database, almost identical instance can be spawned
<Asher>
i used Process.detach to achieve that
<Defusal>
Asher, run my test case and press ctrl + c
<Defusal>
and you will see exactly what the problem is
<Defusal>
like i said Asher, if you use Process.detach, the child continues after the parent exits, but if you sent the parent SIGINT, it is still forwarded to the children
<Defusal>
i'll go with a proxy spawner script then, looks like there is no better solution
Indian has joined #ruby-lang
tekin has joined #ruby-lang
Heimidal has joined #ruby-lang
Gekz has joined #ruby-lang
Gekz has joined #ruby-lang
ericmuyser has joined #ruby-lang
<countskm>
was wondering if someone might give me feedback what im doing wrong:
<uniqanomaly_>
ArgumentError: wrong number of arguments (1 for 0)
<uniqanomaly_>
from (irb):1812:in `floor'
<uniqanomaly_>
from (irb):1812:in `read'
<uniqanomaly_>
from (irb):1899
<uniqanomaly_>
from :0
<uniqanomaly_>
1.8.7-p352 :1900 > data.read
<uniqanomaly_>
ArgumentError: wrong number of arguments (0 for 1)
<uniqanomaly_>
rotfl
<Defusal>
uniqanomaly_, please read the topic before spamming the channel
tekin has joined #ruby-lang
<uniqanomaly_>
k
ericmuyser has joined #ruby-lang
<uniqanomaly_>
syntax error ;>
<Defusal>
ok so rue, i can't even get this to work
benanne has joined #ruby-lang
<Defusal>
if i don't use Process.detach on the spawner proxy script, it goes defunct until its child process ends, if i do use it, EM doesn't fire the callback for EM.system once the proxy process ends and the event only fires when the application is shutting down :|
<Defusal>
if anyone has any ideas, i'm all ears :|
<Defusal>
i mean, i could make a DRb interface for the proxy script to connect to, but goodness, i really don't want to.. the proxy script is bad enough as is
ridders24 has joined #ruby-lang
<ridders24>
hi all
<ridders24>
anybody know how I get file.find to provide an output?
fukushim_ has joined #ruby-lang
ericmuyser|air has joined #ruby-lang
Phrogz has joined #ruby-lang
<Phrogz>
What is the ~least amount of code (without golfing) I can write to get a web server up that only serves static files from a directory?
<apeiros_>
Phrogz: about 5 lines was mine, using webrick
brianpWins has joined #ruby-lang
<apeiros_>
there's faster servers around for ruby nowadays, though
<Phrogz>
Damn; I'm looking for a one-line to kick off the command line.
curtism has joined #ruby-lang
curtism has joined #ruby-lang
<apeiros_>
write a gem? :)
davpoind has joined #ruby-lang
Torrieri has joined #ruby-lang
<Phrogz>
:)
<Phrogz>
I'm assuming it will involve Rack::Directory, but I only use Rack indirectly through Sinatra and Thin; I have no idea how to boot up the simplest possible Rack app and "go".
<Phrogz>
This yak-shaving brought to you by my persistent desire to not do the work I so desperately need to do.
<Phrogz>
...and Chrome's sucktaculor/"safe" inability to perform XHR over file://
<Phrogz>
apeiros_: I just need to serve some files from various directories and shaving this yak and having this in my command history is more informative than writing or relocating a mini ruby file.
<apeiros_>
Phrogz: as said, write a gem then and install it
<apeiros_>
call it something mnemonic, like serve, or servedir
<Phrogz>
That's an uninteresting and lumpy yak in my opinion :)
<Phrogz>
But I appreciate your advice.
<apeiros_>
pffff
<apeiros_>
actually… might be a nice hack-night adventure for next wednesday
<apeiros_>
write a small rack-serverpages based gem
Austin__ has joined #ruby-lang
<Phrogz>
That would be nice to have around in the wild. :)
<apeiros_>
yeah, I imagine something like `rackdir` to serve the current directory, interpreting a couple of suffixes, have a flag like '-p, --plain' to stop it from interpreting anything
<Defusal>
rue, i've ended up having to replace EM.system(cmd) {|output| } with EM.defer { output = `#{cmd}`; EM.next_tick { pid = output.to_i; do_stuff_with(pid) } }
<Defusal>
and "cmd" spawns a ruby -e process which ignores sig INT, spawns the actual process, detaches from its pid and then prints the pid
<Defusal>
one hell of a mission to spawn and properly detach from a process
<Defusal>
and i hate to have to use another thread, but at least it works :/
<Defusal>
hopefully ruby will have better support for properly detaching from spawned processes one day
dejongge has joined #ruby-lang
justinmcp has joined #ruby-lang
dejongge has joined #ruby-lang
pygmael has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
Indian has joined #ruby-lang
Indian_ has joined #ruby-lang
crudson has joined #ruby-lang
paul0` has joined #ruby-lang
batman has joined #ruby-lang
<Guest51966>
hello?
<imperator>
yes, this is internet
<mistym>
welcome to internet!
<apeiros_>
what what what?
<apeiros_>
damit! I thought I was on the tubes!
* apeiros_
goes away
<rue>
Hello, Internet residence, random dude speaking
mrsolo_ has joined #ruby-lang
mrsolo_ has joined #ruby-lang
gaivs has joined #ruby-lang
<Guest51966>
i'm stuck
<mistym>
Guest51966: What's the issue?
<epitron>
physically or mentally
<Guest51966>
trying to do a exercise
<epitron>
and you got stuck in the exercise equipment?
<Phrogz>
So...physically
<Guest51966>
for a tutorial i was going through
* epitron
gets some lard
<Phrogz>
Damn weekday warriors.
<Guest51966>
on ruby
<gaivs>
hello world
<Guest51966>
it's a grandma application
<epitron>
hello! internet speaking. how may i direct your call?
<Phrogz>
Guest51966: Don't mind the side chatter; keep on asking your question.
<epitron>
(hat-tip to rue)
masterkorp has quit ["WeeChat 0.3.2"]
<Guest51966>
well it says i have to say bye 3 times before the application quits
<Guest51966>
i can't figure out how to do it
<Phrogz>
Guest51966: 3.times{ puts "bye!" }
<epitron>
unless you mean, the user has to type 'bye' 3 times
<Phrogz>
Oh :)
<Guest51966>
it says 3 times in a row
<Phrogz>
That does sound like a grandma application
<Guest51966>
lol
<Guest51966>
i can give the link
<Guest51966>
to the website if you want
<Phrogz>
Guest51966: have a variable "bye_count". Each time the user says something other than "bye", set it back to 0. Each time they say bye, bye_count += 1
<Guest51966>
hmmm
<Guest51966>
ok
<Guest51966>
thanks
<Guest51966>
i'll give it a go
simon_weber has joined #ruby-lang
<epitron>
there are many ways to do this example
<epitron>
you'll probably hit upon a few weird ones :)
<gaivs>
Hello people. I searching for a library for statical analysis of Ruby Code. I.e., an ruby library that parses a ruby code and try to identify his classes, fuctions, et cetera. I didn't find it anywhere. Someone can help me?
<epitron>
also it's broken
<Guest51966>
oh
<manveru>
gaivs: ripper
<manveru>
gaivs: ruby stdlib
<Guest51966>
so what does += mean?
<Phrogz>
Guest51966: x += 1 is x = x + 1
<manveru>
x += y is like x = x + y, also see *= and /=
<Guest51966>
say = gets.chomp
<Guest51966>
while say != "BYE"
<Guest51966>
if say == say.upcase
<Guest51966>
puts "NO, NOT SINCE 1938!"
<Guest51966>
say = gets.chomp
<Guest51966>
else
<Guest51966>
puts "HUH?! SPEAK UP, SONNY!"
<Guest51966>
say = gets.chomp
<Guest51966>
end
<Guest51966>
end
<epitron>
hahah
<Guest51966>
that's what i got so far
<Phrogz>
Here's another way to check to see if the last three inputs are "bye" :) history = []; loop{ history << gets; ... exit if history.last=="bye" && history[-3,3].uniq.length==1 } :)
<Phrogz>
Guest51966: In the future, please do not paste more than 2-3 lines of code in the channel.
<Guest51966>
ok sorry
<epitron>
Phrogz: oooooooo.. i like that one :)
r3dskade has joined #ruby-lang
<epitron>
Guest51966: we also lost all the indenting
<mistym>
Guest51966: No worries. There are websites that are good for that, like gist.github.com and pastie.org
<manveru>
yeah, düsseldorf is just like 5 hours from here
<rue>
manveru: Do you know Peter Schmidt? He lives in Bavaria
<manveru>
rue: do you know hans söllner?
<rue>
I'm sure I do
<manveru>
hm, more like 7 hours :(
<manveru>
rue: and i have no idea who peter schmidt is... sounds like there must be 500 of him
<rue>
I didn't like Düsseldorf much, but München is great. And Frankfurt(-am-Main) isn't too bad either
<rue>
manveru: ;)
<imperator>
manveru, train an option?
<rue>
Though that's only marginally “southern”
<manveru>
imperator: i think i have to go into that area for work anyway
<manveru>
will see
chimkan_ has joined #ruby-lang
* imperator
downloads the latest haiku .iso
<imperator>
manveru, does "begeistart" mean something else and i've missed a joke? i get no translation for it
<imperator>
(or geistart)
Stalkr_ has joined #ruby-lang
mixandgo has joined #ruby-lang
<rue>
Geist is a spirit
tekin has joined #ruby-lang
Stalkr_ has joined #ruby-lang
msisk has joined #ruby-lang
<rue>
Which doesn't really help
<imperator>
yeah, i translated begeistert as "Be Haunt" :)
<rue>
Could be haunted
<rue>
Actually that would be -ert
<rue>
(If it were)
<rue>
Languages are great.
canton7 has joined #ruby-lang
imperator has joined #ruby-lang
<imperator>
reboot complete, computer now fully operational
woollyams has joined #ruby-lang
gregf has joined #ruby-lang
<rue>
imperator: IRCing from Haiku, then?
malev_ has joined #ruby-lang
<imperator>
nope, had to install an osx update....HAD TO
<drbrain>
imperator: that damned webkit is in everything ☹
<Phrogz>
Sense, it makes none.
<Phrogz>
Version your shit, link to the right version on launch. Or something.
<Phrogz>
(Implementation details are left as an exercise to competent engineers.)
<apeiros_>
imperator: begeistart is probably a misspelling of begeistert
<apeiros_>
which means excited
<rue>
Spirited
<drbrain>
Phrogz: for a security fix, I'm happy knowing that all exploitable versions are no longer running
<drbrain>
Phrogz: waiting for launch for other updates would be fine with me
<Phrogz>
Oh. Well, yeah, for that.
<apeiros_>
na, spirited is semantically futher away I'd say
<apeiros_>
ethused/enthusiastic/excited is more in the sense of the common use of begeistert
<imperator>
drbrain, webkit? who? what?
<rue>
apeiros_: I mean in the sense of a "spirited speech". It's close enough that there's probably a common root
<drbrain>
imperator: on OS X, webkit renders HTML, and many processes use it since it's a very flexible and fast way to create a UI
s0ber_ has joined #ruby-lang
y3llow_ has joined #ruby-lang
<imperator>
drbrain, ah, thanks
<apeiros_>
any good classes/modules to handle versioned ruby objects, with the ability to "travel in time", i.e. get the object back into the state of a given moment?
<rue>
Someone did a functional lib that had that implemented for some things (to support immutable data structures), but that was a long time ago…
<rue>
apeiros_: Is this data only or data, methods[, visibility, …] ?
<apeiros_>
oh, data only
rdavila has joined #ruby-lang
<apeiros_>
it's sufficient if it works for a plain {string => string/int} hash
<rue>
So basically def set_something(smth); @smth << smth; end; def get_something; @smth.last; end ?
<rue>
apeiros_: Interesting. And needs to be fast enough that versioning on(to) disk won't work?
<apeiros_>
I currently have no performance expectations
<rue>
Actually, I wonder if anyone's made an in-memory version of git
Austin__ has quit [#ruby-lang]
}0 has joined #ruby-lang
<apeiros_>
hm, that's actually an additional problem. keeping that completely in-memory doesn't scale. the dataset is relatively small (a couple of dozen KB, which ruby naturally inflates to a one digit MB number), but since the data could easily be used over a decade…
<apeiros_>
soooo… kiss and deal with the scale problem later? or overengineer and have a perfect solution that can be left untouched for decades? :)
<rue>
I'd probably go with the former with the “twist” of just gitting it ;)
<apeiros_>
the bigger problem is probably that traveling in time over the whole dataset will be expensive… so I can either work with snapshots (I happen to know that the data currently is only updated monthly anyway), or I keep deltas…
<apeiros_>
or I could go with a combination
<apeiros_>
so you have a maximum of deltas to apply…
<epitron>
apeiros_: how about just keeping the current versions in memory, and putting the old version on disk.. w/ deltas
<apeiros_>
oh, I guess I just figured out, why they provide a sequence number, by which the changes have to be processed. foreign-key integrity…
<apeiros_>
epitron: yeah, that'd be towards "overengineered perfect first try" :)
<epitron>
really? :)
<epitron>
the deltas shouldn't be too hard to generate
<apeiros_>
sure. mixed approach >> more complex than >> single mechanism
<epitron>
you can just override the []= method on hash
<epitron>
and update() i suppose
<apeiros_>
I have custom classes already, so that's not a big deal
<apeiros_>
I mean, I don't have to go extend hashes
<apeiros_>
and yes, generating deltas is trivial
<epitron>
oh man
<epitron>
you could do this really easily with json
<epitron>
it would be very fast too :)
<apeiros_>
eeeeew
<apeiros_>
and, eh, no, you couldn't
<epitron>
your revisions would be a textfile where each line is a json hash
<apeiros_>
json can't even represent date/time
<epitron>
and if you want to go back in time, you'd do "reverse_each" on the file :)
<apeiros_>
lol, ok…
<epitron>
and if you need to access specific revisions, you can generate a secondary index file
<apeiros_>
wouldn't quite work out ;-)
<epitron>
BTree style
<epitron>
BDB
<epitron>
well, the serialization is a problem
<apeiros_>
I think I'll go with custom implementation, in-memory only. I can add "swapping" later
<epitron>
but you said you wouldn't mind { "string"=>int/string}
<apeiros_>
(famous last words)
<epitron>
haha
<rue>
epitron: You're well on your way to implementing a DB, good work :P
<epitron>
hahaha
<epitron>
well, the reverse_each thing is pretty easy
<epitron>
the whole thing, without Btree indexing, would be pretty short
<epitron>
i'm just thinking of a structure that would be really fast to update, and fast to roll-back
<epitron>
you can't beat appending to flat files for speed
<epitron>
and reverse_each is quite snappy
Nisstyre has joined #ruby-lang
<epitron>
i bet tokyo cabinet would be good if you want to use some kind of marshal database
rolfb has joined #ruby-lang
Guest48483 has joined #ruby-lang
srbartlett has joined #ruby-lang
<martha>
hi
<imperator>
hi martha
<drbrain>
hi martha
<martha>
I'm learning ruby and I'm trying to figure out how to do something,but I'm not sure how to call it
<RickHull>
it's surprising because Foo::Bar::Razz::X has a value
<drbrain>
RickHull: yeah
<rue>
apeiros_: I'm not sure ‘timeshift’ is the best name (although presumably people using it will know what it's about)
<apeiros_>
rue: better names welcome… I find naming stuff always the hardest thing…
<apeiros_>
how about Historizable?
<RickHull>
2 hardest things in CS: cache invalidation, naming things, and off by 1 errors
<rue>
I'd just call it versioned
<rue>
Well, maybe. I guess that's a little vague about the time aspect
<apeiros_>
was just going to say
<apeiros_>
the navigation is time based
<apeiros_>
with versions, you usually deal with revision-numbers or tags or somesuch
<Asher>
time slip!
<imperator>
apeiros_, primer ;)
<rue>
Dateable :)
<apeiros_>
rue: it's not a girl!
<apeiros_>
imperator: hu?
<rue>
Could be a boy
postmodern has joined #ruby-lang
<imperator>
apeiros_, it's a movie that involves time travel
<apeiros_>
imperator: ah
<imperator>
low budget, but pretty good, popular and brain burning
<apeiros_>
yeah, low budget & successful usually means good story
<rue>
I think I'd still go with versioned since the date is (I think?) incidental in that it's not the determining factor when the version is created, it's the other way around
<rue>
But, given that a user will already know what they're getting, I think Timeshift is fine
woollyams has joined #ruby-lang
msisk has joined #ruby-lang
JEG2 has joined #ruby-lang
boxmo has joined #ruby-lang
NOKAH has joined #ruby-lang
WillMarshall has joined #ruby-lang
Tearan has joined #ruby-lang
RickHull has quit [#ruby-lang]
igaiga has joined #ruby-lang
ericmuyser has joined #ruby-lang
RickHull has joined #ruby-lang
<imperator>
hm, looks like "timecop" is open ;)
<apeiros_>
hm? timecop gem exists, no? at least I use it :)
<apeiros_>
it's quite nice for testing
Carnage\ has joined #ruby-lang
}0 has joined #ruby-lang
nofxxx has joined #ruby-lang
takaokouji has joined #ruby-lang
mackk has joined #ruby-lang
boxmo has joined #ruby-lang
Jay_Levitt has joined #ruby-lang
qpingu has quit [#ruby-lang]
Dreamer3 has joined #ruby-lang
phlipper has joined #ruby-lang
knightMBP has joined #ruby-lang
<cored>
which json engine do you guys prefer to use
<cored>
I'm using multi_json but I want to elimiate the warnings
<rue>
Warnings schmarnings
bryancp has joined #ruby-lang
andrewhl has joined #ruby-lang
<drbrain>
cored: I use the one that comes with ruby
Hakon|mbp has joined #ruby-lang
<cored>
drbrain: ok, thanks
<drbrain>
cored: also, I never use #to_json
<cored>
active resoure is the one that use it
<drbrain>
JSON.dump
<drbrain>
4life
<rue>
You misspelled lyf
<rue>
cored: Seriously, though, users should never run -w (except when debugging)
<rue>
Structured warnings would make that easier, of course.
<drbrain>
rue: I'm too busy programming to be gangsta
<rue>
Good point, it takes a lot of work to achieve the correct level of sloppiness
mrsolo_ has joined #ruby-lang
bglusman has joined #ruby-lang
rushed has joined #ruby-lang
tomzx has joined #ruby-lang
tekin has joined #ruby-lang
<imperator>
structured warnings!
<rue>
Senior Warning Architect
<imperator>
at least there's a gem for it
<rue>
Is there? Hm, I think it was someone that wrote that one