Topic for #ruby-lang is now Ruby 1.9.3p0: http://ruby-lang.org | Paste >3 Lines of Text on http://pastie.org
<zenspider> sweet jesus that's horrible
<zenspider> zomg chris2!
<wallerdev> anyone use sublime text 2?
<rue> Hipsters do
<wallerdev> i was going to try it out but their site has a screencast that requires java… wtf?
<rue> Although it's getting a little mainstream now.
<wallerdev> i can't remember any other time I've needed java to watch a video onlinie
<rue> I'm sure there's a fixie metaphor here somewhere
<andrewvos> There always is
livinded [livinded!~lolwut@pool-108-23-242-132.lsanca.fios.verizon.net] has joined #ruby-lang
fragmachine [fragmachine!~fragmachi@101.170.141.157] has joined #ruby-lang
Aengus [Aengus!~Aengus@cloudysunday.com] has joined #ruby-lang
rdavila [rdavila!~rdavila@190.43.31.50] has joined #ruby-lang
Jarred [Jarred!~Administr@c-71-198-139-210.hsd1.ca.comcast.net] has joined #ruby-lang
<Jarred> hi all
<wallerdev> hey Jarred
<andrewvos> HI AJARRED
<wallerdev> hows your new job going?
<Jarred> My new job?
<wallerdev> must be a different jarred
<Jarred> Probably
<RORgasm> hey guys
<RORgasm> sorry got distracted
<andrewvos> HEY RORGASM
<RORgasm> i know how inject works
<RORgasm> and i know it performs worse than each
<RORgasm> i'm just not too sure with whats going on with the blocks and lambdas in that block
<RORgasm> andrewvos: what's up?
<andrewvos> I think it performs better than each
<RORgasm> i don't think so
<andrewvos> Why>??
<andrewvos> That's subjective
<rue> Profile
<andrewvos> It's slower?
<RORgasm> that's what i though
<zenspider> inject doesn't perform better than each. inject uses each
<RORgasm> i had read a few articles regarding it a while back
<rue> RORgasm: It goes through the set of callbacks and wraps them inside eachother (or doesn't, if the condition isn't fulfilled).
<andrewvos> Ahhh, so if you wanted speed you would choose ruby?
<RORgasm> mainly coz inject ends up creating a lot more objects than using #each with a definiedn acucmulator variable
<bougyman> bench it and see.
<RORgasm> sure
<RORgasm> rue: ok...one sec
<zenspider> RORgasm: more assignments, not more objects.
Phrogz [Phrogz!~phrogz@pdpc/supporter/professional/phrogz] has joined #ruby-lang
tomzx [tomzx!~tomzx@66-77.162.dsl.aei.ca] has joined #ruby-lang
replore_ [replore_!~replore@203.152.213.161.static.zoot.jp] has joined #ruby-lang
<bougyman> RORgasm: quite a bit faster, here.
<RORgasm> zenspider: really, but i thought more objects were created during the allocation process...?
<bougyman> 12 seconds for each, 14 seconds for inject.
<bougyman> summing 1..10000 10000 times.
<bougyman> 9.65 seconds vs 8.1 seconds on my beefier box.
<zenspider> bougyman: don't forget (n**2 + n)/2 !!!
<zenspider> :P
<bougyman> pretty consisten runs.
<bougyman> each wins.
<zenspider> 10k iterations is pretty small for something this low
<zenspider> constant times over linear :P
<zenspider> times? wins...
<bougyman> ok, 100000 then
<zenspider> I need another espresso
<rue> 10000 espressos
<bougyman> 81 seconds for 100,000
<bougyman> like i said, pretty consistent
<bougyman> (that's for each)
<RORgasm> zenspider: inject definitely seesm to be performing worse than each in 1.9.2....but not by that much...i think it used to be a bigger difference in MRI, hmm...well i guess that's not the problem in that block of code really
<bougyman> in about 81 seconds we'll see inject say it was 96 seconds.
<bougyman> RORgasm: to me, that's substantial.
<bougyman> the differences i'm seeing, that is.
<RORgasm> bougyman: zenspider ^
<zenspider> RORgasm: again... it has to perform worse by definition since it is dependent on each
<RORgasm> zenspider: that's not what i meant
<bougyman> 96.65
<bougyman> vs 81.23
<bougyman> substantial
<bougyman> greater than 15%
<RORgasm> zenspider: i meant to say that the performance difference used to be larger between the two in MRI than it is now with 1.9 (Yarv) imho
<rue> RORgasm: Technically, your #inject has an extra assignment
<zenspider> yeah. that's not a fair benchmark
<zenspider> use + not +=
<rue> Also, (0..n).inject do end -> (1..n).inject(0) do end
<rue> Er ==
gregmoreno [gregmoreno!~gregmoren@c-98-234-78-95.hsd1.ca.comcast.net] has joined #ruby-lang
<rue> Stylistic note
<RORgasm> anyhow...i thought maybe it was causing thie issue in this block of code
<RORgasm> i was trying to see if i could figure out why this code was bombing https://github.com/jnunemaker/mongomapper/blob/master/lib/mongo_mapper/plugins/embedded_callbacks.rb#L21-27
<RORgasm> its an issue in mongomapper
<RORgasm> the embedded callbacks plugin
<RORgasm> getting a stack level too deep error for a lot of embedded docs (on the order of 800 from what i can tell from people's comemnts)
<RORgasm> anyone have any ideas on this
<jorgenpt> injekt: Hmm, I'm a little curious about this behavior of slop: opts = Slop.parse(["--no_install"]) do on :no_install; end, opts.no_install? is true, opts.to_hash shows :no_install => nil.
<RORgasm> i've contributed some code and docs to mongomapper so i was just curious to why this issue was occurring and wanted to see if i could help figure out a better solution
<RORgasm> anyone ?
<RORgasm> :)
fullsailor [fullsailor!~fullsailo@ip24-250-174-76.ga.at.cox.net] has joined #ruby-lang
<rue> I don't really understand the context of the code; I assume it's for some reason not possible to just call the callbacks
headius [headius!~headius@64.122.234.10] has joined #ruby-lang
<zenspider> rue: you know! modules!
<zenspider> for kids!
<zenspider> RORgasm: but do they listen to me??? noooooooo.....
<RORgasm> zenspider: lol
<zenspider> RORgasm: you haven't actually explained what your issue is... you just said you want to do that code "without inject" but not why
<zenspider> there's plenty of things wrong with that method, but using inject isn't one of them
<RORgasm> zenspider: i realized inject isn't the problem
<RORgasm> zenspider: i thought perhaps inject was the performance bottleneck in that block of code
<zenspider> not using map on the first paragraph would be a nice cleanup tho
<RORgasm> zenspider: i was also trying to grock what exactly that block is doing
<zenspider> whatever is in the blocks is prolly the performance bottleneck
<rue> Maybe a legit stack problem, limits too low?
<RORgasm> zenspider: yeah that's what i figured
<RORgasm> is there a way to inspect super before yielding control to it
<RORgasm> ?
<RORgasm> hmm
<RORgasm> nevermind
<RORgasm> zenspider: where are u seeing a map being used?
<zenspider> I'm seeing a map NOT being used
<zenspider> 14-18
<RORgasm> i see an each there not a map
<zenspider> I'd bet a million billion somethings that there is little-to-no reason why inject is being used and passed to super over just calling the fucking procs.
<RORgasm> zenspider: totally offtopic...were you at cascadia ruby conf?
<zenspider> RORgasm: look at the code. that's my point.
<RORgasm> last year?
<zenspider> RORgasm: yes
<RORgasm> zenspider: cool...i was there too... i talked about enumerable
<zenspider> then you should know that 14-18 should be a map :P
<RORgasm> :)
<RORgasm> zenspider: sorry i just misread u...i thought u said it was currently using a map :)
alip [alip!~alip@exherbo/developer/alip] has joined #ruby-lang
Asher [Asher!~asher@98.158.127.150] has joined #ruby-lang
deryl [deryl!deryl@perfecting.rubyists.com] has joined #ruby-lang
amerine [amerine!~mturner@67.204.184.82] has joined #ruby-lang
dejongge [dejongge!~jonke@pD9E0DFE1.dip0.t-ipconnect.de] has joined #ruby-lang
Heimidal_ [Heimidal_!~heimidal@factory-smtp.factorylabs.com] has joined #ruby-lang
Sailias [Sailias!~jonathan@CPE0018f85e576d-CM001bd7aaaf96.cpe.net.cable.rogers.com] has joined #ruby-lang
Sailias [Sailias!~jonathan@CPE0018f85e576d-CM001bd7aaaf96.cpe.net.cable.rogers.com] has joined #ruby-lang
neoesque [neoesque!~neoesque@210.59.147.232] has joined #ruby-lang
<Jarred> I have several microcontrollers that will talk to a server over serial ports. I also have more than one web browser accessing the same server. I'm trying to decide what software stack I should use for the server. I could just use Rails, and have a separate application turn the data sent over serial into HTTP requests, or I could have an adapter pattern for the different ways of accessing the device. I could also have a Sinatra app
cola_zero_ [cola_zero_!~cola_zero@www5054u.sakura.ne.jp] has joined #ruby-lang
h4y4shi [h4y4shi!~chatzilla@rrcs-67-79-54-130.sw.biz.rr.com] has joined #ruby-lang
<Jarred> Also take into account that I want to keep this as simple as possible
Phrogz [Phrogz!~phrogz@pdpc/supporter/professional/phrogz] has joined #ruby-lang
<drbrain> Jarred: I use ruby-serialport to dump data from my XBee-attached arduino directly into the database
SkramX [SkramX!~SkramX@pool-173-73-134-143.washdc.east.verizon.net] has joined #ruby-lang
<drbrain> Jarred: if the server pulls data out of a database I would have the microcontroller dump data into the DB directly
jmontross [jmontross!~Adium@static-96-236-65-137.snfcca.dsl-w.verizon.net] has joined #ruby-lang
<nofxx> Jarred, I wrote subduino to do that once, it worked like this -> mcu -> redis -> pubsub -> storage
<postmodern> drbrain, wow that's really cool
<nofxx> Jarred, rails as view https://github.com/nofxx/subduino .... it's pretty simple actually.. just wraps ruby-serialport
<Jarred> nofxx: I like that you used WTFPL
<Jarred> I think that's the best license
<drbrain> postmodern: in my particular case, "the database" is home automation software which then writes out to Pg
<nofxx> Jarred, hehe I hate licenses... I use a regex finder in emacs, so I always go for "lib" it completes LICENSE sometimes... grrrr
<Jarred> I don't really like the idea of having the stuff over serial port writing directly to the database because then it's a little harder to change later on
<postmodern> i wonder what the current status of ruby on SBCs is
<postmodern> would be neat to use ruby on a gumstix arm board
<Jarred> (The code I mean, it's too specific IMO for that device)
<postmodern> or a rasberry pi
<nofxx> Jarred, what kind of data you're going to store?
<drbrain> Jarred: my script reads the raw format and alters it to be usable by the DB
<drbrain> then writes it
g0bl1n [g0bl1n!~g0bl1n@unaffiliated/g0bl1n] has joined #ruby-lang
<drbrain> Jarred: it's no different than making an HTTP request and doing the appropriate munging there
<nofxx> postmodern, and now x86 is coming to this market
<Jarred> drbrain: Yeah, but then everything that accesses the device goes through the same thing. The HTTP requests become something like a gate
<Jarred> I wonder if the Rails app is even neccessary
<Jarred> All I need for the frtone-nd stuff is just Backbone
<drbrain> Jarred: in my experience, submitting data via HTTP when you don't have is not "as simple as possible"
<WillMarshall> If I have a string matching a method name on a class, what's the cleanest way of calling that method?
<WillMarshall> Anything nicer than self.call(my_string)?
<drbrain> WillMarshall: send
<WillMarshall> drbrain: thanks
<postmodern> WillMarshall, note that send can access protected/private methods
<WillMarshall> postmodern: Not relevant in this case, but thank you :)
<WillMarshall> I'm using .send from inside the class anyway
<Jarred> drbrain: The microcontroller can just send the request type, the url, and the querystring over the serial port. From there, it's easy to send that over to the server. It'd be something like: "GET /status?&deviceID=0&front=true&back=false&reed=on&personID=5"
<Jarred> (where "the server" is the Sinatra or Rails server)
<drbrain> Jarred: oh, that's a fancier setup than I imagined
<nofxx> are we talking gprs or serial?
<WillMarshall> And how does one define a method with name of my_string?
<WillMarshall> I've seen this many times, can't remember it :/
<drbrain> I imagined data only flowing from the microcontroller out, not bidirectional
<drbrain> WillMarshall: def my_string() end ??
<postmodern> WillMarshall, define_method(name) { ... } on the class or meta-class of the object ?
<WillMarshall> postmodern: Cheers :)
<flowerpot> You know, I've heard a lot about "data consistency" - what is a good definition of "consistency"? does it depend on what you're doing?
<bougyman> no, consistency pretty much means the same thing
<flowerpot> So what does it mean?
<Jarred> nofxx: In production, it'd probably be serial over bluetooth
<bougyman> flowerpot: the word?
<flowerpot> bougyman, the concept as it applies to hard drives, databases, whatever
<drbrain> flowerpot: ^^ ACID explains it
<flowerpot> ACID article links to Consistency (database systems), which reads:
<flowerpot> "The data consistency model specifies a contract between programmer and system, wherein the system guarantees that if the programmer follows the rules, memory will be consistent"
<flowerpot> the final word "consistent" links to an article that says consistency is lack of logical contradiction, which is totally irrelevant here
<flowerpot> well, not totally
<flowerpot> but
<flowerpot> I see the word "consistency" thrown around like a buzzword
<drbrain> flowerpot: so you totally skipped over the paragraph after the link then?
<drbrain> and the example at 2.3?
<drbrain> err, 2.2?
<drbrain> filesystem consistency is more relaxed than database consistency and is usually restricted just to metadata updates
<flowerpot> 2.2 makes sense
<flowerpot> but I have a hard time translating it from database to filesystem
gregmoreno [gregmoreno!~gregmoren@c-98-234-78-95.hsd1.ca.comcast.net] has joined #ruby-lang
<drbrain> on a filesystem if I rename a file you won't see the file in two places
<drbrain> if I write to a file, however, you may see partial contents
<drbrain> with a database you will never see partial contens
<flowerpot> I get the idea that if an action like updating some metadata is interrupted (e.g. power outage), then the result can be "inconsistent" if there's conflicting metadata
<drbrain> contents
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
MistyM [MistyM!~MistyM@50.72.70.192] has joined #ruby-lang
<drbrain> yes, and at mount-time the filesystem performs an internal check and cleans up inconsistent metadata (through journal, softupdates, etc.)
<flowerpot> so bits sitting on a medium can't be "inconsistent", right? you need some kind of interpretation of the bits for some kind of badness (like contradicting metadata) to occur, right?
<drbrain> if there was a power failure at the right time, yes, the data could be inconsistent
<drbrain> but the user will never know because the filesystem corrects itself
<drbrain> so to you, as the user, it is consistent
<drbrain> the promise of consistency is about how the system behaves and presents data to you, not necessarily about the current physical state of the data
<drbrain> so long as the filesystem can recognize inconsistencies and repair itself it can be considered consistent
<erikh> flock the casbah
<drbrain> I would say the FAT filesystem is not a consistent filesystem since it could easily corrupt its own metadata
Heimidal [Heimidal!~heimidal@c-67-165-197-126.hsd1.co.comcast.net] has joined #ruby-lang
<flowerpot> the reason I ask is because I work a lot with EC2
<flowerpot> and I've often heard that in order to "maintain consistency," you should make sure the buffers have been flushed to disk before taking a snapshot of your instance
<flowerpot> the idea being that data which hasn't been written to disk yet might be required for consistency, or something to that effect
<drbrain> sure
<flowerpot> but isn't there *always* data in buffers?
<flowerpot> and is it possible that even if you flushed the buffers, you might wind up with "inconsistent" data as a result of some other issue?
<drbrain> if your system is idle and you have run sync(8) there should be no unwritten data in the filesystem write buffers
<drbrain> there will always be data in the read buffers, but that data is OK
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
<flowerpot> but that makes it seem lik consistency = buffers flushed to disk. is that so...?
<drbrain> it's also that there's only one version of the filesystem metadata
<drbrain> while the host is up moving a file should only show the file in one of two places
<WillMarshall> Hmm. How would I define a method with a name from a string (my_string) from within a class_eval block?
<WillMarshall> It won't let me call define_method
<flowerpot> you'll have to forgive me; I don't quite follow what you're saying. Is it possible to have consistency without flushing the buffers?
<drbrain> yes
headius [headius!~headius@64.122.234.10] has joined #ruby-lang
<drbrain> if I move a file it should only appear in its source or destination, but not both at once
<drbrain> that can happen without flushing the disk
<drbrain> if you move a file and pull the plug out of the wall Real Fast when you boot back up the file should appear as the source or destination, but not both at once
<drbrain> (appearing at the destination after pulling the plug is a property of Durability)
<drbrain> I need to get on the bus now
<flowerpot> ok. thanks for taking the time to talk about consistency with me :)
twittard [twittard!~twittard@wc.lax.truecarcorp.com] has joined #ruby-lang
<drbrain> oh, it's possible to have pull-the-plug always have the file be in the destination provided mv is finished, but that makes writes go really slow
macmartine [macmartine!~macmartin@c-24-21-112-60.hsd1.or.comcast.net] has joined #ruby-lang
Luxx_ [Luxx_!~highoh@c-67-171-35-186.hsd1.wa.comcast.net] has joined #ruby-lang
jmontross [jmontross!~Adium@static-96-236-65-137.snfcca.dsl-w.verizon.net] has quit [#ruby-lang]
Pip [Pip!~Pip@188.134.46.174] has joined #ruby-lang
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
burns180 [burns180!~aWizard@adsl-072-148-000-213.sip.mcn.bellsouth.net] has joined #ruby-lang
darkf [darkf!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
lele [lele!~lele@fangorn.windmill.it] has joined #ruby-lang
dontbecold_ [dontbecold_!~luke@holly.ghostworksinc.com] has joined #ruby-lang
rtl [rtl!~rtl@monothorpe.com] has joined #ruby-lang
lucas [lucas!~lucas@xanadu.blop.info] has joined #ruby-lang
Keltia [Keltia!roberto@aran.keltia.net] has joined #ruby-lang
hachiya [hachiya!~hachiya@encyclical.net] has joined #ruby-lang
andman [andman!~andman@minorshadows.net] has joined #ruby-lang
ChloeD [ChloeD!~chloe@88-190-26-89.rev.dedibox.fr] has joined #ruby-lang
lsegal [lsegal!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
fullsailor [fullsailor!~fullsailo@ip24-250-174-76.ga.at.cox.net] has joined #ruby-lang
zerokarmaleft [zerokarmaleft!zkl@morpheus.net] has joined #ruby-lang
jaisoares [jaisoares!~jsoares@bl13-218-246.dsl.telepac.pt] has joined #ruby-lang
werwolf [werwolf!~llakey@174-127-47-94.static-ip.telepacific.net] has joined #ruby-lang
a3li [a3li!~alex@gentoo/developer/a3li] has joined #ruby-lang
y3llow [y3llow!~y3llow@114-36-224-117.dynamic.hinet.net] has joined #ruby-lang
Jarred [Jarred!~Administr@c-71-198-139-210.hsd1.ca.comcast.net] has joined #ruby-lang
mtkd [mtkd!znc@209-20-90-74.slicehost.net] has joined #ruby-lang
WillMarshall [WillMarshall!~willmarsh@203.48.101.90] has joined #ruby-lang
yibe [yibe!~yibe@163.43.161.140] has joined #ruby-lang
Arsen7 [Arsen7!~case@gmx218.internetdsl.tpnet.pl] has joined #ruby-lang
samuelkadolph [samuelkadolph!~samuelkad@unaffiliated/samuelkadolph] has joined #ruby-lang
SuperTaz_work [SuperTaz_work!~supertaz_@c-24-130-115-179.hsd1.ca.comcast.net] has joined #ruby-lang
MistyM [MistyM!~MistyM@50.72.70.192] has joined #ruby-lang
basicxman [basicxman!~basicxman@178.79.149.144] has joined #ruby-lang
basicxman [basicxman!~basicxman@unaffiliated/secrece] has joined #ruby-lang
dominikh [dominikh!~dominikh@cinch/developer/dominikh] has joined #ruby-lang
jarib [jarib!~jarib@unaffiliated/jarib] has joined #ruby-lang
retro|cz [retro|cz!~retro@106.142.broadband6.iol.cz] has joined #ruby-lang
mitchty [mitchty!~mitchty@ec2-50-19-41-37.compute-1.amazonaws.com] has joined #ruby-lang
joschi [joschi!~joschi@zuse.schalanda.name] has joined #ruby-lang
ruskie [ruskie!ruskie@sourcemage/mage/ruskie] has joined #ruby-lang
cout [cout!~cout@li2-82.members.linode.com] has joined #ruby-lang
prsimp [prsimp!~prs@manifestland.com] has joined #ruby-lang
meise [meise!~dm@3st.be] has joined #ruby-lang
MistyM [MistyM!~MistyM@50.72.70.192] has joined #ruby-lang
qpingu [qpingu!~Adium@67.218.117.238] has joined #ruby-lang
darix [darix!darix@nordisch.org] has joined #ruby-lang
darix [darix!darix@irssi/staff/darix] has joined #ruby-lang
Stereokitsune [Stereokitsune!~mayoi@nessa.yuuzukiyo.net] has joined #ruby-lang
hackeron [hackeron!~hackeron@gentoo/user/hackeron] has joined #ruby-lang
dv310p3r [dv310p3r!~dv310p3r@c-98-203-41-91.hsd1.fl.comcast.net] has joined #ruby-lang
burns180_ [burns180_!~aWizard@adsl-072-148-000-213.sip.mcn.bellsouth.net] has joined #ruby-lang
twittard_ [twittard_!~twittard@wc.lax.truecarcorp.com] has joined #ruby-lang
slimfit [slimfit!~slimfit@c-98-245-122-231.hsd1.co.comcast.net] has joined #ruby-lang
agib [agib!u781@gateway/web/irccloud.com/x-wjynmuhgygoysosw] has joined #ruby-lang
warreng [warreng!~Adium@badger/staff/warreng] has joined #ruby-lang
Sailias [Sailias!~jonathan@CPE0018f85e576d-CM001bd7aaaf96.cpe.net.cable.rogers.com] has joined #ruby-lang
warreng [warreng!~Adium@badger/staff/warreng] has quit [#ruby-lang]
fragmachine [fragmachine!~fragmachi@101.169.212.176] has joined #ruby-lang
Phrogz [Phrogz!~phrogz@pdpc/supporter/professional/phrogz] has joined #ruby-lang
dfr|floridia [dfr|floridia!~dfr|work@174.128.210.18] has joined #ruby-lang
igotnolegs [igotnolegs!~igotnoleg@75-162-83-166.slkc.qwest.net] has joined #ruby-lang
gokul [gokul!~gokulnath@115.111.177.122] has joined #ruby-lang
<bnagy> good morning asia / deadshift
headius [headius!~headius@71-37-230-236.mpls.qwest.net] has joined #ruby-lang
mikeric [mikeric!~mike@S0106c03f0e8b23f3.vc.shawcable.net] has joined #ruby-lang
Dreamer3 [Dreamer3!~Dreamer3@74-134-34-116.dhcp.insightbb.com] has joined #ruby-lang
twittard [twittard!~twittard@cpe-76-169-74-39.socal.res.rr.com] has joined #ruby-lang
MistyM [MistyM!~MistyM@50.72.70.192] has joined #ruby-lang
macmartine [macmartine!~macmartin@c-24-21-112-60.hsd1.or.comcast.net] has joined #ruby-lang
rippa [rippa!~splitta@85.158.54.234] has joined #ruby-lang
gianlucadv [gianlucadv!~gianlucad@host78-84-dynamic.44-79-r.retail.telecomitalia.it] has joined #ruby-lang
slimfit [slimfit!~slimfit@c-98-245-122-231.hsd1.co.comcast.net] has joined #ruby-lang
Tasser [Tasser!~freak@subtle/contributor/Tass] has joined #ruby-lang
csherin [csherin!~csherin@61.17.32.219] has joined #ruby-lang
twittard [twittard!~twittard@vpn.lax.truecarcorp.com] has joined #ruby-lang
ksinkar [ksinkar!~ksinkar@117.195.104.143] has joined #ruby-lang
bousquet [bousquet!~bousquet@74.197.255.182] has joined #ruby-lang
lordofthedance [lordofthedance!~daddycool@wnpgmb0910w-ad02-150-151.dynamic.mtsallstream.net] has joined #ruby-lang
flip_digits [flip_digits!~textual@c-76-122-14-228.hsd1.fl.comcast.net] has joined #ruby-lang
<postmodern> random thought, why isn't taint used to automatically escape user-input when it reaches sensitive interfaces, like system() or an html template?
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
<bnagy> if you have user input to system() then who cares about escaping it? :)
<shevy> postmodern what would "taint" do to the input?
<shevy> or rather, which sanitization do you want to apply when input is done to system()
<postmodern> shevy, indicate that it should be properly escaped by the callee
<postmodern> bnagy, indeed, but just looking at the epic fail that was the gitorious command injection patch
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby-lang
<bnagy> didn't see it
ksinkar_ [ksinkar_!~ksinkar@117.195.112.44] has joined #ruby-lang
twittard_ [twittard_!~twittard@cpe-76-169-74-39.socal.res.rr.com] has joined #ruby-lang
<bnagy> escaping won't stop people from being retarded
<postmodern> yeah i suppose there'd be no way of catching `cmd #{user_input}`
<postmodern> er system("cmd #{user_input}")
Perry81 [Perry81!~Perry@186.87.120.219] has joined #ruby-lang
<bnagy> wonder how long before someone files a bug that it's broken for german systems etc
<postmodern> also stupid question, why does gsub operate on multi-line Strings
<postmodern> where other regexp String methods require //m
woollyams [woollyams!~woollyams@203-206-165-21.perm.iinet.net.au] has joined #ruby-lang
rpowell [rpowell!~rpowell@58.165.133.33] has joined #ruby-lang
csherin [csherin!~csherin@115.111.177.122] has joined #ruby-lang
deryldoucette [deryldoucette!~Deryl@sms5-pool120-0211.bmts.com] has joined #ruby-lang
<Phrogz> postmodern: That's a rather uninformed statement.
<Phrogz> s/uninformed/…wrong?/
<Phrogz> What other String methods require /m?
<postmodern> Phrogz, which statement, i make a log of wrong statements all the time :)
<shevy> postmodern the "g" ist for "global"
<shevy> that should include "\n" in the string too
<Phrogz> shevy: String#sub operates on multiline strings as well. All string methods do; \n is just another character.
<postmodern> Phrogz, ah ok, i seem to remember //m was required for some method when dealing with multiline input
<Phrogz> The "global" is for "global substitution", as in "do it as much as you can" compared to sub which does it only once.
<Phrogz> postmodern: None that I can think of.
<postmodern> Phrogz, apparently in 1.9 scan/match/etc all work on multi-line Strings
<Phrogz> 1.8, too
<postmodern> so why does //m still exist?
<Phrogz> postmodern: /m causes . to match newline characters. https://github.com/ruby/ruby/blob/trunk/doc/re.rdoc
Perry81 [Perry81!~Perry@186.87.120.219] has joined #ruby-lang
<postmodern> Phrogz, derp, thanks now i know
<Phrogz> That's a good doc to bookmark.
<postmodern> ok yeah, now i remember hitting that with . and //m
<postmodern> ugh shotty memory
<rpowell> hey all
<rpowell> entolled for university todya
<rpowell> today*
<postmodern> congratulations :)
<rpowell> oh, wrong channel
<rpowell> but thanks =D
kitallis [kitallis!~kitallis@122.167.116.57] has joined #ruby-lang
cesario [cesario!u2444@gateway/web/irccloud.com/x-mlamdewtgdtvsmpx] has joined #ruby-lang
meise [meise!~dm@3st.be] has joined #ruby-lang
havenn [havenn!~skipper@pool-71-189-127-105.lsanca.fios.verizon.net] has joined #ruby-lang
denysonique_ [denysonique_!u484@gateway/web/irccloud.com/x-ofedeuhfklwpxkci] has joined #ruby-lang
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
abuiles [abuiles!u1641@gateway/web/irccloud.com/x-ysefsefuwavnssoa] has joined #ruby-lang
savage- [savage-!~savage-@c-67-180-11-89.hsd1.ca.comcast.net] has joined #ruby-lang
dkannan [dkannan!u480@gateway/web/irccloud.com/x-rxfgryqikscmbvdv] has joined #ruby-lang
Oloryn_lt1 [Oloryn_lt1!~Oloryn@home.benshome.net] has joined #ruby-lang
neuro_damage [neuro_damage!~neuro@ec2-23-21-195-181.compute-1.amazonaws.com] has joined #ruby-lang
<bnagy> wow, 20% speedup by judicious use of Thread.pass
mikeric [mikeric!~mike@S0106c03f0e8b23f3.vc.shawcable.net] has joined #ruby-lang
mrchrisadams [mrchrisadams!u1367@gateway/web/irccloud.com/x-djotwiryhzjnmswa] has joined #ruby-lang
burgestrand [burgestrand!~burgestra@h-45-63.a155.priv.bahnhof.se] has joined #ruby-lang
jsnrth [jsnrth!~jsnrth@c-98-245-85-182.hsd1.co.comcast.net] has joined #ruby-lang
<bnagy> I guess it really isn't a bad idea to give the scheduler a hint from time to time
butchanton [butchanton!~butchanto@c-71-202-131-177.hsd1.ca.comcast.net] has joined #ruby-lang
jkprg [jkprg!~jarda@ip-62-245-93-150.net.upcbroadband.cz] has joined #ruby-lang
joshfng [joshfng!~joshfng@ool-45713bd4.dyn.optonline.net] has joined #ruby-lang
neurodamage [neurodamage!~neuro@ec2-23-21-195-181.compute-1.amazonaws.com] has joined #ruby-lang
gianlucadv [gianlucadv!~gianlucad@109.54.208.110] has joined #ruby-lang
RORgasm [RORgasm!~rorgasm@nyv-exweb.iac.com] has joined #ruby-lang
joshfng [joshfng!~joshfng@ool-45713bd4.dyn.optonline.net] has quit ["Leaving..."]
ryanf [ryanf!~rfitz@ec2-50-18-158-149.us-west-1.compute.amazonaws.com] has joined #ruby-lang
<shevy> earth to thread, earth to thread:
<shevy> you guys suck!!!
<bnagy> strangely, there is still a performance diff on jruby
<bnagy> which I didn't expect to see
krz [krz!~foobar@unaffiliated/krz] has joined #ruby-lang
MistyM [MistyM!~MistyM@50.72.70.192] has joined #ruby-lang
yxhuvud [yxhuvud!mongo@h-225-165.a212.priv.bahnhof.se] has joined #ruby-lang
michael_mbp [michael_mbp!~Marin@62.215.214.4] has joined #ruby-lang
Locke23rus [Locke23rus!~quassel@128-70-13-168.broadband.corbina.ru] has joined #ruby-lang
butchanton [butchanton!~butchanto@c-71-202-131-177.hsd1.ca.comcast.net] has joined #ruby-lang
felipe [felipe!~felipe@unaffiliated/felipe] has joined #ruby-lang
SuperTaz_work [SuperTaz_work!~supertaz_@c-24-130-115-179.hsd1.ca.comcast.net] has joined #ruby-lang
Z2FyZA [Z2FyZA!~gard@cm-84.215.22.0.getinternet.no] has joined #ruby-lang
mytrile [mytrile!~mytrile@94.26.28.135] has joined #ruby-lang
Fullmoon [Fullmoon!~Fullmoon@dsl-stat-43-17.mmc.at] has joined #ruby-lang
thone [thone!~thone@g225084106.adsl.alicedsl.de] has joined #ruby-lang
deryldoucette [deryldoucette!~Deryl@cheetah-tiv-ppp1201.bmts.com] has joined #ruby-lang
lake [lake!~lake@li71-228.members.linode.com] has joined #ruby-lang
Perry81 [Perry81!~Perry@186.87.120.219] has joined #ruby-lang
rpowell [rpowell!~rpowell@58.165.133.33] has joined #ruby-lang
KU0N [KU0N!~KU0N@213-193-112-54.static.cablecom.ch] has joined #ruby-lang
alip [alip!~alip@exherbo/developer/alip] has joined #ruby-lang
fragmachine [fragmachine!~fragmachi@101.169.69.172] has joined #ruby-lang
zmack [zmack!~zmack@109.99.235.103] has joined #ruby-lang
MistyM [MistyM!~MistyM@50.72.70.192] has joined #ruby-lang
mikeric [mikeric!~mike@S0106c03f0e8b23f3.vc.shawcable.net] has joined #ruby-lang
chezduck [chezduck!~chezduck@46.231.84.226] has joined #ruby-lang
irc_uSSr [irc_uSSr!~Admin@114.79.28.115] has joined #ruby-lang
irc_uSSr [irc_uSSr!~Admin@114.79.28.115] has quit [#ruby-lang]
roadkith [roadkith!~kith@unaffiliated/kith] has joined #ruby-lang
tla [tla!~tla@toelboell-lund.dk] has joined #ruby-lang
jensn [jensn!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby-lang
solars [solars!~solars@clnet-kmu02-090.ikbnet.co.at] has joined #ruby-lang
|Vargas| [|Vargas|!~luke@host165-130-dynamic.244-95-r.retail.telecomitalia.it] has joined #ruby-lang
|Vargas| [|Vargas|!~luke@pdpc/supporter/profesional/vargas] has joined #ruby-lang
jMCg [jMCg!~hiro@apache/committer/igalic] has joined #ruby-lang
FiXato [FiXato!~FiXato@static-ip-69-64-52-242.inaddr.ip-pool.com] has joined #ruby-lang
chezduck_ [chezduck_!~chezduck@62.212.136.166] has joined #ruby-lang
woollyams [woollyams!~woollyams@124-149-81-196.dyn.iinet.net.au] has joined #ruby-lang
toretore [toretore!~toretore@crr06-3-82-231-12-81.fbx.proxad.net] has joined #ruby-lang
WillMarshall [WillMarshall!~willmarsh@ppp121-44-86-68.lns20.syd6.internode.on.net] has joined #ruby-lang
Axs [Axs!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby-lang
gianlucadv [gianlucadv!~gianlucad@st-dellaved.statistica.unimib.it] has joined #ruby-lang
indeterminate [indeterminate!~sei@user-3c2h3m6.cable.mindspring.com] has joined #ruby-lang
priteshjain [priteshjain!~priteshja@115.248.175.50] has joined #ruby-lang
take_cheeze [take_cheeze!~Adium@pc06224.anc-tv.ne.jp] has joined #ruby-lang
Muz [Muz!~muz@last.fm/moose/Muz] has joined #ruby-lang
robotmay [robotmay!~robotmay@94.30.13.228] has joined #ruby-lang
roolo [roolo!~roolo@customer-79-127-150-214.net.angelnet.cz] has joined #ruby-lang
tekin [tekin!~tekin@cpc8-with5-2-0-cust208.1-4.cable.virginmedia.com] has joined #ruby-lang
Guusen [Guusen!~Gus@92.69.245.55] has joined #ruby-lang
beiter [beiter!~beiter@manz-5f748fa2.pool.mediaWays.net] has joined #ruby-lang
rahult_ [rahult_!~rahult_@219-90-242-50.ip.adam.com.au] has joined #ruby-lang
kitallis [kitallis!~kitallis@122.167.116.57] has joined #ruby-lang
x0F_ [x0F_!~x0F@unaffiliated/x0f] has joined #ruby-lang
shevy [shevy!~shevy@194-166-31-66.adsl.highway.telekom.at] has joined #ruby-lang
eban [eban!~eban@www2371u.sakura.ne.jp] has joined #ruby-lang
Fullmoon [Fullmoon!~Fullmoon@TK212017097035.teleweb.at] has joined #ruby-lang
mailo [mailo!~roolo@customer-79-127-150-214.net.angelnet.cz] has joined #ruby-lang
futurechimp [futurechimp!~futurechi@109.239.86.106] has joined #ruby-lang
ovnimancer [ovnimancer!~anton@212.59.96.38] has joined #ruby-lang
flowerpot [flowerpot!~flower@ec2-50-112-114-252.us-west-2.compute.amazonaws.com] has joined #ruby-lang
<rue> bnagy: And what have we learned about optimizations? ;)
vesan [vesan!vesan@maailmanlopun.modeemi.net] has joined #ruby-lang
<bnagy> um, that they're sometimes free and wacky?
<bnagy> I discovered this when I changed a sleep rand # simulate expense to sleep(0)
srbartlett [srbartlett!~srbartlet@101.172.181.150] has joined #ruby-lang
tommyblue [tommyblue!~tommyblue@galois.linusse.org] has joined #ruby-lang
dave_miles [dave_miles!~davemiles@gatej.mh.bbc.co.uk] has joined #ruby-lang
eban [eban!~eban@www2371u.sakura.ne.jp] has joined #ruby-lang
srbartlett [srbartlett!~srbartlet@101.172.181.150] has joined #ruby-lang
srbartle_ [srbartle_!~srbartlet@101.172.224.108] has joined #ruby-lang
<rue> Someone please tell me that Debian's 1.9 isn't 1.9.0?
<injekt> rue: there is no 1.9.0, but i wouldn't be surprised if it's the not-so-stable 1.9.1 :D
xjonc [xjonc!~xjonc@bfw243.neoplus.adsl.tpnet.pl] has joined #ruby-lang
<rue> Well, there WAS a 1.9.0. In 2007.
<manveru> what debian are we talking about? they had 1.9.0 in their repos once too
<rue> Some dude on -talk
<rahult_> dumb question, any method of core ruby that is written in ruby?
lupine_85 [lupine_85!~lupine_85@unaffiliated/lupine-85/x-7392152] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@46.118.231.73] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@subtle/user/kyrylo] has joined #ruby-lang
Perry81 [Perry81!~Perry@186.87.120.219] has joined #ruby-lang
neurodamage [neurodamage!~neuro@ec2-23-21-195-181.compute-1.amazonaws.com] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
csherin [csherin!~csherin@115.111.177.122] has joined #ruby-lang
<bnagy> doesn't sound like a dumb question, otherwise someone would have tried to sound clever by now :)
<bnagy> my guess is 'not anymore' but I don't know - why do you ask?
gix [gix!~gix@e180021217.adsl.alicedsl.de] has joined #ruby-lang
ovnimancer [ovnimancer!~anton@212.59.96.38] has joined #ruby-lang
<manveru> rahult_: in rbx?
<rahult_> manveru: MRI
<manveru> no
<rahult_> bnagy: mainly curiosity
zwerg [zwerg!~quassel@ip-62-143-88-100.unitymediagroup.de] has joined #ruby-lang
<zwerg> Hi there.
<manveru> hm
<rahult_> thanks manveru
joast [joast!~rick@76.178.187.164] has joined #ruby-lang
<manveru> rahult_: if you consider rubygems core, since it's loaded in 1.9 by default, then there might be some
<rahult_> manveru: found some in std lib, just was curious, I should look into rbx
<manveru> well, ruby core used to be what you find in the libruby
<rahult_> thanks manveru it is good to know, I am happy to read the lib codes :-)
<manveru> i doubt htat... :P
<manveru> *that
<zwerg> When using Crack::XML.parse, the result will be an array, if there are consecutive tags of the same name, which is fine. If there's only one element I won't be able to iterate over it. Any cool trick to overcome this?
<manveru> [*]
<manveru> and what's crack?
<manveru> a wrapper for nokogiri?
<zwerg> A simple parser which gives me an object from XML.
<manveru> uhm
<zwerg> You mean [single_object].each ... ? That would mean I had to check if it's an array or not.
<manveru> did you just use simple, parser, and XML in the same sentence?
<manveru> no
<manveru> [*single_obj].each
JohnBat26 [JohnBat26!~Eugene@89.175.77.79] has joined #ruby-lang
<manveru> also Array(single_obj).each
<zwerg> It's two hundred lines of Ruby. I suppose that's simple enough for XML.
frangiz [frangiz!~frangiz@user26.77-105-206.netatonce.net] has joined #ruby-lang
<manveru> then it doesn't parse xml
<manveru> or you use something else to parse it for you
ovnimancer [ovnimancer!~anton@212.59.96.38] has joined #ruby-lang
<shevy> stones
<shevy> I use stones to parse XML
<zwerg> Ah, that's the trick I was looking for, thanks!
<zwerg> manveru: You mean it wouldn't be able to catch any strange XML corner cases? Maybe so, but luckily the XML files I need to parse seem to be sane enough.
<manveru> ...
<manveru> shevy: and that's how people commit suicide over XML :(
tla_ [tla_!~tla@toelboell-lund.dk] has joined #ruby-lang
<shevy> manveru yeah
<shevy> "strange XML corner cases"
<shevy> famous last words :)
<shevy> zwerg is a cool nick too haha
<zwerg> Is it?
<shevy> sure!
<shevy> german nickname!
<shevy> der zwerg, das tapfere Schneiderlein und die dark corner cases of XML
jxie [jxie!~jxie@115.198.167.77] has joined #ruby-lang
<zwerg> Array(hash) results in hash.to_a :-(
<zwerg> shevy: Sieben auf einen Streich!
krz [krz!~foobar@58.69.201.60] has joined #ruby-lang
krz [krz!~foobar@unaffiliated/krz] has joined #ruby-lang
gianlucadv [gianlucadv!~gianlucad@rna.bio.disco.unimib.it] has joined #ruby-lang
gordonhatusupy [gordonhatusupy!~gordonhat@a80-101-135-186.adsl.xs4all.nl] has joined #ruby-lang
<gordonhatusupy> Hi
Z2FyZA [Z2FyZA!~gard@cm-84.215.22.0.getinternet.no] has joined #ruby-lang
malev [malev!~malev@190.210.138.237] has joined #ruby-lang
kaiwren [kaiwren!~KaiWren@122.167.116.57] has joined #ruby-lang
Spooner [Spooner!~Miranda@host-78-144-139-130.as13285.net] has joined #ruby-lang
joast [joast!~rick@76.178.184.101] has joined #ruby-lang
<Defusal_> Is there any better way to do regex matching in a case statement and then get the matches out, than splatting the regex matches into variables? i know about named groups, but that would make the regex cases far too long...
Sailias [Sailias!~jonathan@CPE0018f85e576d-CM001bd7aaaf96.cpe.net.cable.rogers.com] has joined #ruby-lang
<lianj> Defusal_: $1, $2, ..
<Defusal_> lianj, i need better named variables than that
<Defusal_> hence why im currently slatting the $~[1..-1] into variables
<Defusal_> i guess theres no real compact solution to it
<lianj> isn't that compact enought? :)
<Defusal_> i guess it'll have to be :P
tomzx [tomzx!~tomzx@66-77.162.dsl.aei.ca] has joined #ruby-lang
gokul [gokul!~gokulnath@115.111.177.122] has joined #ruby-lang
mark_locklear [mark_locklear!~jlocklear@ab-tech-lan-to-ab-tech-gw.ncren.net] has joined #ruby-lang
<shevy> how about
<shevy> $snowprincess
<shevy> $tigerforce
<shevy> $sexyqueen
<shevy> $lastsamurai
sdeobald [sdeobald!~steven@122.167.116.57] has joined #ruby-lang
<shevy> $1 $2 is actually not so bad, I think. you can just count in the regex at the ()
<shevy> what I can't stand are things like $% $$ $^ $` $:
flip_digits [flip_digits!~textual@c-76-122-14-228.hsd1.fl.comcast.net] has joined #ruby-lang
jasim [jasim!~jasim@122.167.116.57] has joined #ruby-lang
dous_ [dous_!~dous@cm171.sigma67.maxonline.com.sg] has joined #ruby-lang
tommyvyo [tommyvyo!~tommyvyo@38.123.129.115] has joined #ruby-lang
ickmund [ickmund!~ickmund@cli-5b7e85fc.bcn.adamo.es] has joined #ruby-lang
twixmix [twixmix!~ryanniels@blk-11-127-105.eastlink.ca] has joined #ruby-lang
g0bl1n [g0bl1n!~g0blin@unaffiliated/g0bl1n] has joined #ruby-lang
FiXato [FiXato!~FiXato@fixato.net] has joined #ruby-lang
FiXato [FiXato!~FiXato@fixato.net] has joined #ruby-lang
rafadc [rafadc!~rafadc@4.Red-83-60-163.dynamicIP.rima-tde.net] has joined #ruby-lang
malev [malev!~malev@74.10.95.2] has joined #ruby-lang
billturner [billturner!~textual@pool-173-71-170-21.pitbpa.fios.verizon.net] has joined #ruby-lang
Fullmoon [Fullmoon!~Fullmoon@85-127-83-224.dynamic.xdsl-line.inode.at] has joined #ruby-lang
dous [dous!~dous@cm171.sigma67.maxonline.com.sg] has joined #ruby-lang
dous [dous!~dous@unaffiliated/dous] has joined #ruby-lang
dv310p3r [dv310p3r!~dv310p3r@host-208-68-238-122.biznesshosting.net] has joined #ruby-lang
dous_ [dous_!~dous@cm171.sigma67.maxonline.com.sg] has joined #ruby-lang
empity [empity!~user@149.255.121.162] has joined #ruby-lang
g0bl1n [g0bl1n!~g0blin@unaffiliated/g0bl1n] has joined #ruby-lang
yfeldblum [yfeldblum!~Jay@pool-71-246-76-76.bltmmd.east.verizon.net] has joined #ruby-lang
bglusman [bglusman!~bglusman@c-68-80-200-61.hsd1.pa.comcast.net] has joined #ruby-lang
jxie [jxie!~jxie@115.198.167.77] has joined #ruby-lang
michael_mbp [michael_mbp!~Marin@31.203.216.28] has joined #ruby-lang
Sailias [Sailias!~jonathan@s72-38-77-178.static.comm.cgocable.net] has joined #ruby-lang
ryez [ryez!3dabf6b3@gateway/web/freenode/ip.61.171.246.179] has joined #ruby-lang
<ryez> could anyone please let me know where is define_method from?
<ryez> is it from Module?
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
<ryez> ok, I got it, it's a private instance method in Module
<ryez> >> Module.private_instance_methods(false).grep /def/ => [:method_undefined, :undef_method, :define_method]
jbsan [jbsan!~jbsan@c80-216-213-130.bredband.comhem.se] has joined #ruby-lang
nark-1 [nark-1!~NARKOZ@46.228.177.254] has joined #ruby-lang
JEG2 [JEG2!~JEG2@ip72-198-103-217.ok.ok.cox.net] has joined #ruby-lang
slyphon [slyphon!~weechat@unaffiliated/slyphon] has joined #ruby-lang
<nark-1> how to remove non ascii chars from string?
elux [elux!~peter@96.45.198.150] has joined #ruby-lang
ryez_ [ryez_!3dabf6b3@gateway/web/freenode/ip.61.171.246.179] has joined #ruby-lang
headius [headius!~headius@71-37-230-236.mpls.qwest.net] has joined #ruby-lang
rippa [rippa!~rippa@109-161-66-231.pppoe.yaroslavl.ru] has joined #ruby-lang
outoftime [outoftime!~mat@50.57.10.189] has joined #ruby-lang
<Spooner> ryez_: Object.method(:define_method).owner
wallerdev [wallerdev!~wallerdev@c-68-43-58-191.hsd1.mi.comcast.net] has joined #ruby-lang
<Spooner> Defusal_: You can use /hi (.*)/.match("hi sdf")[1] => "sdf"
<Defusal_> Spooner, not really what i was looking for, but dont worry
<Spooner> Oh, I suppose that doesn't help when pulling out of cases.
<Defusal_> yeah
<Defusal_> I wonder if anyone around has experience with EventMachine and UDP servers
<Defusal_> I cannot work out how to close a datagram socket, which i really need to do
<Defusal_> I'm using EM.open_datagram_socket '0.0.0.0', 27505, RemoteLogger
<bougyman> EM.stop or object.unbind
<Defusal_> I do not want to stop EM bougyman!
<bougyman> if you inherited a Connection, taht is.
<Defusal_> Just that datagram
<imperator> nark-1, s.sub(/[^\x20-\x7e]+/, '') ?
<Defusal_> bougyman, the datagram socket is opened to receive logs when its module is loaded, but now i cannot reload the module to develop it until i can close the datagram, else it can never open again
<Defusal_> if anyone knows how to close an EM datagram sockets port, i'd really appreciate it
<imperator> gsub would be better actually
<Defusal_> Ahh, I think i've got it
kyrylo [kyrylo!~kyrylo@46.118.231.73] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@subtle/user/kyrylo] has joined #ruby-lang
<Defusal_> calling close_connection on the datagram connection instance does work, but it looks like i need to only open it after a delay, since it is not closed by the time the module reloads
tjadc [tjadc!~quassel@41-133-59-28.dsl.mweb.co.za] has joined #ruby-lang
roadkith [roadkith!~kith@unaffiliated/kith] has joined #ruby-lang
dfr|floridia [dfr|floridia!~dfr|work@174.128.210.18] has joined #ruby-lang
macmartine [macmartine!~macmartin@069-064-227-254.pdx.net] has joined #ruby-lang
<bougyman> found it, Defusal_
<bougyman> EM.run { EM.open_datagram_socket '0.0.0.0', 27505, RemoteLog do |r| irb(main):034:2* EM.add_timer(5) { r.close_connection }
<bougyman> works.
<Defusal_> [17:10:42] <Defusal_> calling close_connection on the datagram connection instance does work, but it looks like i need to only open it after a delay, since it is not closed by the time the module reloads
<Defusal_> :)
<Defusal_> i just had to only open it again in EM.next_tick
<bougyman> right
<Defusal_> the module was reloading before the reactor has a tick to close the socket
<bougyman> gotcha
<Defusal_> thanks though :)
RomyRomy [RomyRomy!~stickycak@cpe-69-203-115-155.nyc.res.rr.com] has joined #ruby-lang
imajes [imajes!~imajes@is.imaj.es] has joined #ruby-lang
jensn [jensn!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby-lang
<ryez_> Spooner: great tip, didn't know that, thank you very much
<nark-1> what's the difference between sub and gsub?
<rippa> sub only substitutes on first match
<tobiasvl> nark-1: sub substitutes only the first match, gsub (global sub) substitutes all
<Spooner> ryez_: You can stuff like that even more easily using pry
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby-lang
<Spooner> *can learn stuff
<ryez_> for e.g.? especially regarding this case?
<ryez_> actually I already installed pry, but haven't got much motivation to dig into it
<Spooner> It is very good for delving.
<Spooner> ryez_: e.g. in this case: https://gist.github.com/44a5bdb522dbdb96ba70
<ryez_> and, for :define_method, now I know it's a private instance method, but how to know that via code?
<ryez_> is it possible?
<Spooner> ryez_: What do you mean via code?
bitrot [bitrot!~smd@rrcs-50-84-14-82.sw.biz.rr.com] has joined #ruby-lang
<ryez_> via ruby code
<ryez_> like the way you demo'ed how to find the owner of :define_method
<Spooner> I suppose you'd need to use method(:m).owner and check its public, protected and private methods lists (just remember that in 1.8.7 those are lists of strings, not symbols).
<Spooner> Mmm, no, #receiver, not #owner, since you want to know what the access is on the object, not what the access was on the defining object, if that makes sense.
<ryez_> I'm using 1.9.2
<ryez_> >> Module.private_instance_methods(false).grep /def/ => [:method_undefined, :undef_method, :define_method] >> Module.private_methods(false).grep /def/ => []
<ryez_> >> Module.private_methods().grep /define/ => [:method_undefined, :define_method, :singleton_method_undefined]
<ryez_> why that?
<Spooner> Why what?
tbuehlmann [tbuehlmann!~tobias@unaffiliated/tovias] has joined #ruby-lang
<ryez_> or, why Module.private_methods contains :define_method?
<ryez_> but not Module.private_methods(false)?
<ryez_> sorry, my head is spinning because of this
<ryez_> orz
<ryez_> I guess this is because the ancestor chain is [Module, Object, PP::ObjectMixin, Kernel, BasicObject]
<ryez_> oh, probably we should ignore PP:ObjectMixin
<Spooner> Yep.
<ryez_> but how to explain my question above?
cyri_ [cyri_!~cyri_@232.93.119.80.rev.sfr.net] has joined #ruby-lang
<Spooner> ryez_: I am not sure. You are suggesting that you expect those methods to be in when you specify "false" since they are defined on Module itself?
<ryez_> no, I wonder how Module.private_methods(true) get it
blowmage [blowmage!~blowmage@humanecode.new.xen.prgmr.com] has joined #ruby-lang
<Spooner> ryez_: private_methods(true) gets all methods that it can access and private_methods(false) gets only those it defines itself, so that makes sense, doesn't it?
<Spooner> And the default is "true"
<ryez_> yes, then it means :define_method is also a private_method from one of Module's ancestors, but which ancestor?
<Spooner> But then it is the owner of the method, so I am not entirely sure why it doesn't come up.
<Spooner> Perhaps someone else can explain that :$
<ryez_> I have a guess
<ryez_> maybe this can explain
<ryez_> Module.class => Class
<ryez_> Class.ancestors: => [Class, Module, Object, Win32::Console::Constants, PP::ObjectMixin, Kernel, BasicObject]
nfxgosu [nfxgosu!~nekid@117.193.253.97] has joined #ruby-lang
<ryez_> btw, Win32::Console::Constants looks like the magic done by pry
<ryez_> so, Module, as an object, also as a (special) instance of Class, get :define_method as its private_method
<Spooner> Yes, those and pp are added by pry.
<ryez_> (private_)instance_methods is for Class and similars, (private_)methods is for ordinary object
<ryez_> but in ruby, A Class is also an object, although special, but it does be an object
<ryez_> makes sense?
<Spooner> Only in that I accept that at the bottom end, Ruby breaks its own rules a bit :D
<ryez_> could you please be more specific?
slimfit [slimfit!~slimfit@50-76-131-66-static.hfc.comcastbusiness.net] has joined #ruby-lang
lordofthedance [lordofthedance!~daddycool@wnpgmb0911w-ad03-143-70.dynamic.mtsallstream.net] has joined #ruby-lang
<Spooner> I was meaning specifically the main object, which is a bit classy and a bit objecty and generally floats about being main and not caring.
<Spooner> (I'm sure that could be explained better by someone else).
MistyM [MistyM!~MistyM@50.72.70.192] has joined #ruby-lang
<ryez_> the fact that 'global' methods are actully defined on Object, right?
<Spooner> Yeah, that too.
NARKOZ [NARKOZ!~NARKOZ@46.228.177.254] has joined #ruby-lang
<ryez_> I personally think that's magical but somewhat reasonable :-)
<Spooner> Magic is fine, but I try not to try to explain it.
<ryez_> btw, regarding your gist about pry, very informative, thank you Spooner, I'm now happy to learn more about pry
<Spooner> It is just irb with knobs on, so you can't lose by playing with it a bit.
<ryez_> good to know, thanks
slyphon [slyphon!~weechat@dsl254-099-007.nyc1.dsl.speakeasy.net] has joined #ruby-lang
slyphon [slyphon!~weechat@unaffiliated/slyphon] has joined #ruby-lang
scampbell [scampbell!~scampbell@c-98-224-240-62.hsd1.mi.comcast.net] has joined #ruby-lang
malev_ [malev_!~malev@190.210.138.237] has joined #ruby-lang
<Spooner> I don't use it as much as I probably should. I am trying to get into the habit of debugging via tests rather than inspection, so it is less useful. Still, now and again I use it to great effect.
<ryez_> anyway, tests are more persistent
<Spooner> Yeah, but for finding out about Ruby, I wish I'd had pry years ago!
<ryez_> glad that you brought me into it, :D
<ryez_> ok too late for me, thank you and hopefully ttyl
malev [malev!~malev@190.210.138.237] has joined #ruby-lang
<Spooner> Night.
SteveG [SteveG!~steve@pdpc/supporter/21for7/steveg] has joined #ruby-lang
darkf [darkf!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
wmoxam [wmoxam!~wmoxam@pdpc/supporter/active/wmoxam] has joined #ruby-lang
<injekt> Spooner: there's nothing wrong with debugging via inspection, I've done it for years. I don't think tests are the best method of debugging by any means
<shevy> :)
<bnagy> down with tests
<injekt> rubys p method ftw
<shevy> with some tests
<bnagy> tests test what the developers think might go wrong. The whole of modern security is founded on what actually goes wrong.
<Spooner> injekt: Well, I still end up using p a-plenty, but I know my fix works when my tests pass.
<injekt> Spooner: of course
wallerdev [wallerdev!~wallerdev@c-68-43-58-191.hsd1.mi.comcast.net] has joined #ruby-lang
Fullmoon [Fullmoon!~Fullmoon@dsl-stat-43-17.mmc.at] has joined #ruby-lang
malev_ [malev_!~malev@190.210.138.237] has joined #ruby-lang
malev [malev!~malev@190.210.138.237] has joined #ruby-lang
<ddfreyne> The advantage of printing stuff for debugging is that you can log a whole log to a file and then analyse it afterwards, which is quite impossible when stepping through
<ddfreyne> and you don’t have cases of “crap, what was that value again?”
* bnagy stands on the 'printf debugging ftw' side of the room
vesan [vesan!vesan@maailmanlopun.modeemi.net] has joined #ruby-lang
<ddfreyne> now, if Ruby had a good debugger… :)
* shevy aims with a bazooka at the 'printf debugging ftw' side of the room
<ddfreyne> disclaimer: I have not used pry-debug yet
<shevy> bnagy come over to here! hipster debugging ftw!
<bnagy> debuggers are for girls or people without sourcecode
<Tasser> ddfreyne, the stackexplorer doesn't work that bad.
<bnagy> 'girls' in the figurative sense, obviously
<ddfreyne> girls suck!
<bnagy> figuratively
<bnagy> I'm told
<ddfreyne> except yugui_zzz
<ddfreyne> rock on
gianlucadv [gianlucadv!~gianlucad@109.53.158.230] has joined #ruby-lang
<bnagy> ok night :P
futurechimp [futurechimp!~futurechi@109.239.86.106] has joined #ruby-lang
slimfit [slimfit!~slimfit@50-76-131-66-static.hfc.comcastbusiness.net] has joined #ruby-lang
jason_y [jason_y!a3b5fb67@gateway/web/freenode/ip.163.181.251.103] has joined #ruby-lang
kaiwren [kaiwren!~KaiWren@122.172.7.193] has joined #ruby-lang
amerine [amerine!~mturner@bc171197.bendcable.com] has joined #ruby-lang
uniqanomaly__ [uniqanomaly__!~ua@78.10.49.147] has joined #ruby-lang
savage- [savage-!~savage-@istep.static.monkeybrains.net] has joined #ruby-lang
solars [solars!~solars@mk089144206050.a1.net] has joined #ruby-lang
SuperTaz_work [SuperTaz_work!~supertaz_@38.99.52.59] has joined #ruby-lang
slimfit [slimfit!~slimfit@50-76-131-66-static.hfc.comcastbusiness.net] has joined #ruby-lang
kain_ [kain_!~kain@93-62-245-141.ip25.fastwebnet.it] has joined #ruby-lang
perryh__ [perryh__!~perryh@far3677.urh.uiuc.edu] has joined #ruby-lang
s0ber_ [s0ber_!~s0ber@114-36-224-117.dynamic.hinet.net] has joined #ruby-lang
malev [malev!~malev@74.10.95.2] has joined #ruby-lang
Xzyx987X [Xzyx987X!~Xzyx987X@c-75-72-121-187.hsd1.mn.comcast.net] has joined #ruby-lang
Defusal [Defusal!~DeFi@dsl-241-10-179.telkomadsl.co.za] has joined #ruby-lang
mdmdm_ [mdmdm_!~maestro@50-0-12-246.dsl.dynamic.sonic.net] has joined #ruby-lang
nofxx [nofxx!~nofxx@177.106.32.38] has joined #ruby-lang
bryanl_ [bryanl_!~bryanl@li362-49.members.linode.com] has joined #ruby-lang
mtkd_ [mtkd_!znc@209-20-90-74.slicehost.net] has joined #ruby-lang
xsdg_ [xsdg_!~xsdg@SIPB-VM-99.MIT.EDU] has joined #ruby-lang
JoL1hAHN [JoL1hAHN!~nrk@oh.noes.timeparadox.it] has joined #ruby-lang
blowmage` [blowmage`!~blowmage@humanecode.new.xen.prgmr.com] has joined #ruby-lang
gregf1 [gregf1!~gregf@207.5.168.94] has joined #ruby-lang
Twixmix_ [Twixmix_!~ryanniels@blk-11-127-105.eastlink.ca] has joined #ruby-lang
perryh__ [perryh__!~perryh@unaffiliated/perry753] has joined #ruby-lang
Defusal [Defusal!~DeFi@unaffiliated/ecnerifed] has joined #ruby-lang
nofxx [nofxx!~nofxx@unaffiliated/nofxx] has joined #ruby-lang
znz_jp0 [znz_jp0!~znz@ns5.n-z.jp] has joined #ruby-lang
JoL1hAHN [JoL1hAHN!~nrk@unaffiliated/jol1hahn] has joined #ruby-lang
mahlon_ [mahlon_!mahlon@martini.nu] has joined #ruby-lang
SteveG [SteveG!~steve@moat.stevegibson.com] has joined #ruby-lang
kaiwren [kaiwren!~KaiWren@122.172.7.193] has joined #ruby-lang
dbussink [dbussink!~dbussink@ec2-46-137-118-125.eu-west-1.compute.amazonaws.com] has joined #ruby-lang
SteveG [SteveG!~steve@pdpc/supporter/21for7/steveg] has joined #ruby-lang
indeterminate [indeterminate!~sei@user-3c2h3m6.cable.mindspring.com] has joined #ruby-lang
shachaf [shachaf!~shachaf@li227-219.members.linode.com] has joined #ruby-lang
vereteran-x [vereteran-x!~vereteran@static.88-198-170-117.clients.your-server.de] has joined #ruby-lang
zzak [zzak!~zzak@ec2-107-20-68-16.compute-1.amazonaws.com] has joined #ruby-lang
EvilJStoker [EvilJStoker!jstoker@unaffiliated/jstoker] has joined #ruby-lang
tekin [tekin!~tekin@cpc8-with5-2-0-cust208.1-4.cable.virginmedia.com] has joined #ruby-lang
CodeBlock [CodeBlock!~CodeBlock@ec2-107-22-199-66.compute-1.amazonaws.com] has joined #ruby-lang
alindeman [alindeman!~adml@freenode/senior-staff-emeritus/alindeman] has joined #ruby-lang
Sailias [Sailias!~jonathan@s72-38-77-178.static.comm.cgocable.net] has joined #ruby-lang
cesario [cesario!u2444@gateway/web/irccloud.com/x-zrvmqsnndzwvqvgw] has joined #ruby-lang
yibe [yibe!~yibe@163.43.161.140] has joined #ruby-lang
ramonmaruko [ramonmaruko!~marco@122.52.126.66] has joined #ruby-lang
sora_h [sora_h!~sora_h@sorah.jp] has joined #ruby-lang
CodeBlock [CodeBlock!~CodeBlock@ec2-107-22-199-66.compute-1.amazonaws.com] has joined #ruby-lang
burgestrand [burgestrand!~burgestra@h-45-63.a155.priv.bahnhof.se] has joined #ruby-lang
Twixmix [Twixmix!~ryanniels@blk-11-127-105.eastlink.ca] has joined #ruby-lang
andrewhl [andrewhl!~andrew@24-246-14-26.cable.teksavvy.com] has joined #ruby-lang
srbaker [srbaker!~srbaker@64.180.199.227] has joined #ruby-lang
niklasb [niklasb!~codeslay0@p5B310A4E.dip0.t-ipconnect.de] has joined #ruby-lang
rindolf [rindolf!~shlomif@bzq-79-177-18-149.red.bezeqint.net] has joined #ruby-lang
slimfit [slimfit!~slimfit@50-76-131-66-static.hfc.comcastbusiness.net] has joined #ruby-lang
roha [roha!~phelot@84-75-49-50.dclient.hispeed.ch] has joined #ruby-lang
Twixmix [Twixmix!~ryanniels@blk-11-127-105.eastlink.ca] has joined #ruby-lang
wallerdev [wallerdev!~wallerdev@72.44.102.30] has joined #ruby-lang
butchanton [butchanton!~butchanto@64.134.221.138] has joined #ruby-lang
roha [roha!~phelot@84-75-49-50.dclient.hispeed.ch] has joined #ruby-lang
lsegal [lsegal!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
<rindolf> Hi all! How do I extract all matching $1 and $2 from a regular expression match in a string in Ruby? Similar to Perl 5's my @arr = ($str =~ m/(...) (...)/g) .
Heimidal [Heimidal!~heimidal@c-67-165-197-126.hsd1.co.comcast.net] has joined #ruby-lang
amerine [amerine!~mturner@67.204.184.82] has joined #ruby-lang
Stalkr_ [Stalkr_!~Stalkr@x1-6-e0-46-9a-1f-97-a2.k617.webspeed.dk] has joined #ruby-lang
omegapunkt [omegapunkt!~textual@60.234.20.206] has joined #ruby-lang
<erikh> they're just $1 and $2
benanne [benanne!~rijdier@ip-213-49-105-166.dsl.scarlet.be] has joined #ruby-lang
<rindolf> erikh: but I want all matches.
<rindolf> erikh: /g mean global.
<rindolf> erikh: would $1 and $2 be arrays?
<wallerdev> use String#scan
<rindolf> wallerdev: thanks.
<MistyM> You can also use the #captures method on a MatchData object.
mrsolo [mrsolo!~mrsolo@64.125.181.73] has joined #ruby-lang
tjadc [tjadc!~quassel@dsl-241-10-179.telkomadsl.co.za] has joined #ruby-lang
* shevy captures MistyM
<lianj> capture-the-match gamemode
Z2FyZA [Z2FyZA!~gard@cm-84.215.22.0.getinternet.no] has joined #ruby-lang
daglees [daglees!~belvedere@91.186.226.125] has joined #ruby-lang
daglees [daglees!~belvedere@unaffiliated/daglees] has joined #ruby-lang
dreinull [dreinull!dreieins@217.18.70.225] has joined #ruby-lang
cyri_ [cyri_!~cyri_@232.93.119.80.rev.sfr.net] has joined #ruby-lang
dreinull [dreinull!~dreieins@217.18.70.225] has joined #ruby-lang
Asher [Asher!~asher@res-105001.nat.emory.edu] has joined #ruby-lang
Asher [Asher!~asher@res-105002.nat.emory.edu] has joined #ruby-lang
slyphon [slyphon!~weechat@unaffiliated/slyphon] has joined #ruby-lang
<rindolf> Thanks all! I've written this script - http://paste.debian.net/154200/ that generated this report - http://paste.debian.net/154199/
twittard [twittard!~twittard@wc.lax.truecarcorp.com] has joined #ruby-lang
pigdude [pigdude!~tallen@li61-243.members.linode.com] has quit [#ruby-lang]
Carnage\ [Carnage\!~carnage@84-75-163-211.dclient.hispeed.ch] has joined #ruby-lang
<rindolf> OK, another question - how do I uppercase the first letter of a string? Like ucfirst() in Perl.
<drbrain> upcase
<rindolf> drbrain: I want only the first letter - not the whole string.
<drbrain> oh right, capitalize
<erikh> that's AS though, right?
<rindolf> erikh: what?
qpingu [qpingu!~Adium@67.218.117.238] has joined #ruby-lang
<rindolf> drbrain: well, I don't think ucfirst affects the other letters (be them uppercase or lowercase) but .capitalize is OK here.
<drbrain> erikh: no, capitalize is on String
<drbrain> what do you mean by "affects the other letters"?
<rindolf> drbrain: it lowercases them.
<rindolf> drbrain: if they are uppercase.
<rindolf> In the return value I mean.
<drbrain> ah, I see
<drbrain> so in perl ucfirst("fOo") # => "FOo"
<erikh> correct
<erikh> (I'm helping!)
<drbrain> oh look, I confirmed myself! perl -e 'print ucfirst("fOo")'
<drbrain> rindolf: the equivalent to ucfirst would be sub(/\A[a-z]/) { $&.upcase }
qpingu [qpingu!~Adium@67.218.117.238] has joined #ruby-lang
mikeric [mikeric!~mike@S0106c03f0e8b23f3.vc.shawcable.net] has joined #ruby-lang
<rindolf> drbrain: I see. Thanks.
tenderlove [tenderlove!~tenderlov@pdpc/supporter/active/tenderlove] has joined #ruby-lang
<shevy> menu.rb:15: warning: duplicated when clause is ignored
<shevy> is there any way to find out which clause is duplicated precisely?
<drbrain> shevy: the one on line 15?
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
qpingu1 [qpingu1!~Adium@67.218.117.238] has joined #ruby-lang
uniqanomaly_ [uniqanomaly_!~ua@dynamic-78-8-93-134.ssp.dialog.net.pl] has joined #ruby-lang
* zzak /join #perl-lang
headius [headius!~headius@70-89-202-123-invergrove-mn.hfc.comcastbusiness.net] has joined #ruby-lang
Axsuul [Axsuul!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby-lang
andrewhl [andrewhl!~andrew@24-246-14-26.cable.teksavvy.com] has quit [#ruby-lang]
<shevy> drbrain hmm they seem to be repeated, I get that same warning about repeated 20 times
andrewhl [andrewhl!~andrew@24-246-14-26.cable.teksavvy.com] has joined #ruby-lang
postmodern [postmodern!~postmoder@c-71-237-178-98.hsd1.or.comcast.net] has joined #ruby-lang
Asher [Asher!~asher@98.158.127.150] has joined #ruby-lang
<rue> erikh: I've still not had time to look at it, sorry. This move is sapping my will to live
<rue> Well, not the move so much as all this IKEA crap
<erikh> rue: oh dude
<erikh> don't rush
<erikh> besides, raggi gave me a ton of feedback and I will be rewriting some of it.
cyri_ [cyri_!~cyri_@jem75-1-87-88-118-80.dsl.sta.abo.bbox.fr] has joined #ruby-lang
<shevy> IKEA is the swedish way to confuse the poor finns
<yxhuvud> ah, we are finally found out
lightcap [lightcap!~lightcap@184-100-173-167.ptld.qwest.net] has joined #ruby-lang
skiz [skiz!~skiz@216-75-227-188.static.wiline.com] has joined #ruby-lang
mikeric [mikeric!~mike@96.53.33.22] has joined #ruby-lang
jamw [jamw!~j@cpc11-orpi3-2-0-cust53.2-3.cable.virginmedia.com] has joined #ruby-lang
skiz [skiz!~skiz@216-75-227-188.static.wiline.com] has joined #ruby-lang
<rue> Actually, it's not even that. The root cause is that I can't find my socks
qpingu [qpingu!~Adium@67.218.117.238] has joined #ruby-lang
curtism [curtism!~curtis@bas11-montreal02-1128531121.dsl.bell.ca] has joined #ruby-lang
<erikh> RCA on cold feet
jstemmer [jstemmer!~cheetah@mrpwn.stemmertech.com] has joined #ruby-lang
looopy_ [looopy_!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
dejongge [dejongge!~jonke@pD9E0DFE1.dip0.t-ipconnect.de] has joined #ruby-lang
tekin [tekin!~tekin@cpc8-with5-2-0-cust208.1-4.cable.virginmedia.com] has joined #ruby-lang
xsdg [xsdg!~xsdg@SIPB-VM-99.MIT.EDU] has joined #ruby-lang
robbyoconnor [robbyoconnor!~wakawaka@guifications/user/r0bby] has joined #ruby-lang
CodeBlock [CodeBlock!~CodeBlock@fedora/CodeBlock] has joined #ruby-lang
shachaf_ [shachaf_!~shachaf@li227-219.members.linode.com] has joined #ruby-lang
jmontross [jmontross!~Adium@static-96-236-65-137.snfcca.dsl-w.verizon.net] has joined #ruby-lang
Jake232 [Jake232!~textual@5e0e46cc.bb.sky.com] has joined #ruby-lang
hagabaka [hagabaka!~quassel@cblmdm24-53-178-92.buckeyecom.net] has joined #ruby-lang
hagabaka [hagabaka!~quassel@unaffiliated/hagabaka] has joined #ruby-lang
ppl [ppl!~ppl@222.236.30.217] has joined #ruby-lang
qpingu [qpingu!~Adium@67.218.117.238] has joined #ruby-lang
Fretta [Fretta!~Fretta@ip184-187-186-58.sb.sd.cox.net] has joined #ruby-lang
fritzek [fritzek!~fritzek@p5DDB62EC.dip.t-dialin.net] has joined #ruby-lang
deryldou1ette [deryldou1ette!~Deryl@216.183.139.175] has joined #ruby-lang
lsegal [lsegal!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
AlHafoudh [AlHafoudh!~textual@dsl-static-173.212-5-200.telecom.sk] has joined #ruby-lang
tenderlove [tenderlove!~tenderlov@pdpc/supporter/active/tenderlove] has joined #ruby-lang
tenderlo_ [tenderlo_!~tenderlov@pdpc/supporter/active/tenderlove] has joined #ruby-lang
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
ryannielson [ryannielson!~ryanniels@blk-11-127-105.eastlink.ca] has quit [#ruby-lang]
slimfit [slimfit!~slimfit@50-76-131-66-static.hfc.comcastbusiness.net] has joined #ruby-lang
SkramX [SkramX!~SkramX@128.164.23.206] has joined #ruby-lang
S1kx [S1kx!~S1kx@ip-95-223-80-198.unitymediagroup.de] has joined #ruby-lang
S1kx [S1kx!~S1kx@pdpc/supporter/monthlybyte/s1kx] has joined #ruby-lang
laurion [laurion!5679120e@gateway/web/freenode/ip.86.121.18.14] has joined #ruby-lang
<laurion> pastie: hi
<erikh> pastie isn't home
<erikh> she's out on the town
mark- [mark-!~SkramX@128.164.23.206] has joined #ruby-lang
<laurion> didn't pastie.org have a log in thing?
<erikh> it's been a long time since that bot lived here
<laurion> now I don't seem to find any way of logging in
Pip__ [Pip__!~Pip@188.134.48.13] has joined #ruby-lang
DMKE [DMKE!~DMKE@g230212096.adsl.alicedsl.de] has joined #ruby-lang
DMKE [DMKE!~DMKE@pdpc/supporter/student/dmke] has joined #ruby-lang
dfr|floridia [dfr|floridia!~dfr|work@174.128.210.18] has joined #ruby-lang
S2kx [S2kx!~S1kx@ip-95-223-80-198.unitymediagroup.de] has joined #ruby-lang
qpingu [qpingu!~Adium@67.218.117.238] has joined #ruby-lang
qpingu [qpingu!~Adium@67.218.117.238] has quit [#ruby-lang]
twittard_ [twittard_!~twittard@wc.lax.truecarcorp.com] has joined #ruby-lang
Carnage\ [Carnage\!~carnage@84-75-163-211.dclient.hispeed.ch] has joined #ruby-lang
<lake> /join #archlinux
<rue> Nooo
jamescotterill [jamescotterill!~james@94-192-130-249.zone6.bethere.co.uk] has joined #ruby-lang
h4y4shi [h4y4shi!~chatzilla@rrcs-67-79-54-130.sw.biz.rr.com] has joined #ruby-lang
<jmontross> easy way to do a .gsub with an array to fill in the values of each item found?
<jmontross> first i do a .scan and transform each item
<jmontross> then i've got an array of what i want to jam back in
<rue> Which each items are you talking about?
<rue> You have an Array of Strings, which you want to mutate?
<jmontross> yes. i have a body of text that contains some hyperlinks i want to mutate
<jmontross> so i scan the text looking for hyperlinks of certain pattern
<jmontross> then i mutate them
<jmontross> and now i have this array of hyperlinks i mutated.
<rue> How did you end up with an Array?
<rue> There's a step missing her
<rue> e
<rue> string.gsub pattern, substitution
<rue> Or #sub, if you prefer
<jmontross> string.gsub (pattern, substitution) is simple enough, but the substitution is really tricky and involves a bit of processing of the result of the regex on the pattern
<rue> There's a few ways you could go about it. One is to first scan for anything looking like a link, and then sub that using more specific patterns
<hagabaka> gsub can take a block
slimfit [slimfit!~slimfit@50-76-131-66-static.hfc.comcastbusiness.net] has joined #ruby-lang
dr_bob [dr_bob!~dr_bob@p5DC4E713.dip.t-dialin.net] has joined #ruby-lang
<drbrain> jmontross: URI.extract
<wallerdev> nokogiri :D
<erikh> asdf
<erikh> talk about hammers and nail
<erikh> s
<erikh> it's someone's wrong on the internet time with erikh
<rue> Em, yes, if HTML/XML links, that's one thing…
srbartlett [srbartlett!~srbartlet@202.146.7.239] has joined #ruby-lang
mantono [mantono!~mantono@c83-251-126-234.bredband.comhem.se] has joined #ruby-lang
<erikh> even so, you still have to get the right attrs
<erikh> and javascript
qpingu [qpingu!~Adium@67.218.117.238] has joined #ruby-lang
headius [headius!~headius@71-37-230-236.mpls.qwest.net] has joined #ruby-lang
AlHafoudh [AlHafoudh!~textual@dsl-static-173.212-5-200.telecom.sk] has joined #ruby-lang
S1kx [S1kx!~S1kx@pdpc/supporter/monthlybyte/s1kx] has joined #ruby-lang
ggzach [ggzach!~ggzach@147.9.88.15] has joined #ruby-lang
<rue> If it's not just a bunch of URLs. He wasn't quite clear
ggzach [ggzach!~ggzach@147.9.88.15] has quit [#ruby-lang]
tekin [tekin!~tekin@cpc8-with5-2-0-cust208.1-4.cable.virginmedia.com] has joined #ruby-lang
<erikh> I guess what I'm saying is even if it's html it might be wiser to use uri.extract
<erikh> anyhow -- wrong on the internet time is over, I have shit to do
gregf [gregf!~gregf@207.5.168.94] has joined #ruby-lang
<jmontross> hagabaka: gsub can take a block… thanks
gregf [gregf!~gregf@207.5.168.94] has joined #ruby-lang
motb [motb!~motb@147.9.88.15] has joined #ruby-lang
motb [motb!~motb@147.9.88.15] has quit [#ruby-lang]
<jmontross> what block to pass it is more interesting…
mortice [mortice!~Tom@li300-55.members.linode.com] has joined #ruby-lang
bobbywilson0 [bobbywilson0!~bobbyw@c-67-190-166-159.hsd1.co.comcast.net] has joined #ruby-lang
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
motb [motb!~mutinyont@147.9.64.15] has joined #ruby-lang
motb [motb!~mutinyont@147.9.64.15] has quit [#ruby-lang]
mutinyonthebay [mutinyonthebay!~mutinyont@147.9.64.15] has joined #ruby-lang
mutinyonthebay [mutinyonthebay!~mutinyont@147.9.64.15] has quit [#ruby-lang]
mutinyonthebay [mutinyonthebay!~mutinyont@147.9.64.15] has joined #ruby-lang
mutinyonthebay [mutinyonthebay!~mutinyont@147.9.64.15] has quit [#ruby-lang]
<levifig> back
WillMarshall [WillMarshall!~willmarsh@203.48.101.90] has joined #ruby-lang
<rue> Good to hear
lordofthedance [lordofthedance!~daddycool@wnpgmb0911w-ad03-143-70.dynamic.mtsallstream.net] has joined #ruby-lang
probst [probst!~probst@guest.st-edmunds.cam.ac.uk] has joined #ruby-lang
stephenp [stephenp!~stephenp@gatepost.hos.net] has joined #ruby-lang
<stephenp> in 1.8.7 is there a way to get each_line to honor escaped new lines?
roha [roha!~phelot@84-75-49-50.dclient.hispeed.ch] has joined #ruby-lang
meise [meise!~dm@3st.be] has joined #ruby-lang
<erikh> eh? can you post some code that exhibits your issue?
<rue> Well, it's not a newline if it's escaped…
<erikh> oh, I misread that.
<erikh> ah
<erikh> ok, so you still have newlines in there
<erikh> what I'd do is File.read('myfile') and parse out \\n
<erikh> err, \\\n
<erikh> so something like File.read('myfile').gsub(/\\\n/, ' ')
<stephenp> okay then.
<stephenp> hopes dashed.
<erikh> each_line isn't magical, it's basically IO.readline wrapped over an each/block pattern
stamina [stamina!~stamina@ip5452a9bc.speed.planet.nl] has joined #ruby-lang
Phrogz [Phrogz!~phrogz@pdpc/supporter/professional/phrogz] has joined #ruby-lang
dfr|floridia [dfr|floridia!~dfr|work@174.128.210.18] has joined #ruby-lang
<drbrain> each_line(/[^\\]$/) { |l| p l } # => TypeError ☹
slimfit [slimfit!~slimfit@50-76-131-66-static.hfc.comcastbusiness.net] has joined #ruby-lang
ltd-- [ltd--!~z@zx.io] has joined #ruby-lang
rpowell [rpowell!~rpowell@58.165.133.33] has joined #ruby-lang
Phrogz [Phrogz!~phrogz@184-96-128-49.hlrn.qwest.net] has joined #ruby-lang
Phrogz [Phrogz!~phrogz@pdpc/supporter/professional/phrogz] has joined #ruby-lang
dfr|flor_ [dfr|flor_!~dfr|work@174.128.210.18] has joined #ruby-lang
twittard [twittard!~twittard@wc.lax.truecarcorp.com] has joined #ruby-lang
Heimidal [Heimidal!~heimidal@factory-smtp.factorylabs.com] has joined #ruby-lang
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
abentspoon [abentspoon!~micah@173.247.201.130] has joined #ruby-lang
Spooner [Spooner!~Miranda@host-78-144-139-130.as13285.net] has joined #ruby-lang
Sailias [Sailias!~jonathan@CPE0018f85e576d-CM001bd7aaaf96.cpe.net.cable.rogers.com] has joined #ruby-lang
dfr|floridia [dfr|floridia!~dfr|work@174.128.210.18] has joined #ruby-lang
amerine [amerine!~mturner@67.204.184.82] has joined #ruby-lang
hagabaka [hagabaka!~quassel@cblmdm24-53-178-92.buckeyecom.net] has joined #ruby-lang
hagabaka [hagabaka!~quassel@unaffiliated/hagabaka] has joined #ruby-lang
daglees [daglees!~belvedere@unaffiliated/daglees] has joined #ruby-lang
<MistyM> Hm, running into a threading problem.
<erikh> knit instead
<erikh> sewing machines are so overrated
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
<MistyM> knit one ruby two
<erikh> ha
<MistyM> https://gist.github.com/76900f8e7b9f7e1592ee (a few things here are kinda messy, transitioning stuff)
<MistyM> So this is an object-oriented wrapper around C libraries for chiptunes with a plugin system. Prealpha has two plugins, skeleton of the external interface, and a sample player.
<erikh> what exactly are you hitting/
<MistyM> I was adding a buffer so that a background thread could run ahead and generate past the current playing point; the buffer reader accessor is meant to read out of that buffer one sample at a time and increment its position.
<MistyM> Problem: apparently the background thread isn't being called at least once before the foreground thread hits the part where it tries to read from the buffer, so it gets an empty string and barfs.
publicvoid [publicvoid!~publicvoi@p4FCAFAD7.dip.t-dialin.net] has joined #ruby-lang
Sailias [Sailias!~jonathan@CPE0018f85e576d-CM001bd7aaaf96.cpe.net.cable.rogers.com] has joined #ruby-lang
S2kx [S2kx!~S1kx@ip-95-223-80-198.unitymediagroup.de] has joined #ruby-lang
<drbrain> are you using a Queue ?
<MistyM> No. I'm actually not familiar with Ruby queues. To ri!
<MistyM> Thanks!
<drbrain> with a Queue, the consumer will block until the producer has an item for you
<MistyM> Awesome - that's exactly what I need then.
SuperTaz_work [SuperTaz_work!~supertaz_@38.99.52.59] has joined #ruby-lang
<erikh> err, isn't that unless something like select gets in the way and makes the consumer thread sleep before it hits the queue?
<erikh> I'm new to this stuff, it's mainly for my own edification
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
<drbrain> adding an item to the queue signals threads blocked on read
macmartine [macmartine!~macmartin@069-064-227-254.pdx.net] has joined #ruby-lang
<drbrain> using a condition variable
<erikh> I think I saw this in thread.rb a while back
<erikh> I will review this weekend. thanks!
<erikh> raggi gave me a ton of reading to do about the actor model as well