ChanServ changed the topic of #ruby-lang to: Ruby 1.9.3-p125: http://ruby-lang.org | Paste >3 lines of text on http://pastie.org or use a gist
gregmore_ has joined #ruby-lang
tevren has joined #ruby-lang
io_syl has joined #ruby-lang
<erikh> oof
<seoaqua> zenspider, thanks, but chrome is able to open it, so that's a trick ?
<niklasb> seoaqua: chrome is just too smart for its own good.
<zenspider> seoaqua: just because chrome can open in doesn't make it a uri
rdavila has joined #ruby-lang
<seoaqua> zenspider, ok got it :(
<seoaqua> zenspider, so the only format of % stings are %[0-9A-F]{2} ?
jakko has joined #ruby-lang
srbartlett has joined #ruby-lang
peppyheppy has joined #ruby-lang
peppyheppy has quit [#ruby-lang]
shevy has joined #ruby-lang
slyphon has joined #ruby-lang
Clordio has joined #ruby-lang
srbaker has joined #ruby-lang
Tearan has joined #ruby-lang
jtoy has joined #ruby-lang
gregmore_ has joined #ruby-lang
srbaker has joined #ruby-lang
renato has joined #ruby-lang
srbaker has joined #ruby-lang
Swimming_Bird has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
Radium has joined #ruby-lang
jmcphers has joined #ruby-lang
ryanf has joined #ruby-lang
kensei has joined #ruby-lang
jmcphers has joined #ruby-lang
tomzx has joined #ruby-lang
shtirlic_ has joined #ruby-lang
spuk has joined #ruby-lang
jstr has joined #ruby-lang
jakko has joined #ruby-lang
jakko has joined #ruby-lang
<Xzyx987X> this is perhaps not even a ruby specific question, but what is the best way in ruby to create a file that will be deleted when closed? it only has to work on *nix, but it would be nice if it worked in windows too
<erikh> ri Tempfile
dumfries has joined #ruby-lang
<Xzyx987X> that doesn't work because I need to be able to control the file name. I also need to make sure it is deleted exactly when it is closed and no later. I don't think tempfile does that
<Xzyx987X> what I am really trying to do here is create a class that will allow me to lock objects across seporate processes based on an id. maybe there is a better way to go about it, but file locks were the first thing I thought of
jarred has joined #ruby-lang
jmcphers has joined #ruby-lang
jakko has joined #ruby-lang
dumfries has joined #ruby-lang
seanstickle has joined #ruby-lang
<bnagy> how about Tempfile?
<bnagy> did you look at Regexp.union?
<bnagy> what does 'locking objects' mean?
<bnagy> in general, using the filesystem is about the worst approach you could take to interprocess comms / sync
<heftig> Xzyx987X: delete the file immediately after you open it
<heftig> ah, nevermind, you need locking and not tempfiles
dumfries has joined #ruby-lang
<heftig> where does that object come from? if it's from a database, use the database's locking mechanisms
<heftig> if it's associated with a file, use flock
<Xzyx987X> bnagy, I agree it's bad. it would make ten times more sense to do this any number of other ways. except for this particular project, I can't run an external process to manage the locks in any way, and I'm trying not to rely on anything platform specific
diegoviola has joined #ruby-lang
<Xzyx987X> using flock is my current plan, but it still leaves me with a bunch of stray lock files, since a very common case for losing a lock would be the program exiting
<heftig> on exit, try to grab an exclusive lock on the file. if it succeeds, delete it.
<heftig> (other programs should keep a shared lock on the file as long as they're interested in it)
<Xzyx987X> is there a way I can run a code on exit without putting it at the end of the script though? this code is for a library, it is not a script unto itself
<Xzyx987X> I don't want to add an annoying extra call at the end of every script as a requirement for using the library
<Xzyx987X> if it comes to that, I could just add something that prunes dead locks when the script gets opened
<bnagy> libraries shouldn't try to do finalizers etc imho
<Xzyx987X> it's better than nothing I guess
<bnagy> just have a #destroy method or whatever
<Xzyx987X> how would said method get called?
<bnagy> if you really, srsly, can't make your methods self contained and nonleaky
<bnagy> leaky_obj.destroy
<heftig> clean up locks in "ensure" blocks
<Xzyx987X> so how do I call that when the application exits, including if that exit was triggered by an exception?
<bnagy> that's what I'm saying - don't do that
<heftig> what?
<heftig> it wouldn't violate self-containment
<bnagy> at_exit in libraries is ugly, and ime not reliable
<heftig> i'm not talking about at_exit or finalizers
<heftig> just ensure
<bnagy> oh, I completely agree with that
<bnagy> methods should be self-contained and nonleaky
<Xzyx987X> like I said, I think just cleaning up the locks when the script is loaded is the only thing that will work if I don't have a delete on close flag for opening files
<Xzyx987X> at least the only thing that is 100% foolproof
<bnagy> Xzyx987X: heftig said before - if you unlink it right away it will vanish when the last process holding a handle goes away
<Xzyx987X> oh, really? sorry, must've missed that part
<bnagy> I don't know how portable that is btw but it will work for all *nix
<heftig> er, well, it will vanish from the FS right away, but it won't be deallocated until it's closed
<Xzyx987X> oh, I need it to stay on the fs
<heftig> so this is definitely the wrong approach
<bnagy> well I think using the filesystem at all is almost certainly wrong :/
<Xzyx987X> yea, but given the restrictions I mentioned, what other options do I have?
<Xzyx987X> I couldn't think of any
<bnagy> well I don't know enough about your problem
<Xzyx987X> I'm not saying there aren't any, but off the top of my head, I don't know
<bnagy> 10:20 < heftig> where does that object come from? if it's from a database, use the database's locking mechanisms
<heftig> also, there's Mutex, which is for multithread synchronization
<heftig> don't know if it works across forks
<Xzyx987X> it is either a file, or an object in memory. one of the two, but it can be either
<Xzyx987X> I need to be able to lock the id of the object in a way that will be consistant across processes
<Xzyx987X> that's more or less it
<heftig> IDs are not consistent across processes
<Xzyx987X> the id is not a ruby id. it is a unique id I create
<bnagy> it really sounds like you should be using a db for this
<heftig> then you'd end up with lock rows instead of lock files
<bnagy> or at least a process that does the object management
<Xzyx987X> not an option because the code is part of a library. I can't depend on the user setting up a db just for one include
<bnagy> roll your own then, have an object manager process which exposes an api over drb or whatever
<bnagy> what are you using multiple processes for, in the first place?
<Xzyx987X> it's part of a library for ruby cgi scripts to store data in a simple way using the file system that doesn't require you to set up a database, but gives you basic database like functionality
<bnagy> :|
<Xzyx987X> it's basically a way to avoid using a database if you either don't have the option of running one, or you don't want to take the trouble
<Xzyx987X> it obviously won't perform as well, but it is mainly targeted for a smaller site
<Xzyx987X> it's also fully object based from the ground up, which is nice
tridge has joined #ruby-lang
<Xzyx987X> well, you know, I actually just though of a way I could get around having to keep memory locks consistent across processes, so I'm just going to do that, and then I can just lock the actual files containing the data
<Xzyx987X> in other words, never mind :P
jakko_ has joined #ruby-lang
<bnagy> have you seen pstore?
jfelchner has joined #ruby-lang
<Xzyx987X> please don't tell me there is already something that does this. lol, my code is practically finished except the lock part.
<Xzyx987X> well ok, I guess the idea is somewhat similar, what I am doing is much more robust
<bnagy> no, a real ORM is robust
<bnagy> what you are doing is a hack :)
<bnagy> I doubt pstore will work across processes anyway
<Xzyx987X> fair enough, but it is a useful hack. at least in my opinion
tridge has quit [#ruby-lang]
<Xzyx987X> actually, as my platform is flexible enough that I could code a few extra classes to make it act as a frontend for an actual database
<Xzyx987X> that way you could effectively use the same code for storing stuff on a database as stuff on the file system
<Xzyx987X> so it you for instance had to test some code on a machine where a database was set up, you'd be covered
<Xzyx987X> *wasn't I mean
<bnagy> well if it's exactly the same code then you're going to get FS-level locking and performance out of a DB
<bnagy> which probably isn't what most people would expect
<Xzyx987X> no, the locking is handled by the device that does the locking
<Xzyx987X> in this case the database is the device
<Xzyx987X> that's how the code is set up
<bnagy> ok well good luck
<Xzyx987X> thanks, I'll need it...
gregmore_ has joined #ruby-lang
gix has joined #ruby-lang
<zenspider> Xzyx987X: you can rename the file
chimkan_ has joined #ruby-lang
peppyheppy has joined #ruby-lang
gnufied has joined #ruby-lang
jakko_ has joined #ruby-lang
aran418 has quit ["go team /leave!"]
qpingu has joined #ruby-lang
jakko has joined #ruby-lang
elalande has joined #ruby-lang
crankharder has joined #ruby-lang
srbaker has joined #ruby-lang
rking_ has joined #ruby-lang
fattastic has joined #ruby-lang
rking_ has quit [#ruby-lang]
TTilus has joined #ruby-lang
rippa has joined #ruby-lang
chimkan_ has joined #ruby-lang
kiddorails has joined #ruby-lang
kiddorails has quit [#ruby-lang]
tonesfrommars has joined #ruby-lang
mikeric has joined #ruby-lang
rking_ has joined #ruby-lang
brianpWins has joined #ruby-lang
morozovm has joined #ruby-lang
jakko has joined #ruby-lang
wmoxam has joined #ruby-lang
vesan_ has joined #ruby-lang
gsav has joined #ruby-lang
alexh_ has joined #ruby-lang
alexh_ has quit [#ruby-lang]
jakko has joined #ruby-lang
jakko_ has joined #ruby-lang
Radium has joined #ruby-lang
Oloryn_lt1 has joined #ruby-lang
Swimming_Bird has joined #ruby-lang
mikeric has joined #ruby-lang
nahhh has joined #ruby-lang
x0F_ has joined #ruby-lang
jarred has joined #ruby-lang
jstr has joined #ruby-lang
jfelchner has joined #ruby-lang
jakko has joined #ruby-lang
deobald has joined #ruby-lang
gsav has joined #ruby-lang
gnufied has joined #ruby-lang
yxhuvud has joined #ruby-lang
nofxx has joined #ruby-lang
brushbox has joined #ruby-lang
deobald has joined #ruby-lang
Cope has joined #ruby-lang
<Cope> hi
<Cope> given an array like this [['name', 'fred'], ['age', 12], ['eyes', 'blue']]
<Cope> what's a nice elegant way to convert that into a hash of form name => fredm age => 12, etc
<bnagy> Hash[*[an_ary]]
Joeysomo has joined #ruby-lang
<Cope> right... i have this: options = {}; o.each {|i| options[i.first.to_sym] = i.last} - was looking for something nicer
drumond19 has joined #ruby-lang
<Cope> i wonder if what i have is more readable, if less elagnt
<bnagy> what's not readable? Hash#[] is not obscure, it exists for the sole purpose of working with two-element arrays like that
<bnagy> but it won't convert your keys to symbols, you'd need to map first for that
* Cope nods
<bnagy> which means something like Hash[*[a.map{|e| [e.first.to_sym,e.last]}]] which is getting pretty ugly
kensei has joined #ruby-lang
<manveru> >> Hash[a.map{|k,v| [k.to_sym, v] }]
<manveru> => {:name=>"fred", :age=>12, :eyes=>"blue"}
<manveru> >> a.each_with_object({}){|(k,v),h| h[k.to_sym] = v }
<manveru> => {:name=>"fred", :age=>12, :eyes=>"blue"}
<manveru> if you prefer a single iteration :)
<bnagy> oh yeah... you don't need * if you have an array of two element arrays already :<
<manveru> also, good morning folks
<bnagy> o/
benanne has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
ryanf has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
denysonique has joined #ruby-lang
batmanian has joined #ruby-lang
A1241 has joined #ruby-lang
srbartlett has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
francisfish has joined #ruby-lang
nofxx has joined #ruby-lang
Zolrath has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
mikeric has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
jxie has joined #ruby-lang
tbuehlmann has joined #ruby-lang
pcboy_ has joined #ruby-lang
voker57 has joined #ruby-lang
voker57 has joined #ruby-lang
sandbags has joined #ruby-lang
A124 has joined #ruby-lang
rippa has joined #ruby-lang
tekin has joined #ruby-lang
olesu has joined #ruby-lang
forcar455 has joined #ruby-lang
forcar455 has quit [#ruby-lang]
Carnage\ has joined #ruby-lang
workmad3 has joined #ruby-lang
lianj has joined #ruby-lang
srbartlett has joined #ruby-lang
<erikh> HELLO INTERNET
Radium_ has joined #ruby-lang
voidx has joined #ruby-lang
gnufied has joined #ruby-lang
gnufied1 has joined #ruby-lang
apeiros_ has joined #ruby-lang
sheol has joined #ruby-lang
retro|cz has joined #ruby-lang
Patterner has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
olesu has joined #ruby-lang
zombiesandbags has joined #ruby-lang
sandbags has joined #ruby-lang
publicvoid_ has joined #ruby-lang
mssola has joined #ruby-lang
tekin has joined #ruby-lang
Radium_ has joined #ruby-lang
Mchl has joined #ruby-lang
tekin has joined #ruby-lang
DMKE has joined #ruby-lang
vesan_ has joined #ruby-lang
sheol has joined #ruby-lang
kensei has joined #ruby-lang
vesan_ has joined #ruby-lang
toretore has joined #ruby-lang
workmad3 has joined #ruby-lang
telemachus has joined #ruby-lang
<shevy> HELLO ERIKH
Nss has joined #ruby-lang
<erikh> <3
hirotoshi has joined #ruby-lang
niklasb has joined #ruby-lang
hirotoshi has joined #ruby-lang
epitron__ has joined #ruby-lang
hachiya has joined #ruby-lang
sheol_ has joined #ruby-lang
cjs226_ has joined #ruby-lang
ChloeD has joined #ruby-lang
rue_XIV has joined #ruby-lang
jsaak_ has joined #ruby-lang
<shevy> PING
bryanl_ has joined #ruby-lang
workmad3_ has joined #ruby-lang
jakko has joined #ruby-lang
ged has joined #ruby-lang
rdavila has joined #ruby-lang
tallship has joined #ruby-lang
FACEFOX has joined #ruby-lang
elalande has joined #ruby-lang
<manveru> GOTO 0726
<shevy> hmm
<shevy> CONFUSED
codewrangler has joined #ruby-lang
frangiz has joined #ruby-lang
z3r00ld has joined #ruby-lang
z3r00ld has quit [#ruby-lang]
fattastic has joined #ruby-lang
Karmaon has joined #ruby-lang
<bnagy> thank god that's not a permissible cpu error
Jake232 has joined #ruby-lang
<shevy> DESTROY ALL HUMANS
<bnagy> cpu: E_CONFUSED gcc: stfu biatch!
<shevy> START WITH BNAGY
<shevy> MAD
<shevy> ANGRY
Swimming_Bird has joined #ruby-lang
hirotosh_ has joined #ruby-lang
hirotos__ has joined #ruby-lang
kain has joined #ruby-lang
DMKE has joined #ruby-lang
workmad3__ has joined #ruby-lang
mistym has joined #ruby-lang
datanoise has joined #ruby-lang
batmanian has joined #ruby-lang
Natch| has joined #ruby-lang
thone_ has joined #ruby-lang
savage- has joined #ruby-lang
JackNorris has joined #ruby-lang
kensei has joined #ruby-lang
kensei_ has joined #ruby-lang
futurechimp has joined #ruby-lang
Sailias has joined #ruby-lang
seanstickle has joined #ruby-lang
dreieins has joined #ruby-lang
jordan_ has joined #ruby-lang
jtoy has joined #ruby-lang
jordan_ has quit [#ruby-lang]
datanoise has joined #ruby-lang
hagabaka has joined #ruby-lang
rippa has joined #ruby-lang
rolfb has joined #ruby-lang
<Defusal_> what is the correct way to change ulimit when using Process.spawn
eban has joined #ruby-lang
tevren has joined #ruby-lang
JohnBat26 has joined #ruby-lang
<rue> You can only decrease
deobald has joined #ruby-lang
<Defusal_> rue, so in order to increase i must raise the ruby processes ulimit?
Psyche^ has joined #ruby-lang
ryanf has joined #ruby-lang
lake has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
dreinull has joined #ruby-lang
nofxx has joined #ruby-lang
Xzyx987X_ has joined #ruby-lang
naquad has joined #ruby-lang
nofxx has joined #ruby-lang
havenn has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
dejongge has joined #ruby-lang
nofxx has joined #ruby-lang
mbriggs has joined #ruby-lang
rdavila has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
lsegal has joined #ruby-lang
nofxx has joined #ruby-lang
tomzx has joined #ruby-lang
nofxx has joined #ruby-lang
JohnBat26 has joined #ruby-lang
Rahul has joined #ruby-lang
nofxx has joined #ruby-lang
virunga has joined #ruby-lang
flak has joined #ruby-lang
Z33K|Lux has joined #ruby-lang
havenn has joined #ruby-lang
nofxx has joined #ruby-lang
rippa has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
Sailias has joined #ruby-lang
gnufied has joined #ruby-lang
nofxx has joined #ruby-lang
drumond1_ has joined #ruby-lang
nofxx has joined #ruby-lang
Rahul has quit ["Leaving"]
mattyoho has joined #ruby-lang
mattyoho has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
deobald has joined #ruby-lang
nofxx has joined #ruby-lang
guns has joined #ruby-lang
lightcap has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
fowl__ has joined #ruby-lang
seanstickle has joined #ruby-lang
nofxx has joined #ruby-lang
tjadc has joined #ruby-lang
TheRedGuy has joined #ruby-lang
havenn has joined #ruby-lang
nofxx has joined #ruby-lang
mbriggs has joined #ruby-lang
jfelchner has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
savage- has joined #ruby-lang
nofxx has joined #ruby-lang
vesan_ has joined #ruby-lang
zmack has joined #ruby-lang
yxhuvud has joined #ruby-lang
Nss has joined #ruby-lang
boxmo has joined #ruby-lang
nofxx has joined #ruby-lang
t has joined #ruby-lang
nofxx has joined #ruby-lang
<Defusal_> would system('ulimit -c unlimited') work, or does it need to be changed some other way? (the script runs as root)
boxmo has joined #ruby-lang
igotnolegs has joined #ruby-lang
dreieins has joined #ruby-lang
<Defusal_> ah theres Process.setrlimit
<matti> ;]
nofxx has joined #ruby-lang
<Defusal_> argh
<Defusal_> does anyone know the setrlimit equivalent of 'unlimited'?
<Defusal_> it says "invalid resource value: unlimited"
<Defusal_> yet "ulimit -c unlimited" would be valid
macmartine has joined #ruby-lang
boxmo has joined #ruby-lang
<heftig> Defusal_: -1
benanne has joined #ruby-lang
hynkle has joined #ruby-lang
<darix> Defusal_: Process::RLIM_INFINITY
nofxx has joined #ruby-lang
<Defusal_> heftig and darix, thanks
nofxx has joined #ruby-lang
<darix> andrewvos: php in itself is a security issue ... and if you are about security allow_url_fopen should be off anyway.
francisfish has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
vpamulap has joined #ruby-lang
nofxx has joined #ruby-lang
jbsan has joined #ruby-lang
toretore has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
rking has joined #ruby-lang
Xzyx987X_ has joined #ruby-lang
Xzyx987X has joined #ruby-lang
qpingu has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul was kicked from #ruby-lang by zenspider [Kicked]
justinmcp has joined #ruby-lang
nofxx has joined #ruby-lang
nif has joined #ruby-lang
nofxx has joined #ruby-lang
sandbags has joined #ruby-lang
nofxx has joined #ruby-lang
<fowl__> zenspider on patrol
nofxx has joined #ruby-lang
robgleeson|mba has joined #ruby-lang
petercooper has joined #ruby-lang
nofxx has joined #ruby-lang
urbanmonk has joined #ruby-lang
s0ber_ has joined #ruby-lang
y3llow_ has joined #ruby-lang
nofxx has joined #ruby-lang
y3llow has joined #ruby-lang
Kero has joined #ruby-lang
y3llow has joined #ruby-lang
nofxx has joined #ruby-lang
<zenspider> sexp_processor 3.2.0 released
y3llow has joined #ruby-lang
nofxx has joined #ruby-lang
tla has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
codewrangler has joined #ruby-lang
nofxx has joined #ruby-lang
savage- has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
postmodern has joined #ruby-lang
nofxx has joined #ruby-lang
Nss has joined #ruby-lang
rdavila has joined #ruby-lang
heftig has joined #ruby-lang
nofxx has joined #ruby-lang
diegoviola has joined #ruby-lang
nofxx has joined #ruby-lang
cola_zero has joined #ruby-lang
nif has joined #ruby-lang
nofxx has joined #ruby-lang
srbaker has joined #ruby-lang
hagabaka has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
havenn has joined #ruby-lang
seanstickle has joined #ruby-lang
nif has joined #ruby-lang
nofxx has joined #ruby-lang
mistym has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
<erikh> bugs.ruby-lang.org is down, if anyone's around who can get in touch with the right people..
FACEFOX has joined #ruby-lang
nofxxx has joined #ruby-lang
fayimora has joined #ruby-lang
brianpWins has joined #ruby-lang
nofxx has joined #ruby-lang
srbartlett has joined #ruby-lang
FACEFOX has joined #ruby-lang
nofxx has joined #ruby-lang
woollyams has joined #ruby-lang
nofxx has joined #ruby-lang
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
spuk has joined #ruby-lang
nofxx has joined #ruby-lang
d1zzYLuLz has joined #ruby-lang
dreieins has joined #ruby-lang
nofxx has joined #ruby-lang
slyphon has joined #ruby-lang
nofxx has joined #ruby-lang
nif has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
jtoy has joined #ruby-lang
Joeysomo has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
Xzyx987X has joined #ruby-lang
nofxx has joined #ruby-lang