Topic for #ruby-lang is now Ruby 1.9.3p0: http://ruby-lang.org | Paste >3 Lines of Text on http://pastie.org
_whitelogger [_whitelogger!~whitelogg@kaunan.whitequark.org] has joined #ruby-lang
srbaker [srbaker!~srbaker@38.108.87.20] has joined #ruby-lang
anthony [anthony!~anthony@c-68-41-81-89.hsd1.mi.comcast.net] has joined #ruby-lang
<sloth> thanks erikh, injekt and samuelkadolph
<erikh> enjoy
bradland [bradland!~bradland@c-69-247-235-233.hsd1.fl.comcast.net] has joined #ruby-lang
cyri_ [cyri_!~cyri_@jem75-1-87-88-118-80.dsl.sta.abo.bbox.fr] has joined #ruby-lang
dkannan [dkannan!u480@gateway/web/irccloud.com/x-lsjrnduhyqhgurqk] has joined #ruby-lang
agib [agib!u781@gateway/web/irccloud.com/x-nyxgbcayokcbywow] has joined #ruby-lang
akahn [akahn!u2243@gateway/web/irccloud.com/x-irktqvsbmoshcrik] has joined #ruby-lang
unsymbol [unsymbol!unsymbol@gateway/shell/anapnea.net/x-khtzrcpqhltexgtl] has joined #ruby-lang
Bwild [Bwild!~irc@netblock-75-79-22-130.dslextreme.com] has joined #ruby-lang
_whitelogger0 [_whitelogger0!~whitelogg@kaunan.whitequark.org] has joined #ruby-lang
_whitelogger0 [_whitelogger0!~whitelogg@kaunan.whitequark.org] has joined #ruby-lang
pvh [pvh!u717@gateway/web/irccloud.com/x-gzbqoqlqqbqgwnse] has joined #ruby-lang
pvh [pvh!u717@gateway/web/irccloud.com/x-gzbqoqlqqbqgwnse] has joined #ruby-lang
_whitelogger [_whitelogger!~whitelogg@kaunan.whitequark.org] has joined #ruby-lang
simon_weber [simon_weber!u4119@gateway/web/irccloud.com/x-xdcsaaymnkvnaqwg] has joined #ruby-lang
Axsuul [Axsuul!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby-lang
Axsuul [Axsuul!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby-lang
mccraig [mccraig!u574@gateway/web/irccloud.com/x-xeiwzvqmtwbvlaoo] has joined #ruby-lang
Axsuul [Axsuul!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby-lang
_whitelogger has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
Boohbah has joined #ruby-lang
Boohbah has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
Axsuul has joined #ruby-lang
<shevy> dumdedum
phaze79 has joined #ruby-lang
DefV has joined #ruby-lang
<phaze79> can anyone point me in the right direction? is there a way to detect if a word is in japanese in ruby?
<shevy> hmm perhaps you can detect some encodings
<shevy> in the past, I think they often set $kcode or something like that to a specific value
<samuelkadolph> How would you detect a Japanese word?
<samuelkadolph> Just look for Japanese characters perhaps
<manveru> hm
<phaze79> currently that is what i am thinking
<phaze79> but is there a method that can be called?
<samuelkadolph> Not in ruby
<samuelkadolph> There might be a gem for it
<shevy> it would be too specialized in default ruby
<shevy> phaze79: the famous .is_japanese? method call awaits your creation :)
<phaze79> lol
<shevy> until then you can ask manveru if something is japanese or not hehe
<manveru> well, katakana and hiragana are easy
<shevy> see! :D
charper has joined #ruby-lang
<manveru> but kanji...
<manveru> that's a whole can of worms :)
<rue_XIV> Still doesn't mean it's a Japanese word, could be garbage.
timbleck has joined #ruby-lang
<manveru> yeah
<manveru> you can use \p{hiragana} and \p{katakana}
denysonique__ has joined #ruby-lang
<manveru> for the kanji you have to check for the unicode ranges
<manveru> and finally there are no spaces in japanese, so you have to guess
DRCALKIN has joined #ruby-lang
Axsuul has joined #ruby-lang
dejongge1 has joined #ruby-lang
Defusal_ has joined #ruby-lang
slimfit has joined #ruby-lang
bradly has joined #ruby-lang
timbleck has joined #ruby-lang
dragonkh has joined #ruby-lang
newbold has joined #ruby-lang
erpuds has joined #ruby-lang
dkannan has joined #ruby-lang
cesario has joined #ruby-lang
RomyRomy has joined #ruby-lang
pvh has joined #ruby-lang
malev_ has joined #ruby-lang
flak has joined #ruby-lang
<devn> I would like to patch Hash to have a method "true_of?" -- the method takes a key, and a block. Example: {a: 1}.true_of?(:a) { key == :a && value == 1 }
<ReinH_> devn: why?
<devn> Fun and profit
<ReinH_> huh
<ReinH_> ok, then do so, but you'll need to supply block locals |key, value|
cldwalker has joined #ruby-lang
<ReinH_> how would you not know that the key :a == :a?
<devn> no locals. I want to build those methods on this specific instance of the block
<devn> ReinH_: it's a contrived example?
<ReinH_> ok, then you'll need instance eval and a proxy object
denysonique__ has joined #ruby-lang
<ReinH_> TrueOfProxy.new(self).instance_eval(&block)
<ReinH_> where TrueOfProxy provides #key and #value methods
<ReinH_> huh, new calyx and teebee remix
<ReinH_> actually unsure if like
<ReinH_> that was the wrong window
<ReinH_> apologies
<ReinH_> let me try that again somewhere else
malev has joined #ruby-lang
djcercone has quit [#ruby-lang]
<ReinH_> devn: does that make sense?
malev_ has joined #ruby-lang
akahn has joined #ruby-lang
Nisstyre has joined #ruby-lang
<devn> ReinH_: erm, have to be honest, no
<manveru> :)
<devn> ReinH_: im struggling to get this to work
<theconartist> devn: that is a particularly bad example
<devn> i was shown this idea by my pair and at first blush I figured: "oh sure, no problem", and then started digging into the implementations that are out there. I found self.instance_eval d
<devn> puts self[:a]
<devn> grr, sorry, wrong paste buffer
<theconartist> how should someone know that it's provided by the block and not a lexical closure?
<devn> theconartist: ill write a readme? would you like to suggest a better example?
<theconartist> yes
<devn> ReinH_: here is the implementation I found: https://github.com/miros/anaphora/blob/master/lib/anaphora.rb
<ReinH_> so Proxy there is the type of object you need, but in this case you only need to define #key and #value
<ReinH_> or manveru could just give you a fish
<ReinH_> ~_~
<manveru> :D
* manveru goes back fishing
<ReinH_> manveru: @hash can just be an lvar btw :p
<ReinH_> principle of least possible scope ;)
<devn> ohhhhhhhhh.
<devn> manveru: ReinH_: much obliged. you've not only made me happy, but my pair as well. and now I can move him on to pairing on some clojure with me ;)
<manveru> i might be able to implement it in scheme... but not clojure :P
<ReinH_> devn: just be ware that your savings of a few keystrokes comes at the cost of breaking convention and adding to the amount of explicit knowledge needed to use the method
<theconartist> that example is increasing complexity, not reducing it
<ReinH_> s/ware/a\1
<theconartist> not very clojure-like
<ReinH_> theconartist: confirm
<ReinH_> I would rather use true_of(:a){|key, value|
<ReinH_> it is symmetric with most other similar hashy methods
<ReinH_> delete_if{|key, value|
<ReinH_> each{|key, value|
<ReinH_> etc
m3nd3s has joined #ruby-lang
<theconartist> would rather use {}[:a].true? {|vars| test }
<ReinH_> theconartist: I mean yes, but clearly this is a contrived example
<ReinH_> or just of hash[:a] == 1
<theconartist> DEAR LORD NO
<ReinH_> s/of/if
gregf has joined #ruby-lang
<ReinH_> theconartist: :p
<ReinH_> I get the feeling you're trying to pull one over on me
<ReinH_> THECONARTIST
<devn> hah
<shevy> omg
<shevy> {}[:a].true? {|vars| test } !!!
<ReinH_> what does that even mean
<shevy> there must be a more beautiful way
<theconartist> there are examples i have made that are simliar, but trying to put it in the { anonymous block } is overloading and nasty
<devn> yeah, it's contrived, but the point is to separate existence from property testing
<manveru> the who?
<ReinH_> devn: the metaprogramming and instance_eval is unnecessary though
<rue_XIV> No, the kinks
<devn> ReinH_: I don't disagree
<manveru> let's go with the smiths
<devn> ReinH_: It's something I didn't know how to do, so I hope to fit it in when it makes sense
<ReinH_> are we using two-value logic here? :p
<devn> haha
<ReinH_> true/false/fuck off?
<devn> ;)
<erikh> ReinH_: I believe that's called "null", kthx
<rue_XIV> Hm
<ReinH_> nil, thank you
<rue_XIV> n–uh = nil
<erikh> apparently you guys don't spend enough time with sql null
<ReinH_> NULL, thank you
<ReinH_> true/false/pony
<erikh> damn straight
<nofxx> Hm.. wondering if creating workers from workers is a good pattern. Scenario generate stats for a bunch of users, cron fires a worker without user id, worker goes like: User.all { |u| Worker.enqueue u }
<erikh> that's not creating a worker, that's filling a queue
<erikh> unless #enqueue does something entirely different from what it means
<manveru> let's fill queues with workers that fill queues!
<erikh> queueueueueueueeu
<nofxx> erikh, yup.. a job that creates more jobs
<nofxx> heheh
<rue_XIV> module Consulting; …
petercooper has joined #ruby-lang
<ReinH_> usually enqueue adds things to a queue
<ReinH_> nofxx: seems fine, but why cron?
<nofxx> ReinH_, it's a daily report
<ReinH_> breaking apart into smallest atomic job gives you more control over process management
<ReinH_> ah ok
<ReinH_> nofxx: is this resque or similar?
<nofxx> ReinH_, yeah, plus N workers can run in parallel...
<nofxx> ReinH_, yes, resque
<ReinH_> confirm
H2H has joined #ruby-lang
<ReinH_> nofxx: how are you running workers? in the cloud? VPS somewhere?
<nofxx> ReinH_, yup
<ReinH_> which
<nofxx> linode
<ReinH_> nofxx: if I can make a suggestion
<ReinH_> experiment with creating an AWS AMI that, when launched, fires up N workers that start pulling off the queue
<ReinH_> then you have really simple pool size controls
<ReinH_> where N is however many run most efficiently on whatever size instance
<erikh> this has nothing to do with a worker than enqueues more items
<ReinH_> erikh: yes, just making a general suggestion
<nofxx> ReinH_, hmm those boot up as needed ?
<ReinH_> then you can monitor queue size and automatically create/destroy worker AMIs based on load
<nofxx> ReinH_, thanks for the tip
<ReinH_> eventually it becomes a self managing system
<ReinH_> and self managing systems are awesome
<erikh> heh -- guard it with a max number of instances
<ReinH_> nofxx: yep, just put the workers in init.d and rc them
<ReinH_> erikh: well yes, I mean don't make skynet
<erikh> not saying I've been here before, but yeah
<erikh> just totally not speaking from experience or anything
<rue_XIV> Ah, AMI is a VM image?
<erikh> sort of
<ReinH_> rue_XIV: confirm
<ReinH_> for AWS EC2
<ReinH_> near enough as makes no difference, yes
<erikh> fwiw, the big difference is that it has relationships with other moving parts such as a kernel and initrd -- for running under paravirt
<ReinH_> confirm
<ReinH_> but which you never really need to care about
<erikh> unless you build them
<erikh> which is waht you're suggesting is done
<nofxx> think I'll move this to a rake task... no need use in resque-schedule as it's a daily basis run
qpingu has joined #ruby-lang
<nofxx> I'll fill the queue there, avoid the skynet
<nofxx> Heh... one think I always wondered about english.... isn't "fill up" pleonasm?
srbaker has joined #ruby-lang
lordofthedance has joined #ruby-lang
dcheung has quit [#ruby-lang]
dreinull has joined #ruby-lang
<andrewvos> meh
denysonique__ has joined #ruby-lang
malev has joined #ruby-lang
hagabaka has joined #ruby-lang
hagabaka has joined #ruby-lang
<rue_XIV> nofxx: Fill it halfway
<andrewvos> rue_14?
<erikh> the 14th.
<erikh> like that frenchman
<andrewvos> he
<andrewvos> h
<apeiros_> *sob*, I don't like the initialize method of struct-likes - so many arguments…
looopy has joined #ruby-lang
Indian has joined #ruby-lang
<apeiros_> 20 arguments… yuck…
<rue_XIV> Well, you can do that without structiness, too
dreinull has joined #ruby-lang
<apeiros_> well it's an object with a lot of properties. none inferable. so I have to pass them one way or the other.
<apeiros_> and I don't consider passing a hash with 20 key/value pairs a better option. especially if no attribute is optional :(
<rue_XIV> You could make a QuarterObjectFactory and split up the creation
<shevy> rue_XIV what is with that XIV wasn't that a king that built castles?
slimfit has joined #ruby-lang
<samuelkadolph> o = MyObjectConstructor.new; o.foo = "Bar"; m = MyObject.new(o)
<apeiros_> it's the one that got beheaded
<outoftime_> shevy: a king that built France.
<rue_XIV> shevy: No
naz has joined #ruby-lang
brownies has joined #ruby-lang
looopy has joined #ruby-lang
abuiles has joined #ruby-lang
<erikh> rue_XIV: skyrim is worth the trouble
<erikh> that is all
* erikh disappears in a puff of dongs
<andrewvos> dongs?
<shevy> thongs
dfr|mac has joined #ruby-lang
fayimora has joined #ruby-lang
macmartine has joined #ruby-lang
gregf has joined #ruby-lang
tla has joined #ruby-lang
kain has joined #ruby-lang
tomzx has joined #ruby-lang
<zenspider> puff of... dongs...
<zenspider> I feel like I missed something crucial to understanding that line
<rue_XIV> Not reall
<andrewvos> Not sure everyone understands that dong==cock
jamw has joined #ruby-lang
<rue_XIV> I'm pretty sure most do
<andrewvos> As long as we're all on the same page.
* andrewvos disappears in a puff of cocks
andkerosine has joined #ruby-lang
<shevy> awww you don't know how it's originally done!
* shevy disappears in a puff of smoke
<andkerosine> How does one go about causing an AJAX request to return more than once?
<andrewvos> andkerosine: wat?
<andkerosine> Processing a user's request involves returning data every few seconds.
<andrewvos> Yuah?
<andkerosine> I'm currently using setInterval and a hidden variable to return the right piece of data.
rpowell has joined #ruby-lang
<andkerosine> Is that the only way to do it?
<andrewvos> I.. I have no idea what's going on
<andrewvos> What are you trying to do exactly?
<andkerosine> It's an optimal proxy finder.
dreinull- has joined #ruby-lang
<andkerosine> When the user presses go, I want to send an AJAX request to the server, and have the server test each proxy in turn and return how long it took.
<andrewvos> I'm currently using Cathode to view IRC. This is insane
<andrewvos> It does colours in the terminal now :)
* andrewvos runs top
<andrewvos> Oh, it's at 15% :/
<samuelkadolph> andkerosine: Shouldn't it find the best proxy for the client and not the server?
petercooper has joined #ruby-lang
<andkerosine> It should. How would I go about that?
SuperTaz_work has joined #ruby-lang
Stalkr_ has joined #ruby-lang
<samuelkadolph> I don't think you really can with AJAX
<samuelkadolph> It doesn't give you much info back with a response. The best you can do is time it
<andrewvos> Started adding some collaborators on fuckingawesomesongs.com
<andrewvos> Want to see what happens
originalserver has joined #ruby-lang
<originalserver> I selling dedicated servers in different countries, only windows xp,2003,2008, seven
BigFatFatty has joined #ruby-lang
<andrewvos> Cool story bro. Tell it again!
daglees has joined #ruby-lang
daglees has joined #ruby-lang
savage- has joined #ruby-lang
yfeldblum has joined #ruby-lang