lordofthedance [lordofthedance!~daddycool@wnpgmb0911w-ad03-151-226.dynamic.mtsallstream.net] has joined #ruby-lang
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
robotmay [robotmay!~robotmay@5ad8f1da.bb.sky.com] has joined #ruby-lang
vesan__ [vesan__!vesan@maailmanlopun.modeemi.net] has joined #ruby-lang
cola_zero [cola_zero!~cola_zero@www5054u.sakura.ne.jp] has joined #ruby-lang
vereteran [vereteran!~vereteran@static.88-198-170-117.clients.your-server.de] has joined #ruby-lang
curtism [curtism!~curtis@bas11-montreal02-1128531121.dsl.bell.ca] has joined #ruby-lang
foca_ [foca_!~foca@li25-211.members.linode.com] has joined #ruby-lang
cola_zero [cola_zero!~cola_zero@www5054u.sakura.ne.jp] has joined #ruby-lang
lele|w [lele|w!~Lele@2a01:2d8:0:cafe:218:f3ff:fece:a48] has joined #ruby-lang
Stereokitsune [Stereokitsune!~mayoi@nessa.yuuzukiyo.net] has joined #ruby-lang
blowmage [blowmage!~blowmage@humanecode.new.xen.prgmr.com] has joined #ruby-lang
DefV [DefV!~Jan@node-hahmcop4no4a1ruk1w.ipv6.as30961.net] has joined #ruby-lang
Stereoki1sune [Stereoki1sune!~mayoi@nessa.yuuzukiyo.net] has joined #ruby-lang
robotmay [robotmay!~robotmay@5ad8f1da.bb.sky.com] has joined #ruby-lang
DefV [DefV!~Jan@node-hahmcop4no4a1ruk1w.ipv6.as30961.net] has joined #ruby-lang
cyri__ [cyri__!~cyri_@jem75-1-87-88-118-80.dsl.sta.abo.bbox.fr] has joined #ruby-lang
takaokouji [takaokouji!~takaokouj@2001:268:306:1:225:bcff:fedc:e1fe] has joined #ruby-lang
rpowell [rpowell!~rpowell@CPE-121-216-141-190.lnse2.ken.bigpond.net.au] has joined #ruby-lang
rpowell [rpowell!~rpowell@CPE-121-216-141-190.lnse2.ken.bigpond.net.au] has joined #ruby-lang
looopy_ [looopy_!~looopy@pool-141-156-50-197.washdc.btas.verizon.net] has joined #ruby-lang
looopy__ [looopy__!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
Sailias [Sailias!~jonathan@CPE0018f85e576d-CM001bd7aaaf96.cpe.net.cable.rogers.com] has joined #ruby-lang
jjmgbt [jjmgbt!~chatzilla@c-71-61-59-172.hsd1.pa.comcast.net] has joined #ruby-lang
DRCALKIN [DRCALKIN!~DROOL_AND@cpe-66-69-208-144.austin.res.rr.com] has joined #ruby-lang
<jjmgbt>
If someone can help, please do :) I'm trying to have a variable be executed as a block to be passed to a method, from which it will call a local variable. No idea what syntax to use. http://pastie.org/3240547
<jjmgbt>
(that code doesn't work -- was just trying stuff and figured that was the best example to share)
<rue>
#method is an existing method name, you probably want something else
<rue>
Other than that, it won't work because a block closes over its own scope, not the method in which it's run
<jjmgbt>
ah
<jjmgbt>
Ok, thank you
<rue>
And, furthermore, the interpolation isn't even in the method
<rue>
The short answer would be that you shouldn't be doing this, ever. Local vars are that. Pass them into the block if needed
<rue>
The longer answer is that there *is* a way, but see above.
<jjmgbt>
Fair enough. Just learning and playing.
<jjmgbt>
Although, curiosity makes me want to know *how* it could be done
alindeman_ [alindeman_!~adml@freenode/senior-staff-emeritus/alindeman] has joined #ruby-lang
drdr [drdr!d059b08f@gateway/web/freenode/ip.208.89.176.143] has joined #ruby-lang
codelol [codelol!u3386@gateway/web/irccloud.com/x-bcaxainkadjgtwuy] has joined #ruby-lang
<vereteran>
are there any gems able to parse video headers to give me duration and resolution?
<flowerpot>
you want ffmpeg
<flowerpot>
It's unrelated to ruby though
<flowerpot>
get ffmpeg and use ffprobe to get that information.
<vereteran>
flowerpot, i don't want ffmpeg. i'm getting only 200 kb via http and i want to identify content and data above
<drdr>
verrteran you could write your own
<drdr>
its not like video specs are drenched in mystery and locked away in castles
<flowerpot>
I see
<vereteran>
drdr, i need at least 3 formats: flv, f4v, x264. thats a lot of time
<flowerpot>
vereteran, are you sure you can't just grab the first 200 kb and sick ffprobe on it?
* drbrain
votes for not reinventing the wheel and using ffmpeg
<flowerpot>
dunno if it works with truncated files, b ut you might as well try first
<vereteran>
flowerpot, ffmpeg is a really big dependency and i'm not sure i'll be able to install it on my budget vds
<vereteran>
flowerpot, it'll work with truncated file
<flowerpot>
I see, you want to avoid the extra baggage
WillMarshall [WillMarshall!~willmarsh@121-73-153-79.cable.telstraclear.net] has joined #ruby-lang
<rue>
imperator: The point is it doesn't tell you. Of course it's a bit awkward if you have to chase it down, but doesn't the typedef support cover that?
<Asher>
aren't basically all of the _______t types uints?
<rue>
The _t stands for type, pretty much, so not always.
<Asher>
no i got that
<Asher>
but most of the ones that posix uses
<Asher>
are all for positive int units
<rue>
Mm, most should
<imperator>
rue, typedef support?
<rue>
Hm, I'm thinking rbx.
<rue>
There are a couple libs for parsing headers, though
<bnagy>
are any of them good? I did it all manually, last ffi thing
rpowell [rpowell!~rpowell@CPE-121-216-141-190.lnse2.ken.bigpond.net.au] has joined #ruby-lang
<lianj>
good for bootstrap
<lianj>
i like manually aswell, can often can ignore lots of stuff. but sucks if upstream headers change and you have to find the changes by hand then. happend to me with last ffmpeg update :/
rippa [rippa!~splitta@85.158.54.234] has joined #ruby-lang
rhizmoe [rhizmoe!~eric@slider.synthesizer.org] has joined #ruby-lang
<epitron>
is there a good ruby library for making a streaming HTTP proxy?
<rhizmoe>
what does Hash#compare_by_identity do, or what's it for?
<epitron>
rhizmoe: identity is like the ID number of an object, as opposed to the content
<epitron>
so two strings could be equal, but have different id
<rhizmoe>
that doesn't sound like what's in the docs
<epitron>
haah
<epitron>
well, i don't actually know that method ^_^
<epitron>
i'm just guessing
<epitron>
sorry
<epitron>
ah yes, that is accurate
<epitron>
except it applies to the keys
<imperator>
holy cow getlastlogx is slow with ffi, i must be doing something horribly wrong here
<epitron>
so instead of comparing the keys with ==, it compares using object id's
<rhizmoe>
ok. thanks, i think.
<epitron>
doesn't make sense?
<Asher>
epitron - what do you want from a streaming HTTP proxy?
<epitron>
Asher: fun times :D
<epitron>
mostly low latency though
Banistergalaxy [Banistergalaxy!~AndChat@222.153.223.46] has joined #ruby-lang
<epitron>
proxies that download the entire request are noticably slow
wallerdev [wallerdev!~wallerdev@72.44.102.30] has joined #ruby-lang
<epitron>
also, you can't stream mp3's
<epitron>
or videos
<Asher>
meaning a proxy that sits in the middle and relays everything?
<epitron>
most things ^_^
<epitron>
yeah, this will be on the local machine
<Asher>
interesting...
<Asher>
i don't know of any library targeted toward that sort of thing… i imagine it will require a lot of packet reading and processing
<bnagy>
EM must have a thing for it
<epitron>
well, eventmachine is the .. yeah :)
<epitron>
i think i tried before with em-http-client though, and there was some problem
<epitron>
s/client/request/
<bnagy>
maybe go one layer down and see if there's a streaming TCP proxy
<epitron>
hmm
<epitron>
well, my ultimate goal is to modify the requests
<epitron>
but i could use that as a foundation
corsican [corsican!corsican@50-79-33-41-static.hfc.comcastbusiness.net] has joined #ruby-lang
macmartine [macmartine!~macmartin@c-24-21-112-60.hsd1.or.comcast.net] has joined #ruby-lang
<Asher>
if you want to modify the requests you have to be at a packet level, no?
<epitron>
i can send back any request i want :)
<epitron>
s/request/response/
<epitron>
it's a proxy, right?
<bnagy>
did you already look at Burp?
<bnagy>
not in ruby, but kind of the gold standard for that kind of thing
<epitron>
oh yeah, burp!
<bnagy>
I think someone wrote Buby, but it might be terrible
havenn [havenn!~skipper@pool-108-0-191-60.lsanca.fios.verizon.net] has joined #ruby-lang
<epitron>
this is probably pretty heavyweight
<epitron>
java + jruby alone is a lot of code
igotnolegs [igotnolegs!~igotnoleg@75-162-83-166.slkc.qwest.net] has joined #ruby-lang
WillMarshall [WillMarshall!~willmarsh@121-73-153-79.cable.telstraclear.net] has joined #ruby-lang
macmartine [macmartine!~macmartin@c-24-21-112-60.hsd1.or.comcast.net] has joined #ruby-lang
gianlucadv [gianlucadv!~gianlucad@host78-84-dynamic.44-79-r.retail.telecomitalia.it] has joined #ruby-lang
kitallis [kitallis!~kitallis@122.172.247.109] has joined #ruby-lang
mikeric [mikeric!~mike@S0106c03f0e8b23f3.vc.shawcable.net] has joined #ruby-lang
cldwalker [cldwalker!u2984@gateway/web/irccloud.com/x-jcpvvatjrkxjdqxl] has joined #ruby-lang
soahccc [soahccc!chaos@d2-1.debian-02.ppps.hosts.project-production.de] has joined #ruby-lang
mrchrisadams [mrchrisadams!u1367@gateway/web/irccloud.com/x-hopptoctpucqgcpt] has joined #ruby-lang
mccraig [mccraig!u574@gateway/web/irccloud.com/x-gpzzlwtbrytfitzk] has joined #ruby-lang
denysonique_ [denysonique_!u484@gateway/web/irccloud.com/x-grnaelbawrbxsots] has joined #ruby-lang
abuiles [abuiles!u1641@gateway/web/irccloud.com/x-socujmkunorudgnl] has joined #ruby-lang
newbold [newbold!u5179@gateway/web/irccloud.com/x-zdbpetkriiiwekoa] has joined #ruby-lang
savage- [savage-!~savage-@c-67-180-11-89.hsd1.ca.comcast.net] has joined #ruby-lang
dross [dross!~dross@unaffiliated/dross] has joined #ruby-lang
dross [dross!~dross@unaffiliated/dross] has quit [#ruby-lang]
vladalive [vladalive!~vladalive@176.52.59.4] has joined #ruby-lang
dkannan [dkannan!u480@gateway/web/irccloud.com/x-mznofavdhpluxhyc] has joined #ruby-lang
Rich_Morin [Rich_Morin!~rdm@cfcl.com] has quit [#ruby-lang]
jwollert [jwollert!~jwollert@rkh.im] has joined #ruby-lang
agib [agib!u781@gateway/web/irccloud.com/x-veibsqpupuzyznyy] has joined #ruby-lang
heftig [heftig!jan@archlinux/developer/heftig] has joined #ruby-lang
dr0id [dr0id!~andy@unaffiliated/dr0id] has joined #ruby-lang
Gekz_ [Gekz_!~gekz@unaffiliated/gekz] has joined #ruby-lang
<postmodern>
ruby 1.8 question, is there an equivalent to GC.stat?
<postmodern>
im guessing no
cyri__ [cyri__!~cyri_@jem75-1-87-88-118-80.dsl.sta.abo.bbox.fr] has joined #ruby-lang
mikeric [mikeric!~mike@S0106c03f0e8b23f3.vc.shawcable.net] has joined #ruby-lang
<rue>
postmodern: Don't believe so, on MRI
<postmodern>
rue, thought so
ryanf [ryanf!~ryanf@235.sub-174-253-242.myvzw.com] has joined #ruby-lang
<rue>
Ha, building docs for 1.8.7 brought CPU temp to nearly 100
mtkd [mtkd!znc@209-20-90-74.slicehost.net] has joined #ruby-lang
dfr|mac [dfr|mac!~dfr|work@ool-18baf7e7.dyn.optonline.net] has joined #ruby-lang
Locke23rus [Locke23rus!~quassel@128-70-125-206.broadband.corbina.ru] has joined #ruby-lang
srbartlett [srbartlett!~srbartlet@202.146.7.239] has joined #ruby-lang
csherin [csherin!~csherin@115.111.177.122] has joined #ruby-lang
yxhuvud [yxhuvud!mongo@h-5-47.a212.priv.bahnhof.se] has joined #ruby-lang
burgestrand [burgestrand!~burgestra@h-45-63.a155.priv.bahnhof.se] has joined #ruby-lang
<raggi>
rue: lol :)
michael_mbp [michael_mbp!~Marin@62.215.214.4] has joined #ruby-lang
amerine [amerine!~mturner@bc171197.bendcable.com] has joined #ruby-lang
WillMarshall [WillMarshall!~willmarsh@121-73-153-79.cable.telstraclear.net] has joined #ruby-lang
dr0id [dr0id!~andy@unaffiliated/dr0id] has quit [#ruby-lang]
bousquet [bousquet!~bousquet@mobile-166-205-136-158.mycingular.net] has joined #ruby-lang
yadav [yadav!~quassel@dsl-173-248-230-235.acanac.net] has joined #ruby-lang
darkf_ [darkf_!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
JohnBat26 [JohnBat26!~Eugene@89.175.77.79] has joined #ruby-lang
frangiz [frangiz!~frangiz@user26.77-105-206.netatonce.net] has joined #ruby-lang
hagabaka [hagabaka!~hagabaka@unaffiliated/hagabaka] has joined #ruby-lang
<josh9>
i have my pet project on a server at home. i want to automate the setup of similar server if my home server dies. is chef a good way to do that?
<bousquet>
josh9: yes, chef is great once you get everything configured to build off the recipes. takes a bit more time to package than just one-off server setup
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby-lang
ddfreyne [ddfreyne!~denisdefr@stoneship.org] has joined #ruby-lang
<josh9>
bousquet: do u use chef-solo or the client-server option?
thone [thone!~thone@g226051085.adsl.alicedsl.de] has joined #ruby-lang
<josh9>
also, what is the cheapest option to host it in the cloud?
TvL2386 [TvL2386!~tom@2a00:1388:0:3:224:beff:feaf:8eb2] has joined #ruby-lang
<josh9>
(i don't care if it's virtualized or not
<bousquet>
josh9: chef solo. running on amazon aws. not sure if there's cheaper.
<josh9>
another question, isn't it faster to clone a vm? (comparing to using a ruby script that need to install everything)
<bousquet>
probably
<josh9>
so what's the excitement about chef?
<bousquet>
depending on io and the tooling provided by the hosting provider. compiling things like ruby from source can take some time
<bousquet>
josh9: mostly the ability to manage the configuration in a versioned and automated way.
<josh9>
bousquet: got it. thanks
<bousquet>
for years i had a list of commands I would run to build it up but chef has allowed that to get more sophisticated and have more best practices building upon recipes more people manage than myself
<burgestrand>
josh9: also check out Sprinkle or Puppet
<josh9>
nice
<burgestrand>
Personally I prefer Sprinkle. It requires no bootstrapping and the scripts are easily readable even if you haven’t seen a recipe before.
voker57 [voker57!~voker57@128-70-51-144.broadband.corbina.ru] has joined #ruby-lang
voker57 [voker57!~voker57@kvirc/developer/Voker57] has joined #ruby-lang
Pip [Pip!~Pip@188.134.46.174] has joined #ruby-lang
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
ryanf [ryanf!~ryanf@230.sub-174-253-229.myvzw.com] has joined #ruby-lang
roadkith [roadkith!~kith@unaffiliated/kith] has joined #ruby-lang
gidogeek_ [gidogeek_!~gidogeek@2002:5f82:ec27:0:9c62:7af6:e652:371a] has joined #ruby-lang
havenn [havenn!~skipper@pool-72-67-31-188.lsanca.fios.verizon.net] has joined #ruby-lang
charper [charper!u1691@gateway/web/irccloud.com/x-brxwipxxntozngqk] has joined #ruby-lang
solars [solars!~solars@clnet-kmu02-090.ikbnet.co.at] has joined #ruby-lang
tla [tla!~tla@toelboell-lund.dk] has joined #ruby-lang
flak [flak!~splitta@85.158.54.234] has joined #ruby-lang
Pip_ [Pip_!~Pip@188.134.46.174] has joined #ruby-lang
Pip_ [Pip_!~Pip@unaffiliated/pip] has joined #ruby-lang
gix- [gix-!~gix@e180027180.adsl.alicedsl.de] has joined #ruby-lang
foca [foca!~foca@li25-211.members.linode.com] has joined #ruby-lang
dreinull- [dreinull-!dreieins@217.18.70.225] has joined #ruby-lang
jordan`` [jordan``!~gromit@2001:660:3302:2826:225:90ff:fe20:d9a8] has joined #ruby-lang
codelol_ [codelol_!u3386@gateway/web/irccloud.com/x-mblvvhrnjvlqwfqd] has joined #ruby-lang
Tick-Tock [Tick-Tock!~Tick-Tock@2607:f358:1:fed5:22:0:b683:4295] has joined #ruby-lang
masterkorp [masterkorp!~masterkor@static.34.107.46.78.clients.your-server.de] has joined #ruby-lang
ozzloy [ozzloy!~ozzloy@unaffiliated/ozzloy] has joined #ruby-lang
dhoss [dhoss!~dhoss@bruticus.dhoss.net] has joined #ruby-lang
basicxman [basicxman!~basicxman@178.79.149.144] has joined #ruby-lang
basicxman [basicxman!~basicxman@unaffiliated/secrece] has joined #ruby-lang
segy [segy!~segfault@pdpc/supporter/active/segy] has joined #ruby-lang
yeltzooo [yeltzooo!~yeltzooo@ec2-50-18-131-205.us-west-1.compute.amazonaws.com] has joined #ruby-lang
bnagy [bnagy!~ben@27.54.42.187] has joined #ruby-lang
freedrull [freedrull!~freedrull@freedrull.xen.prgmr.com] has joined #ruby-lang
corsican [corsican!corsican@50-79-33-41-static.hfc.comcastbusiness.net] has joined #ruby-lang
prsimp [prsimp!~prs@manifestland.com] has joined #ruby-lang
coderrr [coderrr!~steve@li335-154.members.linode.com] has joined #ruby-lang
valeri_ufo [valeri_ufo!~valeri_uf@deadlink.in] has joined #ruby-lang
FiXato [FiXato!~FiXato@fixato.net] has joined #ruby-lang
kinabalu [kinabalu!~kinabalu@li164-71.members.linode.com] has joined #ruby-lang
LanceHaig [LanceHaig!44cb33e14a@vm10.hosting.betterhosted.com] has joined #ruby-lang
pablo [pablo!~pabloh@186.22.82.39] has joined #ruby-lang
mytrile [mytrile!~mytrile@94.26.28.135] has joined #ruby-lang
josh9 [josh9!~oren@cpe-76-172-9-207.socal.res.rr.com] has joined #ruby-lang
havenn [havenn!~skipper@pool-72-67-31-188.lsanca.fios.verizon.net] has joined #ruby-lang
mksm [mksm!~ramorim@li168-21.members.linode.com] has joined #ruby-lang
jensn [jensn!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby-lang
flebel [flebel!~flebel@dsl-69-171-137-41.acanac.net] has joined #ruby-lang
knu [knu!chuck@v055125.ppp.asahi-net.or.jp] has joined #ruby-lang
flebel [flebel!~flebel@unaffiliated/flebel] has joined #ruby-lang
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
ged [ged!~ged@deveiate.org] has joined #ruby-lang
gokulnath [gokulnath!~gokulnath@115.111.177.122] has joined #ruby-lang
rpowell [rpowell!~rpowell@CPE-121-216-141-190.lnse2.ken.bigpond.net.au] has joined #ruby-lang
Cope [Cope!~atalanta@91.194.75.218] has joined #ruby-lang
<Cope>
hi.... i am getting a very puzzling error
<Cope>
I am trying to run:
<Cope>
input = gets.chomp
Asher1 [Asher1!~asher@c-24-126-149-16.hsd1.ga.comcast.net] has joined #ruby-lang
<Cope>
pretty trivial
<Cope>
but i get:
<Cope>
No such file or directory - -e (Errno::ENOENT)
<Cope>
whenever i try to call gets
Asher [Asher!~asher@98.158.127.150] has joined #ruby-lang
levifig_ [levifig_!u1908@gateway/web/irccloud.com/x-mrhxnlibdzcsjcfj] has joined #ruby-lang
Pip [Pip!~Pip@188.134.46.174] has joined #ruby-lang
Pip [Pip!~Pip@unaffiliated/pip] has joined #ruby-lang
cyri_ [cyri_!~cyri_@149.93.119.80.rev.sfr.net] has joined #ruby-lang
levifig_ [levifig_!u1908@gateway/web/irccloud.com/x-jajylrbpsejcgqlf] has joined #ruby-lang
<bnagy>
that's not working code, so it's probably going to be hard to debug
voker57_ [voker57_!~voker57@128-70-118-94.broadband.corbina.ru] has joined #ruby-lang
<rippa>
Cope: try $stdin.gets
<Cope>
thanks rippa
<Cope>
works :)
tekin [tekin!~tekin@cpc8-with5-2-0-cust208.1-4.cable.virginmedia.com] has joined #ruby-lang
<matled>
Cope: gets will be called on $< by default. $< is a special file which reads from files specified on the command line, or stdin if none is supplied. it seems you passed a "-e" to your script as argument and ruby tries to open it as a file for $<.
molgrew [molgrew!~bozo20@85.182.139.18] has joined #ruby-lang
<Cope>
ahh
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
vladalive [vladalive!~vladalive@176.52.59.4] has joined #ruby-lang
ksinkar [ksinkar!~ksinkar@123.201.117.198] has joined #ruby-lang
<rue>
ARGF, usually.
<rue>
Or more commonly
ioga_wrk [ioga_wrk!~ioga@92.255.125.251] has joined #ruby-lang
Banistergalaxy [Banistergalaxy!~AndChat@222.153.223.47] has joined #ruby-lang
zmack [zmack!~zmack@109.99.235.103] has joined #ruby-lang
rpowell [rpowell!~rpowell@CPE-121-218-99-41.lnse4.ken.bigpond.net.au] has joined #ruby-lang
kitallis [kitallis!~kitallis@122.172.247.109] has joined #ruby-lang
adambeynon [adambeynon!~adambeyno@82-69-1-211.dsl.in-addr.zen.co.uk] has joined #ruby-lang
shevy [shevy!~shevy@178-190-75-144.adsl.highway.telekom.at] has joined #ruby-lang
heftig [heftig!jan@archlinux/developer/heftig] has joined #ruby-lang
flooose [flooose!~chris@mnch-4d0436ba.pool.mediaWays.net] has joined #ruby-lang
[zaf]-Coral [[zaf]-Coral!~quassel@41-133-59-28.dsl.mweb.co.za] has joined #ruby-lang
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
burgestrand [burgestrand!~burgestra@dhcp-189083.eduroam.chalmers.se] has joined #ruby-lang
toretore [toretore!~toretore@crr06-3-82-231-12-81.fbx.proxad.net] has joined #ruby-lang
valcker [valcker!~valcker@228-7-190-109.dsl.ovh.fr] has joined #ruby-lang
[zaf]-Coral [[zaf]-Coral!~quassel@41-133-59-28.dsl.mweb.co.za] has joined #ruby-lang
dr0id [dr0id!~andy@unaffiliated/dr0id] has joined #ruby-lang
headius [headius!~headius@71-37-230-236.mpls.qwest.net] has joined #ruby-lang
Roujo [Roujo!~Roujo@modemcable186.146-70-69.static.videotron.ca] has joined #ruby-lang
StevenRingo [StevenRingo!~nevets@ppp121-44-25-1.lns20.syd6.internode.on.net] has joined #ruby-lang
Roujo [Roujo!~Roujo@modemcable186.146-70-69.static.videotron.ca] has joined #ruby-lang
krz [krz!~foobar@2002:3a45:c93c:0:999c:2b17:4264:ad4e] has joined #ruby-lang
krz [krz!~foobar@unaffiliated/krz] has joined #ruby-lang
dave_miles [dave_miles!~davemiles@gatek.thls.bbc.co.uk] has joined #ruby-lang
Jade [Jade!~jade@unaffiliated/jade] has joined #ruby-lang
x0F__ [x0F__!~x0F@unaffiliated/x0f] has joined #ruby-lang
futurechimp [futurechimp!~futurechi@109.239.86.106] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@subtle/user/kyrylo] has joined #ruby-lang
valcker_ [valcker_!~valcker@78.250.115.211] has joined #ruby-lang
workmad3 [workmad3!~workmad3@vpn174.its.manchester.ac.uk] has joined #ruby-lang
_inc [_inc!~inc@unaffiliated/-inc/x-0498339] has joined #ruby-lang
xjonc [xjonc!~xjonc@afft121.neoplus.adsl.tpnet.pl] has joined #ruby-lang
tvl [tvl!~tvl@arrakis.uio.no] has joined #ruby-lang
<Asher>
wtf does delete_if return the original hash not the deleted elements
<Muz>
Because it's consistant with every other method that deletes or changes an object?
<Muz>
You get returned the resulting object, not the items you removed.
<Asher>
it's not consistentent with Hash#delete
thebastl [thebastl!bastl@ve621924175.ihrserver.de] has quit ["Leaving"]
<Muz>
I'd argue that Hash#delete has the confusing behaviour if anything
<Asher>
you'd argue that method chaining is more important than determining what was deleted?
<Muz>
But that said, it's not too confusing, as it provides a quick and deterministic method for seeing if something actually was deleted.
<Muz>
Gven the context and intention of use for a method; yes.
<Muz>
*intended
<Asher>
the only way to know what delete_if deletes is to trakc it manually during the loop
<Asher>
whereas i don't see the benefit of returning the hash
<Asher>
the benefit of returning the deleted elements seems clear
<Asher>
it seems like there should then be a delete_if! that would return the hash
<Asher>
but there's no since delete always changes the hash
<Asher>
*not
<Asher>
it encourages nasty little blocks of unnecessary if => store, return true else => return false in blocks
<Asher>
which of course can't say "return"
<Asher>
which makes it more ambiguous to read too
<matti>
Hi Asher :)
<Asher>
matti :D how goes
<matti>
Asher: Could be better ;]
<Asher>
aw that sucks :)
<matti>
:>
<matti>
You?
<molgrew>
don't you already know what delete_if deletes, because you provided the block?
<rippa>
blocks can say "next: though
<rippa>
*"
<Asher>
i've been doing pretty well - getting things together to launch contentinterfaces.com
<Asher>
molgrew - only if you manually track what the block will return
<molgrew>
why does one need to track what the block returns? delete_if does that and acts accordingly
bl00dshooter [bl00dshooter!~bl00dshoo@201.76.213.131] has joined #ruby-lang
<Asher>
delete_if does not return what the block deletes
<Asher>
if you want to know what was deleted you have to track it yourself
<molgrew>
I see now, you want more than just "everything that makes block return true" as answer
<Asher>
i want to know what the block determined it was deleting
bl00dshooter [bl00dshooter!~bl00dshoo@201.76.213.131] has joined #ruby-lang
fayimora [fayimora!~fayimora@lt38-201.eecs.qmul.ac.uk] has joined #ruby-lang
valcker__ [valcker__!~valcker@78.250.115.211] has joined #ruby-lang
gix [gix!~gix@e180005210.adsl.alicedsl.de] has joined #ruby-lang
valcker__ [valcker__!~valcker@78.250.115.211] has joined #ruby-lang
<rue>
This is the third inquiry of the same nature in the last week
<rue>
There's clearly demand for a change to either #reject! or #delete_if
<erikh>
reject! is kind of useless because you can't chain it
<shevy>
but you can chain your mom!
<erikh>
if it yielded the modified object jquery-style, it'd be a lot more useful
<injekt>
:)
bl00dsho_ [bl00dsho_!~bl00dshoo@201.76.213.131] has joined #ruby-lang
<rue>
erikh: It does, doesn't it?
<rue>
Well, it may return nil but other than that.
bl00dshooter [bl00dshooter!~bl00dshoo@201.76.213.131] has joined #ruby-lang
<andrewvos>
Anyone know a simple way to run a piece of code for a certain amount of time. #timeout raises an exception when my code executes longer than expected.
<andrewvos>
I kind of want something like timeout but without the raised error.
<rue>
There's a gem called begin-rescue-end
<andrewvos>
rue: I hate you
<erikh>
nil doesn't chain well
|Vargas| [|Vargas|!~luke@host130-149-dynamic.51-79-r.retail.telecomitalia.it] has joined #ruby-lang
|Vargas| [|Vargas|!~luke@pdpc/supporter/profesional/vargas] has joined #ruby-lang
<manveru>
meh
ioga_wrk [ioga_wrk!~ioga@92.255.125.251] has joined #ruby-lang
<manveru>
bikeshedding ftl :P
<manveru>
>> x = {a: 1, b: 2, c: 3, d: 4}; y = x.delete_if.with_object({}){|(k,v),o| o[k] = v if v % 2 == 0 }; [x, y]
<manveru>
=> [{:a=>1, :c=>3}, {:b=>2, :d=>4}]
<manveru>
>> x = {a: 1, b: 2, c: 3, d: 4}; y = x.partition{|k,v| v % 2 == 0 }.map{|y| Hash[y] }
<manveru>
=> [{:b=>2, :d=>4}, {:a=>1, :c=>3}]
<shevy>
what is going on
<shevy>
the array positions were exchanged with one another?
molgrew_ [molgrew_!~bozo20@85.182.139.18] has joined #ruby-lang
gianlucadv [gianlucadv!~gianlucad@st-dellaved.statistica.unimib.it] has joined #ruby-lang
codewrangler [codewrangler!~codewrang@pool-72-66-12-100.washdc.fios.verizon.net] has joined #ruby-lang
<andrewvos>
rue: I just don't want the devs to have to mess about with multiple repos
<rue>
They'll need to anyway
vesan_ [vesan_!vesan@maailmanlopun.modeemi.net] has joined #ruby-lang
<rue>
Unless you merge everything into one
<andrewvos>
rue: I mean, they're doing that now. And we end up doing an svn commit with the same message in multiple places.
<rue>
Why?
<andrewvos>
Which is fucking painful
<andrewvos>
rue: Well because when changing code in different projects it's all realy part of the same commit.
<andrewvos>
rue: Which screams "these should be in one project"
Tick-Tock [Tick-Tock!~Tick-Tock@2607:f358:1:fed5:22:0:b683:4295] has joined #ruby-lang
amerine [amerine!~mturner@67.204.184.82] has joined #ruby-lang
niklasb [niklasb!~codeslay0@p5B310A89.dip0.t-ipconnect.de] has joined #ruby-lang
<andrewvos>
Possibly
<rue>
Sure, but that's not the same thing as submodules
<rue>
A submodule is a reference to an external repo at a certain commit
<andrewvos>
Ok so it's harder with git then?
spinagon [spinagon!~rippa@87-253-25-211.pppoe.yaroslavl.ru] has joined #ruby-lang
<rue>
Harder to continue with the suckage? Could be :)
<rue>
If they're one project, merge them. If they're standalone, decouple them better
ksinkar [ksinkar!~ksinkar@115.240.93.138] has joined #ruby-lang
rippa [rippa!~rippa@93-181-222-153.adsl.yaroslavl.ru] has joined #ruby-lang
<andrewvos>
rue: Agreed.
tbuehlmann [tbuehlmann!~Tobias@unaffiliated/tovias] has joined #ruby-lang
rippa [rippa!~rippa@93-181-222-153.adsl.yaroslavl.ru] has joined #ruby-lang
RomyRomy [RomyRomy!~stickycak@cpe-69-203-115-155.nyc.res.rr.com] has joined #ruby-lang
burgestrand [burgestrand!~burgestra@h-45-63.a155.priv.bahnhof.se] has joined #ruby-lang
rippa [rippa!~rippa@93-181-222-153.adsl.yaroslavl.ru] has joined #ruby-lang
cconstantine_ [cconstantine_!~cconstant@173.247.200.5] has joined #ruby-lang
enikar [enikar!~gil@cl-140.mrs-01.fr.sixxs.net] has joined #ruby-lang
robotmay [robotmay!~robotmay@5ad8f1da.bb.sky.com] has joined #ruby-lang
pbjorklund [pbjorklund!~textual@c-b9dbe655.026-155-626f721.cust.bredbandsbolaget.se] has joined #ruby-lang
kinabalu [kinabalu!~kinabalu@unaffiliated/kinabalu] has joined #ruby-lang
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
SuperTaz_work [SuperTaz_work!~supertaz_@38.99.52.59] has joined #ruby-lang
SuperTaz_work [SuperTaz_work!~supertaz_@38.99.52.59] has joined #ruby-lang
ivanoats [ivanoats!~ivanoats@pdpc/supporter/active/ivanoats] has joined #ruby-lang
jensn [jensn!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby-lang
mrsolo [mrsolo!~mrsolo@64.125.181.73] 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
apeiros_ [apeiros_!~apeiros@77-58-113-31.dclient.hispeed.ch] has joined #ruby-lang
Sailias [Sailias!~jonathan@206-248-172-164.dsl.teksavvy.com] has joined #ruby-lang
dejongge [dejongge!~jonke@pD9E0DEBE.dip0.t-ipconnect.de] has joined #ruby-lang
LanceHaig [LanceHaig!44cb33e14a@foresight/member/lhaig] has joined #ruby-lang
Carnage\ [Carnage\!~carnage@84-75-163-211.dclient.hispeed.ch] has joined #ruby-lang
tenderlove [tenderlove!~tenderlov@pdpc/supporter/active/tenderlove] has joined #ruby-lang
codewrangler [codewrangler!~codewrang@pool-72-66-12-100.washdc.fios.verizon.net] has joined #ruby-lang
jaisoares [jaisoares!~jsoares@bl12-6-6.dsl.telepac.pt] has joined #ruby-lang
andrewhl [andrewhl!~andrew@24-246-14-26.cable.teksavvy.com] has joined #ruby-lang
nofxx_ [nofxx_!~nofxx@unaffiliated/nofxx] has joined #ruby-lang
brianpWins [brianpWins!~brianpWin@S01060014bf8930ea.vc.shawcable.net] has joined #ruby-lang
charlietanksley [charlietanksley!cwt@gateway/shell/blinkenshell.org/x-nhydmtjxzlydxjna] has joined #ruby-lang
jaisoares [jaisoares!~jsoares@bl12-6-6.dsl.telepac.pt] has quit [#ruby-lang]
jaisoares [jaisoares!~jsoares@bl12-6-6.dsl.telepac.pt] has joined #ruby-lang
macmartine [macmartine!~macmartin@069-064-227-254.pdx.net] has joined #ruby-lang
zwevans [zwevans!~zwevans@99-127-40-79.lightspeed.rlghnc.sbcglobal.net] has joined #ruby-lang
<rue>
Unanimity <3
<imperator>
we tried a git submodule for a while, gave up on it
<imperator>
ended up just creating our own fork
<rue>
Gitslave doesn't seem terrible, I guess. If you want to go that way
<rue>
Certainly >> submodules
pigdude [pigdude!~tallen@li61-243.members.linode.com] has quit [#ruby-lang]
<yxhuvud>
to me it feels as if git nails the single-project VC use case. however, big projects with multiple subprojects seems mostly like an open problem still
hagabaka [hagabaka!~hagabaka@unaffiliated/hagabaka] has joined #ruby-lang
jaisoares [jaisoares!~jsoares@bl12-6-6.dsl.telepac.pt] has joined #ruby-lang
<rue>
I think it's more a problem of *having* big projects with multiple subprojects
<imperator>
yep
drbrain [drbrain!~drbrain@drbrain-1-pt.tunnel.tserv14.sea1.ipv6.he.net] has joined #ruby-lang
<rue>
I'm open to being convinced otherwise on this count
<yxhuvud>
sure. but I don't see how it can be avoided.
kain [kain!~kain@151.64.210.200] has joined #ruby-lang
<rue>
What establishes a subproject relationship?
<yxhuvud>
most obvious case is when you have third party code that you want to integrate
<yxhuvud>
sometimes it is possible to do it through a library, but that is not always sufficient
<rue>
It should be quite rare that it isn't
<yxhuvud>
not so ime. especially not if you have to alter stuff in the corresponding code.
<rue>
Alter the library?
whatasunnyday [whatasunnyday!~sunny@c-24-130-81-47.hsd1.ca.comcast.net] has joined #ruby-lang
artOfWar [artOfWar!~artofwar@108-205-201-30.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
Asher [Asher!~asher@res-105001.nat.emory.edu] has joined #ruby-lang
<yxhuvud>
or alter the precompiled entrances to it. It gets a lot less nice and fuzzy when projects grow out of a single environment. Take the app we do at work for example. we have big chunks of code in c, java, python, ruby, bash etc. You *really* want to modularize stuff at that point
<imperator>
meh, just convert all that other crap to ruby!
* imperator
ducks
gianlucadv [gianlucadv!~gianlucad@host78-84-dynamic.44-79-r.retail.telecomitalia.it] has joined #ruby-lang
<rue>
Wouldn't modularization be better with well-defined APIs?
dv310p3r [dv310p3r!~dv310p3r@host-208-68-238-122.biznesshosting.net] has joined #ruby-lang
<yxhuvud>
well defined api's are nice, but that doesn't really help the problem with having to have umbrella modules
gidogeek_ [gidogeek_!~gidogeek@wirelab.isp.be.nl] has joined #ruby-lang
<imperator>
hm, anyone know how to do the equivalent of cc -D_POSIX_PTHREAD_SEMANTICS with FFI ?
<crankharder>
I want to write a class method that when called will define instance methods on the same class, how do I do that?
<apeiros_>
crankharder: see class_eval and define_method
<rue>
imperator: That being a compile-time definition, you need to figure out if it just affects the functions called, or otherwise splices code
<imperator>
rue, it uses different function declarations as far as i can tell
<imperator>
not sure how it's handled internally
<imperator>
oh, hah, just realized my C code doesn't even build it properly with gcc, only solaris cc
<imperator>
well, funk
boodle [boodle!~boodle@174.46.129.34] has joined #ruby-lang
Stalkr_ [Stalkr_!~Stalkr@x1-6-e0-46-9a-1f-97-a2.k617.webspeed.dk] has joined #ruby-lang
<crankharder>
apeiros_: ty
<rue>
imperator: clang?
<rue>
imperator: It sounds like you'd have to build the lib with the flag defined
Carnage\ [Carnage\!~carnage@84-75-163-211.dclient.hispeed.ch] has joined #ruby-lang
curtism [curtism!~curtis@bas11-montreal02-1128531121.dsl.bell.ca] has joined #ruby-lang
<erikh>
I want it to work on machines other than my own
<apeiros_>
hehe, ok
<apeiros_>
somebody (not me) should make a commit, changing strscan to stringscanner, adding strscan.rb which emits a deprecation warning and requires stringscanner
<apeiros_>
same for optparse
<yxhuvud>
string_scanner ktnx
optikalmouse [optikalmouse!~user@bas1-toronto42-1279599710.dsl.bell.ca] has joined #ruby-lang
Skif [Skif!~Skif@72.1.92.57] has joined #ruby-lang
<optikalmouse>
emacs ruby dev stuff, where can I finds it? ;p
<apeiros_>
yxhuvud: u rails traitor u!!! to the torches!
<H4y4shi>
huh.... I just found out how to use def...
* apeiros_
gets his pitchfork
<H4y4shi>
so awesome!
<Phrogz>
optikalmouse: The Internets?
<apeiros_>
H4y4shi: achievement unlocked!
* Phrogz
does use emacs, or he might be more helpful.
<H4y4shi>
fuck yeah!
<apeiros_>
5000 nobsi-points! new high-score!
<apeiros_>
:)
<yxhuvud>
sorry but I just can't get behind c-isms like just concatenating words to form library names
<apeiros_>
yxhuvud: hm?
<H4y4shi>
I never knew how to go back in my programs to earlier parts but now with def I can woot
<yxhuvud>
though the real c-ism might be the original name.
<apeiros_>
that's not about the naming of the library. it's about the mapping of the name to the file.
<apeiros_>
personally I'd prefer StringScanner.rb
<apeiros_>
I see no gain in silly case-mappings
<optikalmouse>
or um, which IDEs do ppl use for ruby dev?
<apeiros_>
optikalmouse: needle, magnet & steady hand
<Phrogz>
optikalmouse: I use Sublime Text 2 (not an IDE so much as an amazing text editor)
<erikh>
I use vim. others use emacs, textmate, sublime text 2
<rippa>
vim is kind of popular
<rippa>
there's also that thing
<rippa>
ruby mine or something
<erikh>
jetbrains.com
<rippa>
that's also not free
<yxhuvud>
apeiros_: hmm
<optikalmouse>
which ones are the free/open source ones? vim, emacs anything else?
Keva161 [Keva161!~Keva161@78.32.156.143] has joined #ruby-lang
<erikh>
I just gave you a list
<optikalmouse>
erikh: I'm not asking about price, I'm asking about opensource?
<erikh>
vim, emacs, sublime text 2
<optikalmouse>
oh ok
<optikalmouse>
thx
* jaimef
looks for a way to compare to large json structures for diffs
<erikh>
there's a differ in active_support
<erikh>
I wrote my own, and found out about it later.
Asher [Asher!~asher@98.158.127.150] has joined #ruby-lang
gregmore_ [gregmore_!~gregmoren@S01067444012f4469.vc.shawcable.net] has joined #ruby-lang
h4y4shi [h4y4shi!~chatzilla@rrcs-67-79-54-130.sw.biz.rr.com] has joined #ruby-lang
Phrogz [Phrogz!~phrogz@pdpc/supporter/professional/phrogz] has joined #ruby-lang
<andrewvos>
erikh: Is yours any good?
<andrewvos>
Reason I ask is I need a json differ for a task coming up.
<jaimef>
active-support has json differ? it's not jumping out at me
hagabaka [hagabaka!~hagabaka@unaffiliated/hagabaka] has joined #ruby-lang
Phrogz [Phrogz!~phrogz@pdpc/supporter/professional/phrogz] has joined #ruby-lang
<andrewvos>
Sublime TExt 2 isn't free
<erikh>
jaimef: it has a data structure diffing utility
RickHull1 [RickHull1!~rhull@209.119.14.25] has joined #ruby-lang
<apeiros_>
hey erikh: in perl they use the term "scalar" for single datapoints, what does it use again for collections?
<erikh>
list
<erikh>
all data structures derive from a list (somehow)
bl00dshooter [bl00dshooter!~bl00dshoo@201.76.213.131] has joined #ruby-lang
<apeiros_>
thanks
<erikh>
hash tables are in unstored form just even-length lists
<erikh>
this can be a little confusing at first but it's super-powerful
<apeiros_>
erikh: I remember :)
<erikh>
ah ok
<apeiros_>
I just forgot the term. I haven't used perl in ages :-S
<injekt>
:)
<imperator>
perl, what's that?
<apeiros_>
well, I mean, of course I remember the term 'list'. I forgot that the distinction used in perl was scalar/list :)
<erikh>
imperator: heh
<erikh>
apeiros_: note there's no "list()" function like there is with scalar()
<injekt>
imperator: the thing which has cpan? you know, which > *
<erikh>
surrounding with parens usually coerces list form, but there are other situations where you need to use @
<erikh>
or @{}
<erikh>
... which mostly involve references
<injekt>
deference that biznitch
<injekt>
dereference*
<erikh>
yeah, CPAN is pretty much win
<injekt>
aye
<injekt>
used some mojo stuff this last week
<erikh>
oh yeah, kraih is really kicking ass
<erikh>
been watching his commits on github
<injekt>
yeah
<imperator>
erikh, though i had to crack up when some of them started counting -modules- once rubygems distros started catching up
<injekt>
I love the dom stuff
<erikh>
imperator: oh yeah -- well, they're taking a lot of (unnecessary and cargo culted) heat lately, so the information police feel the need to step up
<RickHull1>
we've been reported to the cyberpolice?
RickHull [RickHull!~rhull@pdpc/supporter/active/rickhull] has joined #ruby-lang
<injekt>
unfortunately no other language has anything NEAR as sexy as nokogiri for dom stuff
<imperator>
RickHull, you've been reported to the phone cops
<RickHull>
they've backtraced it!
<erikh>
I like XML::LibXML, but I like DOM APIs too
<erikh>
I'm a bit crusty that way
<injekt>
not sure if I used that one, I went through so many which I felt did weird things
<erikh>
oh yeah -- some of the xml parsers are shit
<injekt>
but used the mojo dom stuff, and it was really nice
<erikh>
such is the nature of CPAN
<injekt>
yeah
<injekt>
aye
<apeiros_>
erikh: sry, was afk (wife returned) - I was mostly looking for terms
<erikh>
there's a guy on magnet who benched them all
<erikh>
even experimental iksemel modules
<injekt>
all of them?
<erikh>
he used a dump of wikipedia
<injekt>
dang
<erikh>
basically, if you can deal with the API, XML::Parser is the winrar for most cases
<injekt>
ah I think I may have struggled with that API tbh
<injekt>
can't remember now, totally settled with Mojo::DOM
ilyam [ilyam!~ilyam@eng.nat.mtv.ooyala.com] has joined #ruby-lang
SkramX [SkramX!~SkramX@128.164.117.253] has joined #ruby-lang
<erikh>
reimplimenting sprintf is a bitch with arbitrary formats
rushed [rushed!~rushed@cpe-70-116-11-35.austin.res.rr.com] has joined #ruby-lang
pigdude [pigdude!~tallen@li61-243.members.linode.com] has joined #ruby-lang
<pigdude>
why is this small script unreliable? it doesn't move files when it should, and i never see the "hg revert" message: http://paste.pocoo.org/show/540193/
<erikh>
exec replaces the process with the new one
<pigdude>
oh shite
<erikh>
it doesn't do anything to tty controls
<pigdude>
so if i want to exec string ...
<erikh>
system(string)
<pigdude>
oh ok
<pigdude>
that's nicer than `#{s}`
<erikh>
that'll still render the output
<pigdude>
thanks erikh
jjore [jjore!~jjore@c-24-18-236-106.hsd1.wa.comcast.net] has quit ["ERC Version 5.2 (IRC client for Emacs)"]
Heimidal_ [Heimidal_!~heimidal@factory-smtp.factorylabs.com] has joined #ruby-lang
<erikh>
`#{s}` or %x[#{s}] will only capture stdout unless you redirect it in the shell
<erikh>
yep
lsegal [lsegal!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
<erikh>
if you really want to capture it all, well...
<pigdude>
erikh, no, this works great
<erikh>
ok cool
<MistyM>
Open3 and friends are useful for more advanced stuff.
<erikh>
Open* is horribly unportable
<erikh>
... unfortunately it's a pretty hard problem
<yxhuvud>
There are portable solutions as long as you don't have to interact with the process
<erikh>
portable to windows and jruby? that always yield output in a deterministic order?
<erikh>
I'd like to hear about them
<MistyM>
Unixisms don't port to Windows - film at 11.
indstry [indstry!~apple@c-71-238-98-243.hsd1.mi.comcast.net] has joined #ruby-lang
Heimidal [Heimidal!~heimidal@factory-smtp.factorylabs.com] has joined #ruby-lang
<imperator>
erikh, how is open3 unportable?
<yxhuvud>
erikh: I was thinking of systemu (from ara t howard). Dunno if it works on java, but it was very convenient on windows
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby-lang
crudson [crudson!~doug@static-72-94-51-106.phlapa.fios.verizon.net] has quit [#ruby-lang]
<imperator>
gem install win32-open3 on 1.8, open3 should *just work* on 1.9
senj [senj!~senj@S01060026f323bcdf.ed.shawcable.net] has joined #ruby-lang
indstry [indstry!~apple@c-71-238-98-243.hsd1.mi.comcast.net] has joined #ruby-lang
<yxhuvud>
imperator: it may be fixed now popen3 blocked the last time I had to work on windows. (which was several years ago, granted.
<yxhuvud>
*but
<erikh>
imperator: mashing stderr and stdout together yields a few issues
<erikh>
because stderr has different semantics on unix than it does on windows (autoflush vs. proper buffering as I understand it)
<erikh>
so basically depending on how you code it you might get stderr at one point but on a unix system another point
<erikh>
ah no, it was line buffering
dejongge [dejongge!~jonke@pD9E0DEBE.dip0.t-ipconnect.de] has joined #ruby-lang
<imperator>
hm, never experienced any problems with that
<erikh>
I've had a ton of problems with it in gem-testers
<imperator>
of course, system calls are the devil and should be avoided anyway ;)
<erikh>
maybe my code is just fail
h4y4shi [h4y4shi!~chatzilla@rrcs-67-79-54-130.sw.biz.rr.com] has joined #ruby-lang
macmartine [macmartine!~macmartin@069-064-227-254.pdx.net] has joined #ruby-lang
_inc [_inc!~inc@unaffiliated/-inc/x-0498339] has joined #ruby-lang
<h4y4shi>
Hey could someone explain a beginner question for me. The question is. What does the following line of code do? attr_reader, :name, :attack, :hp
<h4y4shi>
What does this line of code do?
<h4y4shi>
the next line of code. def initialize(name, attack, hp)
<h4y4shi>
next line. @name = name
<h4y4shi>
next line. @attack = attack
<h4y4shi>
next line. @hp = hp
<h4y4shi>
next line. end
<h4y4shi>
So I just want to know why is the def initialize so common?
rpowell [rpowell!~rpowell@CPE-121-218-99-41.lnse4.ken.bigpond.net.au] has joined #ruby-lang
robotmay [robotmay!~robotmay@5ad8f1da.bb.sky.com] has joined #ruby-lang
<MistyM>
h4y4shi: def initialize is the code which will be executed when an instance of that class is created via Foo.new
<lsegal>
known in OOP as a "constructor" method
<MistyM>
attr_reader (along with its friends attr_writer and attr_accessor) makes it possible to access the instance variables of an object from outside objects.
<MistyM>
attr_reader creates a method to read the named instance variable; attr_writer creates a method to write the named instance variable; and attr_accessor does both.
<h4y4shi>
Okay thank you. I was wondering the difference between those three.
<MistyM>
So, put it all together - your class there defines three instance variables (@name, @attack, @hp) and creates reader methods for them; then defines its constructor so that, when you create a new object in that class, it assigns values to those three instance variables.
<apeiros_>
h4y4shi: also for future reference, use pastie.org for multi-line pastes (or gist.github.com)
<h4y4shi>
Okay I will do that.
<h4y4shi>
so is def initialize special in some way?
<apeiros_>
slightly. Class#new will call it
<apeiros_>
e.g. class Foo; end; Foo.new # <-- will call Foo#initialize
<apeiros_>
you use it to initialize a newly created object (hence its name)
<h4y4shi>
so if I were to call it def apple would it do the same thing if everything else was the same?
<Mon_Ouie>
No, because Class#new calls #initialize not #apple
flooose [flooose!~chris@178-27-1-76-dynip.superkabel.de] has joined #ruby-lang
<MistyM>
If you called it def apple it wouldn't be called when you generate a new object from that class with Class.new
<Mon_Ouie>
But that's not really a property of the initialize method. The only special thing with it is it is private by default
<h4y4shi>
oh okay I get it thank you!
srbartlett [srbartlett!~srbartlet@202.146.7.239] has joined #ruby-lang
<yxhuvud>
initialize is private by default? heh. always count on Mon_Ouie to teach you something
<MistyM>
If you called it def apple - `mackintosh = Class.new` then you could run `mackintosh.apple` on an object you create. But it won't be run automatically.
<h4y4shi>
Thank you MistyM that makes sense.
<h4y4shi>
=D
<MistyM>
:D
jbsan [jbsan!~jbsan@host86-147-222-73.range86-147.btcentralplus.com] has joined #ruby-lang
gix [gix!~gix@e180005210.adsl.alicedsl.de] has joined #ruby-lang
<h4y4shi>
What made you all want to learn Ruby?
<qpingu>
Syntax for me
<qpingu>
Loose and expressive
kookwekker [kookwekker!kookwekker@2a02:2308::216:3eff:feb8:af22] has joined #ruby-lang
<MistyM>
That's a big part of it for sure.
<MistyM>
For me, Why's Poignant Guide to Ruby. I wanted to learn to program but had a lot of trouble finding the right introduction that "clicked" with me.
<h4y4shi>
I started because of RPG maker XP but lol I never understood it.
<h4y4shi>
So now years later I decided to try to figure it out because I heard some buzz about it on the internet
<MistyM>
Hm. Regexp question.
<MistyM>
So I've got strings which may contain some notes in square brackets, e.g. "foo [note] bar [note2]". I'm matching multiple captures to extract those portions.
<MistyM>
...I think I just rubber duck debugged myself. One minute.
brianpWins [brianpWins!~brianpWin@S01060014bf8930ea.vc.shawcable.net] has joined #ruby-lang
* RubberDebugger
is listening
<MistyM>
;o
fayimora_ [fayimora_!~fayimora@2a01:388:201:3721:95db:a28:8e8b:3228] has joined #ruby-lang
<optikalmouse>
so what do ppl use for unit-testing?
<optikalmouse>
and is there a way to have both 1.9 and 1.8 installed? *kicks Ubuntu*
<RubberDebugger>
RVM or alternatively rb-env are commonly used to manage multiple ruby versions
<RickHull>
on debian based distros, there is usually a ruby1.9 package
<MistyM>
Dang. I feel so close. "foo [note] bar [note2]".match /(\[[a-zA-Z ]+\])+/ #=> "[note]" (but not "[note2]" as well)
gregmore_ [gregmore_!~gregmoren@S01067444012f4469.vc.shawcable.net] has joined #ruby-lang
<optikalmouse>
yeeeeeah totally not going to install either of them...is there a way to make sure that gems I install will work with ruby 1.8?
<MistyM>
1.8 :(
<MistyM>
optikalmouse: What's bugging you about them?
<injekt>
optikalmouse: no
<injekt>
optikalmouse: 1.9 is the latest version, so most gems will be targetted to that
<MistyM>
1.9 is a major language revision, so there are incompatibilities.
arooni-mobile [arooni-mobile!~arooni-mo@72.169.215.13] has joined #ruby-lang
<MistyM>
optikalmouse: If you don't like the idea of installing things into your system without apt-get, rvm's installer is pretty "friendly" that way. It lives in .rvm in your home directory and adds one line to your .(bash|zsh)_profile. If you don't like it you can wipe it very easily without touching the rest of your system.
<injekt>
is he on ubuntu then?
<RickHull>
y
<RickHull>
the best way I've found to deal with ruby on a debian based system is to manage all of ruby outside of apt
<injekt>
on any system*
<optikalmouse>
oh ok, so it's like every other programming language then, I'm used to that then ;p
<qpingu>
Not on Windows though
<qpingu>
You're stuck with one Ruby installation
<injekt>
lies
<RickHull>
well, windows doesn't have a standard repo or package system
<injekt>
there's an rvm type equiv for windows
<heftig>
RickHull: windows installer?
<RickHull>
do you mean installer.exe or .msi or portable exe? ;)
guns [guns!~guns@c-98-228-72-208.hsd1.il.comcast.net] has joined #ruby-lang
<RickHull>
there are ways to install software on windows, no doubt
<qpingu>
Same could be said about the plethora of unix package formats
<injekt>
no there is an official installer
<heftig>
RickHull: nowadays, all sane installers build on windows installer
<RickHull>
does that include the nullsoft thingie?
<erikh>
no
<heftig>
nope
<RickHull>
i don't see that much anymore
setmeaway [setmeaway!~setmeaway@118.45.149.58] has joined #ruby-lang
<erikh>
yay netsplit
qpingu [qpingu!~Adium@67.218.117.238] has joined #ruby-lang
mccraig [mccraig!u574@gateway/web/irccloud.com/x-gdppticvrmnqalxu] has joined #ruby-lang
dkannan [dkannan!u480@gateway/web/irccloud.com/x-ulhyrsrvprierpaz] has joined #ruby-lang
levifig[o] [levifig[o]!u1908@gateway/web/irccloud.com/x-akeraezrlcdsfknv] has joined #ruby-lang
ilyam [ilyam!~ilyam@eng.nat.mtv.ooyala.com] has joined #ruby-lang
mrchrisadams [mrchrisadams!u1367@gateway/web/irccloud.com/x-wbyjvlxndlpttnfq] has joined #ruby-lang
cldwalker_ [cldwalker_!u2984@gateway/web/irccloud.com/x-butsgokcdecxvxnz] has joined #ruby-lang
kitallis [kitallis!~kitallis@122.172.247.109] has joined #ruby-lang
codelol [codelol!u3386@gateway/web/irccloud.com/x-musyqfrdjnnpbxdh] has joined #ruby-lang
denysonique_ [denysonique_!u484@gateway/web/irccloud.com/x-xfsfmbhpkwugdxch] has joined #ruby-lang
RickHull [RickHull!~rhull@pdpc/supporter/active/rickhull] has quit [#ruby-lang]
Heimidal_ [Heimidal_!~heimidal@factory-smtp.factorylabs.com] has joined #ruby-lang
abuiles [abuiles!u1641@gateway/web/irccloud.com/x-cjrehdmdbdwitija] has joined #ruby-lang
crassvs [crassvs!u4275@gateway/web/irccloud.com/x-jvuagqtbxfpxvenn] has joined #ruby-lang
necromancer [necromancer!u4538@gateway/web/irccloud.com/x-swjzxdrnveenowba] has joined #ruby-lang
newbold [newbold!u5179@gateway/web/irccloud.com/x-dkcjpneasgaqjdls] has joined #ruby-lang
rpowell [rpowell!~rpowell@CPE-121-218-99-41.lnse4.ken.bigpond.net.au] has joined #ruby-lang
cesario [cesario!u2444@gateway/web/irccloud.com/x-ptyobqjbueriqhex] has joined #ruby-lang
mztriz [mztriz!~mztriz@nkugateway.nku.edu] has joined #ruby-lang
headius [headius!~headius@71-37-230-236.mpls.qwest.net] 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
<andrewvos>
Not much going on here
yfeldblum [yfeldblum!~Jay@c-98-218-48-253.hsd1.md.comcast.net] has joined #ruby-lang
<optikalmouse>
is there a way to do keyword args in ruby?
<injekt>
optikalmouse: no, pass a hash
<drbrain>
you can fake them with hashes
<andrewvos>
optikalmouse: What?
<injekt>
boom
* injekt
wins
<andrewvos>
oh right
<andrewvos>
Well played injekt.
twittard [twittard!~twittard@wc.lax.truecarcorp.com] has joined #ruby-lang
<optikalmouse>
also, what's the standard way of using functions; Set.new [1,2] or Set.new([1,2])? the docs are using diff conventions -_-'
<injekt>
optikalmouse: your choice
<andrewvos>
optikalmouse: I like to omit brackets
<injekt>
the parenthesis are optional
<andrewvos>
Some may call me a heathen
<optikalmouse>
ok, brackets all the freaking time then.
<injekt>
andrewvos: actually I think it's more common
<andrewvos>
Well, I tend to use brackets if I have more than two/three parameters. But, if I have more than two or three parameters then my code is shit anyway.
<injekt>
heh
<injekt>
anyone alive who uses slop?
<shevy>
injekt it's on my todo list next time I have to use OptionParser!
<injekt>
:)
<andrewvos>
injekt: Just use ARGV
<andrewvos>
injekt: Seriously
<andrewvos>
It's not so fucking hard
<andrewvos>
All those other tools give you is a false sense of security
<andrewvos>
Then when you want to do something cool, they fuck you
<injekt>
what does using ARGV have to do with option parsing?
<injekt>
and I disagree
<injekt>
'do something cool', slop hasn't yet stopped me from doing what I want
<shevy>
ARGV is annoying, I remember when I started ruby I even had methods that directly used ARGV inside
<andrewvos>
Yeah I tend to exaggerate
<andrewvos>
It's just an array though. It's not that hard.
<injekt>
sure, but to allow different option formats you need to parse each item
<injekt>
ARGV is fine if you're building something yourself for a single intended use
<injekt>
if you want to support a broad format, and remove a ton of code you'll no doubt be repeating, option parsers are nice
<jorgenpt>
Man, I was totally switching to this window to get some suggestions for option parsing to use in place of args4j
<jorgenpt>
Totally trying out slop for it.
<shevy>
I think it even has more documentation than OptionParser
<injekt>
not sure about that, but the API is tiny compared to optparse, it's less than half the LOC
twittard [twittard!~twittard@wc.lax.truecarcorp.com] has joined #ruby-lang
rpowell [rpowell!~rpowell@CPE-121-218-99-41.lnse4.ken.bigpond.net.au] has joined #ruby-lang
brianpWins_ [brianpWins_!~brianpWin@S01060014bf8930ea.vc.shawcable.net] has joined #ruby-lang
rpowell [rpowell!~rpowell@CPE-121-218-99-41.lnse4.ken.bigpond.net.au] has joined #ruby-lang
tomzx [tomzx!~tomzx@dsl-136-201.aei.ca] has joined #ruby-lang