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
morozovm has joined #ruby-lang
<zenspider> deryldoucette: yeah... that NEVER gets old
<deryldoucette> hehe
<jaimef> is there a way to "unload" active record extentions to the hash class?
<zenspider> not really, no
<drbrain> jaimef: not really
<zenspider> BEAT YOU DAMNIT!
<zenspider> HAH
burns180 has joined #ruby-lang
gsav has joined #ruby-lang
<jaimef> something was working in irb because the hash#deep_diff without active record works fine
<zenspider> buggy code is buggy
<zenspider> dunno what to say
<jaimef> yeah looks like irb returns a Hash from a Json.parse, whereas the other is bringing back Ohai::system
<deryldoucette> is that the json profiler?
<deryldoucette> (heard of it, but you're the first i've met that has used it. so was just wondering if it was the same thing)
<jaimef> no just home grown stuff
<deryldoucette> ah
tenderlove has joined #ruby-lang
<zenspider> jaimef: Json.parse returns an Ohai instance when you have AR loaded?
<zenspider> that doesn't sound right... sounds like something else is also interacting
<zenspider> how are you running irb?
<zenspider> can you try script/console?
<jaimef> rails?
<jaimef> I dumped an Ohai::system object to a json file. just oddly some version difference in either a library of gem is resulting in different behavior
<jaimef> no doubt user error
slyphon has joined #ruby-lang
<erikh> you can pull in specific parts of activesupport
<erikh> most of the files can be required independently.
<zenspider> Json.parse doesn't do any type casting, unlike yaml... so I don't see how you could possibly get an Ohai instance back
m3nd3s has joined #ruby-lang
<jaimef> agreed
<jaimef> the difference is in irb vs bundle exec irb. so will figure out what I broke
l0st1 has joined #ruby-lang
<jaimef> ahh it pulls in chef
<jaimef> different versions of json, one appears to use the "json_class" field which is Ohai::System and the other one does not
<zenspider> nonstandard json is nonstandard
thone has joined #ruby-lang
tomzx has joined #ruby-lang
jkyle_ has joined #ruby-lang
tommyvyo_ has joined #ruby-lang
burns180_ has joined #ruby-lang
wmoxam has joined #ruby-lang
gsav has joined #ruby-lang
Avanine has joined #ruby-lang
heppy_ has joined #ruby-lang
igotnolegs has joined #ruby-lang
Technodrome has joined #ruby-lang
srbartlett has joined #ruby-lang
Technodrome has quit [#ruby-lang]
takaokouji has joined #ruby-lang
takaokouji has joined #ruby-lang
rohit has joined #ruby-lang
m3nd3s has joined #ruby-lang
neilc has joined #ruby-lang
chimkan has joined #ruby-lang
burns180 has joined #ruby-lang
QoQOoO has joined #ruby-lang
<zenspider> sup bitches?
<andrewvos> meh
<andrewvos> is zenspider drunk?
QaDeS_ has joined #ruby-lang
Kero has joined #ruby-lang
<neilc> zenspider: digging around in ruby2ruby at the moment, as it happens
agib has joined #ruby-lang
havenn has joined #ruby-lang
shtirlic has joined #ruby-lang
io_syl_ has joined #ruby-lang
Kuukunen has joined #ruby-lang
<neilc> zenspider: btw, is it expected that ~155 of the ruby2ruby tests fail out of the box?
Joeysomo has joined #ruby-lang
skyjumper has joined #ruby-lang
<andrewvos> neilc: Are there only 155 tests?
<neilc> andrewvos: "2080 tests, 5935 assertions, 155 failures, 0 errors, 0 skips"
<andrewvos> neilc: I find that a good number of failures to go by is 0
<neilc> andrewvos: i also inclined to follow a similar rule of thumb
<andrewvos> neilc: Zero, or 150 of course
<lianj> add skip to all of these and youre golden, right? :P
<andrewvos> lianj: I like your thinking. Someday you'll make a good project manager
<andrewvos> Some day*
<lianj> yay
burns180_ has joined #ruby-lang
Joeysomo has joined #ruby-lang
ankurgel has joined #ruby-lang
qpingu has joined #ruby-lang
Avanine has joined #ruby-lang
shtirlic_ has joined #ruby-lang
cdnz has joined #ruby-lang
Luxx_ has joined #ruby-lang
cdnz has joined #ruby-lang
Joeysomo has joined #ruby-lang
<zenspider> neilc: define "the box"
dfr|mac has joined #ruby-lang
<zenspider> neilc: r2r tests are driven by pt_testcase.rb from sexp_processor, which has been expanding as we add more 1.9 tests
<zenspider> until ruby_parser passes those tests, focusing on r2r is a waste of time
cdnz_ has joined #ruby-lang
<zenspider> fwiw, I only get 51 failures... hrm
<zenspider> ah. that's because I'm not generating layers 2-4 of the bootstrap tests
Heimidal has joined #ruby-lang
<cout> "only"
<zenspider> you can't expect tests on trunk to always be passing. sorry.
neoesque has joined #ruby-lang
ttilley has joined #ruby-lang
slimfit has joined #ruby-lang
dfr|mac_ has joined #ruby-lang
ttilley has joined #ruby-lang
leriksenau has joined #ruby-lang
krz has joined #ruby-lang
Joeysomo has joined #ruby-lang
cdnz has joined #ruby-lang
sir_e_brum has joined #ruby-lang
Aphelion has joined #ruby-lang
gsav has joined #ruby-lang
burns180 has joined #ruby-lang
l0st1 has joined #ruby-lang
looopy has joined #ruby-lang
heppy has joined #ruby-lang
wallerdev has joined #ruby-lang
macmartine has joined #ruby-lang
ascarter has joined #ruby-lang
petercooper has joined #ruby-lang
verto_ has joined #ruby-lang
havenn has joined #ruby-lang
Karmaon_ has joined #ruby-lang
Joeysomo has joined #ruby-lang
gsav_ has joined #ruby-lang
gsav_ has joined #ruby-lang
gsav_ has joined #ruby-lang
StevenRingo has joined #ruby-lang
dv310p3r has joined #ruby-lang
burns180_ has joined #ruby-lang
nguerin has joined #ruby-lang
qpingu has joined #ruby-lang
jacobwg has joined #ruby-lang
jacobwg has joined #ruby-lang
slimfit has joined #ruby-lang
looopy has joined #ruby-lang
burns180 has joined #ruby-lang
naz has joined #ruby-lang
mztriz has joined #ruby-lang
<rue> Ooh, did I miss some exciting Ruby drama?
macmartine has joined #ruby-lang
<cout> I haven't seen good ruby drama since zed shaw
skipper has joined #ruby-lang
brianpWins has joined #ruby-lang
Karmaon has joined #ruby-lang
gregf has joined #ruby-lang
<drbrain> I have no idea
Kero has joined #ruby-lang
nuclearsandwich has joined #ruby-lang
twittard has joined #ruby-lang
QoQOoO has joined #ruby-lang
ankurgel has joined #ruby-lang
rohit has joined #ruby-lang
machine1 has joined #ruby-lang
wmoxam_ has joined #ruby-lang
gsav has joined #ruby-lang
rushed has joined #ruby-lang
burns180_ has joined #ruby-lang
<shevy> cout I think the drama is only in rails if at all
<erikh> all the dramas
<erikh> where's maury when you need him
ericmuyser has joined #ruby-lang
Karmaon has joined #ruby-lang
PatrixCR has joined #ruby-lang
hagabaka has joined #ruby-lang
andkerosine has joined #ruby-lang
<andkerosine> Anyone familiar with rubyzip?
Fretta has joined #ruby-lang
PatrixCR has quit [#ruby-lang]
Avanine has joined #ruby-lang
gsav has joined #ruby-lang
chimkan___ has joined #ruby-lang
slimfit has joined #ruby-lang
twittard has joined #ruby-lang
burns180 has joined #ruby-lang
PatrixCR has joined #ruby-lang
<PatrixCR> Does anyone here know what gem is the best to use twitter bootstrap with rails?
ryanf has joined #ruby-lang
io_syl has joined #ruby-lang
PatrixCR has quit [#ruby-lang]
<zenspider> best...
macmartine has joined #ruby-lang
<erikh> rails...
<lianj> drama...
<erikh> maury...
<Avanine> springer...
<erikh> last I heard nobody got in any fistfights over rails
<erikh> that's what separates the springers from the poviches
burns180_ has joined #ruby-lang
dominikh has joined #ruby-lang
csprite has joined #ruby-lang
petercooper has joined #ruby-lang
csprite has quit [#ruby-lang]
burns180 has joined #ruby-lang
lchi has joined #ruby-lang
<neilc> zenspider: re: r2r tests, "out of the box" == "git clone && rake test" of r2r
<neilc> zenspider: doesn't bother me whether the tests are all intended to pass, i was just curious if my local config was busted
<zenspider> nope... it's not you. it's me
machine1 has joined #ruby-lang
<neilc> heh, fair enough
gokul has joined #ruby-lang
<zenspider> saw your patch (I'm assuming)... looks good
<neilc> cool
<shevy> erikh: hipsters usually don't use their fists!
wallerdev has joined #ruby-lang
manveru has joined #ruby-lang
<shevy> hmm did Hash#select change from ruby 1.8 to 1.9 ? or did it always return a hash
<erikh> probably a 1.9-ism
<erikh> most enumerables in 1.8 returned 2-element tuples
<shevy> ah I see
<erikh> corundum: quickref?
x0F__ has joined #ruby-lang
cdnz has joined #ruby-lang
jenrzzz has joined #ruby-lang
Joeysomo has joined #ruby-lang
Kero has joined #ruby-lang
gjaldon has joined #ruby-lang
QoQOoO has joined #ruby-lang
andkerosine has quit [#ruby-lang]
burns180_ has joined #ruby-lang
burns180_ has joined #ruby-lang
robbyoconnor has joined #ruby-lang
H2H has joined #ruby-lang
heppy has joined #ruby-lang
ozzloy has joined #ruby-lang
ozzloy has joined #ruby-lang
davidw has joined #ruby-lang
rippa has joined #ruby-lang
gjaldon has joined #ruby-lang
znz_v has joined #ruby-lang
dhruvasagar has joined #ruby-lang
kitallis has joined #ruby-lang
|Vargas| has joined #ruby-lang
|Vargas| has joined #ruby-lang
phlipper has joined #ruby-lang
gjaldon has joined #ruby-lang
burns180 has joined #ruby-lang
Weems has joined #ruby-lang
Weems has joined #ruby-lang
tla has joined #ruby-lang
andee_marks has joined #ruby-lang
Karmaon has joined #ruby-lang
andee_marks has quit [#ruby-lang]
andee_marks has joined #ruby-lang
frangiz has joined #ruby-lang
yxhuvud has joined #ruby-lang
mytrile has joined #ruby-lang
beiter has joined #ruby-lang
gnufied has joined #ruby-lang
ezkl has joined #ruby-lang
PhilCK has joined #ruby-lang
PhilCK has joined #ruby-lang
ankurgel has joined #ruby-lang
StevenRingo has joined #ruby-lang
tekin has joined #ruby-lang
gnufied has joined #ruby-lang
gnufied has joined #ruby-lang
dc5ala has joined #ruby-lang
Nss has joined #ruby-lang
burns180 has joined #ruby-lang
burns180 has joined #ruby-lang
ramonmaruko has joined #ruby-lang
twittard has joined #ruby-lang
SPYGAME has joined #ruby-lang
sym- has joined #ruby-lang
jenrzzz has joined #ruby-lang
tekin has joined #ruby-lang
zmack has joined #ruby-lang
zmack has joined #ruby-lang
amerine has joined #ruby-lang
Avanine has joined #ruby-lang
WillMarshall has joined #ruby-lang
beiter has joined #ruby-lang
IPGlider has joined #ruby-lang
Fractality has joined #ruby-lang
brianpWins has joined #ruby-lang
cyri_ has joined #ruby-lang
burns180_ has joined #ruby-lang
uniqanomaly has joined #ruby-lang
Gray has joined #ruby-lang
Gray|2 has joined #ruby-lang
<Gray|2> hello, Guys! question about subtract dates http://pastie.org/3547009
<Gray|2> result is: -731593216962773/86400000000
<Gray|2> why?
* Avanine looks
tla_ has joined #ruby-lang
<Gray|2> any help?
slaytanic has joined #ruby-lang
QoQOoO has joined #ruby-lang
Gray|2 has quit ["Once you know what it is you want to be true, instinct is a very useful device for enabling you to know that it is"]
<sym-> dt ends up to be of class Rational...
<sym-> maybe you want to convert the two dates to seconds first? (just musing)
<sym-> ends up being*
<erikh> I know this question gets asked all the time but I always forget
<erikh> does 1.9.3 build under clang?
<ddfreyne> erikh: I'd like to know the answer to that as well
<erikh> well I guess I'll find out in a bit here
jenrzzz has joined #ruby-lang
<erikh> well, more realistically tomorrow but yeah
toretore has joined #ruby-lang
<Avanine> DateTime doesn't provide a - method.
Gray has joined #ruby-lang
<Avanine> Gray|2
<Gray> hello experts!
<Avanine> Gray: are you the same person as Gray|2 ?
<Gray> yes, i have troubles with my IRC client, could you repeat you message please.
<Avanine> DateTime doesn't provide a - method.
<Avanine> You'll probably want to use the date class instead: http://ruby-doc.org/stdlib-1.9.3/libdoc/date/rdoc/Date.html
leriksenau has joined #ruby-lang
leriksenau has quit [#ruby-lang]
leriksenau has joined #ruby-lang
<Gray> but i need not only date. Date and time.
tbuehlmann has joined #ruby-lang
leriksenau has quit [#ruby-lang]
uniqanomaly has joined #ruby-lang
<kyrylo> Gray, you could've click that link and read the first sentence, at least.
<kyrylo> *clicked
aza_kibo_ has joined #ruby-lang
Stalkr_ has joined #ruby-lang
<Gray> kyrylo, i read. But i don't understand why i can't subtract 2 DateTime objects?
leriksenau has joined #ruby-lang
leriksenau has quit [#ruby-lang]
<sym-> intruitively, that would make sense, what would e.g. the difference be between 2011 and 1988? the year 33?
<sym-> 23*
futurechimp has joined #ruby-lang
<Gray> sym-, i new in ruby and in programming. So, here is a book: http://pine.fm/LearnToProgram/?Chapter=01 and here is the simple task: how many seconds old are you?
<Gray> so i need substract now date time - birth date time
francisfish has joined #ruby-lang
<beiter> hi, is there a good way to parse a tree into a xml file ?
burns180 has joined #ruby-lang
<sym-> Gray: it's not trivial because of leap years, leap seconds, etc
<sym-> Gray: but there should be a good chance one of these classes has a "to seconds" method, I would read the docs
victork has joined #ruby-lang
<rippa> Time#-
<rippa> gives you seconds
Hakon|mbp has joined #ruby-lang
zerokarmaleft has joined #ruby-lang
Guest16561 has joined #ruby-lang
Zolrath has joined #ruby-lang
vcashk has joined #ruby-lang
andee_marks_ has joined #ruby-lang
sandbags has joined #ruby-lang
nevynxxx has joined #ruby-lang
Fractality has joined #ruby-lang
victork has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
Joeysomo_ has joined #ruby-lang
jbsan has joined #ruby-lang
zerokarmaleft has joined #ruby-lang
DarkGray has joined #ruby-lang
Stalkr_ has joined #ruby-lang
rohit has joined #ruby-lang
reitelles has joined #ruby-lang
L0rdShrek has joined #ruby-lang
PhilCK has joined #ruby-lang
roadkith has joined #ruby-lang
seoaqua has joined #ruby-lang
burns180_ has joined #ruby-lang
canton7 has joined #ruby-lang
srbartlett has joined #ruby-lang
A124 has joined #ruby-lang
Muz has joined #ruby-lang
srbartlett has joined #ruby-lang
davidw has joined #ruby-lang
workmad3 has joined #ruby-lang
QaDeS has joined #ruby-lang
IPGlider has joined #ruby-lang
neoesque has joined #ruby-lang
verto has joined #ruby-lang
adambeynon has joined #ruby-lang
burns180 has joined #ruby-lang
Hakon|mbp has joined #ruby-lang
reitelles has quit [#ruby-lang]
reitelles has joined #ruby-lang
<kalleth> scumbag ruby: allows simple command execution through output = `command`, doesn't sanitise it automatically
<kalleth> :(
<injekt> kalleth: sanitize how?
<kalleth> i dunno, escape it somehow ;p
<injekt> escape.. what?
<injekt> lol
<kalleth> i hasten to add i'm not the genius that passed unsanitised user-entered strings to a bash script call ;)
<kalleth> (as root!)
<injekt> oh
<injekt> there are lots of shell util libraries
<kalleth> yeah, there's Escape
<injekt> there's shellescape in shellwords which is in stdlib
<kalleth> hmm
IPGlider has joined #ruby-lang
<erikh> ri Shellwords
<injekt> erikh: goback2sleep
<injekt> busy night?
<kalleth> hmm, Shellwords doesn't seem reliable enough
<kalleth> for example
csherin has joined #ruby-lang
fayimora has joined #ruby-lang
<kalleth> simple solution: Open3.popen3(["ls", "-ltr", "/"])
kedare has joined #ruby-lang
<A124> Moorning. (Not for me really) What whould you advise as a storage for tens of thousands small (~5kB) images?
<kalleth> A124: reiserfs
* kalleth giggles
<kalleth> seriously, some kind of filesystem
<A124> kalleth: Umm.. is reser maintained even. But, thanks for that.
<kalleth> i was taking the piss, A124 ;p
<kalleth> obv
<A124> xD
<A124> Not obv for me
<erikh> injekt: I never went to sleep in the first place
Para has joined #ruby-lang
<kalleth> A124: you _could_ use a database, I guess, but using databases for filestores seems a bit..dodgy for me
<A124> kalleth: The thing is taking a lot of inodes and slow directories. And the files are really small.
<erikh> kalleth: look into the C that handles that array form
<kalleth> are you talking local storage to your app or remote storage like amazon cdn etc?
<erikh> it's ... shellwords
<A124> kalleth: Yeah. I have second folder with larger images, which is other case. But the very small ones .. and very many..
<kalleth> erikh: so why does my Shellwords.escape not work with ls -ltr / (i.e. escapes it so much it produces invalid output), but Open3.popen3([array,of,args]) works fine?
<A124> kalleth: Some storage system usable with Ruby
<erikh> kalleth: because they aren't the same implementation.
<erikh> and what does shell words do to ls -ltr / ?
<A124> kalleth: FS works for large files obviously, but this is not the case.
<kalleth> A124: local to the app on the same machine, right? I think there's a filesystem specifically designed for lots of small files, format a partition with that fstype, and use that
<kalleth> *shrug*
<kalleth> alternatively there's probably some open source project out there i'm not aware of
m3nd3s has joined #ruby-lang
<A124> kalleth: Yes. Local or over the network, but still on a machine which I run.
<erikh> no, what is the resulting string from shellwords.
<kalleth> irb(main):066:0> Shellwords.escape("ls -ltr /")
<kalleth> => "ls\\ -ltr\\ /"
<erikh> 1.9.3p125 :002 > Shellwords.shellescape('ls -ltr /')
<erikh> => "ls\\ -ltr\\ /"
<erikh> how is that not legal?
<kalleth> erikh: i've not delved into it, I just compared using shellwords.... oh
<kalleth> shellescape?
<erikh> they're the same
<kalleth> erikh: the furthest i took it was in that pastie
<kalleth> compared open3.popen3 using it, with not using it
<kalleth> one produces one output, one produces different (invalid/wrong) output, for the same input text
<kalleth> it could very possibly be open3 spannering inside its library
<kalleth> i don't know, I didn't check
<erikh> ah derp
<erikh> so yeah, that's probably what's happening
<kalleth> nope
<kalleth> its not
<erikh> open3 is doing additional stuff.
<erikh> ok
<kalleth> irb(main):069:0> `#{Shellwords.shellescape("ls -ltr /")}`
<kalleth> sh: ls -ltr /: No such file or directory
<kalleth> => ""
<kalleth> irb(main):070:0> `ls -ltr /`
<kalleth> => "total 97\ndrwxr-xr-x 2 root root 4096 Oct 28
<kalleth> sry4paste
<kalleth> brb meeting
<erikh> yes, but you're only supposed to shellescape the arguments.
<erikh> e.g., shellescape('-ltr') shellescape('/')
<erikh> anyhow
<injekt> Shellwords.join(['ls', '-ltr', '/'])
burns180 has joined #ruby-lang
<kalleth> ah, ok, erikh, that makes sense :)
<injekt> if you have a string, you want to shellwords split it, then you want to shellwords join it before you execute it
<injekt> boom, I worked that out from the docs
<kalleth> yeah :) I'll just use an array of arguments
<erikh> also note that array forms of system() and friends go through similar escaping routines before being passed to exec-alikes
<erikh> they are not parameterized execs
<kalleth> one question though, all of these exec mechanisms fork() or equiv and fire up a shell, right?
<yxhuvud> erikh: well, not the first argument to system. only the latter ones
<kalleth> is there a way to execute a command from ruby without doing that?
<matled> kalleth: I'd always recommend to use exec in a way that allows to pass parameters. i.e. http://pastie.org/3547803
<kalleth> i.e. issue it without shell interp
<erikh> yxhuvud: probably correct; I source dove with raggi until we found the strtok calls and then we both just threw up in our mouths a little and stopped
<matled> kalleth: no, they only fire up a shell if there is only one argument (and maybe that is checked if it is an executable in $PATH or not)
<yxhuvud> :D
<injekt> wow the ruby-doc website is NOT easy to navigate
<kalleth> matled: aah, so exec "ls -ltr /" does fire up a shell, but exec ["ls", "-ltr", "/"] doesn't?
<matled> kalleth: yep
<erikh> what I'm trying to say is that parameterized system and friends does not change anything
<kalleth> got it :)
<injekt> my face hurts
<erikh> ugh
<erikh> going to break stuff now, later
<matled> kalleth: and that exec "sh", "-c", ... fires up the shell manually and passes the arguments as arguments to the shell
<injekt> enjoy!
<matled> kalleth: the extra sh is $0
<kalleth> :)
erpelchen has joined #ruby-lang
<A124> kalleth: Any other ideas? .. I only heard of xfs. But I don't see at as a best solution. Also, I haven't mentioned. Mostly all files will remain untouched.
rohit has joined #ruby-lang
<matled> kalleth: I've got to go now
m3nd3s has joined #ruby-lang
sandbags has joined #ruby-lang
<kalleth> matled: that's ok, I'm done, thanks very much :)
<kalleth> A124: i'm not au fait with all the open source projects to do it
<A124> kalleth: ok. Thank you. All I have though about was some MangoDB, flatfile database, filesystem tweaks / change
<kalleth> well, surely the db would still have to go to disk to get the data
<kalleth> and my guess is a filesystem will be better at getting to the right data on disk than a database
<kalleth> and better @ using less memory, too
<kalleth> :P
<kalleth> but that's just a guess, i'd research it more and chat to some more dudes before you settle on an approach
<A124> kalleth: Maybe. The problem is not with the data, but with the count of the files.
<kalleth> *shrug*
<kalleth> mongodb actually looks reasonable, why not performance benchmark both
<A124> kalleth: Umm.. Well, I gues I maybe should xD Thanks.
<kalleth> write a wrapper to return the path to the file/get the file data, and then write a Filesystem based implementation and a Mongodb based implementation, compare the two over a million files
<A124> kalleth: I also remeber xfs being used on news server and other alike things. So it maybe could permform well, except it's stale.
<kalleth> maybe it's stale because it does what it says on the tin? :P
<kalleth> i dunno, i'm no guru
<kalleth> i know that with filesystems dealing with lots of very small files, the blocksize is important
<kalleth> but potentially mongodb will perform better
<A124> kalleth: Mongo is pretty sable and has ClusterFS, which is extension backed up by MongoDB. The FS is not a FS though.
<kalleth> the more i read up on it, the more a key-value type document/nosql db seems good
<kalleth> "imageid: binary representation of image"
<kalleth> but as i said, best to benchmark them :)
<A124> kalleth: To be honest. I advocated nosql when everyone was killing others for not using SQL xD
<kalleth> A124: the more I read about them, the more I think they have a very specific set of use cases
<kalleth> for example, I wouldn't use a key-value store only to develop a rails application with relationships :P
<A124> kalleth: They are not that specific. And also work as a SQL in a little. But without the complex, not often used sh*t. So they are more robust and faster and simpler.
<kalleth> it depends if it's the right tool for the job
<kalleth> can you enforce referential integrity at the datastore level? can you run complex queries with dependent relationships etc?
<injekt> stop talking about it and try both? ;)
<kalleth> ^
<erikh> use sysbench
<erikh> or bonnie++
<injekt> I just typed boonie into google
<injekt> fuck you
<injekt> @ fingers
<A124> kalleth: exactly, but some relations are good anyway.
<erikh> bonnie++ is a filesystem benchmarking tool
<injekt> i've not heard of it before
<injekt> interesting
<kalleth> anyway, i have to go back to work now, listen to erikh and injekt and try both and see which works best :)
<A124> erikh: Thanks. Although CLusterFS from mongo is not a standard FS, though
<injekt> oO
<erikh> I don't even know what clusterfs is
<erikh> it sounds very hip
<A124> kalleth: Yup. Thanks.
<injekt> clusterfucks
<injekt> I should get back to work
<A124> erikh: It's a layer on top of MongoDB
<erikh> mongodb isn't exactly famous for its reliability
<A124> erikh: Takes care of names, md5 checksums, integrity checking, and splitting large files.
<andrewvos> erikh: Well, you could say that is is famous for it's reliability.
<erikh> andrewvos: heh.
<A124> Umm. I don't know much, so that is why I ask, if anyone has any idea ;)
<erikh> we use it at work. it's been ok
<erikh> I just know of several nightmare scenarios with it.
<A124> erikh: Which scenarios please? So I could avoid them possibly xD
<erikh> the database soiling itself
<erikh> to the point of no return
<erikh> you should research it and see if it's worth the trouble for you.
<erikh> fwiw, sql databases are pretty mature products these days and you really have to try hard to get them to crash.
<yxhuvud> heh, I get mysql to dump almost daily ;)
<erikh> shit man, how do you manage that?
<erikh> I mean a few years ago I wouldn't have been surprised
<erikh> but 5.1 and up are pretty solid
<yxhuvud> well, the cli isn't very stable if you do certain things while it is exiting.
<yxhuvud> so it is not as if it matters
gasbakid has joined #ruby-lang
DarkGray has joined #ruby-lang
<andrewvos> how do I ack search loads of files like this "ack --all base.spv -l" but then open all those files at once in vim?
<andrewvos> So I can use :n
<erikh> use the Ack plugin?
<erikh> :)
<andrewvos> erikh: hehe fair enough
<erikh> it opens a debug window
<erikh> you can just enter through the files
<erikh> takes you right to the line, etc.
<erikh> it's pretty awesome.
<andrewvos> It's only finding one match :/
<erikh> did you :Ack -a or w/e
<erikh> sooooo tired
<andrewvos> ohhhh right
<andrewvos> Thanks erikh
<andrewvos> That's amazing
<injekt> <3 the Ack plugin
<erikh> yeah the plugin really rules
<injekt> although I have been using sublime for the last week
WillMarshall has joined #ruby-lang
y3llow_ has joined #ruby-lang
fayimora has joined #ruby-lang
burns180_ has joined #ruby-lang
jhchabran has joined #ruby-lang
znz_v has joined #ruby-lang
apeiros_ has joined #ruby-lang
rolfb has joined #ruby-lang
reitelles has quit [#ruby-lang]
QaDeS has joined #ruby-lang
<DarkGray> is any difference?
<DarkGray> puts str.ljust(50)
<DarkGray> puts str.ljust 50
<apeiros_> DarkGray: no, it's the same
<roadkith> the one as ()
<apeiros_> all you have to do is pay attention with regards to precedence
<roadkith> and readability
<roadkith> no?
<rolfb> apeiros_: weren't you happy with the Apple TV update?
<apeiros_> rolfb: no, I'm disappointed
<rolfb> apeiros_: why?
<DarkGray> thx
<rolfb> apeiros_: what did you want?
<apeiros_> rolfb: same bad software. I'll take a look at it tonight. maybe it's better than it looks…
<roadkith> what do you buy appleTV for btw?
<roadkith> what does it do?
<apeiros_> rolfb: better software. f.ex.: filter movies by language, play mp3-streams in my itunes library, better internet radio, being able to use a bluetooth keyboard…
<rolfb> roadkith: movies, tv shows, major league baseball, podcasts (especially TED talks), netflix, vimeo, youtube
<roadkith> does it store movies?
<rolfb> roadkith: it has cloud locker for movies
<apeiros_> have already rented/watched movies marked. then (not a software problem) the selection of movies and tv shows in switzerland is a joke…
<rolfb> as in, you can stream at will
<rolfb> if you've bought it
<rolfb> i mean "on demand" :)
<roadkith> hm
<apeiros_> roadkith: I use it to connect my computer with my tv
<roadkith> you cannot watch blurays on it can you?
<apeiros_> also to rent movies and show photos to friends
<rolfb> apeiros_: yeah, i buy gift cards on ebay and use an US account
<apeiros_> roadkith: it has no drive, so no
<apeiros_> rolfb: ah, good idea
<roadkith> hmm guess i dont need it then
<rolfb> and the new software update gave you "complete my season"
<roadkith> need/want
<rolfb> which is nice
<apeiros_> rolfb: you're from NO?
<rolfb> apeiros_: YES, NO
<rolfb> :)
<apeiros_> lol
<apeiros_> your country caused troubles with our localization files… :)
<apeiros_> no is a literal for false in yaml…
voker57 has joined #ruby-lang
voker57 has joined #ruby-lang
<yxhuvud> :D
<rolfb> apeiros_: ohrly? either way, there is no such thing as "no"
<rolfb> there is no-NB and no-NO
<rolfb> i think
<rolfb> (but i'm not sure how yaml handles that)
<apeiros_> rolfb: hu?
<rolfb> sorry, no-NB and no-NN
<rolfb> the language is split
djh has joined #ruby-lang
<apeiros_> ah, you mean locales?
<rolfb> yes
<apeiros_> na, we had a list of countries
<rolfb> ah
<apeiros_> but tbh, the bigger issue was italian, where we had a couple of 'no' values.
burns180 has joined #ruby-lang
<rolfb> :)
<apeiros_> anyway, HD ipad gives me hopes for an HD MBA
<rolfb> hmm
<rolfb> that could be nice
<rolfb> would love some antiglare on it too
<apeiros_> that hasn't bothered me much. but I can understand those whom it does bother.
<rolfb> have you had antiglare?
<apeiros_> you mean the way screens have been before high-glossy, right?
<rolfb> i had on my previous mac
<rolfb> hmm, no
<apeiros_> oh, ok, then I misunderstood
<rolfb> i think it's better than that
<darix> i think the bigger disappointment is lenovo. like all their business laptops are non-glare display. but their tablet gets a glare display -.-
<rolfb> it works rather good in sunshine
<apeiros_> hm, no, the only thing I've seen working well in sunshine was a technology called "transflective" (iirc)
<apeiros_> that was very nice. I wonder why nobody uses it - too expensive? not manufacturable in those sizes? no idea…
<rolfb> i would buy that in a heartbeat
<apeiros_> eInk is also very readable in sunlight. too bad it's too slow for anything but static content…
jxie has joined #ruby-lang
<apeiros_> anyway, I'll have to pay attention wrt anti-glare then
<rolfb> eInk is awesome :)
* ruskie loves eInk
adambeynon has joined #ruby-lang
Sailias has joined #ruby-lang
* shevy loves ruskie
<ruskie> heh
<ruskie> what did I do to deserve that?
<A124> shevy: Hey. Any progress? xD
looopy has joined #ruby-lang
mark_locklear has joined #ruby-lang
<cout> I had high hopes for Pixel Qi
vcashk has joined #ruby-lang
ankurgel has joined #ruby-lang
<apeiros_> cout: had? no longer?
<cout> apeiros_: well it doesn't seem to be hoing anywhere
<cout> going
<apeiros_> :-/
* apeiros_ had high hopes in polymer-memory
<apeiros_> but that went nowhere either :(
<apeiros_> another one of those "just around the corner!" technologies…
burns180_ has joined #ruby-lang
<cout> I'm glad we do have eink now. I was afraid it was going to die with that silly phone motorola used it on.
<cout> motorola f3
<cout> for some reason they thought it would be a good idea to only support lowercase letters, and the battery life wasn't any better than a regular phone
ankurgel has joined #ruby-lang
fvollero has joined #ruby-lang
vcashk has joined #ruby-lang
beiter has joined #ruby-lang
burns180 has joined #ruby-lang
ankurgel has joined #ruby-lang
mytrile has joined #ruby-lang
mytrile has joined #ruby-lang
ascarter has joined #ruby-lang
ankurgel has joined #ruby-lang
joast has joined #ruby-lang
wyhaines has joined #ruby-lang
Stalkr_ has joined #ruby-lang
dv310p3r has joined #ruby-lang
imperator has joined #ruby-lang
jkprg has joined #ruby-lang
burns180_ has joined #ruby-lang
<imperator> good morning
fayimora has joined #ruby-lang
bglusman has joined #ruby-lang
<cout> hi dan
<imperator> cout, how you been?
robbyoconnor has joined #ruby-lang
enebo has joined #ruby-lang
<cout> imperator: busy
<cout> taking anatomy this semester
DarkGray has joined #ruby-lang
slyphon_away has joined #ruby-lang
<cout> you?
m3nd3s has joined #ruby-lang
justinxreese has joined #ruby-lang
Indian has joined #ruby-lang
Sailias has joined #ruby-lang
<imperator> cout, unemployed but happy, designed another game i'm hoping to get published, but gotta start looking for a job :(
<cout> DarkGray: before you call srand the first time, save a random number, then when you want to "go back to random mode", use that number as the seed
<cout> imperator: job hunting isn't much fun
<cout> imperator: especially when it means you lose your freedom
<imperator> cout, indeed
futurechimp has joined #ruby-lang
<imperator> cout, what are you going (back?) to school for? you may have told me and i've forgotten
<cout> imperator: MD
<imperator> srsly? wow
<imperator> i guess you won't be needing ruby much longer then
<cout> actually I'm getting a job doing ruby for the medical university
<DarkGray> could you show example? i try this, but same result: http://pastie.org/3548776
<cout> I hope to combine software engineering with being a doctor, but I'm not sure what that's going to look like yet
coreydaley has joined #ruby-lang
<DarkGray> cout ?
<cout> DarkGray: s = rand(2**31); srand(10); p rand(10); srand(s); p rand(10)
dejongge has joined #ruby-lang
<kalleth> lmao
<kalleth> computers are random, rite guys
JEG2 has joined #ruby-lang
virunga has joined #ruby-lang
virunga_ has joined #ruby-lang
tomzx has joined #ruby-lang
ezkl has joined #ruby-lang
* imperator randomly mentions SecureRandom
<imperator> cout, i'll be interested to see what that looks like, too :)
fayimora has joined #ruby-lang
lchi has joined #ruby-lang
mistym has joined #ruby-lang
ezkl has joined #ruby-lang
burns180 has joined #ruby-lang
burns180 has joined #ruby-lang
dajmon has joined #ruby-lang
tbuehlmann has joined #ruby-lang
<sym-> did you expect different results the second time around or what? O_O
<dajmon> hello! i am a master's student observing this chatroom for a research study. click here for more info - http://pastie.org/3547791
outoftime has joined #ruby-lang
<andrewvos> hmmm
futurechimp has joined #ruby-lang
<dajmon> (and i hope that's better, dominikh :p)
wmoxam has joined #ruby-lang
* imperator has done the study and encourages others to do it
<dajmon> :) thanks!
* apeiros_ doesn't like being a research subject…
<apeiros_> guinea pig?
<apeiros_> ah, interviews…
<dajmon> don't worry, no vivisection necessary
<apeiros_> aaaaaw =(
<dajmon> i mean, i guess if you WANT i could write it into my proposal
macmartine has joined #ruby-lang
rayners has joined #ruby-lang
Spooner has joined #ruby-lang
sym_ has joined #ruby-lang
ankurgel has joined #ruby-lang
dhruvasagar has joined #ruby-lang
m3nd3s has joined #ruby-lang
lchi has quit [#ruby-lang]
lchi has joined #ruby-lang
<andrewvos> fuck everything about programming today
<andrewvos> You know the problem with programming? Fucking programmers.
<deryldoucette> fuck everything about everything today
<deryldoucette> today is about reading and learning. programming can be done tomorrow.
<ankurgel> what the fuck is wrong?
<deryldoucette> the problem with programming is knowitall programmers with attitudes :)
srbaker has joined #ruby-lang
<dajmon> what are you reading and learning?
Phrogz has joined #ruby-lang
mytrile has joined #ruby-lang
<andrewvos> deryldoucette: Nope, even the stupid programmers
<deryldoucette> dajmon: freeswitch cookbook
kng has joined #ruby-lang
<andrewvos> deryldoucette: But I agree. The hotshot programmers are the worst. They always look good because they write the most complex bullshit and nobody has the heart to even begin to try understand it.
<lianj> bad mood day?
<deryldoucette> andrewvos: hehe i wouldn't say no one has the heart, more like people don't want to question the hotshots. because if they are wrong even ONCE.. they lose ALL credibility. The hotshot gets it wrong, THEY get forgiven with ease because they ARE hotshot programmers.
robgough has quit [#ruby-lang]
<deryldoucette> I'd keep my mouth shut too
<deryldoucette> i question something zenspider does and I'm wrong, I become a laughing stock within the (company|project) for example. He.. he gets forgiven if he makes a mistake usually with just a chuckle because he's got a proven solid track record.
<andrewvos> yeah
<andrewvos> oh well
<andrewvos> oh well, back to trying to do something completely trivial but failing at it for an entire day. Yay!
<deryldoucette> hehe been there done that.
<mistym> andrewvos: Keep fighting the good fight!
<deryldoucette> it don't get no better
reitelles has joined #ruby-lang
<andrewvos> mistym: I'm getting to the point where I would rather just take the money and try not get too upset
<deryldoucette> some days you'' kill the beast. some days the beast kills you. nature of the world :)
burns180_ has joined #ruby-lang
<felideon> is there a common ruby idiom where I can either iterate over an array, or do something else if the array is empty?
<reitelles> felideon: a simple if?
<felideon> right now i just have if foo.empty? then frob else foo.each { |x|
<felideon> ... }
<felideon> right
darkf has joined #ruby-lang
jenrzzz has joined #ruby-lang
<felideon> I was tryin: if foo.each do ... end else ... end but that doesnt seem to work :)
vienneau has joined #ruby-lang
gregmore_ has joined #ruby-lang
dfr|mac has joined #ruby-lang
<reitelles> felideon: guess not, afaik 'else' just works with 'if'
<reitelles> but that would be cool, it it worked :)
<cout> reitelles: it also works with rescue
<reitelles> cout: you're right, didn't know that
<reitelles> i checked a manual and found that it also works in 'case' expressions
<reitelles> hadn't use that yet... thought was something like 'default' :P
io_syl has joined #ruby-lang
<rue> One of these cases, or else
<cout> arr = [1, 2, 3 ]; class Empty; def ===(x); x.empty?; end; end; case arr; when Empty; puts "EMPTY"; else puts "NOT EMPTY"; end
<cout> idiomatic but overkill :(
tenderlove has joined #ruby-lang
hangingclowns has joined #ruby-lang
<hangingclowns> I have a sentence like string and I want to use a regular expression to pull out just the alphabet letters from the string and store it into another string for manipulation
<hangingclowns> how can I do that?
<hangingclowns> i have the regular expressoin, but I can't seem to find the right method
wyhaines has joined #ruby-lang
<hangingclowns> I tried chars = string[/[a-zA-Z]/] <— but this just seems to return everything up until the first whitespace
v0yager has joined #ruby-lang
<hangingclowns> actually, i tjust returns the first character
<andrewvos> hangingclowns: "weewf@£235235231131!!££!!$!%!£%! ".chars.select{|c| c =~ /\w/}.join
<andrewvos> hangingclowns: Is that what you want? it's ugly but works
<andrewvos> I'm sure you can do it with a clever regex but I hate programming too much to think about it right no
<hangingclowns> hmm
<hangingclowns> seems a bit more complicated than I thought it would be?
<hangingclowns> i thought you can just take out the characters, now I have to go through every one instead?
<rippa> string.scan(/a-zA-Z/)
<rippa> string.scan(/[a-zA-Z]/)
<rippa> I mean
curtism has joined #ruby-lang
<rippa> and .join
<rippa> ofc
<hangingclowns> yes, seems good i think
<hangingclowns> thanks rippa
<hangingclowns> trying to make a palindrome? function
<hangingclowns> where it examines a string to see if it's the same both forwards and back
<hangingclowns> but i have punctuation marks to consider.
<rippa> make a clever recursive regexp
<rippa> to check for palindromness
<hangingclowns> recursive?
<mortice> string.gsub([^\w],"").reverse == string
<mortice> sorry, with / / around the regex
<Phrogz> mortice: Nope; you need gsub! there, but then that mutates.
<mortice> Phrogz: right you are unless you apply the gsubbing on both sides :)
<rue> hangingclowns: Consider, or ignore?
<hangingclowns> i think this looks good
<hangingclowns> string.scan(/[a-zA-Z]/).join()
burns180 has joined #ruby-lang
burns180 has joined #ruby-lang
<Phrogz> hangingclowns: /[a-z]/i at least
<Phrogz> Er, /[a-z]+/i
apeiros_ has joined #ruby-lang
<Phrogz> hangingclowns: Or are you allowing foo-oof ?
<hangingclowns> just legal alphabet as far as I know
<hangingclowns> it reads the same backwards as forwards, ignoring case, punctuation, and nonword characters
<hangingclowns> so it should be a non-word character, right?
<mortice> all you need to do is:
<mortice> normalised = word.downcase.gsub(/[^w]/, "")
<mortice> normalised.reverse == normalised
<apeiros_> mortice: assuming you meant [^\w], then you can replace it with \W instead
<mortice> I meant [^\w], and that's what I typed. But good point :)
<apeiros_> hm, well, I see [^w] here…
<mortice> oh, my bad. Late in the day and the week here!
<mortice> knew I should have copy-pasted from irb
<hangingclowns> ahhh
<hangingclowns> that does look more "ruby-like"
<hangingclowns> i like that better
EvilJStoker has joined #ruby-lang
<mistym> I have a directory with a '/' in its name. That's obviously wreaking havoc on File and Dir operations. I know where the / is - how can I escape it so it isn't interpreted as a folder division?
<apeiros_> \
<mistym> apeiros_: Tried that. Oddly enough replacing the / with a \/ doesn't seem to have helped.
<apeiros_> mistym: you may need \\/
<mistym> apeiros_: I'll try that, thanks.
<andrewvos> o/
<andrewvos> |o| <-- tie fighter
burns180_ has joined #ruby-lang
<mistym> <('.')> <-- kirby
<andrewvos> ooohhh
<andrewvos> I love kirby
<dajmon> t('.'t)
<andrewvos> hahaha
<mistym> ꖯ
<mistym> Argh. dirname.gsub! '/', "\/" and .gsub! '/', "\\/" did not help.
<rippa> maybe it's not really a "/"
<rippa> maybe it just looks like
<rippa> unicode has many characters
<mistym> rippa: No, it replaced them - it just didn't help File/Dir correctly locate files in them.
darkf has joined #ruby-lang
futurechimp has joined #ruby-lang
<mistym> rippa: Problem is the directory is named 'foo/bar'. File and Dir, which work with strings, quite sensibly assume that means it's two nested directories.
<rippa> you renamed it and it still doesn't work?
<hangingclowns> What is \b in a regular expression? i need to pull out whole words, not just characters, now
<rippa> word boundary
<hangingclowns> like a space or a comma?
<Tasser> hangingclowns, like not a word anymore
flak has joined #ruby-lang
<hangingclowns> ahh, so this should work: [^\W]{1,}\b
<hangingclowns> any word character together with 1 or more characters
<hangingclowns> this should pull out full words
Tearan has joined #ruby-lang
QaDeS has joined #ruby-lang
<hangingclowns> i really gotta get into regexp
<hangingclowns> so powerful if you know how to write them
<deryldoucette> hangingclowns: i bought the mastering regular expressions book. become like a freakin bible
<hangingclowns> there's an expressions book!?
<hangingclowns> all i found was a cheatsheet online and its' been dogshit for me
<mortice> hangingclowns: you can write \w+ instead of [^\W]{1,}
<deryldoucette> yeah sec. lemme see if i can find the url for it
<mortice> \W means 'not a word character' and \w means 'word character', so there's no need to double-negate
<mortice> and + means '1 or more of preceding pattern'
<hangingclowns> \w=?
<hangingclowns> i'm picking up whole words, though
<mortice> don't see the problem
<mortice> since my regex and yours are equivalent :P
dfr|mac has joined #ruby-lang
<hangingclowns> are they?
<mortice> I believe so, unless I'm missing something obvious
<hangingclowns> i don't knkow
<mortice> \w is equivalent to [^\W]
<hangingclowns> sorry, I'm terrible at regex, really
adambeynon has joined #ruby-lang
<mortice> and + is equivalent to {1,}
<hangingclowns> really?
<hangingclowns> shit
<hangingclowns> let me fix this lol
<mortice> yea, since ^ means 'not' and \W means 'not \w'
<hangingclowns> well i'll be damned...
Jade has joined #ruby-lang
<hangingclowns> i don't know the \b?
<hangingclowns> i don't need*
<hangingclowns> (Hint: the sequence \b in a Ruby regexp means "word boundary".)
<hangingclowns> makes me nervous cause he says this?
<rue> \B is the best
<mortice> you'll still need the \b
savage- has joined #ruby-lang
<mortice> look up, I said you could write \w+\b rather than your original :)
<mortice> although to be fair, I wasn't explicit about that
<hangingclowns> so i do need \b?
<hangingclowns> i tried without the \b and i tseems the same
rippa has joined #ruby-lang
<mortice> it really depends on the problem you're trying to solve
<hangingclowns> counting words in a sentence
<hangingclowns> "A man, a plan, a canal -- Panama"
<mortice> why would you use regexes for that? :)
<hangingclowns> should have a 3x
<hangingclowns> cause why have a human do something that a machine can do in less time and not f-up :)
<mortice> sentence.split(" ").select {|s| /\w+/.match?(s) }.size
<mortice> oops, not the right method on regex
<hangingclowns> i'm just using scan
<hangingclowns> works good
<hangingclowns> no need to pslit at that
<hangingclowns> cause there are commas and other things
<mortice> ah, it's sentence.split(" ").select {|s| /\w+/.match(s) }.size
headius has joined #ruby-lang
<mortice> and tbf you don't need the argument to split
<hangingclowns> scan basicaly days what you say, but in less
<mortice> with the right regex, yea :)
<mortice> yea, to be fair, that is more elegant
vcashk has joined #ruby-lang
butchanton has joined #ruby-lang
<hangingclowns> nice
<hangingclowns> i win ;)
<hangingclowns> thanks for your help, btw
Heimidal has joined #ruby-lang
rdeshpande has joined #ruby-lang
m3nd3s has joined #ruby-lang
SuperTaz_work has joined #ruby-lang
PigDude has joined #ruby-lang
t has joined #ruby-lang
<PigDude> what if i want a method 'binding' on a class but that is a private method of Class (or something above it) so I can't override it
<mistym> Ergh. I wish I could just rename the directory but that's not an option.
<mortice> hangingclowns: no problem, sorry for confusions caused by it being Thursday afternoon and my mind not working :)
amerine has joined #ruby-lang
<hangingclowns> it's friday morning at 1:22am over here
<hangingclowns> so dont' expect much from me, either
<hangingclowns> it's been a long week
m3nd3s has joined #ruby-lang
burns180 has joined #ruby-lang
robbrit has joined #ruby-lang
<mistym> *There* we go. Apparently I can substitute a : for the /
<mistym> (Presumably OS X-specific.)
MDmalLION has joined #ruby-lang
<MDmalLION> I have a module with 2 methods how do I have the user call one of the methods
<andrewvos> MDmalLION: Module.method_name
<apeiros_> PigDude: public :methodname
MDmalLION has joined #ruby-lang
jenrzzz has joined #ruby-lang
H2H has joined #ruby-lang
<Mon_Ouie> Doesn't just overriding it make it public?
slimfit has joined #ruby-lang
<Mon_Ouie> (unless you're in a protected/private context)
<apeiros_> we can try…
<apeiros_> seems like
<apeiros_> at least in 1.9
<Mon_Ouie> class Foo; def puts; end; end; Foo.new.puts
<apeiros_> I assumed it wouldn't, since he asked
<apeiros_> I keep forgetting how people just blindly make assumptions and ask without properly checking their facts first…
<MDmalLION> git://gist.github.com/2002278.git
<MDmalLION> I want the user to type tof.etiology and have the puts statement come up
<Mon_Ouie> Giving the HTTP link would be more helpful
<MDmalLION> my bad
<hangingclowns> how does a one-line ifstatement work again?
<hangingclowns> if condition : true ? false ?
<darix> hangingclowns: foo if bar
<hangingclowns> with an else
<hangingclowns> sorry
<darix> ah
<darix> then cond ? iftrue : iffalse
wyhaines has joined #ruby-lang
<darix> cond ? iftrue : iffalse
<hangingclowns> oh okay
<hangingclowns> great
<hangingclowns> thanks
MDmalLION has joined #ruby-lang
heppy has joined #ruby-lang
dejongge has joined #ruby-lang
achiu has joined #ruby-lang
lightcap has joined #ruby-lang
turboladen has joined #ruby-lang
segy has joined #ruby-lang
SuperTa__ has joined #ruby-lang
workmad3 has joined #ruby-lang
burgestrand has joined #ruby-lang
dajmon has joined #ruby-lang
brianpWins has joined #ruby-lang
MDmalLION has joined #ruby-lang
kng has quit [#ruby-lang]
vcashk has joined #ruby-lang
Avanine has joined #ruby-lang
<imperator> it's official, der laptop ist kaput
<mistym> imperator: :(
<dominikh> *kaputt
<apeiros_> gabudd
<dominikh> only in apeiros's weird country
burns180_ has joined #ruby-lang
<apeiros_> not even there
<apeiros_> it'd be "kabutt" in my country
<apeiros_> "dä läptop isch kabutt"
<dominikh> :D
<dominikh> never going to move to there
<dominikh> -to
<apeiros_> too bad… we're hiring :)
matthewC has joined #ruby-lang
<dominikh> what's the point if I cannot understand anyone ;)
<imperator> can i work from home? ;)
<apeiros_> imperator: nope, sadly, that's a no-go :(
<apeiros_> 40h presence time is required
JoelMcCracken has joined #ruby-lang
<apeiros_> (per week)
<imperator> dominikh, don't worry, everyone speaks esperanto as a compromise
<dominikh> imperator: haha...
babinho has joined #ruby-lang
<apeiros_> g
<apeiros_> imperator: naaa, esperanto is so 1980 - we speak lojban
<dominikh> I speak lolcats
seanstickle has joined #ruby-lang
<imperator> deryldoucette, what's this about being persecuted or something?
* imperator was at Best Buy, being told the bad news
TheDracle has joined #ruby-lang
<TheDracle> So, I can create a new Class, with Class.new, how do I have it include a module?
<apeiros_> Class.new do include Module end
<apeiros_> also, include is just a method
<apeiros_> so you can do: klass.send :include, Module
<apeiros_> the send is necessary because include is private
Gray has joined #ruby-lang
<Phrogz> or klass.instance_eval{ include m }
<apeiros_> iirc if you only do a single operation, that's more expensive than send
<TheDracle> Ah, I like the second way.
<TheDracle> Thanks :)
<apeiros_> (but that's premature optimization :D)
<Gray> t will do the same thing every time you seed it with the same number. If you want to get different numbers again (like what happens if you never use srand), then just call srand 0. This seeds it with a really weird number, using (among other things) the current time on your computer, down to the millisecond.
<Gray> but if i set srand 0 - random don't works.
<rippa> how?
macmartine has joined #ruby-lang
<apeiros_> Gray: use `srand` instead of `srand 0`
<apeiros_> (or just don't call srand at all)
<Gray> aperios_, hmm let me try...
<apeiros_> Gray: hint, use tab-completion for nicks
<apeiros_> then you don't typo them…
<Gray> apeiros_: thx)))
<Gray> apeiros_: doubles thx, `srand` works fine)
krzyhoo has joined #ruby-lang
<krzyhoo> andrewvos: my man
<krzyhoo> you made my day yesterday
<krzyhoo> did some work today
<krzyhoo> and manage to create an awesome xml erb template for my project
wyhaines_ has joined #ruby-lang
tekin has joined #ruby-lang
wyhaine__ has joined #ruby-lang
<hangingclowns> anyone know of an easy way to loop through an array of arrays with a 2 element array of strings for player data?
<hangingclowns> the arrays in a form of a tournament
<Phrogz> hangingclowns: Depends on what you need. You could just nested_array.flatten.each{ |str| ... }
<burgestrand> I heard you like arrays, so I put some arrays in your arrays with arrays in them :x
<Phrogz> Is it [ [ ['foo', 'bar'], ['jim', 'jam'] ] ] or [ ['foo', 'bar'], ['jim', 'jam'] ]? It's the former, right?
<burgestrand> I was also a bit confused by that one
<hangingclowns> no
<Phrogz> You could also (Ruby 1.9) nested.flatten(1).each{ |p1,p2| ... }
<Phrogz> Oh, then just array_of_tuples.each{ |p1,p2| ... }
<hangingclowns> maybe my coding is not so great :(
<hangingclowns> but i think it's readable
<Phrogz> Oh, so it's an array of arrays of arrays of two-element arrays?
<hangingclowns> yeah
<krzyhoo> f***. i think i really F-ed up. Had to install git on windpows and now some of the documents i am watching on windows are marked as Macintosh (even though i use only windows and linux)
<hangingclowns> you'll see at the bottom of my gist, tourney =
<hangingclowns> then you'll see what i mean
<Phrogz> So tourney.flatten(2).each{ |p1,p2| ... }
<hangingclowns> well I have a get winner that will return the winner array
<hangingclowns> any need for flatten?
<jaimef> can you specify the location of a Rakefile with rake(1)?
* Phrogz HATES the game where the rules are figuring out what the OP actually needs.
<Phrogz> krzyhoo: Sounds like you need to change your line ending settings on git.
<hangingclowns> this is definitely a fun game, though
<hangingclowns> this kind of exercise is fun, i think
<hangingclowns> but definitely hard to think about
<krzyhoo> Phrogz: well did what the guys suggsted
<krzyhoo> LF in Git
<krzyhoo> CRLF in windows
<krzyhoo> and it really fed up
<Phrogz> hangingclowns: No, that was a backhanded insult do you not saying what you really needed when you asked your question. :)
wallerdev has joined #ruby-lang
<krzyhoo> anyways, is there a gem to pretty pring an XML ?
<krzyhoo> i have an entire xml dicument in a variable (created from an erb templaet) and there are a lot of ugly whitespaces
<krzyhoo> wiould like to make it more sexy
<hangingclowns> so, i don't understand what you just said Phrogz
<Phrogz> krzyhoo: You can use Nokogiri
<krzyhoo> seem like an overkill loading nokogiri just for that :)
<Phrogz> krzyhoo: You want to pretty-print XML, which means parsing it. What could be simpler than using an XML parser?
<krzyhoo> Phrogz: point taken :)
<Phrogz> BTW, see my answer on that link, not the XSLT one :)
ascarter has joined #ruby-lang
<krzyhoo> Phrogz: can you explain what"s in the brackets?
<krzyhoo> Nokogiri::XML(html,&:noblanks)
lightcap has joined #ruby-lang
<Phrogz> It's the same as Nokogiri.XML( html ) do |doc| doc.noblanks; end
achiu has joined #ruby-lang
srbaker has joined #ruby-lang
<krzyhoo> ok, but what does html mean?
<krzyhoo> since we are formatting xml?
<Phrogz> krzyhoo: That question that I linked you to was about pretty-printing HTML
<Phrogz> 'html' is whatever variable holds your string with XML source.
vmatiyko has joined #ruby-lang
<krzyhoo> thanks man
<krzyhoo> cheers
<Phrogz> You're welcome.
srbaker has joined #ruby-lang
<dajmon> is anyone else interested in doin' an interview today?
burns180 has joined #ruby-lang
<rue> I can, but I'll only talk about my new album, not GnR
<outoftime> dajmon: ?
coreydaley has joined #ruby-lang
Skif has joined #ruby-lang
srbaker has joined #ruby-lang
butchanton has joined #ruby-lang
<shevy> lol
ascarter has joined #ruby-lang
jenrzzz has joined #ruby-lang
jasonw22 has joined #ruby-lang
davpoind has joined #ruby-lang
Keva161 has joined #ruby-lang
qpingu has joined #ruby-lang
<dajmon> outoftime: for research i'm doing, more info here - http://pastie.org/3547791
<outoftime> dajmon: how short is short?
<dajmon> as short as you like, typically it's taken about half an hour but if you have less time than that i can just cover the main topics w/o going into details with you
ilyam has joined #ruby-lang
<burgestrand> Oh, yeah, you were the talk of the channel last time I was in here too
<dajmon> uh oh
<dajmon> that doesn't bode well for observational bias
<burgestrand> I could talk to you for a little while if it would help you, can’t make any guarantees it’ll be a full half hour though :)
<dajmon> that'd be great :)
senj has joined #ruby-lang
Stalkr_ has joined #ruby-lang
naz has joined #ruby-lang
vmatiyko has quit [#ruby-lang]
virunga has joined #ruby-lang
H2H has joined #ruby-lang
ascarter has joined #ruby-lang
publicvoid has joined #ruby-lang
justinmcp has joined #ruby-lang
<krzyhoo> Phrogz: can i use nokogiri to validate my document against an external dtd file?
butchanton has joined #ruby-lang
<Phrogz> krzyhoo: I don't know the answer, but I think not. XSD yes, DTD no (I think).
pw_ has joined #ruby-lang
<Phrogz> If libxml2 does it, I bet Nokogiri does. Let's see.
<rue> That's basically what it boils down to
nevynxxx has joined #ruby-lang
<krzyhoo> the software i am usingf (Informatica PowerCenter) uses DTD to validate
<krzyhoo> and i have only DTD
<Phrogz> I'm wrong.
wallerdev has joined #ruby-lang
<Phrogz> But I've never used it, so I'm not sure how you pull the DTD in and reference it properly.
urbino has joined #ruby-lang
<krzyhoo> gotta play with it :)
<krzyhoo> but the pretty printing works great
<urbino> hello all
<urbino> what is the best way (concise) to test that all members of one array are in another?
<Phrogz> krzyhoo: This looks promising, validating a DTD against a document: http://nokogiri.org/Nokogiri/XML/DTD.html#method-i-validate
<krzyhoo> excellent
<Phrogz> urbino: (a1 & a2).length == a1.length
burns180_ has joined #ruby-lang
gjaldon has joined #ruby-lang
<urbino> the first array will be smaller then the compared
<imperator> Phrogz, hm, can't you just do a1 & a2 == a1?
<Phrogz> imperator: Simpler, yes. Silly me. (Maybe not as fast, but who cares?)
<Phrogz> urbino: That's fine.
<krzyhoo> urbino: its maths
<krzyhoo> logic
<krzyhoo> so Phrogz is right
<imperator> urbino, fire up irb and try a few sample arrays
nevynxxx has joined #ruby-lang
<urbino> Phrogsz: will do
<imperator> the downside of losing my laptop is that i think i lost my ms office and msvc++ license
mssola has joined #ruby-lang
srbaker has joined #ruby-lang
<krzyhoo> guys how about a bestpractise question. what is better (acc to best practices)
robbrit has quit [#ruby-lang]
burns180 has joined #ruby-lang
<krzyhoo> workflow_xml = Nokogiri::XML(template.result(binding),&:noblanks)
<krzyhoo> or splitting this into two: processing erb and pretty printing in the next line
<krzyhoo> as in:
<Phrogz> krzyhoo: Two lines is more self-documenting, since you can name the local variable xml_source
<krzyhoo> xml = template.result(binding)
<urbino> won't work
<krzyhoo> workflow_xml = Nokogiri::XML(xml,&:noblanks)
<urbino> Phrogz: the element size of a1 is smaller the the element size of a2
<Phrogz> krzyhoo: Since not everyone will know ERB
<krzyhoo> Phrogz: thanks. besindes, i should also get it in 6 months :)
<Phrogz> urbino: This does not matter. The set intersection of the two will produce all the arrays in a1 if they are also in a2.
<urbino> Ahh
<deryldoucette> imperator: err? what do you mean persecuted
<Phrogz> [1,3,2,17] & [3,1,2,42,17] #=> [1, 3, 2, 17]
<urbino> Phrogz: (a1 && a2) is giving me a union
l0st1 has joined #ruby-lang
<imperator> use one "&"
<Phrogz> urbino: No, it's returning the first array. && -> boolean guard operator; Array#& set intersection Array#| set union
<Phrogz> a1=[1,2,17]; a2=[2,1,42]; [ a1&a2, a1|a2, a1&&a2, a1||a2 ] #=> [[1, 2], [1, 2, 17, 42], [2, 1, 42], [1, 2, 17]]
Caius has joined #ruby-lang
havenn has joined #ruby-lang
<Phrogz> Sorry; a1 && a2 would return the second array; a1 || a2 would return the first array. Neither are what you want :)
<urbino> Phorgz: Got it. Thanks it does work. I had to standardize the strings in the arrays to boot
twittard has joined #ruby-lang
io_syl has joined #ruby-lang
<urbino> How many columns wide is the max limit considered good practice in Ruby?
<urbino> columns wide == code line length
<imperator> 79
gix has joined #ruby-lang
<erikh> there's a limit?
<imperator> erikh, been reading too much rails source code lately, have ya?
<erikh> eh, chef
mosca_ has joined #ruby-lang
<erikh> I've got a 1080p monitor, 14pt font and full screen vim
<erikh> and some lines still scroll past the end
<TTilus> 14pt sounds awfully big
slimfit has joined #ruby-lang
<shevy> hah
<shevy> old people have bad eyes and need large fonts man
<imperator> and by "old" he means "over 40"
<TTilus> i have two 80 chars wide terms and three equally wide emacs frames side by side
<apeiros_> or they've got hi-dpi screens…
<shevy> 40 is already one step in the grave
lsegal has joined #ruby-lang
<pw_> erikh: THATS MY MAN! 14p all the way!
* imperator runs his osx terminals at 24pt
<apeiros_> though, pt is actually a resolution independent measure
<TTilus> apeiros_: it was pt not px
<shevy> imperator I know your health situation, every time you breathe slowly anyway ... ;)
<TTilus> apeiros_: exactly
<apeiros_> not that browsers actually paid any attention to that detail…
<erikh> I'm not over 40.
<rue> Too
<erikh> I do have bad eyes though.
<erikh> I have to spend extra on optician techniques to avoid having milton glasses
<urbino> Phrogz: I can't use a set as it will eliminate duplicates, which is a valid case
<TTilus> erikh: a friend of mine, an old skool nerd celebrity btw, has -11.5 glasses
<erikh> yeah, the guy who does "vm" for emacs has some screenshots of his setup
<erikh> guy has to be nearly blind
<Phrogz> urbino: So, then (a1&a2)==(a1&a1)
<Gray> rand(500) generate random number from 0 to 500. How to generate from 450 to 500 ?
<rippa> either
<rippa> random(51)+450
<rippa> *rand
<rippa> or rand(450..500)
jxie has joined #ruby-lang
<apeiros_> Gray: you're mistaken
<apeiros_> rand(500) is *not* 0 to 500, it's 0 to 499
<apeiros_> (500 distinct values)
<Gray> apeiros_: ok, thx.
<rippa> well, it's "to 500 not inclusive"
musha68k has joined #ruby-lang
<Gray> rippa: when i try rand(450..501) i got error
<apeiros_> your ruby ain't new enough for that then
m3nd3s has joined #ruby-lang
<rippa> it's 1.9.3
<rippa> try Random.new.rand(450..500) though
<Gray> puts "LAST TIME IT WAS IN..." + rand(1930..1960).to_s + "!"
<rippa> I think that used to work
<Gray> ok, thx let me try...
<Gray> ruby -v in windows cmd shows: ruby 1.8.7 (2012-02-08 patchlevel 358) [i386-mingw32]
<lianj> 1.8 and windows :|
<lianj> sad panda
<Gray> sad sad sad :)
<apeiros_> indeed
<apeiros_> you'll have to resort to rand(min+max)-min
<Phrogz> wow
<apeiros_> (of course you can precalculate min+max)
<TTilus> urbino: would multiset (bag) be what you are after?
RomyRomy has joined #ruby-lang
musha68k has joined #ruby-lang
francisfish has joined #ruby-lang
<Gray> Random.new.rand(1930..1960) #=> uninitialized constant Random
<rippa> apeiros_: rand(max-min+1)+min
<rippa> drop +1
<rippa> ah, no, it's needed
musha68k has joined #ruby-lang
<Gray> also what you use? MAC OS? / Linux?
<apeiros_> rippa: correct, +1 is needed, thanks for the correction
<TTilus> im mostly on linux
<imperator> i thought Random was added in 1.9
<TTilus> and a little on mac and maemo (which i think counts as linux)
hangingclowns has joined #ruby-lang
amerine has joined #ruby-lang
digman543 has joined #ruby-lang
<Gray> rippa: so, i try: puts "LAST TIME IT WAS IN..." + rand(1950-1930+1)+1930.to_s + "!" #=> LAST TIME IT WAS IN...1028!
<rippa> (rand(1950-1930+1)+1930).to_s
<Phrogz> Or better: puts "LAST TIME WAS IN #{ rand(1950-1930)+1930 }!"
<rippa> yeah, that too
<urbino> TTilus: Its good reading but no I do not need a multiset, thanks http://bit.ly/xZPpaS
<Gray> rippa: puts LAST TIME IT WAS IN..." + (rand(1950-1930+1)+1930).to_s + "!" #=> OOHH LAST TIME IT WAS IN...285!
<Gray> Phrogz: What is this #{} ? where i can read about it?
<rippa> string interpolation
burns180_ has joined #ruby-lang
<rippa> Gray: works here
RomyRomy has joined #ruby-lang
rolfb has joined #ruby-lang
<urbino> will the keyword return break out of a function/method in ruby?
<rippa> yes
<rippa> you could even say
Nss has joined #ruby-lang
<rippa> it will return control
<Phrogz> heh
<TTilus> ...to caller
<Gray> Phrogz: thanks, #{} is convenient
adambeynon has joined #ruby-lang
cyri_ has joined #ruby-lang
postmodern has joined #ruby-lang
<urbino> how does the syntax for "map function to array" work?
vbatts has joined #ruby-lang
<urbino> work == look
<apeiros_> ary.map { |ele| …do something with ele… }
<apeiros_> ri Array#map
<apeiros_> comes with examples.
<urbino> ri == ruby-docs.org ?
<tekin> So is there a better way to force a variable to a boolean than this: !! var_or_nil
<Mon_Ouie> Gray: rand(1930..1950) in Ruby 1.9.3
<Gray> Mon_Ouie: i understand, thanks
<apeiros_> tekin: define better.
<apeiros_> but yes, there is: !!var_or_nil
<apeiros_> (spaces ftl)
<tekin> apeiros_ yeah, it just feels…. a bit icky
<tekin> was curious as to whether there was another way
jenrzzz has joined #ruby-lang
Zolrath has joined #ruby-lang
erics has joined #ruby-lang
RomyRomy_ has joined #ruby-lang
<urbino> http://pastebin.com/tMgn0iQW stylistic notes welcomed
achiu has joined #ruby-lang
burns180_ has joined #ruby-lang
dfr|mac has joined #ruby-lang
brushbox has joined #ruby-lang
<Gray> task at the end of chapter: Ctrl+f "leap ears" http://pine.fm/LearnToProgram/?Chapter=06
<Gray> okay?
<Mon_Ouie> I'd rather use a range and iterate over it
<Mon_Ouie> That would avoid having syear only being the starting year for the first iteration, also
<shevy> hmm
<shevy> say you have a big project... you started to rewrite it... finished 20% then you lost some motivation
<shevy> what now
<shevy> :(
RomyRomy has joined #ruby-lang
<Gray> Mon_Ouie: range? how i can use range in ruby? could you show me please?
<Asher> shevy - smoke a bowl and get back to work?
<shevy> Asher hmm but I dont smoke! :(
<Asher> there you go!
<Asher> creative tricks you haven't exhausted yet;)
<Gray> what does mean smoke a bowl?
<Gray> :)
<shevy> Gray you dont wanna know!
<Mon_Ouie> (10..20).each { |n| puts n }
WillMarshall has joined #ruby-lang
<rue> Leap ears sounds nasty
<Gray> rue: in russian it's sound's like "visokosniy" ;)
<Gray> and thats - nasty
RomyRomy has joined #ruby-lang
<Gray> Mon_Ouie: thank you!
dreinull has joined #ruby-lang
hagabaka has joined #ruby-lang
hagabaka has joined #ruby-lang
<Phrogz> shevy: I do that just about once a month :(
<shevy> hmmm
<Phrogz> shevy: You're not saying that you were modifying files outside of source control and now have a broken product, right?
<shevy> don't you guys have strategies against that
<shevy> Phrogz, nah
<shevy> but I was like "This all sucks tremendously. It's better to start from scratch."
<Phrogz> shevy: My strategy is to say "shiny!" to the new project that distracted me and not look back.
<shevy> and now I am like "Hmm. It used to suck, but it worked better than it does right now..." :(
<shevy> lol Phrogz
Heimidal has joined #ruby-lang
headius has joined #ruby-lang
m3nd3s has joined #ruby-lang
<shevy> hmm
<shevy> to check whether something like awesome_print is available
<shevy> can I do:
<shevy> if (require 'awesome_print')
<shevy> ?
<Asher> nope
<outoftime> shevy: just do the require and rescue a LoadError
Giddeon has joined #ruby-lang
<Asher> outoftime - why would require raise a LoadError?
<outoftime> Asher: if it's not available
<Asher> oh i totally misread
Heimidal has joined #ruby-lang
slyphon has joined #ruby-lang
burns180_ has joined #ruby-lang
<urbino> whats wrong with this: array1.each {|x| array2 < x} ?
<Asher> what's it telling you is wrong with it?
<Phrogz> urbino: What's 'wrong' with it is that it has no side effects.
<heftig> urbino: everything. what are you trying to do?
<darkf> urbino: everything you do is wrong
<urbino> NoMethodError: undefined method
<wmoxam> so helpful :D
<yorickpeterse> Is there a clean way of completely disabling shell access from Ruby? The laziest way is to redefine Kernel#system and Kernel#` but that's not very bulletproof
<Phrogz> urbino: Is 'array2' actually an array? What does it mean to ask if [1,2,3] < 'z' ?
<heftig> yorickpeterse: $SAFE
<heftig> only available in MRI
<Asher> urbino - you're giving little bits of information that aren't enough to direct you properly
<urbino> I would like to unest a list of lists one level at a time (not flatten)
<Phrogz> "unest"?
<urbino> un-nest
<yorickpeterse> heftig: SAFE disables much more than that
<wmoxam> urbino: I think you mean array2 << x
<urbino> and << to append the array was my intention
<yorickpeterse> I can't really use it since some of the code actually needs, for example, File.expand_Path
<wmoxam> urbino: you are trying to append, right?
<urbino> right
<Phrogz> urbino: So does your code actually do <<, or what you wrote above?
Faris has joined #ruby-lang
<urbino> Yes it <<
<Asher> yorickpeterse - my understanding is that there are some sandboxing efforts but that the most successful thus far involve patching the ruby install (recompiling)
<wmoxam> urbino: how about array2.concat(array1)
<Gray> Guys, after i finish that book: http://pine.fm/LearnToProgram. Can i start learn Ruby on Rails? Or i should focus on Ruby?
<urbino> array1.each {|x| array2 < x}
<Phrogz> urbino: Then what's your real code and real error message?
<wmoxam> urbino: that is easier and better
<urbino> array2 was already initialized earlier
<urbino> array2 = Array
<urbino> then
<yorickpeterse> Asher: ugh
<Phrogz> urbino: No no no
<urbino> the block I posted
<Phrogz> array2 = [] If you do array2 = Array then array2 is the class Array
<Phrogz> (Or perhaps you meant array2 = Array.new
<urbino> Ahh.
<Spooner> And in your pasted example, < is not at all the same as <<
<Asher> urbino - also, have you looked at Array#flatten
<wmoxam> ...
<urbino> I want to un-nest one level at a time not flatten
<Asher> what does un-nest mean to you
WillMarshall has joined #ruby-lang
havenn has joined #ruby-lang
<yorickpeterse> Blegh, tempted to just redefine all shell related methods in Ruby
<Asher> yorickpeterse - what's the context you need/want to do this?
<urbino> iteratate over elem[0] and elem[1]
<urbino> each elem has more in them but I do not want to flatten it yet
<urbino> more arrays in them
<Asher> so flatten to depth of 1
<urbino> array.flatten(1) ?
<Asher> ya
<Asher> or flatten!
<urbino> Hmm
<Asher> if you want to modify the array instead of create a copy
<yorickpeterse> Asher: I'm running a demo of a CMS which takes user input and sanitizes it. Technically this means Ruby code can't be executed in any way. However, I want to be 110% sure that people can't do things like `rm -rf * # herp derp`.
<yorickpeterse> Or using FileUtils for that matter
<yorickpeterse> $SAFE would be suitable if it wouldn't kill the entire app
<Phrogz> Asher: not "to a depth of 1", but "by a depth of 1"
tekin has joined #ruby-lang
<Asher> phrogz - sure but you understood what i meant
gsav has joined #ruby-lang
<Phrogz> Yes, but urbino seems to understand so little, I thought it best to be clear in front of him/her :)
<shevy> hehe
<shevy> urbino will master ruby in less than 4 weeks
<shevy> yorickpeterse you can check the input via a method you can control?
<shevy> I mean before the ``
<shevy> cant believe master matz would not have thought about this!
<yorickpeterse> That's already done sort of. The method checks for certain template tags (which would allow Ruby code) and escapes them
<yorickpeterse> Like I said, I just want to be 110% sure it's not possible in this case :)
<yorickpeterse> Playing around with $SAFE now and it seems my app actually works with it, I thought it would break it
<postmodern> yorickpeterse, use Shellwords.shellescape
<postmodern> yorickpeterse, or your evaling it?!
<yorickpeterse> No
<shevy> hmm
<yorickpeterse> Basically what the method does is 1. escaping template tags 2. optionally cleaning HTML using Loofah
<shevy> _why used to have this sandbox, which then led to the creation of BasicObject
<postmodern> yorickpeterse, you could spawn a new Thread and set $SAFE to 4
<yorickpeterse> So for example, if somebody inserts "#{herp derp}" that will result in "\#\{herp derp\}" which isn't evaluated by the template engine
<Asher> it would be neat to have a history page about the various developments that have happened to ruby
<urbino> Shevy: I hope so. Ruby has been nagging at me for a while, but I program in python so there was never a better then good reason to switch
benanne has joined #ruby-lang
<urbino> Phrogz: I am a dude, don't know what to say except thanks for your help, and it is somewhat funny being a complete noob
<yorickpeterse> Hm, $SAFE = 3 seems to be the way to go
havenn has joined #ruby-lang
<yorickpeterse> Thanks for the suggestions/help :)
RomyRomy has joined #ruby-lang
<urbino> I thought I would have gotten flamed once or twice already : )
<yorickpeterse> People only flame when it involves Rails
<yorickpeterse> or Coffeescript
burns180 has joined #ruby-lang
<Phrogz> urbino: We're all complete noobs in the things we haven't learned yet. It happened to us all, and is ongoing. (I had to pay someone $50 to get ImageMagick working again on my linux box because I'm such a noob at managing packages and cleaning up my own shit.)
<shevy> yeah urbino I can understand that
<shevy> ruby and python seem to overlap in their respective niche more than other languages
<shevy> with perl it is easier - you can switch to a new language :D
<Asher> Phrogz - admittedly, ImageMagick is one of the biggest messes around
<urbino> With the success of the higher level languages, I worry no one will be competent enough to maintain the legacy opensource stuff in c/c++
WillMarshall has joined #ruby-lang
jenrzzz has joined #ruby-lang
<yorickpeterse> Aw fuck, $SAFE is file specific
<drbrain> yorickpeterse: no it's not
<heftig> urbino: no, compilers aren't yet good enough
<drbrain> it's thread-specific though
<yorickpeterse> drbrain: hold on, let me crack open some code
<yorickpeterse> drbrain: https://gist.github.com/2003783 `ruby b.rb` outputs 0
dreinull has joined #ruby-lang
<drbrain> yorickpeterse: hrm
<yorickpeterse> Either that means I'm an idiot and don't understand $SAFE or its file specific :)
<matti> drbrain: Hi ;]
<rue> It'd be so useless if it was…
<drbrain> hi matti
<urbino> heftig: Yes, but the virtual machines are taking over, LLVM and JVM and making room for coffeescript and ruby-cuda
<heftig> urbino: they still don't produce code that's good enough to replace C at a low level
leonL has joined #ruby-lang
<drbrain> yorickpeterse: looking at safe.c, and printing the threads, the safe level should be the same across the require
<heftig> also, there's a world of difference between LLVM and JVM
<drbrain> but… obviously not
<yorickpeterse> Perhaps a bug?
mytrile has joined #ruby-lang
srbartlett has joined #ruby-lang
<yorickpeterse> Onwards my Chrome, to the Ruby bugtracker we go!
<rue> Could it be because the require *is* an unsecure operation?
<rue> Er, insecure
<urbino> heftig: Different directions in goals?
<yorickpeterse> Wouldn't it throw an exception in that case?
<rue> That's my point
<rue> Seems a little iffy to roll it back because of that, though
<rue> With no warning
Boohbah has joined #ruby-lang
<drbrain> yorickpeterse: perhaps
<heftig> urbino: yes. the jvm is high-level, pretty much compile-once run-anywhere, has its own code loader, ABI, memory model, is object-oriented, stack-based
lightcap has joined #ruby-lang
<rue> Am I entirely fabricating a recollection that the rule is to load everything first, and only then change the safe level?
<yorickpeterse> That's what I'm doing in that example
<yorickpeterse> err wait
<rue> No, not exactly
<yorickpeterse> hmm
<yorickpeterse> hold on, let me test this with the particular app
rdeshpande has joined #ruby-lang
<yorickpeterse> Nope, doesn't make a difference
<heftig> urbino: LLVM is pretty much just used as part of a compiler (JIT or AOT). it's a register-based vm that abstracts the architecture, so you can do architecture-agnostic transformations on it
<shevy> does anyone know offhand whether it is possible to use different colours with awesome_print?
<shevy> for the keys of a hash specifically... right now it conflicts with my terminal colours :(
<heftig> yes
davidw has joined #ruby-lang
<heftig> here's my .irbrc that does a lot of things, among screwing with AP's colors
<shevy> cool
burns180_ has joined #ruby-lang
<drbrain> yorickpeterse: actually, I think this is necessary behavior
srbaker has joined #ruby-lang
<drbrain> because require doesn't work at $SAFE > 0
<shevy> heftig: right now what awesome_print does is this http://www.pictureupload.de/originals/pictures/080312232540_UPLOAD.png
<shevy> lemme play around a little :)
<drbrain> so you can bump safe in your file, but it won't blow up other code until you actually use it (not while building it
achiu has joined #ruby-lang
<Asher> anyone know how to create a DOCTYPE tag in nokogiri for HTML 5?
<Asher> ie <!DOCTYPE html>
<yorickpeterse> drbrain:hmmm
<urbino> Heftig: so java not being focused on abstracting the registers on the underlying system is why java/jvm has not taken over as the language for cell processors and gpus?
<yorickpeterse> Ah well, I'll just have to trust my tag escaper
<heftig> urbino: no, GPUs are completely different
<Asher> drbrain - hmm i thought that was for the DTD to go with the DOCTYPE.. lemme try
dejongge has joined #ruby-lang
<drbrain> Asher: it's just a guess, I didn't try
aza_kibou has joined #ruby-lang
<urbino> Heftig: Completely different from what?
brownies has joined #ruby-lang
<drbrain> yorickpeterse: you can use a Thread
andkerosine has joined #ruby-lang
<drbrain> Thread.new { $SAFE = 4; run_your_thread_escaper }.value
<heftig> urbino: CPUs
<urbino> RIght
Heimidal has joined #ruby-lang
<heftig> you don't do object-oriented programming on GPUs
<yorickpeterse> drbrain: The problem is that it's escaped way before being executed and I have no control over the latter
H2H has joined #ruby-lang
<drbrain> yorickpeterse: ah :/
lightcap has joined #ruby-lang
<drbrain> heftig: are there any OO processors at the instruction level?
RomyRomy_ has joined #ruby-lang
<Asher> drbrain - hum that seems to create <DOCTYPE></DOCTYPE>
<drbrain> Asher: dang
<Asher> is there a way to make it not have a closing tag?
<heftig> drbrain: don't know of any
chimkan has joined #ruby-lang
<drbrain> Asher: also, it should be <!DOCTYPE>
<Asher> right
<Asher> and have html, i believe
<urbino> RIght, JVM was built to not crash the underlying system, manage memory, and provide better OO support. LVM is built to abstract underlying architechter and make it available for compilers in a language agnostic way.
<Asher> the problem is that it makes me create the DTD with the same #new as Nokogiri::XML::Node, which takes 2 args - the name and a document
<Asher> so i have the name as either DOCTYPE or !DOCTYPE, both of which create a pair
<Asher> not sure what else to try
<Asher> and telling the document to render to html creates an HTML 4.01 DTD
woollyams has joined #ruby-lang
Heimidal has joined #ruby-lang
dreinull- has joined #ruby-lang
RomyRomy_ has joined #ruby-lang
<Asher> what an asshole comment: def initialize name, document ; # ... Ya. This is empty on purpose. ; end
<yorickpeterse> lol
retro-in-better- has joined #ruby-lang
<yorickpeterse> So before I "casually" dump a Reddit link in here, what's the policy of this channel about self promotion?
<Asher> it would have been so easy to write # defined in parallel C source file
<Asher> i'd say self promotion is encouraged so long as it doesn't suck
<yorickpeterse> ha
<drbrain> yorickpeterse: ^^ ditto
<yorickpeterse> Well, in that case "I'll just leave this here": http://www.reddit.com/r/ruby/comments/qnzdk/zen_a_modular_and_flexible_ruby_cms_that_doesnt/
<yorickpeterse> Hopefully that raises some awareness amongst Rubyists, Reddit usually works quite well for it
lightcap has joined #ruby-lang
RomyRomy has joined #ruby-lang
RomyRomy_ has joined #ruby-lang
<shevy> I am so slow
<shevy> on my todo list is to write something larger with sinatra
<andkerosine> Define "larger".
<shevy> hmm
workmad3 has joined #ruby-lang
<shevy> something that is non-trivial to do in good ancient ruby-cgi for instance
burns180 has joined #ruby-lang
<shevy> I dunno... something that displays data from some yaml files and has fancy buttons and thingies to re-arrange the page... and store the position of rearranged boxes and stuff
<andkerosine> Ooh, that's fancy.
<urbino> How do I get just the values from a Hash?
<yorickpeterse> urbino: Hash#values
<yorickpeterse> e.g.
<yorickpeterse> {:name => 'Ruby'}.values # => ["Ruby"]
<urbino> My mistake, I was using an array
<yorickpeterse> :)
headius has joined #ruby-lang
TheMoonMaster has joined #ruby-lang
gsav has joined #ruby-lang
acyed has joined #ruby-lang
<zenspider> .map(&:last)
<zenspider> yay! lots of cleanup on sexp_processor, ruby2ruby, and ParseTree!
<andkerosine> Question: Why would allowing block methods with parameters be bad?
<andkerosine> %w[foo bar baz].map { |e| e[2] }
<andkerosine> %w[foo bar baz].map(&:[2])
<andkerosine> Trite example, but the gist is there.
<andkerosine> I saw that somebody monkey-patched it together, although I can't remember where, but I recall both he and ruby-lang saying it's frowned upon, and I can't quite grasp why.
t has joined #ruby-lang
Sailias has joined #ruby-lang
<workmad3> andkerosine: are you wondering why monkey-patching is bad in general, or why adding the ability to respond directly to :[2] is bad, or something else?
<andkerosine> The latter.
<andkerosine> We can pass methods as symbols to Enumerable methods, which is awesome, but why only parameter-less ones?
<Phrogz> andkerosine: The proc returned by Symbol#to_proc can already receive multiple parameters from the block:
<Phrogz> So you're not so much asking about the proc receiving parameters, but rather you want to create a curried lambda based on parameters you pass in.
<Phrogz> You could make your own Symbol#curried_proc method, but it wouldn't get to use the & syntax.
<andkerosine> New terms.
<Phrogz> You'd have to do .map(:[].curried_proc(2))
<andkerosine> Mm-hmm.
<andkerosine> I'll have to look for where I saw it.
burns180_ has joined #ruby-lang
burns180_ has joined #ruby-lang
<Phrogz> I suppose you could override Symbol#to_proc with your own version that looked for () or [] and pulled the value out from the string.
<workmad3> andkerosine: I can guess how to monkey-patch that support on... you'd monkey-patch a method-missing on to Array that matches against a regex like: /\[[\d]+\]/
<Phrogz> And then eval'd it in the binding of the caller, so that bar=42; ... &:foo(bar) would work. Oof.
Swimming_Bird has joined #ruby-lang
<Phrogz> Er, &:"foo(bar)" rather. Uglier and uglier.
<andkerosine> Mm-hmm.
<andkerosine> It's certainly not a pretty way to go about it, I just thought it was nice syntactic sugar.
<andkerosine> I shall leave the idea alone.
<Phrogz> Here's a neater idea: Array#to_proc http://www.ruby-forum.com/topic/191078#833288
<Phrogz> Then no evalling.
headius has joined #ruby-lang
<andkerosine> It's beautiful. : )
<Phrogz> Though that particular implementation does not support receiving additional parameters from the block beyond yours.
tenderlove has joined #ruby-lang
senj has joined #ruby-lang
Carnage\ has joined #ruby-lang
Sailias has joined #ruby-lang
Sailias_ has joined #ruby-lang
Avanine has joined #ruby-lang
Karmaon has joined #ruby-lang
coreydaley has joined #ruby-lang
burns180 has joined #ruby-lang
dv310p3r has joined #ruby-lang
<zenspider> rawr
shevy has joined #ruby-lang
<Phrogz> Oh shit, we woke up the spider.
<Asher> drbrain - FYI figured it out: document_frame = ::Nokogiri::XML::Document.new ; document_frame.create_internal_subset( 'html', nil, nil ) # => <!DOCTYPE html>
hangingclowns has joined #ruby-lang
<zenspider> Asher: he took off for an eye appt
<Asher> cool - i figure he'll see it upon return.. in any case was just following up on his attempt to answer my question :)