Topic for #ruby-lang is now Ruby 1.9.3p0: http://ruby-lang.org | Paste >3 Lines of Text on http://pastie.org
<drbrain> include both errors
eggman2001 has quit [#ruby-lang]
<tedwing> sounds good. Will do.
<tedwing> drbrain: thanks again!! I'm going to head out.
<drbrain> tedwing: awesome
tedwing has quit [#ruby-lang]
Stalkr_ has joined #ruby-lang
dbussink has joined #ruby-lang
Gunnar_ has joined #ruby-lang
srbartlett has joined #ruby-lang
naz has joined #ruby-lang
twittard_ has joined #ruby-lang
looopy has joined #ruby-lang
<zenspider> rawr
tomzx has joined #ruby-lang
havenn has joined #ruby-lang
MistyM has joined #ruby-lang
anthony has joined #ruby-lang
chimkan has joined #ruby-lang
Heimidal has joined #ruby-lang
sebicas has joined #ruby-lang
seanstickle has joined #ruby-lang
andrewhl has joined #ruby-lang
ttilley has joined #ruby-lang
qpingu has quit [#ruby-lang]
neoesque has joined #ruby-lang
<devn> How can I add a method to Hash that will allow me to coerce it to an openstruct for dot access?
<devn> I want to access locals by dynamically creating an openstruct from a hash.
<injekt> devn: Why would you want to? Just do OpenStruct.new(hash) ?
<injekt> oh
<injekt> well, yeah
<devn> o = {foo: 1}.objectize!
<devn> o.foo => 1
<devn> how do I add objectize! on Hash?
<injekt> o = OpenStruct.new(foo: 1); o.foo => 1
<injekt> seriously, you dont need to monkeypatch hash
<devn> i just want to for the sake of doing it
<injekt> class Hash; def objectize!; OpenStruct.new(self); end; end
<devn> injekt: hm, thanks -- didn't think it'd be that easy. I was doing something crazy: hash.each {|k,v| struct.send("#{key}=", val) }
<injekt> openstruct is smart
xaio has joined #ruby-lang
twittard has joined #ruby-lang
* injekt walks away quickly
<matti> LOL
qpingu has joined #ruby-lang
Karmaon has joined #ruby-lang
<xaio> Would you guys mind helping me with my ruby question? If I have JavaScript that does this: hex_hmac_sha1(salt.value, hex_sha1(cfadminPassword.value)); I would like to be able to do that in ruby.
<xaio> My first unsuccessful attempt at it is here: http://pastebin.com/ZiDh8pKB
<xaio> What I did was, this: OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), salt, passwd).unpack('H*')[0].upcase
<matti> Or do the OpenSSL version ;]
sideshownz has joined #ruby-lang
<xaio> I thought that my solution would be correct, but it is not.
<drbrain> xaio: the tests do OpenSSL::HMAC.new(@key, "MD5")
<drbrain> so maybe OpenSSL::HMAC.new(salt, "SHA1").hexdigest(passwd)
<matti> Hi drbrain :))
<drbrain> matti: hi
<matti> ;]
<drbrain> ha, sweet
<matti> Man, technology is so great.
<matti> A live stream from above the planet.
<matti> Imagine that.
headius has joined #ruby-lang
Heimidal has joined #ruby-lang
ylluminate has joined #ruby-lang
Sailias has joined #ruby-lang
<xaio> drbrain: I get "wrong number of arguments 1 for 0" for hexdigest
<drbrain> xaio: oh, I should have looked closer, OpenSSL::HMAC.new("salt", "SHA1").update("passwd").hexdigest
<drbrain> or OpenSSL::HMAC.hexdigest("SHA1", "salt", "passwd")
<drbrain> all in one line
<drbrain> err, call
<drbrain> (that takes care of the unpack part)
<xaio> oh cool
<matti> And yields a string.
<matti> Already hex, IIRC.
<matti> Um. New Twitter web site is... funky.
sebicas has quit [#ruby-lang]
beiter has joined #ruby-lang
Heimidal has joined #ruby-lang
<xaio> drbrain: that hash is coming out to be a different value compared to if I run it in JavaScript. Is that because the JavaScript is calling sha1 on the password string too?
<drbrain> xaio: that would make a difference, yes
<drbrain> you'll need to do both, I guess
lordofth1dance has joined #ruby-lang
<xaio> drbrain: so hex_hmac_sha1(salt.value, hex_sha1(passwd)); would look like... OpenSSL::HMAC.hexdigest("SHA1",salt, OpenSSL::HMAC.new(passwd, "SHA1").to_s)
sideshownz has joined #ruby-lang
<drbrain> I think OpenSSL::Digest::SHA1.hexdigest(passwd)
<drbrain> for the inner
macmartine has joined #ruby-lang
Austin__ has joined #ruby-lang
Sailias has joined #ruby-lang
<xaio> drbrain: you got it. Thanks man!
fayimora has joined #ruby-lang
gix has joined #ruby-lang
Sailias_ has joined #ruby-lang
havenn has joined #ruby-lang
takaokouji has joined #ruby-lang
andrewhl has joined #ruby-lang
lsegal has joined #ruby-lang
slimfit has joined #ruby-lang
SuperTaz_work has joined #ruby-lang
WillMarshall has joined #ruby-lang
Luxx_ has joined #ruby-lang
mksm has joined #ruby-lang
twittard_ has joined #ruby-lang
fayimora_ has joined #ruby-lang
ttilley has joined #ruby-lang
m742 has joined #ruby-lang
neoesque has joined #ruby-lang
cldwalker has joined #ruby-lang
Karmaon has joined #ruby-lang
srbartlett has joined #ruby-lang
gjaldon has joined #ruby-lang
dv310p3r has joined #ruby-lang
slyphon has joined #ruby-lang
srbartle_ has joined #ruby-lang
replore_ has joined #ruby-lang
brownies has joined #ruby-lang
andrewhl has joined #ruby-lang
brianpWins has joined #ruby-lang
SuperTa__ has joined #ruby-lang
srbartlett has joined #ruby-lang
headius has joined #ruby-lang
chimkan has joined #ruby-lang
Banistergalaxy has joined #ruby-lang
<Banistergalaxy> Hey boys
uniqanomaly has joined #ruby-lang
gokul has joined #ruby-lang
havenn has joined #ruby-lang
<andkerosine> You find yourself alone in a vast wasteland.
<zenspider> you will prolly get eaten by a grue?
twittard has joined #ruby-lang
lightcap has joined #ruby-lang
banistergalaxy has joined #ruby-lang
<banistergalaxy> hey dudes
rippa has joined #ruby-lang
kaiwren has joined #ruby-lang
gnufied has joined #ruby-lang
igotnolegs has joined #ruby-lang
<andkerosine> Your pleasant greetings reverberate off the invisible walls of a desolate nothing, heard by nobody.
<banisterfiend> far gone in eyes with a vacuous vapor
<gjaldon> hi
<any-key> sup
<banisterfiend> any-key: yo yo yo
<banisterfiend> any-key: not a lot, sitting in a car near a park near the sea
<banistergalaxy> any-key: what's up with u
<any-key> s/with/wit
<gnufied> sounds fun.
<banistergalaxy> gnufied: how is your memory profiler project going
wmoxam has joined #ruby-lang
<gnufied> well, kinda stopped for now.
<gnufied> changing priorities etcetra..
sideshownz has joined #ruby-lang
gjaldon has joined #ruby-lang
<andkerosine> So, I'm thinking about switching to Dvorak: http://i.imgur.com/DTeTB.png
<zenspider> yup yup
<andkerosine> You use?
replore has joined #ruby-lang
<TTilus> no, seemed like very little gain from a lot of hassle
<zenspider> but of course
<zenspider> huh... I had no idea that u was used that infrequently
<zenspider> ruby -e 'h = Hash.new 0; File.read("/usr/share/dict/words").scan(/[aoeui]/).each { |c| h[c] += 1 }; p h.sort_by { |k,v| -v }'
<zenspider> andkerosine: drbrain, me, aja, dean... lots of seattle.rb members use dvorak
<banistergalaxy> zenspider: did you learn to touch type on it?
<zenspider> sorry... I crossed wires. dean is an emacs user... but a dirty qwerty user
<banistergalaxy> or do u just do your own thing
<zenspider> banistergalaxy: I touch type
<andkerosine> zenspider: I used my own source code to generate the heatmaps, so there's that.
<andkerosine> I imagine U /is/ more common, I just apparently don't use it much?
<zenspider> andkerosine: nope. run that command above (assuming you have osx)
<andkerosine> Huh.
<zenspider> change the path if you're on linux to whatever is appropriate
<andkerosine> Just as a quick guess... 5%?
<zenspider> it's impressively less
<zenspider> [["e", 234413], ["i", 200536], ["a", 196995], ["o", 170062], ["u", 87145]]
<andkerosine> Huh. You have more words than I.
<andkerosine> [["e", 233907], ["i", 200130], ["a", 196411], ["o", 169774], ["u", 87006]]
<zenspider> hah
<TTilus> uhm, counting letters from dict words instead of text corpus?
<andkerosine> Wonder what that's about...
<TTilus> hows that supposed to help?
<zenspider> TTilus: you're a negative nancy
<andkerosine> A fair point, though, which I why I used my own code for the visual.
<TTilus> zenspider: my second name :)
<andkerosine> Wanted to see how worth it it'd be to switch.
<andkerosine> Looks pretty convincing. : )
<zenspider> hamlet: [["e", 16123], ["o", 10054], ["a", 8373], ["i", 7053], ["u", 4598]]
<zenspider> andkerosine: I like it and it certainly is worth it for me.
<TTilus> zenspider: why not use your codebase instead of hamlet?
<zenspider> because it's too large?
<TTilus> or do you intend to became prosaist using oldish english
<TTilus> too large =D
<zenspider> still running...
Heimidal has joined #ruby-lang
<zenspider> [["e", 4234960], ["a", 2264802], ["o", 1877260], ["i", 1836703], ["u", 908668]]
<TTilus> you DO have significant amount of letters in ur codebase
<zenspider> still doesn't make sense why i is a reach and u is not
kp666 has joined #ruby-lang
xaio has joined #ruby-lang
MistyM has joined #ruby-lang
<TTilus> y did u leave y out?
<zenspider> andkerosine: anyhow... if you think you should make the jump, I highly recommend it. all in all it'll take about 10 days to rewire all the neurons but only 3-4 to start being productive again
<TTilus> (i can imagine why did u leave out å, ä and ö out tho)
<zenspider> for starters, y isn't on home row
<TTilus> oh
<TTilus> me n00b
<erikh> dvorak! ruuuuuun
<TTilus> assumed u just counted wovels
brianpWins has joined #ruby-lang
<TTilus> im just plain too lazy to switch
gianlucadv has joined #ruby-lang
<devn> zenspider: is using openstruct as a refactoring for "#{args[:foo]}" * 100 a reasonable solution doing away with the syntax overhead of hash access?
<devn> for* doing away with
<devn> o.foo vs args[:foo]
<devn> stylistically...
sideshownz has joined #ruby-lang
<andkerosine> OpenStruct is inefficient.
neoesque has joined #ruby-lang
chimkan_ has joined #ruby-lang
<banistergalaxy> andkerosine: often that's not an issue though
<banistergalaxy> i use OpenStruct for config stuff
<andkerosine> Admittedly, that's a bit of a stretch.
<zenspider> efficient? why use ruby if that's a concern?
<banistergalaxy> andkerosine: as another point though, Struct uses native code iirc
<andkerosine> = Good Thing, no?
<andkerosine> zenspider: The world, even the programming one, is not so black-and-white.
<zenspider> bah
<andkerosine> Use Ruby for programmer happiness not speed, but don't throw efficiency to the wind unnecessarily.
<zenspider> bah again
Karmaon has joined #ruby-lang
<gnufied> zenspider is running low on tea.
S2kx has joined #ruby-lang
<zenspider> oooh. tea sounds good. it's nice and cold outside
<erikh> I wore shorts to work today
<zenspider> (and I'm at beer && code and I'll have to walk home in it)
estepesantes has joined #ruby-lang
<estepesantes> hello world
PatrixCR has joined #ruby-lang
Karmaon has joined #ruby-lang
Tref has joined #ruby-lang
<Tref> guys i have an interesting question about modules
<Tref> can someone take a look at this
<Tref> its just a simple module example where I'm trying to initialize a new object based off another module included in the module
<Tref> if i initialize a class within a module with another module, shouldn't I be able to call the methods of the module I initialized the class with from the instance?
<Tref> or from an instance of it...
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
postmodern_ has joined #ruby-lang
srbartlett has joined #ruby-lang
<nofxx> Suppose user.comments.each { |n| n.do_something } in mongoid .... and user has 10k comments, why it goes until eat all ram? should'nt GC free the obj?
<nofxx> Am I missing something stupid?
sideshownz has joined #ruby-lang
JohnBat26 has joined #ruby-lang
<rippa> Tref: you don't store session anywhere
<zenspider> Tref: your question doesn't make sense to me
Karmaon has joined #ruby-lang
<andkerosine> His answer is instance variables, if that helps clear it up.
<zenspider> methods don't bleed into other objects
spupuser2 has joined #ruby-lang
spupuser2 has quit ["Leaving"]
<zenspider> nofxx: um... if user.comments gets all the objects first, it won't GC anything but junk that n.do_something creates
<zenspider> but if mongoid provides something to defer full fetching, then yeah. your theory makes total sense
<Tref> andkerosine: yeah that should definitely work
<Tref> i just figured if my initialize method was returning an instance of one class that it would still have all its methods
<Tref> but i guess that's just wrong
<andkerosine> Afraid so.
<Tref> I'm still getting my feet wet here so....
<Tref> alright then
<Tref> well at least i know now :)
<andkerosine> All in good time.
SuperTaz_work has joined #ruby-lang
<andkerosine> Note the lack of parentheses on #new in my fix. : P
<andkerosine> I imagine it's a habit from some other language, but generally Ruby code should leave them out of a method call if there are no parameters.
havenn has joined #ruby-lang
<rippa> or like this
lightcap has joined #ruby-lang
macmartine has joined #ruby-lang
andkerosine has quit [#ruby-lang]
<nofxx> hmm.. can get better? user.comments.each { |n| n.do_something; nil }
Karmaon has joined #ruby-lang
<nofxx> Damn.. just need to figure out why some workers crash with 'Resque::DirtyExit' when god restarts'em....
<nofxx> only fix I've found is get rid of redis dump... no big deal, but boring
krz has joined #ruby-lang
<Tref> rippa: and kerosine: that second one was more like it
<Tref> i thought if initialize returned session it would be the same thing
<Tref> but i guess i was thinking about that more in terms of variables not classes
<rippa> Tref: but it doesn't return session
<rippa> it can though
<Tref> but then would i be able to call instance.metadata?
<Tref> I'm thinking no
<Tref> that's what I'm asking is possible i goes
<Tref> not goes… guess
<zenspider> Tref: do the simplest thing that could possibly work
thone_ has joined #ruby-lang
yxhuvud has joined #ruby-lang
<zenspider> Tref: return in initialize does _nothing_
<zenspider> completely ignored
<Tref> ah
<zenspider> and you're assigning session to a local variable and then throwing it away
<Tref> yeah, rippa I thought what you just put up would work also, but it does not
<zenspider> self.session = xxx
<rippa> forgot about initialize thing
<rippa> lol
<zenspider> Tref: why should x.metadata work?
<TTilus> time to refactor refactoring plans...
achiu has joined #ruby-lang
ttilley has joined #ruby-lang
ttilley has joined #ruby-lang
havenn has joined #ruby-lang
<yxhuvud> zenspider: well, return still breaks the execution of initialize, so nothing is hardly correct. The return value is ignored though.
<zenspider> yxhuvud: I was referring to returning a result
<zenspider> I should have been more clear
|Vargas| has joined #ruby-lang
|Vargas| has joined #ruby-lang
_bryanp has joined #ruby-lang
butchanton has joined #ruby-lang
havenn has joined #ruby-lang
krz has joined #ruby-lang
krz has joined #ruby-lang
macmartine has joined #ruby-lang
solars has joined #ruby-lang
lake has joined #ruby-lang
krz has joined #ruby-lang
brianpWins has joined #ruby-lang
<jtoy> can that cause memory leaks?
<erikh> unless you use eval? probably not
twelvechairs has joined #ruby-lang
Fullmoon has joined #ruby-lang
<twelvechairs> esoteric question. Is there a simple way to be able to sort objects in a regular way (eg by object_id) however, where enumerables, ensure that duplicates (eg. 2 arrays with the same contents) always end up in the same spot?
JohnBat26 has joined #ruby-lang
<theconartist> twelvechairs: what do you mean by same spot?
<theconartist> that there are no duplicates or that they are adjacent
lightcap has joined #ruby-lang
QaDeS has joined #ruby-lang
<twelvechairs> theconartist: that they are adjacent
<lsegal> i think he means that the order for objects that are equal is considered undefined and might produce two distinct arrays if you run the sort more than once
zmack has joined #ruby-lang
looopy has joined #ruby-lang
<twelvechairs> yeah. what lsegal said
<twelvechairs> more or less
lsegal` has joined #ruby-lang
fritzek has joined #ruby-lang
mytrile has joined #ruby-lang
neko_gata_s has quit [#ruby-lang]
<theconartist> i don't understand at all
dc5ala has joined #ruby-lang
cyri_ has joined #ruby-lang
daglees has joined #ruby-lang
daglees has joined #ruby-lang
Dotan has joined #ruby-lang
roadkith has joined #ruby-lang
<zenspider> twelvechairs: you want to sort by object_id EXCEPT where sub-collections are concerned?
<twelvechairs> zenspider: yeah. where
<twelvechairs> well. doesn't have to be by object_id, but by anything where every object is comparable....
chendo_ has joined #ruby-lang
<twelvechairs> I think I'm getting my head around this anyway (writing a reasonable comparison routine) :) just seemed for a sec that there must be a simpler solution ....
<zenspider> what are you ACTUALLY trying to do? high level?
<theconartist> i can't see any possible use case for what you explained^
fayimora has joined #ruby-lang
<twelvechairs> I'm trying to turn a series of place-inspecfic arrays into a tree of data, so for instance ["a",[1]] sits below ["a"] and [1], and [[1],"a"] will resolve to the same place.
<twelvechairs> ... if that makes sense
<yorickpeterse> Morning
senthil has joined #ruby-lang
<senthil> anyone use spinach in place of cucumber?
senthil has quit [#ruby-lang]
senthil has joined #ruby-lang
gianlucadv has joined #ruby-lang
<zenspider> I love spinach
<zenspider> raw, with a little olive oil, balsamic, salt, and pepper. last week I made a really nice one with chicken sauted in olive oil, a serrano pepper, and bourbon... nom nom nom
<senthil> zenspider: you got my hopes all up
<zenspider> now I'm hungry
fayimora has joined #ruby-lang
zmack_ has joined #ruby-lang
zmack has joined #ruby-lang
<shevy> hehe
<shevy> I liked a special sort of pancake, with cheese + spinach wrapped inside the (fairly thin and small) pancake. I hate spinach but it's ok when it's not too much, and enough cheese covering it
<zenspider> different from a crepe? where from?
<senthil> kik
<senthil> *lol
<senthil> just to clarify, i meant the bdd cucumber like integration test tool: spinach
robotmay has joined #ruby-lang
queequeg1 has joined #ruby-lang
<shevy> oh... good point. I suppose it's quite similar to a crepe zenspider ... but I was proud that it was always "home-made" :P
<zenspider> mmmm... or swimming rama... with nice spicy hot peanut sauce over fresh slightly wilted spinach ... some tofu or chicken
tekin has joined #ruby-lang
zmack has joined #ruby-lang
krz has joined #ruby-lang
toretore has joined #ruby-lang
jorgenpt has joined #ruby-lang
<zenspider> I hate cooked spinach tho...
<senthil> bunch of spinach + 2 apples in a fruit jucier = yum!
<twelvechairs> zenspider: cooked spinach is great. spinach and ricotta/feta is an eternal combination
Fullmoon has joined #ruby-lang
<zenspider> not gonna happen
skryking has joined #ruby-lang
krzkrzkrz has joined #ruby-lang
krzkrzkrz has joined #ruby-lang
krzkrzkrz has joined #ruby-lang
nebbie has joined #ruby-lang
rohit has joined #ruby-lang
futurechimp has joined #ruby-lang
roha has joined #ruby-lang
frangiz has joined #ruby-lang
mytrile has joined #ruby-lang
kitallis has joined #ruby-lang
Xzyx987X has joined #ruby-lang
tla_ has joined #ruby-lang
EvilJStoker has joined #ruby-lang
lorenzo_ has joined #ruby-lang
futurechimp has joined #ruby-lang
logbot69648 has joined #ruby-lang
kaiwren has joined #ruby-lang
robwilliamsukio has joined #ruby-lang
brownies has joined #ruby-lang
logbot54291 has joined #ruby-lang
zenspider has joined #ruby-lang
Xzyx987X has joined #ruby-lang
rohit has quit [#ruby-lang]
headius has joined #ruby-lang
Jake232 has joined #ruby-lang
Defusal has joined #ruby-lang
tbuehlmann has joined #ruby-lang
rohit has joined #ruby-lang
qpingu has quit [#ruby-lang]
x0F has joined #ruby-lang
Asher has joined #ruby-lang
parzo has joined #ruby-lang
kain has joined #ruby-lang
spectra has joined #ruby-lang
Stalkr_ has joined #ruby-lang
gix has joined #ruby-lang
fayimora has joined #ruby-lang
twelvechairs has joined #ruby-lang
drbrain has joined #ruby-lang
Fullmoon has joined #ruby-lang
looopy has joined #ruby-lang
futurechimp has joined #ruby-lang
rohit has joined #ruby-lang
divoxx has joined #ruby-lang
Fullmoon has joined #ruby-lang
rohit has quit [#ruby-lang]
<yorickpeterse> #ruby-lang is the quiet today
jwollert has joined #ruby-lang
[dmp] has joined #ruby-lang
[dmp] has joined #ruby-lang
masterkorp has joined #ruby-lang
Muz has joined #ruby-lang
roha has joined #ruby-lang
vdrab has joined #ruby-lang
demeth has joined #ruby-lang
fayimora has joined #ruby-lang
Stalkr_ has joined #ruby-lang
kb9agt has joined #ruby-lang
stamina has joined #ruby-lang
mark_locklear has joined #ruby-lang
vdrab has joined #ruby-lang
looopy has joined #ruby-lang
m742 has joined #ruby-lang
danishman has joined #ruby-lang
Stalkr_ has joined #ruby-lang
Stalkr_ has joined #ruby-lang
codewrangler has joined #ruby-lang
ramonmaruko has joined #ruby-lang
alessio_rocco has joined #ruby-lang
<Tasser> +m ?
wyhaines has joined #ruby-lang
MistyM has joined #ruby-lang
<yorickpeterse> heh, typo
<yorickpeterse> I was supposed to say "too quiet"
elux has joined #ruby-lang
Spooner has joined #ruby-lang
jbwiv has joined #ruby-lang
wmoxam has joined #ruby-lang
sternicus has joined #ruby-lang
jxie has joined #ruby-lang
xaio has joined #ruby-lang
robbrit has joined #ruby-lang
vdrab has joined #ruby-lang
yfeldblum has joined #ruby-lang
futurechimp has joined #ruby-lang
slyphon has joined #ruby-lang
<shevy> hmm is there a simple way to keep a variable like "x" as an alias to variable "y"? I mean right now I do this via a method, and assign x = y at the end of it, so it's no problem. Just wondering whether there exists a better way
gjaldon has joined #ruby-lang
Fullmoon has joined #ruby-lang
tekin has joined #ruby-lang
tokumine has joined #ruby-lang
Jake232 has joined #ruby-lang
robotmay has joined #ruby-lang
divoxx has joined #ruby-lang
jtoy_ has joined #ruby-lang
sternicus has joined #ruby-lang
sternicus has joined #ruby-lang
jtoy_ has joined #ruby-lang
dv310p3r has joined #ruby-lang
robotmay has joined #ruby-lang
ramonmaruko has joined #ruby-lang
tomzx has joined #ruby-lang
scampbell has joined #ruby-lang
dfr|mac has joined #ruby-lang
dfr|mac_ has joined #ruby-lang
<yorickpeterse> Objects are references by default
<yorickpeterse> So I'm not sure if you'd need anything fancy for it
rippa has joined #ruby-lang
slyphon has joined #ruby-lang
virunga has joined #ruby-lang
Heimidal has joined #ruby-lang
<shevy> oh true lol
csherin has joined #ruby-lang
outoftime has joined #ruby-lang
headius has joined #ruby-lang
zmack has joined #ruby-lang
zmack has joined #ruby-lang
Jay_Levitt has joined #ruby-lang
tekin has joined #ruby-lang
Sailias_ has joined #ruby-lang
uniqanomaly has joined #ruby-lang
scampbell has joined #ruby-lang
_bryanp has joined #ruby-lang
adambeynon has joined #ruby-lang
wmoxam has joined #ruby-lang
enebo has joined #ruby-lang
dcheung has joined #ruby-lang
slyphon has joined #ruby-lang
rayners has joined #ruby-lang
<darix> yorickpeterse: just wondering ... wouldnt a better statement be: variables are references to objects by default?
slimfit has joined #ruby-lang
<rue> That implies they don't have to be
kp666 has joined #ruby-lang
<erikh> hey guys
bglusman has joined #ruby-lang
ruxpin has joined #ruby-lang
<deryl> morning
<ruxpin> hi, I have a class that is being monkey-patched at run time by another library (by an unused method) so was wondering how to unregister this (instance) method from the class?
<erikh> don't require that file
<erikh> (iow, you can't)
imajes has joined #ruby-lang
<erikh> oh, just plucking a method
<erikh> hrmmmmm
<erikh> Module#undef_method
dfr|mac has joined #ruby-lang
<erikh> but once monkeypatches are applied, you can't get rid of them as a unit
<erikh> just something to be aware of.
<ruxpin> the scenario is that 3rd party lib inserts a method to an active record instance that has a db attribute with the same name
<Phlogistique> couldn't you do something like
<erikh> good patches will do something like alias foo bar; def bar(); my_thing; foo; end
<Phlogistique> GlobalClass_ = GlobalClass
<Phlogistique> require 'monkey/patching'
<Phlogistique> GlobalClass = GlobalClass_
<Phlogistique> ?
<erikh> you could, but I bet he can't catch it that early
<ruxpin> hmm
<ruxpin> I am thinking either undefin the method (will try that first) and if it doesn't work, explicitly define the setter and getter method to override the monkey patch
<erikh> that could have other consequences
<erikh> e.g., if it calls that method and expects certain return values.
Heimidal has joined #ruby-lang
<erikh> I'd just trash the plugin.
<ruxpin> I don't know, however how to create "self.attr =" method (not having to call the setter without space as "self.attr=")
<erikh> attr_accessor :attr
<ruxpin> that won't be then stored to db (it is an active record object)
<ruxpin> the funny thing is, this problematic lib is not used in production, it is a testing utility :)
kp666 has joined #ruby-lang
leonL has joined #ruby-lang
kp666 has joined #ruby-lang
willdrew has joined #ruby-lang
kp666 has joined #ruby-lang
willdrew has joined #ruby-lang
kp666 has joined #ruby-lang
<darix> ruxpin: yeah but even in testing this is problematic imho
anthony has joined #ruby-lang
leonL has joined #ruby-lang
<ruxpin> the hard core solution is to change the db column name
kp666 has joined #ruby-lang
S1kx has joined #ruby-lang
<S1kx> anyone have a decent ruby coding VM setup under windows that actually works?
<darix> S1kx: virtualbox + opensuse?:p
<S1kx> recently 80% of the time i should work is spent on fixing crashing GNOME (under virtualbox), rubymine being stupid about I/O errors after crashes and various other stupid UI problems with linux mint under virtualbox
<S1kx> i have used ubuntu before, tried with both gnome and kde (i personally dislike unity)
mephux has joined #ruby-lang
<darix> did you try installing it natively on your work machine?
<darix> S1kx: in a serious note... there is rubyinstaller
kp666 has joined #ruby-lang
<darix> which should get you the ruby interpreter for windows
<lianj> use the archlinux and lightweight wms, luke!
<S1kx> im developing eventmachine apps that dont really run under windows -,- plus some gems that dont work there either, which is the whole reason for having that work vm
<S1kx> ruby on windows is where i originally started, but switched to this like a year ago
<darix> S1kx: so back to installing linux natively?
<darix> and lianj pekwm ftw^^
<lianj> darix: a c++ wm? no thanks ;)
<S1kx> nope :/ after having used linux in VMs for quite a while now, I still prefer a lot of stuff under windows. apart from that though i develop windows apps/games (and yes i know i can run windows in a vm there)
<darix> lianj: darix 4844 0.0 0.0 59288 3880 ? Ss Jan18 0:26 /usr/bin/pekwm
chimkan_ has joined #ruby-lang
<darix> lianj: and it is very keyboard friendly
<darix> S1kx: so 2 computer! one with linux one with windows ;)
<S1kx> :p i would have already bought an imac if i had the money
<darix> so because you dont have enough fun already
<darix> you would add a 3rd OS to the mix
<darix> very smart ;)
_bryanp has joined #ruby-lang
<S1kx> i would replace linux with mac os
<lianj> why would you need gnome/kde in that vm at all? (for eventmachine devel)
<lianj> even X
<darix> lianj: maybe he doesnt know vim?
<S1kx> are you asking: why dont you just use a console?
<lianj> yea, or rather ssh
<darix> S1kx: and you would get all the funny things with poll/select fun on osx :D
<S1kx> possibly because clicking with a mouse is about 10 times faster than typing out what you want on the keyboard
<darix> S1kx: rofl
_bryanp has joined #ruby-lang
<darix> by the time you moved your hand to the mouse. most vim users are done with the action you want to click
* lianj speechless
<darix> anyway
_bryanp has joined #ruby-lang
<lianj> windows users, they think all shells are like cmd.exe :P
<darix> actually powershell had some interesting concepts
<S1kx> no i'm actually using vim for quite some stuff, but i dont know all 200 commands, so navigating around isnt exactly comfortable -,-
<S1kx> darix: is it worth it?
<darix> yes
<tobiasvl> S1kx: welcome to vim
mrchrisadams has joined #ruby-lang
chimkan has joined #ruby-lang
<Phlogistique> S1kx: it's still way easier to learn than Emacs
darkf has joined #ruby-lang
<S1kx> i'll give it a try, ty
erics has joined #ruby-lang
<Phlogistique> I think it is an error to believe that command-line interfaces are successful because they are inherently better than graphical ones
<Phlogistique> they are successful because worse is better
slyphon has joined #ruby-lang
darkf has joined #ruby-lang
tbuehlmann has joined #ruby-lang
dkannan has joined #ruby-lang
andrewhl has joined #ruby-lang
slimfit has joined #ruby-lang
nofxx has joined #ruby-lang
nofxx has joined #ruby-lang
uniqanomaly has joined #ruby-lang
<Phlogistique> tobiasvl: that's completely orthogonal to what I was saying
<erikh> show me how to pipe a gui tool to another gui tool
<tobiasvl> Phlogistique: yeah ;)
<darix> Phlogistique: i am not saying that guis are bad, but many gui tools force you to too much mouse usage. thats why i had a long time of fun to find a very keyboard friendly window manager
headius has joined #ruby-lang
<Phlogistique> darix: the mouse is an extremely powerful tool
<Phlogistique> it's much more efficient for pointing and clicking than any keyboard
<darix> Phlogistique: it requires me to move my hand of the keyboard. when i could do the same action with 2-3 clicks on my keyboard
<darix> Phlogistique: keybindings are not point and click
<Phlogistique> yeah, elephant are not carrots
<darix> but carrots are tasty
<darix> havent tried elephants yet
<erikh> yeah
<erikh> imagine using a programmer's editor with a mouse
<Phlogistique> erikh: well, imagine using pure data or Max/MSP without a mouse
<erikh> that doesn't mean it should all be one way or another
<erikh> I guess that's what I'm saying
<Phlogistique> (actually I find pure data anti-ergonomic enough that I wish I could use it with only the keyboard)
fayimora has joined #ruby-lang
<erikh> one thing I've found in computing is that purist notions are pretty much ivory tower bullshit at best
<erikh> (I'm looking at you, haskell)
<Phlogistique> well, Haskell has brought a lot to Ruby!
<erikh> haha
<erikh> of course it has
<erikh> just like lisp and perl and fortran have.
<Phlogistique> yeah, and Lisp is very serious about being faithful to its core paradigm too
<Phlogistique> (turtles all the way down)
<erikh> there's paradigms and there's purisms
<erikh> haskell in particular goes out of its way to seem pure when you need hack atop hack (hi, monads) to get anything done
<erikh> ocaml's nice about this -- it's all, "we want you to be pure, but when you can't be, here's a bunch of things we made for you to use"
<Phlogistique> it's rather fallacious to call abstractions "hacks"
<erikh> I disagree.
kaiwren has joined #ruby-lang
<Phlogistique> anyway, the Haskell community usually tries to be rather practical; and since you have the IO monad, purity is not much more of an obstacle to that than all the other problems Haskell have
<Phlogistique> their motto is not "Avoid success at all costs." for nothing :)
Heimidal has joined #ruby-lang
<erikh> heh.
heppy has joined #ruby-lang
ivanoats has joined #ruby-lang
divoxx has joined #ruby-lang
dustacio has joined #ruby-lang
dfr|mac has joined #ruby-lang
tommyvyo has joined #ruby-lang
<shevy> hmm
dfr|mac has joined #ruby-lang
slimfit has joined #ruby-lang
<erikh> how is it 9am and I am exhausted already
<rue> Monads are a handwave
<erikh> these are not the pure functional components you're looking for
<erikh> that reminds me
<erikh> rue: can I get you to look at that project again when you get time?
<erikh> just tell me if it looks like a piece of shit
<erikh> really not looking for much more than that
<rue> Ah, sure
melter has joined #ruby-lang
<erikh> thanks dude
<rue> I've had weird days this week; I was even mostly away from the internets for almost a day and a half
<erikh> fixing your wife's computer? :)
<rue> Among other things, yeah
<rue> I also played some games or, more accurately, installed various mods and played around with settings in preparation of actually playing
<erikh> heh
<erikh> skyrim?
<rue> And Oblivion
<erikh> oh yeah.
<rue> And Batman AC
<erikh> is that any good?
<erikh> I've been thinking of getting kingdoms of amalur too -- watched a friend play it, looks pretty neat.
<erikh> nice balance of high action and story telling
<rue> The wife likes it, I think that's what she's mostly been playing
yxhuvud has joined #ruby-lang
Oloryn_lt1 has joined #ruby-lang
<rue> Batman is mostly just fun at this point, been smacking bad guys upside the head with the spiffy combat animations
<erikh> yeah, sounds like arkham asylum
<erikh> wearing my nerd badge with pride: I've been playing a lot of Magic the Gathering: Online lately
<erikh> the old school client/server thing with the full card support
<erikh> deck building, etc
<rue> That does make regular D&D seem much less nerdy.
<wmoxam> I bought a pack of MTG cards the other day, first time that I have in something like a decade
<erikh> heh
stephenp has joined #ruby-lang
<wmoxam> it's changed a lot
<erikh> yeah, you buy the cards online just like you would normally
<wmoxam> wtf planeswalker card type
<erikh> oh yeah
<stephenp> how do i create an instance of a class defined in ruby from a c extension? send "new" to the class constant would be my guess, but there doesn't appear to by any "rb_get_const" like function?
savage- has joined #ruby-lang
Heimidal has joined #ruby-lang
lordofthedance has joined #ruby-lang
Heimidal has joined #ruby-lang
dustacio has joined #ruby-lang
<stephenp> there it is const_get. well, that makes perfect sense.
tekin has joined #ruby-lang
dejongge has joined #ruby-lang
publicvoid_ has joined #ruby-lang
phazenine has joined #ruby-lang
dfr|mac has joined #ruby-lang
dous_ has joined #ruby-lang
alessio_rocco has joined #ruby-lang
achiu has joined #ruby-lang
grough has joined #ruby-lang
grough has quit [#ruby-lang]
<oddmunds> any remember how i can tell bundler to look for dependencies in the gemspec?
<oddmunds> i'm pretty sure i've seen it somewhere. you put look_in :gemspec or something in the Gemfile
H2H has joined #ruby-lang
<whitequark> oddmunds: gemspec
<whitequark> just that
<oddmunds> ah, thanks
alessio_rocco has joined #ruby-lang
<gjaldon> hi guys
<gjaldon> i'm teaching myself ruby through chris pine's learn to program and i'm stumped with one of his arrays exercises
<rippa> probably slicing again
<gjaldon> i'm supposed to display inputs of the user in an alphabetical order without using the sort array method
<gjaldon> was wondering if i could get tips on how to do it
<rippa> you could implement your own sorting
alessio__ has joined #ruby-lang
<virunga> gjaldon, use binary search and <=> operator
mytrile has joined #ruby-lang
<kain> given two array of integers, what's the best way to return a true/false value if they have differences? i.e. they does not contain the same elements
<rippa> virunga: binary search works with sorted data
<virunga> rippa, right
<virunga> :P
<gjaldon> what's a binary search? sorry, still new to ruby
<gjaldon> and programming in general
<virunga> gjaldon, nevermind
<rippa> gjaldon: it's a method to find a value in a sorted list
<rippa> kain: try intersection
Defusal has joined #ruby-lang
Defusal has joined #ruby-lang
<rippa> a1 & a2
<kain> rippa, in rspec we have this nice [ 1, 2, 3 ].should =~ [ 4, 2, 3 ]
<kain> :D
<gjaldon> virunga: so how's the syntax for the binary search?
<kain> rippa, & returns the common elements..
<rippa> gjaldon: it's not builtin
<rippa> kain: or empty array if no common elements
<gjaldon> rippa: oh so it's a method I need to build myself
<rippa> oh, wait
<kain> rippa, I just need to check if there's at least one difference
<rippa> can there be duplicates?
<gjaldon> unfortunately, i'm not yet at that chapter and need to make do with whatever is built in 'cept for the array sort method. and no duplicates
<rippa> I asked kain, sorry
<kain> rippa, don't care actually
Austin__ has joined #ruby-lang
<kain> usually not
<rippa> (a1 | a2) == a1
<rippa> oh wait
<rippa> I need to think
<kain> just wondering how to do in ruby something like rspec:
<kain> RSpec also provides a =~ matcher for arrays that disregards differences in the ording between the actual and expected array.
<kain> cannot find the source atm
Heimidal_ has joined #ruby-lang
<kain> perhaps a .to_set
<phazenine> is there a way to add a bom to a csv file?
<rippa> source
<kain> thanks rippa
<rippa> there's nothing in the way of actual code though
flak has joined #ruby-lang
srbaker has joined #ruby-lang
alessio_rocco has joined #ruby-lang
robotmay has joined #ruby-lang
phazenine has joined #ruby-lang
<phazenine> so when I write japanese text to a csv file, everything seems to open it correctly except excel. is there a way to make excel open it correctly?
csherin has joined #ruby-lang
<whitequark> phazenine: how is this related to Ruby?
logankoe1ter has quit [#ruby-lang]
<manveru> phazenine: using WINDOWS_1252 encoding maybe?
<manveru> don't have excel to test though
<phazenine> i'm using ruby to write it
<whitequark> like files written with ruby somehow differ from all other files.
<manveru> but last time i tried to upload japanese text to amazon, they wanted tab-separated formated as excel would export it, and they only accepted that encoding
<phazenine> using CSV.open with ab:UTF-8 to write it
<phazenine> I've looked up how to add a bom at the top of my file, but i seem to get posts on how to remove it or parse it out
<manveru> bom is only useful for utf-16 or utf-32
<yorickpeterse> whitequark: content and encoding differ
<manveru> hm
<manveru> well
<manveru> opening with encoding and in binary mode isn't gonna work well
<manveru> phazenine: anyway, try 'w+:Shift_JIS'
<phazenine> tried it as well
<phazenine> still comes out like: text('ショップ情報
<phazenine> while in my editor and notepad it looks like: text('ショップ情
<manveru> ?
<manveru> you wrote without b and with SJIS?
<phazenine> well I've tried a:UTF-8 and a:SJIS as well as with ab:encoding
Jade has joined #ruby-lang
<manveru> a will append to an existing file
<manveru> that's why i say use w+ to get rid of the old content
uniqanomaly has joined #ruby-lang
SuperTaz_work has joined #ruby-lang
<phazenine> mm that didn't work as well
<manveru> phazenine: also, don't use SJIS, write it as Shift-JIS
<manveru> or Shift_JIS
<phazenine> i did
<manveru> they're different encodings
<manveru> then i guess you gotta show your code, because it works fine here
<shevy> UNDRESS NOW!!!
Sailias_ has joined #ruby-lang
Heimidal has joined #ruby-lang
dfr|mac has joined #ruby-lang
<manveru> ouch
<manveru> are you on 1.8 or something?
<phazenine> 1.9.3
<manveru> then all you need is require 'csv'
<manveru> rubygems is in stdlib, and faster_csv was renamed to csv and replaced the old lib in stdlib
<phazenine> tis at the top of the file
<manveru> yeah
<manveru> yeah, this isn't gonna go well
<phazenine> is there a better solution other than outputting to csv?
<manveru> using libreoffice? :)
<phazenine> lol i opted to go a db route, but they refused and it must be in excel
v0yager_ has joined #ruby-lang
uniqanomaly has joined #ruby-lang
<manveru> hm, how do you get stuff from that php file?
alindeman has joined #ruby-lang
<shevy> by black magic
<phazenine> yea
<phazenine> regex
<manveru> phazenine: how do you use the grabjapanesetext.rb
<phazenine> oh
<phazenine> ruby grabjapanesetext.rb jpsource.php
<manveru> ok
flebel has joined #ruby-lang
<phazenine> it will output a jpsource-output.csv file
<manveru> ok...
<manveru> i fear you guys do translation that way?
<phazenine> well someone is going to translate it manually using excel
Dotan has joined #ruby-lang
dv310p3r has joined #ruby-lang
<manveru> yeah, thought so
<phazenine> i just need to grab the japanese text, which i did, then display it in excel, which fails
<manveru> well, you can do this much easier
<whitequark> can you, err, copy-paste it to Excel and save it as CSV?
<manveru> ok
<manveru> phazenine: http://pastie.org/3396384
<manveru> something like that?
<manveru> it works here at least
<manveru> can't test it against excel obviously
<manveru> but the resulting file is shift-jis :)
slyphon has joined #ruby-lang
<phazenine> doesn't work in excel and if i change the way I save i can get the same results as your output
_bryanp has joined #ruby-lang
<phazenine> thanks for trying tho
macmartine has joined #ruby-lang
willdrew has joined #ruby-lang
fayimora has joined #ruby-lang
<manveru> and no comment on making your 80 lines into 13? :)
<manveru> oh well
<manveru> phazenine: maybe try SJIS then
<manveru> god knows, maybe that's the right one
willdrew has joined #ruby-lang
<muzone> some people man
* muzone shakes his head
* erikh farts
Carnage\ has joined #ruby-lang
ivanoats has joined #ruby-lang
* shevy shakes erikh
andremaha has joined #ruby-lang
aki__ has joined #ruby-lang
divoxx has joined #ruby-lang
toretore has joined #ruby-lang
csherin has joined #ruby-lang
gix has joined #ruby-lang
slimfit has joined #ruby-lang
fayimora_ has joined #ruby-lang
nofxx_ has joined #ruby-lang
chimkan has joined #ruby-lang
postmodern has joined #ruby-lang
tla has joined #ruby-lang
symm- has joined #ruby-lang
Slackwise has joined #ruby-lang
monkeysmuggler has joined #ruby-lang
<monkeysmuggler> Question. Having a bit of a brain fart today. Let's say I have the name of a method in a string variable foo... so foo = "this_method_here". How can I tell if that method is defined? If I do defined? foo, it's going to give me instance variable. If I do defined? foo.to_s, it's going to say method no matter what
<monkeysmuggler> because it isn't evaluating the contents
florentg2 has joined #ruby-lang
outoftime has joined #ruby-lang
<manveru> monkeysmuggler: respond_to?(foo)
tbuehlmann has joined #ruby-lang
* monkeysmuggler facepalm
<monkeysmuggler> thanks
naz has joined #ruby-lang
Jay_Levitt has joined #ruby-lang
srbaker has joined #ruby-lang
robotmay has joined #ruby-lang
S2kx has joined #ruby-lang
curtism has joined #ruby-lang
Heimidal_ has joined #ruby-lang
_bryanp has joined #ruby-lang
_bryanp1 has joined #ruby-lang
dcheung has quit [#ruby-lang]
gjaldon has joined #ruby-lang
jamw has joined #ruby-lang
jkprg has joined #ruby-lang
heppy has joined #ruby-lang
Heimidal has joined #ruby-lang
havenn has joined #ruby-lang
fayimora has joined #ruby-lang
benanne has joined #ruby-lang
ivanoats has joined #ruby-lang
QaDeS has joined #ruby-lang
<andrewhl> is there a method for determining how many hours remain until a certain date?
headius has joined #ruby-lang
<heftig> (DateTime.parse("2012-03-14") - DateTime.now) * 24
savage- has joined #ruby-lang
<virunga> Ruby = Ask, and ye shall receive.
<erikh> yes, but you must send a message to do so
robbrit has quit [#ruby-lang]
<andrewhl> ah, thanks
<virunga> :)
savage-_ has joined #ruby-lang
alessio_rocco has joined #ruby-lang
lsegal has joined #ruby-lang
optikalmouse has joined #ruby-lang
<optikalmouse> when using the rss module, how do I know what properties are available?
<optikalmouse> I'm looking at the ruby-docs and there's no info on that... :S
parzo has joined #ruby-lang
Jade has joined #ruby-lang
shtirlic has joined #ruby-lang
<shevy> that is to be expected
<shevy> ruby-docs tend to be notoriously bad
kaochenl2ng has joined #ruby-lang
solars has joined #ruby-lang
robbrit has joined #ruby-lang
achiu has joined #ruby-lang
florentg2 has joined #ruby-lang
whatasunnyday has joined #ruby-lang
<whatasunnyday> Hi, I have a general question about objects in ruby.
<whatasunnyday> I'm using the nokogiri library to search an html page for its elements.
<whatasunnyday> So, I do doc = doc = Nokogiri::HTML(open("somepage.html"))
<whatasunnyday> elements = doc.search("//h1")
<whatasunnyday> If I do elements.class = Nokogiri::XML::NodeSet
<whatasunnyday> I can see its a node.
<whatasunnyday> If I do elements it returns a bunch of node ids.
<whatasunnyday> However, if I do puts, it makes "human readable."
<whatasunnyday> How can I get the values as strings?
<manveru> (doc/:h1).map{|h1| h1.text }
<whatasunnyday> oh
<whatasunnyday> .text
<whatasunnyday> amazing
<whatasunnyday> thank you very much
<manveru> indeed
Indian has joined #ruby-lang
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
s0ber has joined #ruby-lang
y3llow has joined #ruby-lang
Stereokitsune has joined #ruby-lang
y3llow has joined #ruby-lang
Stereokitsune has joined #ruby-lang
robbrit has quit [#ruby-lang]
leonL has joined #ruby-lang
y3llow has joined #ruby-lang
H2H has joined #ruby-lang
andrewhl has joined #ruby-lang
erpuds has joined #ruby-lang
saLOUt has joined #ruby-lang
rushed has joined #ruby-lang
burgestrand has joined #ruby-lang
<Asher> is there a standard file extension for marshal?
jMCg has quit [#ruby-lang]
m_connell has joined #ruby-lang
divoxx has joined #ruby-lang
<drbrain> Asher: no
<drbrain> Asher: I use .ri for ri data
v0yager_ has joined #ruby-lang
burgestrand has joined #ruby-lang
KDiddy has joined #ruby-lang
<andrewhl> hmmm. I have an updated_at time stamp; I need to determined how many hours remain from Time.now until 24 hours after the timestamp (if difference <= 0, puts "Done"). I'm kind of stumped on how to do this
<andrewhl> to determine*
<andrewhl> err, if Time.now > timestamp, I guess would be the proper way to write that
srbaker has joined #ruby-lang
<drbrain> andrewhl: you can add a number of seconds to a Time
<burgestrand> andrewhl: reasoning about these kind of things help me if I draw a timeline.
Stalkr_ has joined #ruby-lang
<burgestrand> Like. With an actual pen and paper.
<andrewhl> yeah
<drbrain> so, to start: done_time = obj.updated_at + 86400
<drbrain> then it should be straightforward
<andrewhl> ok
<drbrain> no need to calculate a difference, just compare directly
<andrewhl> 86400 is a day?
<drbrain> yes
<drbrain> 60*60*24
<andrewhl> ok
<andrewhl> So if I subtract Time.now from it, that should give me the seconds?
<whitequark> drbrain: heh, you've memoized 86400 too
<whitequark> also, 604800.
<drbrain> whitequark: it's hard not to since it's so common
<drbrain> one week
<whitequark> yep
<whitequark> how much powers of two can you name from, er, your brain? I'm off at 262144.
<drbrain> I only remember it on sight from DNS zone files
<drbrain> I don't often need to use dates that far off
<whitequark> apart from 1048576, of course.
<drbrain> I have to count on my fingers
<whitequark> actually, the last I've remembered was 65536, but only until I started to work with NAND flashes. 262144 is a common block size on these, just like 131072 is...
symm- has joined #ruby-lang
Axsuul has joined #ruby-lang
slyphon has joined #ruby-lang
gregf has joined #ruby-lang
stephenp has joined #ruby-lang
havenn has joined #ruby-lang
queequeg1 has joined #ruby-lang
ttilley has joined #ruby-lang
WillMarshall has joined #ruby-lang
ttilley has joined #ruby-lang
havenn has joined #ruby-lang
<drbrain> headius: ping
srbartlett has joined #ruby-lang
<headius> drbrain: hey there
<drbrain> I have a 4MB gem of RDoc data
<drbrain> for you to test, how would you like to retrieve it?
<drbrain> email or HTTP?
<headius> either's fine for me
dju has joined #ruby-lang
<headius> headius@headius.com
<whitequark> drbrain: try IPv6 over pigeon carriers
<drbrain> whitequark: might take some time, and it would be faster to just pigeon several USB sticks (for redundancy)
willdrew_ has joined #ruby-lang
<whitequark> drbrain: a pigeon cannot carry an USB stick afaik, maybe apart from the most light ones, those small, incredibly integrated (and often failing) black rectangles
<whitequark> I'd suggest microsd cards
<whitequark> ... no, I won't say where did I get to know that a pigeon cannot carry an USB stick. don't even ask.
retro|cz has joined #ruby-lang
<drbrain> headius: ok, it's being sent at the pace of a 56Kbps modem!
petercooper has joined #ruby-lang
mytrile has joined #ruby-lang
slimfit has joined #ruby-lang
chimkan_ has joined #ruby-lang
butchanton has joined #ruby-lang
leonL has joined #ruby-lang
mytrile has joined #ruby-lang
Silowyi has joined #ruby-lang
heppy has joined #ruby-lang
<Silowyi> is it possible with something like ahash.each {|key,value| ahash[key] = do_something} to end up iterating on a specific key more than once?
cirwin has joined #ruby-lang
brushbox has joined #ruby-lang
<cirwin> there seem to be lots of non-blocking postgresql connection pooling things flying around — does anyone have a recommendation as to which are good?
<virunga> Silowyi, the first row of each documentation answer you
<Silowyi> virunga: yeah the thing is, that's not what I'm observing
<Silowyi> virunga: what I'm observing is on one each call, a single value is modified 4 times.
<Silowyi> virunga: so I'm trying to look at ways to explain it, and guessing that something about the reassigning back to the key is causing it to get moved in the hash... or something.
<headius> drbrain: ZOOM
<headius> or should I say XOOM
butchanton has joined #ruby-lang
<Silowyi> virunga: or maybe my code is calling each more than once somehow... hard to tell here.
xaio has joined #ruby-lang
<Silowyi> (there's no reason it should be, but meh... dealing with a legacy framework where things aren't always clear)
v0yager has joined #ruby-lang
<virunga> it's pretty late here, i'll go to bed
<virunga> 'nite
<ttilley> headius: random note - jruby doesn't seem to support breaking apart array args in blocks when using 1.9 mode, but it works in jruby 1.8 mode and is supported by MRI 1.9. i mean like {|arg1, (arg2array1, arg2array2)| }
<Silowyi> wahah, ok now I feel stupid, need to remember to dup that object before modifying it :P
<drbrain> headius: ooh! I think it finally sent!
<headius> ttilley: 1.6.7 fixes
<headius> or it should
<headius> try it out and let me know :)
<ttilley> oh. well nevermind then
<ttilley> heh
<headius> if it doesn't we'll be sad...and then we'll fix it
<headius> that all should work
<headius> drbrain: ok!
v0yager has joined #ruby-lang
<headius> drbrain: so there will be an rdoc gem release that tells jruby users to grab rdoc-data for all versions, yes?
<drbrain> headius: yes, but that may follow along a little later
<headius> no problem
<headius> drbrain: seen this before?
<headius> system ~/projects/jruby $ rdoc --debug String
<headius> I can't deal with a fifo ./fifo
<headius> I just happened to have a fifo in cwd for something elsw
<headius> I am calling rdoc wrong too, I know
<drbrain> headius: so, `mkfifo fifo; rdoc --debug String` would reproduce?
<Phlogistique> g
<drbrain> headius: no, I haven't
<headius> drbrain: yes
<headius> --debug was just to get a trace...it did it without that too
<drbrain> Phlogistique: g is like p
<headius> hah
heppy has joined #ruby-lang
<drbrain> corundum: g?
<corundum> no clue
<headius> ahhh ok, this is not related to rdoc data but I forgot about something I had patched in ri
<drbrain> corundum: g is like p -- https://rubygems.org/gems/g
<corundum> alright
<headius> specifically...paging doesnt work in jruby because JVM doesn't pass along tty to pager
<headius> I patched it to never page
<headius> sad workaround
<headius> but it looks like data is working fine, which is what you want to know
thomasfl has joined #ruby-lang
<drbrain> great
<headius> I will have to revisit the paging thing
<drbrain> headius: can you submit an issue on rdoc/rdoc with your workaround?
<drbrain> then you won't have to re-patch, at least
<headius> yeah I'll try to come up with something better
<headius> well we won't be shipping anything
<headius> we're just going to recommend people install the gems
<headius> so yeah, I'll get you something
<drbrain> also, you can recommend export RI=-T
<headius> yeah
<drbrain> headius: also, one for the fifo thing too, please?
<headius> sure
<headius> where's the proper repo
<headius> ok
<headius> done
<drbrain> thanks!
<whatasunnyday> Anyone familiar with the anemone gem? I'm having a regular expression issue.
<outoftime> whatasunnyday: i'm familiar with regular expressions
MistyM has joined #ruby-lang
<thomasfl> Does anyone know why 'alias_method' doesn't seem to work on the File class? It makes it impossible to monkeypatch the File class. Example: http://pastie.org/3397900
<whatasunnyday> great!
<whatasunnyday> so, anemone accepts regex patterns for a method called skip_links_like which ignores urls that are matched by the pattern
<whatasunnyday> i am specifically having a huge issue with http://www.firstrain.com/about_us/index.php?page=press_and_news&subpage=20080630
<burgestrand> thomasfl: class << File … end ought to work, and drop the self from def self.open
<outoftime> whatasunnyday: what regexp are you using to matchi t?
<whatasunnyday> my regex is $DYN = %w(news article event document resource download event webinar)
<whatasunnyday> anemone.skip_links_like /\.(#{$DYN.join('|')})$/i
<thomasfl> burgerstrand: Thanks. Trying now.
<whatasunnyday> sorry, took a second
<drbrain> whatasunnyday: Regexp.union is your friend
<whatasunnyday> o.O
<whatasunnyday> what's that
<whatasunnyday> time to google
<burgestrand> thomasfl: http://pastie.org/3397932 :)
<drbrain> (at least, for the .join('|') part)
<outoftime> whatasunnyday: also, the end of that URL is 20080630
<outoftime> whatasunnyday: and you have a end-of-line anchor in your tegexp
<whatasunnyday> i feel dumb
<whatasunnyday> how would i change it to remove he end of line anchor?
<outoftime> whatasunnyday: uh, get rid of the $
<whatasunnyday> oh
<whatasunnyday> the $ is for a global variable
<outoftime> whatasunnyday: not in a regexp
<outoftime> whatasunnyday: not that $. the third-to-last charater
<whatasunnyday> oh
<whatasunnyday> i see it
<whatasunnyday> thanks
<outoftime> whatasunnyday: you could do (&|$)
<outoftime> whatasunnyday: to match the end of a param
<whatasunnyday> actually
<whatasunnyday> i just copied and pasted it wrong
<whatasunnyday> i actually didn't include $ at the end
<outoftime> you have one mischievous clipboard buffer
<whatasunnyday> anemone.skip_links_like /\.(#{$EXT.join('|')})$/i anemone.skip_links_like /(#{$DYN.join('|')})/i
<whatasunnyday> i have one for extensions
<whatasunnyday> i accidently copied and pasted the ext one and changed it to dyn
dous has joined #ruby-lang
<whatasunnyday> which is end of regex
<outoftime> whatasunnyday: well, one of those isn't going to work
<whatasunnyday> any other ideas?
<whatasunnyday> hmm?
<outoftime> whatasunnyday: unless you only care about skipping extensions if there are no query params
<whatasunnyday> really?
<whatasunnyday> i can't just have it match to news in the url
<whatasunnyday> and have it skip it?
<outoftime> whatasunnyday: oh, sure you can. I'm just saying your EXT bit won't work because of the end-of-line anchor if the URL also has a query string
<whatasunnyday> ohhhhh
<outoftime> whatasunnyday: because the file extension won't be at the end of the line.
<whatasunnyday> oh good call
<whatasunnyday> i'll add that
<whatasunnyday> any idea why the DYN portion isn't working?
<outoftime> nope. are you sure anemone lets you call #skip_links_like more than once?
Karmaon has joined #ruby-lang
<whatasunnyday> that's a good point
<whatasunnyday> it seems to be working "sometimes"
<whatasunnyday> like, i have been able to skip certain news links
<whatasunnyday> where as other times i have been unable to do
<whatasunnyday> but their formatting is different
<whatasunnyday> i can't remember any of the top of my head
jobicoppola has joined #ruby-lang
fireglow has quit [#ruby-lang]
<thomasfl> burgerstrand: The code doesn't seem to monkeypatch the File class.
<thomasfl> burgerstrand: http://pastie.org/3397952
heftig has joined #ruby-lang
cored has joined #ruby-lang
cored has joined #ruby-lang
<whatasunnyday> removing the other private method doesn't seem to help
<whatasunnyday> er
<cored> hello guys
<whatasunnyday> sorry removing the other skip_link like doesn't seem to help
<whatasunnyday> any other ideas outoftime?
<cored> how can I make rspec to run the examples just with 1.9.2 if using it and don't run with 1.8.7
<outoftime> whatasunnyday: if you just try to match the regexp directly against the URL, does it work?
<outoftime> whatasunnyday: without using anemone?
yfeldblum has joined #ruby-lang
<whatasunnyday> on http://rubular.com/ it does
<outoftime> cored: /path/to/your/ruby19/binary -S rspec ...
<outoftime> cored: but your life will be easier with RVM
<outoftime> whatasunnyday: you don't have irb installed?
<cored> outoftime: I'm using RVM
<whatasunnyday> oh i do
<cored> maybe I did not explain myself crearly
<outoftime> cored: and you're having trouble running something in ruby 1.9?
<cored> no p
<whatasunnyday> i'll try it in irb
<cored> my specs are green with 1.9.2 I'm using vcr to mock calls
<outoftime> okay
<cored> so the problem is that the response recorded by vcr have some malformed character
<cored> so every json engine I use with multi_json just drop an error
<outoftime> ok, that's some important information : )
<cored> but this is happening just in 1.8.7
<outoftime> well, my solution would be "don't use VCR"
<cored> I did some integration tests with my lib
<cored> and all is working properly
slyphon has joined #ruby-lang
<cored> so I just want to stop running the specs with 1.8.7 so the ci doesn't explode everytime I push to it :-)
<outoftime> cored: that's a lot of important information : )
<cored> I was thinking in finding another runner so I can tell rspec to run a particular line
<cored> but now I just think I can drop the entire thing without regrets
<outoftime> cored: again, I would advise just hand-writing request mocks using FakeWeb or WebMock, rather than using VCR.
<whatasunnyday> it seems to outoftime
<outoftime> whatasunnyday: OK, then you don't have a regexp issue, you have an anemone issue. and on that front, I am useless to you.
<whatasunnyday> outoftime
<whatasunnyday> would you mind looking at the method that anemone uses?
<outoftime> heh, okay
<whatasunnyday> i can show you exactly where it does it
<whatasunnyday> i'm sorry :(
<whatasunnyday> i know its a pain
<outoftime> whatasunnyday: did you know you can link to a specific line on github?
<whatasunnyday> on line 109 and 297
<whatasunnyday> oh, no, i didn't
<outoftime> whatasunnyday: yep, it's pretty cool.
<whatasunnyday> oh that is so tight
<whatasunnyday> i just clicked on the line
<outoftime> whatasunnyday: it's comparing your regexp to link.path
<outoftime> whatasunnyday: you're attempting to match the query string
<whatasunnyday> wow
<outoftime> whatasunnyday: so your ext thing will work. but your dyn thing will not.
<whatasunnyday> they are to separate parts?
<whatasunnyday> two*
<outoftime> path and query_string are separate url components, yes.
<cored> outoftime: yes probably I should do that, but is so much work :-P
<whatasunnyday> i am so sad
<cored> outoftime: will change then, thanks
kyrylo has joined #ruby-lang
kyrylo has joined #ruby-lang
<whatasunnyday> do you think it will be problematic if i change it to compare to the entire url?
<outoftime> cored: it'll probably be better in the long run. godspeed.
<outoftime> whatasunnyday: why not just use skip_query_string
<whatasunnyday> i am crawling a lot of sites
<whatasunnyday> because a lot of websites use query strings as static pages
<whatasunnyday> in php
<outoftime> whatasunnyday: oh right, i should've read the method.
SkramX has joined #ruby-lang
<outoftime> whatasunnyday: monkey-patching that method seems fairly safe to me.
<outoftime> whatasunnyday: it's kinda dumb that it's only allowing you to match against the path
<whatasunnyday> i know what you're saying and i have heard the term before
<whatasunnyday> but what is "monkey patching?"
monkeysmuggler has joined #ruby-lang
<outoftime> whatasunnyday: although in fairness, i have no idea what anemone does, so maybe it makes sense
<whatasunnyday> like, does that mean to apply your own patch?
<whatasunnyday> its just a ruby crawling library
<outoftime> whatasunnyday: it means to override the method in your runtime
<whatasunnyday> nothing really that interesting
<whatasunnyday> oh?
<whatasunnyday> ooooooooooh
<outoftime> whatasunnyday: like somewhere in your code, you open the Anemone::Core class, and redefine #skip_link?
<whatasunnyday> so don't change the gem
<whatasunnyday> but overload the method?
<outoftime> whatasunnyday: not overload, override, but yes.
<whatasunnyday> outoftime
<whatasunnyday> i have learned so much from you today
<outoftime> whatasunnyday: heh, glad to be of help.
<whatasunnyday> if i could send you delicious cookies, i would.
<outoftime> whatasunnyday: I appreciate the sentiment.
<whatasunnyday> so ruby supports overriding methods but not overloading them?
<thomasfl> Has anyone heard of any rubygems that monkeypatches the File class? It can't get the alias_method to work.
<drbrain> thomasfl: show us
<outoftime> whatasunnyday: correct
<outoftime> thomasfl: somebody told you before how to fix it
<outoftime> thomasfl: you want to alias a class method, but your code is attempting to alias a (nonexistent) instance method
<whatasunnyday> outoftime, a sort of abstract question, i'm a college senior studying math. just started coding really last semester. i'm looking for ways to improve my chops. any recommendations?
<thomasfl> Thanks for replies. Here's my example http://pastie.org/3397952
<outoftime> whatasunnyday: Learn Python the Hard Way
<whatasunnyday> i'm working an internship where i code but its sort of hard to find individual projects to work on
<whatasunnyday> alright, that sounds good
<outoftime> whatasunnyday: that's a book recommendation, anyway. for practice, get involved in open-source projects
<drbrain> thomasfl: are you re-implementing part of open-uri?
tomzx has joined #ruby-lang
<drbrain> require 'open-uri'; open 'https://www-dav.example.com/foo.html' do |io| … end
<whatasunnyday> is the python the hard way where you copy examples?
<thomasfl> drbrain: I am trying to extend open-uri to be able to write to webdav enabled servers.
<outoftime> whatasunnyday: yeah he doesn't make the code available online, you're expected to type them out yourself.
shevy has joined #ruby-lang
<drbrain> thomasfl: I don't recommend you do this with a monkeypatch
<outoftime> whatasunnyday: but that's not really the salient part of the "hard way" -- it's more about learning the fundamentals of coding rigorously while also learning a new language
<outoftime> thomasfl: sorry, I didn't realize you had already taken the previous suggestion into account
<whatasunnyday> i feel pretty confident with oo programming
<whatasunnyday> i think i'm looking more along the lines as maybe exercises are projects
<whatasunnyday> the world of open source is huge and very expansive, it often feels difficult to find a project to contribute to
<outoftime> whatasunnyday: are there any that you like?
<whatasunnyday> or, not are
<outoftime> whatasunnyday: any ruby libraries you like, maybe?
<whatasunnyday> to be honest, i don't know many
<outoftime> whatasunnyday: not suggesting you contribute to, like, Firefox or anything : )
<whatasunnyday> just nokogiri, mechanize, and anemone
<whatasunnyday> i love firefox
<outoftime> whatasunnyday: okay -- are there any open bugs for any of those?
<whatasunnyday> i'm not a very good consumer
<whatasunnyday> i see where you are going with this
<whatasunnyday> and i like it
<whatasunnyday> solve bugs
<whatasunnyday> sounds like a plan
<outoftime> start there, then maybe take on some feature requests
<outoftime> or come up with some of your own
<whatasunnyday> i don't use many products, so its sort of hard for me to find good open source projects
<outoftime> the other advantage of that is it'll have you reading lots of code. and reading other people's code (when it's good code) is the best thing you can do
<whatasunnyday> but i like the idea of fixing bugs
<outoftime> whatasunnyday: go forth!
<whatasunnyday> yeah, that seems like a great idea
<whatasunnyday> i'll go look for some big open source ruby libraries
<whatasunnyday> and popular ones
<outoftime> sweet
<whatasunnyday> thanks a lot outoftime
Banistergalaxy has joined #ruby-lang
<outoftime> whatasunnyday: you betcha. have fun.
<thomasfl> drbrain: Thanks for you suggestion. I am trying to monkeypatch module Kernel now, just like open-uri does.
H2H has joined #ruby-lang
slyphon has joined #ruby-lang