Topic for #ruby-lang is now Ruby 1.9.3p0: http://ruby-lang.org | Paste >3 Lines of Text on http://pastie.org
Soleone [Soleone!~soleone@206-248-177-9.dsl.teksavvy.com] has joined #ruby-lang
looopy [looopy!~looopy@static-71-166-232-207.washdc.east.verizon.net] has joined #ruby-lang
mkscrg [mkscrg!~mkscrg@76-218-100-21.lightspeed.sntcca.sbcglobal.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
<dFire> Does Ruby have short as variable type?
<TTilus> dFire: what do you mean by "as variable type"?
<injekt> dFire: variables simply reference objects, there's no primitive types
<TTilus> dFire: in ruby values have types, but variables do not
<TTilus> dFire: thats called dynamic typing
<dFire> Ok, I asked because I need to write some stuff to a binary file
<dFire> But I think I found what I need for that
takaokouji [takaokouji!~takaokouj@nat35.mable.ne.jp] has joined #ruby-lang
<dFire> Another thing (semi-related) If I do a File.open(something something) do |filehandle| code code end
<dFire> after the end, can I still write to that file if I've not done a File.close on it?
<burgestrand> Are the execution times of Array#concat and Array#shift affected by the size of the array?
<injekt> dFire: the file is only open inside the block
<TTilus> deryl: no, its automatically closed
<injekt> dFire: if you want that, dont use the block form
<dFire> ok, thanks
<TTilus> dFire: filehandle = File.open(something, something); code; code; filehandle.close
dejongge1 [dejongge1!~jonke@pD9E0C141.dip0.t-ipconnect.de] has joined #ruby-lang
<dFire> solid.
Soleone [Soleone!~soleone@206-248-177-9.dsl.teksavvy.com] has joined #ruby-lang
Indian_ [Indian_!~Indian@unaffiliated/londonmet050] has joined #ruby-lang
dous [dous!~dous@unaffiliated/dous] has joined #ruby-lang
igotnolegs [igotnolegs!~igotnoleg@75-162-83-166.slkc.qwest.net] has joined #ruby-lang
naz [naz!~n@70.44.2.190.res-cmts.bus.ptd.net] has joined #ruby-lang
dous_ [dous_!~dous@cm171.sigma67.maxonline.com.sg] has joined #ruby-lang
neoesque [neoesque!~neoesque@210.59.147.232] has joined #ruby-lang
robgleeson [robgleeson!~rob@subtle/contributor/robgleeson] has joined #ruby-lang
flip_digits [flip_digits!~textual@c-76-122-14-228.hsd1.fl.comcast.net] has joined #ruby-lang
flip_digits [flip_digits!~textual@c-76-122-14-228.hsd1.fl.comcast.net] has joined #ruby-lang
spuk [spuk!~spuk@189.101.210.16] has joined #ruby-lang
enebo [enebo!~enebo@75-168-44-241.mpls.qwest.net] has joined #ruby-lang
Manhose [Manhose!~Manhose@bl17-17-151.dsl.telepac.pt] has joined #ruby-lang
plusk [plusk!~plusk@201-34-212-230.gnace703.dsl.brasiltelecom.net.br] has joined #ruby-lang
eggman2001 [eggman2001!~shig@user-387hpcb.cable.mindspring.com] has joined #ruby-lang
<eggman2001> can someone interpret this code for me? I'm confused by the receiver of the conditional - when Yelp::ResponseFormat::PICKLE: params[:output] = 'pickle'
SuperTaz [SuperTaz!~supertaz@c-24-130-115-179.hsd1.ca.comcast.net] has joined #ruby-lang
gasbakid [gasbakid!~gasbakid@41.96.78.131] has joined #ruby-lang
jessemc [jessemc!~jessemc@S010678cd8e6f175f.ed.shawcable.net] has joined #ruby-lang
<hagabaka> eggman2001, it's probably in a case statement, and if so, the condition is actually Yelp::ResponseFromat::PICKLE === object_after_case
<eggman2001> hagabaka: thanks. yes, it is. however, i've given up on that library for other reasons :-p
<hagabaka> ok
artOfWar [artOfWar!~artofwar@108-205-201-30.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
<lianj> ruby -e 'case true; when true: p :foo; end' doesn't work on 1.9 anw
<robgleeson> yep, ':' isn't valid syntax anymore
<lianj> thank god ;)
<eggman2001> I see. I also saw that the yelp gem doesn't support the new yelp api anyway
<lianj> hihi
dustin [dustin!~ddeyoung@99-7-24-156.lightspeed.iplsin.sbcglobal.net] has joined #ruby-lang
jessemc [jessemc!~jessemc@S010678cd8e6f175f.ed.shawcable.net] has joined #ruby-lang
jessemc [jessemc!~jessemc@S010678cd8e6f175f.ed.shawcable.net] has joined #ruby-lang
robgleeson [robgleeson!~rob@subtle/contributor/robgleeson] has joined #ruby-lang
eggman2001 [eggman2001!~shig@user-387hpcb.cable.mindspring.com] has quit [#ruby-lang]
Swimming_Bird [Swimming_Bird!~textual@cpe-68-173-86-46.nyc.res.rr.com] has joined #ruby-lang
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby-lang
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
artOfWar [artOfWar!~artofwar@108-205-201-30.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
bglusman_ [bglusman_!~bglusman@c-71-224-192-35.hsd1.pa.comcast.net] has joined #ruby-lang
andrewhl [andrewhl!~andrew@24-246-15-43.cable.teksavvy.com] has joined #ruby-lang
Xzyx987X [Xzyx987X!~Xzyx987X@c-75-72-121-187.hsd1.mn.comcast.net] has joined #ruby-lang
Weems [Weems!Weems@68-117-153-32.dhcp.unas.al.charter.com] has joined #ruby-lang
Weems [Weems!Weems@unaffiliated/weems] has joined #ruby-lang
x0F_ [x0F_!~x0F@unaffiliated/x0f] has joined #ruby-lang
srbartlett [srbartlett!~srbartlet@202.146.7.239] has joined #ruby-lang
gregmore_ [gregmore_!~gregmoren@S01067444012f4469.vc.shawcable.net] has joined #ruby-lang
kitallis [kitallis!~kitallis@122.172.248.47] has joined #ruby-lang
jimmyy111 [jimmyy111!jimmy@112.237.26.89] has joined #ruby-lang
srbartlett [srbartlett!~srbartlet@202.146.7.239] has joined #ruby-lang
burgestrand1 [burgestrand1!~burgestra@81-229-85-235-no66.tbcn.telia.com] has joined #ruby-lang
krz [krz!~foobar@unaffiliated/krz] has joined #ruby-lang
JosephRuby [JosephRuby!~joseph@46.33.34.140] has joined #ruby-lang
davidtspf01_ [davidtspf01_!~leaping@cpe-76-170-28-102.socal.res.rr.com] has joined #ruby-lang
savage- [savage-!~savage-@c-67-180-11-89.hsd1.ca.comcast.net] has joined #ruby-lang
artOfWar [artOfWar!~artofwar@108-205-201-30.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
replore_ [replore_!~replore@ntkngw298122.kngw.nt.ftth.ppp.infoweb.ne.jp] has joined #ruby-lang
Marco [Marco!~marco@Marco-2.Kiewit.Dartmouth.EDU] has joined #ruby-lang
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
<Gekz> so
<Gekz> what's a good robust ORM for ruby?
artOfWar [artOfWar!~artofwar@108-205-201-30.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
<heftig> activerecord.
<heftig> datamapper.
nekid [nekid!~nekid@c-24-6-170-1.hsd1.ca.comcast.net] has joined #ruby-lang
yxhuvud [yxhuvud!mongo@h-17-181.a149.priv.bahnhof.se] has joined #ruby-lang
Xzyx987X [Xzyx987X!~Xzyx987X@c-75-72-121-187.hsd1.mn.comcast.net] has joined #ruby-lang
<sj26> Sequel
<savage-> pstore :-)
igotnolegs [igotnolegs!~igotnoleg@75-162-83-166.slkc.qwest.net] has joined #ruby-lang
dfr|mac [dfr|mac!~dfr|work@ool-18baf7e7.dyn.optonline.net] has joined #ruby-lang
<Gekz> I'm gonna try to metaprogram me some automated XML to SQL conversions
<Gekz> using RelaxNG as the middle ground :D
amerine [amerine!~mturner@bc171197.bendcable.com] has joined #ruby-lang
bglusman [bglusman!~bglusman@c-71-224-192-35.hsd1.pa.comcast.net] has joined #ruby-lang
tla [tla!~tla@toelboell-lund.dk] has joined #ruby-lang
mytrile [mytrile!~mytrile@94.26.28.135] has joined #ruby-lang
adrienk [adrienk!464b167a@gateway/web/freenode/ip.70.75.22.122] has joined #ruby-lang
<adrienk> Hey, I have a quick question. If a variable is set to some value, say @var = 10 and is later changed else where, how do I check if @var has been changed? (with out knowing where else it has been changed)?
<burgestrand1> adrienk: there’s no sane way to do that if you assign @var directly; if you use a setter method for it, howver, you can implement your own dirty tracking
<adrienk> what if it was a :var thus a attr_accessor :var which was set to 0 (@var = 0) then changeed later on. does that help?
<adrienk> would it be easier?
infid [infid!~infid@99-95-168-48.lightspeed.sndgca.sbcglobal.net] has joined #ruby-lang
<erikh> copy it and compare it to the cached value?
<adrienk> how do you do that in ruby?
<erikh> either that or maintain a state
<erikh> well, if it's a fixnum or symbol, foo = bar = <value>
<burgestrand1> oh, nvm me, was under the assumption you did not know the initial value
thone [thone!~thone@g226048044.adsl.alicedsl.de] has joined #ruby-lang
<erikh> if it's a proper object, bar = <value>; foo = bar.dup
<erikh> that's not a deep clone mind you, but it's good enough for horseshoes
<adrienk> erikh I am so lost in what your saying
<erikh> ok, you need to step back then
<erikh> and pick up a programming book and read it.
<adrienk> your essentially saying to dup @var and compare it to the attr_accesssor :var?
<adrienk> oh wait no i get it
<adrienk> >_>
<adrienk> so dumb
<adrienk> bar = val, thus foo = bar.dup, thus if bar == foo - true, else, false
<Gekz> so which framework should I use for webapps?
mkscrg [mkscrg!~mkscrg@76-218-100-21.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
mdel [mdel!~mdel@pool-71-175-17-16.phlapa.fios.verizon.net] has joined #ruby-lang
<adrienk> um one last question - what if: you cannot dup a fix num? is there another way around it?
dc5ala [dc5ala!~dc5ala@stgt-5f709c98.pool.mediaWays.net] has joined #ruby-lang
<adrienk> shit i read that wrong its a reader not accessor
<bnagy> b=a.dup rescue a # this is all awful
<adrienk> My god I need to pay attention to what im doing sometimes >_>
robgleeson [robgleeson!~rob@subtle/contributor/robgleeson] has joined #ruby-lang
RomD` [RomD`!~Roman@nrbg-4d0705b3.pool.mediaWays.net] has joined #ruby-lang
jbsan [jbsan!~jbsan@m83-186-160-26.cust.tele2.se] has joined #ruby-lang
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby-lang
vmatiyko [vmatiyko!~vmatiyko@178.120.67.145] has joined #ruby-lang
<bnagy> anyone got a fast / good suggestion for checking if a string contains any chars that aren't 7 bit ascii?
solars [solars!~solars@clnet-kmu02-090.ikbnet.co.at] has joined #ruby-lang
perryh [perryh!~perryh@unaffiliated/perry753] has joined #ruby-lang
takaokouji [takaokouji!~takaokouj@nat35.mable.ne.jp] has joined #ruby-lang
<erikh> should just be able to & the byte value by 0x1000000
<erikh> anyhow, bed
yakkof [yakkof!~yakkof@c-98-234-84-37.hsd1.ca.comcast.net] has joined #ruby-lang
dr0id [dr0id!~andy@unaffiliated/dr0id] has joined #ruby-lang
retro|cz [retro|cz!~retro@106.142.broadband6.iol.cz] has joined #ruby-lang
shevy [shevy!~shevy@178-191-185-201.adsl.highway.telekom.at] has joined #ruby-lang
gnufied [gnufied!~gnufied@122.178.197.11] has joined #ruby-lang
roadkith [roadkith!~kith@unaffiliated/kith] has joined #ruby-lang
gasbakid [gasbakid!~gasbakid@41.96.21.58] has joined #ruby-lang
<heftig> bnagy: str.force_encoding("US-ASCII").valid_encoding?
<heftig> or try to .encode("US-ASCII") and rescue Encoding::UndefinedConversionError
<bnagy> will that abort immediately if it hits an invalid byte?
<bnagy> it's more readable that each_byte.all? {|(b^0x90).zero?} ...
<bnagy> 0x80 rather
Carnage\ [Carnage\!~carnage@84-75-163-211.dclient.hispeed.ch] has joined #ruby-lang
frangiz [frangiz!~frangiz@user26.77-105-206.netatonce.net] has joined #ruby-lang
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby-lang
<rue> There's some options you can pass to #encode as well, not sure if those work for you
rippa [rippa!~rippa@87-253-28-238.pppoe.yaroslavl.ru] has joined #ruby-lang
csmrfx [csmrfx!~Casimir@81.90.72.4] has quit ["bye"]
gasbakid__ [gasbakid__!~gasbakid@41.96.50.151] has joined #ruby-lang
davidw [davidw!~davidw@host228-251-static.95-94-b.business.telecomitalia.it] has joined #ruby-lang
thrcka [thrcka!thrcka@nat/redhat/x-hwkykrgeneqsjajy] has joined #ruby-lang
davidw [davidw!~davidw@apache/committer/davidw] has joined #ruby-lang
<davidw> anyone know if it's possible, with nokogiri to do something like parse("<p></p <p></p>") ? Everything seems to want to work with one root node, whereas I want to parse some stuff and then add it in as a child node
Manhose [Manhose!~Manhose@bl6-38-193.dsl.telepac.pt] has joined #ruby-lang
vmatiyko [vmatiyko!~vmatiyko@178.120.67.145] has joined #ruby-lang
terrence [terrence!~terrence@123.235.81.126] has joined #ruby-lang
DEac- [DEac-!~deac@81.16.104.86] has joined #ruby-lang
uniqanomaly [uniqanomaly!~ua@dynamic-78-8-90-151.ssp.dialog.net.pl] has joined #ruby-lang
publicvoid__ [publicvoid__!~publicvoi@p4FCAFE2F.dip.t-dialin.net] has joined #ruby-lang
<rue> “Some stuff”
<rue> ?
workmad3 [workmad3!~workmad3@host-78-146-168-54.as13285.net] has joined #ruby-lang
fish_ [fish_!~fish@2a01:238:42b5:f700:dead:cafe:beef:babe] has quit [#ruby-lang]
Newbs [Newbs!~textual@host-78-144-71-110.as13285.net] has joined #ruby-lang
<injekt> davidw: cross posting can be pretty frustrating for people helping you btw
<davidw> injekt, hrm?
matti [matti!matti@madwifi/support/matti] has joined #ruby-lang
<davidw> rue, some stuff like what I wrote above
<davidw> "<p></p> <p></p>"
<injekt> davidw: well, when you asked your question here, you could have pointed people to the question you already asked on Stack Overflow
<davidw> injekt, I asked here first
<injekt> then update people here
<davidw> 'here' had looked pretty dead ... I saw some tumbleweeds rolling by
<injekt> SO looks pretty dead, too ;)
<davidw> but for those who want to have at it:
<davidw> injekt, sure, but it's a less ephemeral place...
senthil [senthil!~senthil@99-51-1-6.lightspeed.snjsca.sbcglobal.net] has joined #ruby-lang
Carnage\ [Carnage\!~carnage@84-75-163-211.dclient.hispeed.ch] has joined #ruby-lang
<Gekz> davidw: did you look at DocumentFragment
<Asher> ?= as a tertiary assignment operator would be neat
<Asher> value ?= true : false
<Asher> i guess not ruby-style tho like we don't have +=
<tobiasvl> Asher: |= ?
<davidw> Gekz, yeah, but it does not work like I'd hoped
<jarib> Asher: ruby has +=
<Asher> tobiasvl- |= does that?
<Asher> oh i duno why i was thnking it didn't have that.. ah well
<tobiasvl> Asher: not exactly, it's not tertiary
<Asher> yea
<tobiasvl> but
<Gekz> ruby even has ||=
<tobiasvl> yeah
<Asher> right
<Asher> that's what was making me think about ?=
<tobiasvl> but in what situation would you need ?= without being able to use |= or ||=
<Asher> var = result_from_some_function() ; var ? var : false
<Asher> maybe you can show me how to do that with
<Asher> |=
<tobiasvl> but ... that's valid ruby code
unsymbol [unsymbol!u4994@gateway/web/irccloud.com/x-qovtvfpjztcjczec] has quit [#ruby-lang]
<tobiasvl> what you just wrote
<Asher> yes i'm aware
<Asher> so is the code for which ||= is a shorthand
<tobiasvl> i guess i don't really understand what it is you really want here
<Asher> ||= is equivalent to var = value unless var
<Asher> i want a tertiary evaluator that will assign teh evaluated variable the resulting value
gasbakid [gasbakid!~gasbakid@41.96.50.151] has joined #ruby-lang
<bnagy> example code?
<Asher> er.. didn't i just give that?
<tobiasvl> no, your example code already works
<bnagy> I mean example code using your imaginary thing
<Asher> var = result_from_some_function() ; var ? var : var = false
<bnagy> cause I have nfi what you're talking about wither :)
<Asher> var ?= var : false
<Asher> actually teh example code requires parens
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
<Asher> var = result_from_some_function() ; var ? var : ( var = false )
<Asher> var = result_from_some_function() ; var ?= var : false
<rippa> isn't that the same as ||= ?
<Asher> var ||= false?
<rippa> yes
<Asher> yeah in this case i suppose so
<Asher> so at least that's a nicer oslution for my code
<Asher> thanks
<Asher> but not in every case
<rippa> still not much of a saving
<rippa> var = var ? var2 : var3
<rippa> var ?= var2 : var3
<Asher> way prettier
<rippa> also ambigous syntax
<Asher> what's ambiguous about it
<bnagy> -1 vote for 'prettier', imho
<Asher> really?
<tobiasvl> "var ? var : ( var = false )" can be rewritten by just moving the assignment too: "var = var ? var : false"
<tobiasvl> (not prettier, but correct syntax)
|Vargas| [|Vargas|!~luke@pdpc/supporter/profesional/vargas] has joined #ruby-lang
<Asher> tobiasvl- right rippa just pointed that out too
<rippa> : is already used for symbols and hashes
<Asher> it is prettier, a bit
<Asher> : is used for tertiary already too
<Asher> this would be an extension of the tertiary operator
<Asher> it's not like i think ruby _has_ to have this or anything… just seemed like it'd be nice
<mitchty> or, you could do var=(x=foo) ? x : false but its basically ||= and depending on truthiness too
gasbakid__ [gasbakid__!~gasbakid@41.96.106.237] has joined #ruby-lang
<sj26> var = var ? var2 : var3 == "var &&= var2; var ||= var3" ?
<sj26> it's interesting syntax, but tertiaries are generally discouraged
<mitchty> I'd just honestly wrap the function with another that just returns the function or false, would be more straightforward
adambeynon [adambeynon!~adambeyno@82-69-1-211.dsl.in-addr.zen.co.uk] has joined #ruby-lang
<Asher> this is the function that is doing the wrapping :)
Banistergalaxy [Banistergalaxy!~AndChat@222.153.223.45] has joined #ruby-lang
robgleeson [robgleeson!~rob@subtle/contributor/robgleeson] has joined #ruby-lang
<kalleth> Asher: you mean ternary?
<Asher> ha yes thanks
robglees_ [robglees_!~rob@87-198-38-218.ptr.magnet.ie] has joined #ruby-lang
saLOUt [saLOUt!~rriemann@naqasl.physik.hu-berlin.de] has joined #ruby-lang
takaokouji [takaokouji!~takaokouj@nat35.mable.ne.jp] has joined #ruby-lang
chrismcg [chrismcg!~chrismcg@pdpc/supporter/active/chrismcg] has joined #ruby-lang
srbartlett [srbartlett!~srbartlet@124-168-200-61.dyn.iinet.net.au] has joined #ruby-lang
vihus [vihus!~vihus@91.201.193.157] has joined #ruby-lang
kyrylo [kyrylo!~kyrylo@46.118.237.222] has joined #ruby-lang
jimmyy111 [jimmyy111!jimmy@112.237.26.89] has joined #ruby-lang
vmatiyko [vmatiyko!~vmatiyko@178.120.67.145] has quit [#ruby-lang]
virunga [virunga!~virunga@151.64.22.99] has joined #ruby-lang
ksinkar [ksinkar!~ksinkar@117.195.102.185] has joined #ruby-lang
PhilCK [PhilCK!~anonymous@cpc2-sgyl30-2-0-cust158.sgyl.cable.virginmedia.com] has joined #ruby-lang
spuk [spuk!~spuk@187.65.189.2] has joined #ruby-lang
zmack [zmack!~zmack@78.97.129.175] has joined #ruby-lang
yango [yango!~yango@85.48.193.157] has joined #ruby-lang
tomzx [tomzx!~tomzx@dsl-216-221-39-59.aei.ca] has joined #ruby-lang
canton7 [canton7!~canton7@95.150.107.113] has joined #ruby-lang
ksinkar [ksinkar!~ksinkar@117.195.115.203] has joined #ruby-lang
Natch| [Natch|!~natch@178.73.216.55] has joined #ruby-lang
Arsen7 [Arsen7!~case@gmx218.internetdsl.tpnet.pl] has joined #ruby-lang
saLOUt [saLOUt!~rriemann@naqasl.physik.hu-berlin.de] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
seii [seii!~sei@user-3c2h3m6.cable.mindspring.com] has joined #ruby-lang
Jade [Jade!~jade@unaffiliated/jade] has joined #ruby-lang
perryh [perryh!~perryh@unaffiliated/perry753] has joined #ruby-lang
dustin [dustin!~ddeyoung@99-7-24-156.lightspeed.iplsin.sbcglobal.net] has joined #ruby-lang
jensn [jensn!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby-lang
dous [dous!~dous@unaffiliated/dous] has joined #ruby-lang
tommyvyo [tommyvyo!~tommyvyo@38.123.129.115] has joined #ruby-lang
tommyvyo_ [tommyvyo_!~tommyvyo@38.123.129.115] has joined #ruby-lang
sandbags [sandbags!~sandbags@unaffiliated/rubymatt] has joined #ruby-lang
sandelius [sandelius!~textual@90-231-202-62-no214.tbcn.telia.com] has joined #ruby-lang
westernanalog [westernanalog!~westernan@2.149.129.124.tmi.telenormobil.no] has joined #ruby-lang
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby-lang
Spooner [Spooner!~Miranda@host-78-144-139-130.as13285.net] has joined #ruby-lang
yfeldblum [yfeldblum!~Jay@pool-71-246-76-76.bltmmd.east.verizon.net] has joined #ruby-lang
ramonmaruko [ramonmaruko!~marco@122.52.126.66] has joined #ruby-lang
jimmyy111 [jimmyy111!~jimmy@112.237.26.89] has joined #ruby-lang
Natch| [Natch|!~natch@178.73.218.106] has joined #ruby-lang
mark_locklear [mark_locklear!~jlocklear@ab-tech-lan-to-ab-tech-gw.ncren.net] has joined #ruby-lang
niklasb [niklasb!~codeslay0@p5B310A64.dip0.t-ipconnect.de] has joined #ruby-lang
enebo [enebo!~enebo@75-168-44-241.mpls.qwest.net] has joined #ruby-lang
robgleeson [robgleeson!~rob@subtle/contributor/robgleeson] has joined #ruby-lang
janissary [janissary!~user@adsl-98-85-0-232.mco.bellsouth.net] has joined #ruby-lang
Carnage\ [Carnage\!~carnage@84-75-163-211.dclient.hispeed.ch] has joined #ruby-lang
dv310p3r [dv310p3r!~dv310p3r@host-208-68-238-122.biznesshosting.net] has joined #ruby-lang
bglusman [bglusman!~bglusman@c-68-80-200-61.hsd1.pa.comcast.net] has joined #ruby-lang
melter [melter!~Melter@2001:4930:116:0:21c:c0ff:feef:eaf5] has joined #ruby-lang
sora_h [sora_h!~sora_h@mayfield.privs.net] has joined #ruby-lang
empity [empity!~user@net-93-70-0-178.cust.dsl.vodafone.it] has joined #ruby-lang
virunga [virunga!~virunga@151.64.22.99] has joined #ruby-lang
jasox [jasox!~jasox@178.239.26.139] has joined #ruby-lang
Carmivore [Carmivore!~carmivmor@ec2-184-73-17-110.compute-1.amazonaws.com] has joined #ruby-lang
jkprg [jkprg!~jarda@ip-62-245-93-150.net.upcbroadband.cz] has joined #ruby-lang
lateau_ [lateau_!~Adium@KD125054233174.ppp-bb.dion.ne.jp] has joined #ruby-lang
gearaholic [gearaholic!~gearaholi@c-71-238-98-243.hsd1.mi.comcast.net] has joined #ruby-lang
Marco [Marco!~marco@Marco-2.Kiewit.Dartmouth.EDU] has joined #ruby-lang
stepnem [stepnem!~stepnem@176.119.broadband10.iol.cz] has joined #ruby-lang
Locke23rus [Locke23rus!~quassel@128-70-109-104.broadband.corbina.ru] has joined #ruby-lang
leonL [leonL!~leonl@CPE0024a5b652a3-CM000f21205d86.cpe.net.cable.rogers.com] has joined #ruby-lang
dfr|mac [dfr|mac!~dfr|work@ool-18baf7e7.dyn.optonline.net] has joined #ruby-lang
scampbell [scampbell!~scampbell@c-98-224-240-62.hsd1.mi.comcast.net] has joined #ruby-lang
akahn [akahn!u2243@gateway/web/irccloud.com/x-eqmqmunlgelhhygd] has joined #ruby-lang
vmatiyko [vmatiyko!~vmatiyko@178.120.67.145] has joined #ruby-lang
krzkrzkrz [krzkrzkrz!~foobar@175.139.71.25] has joined #ruby-lang
krzkrzkrz [krzkrzkrz!~foobar@unaffiliated/krz] has joined #ruby-lang
DMKE [DMKE!~DMKE@pdpc/supporter/student/dmke] has joined #ruby-lang
imajes [imajes!~imajes@is.imaj.es] has joined #ruby-lang
sora_h [sora_h!~sora_h@mayfield.privs.net] has joined #ruby-lang
confounds [confounds!~confounds@CPE78cd8e667600-CM78cd8e6675fd.cpe.net.cable.rogers.com] has joined #ruby-lang
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
empity` [empity`!~user@net-93-70-0-178.cust.dsl.vodafone.it] has joined #ruby-lang
Swimming_Bird [Swimming_Bird!~textual@64.70.114.89] has joined #ruby-lang
RickHull [RickHull!~rhull@209.119.14.25] has joined #ruby-lang
jacobwg [jacobwg!~jacobwg@94.sub-75-224-214.myvzw.com] has joined #ruby-lang
imperator [imperator!~Daniel@63-225-247-192.hlrn.qwest.net] has joined #ruby-lang
spleeze [spleeze!~Spleeze@173-15-131-114-BusName-Philadelphia.hfc.comcastbusiness.net] has joined #ruby-lang
retro|cz [retro|cz!~retro@106.142.broadband6.iol.cz] has joined #ruby-lang
Dreamer3 [Dreamer3!~Dreamer3@74-134-34-116.dhcp.insightbb.com] has joined #ruby-lang
dous [dous!~dous@unaffiliated/dous] has joined #ruby-lang
vmatiyko [vmatiyko!~vmatiyko@178.120.67.145] has quit [#ruby-lang]
cschneid [cschneid!~cschneid@72.1.92.57] has joined #ruby-lang
Austin__ [Austin__!~austin@CPE0016cbc30e9c-CM001ceacff6ba.cpe.net.cable.rogers.com] has joined #ruby-lang
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
apeiros_ [apeiros_!~apeiros@77-58-113-31.dclient.hispeed.ch] has joined #ruby-lang
Defusal [Defusal!DeFi@unaffiliated/ecnerifed] has joined #ruby-lang
headius [headius!~headius@71-210-151-185.mpls.qwest.net] has joined #ruby-lang
empity [empity!~user@net-93-70-0-178.cust.dsl.vodafone.it] has joined #ruby-lang
tommyvyo_ [tommyvyo_!~tommyvyo@38.123.129.115] has joined #ruby-lang
tommyvyo [tommyvyo!~tommyvyo@38.123.129.115] has joined #ruby-lang
tenderlove [tenderlove!~tenderlov@pdpc/supporter/active/tenderlove] has joined #ruby-lang
turboladen [turboladen!~kvirc@12.104.144.2] has joined #ruby-lang
tenderlo_ [tenderlo_!~tenderlov@pdpc/supporter/active/tenderlove] has joined #ruby-lang
empity [empity!~user@net-93-70-0-178.cust.dsl.vodafone.it] has joined #ruby-lang
Codif [Codif!~codif@84.120.204.160.dyn.user.ono.com] has joined #ruby-lang
empity` [empity`!~user@net-93-70-0-178.cust.dsl.vodafone.it] has joined #ruby-lang
RickHull [RickHull!~rhull@pdpc/supporter/active/rickhull] has joined #ruby-lang
savage- [savage-!~savage-@209.118.197.220] has joined #ruby-lang
spleeze [spleeze!~Spleeze@173-15-131-114-BusName-Philadelphia.hfc.comcastbusiness.net] has joined #ruby-lang
tbuehlmann [tbuehlmann!Tobias@unaffiliated/tovias] has joined #ruby-lang
niklasb [niklasb!~codeslay0@p5B310A64.dip0.t-ipconnect.de] has joined #ruby-lang
tallship [tallship!~tallship@pool-71-189-131-153.lsanca.fios.verizon.net] has joined #ruby-lang
darkf [darkf!~darkf_dix@unaffiliated/darkf] has joined #ruby-lang
butchanton [butchanton!~butchanto@vpn-sanfran.exacttarget.com] has joined #ruby-lang
solars [solars!~solars@mk089144206205.a1.net] has joined #ruby-lang
adambeynon_ [adambeynon_!~adambeyno@82-69-1-211.dsl.in-addr.zen.co.uk] has joined #ruby-lang
jgomez [jgomez!~jeremy@26.107.125.91.rb5.adsl.brightview.com] has joined #ruby-lang
amerine [amerine!~mturner@67.204.184.82] has joined #ruby-lang
andrewhl [andrewhl!~andrew@24-246-15-43.cable.teksavvy.com] has joined #ruby-lang
dr_bob [dr_bob!~robert@p5DC4F764.dip.t-dialin.net] has joined #ruby-lang
mkscrg [mkscrg!~mkscrg@76-218-100-21.lightspeed.sntcca.sbcglobal.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
wmoxam [wmoxam!~wmoxam@pdpc/supporter/active/wmoxam] has joined #ruby-lang
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
mrsolo [mrsolo!~mrsolo@64.125.181.73] has joined #ruby-lang
<jacobwg> Does anyone know of a way to add markup to plain text with a regex? I need the regex to match a particular string and replace it with a dynamically computed replacement.
<jacobwg> I've been trying to do it with gsub and a block, but no luck so far
<bougyman> jacobwg: sure
<bougyman> jacobwg: show and example
ttilley [ttilley!~ttilley@unaffiliated/lv] has joined #ruby-lang
<jacobwg> bougyman: hey, again! :)
<jacobwg> This is for the same Bible verse parser
<jacobwg> I'll gist the code
<jacobwg> line 31 is the place I'm working on
<jacobwg> Basically, it can accurately detect and parse verse references, but now I need to replace those references with some kind of dynamic markup
dejongge [dejongge!~jonke@pD9E0C141.dip0.t-ipconnect.de] has joined #ruby-lang
artOfWar [artOfWar!~artofwar@nat/yahoo/x-vbjucdckwexxqedw] has joined #ruby-lang
jacobwg [jacobwg!~jacobwg@94.sub-75-224-214.myvzw.com] has quit ["Textual IRC Client: http://www.textualapp.com/"]
jacobwg [jacobwg!~jacobwg@94.sub-75-224-214.myvzw.com] has joined #ruby-lang
<jacobwg> Weird - my client disconnected from the channel
<apeiros_> jacobwg: you don't want return in the block
<apeiros_> you want next
nekid [nekid!~nekid@c-24-6-170-1.hsd1.ca.comcast.net] has joined #ruby-lang
<apeiros_> or better yet, just let the replacement value be the last evaluated value and use no flow control
<jacobwg> apeiros_: ah, duh on my part...
<apeiros_> jacobwg: also, there's YAML.load_file
<apeiros_> no need to read the file yourself
<jacobwg> Made those changes - testing it out now....
<apeiros_> the gsub is weird though…
<jacobwg> Not quite working yet
scampbell [scampbell!~scampbell@c-98-224-240-62.hsd1.mi.comcast.net] has joined #ruby-lang
<matti> manveru: Poke me at some point. I have a question!
<jacobwg> apeiros_: it can correctly identify the string "1 John 1", but markup returns nil...
jredville [jredville!~jredville@173-160-211-253-Washington.hfc.comcastbusiness.net] has joined #ruby-lang
<apeiros_> jacobwg: sounds like your condition was falsy then…
<apeiros_> maybe you check that with another p or pp…
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
<manveru> matti: ?
RomD` [RomD`!~Roman@nrbg-4d0705b3.pool.mediaWays.net] has joined #ruby-lang
dous [dous!~dous@unaffiliated/dous] has joined #ruby-lang
<jacobwg> apeiros_: interesting - it seems that perhaps the match object is different than then matches returned by string.scan...
<erikh> the match object should be the sum of all matches
<apeiros_> gsub yields the matched string
<erikh> of type MatchData
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby-lang
<apeiros_> scan yields either the matched string or an array of all matched captures
<jacobwg> apeiros_ erikh: ah… so, how would I get the individual matches
<erikh> m[0] and so on
<apeiros_> erikh: he's using gsub, gsub does not yield MatchData
<erikh> I thought it did as the first argument to the block
<apeiros_> nope, only the complete match
<erikh> oh, hrm.
<apeiros_> you can get at the full match-data using e.g. $~
<erikh> ok listen to apeiros_, he's probably right
<apeiros_> or Regexp.last_match (basically the same thing)
<erikh> yeah, things that are likely not threadsafe
<apeiros_> both are thread-local btw. (even though I doubt you'd care :) )
<erikh> orly
<apeiros_> yeah, ruby is a bit flaky with its definition of "global"…
<jacobwg> so, use $1, $2, etc.?
<apeiros_> (and I don't like it)
<apeiros_> I think it's even more narrow than just thread-local, but I forgot the kind of restrictions applied…
<erikh> foo = "bar"; foo.gsub(/b(a)r/) { |full_match, capture| p [full_match, capture] }
<erikh> try that in irb jacobwg
<jacobwg> ["bar", nil]
tenderlove [tenderlove!~tenderlov@pdpc/supporter/active/tenderlove] has joined #ruby-lang
<erikh> jesus, am I thinking of something else here
<apeiros_> :)
<jacobwg> Looks like $1 - $4 works
<erikh> meh, I gotta get back to work; sorry to add noise!
<apeiros_> np
* apeiros_ thinks only String#match, Regexp::last_match and $~ return MatchData
<apeiros_> I might be wrong, though…
<jacobwg> Thanks for the help anyway, erikh!
<jacobwg> apeiros_, you're right $~ returns the MatchData, and $1+ return the individual matches (like an array)
heftig [heftig!jan@archlinux/developer/heftig] has joined #ruby-lang
<apeiros_> jacobwg: beware that the $-vars tend to bite people's asses
<jacobwg> kk
<apeiros_> any method that performs regex matching will override them
<apeiros_> and some perform regex matching and you might not even know it…
vmatiyko [vmatiyko!~vmatiyko@178.120.67.145] has joined #ruby-lang
sandelius [sandelius!~textual@90-231-202-62-no214.tbcn.telia.com] has joined #ruby-lang
jmontross [jmontross!~Adium@68-233-216-82.static-ip.telepacific.net] has joined #ruby-lang
Jake232 [Jake232!~textual@5e08fa4c.bb.sky.com] has joined #ruby-lang
benanne [benanne!~rijdier@ip-213-49-106-58.dsl.scarlet.be] has joined #ruby-lang
zmack [zmack!~zmack@78.97.129.175] has joined #ruby-lang
Guest35011 [Guest35011!~marco@Marco-2.Kiewit.Dartmouth.EDU] has joined #ruby-lang
savage- [savage-!~savage-@209.118.197.220] has joined #ruby-lang
corsican [corsican!corsican@c-67-161-78-60.hsd1.ca.comcast.net] has joined #ruby-lang
mkscrg [mkscrg!~mkscrg@76-218-100-21.lightspeed.sntcca.sbcglobal.net] has joined #ruby-lang
Weems [Weems!Weems@unaffiliated/weems] has joined #ruby-lang
evan [evan!~evan@ec2-50-18-248-68.us-west-1.compute.amazonaws.com] has joined #ruby-lang
evan [evan!~evan@ec2-50-18-248-68.us-west-1.compute.amazonaws.com] has quit ["Leaving..."]
lwhalen [lwhalen!~law@63.116.56.194] has joined #ruby-lang
<lwhalen> hey all, would this be an appropriate channel to ask for help with building specific ruby gems?
benanne [benanne!~rijdier@ip-213-49-106-58.dsl.scarlet.be] has joined #ruby-lang
<apeiros_> I don't know what you mean by "specific" in this context, but I'd say: just ask. in the worst case you're referred to another channel…
<apeiros_> @ lwhalen
timbleck [timbleck!u3835@gateway/web/irccloud.com/x-yulcrliykxrikegh] has joined #ruby-lang
nekid [nekid!~nekid@c-24-6-170-1.hsd1.ca.comcast.net] has joined #ruby-lang
kitallis-cloud [kitallis-cloud!u358@gateway/web/irccloud.com/x-wuqatrhwtywxeuar] has joined #ruby-lang
<lwhalen> hehe fair enough, thanks
<lwhalen> I'm having some issues building the mysql2 gem with mysql enterprise 5.5.14
<lwhalen> it keeps giving me "/usr/bin/ld: cannot find -lmysqlclient_r"
<apeiros_> ah, *that* kind of building :)
<lwhalen> and when I try to pass it "--with-mysql-config=/usr/bin/mysql_config" (like it says in the readme), it says there's no such option
<lwhalen> this is on RHEL 6, Ruby 1.8.7, and rubygems 1.8.13
<apeiros_> I'd say this is the proper channel, but alas, I don't think I can help…
thrcka [thrcka!~thrcka@ip-89-102-34-33.net.upcbroadband.cz] has joined #ruby-lang
<lwhalen> hehe no worries
necromancer [necromancer!u4538@gateway/web/irccloud.com/x-tcjihbwilhtptqzs] has joined #ruby-lang
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
tychobrailleur [tychobrailleur!~sebastien@176.61.72.130] has joined #ruby-lang
<imperator> hm, shouldn't it be --with-mysql-dir?
simon_weber [simon_weber!u4119@gateway/web/irccloud.com/x-jejhzpomcxmwwtjo] has joined #ruby-lang
<lwhalen> not according to the readme...
pvh [pvh!u717@gateway/web/irccloud.com/x-rnvenogcxwddiyqv] has joined #ruby-lang
<imperator> try it, see what happens
PhilCK [PhilCK!~anonymous@cpc2-sgyl30-2-0-cust158.sgyl.cable.virginmedia.com] has joined #ruby-lang
<imperator> afaik dir_config only gives you dir, lib and include
looopy [looopy!~looopy@static-71-166-232-207.washdc.east.verizon.net] has joined #ruby-lang
plusk [plusk!~plusk@201-67-85-241.gnace703.dsl.brasiltelecom.net.br] has joined #ruby-lang
whoops [whoops!u549@gateway/web/irccloud.com/x-kynoqvgqdgtxzyio] has joined #ruby-lang
looopy_ [looopy_!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
tenderlove [tenderlove!~tenderlov@pdpc/supporter/active/tenderlove] has joined #ruby-lang
<kyrylo> Hi. How to iterate over the array, in order to get that result? http://dpaste.com/680997/
<imperator> kyrylo, this a homework assignment?
<shevy> kyrylo array.each {|e|}
<workmad3> shevy: .each doesn't give the requested output :P
<imperator> shevy, don't think that gets him what he wants
coolfool [coolfool!~greg@static-50-34-26-118.evrt.wa.frontiernet.net] has joined #ruby-lang
<workmad3> it looks like a homework assignment to me... get the first, then 2nd and 3rd, then 4th, 5th and 6th, etc...
<shevy> ah
<shevy> weird actually
<shevy> I dont think I ever had the need to do that
<shevy> :)
<imperator> which is why i think it's a homework assignment :)
<kyrylo> Actually, it's not. I think I should use inject, but I don't understand, how to apply it.
<shevy> kyrylo yeah but you aren't saying why this output has to be as odd as is
<shevy> you can also keep track with a counter
agib [agib!u781@gateway/web/irccloud.com/x-gjbkglbfhgzqmbad] has joined #ruby-lang
<shevy> hmm
<kyrylo> It doesn't matter. I just showed you an abstract example of what I need.
<imperator> 0.upto(2){ |n| p a[n,n+1] }
<shevy> can anyone recall a require like ... require 'foo bar' ? with a ' ' in it?
<imperator> or something
<imperator> shevy, nope
<shevy> ok
<kyrylo> imperator, thanks. I think, it could be done better, but anyway, thank you very much.
<apeiros_> shevy: since it's just a path, I'd assume it's possible. I wouldn't do it, though.
tenderlove [tenderlove!~tenderlov@pdpc/supporter/active/tenderlove] has joined #ruby-lang
<workmad3> imperator, kyrylo: you could also use .shift
<workmad3> (1..4).to_a.map{|i| source.shift(i) } for example
<imperator> what workmad3 said
<workmad3> that's more destructive than imperator's solution though... you may want to .dup the source beforehand :)
<kyrylo> dup or clone? ;)
<workmad3> kyrylo: I believe they're just aliases ;)
Codif [Codif!~codif@84.120.204.160.dyn.user.ono.com] has joined #ruby-lang
imperator [imperator!~Daniel@63-225-247-192.hlrn.qwest.net] has quit ["Leaving"]
CoverSlide [CoverSlide!~richard@216.2.249.50] has joined #ruby-lang
elux_ [elux_!~peter@96.45.198.150] has joined #ruby-lang
elux [elux!~peter@96.45.198.150] has joined #ruby-lang
bryanl [bryanl!u1690@gateway/web/irccloud.com/x-vjosenejxhigzrba] has joined #ruby-lang
<rue> No, there's a difference
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby-lang
Spooner [Spooner!~Miranda@host-78-144-139-130.as13285.net] has joined #ruby-lang
<rue> #dup is like a new instance of class, with data copied over. #clone clones internal state, too
<deryl> plus clones are locked if the cloned object is frozen, dup does not
<apeiros_> clone also copies singleton methods and frozen state
<apeiros_> dup doesn't
<workmad3> good to know :)
<apeiros_> I wish there was something that copied singleton methods but not frozen state…
<workmad3> deryl: does anyone ever freeze their objects? :P
<workmad3> (other than for debugging)
<apeiros_> also, if you want to implement #dup/#clone for your class - you most likely should implement #initialize_copy instead (it's invoked by ruby upon dup/clone)
<deryl> :shrug: but its a distinction one should probably know
<robgleeson> the documentation for #dup & #clone is awful, so you could be forgiven for mistaking the two
<rue> That's what I mean by internal state :P
* apeiros_ loves Class#clone, it's a nice way to protect core stuff in testing/stubbing/mocking/…
<apeiros_> too sad there's no Object#replace :(
CoverSlide [CoverSlide!~richard@216.2.249.50] has joined #ruby-lang
<ddfreyne> oh, I did not know about that
* jaimef looks for cleaner foo = File.open("/home/jaimef/xen.conf","r") {|f| f.each_line {|l| puts "line:#{l.split[0]}" if l.match("smurf12") } }
<ddfreyne> workmad3: I freeze regularly
<apeiros_> puts File.read(path).grep(/smurf12/)
<robgleeson> ice man
<apeiros_> might use readlines instead of read
<rue> jaimef: File.readlines / each_line
<ddfreyne> workmad3: for example, for nanoc I freeze all data before compilation, because immutability gives me certain advantages (knowing that something can’t have changed is a big advantage)
<apeiros_> oh, in 1.9, you probably even must (since String is no longer Enumerable)
<rue> jaimef: Then #grep for the match
<rue> Or is that .foreach or something weird
* rue is struggling to build some roobees in XCode hell
<jaimef> got it. grep is sufficient
* ddfreyne ’s laptop is too slow to run xcode on lion :(
<rue> I just splurged on an MBA, old MB's power got flaky
<ddfreyne> I bought a new MBP but it had an azerty keyboard, so I traded it in for a qwerty one, but that was last week… today I got a notice that the new one is ready for picking up!
<rue> Wtf… XCode 4.1 finishes installation, but there's no /Developer, no Install XCode :(
<deryl> thats weird
<deryl> no $HOME/Developer? (never seen it default to homedir though.. ever)
br1an [br1an!u440@gateway/web/irccloud.com/x-qmufhjzleuegzjcy] has joined #ruby-lang
dkannan [dkannan!u480@gateway/web/irccloud.com/x-qpcrhrvxubfydlet] has joined #ruby-lang
<rue> Nope
<deryl> rue: no insult intended here, you *are* looking from console right? ls -d /Developer and not in Finder?
<rue> What's a Finder?
<deryl> don't kill me because when I first installed Xcode (new to apple platform) i didnt' know that /Development did not show up normally through Finder
<deryl> rue: OS X's Explorer basically
<rue> Sarcasm :P
<ddfreyne> /Developer should show up
<deryl> missed it by that much :)
<rue> But, no, it's not there. I've got hidden files on anyway, so it would show up in Finder too, if I used it
<rue> Lessee if the Console has anything
Carnage\ [Carnage\!~carnage@84-75-163-211.dclient.hispeed.ch] has joined #ruby-lang
<rue> Installed “Xcode Install Assistant”
coolfool [coolfool!~greg@static-50-34-26-118.evrt.wa.frontiernet.net] has joined #ruby-lang
queeway [queeway!~queequeg@c-71-202-152-67.hsd1.ca.comcast.net] has joined #ruby-lang
jredville_ [jredville_!~jredville@173-160-211-253-Washington.hfc.comcastbusiness.net] has joined #ruby-lang
<coolfool> hi, I'm new to help via IRC so please excuse any noob-style mistakes I make.
<coolfool> Basically I'm new to ruby but am writing an http proxy using it and need some help regarding it's behaviour
<coolfool> Is it better to explain my problem here or somewhere else?
mezzofanti [mezzofanti!u3033@gateway/web/irccloud.com/x-iseaquvtjdoqhixu] has joined #ruby-lang
<Spooner> coolfool: This is as good a place as any, I think.
<deryl> rue: only thing I can suggest is running sudo \$PATH_TO/Developer/Library/uninstall-devtools –mode=all and trying again. do you have the dmg or are you trying through the appstore?
lsegal [lsegal!jinx@modemcable249.109-177-173.mc.videotron.ca] has joined #ruby-lang
<kyrylo> workmad3, hey, fwiw, I've found (probably) better solution: a = ary.dup; a.map.with_index { |e, i| a.shift(i+1) }
<coolfool> Ok, well in a nutshell, I am using Eventmachine to spawn an http server for me. When I receive a message I check the contents of the message for some specific XML. I parse the XML, modify it a little and then forward it on.
<deryl> rue: if you dont have the dmg, https://developer.apple.com/downloads/download.action?path=Developer_Tools/xcode_4.1_for_lion/xcode_4.1_for_lion.dmg. we push the link in RVM's 'rvm requirements' (idk if you need any of this info, just supplying what i thought might help)
<rue> deryl: dmg, app store only has 4.2
abuiles [abuiles!u1641@gateway/web/irccloud.com/x-xeflszjkpusckzbj] has joined #ruby-lang
<deryl> rue ok
<coolfool> The problem arises when libxml raises an exception. I want to catch the exception so that I can send a meaningful response back to the client. However, the exception seems to be uncatchable in the sense that my Rescue block never seems to be called
<coolfool> I have tried catching exceptions in a separate little program which doesn't use Eventmachine and it worked perfectly which tells me that Eventmachine is somehow interupting the exception process.
<canton7> coolfool, where are you catching the exception? (or attempting to catch it)
<rue> coolfool: Or you're rescuing the wrong thing?
<workmad3> kyrylo: that is probably a bad idea... .shift modifies the array, which could cause issues if you're in the middle of iterating over it
<manveru> coolfool: well, you have to wrap the point where you call nokogiri
<manveru> you cannot rescue things that will never return to the point you called them from
davidw [davidw!~davidw@adsl-ull-23-123.51-151.net24.it] has joined #ruby-lang
<rue> Aha.
<rue> deryl &c.: Jan 3 22:43:35 pounce installd[1057]: PackageKit: Skipping component "com.apple.dt.InstallXcode.Lion" (4.1.0-49.0.0-49000000000000-*) because the version 4.2.1-70.0.0-*-* is already installed at /Applications/Install Xcode.app.
<rue> (It isn't, anymore, so the hunt continues. I bet there's a fucking plist somewhere saying that(
indeterminate [indeterminate!~sei@user-3c2h3m6.cable.mindspring.com] has joined #ruby-lang
jmontross [jmontross!~Adium@static-96-236-65-137.snfcca.dsl-w.verizon.net] has joined #ruby-lang
<coolfool> manveru: how do I know it will never return to the exception point? Is that because of eventmachine and how it schedules?
<manveru> coolfool: well, let's see
jalljo [jalljo!jalljo@unaffiliated/jalljo] has joined #ruby-lang
<manveru> you expect this to work?
<coolfool> yes
<apeiros_> you might be disappointed…
<coolfool> That would raise a runtimeerror exception
<apeiros_> depending on the definition of "work"
whatasunnyday [whatasunnyday!~whatasunn@64.175.137.28] has joined #ruby-lang
<coolfool> I see
<coolfool> so in that example the catch would have to go round the foo.call itself
<apeiros_> rescue. catch exists in ruby and has a different meaning.
<apeiros_> (same for raise vs. throw)
<coolfool> Ok, but I am not sure I understand how this example applies to what I am doing. In my code the libxml parsing function is being called in a proc block and the begin/resuce wraps all the XML blocks.
<coolfool> Sorry, not blocks, I mean function calls
tenderlove [tenderlove!~tenderlov@pdpc/supporter/active/tenderlove] has joined #ruby-lang
<coolfool> I suppose what you say is occurring actually is occuring but in not such an obvious way.
artOfWar [artOfWar!~artofwar@nat/yahoo/x-rxwvidpdvahuiujs] has joined #ruby-lang
<rue> Need moar code.
jensn [jensn!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby-lang
Carmivore [Carmivore!~carmivmor@ec2-50-16-157-158.compute-1.amazonaws.com] has joined #ruby-lang
<rue> Otherwise it's not wise
<coolfool> Ok I'll just get a pastie link
davidw [davidw!~davidw@apache/committer/davidw] has joined #ruby-lang
dfr|mac [dfr|mac!dfr|work@nat/google/x-xzwgwwkwgosmijoo] has joined #ruby-lang
jbsan [jbsan!~jbsan@c80-216-213-130.bredband.comhem.se] has joined #ruby-lang
<coolfool> Have a look at this http://pastie.org/3120867
postmodern [postmodern!~postmoder@c-71-237-178-98.hsd1.or.comcast.net] has joined #ruby-lang
<coolfool> I have tried to reduce it to the bare problem
<RickHull> your rescue block may be executed, and it returns the value of the last expression
<RickHull> in your case, it's an assignment, resp.content_length = '0'
<RickHull> you might add some debug logging inside the rescue block
Locke23rus [Locke23rus!~quassel@128-70-109-104.broadband.corbina.ru] has joined #ruby-lang
<deryl> rue: niice :)
gasbakid [gasbakid!~gasbakid@41.96.1.69] has joined #ruby-lang
<coolfool> where does the flow go after the rescue block? My final goal of asking these questions is to get my proxy to always respond to the client but the moment it doesn't (for a good reason or for a silly one).
<RickHull> coolfool: should the rescue block get executed, it looks like it would be the last expression of your proc
<RickHull> L65 - callback = proc { |res| # I notice you don't ever do anything with res
<RickHull> i am bad with procs and callbacks, so maybe this is par for the course
<RickHull> likewise I am not an EM person
<rue> Also, probably don't want to rescue Exception (in the event it's masking an expected exception)
<coolfool> rue: yes I completely agree, this was done so I could just see that it was being caught
<RickHull> it looks like you are already doing puts/p debugging
<RickHull> go ahead add some more, esp. inside the rescue
<rue> But you're NOT seeing ‘it’ caught :)
<rue> You may or may not be getting some exception
<coolfool> I have now as I have added some debug in the Rescue and it's prints fine. It's just not seding the response.....
kain [kain!~kain@151.64.233.209] has joined #ruby-lang
<RickHull> your begin block does nothing with resp, while your rescue only touches resp
<RickHull> seems odd to me...
<RickHull> i imagine there are requirements regarding the operation proc that have to be fulfilled for EM to work with it
<rue> Lifetime of resp?
<coolfool> I modelled my operation proc on this example http://www.igvita.com/2008/05/27/ruby-eventmachine-the-speed-demon/
<coolfool> the second block of code is the same as mine
gasbakid__ [gasbakid__!~gasbakid@41.96.7.67] has joined #ruby-lang
<coolfool> Interesting observation, if me debug statement is at the top of the resuce block i.e. before the resp.xxxx stuff, it displays. If it's at the end of the rescue block, it doesn't!
<rue> So, perhaps there's another error?
vmatiyko [vmatiyko!~vmatiyko@178.120.67.145] has quit [#ruby-lang]
<coolfool> rue: how would I discover the lifetime of resp and find out if it has become out of scope?
gearaholic [gearaholic!~gearaholi@c-71-238-98-243.hsd1.mi.comcast.net] has joined #ruby-lang
mrneighborly [mrneighborly!~mrneighbo@154.25.119.70.cfl.res.rr.com] has joined #ruby-lang
spleeze [spleeze!~Spleeze@173-15-131-114-BusName-Philadelphia.hfc.comcastbusiness.net] has joined #ruby-lang
spuk [spuk!~spuk@189.6.30.92] has joined #ruby-lang
<coolfool> hmm... ok I think there was another error.
<coolfool> I think it will work now!! Thanks a lot for all your help.
gasbakid__ [gasbakid__!~gasbakid@41.96.78.69] has joined #ruby-lang
srbartlett [srbartlett!~srbartlet@202.146.7.239] has joined #ruby-lang
<erikh> valid ruby: ?:??::?:
WillMars_ [WillMars_!~willmarsh@203.48.101.90] has joined #ruby-lang
<zenspider> not terribly useful, but yes, valid...
<erikh> heh
<zenspider> wonder if ruby_parser will be cool with that
<yxhuvud> erikh: Buffalo buffalo buffalo Buffalo buffalo buffalo Buffalo buffalo!
<erikh> yxhuvud: have you see Moo or Ook?
<yxhuvud> my point was that English also have quirky corners.
<erikh> basically the same idea as brainfuck, but expressed in a single word
<erikh> e.g., oOk and Ook are different operations
<erikh> there's some esoteric language site that has a domain I can't remember that has a ton of these
<yxhuvud> I do get a warning from ?:??::?: though
<erikh> on 1.9 you do
<erikh> on 1.8 you get an integer :)
<yxhuvud> well you get a ":" on 1.9 due to the changed semantics of ?:
<erikh> right
<heftig> yxhuvud: it's BbBbbbBb, not BbbBbbBb
tcurdt [tcurdt!~tcurdt@dslb-188-097-009-235.pools.arcor-ip.net] has joined #ruby-lang
<yxhuvud> heftig: both are valid, and you can generate arbitrarily long sequences if you want.
<RickHull> garafolo ruffalo huffpo juggalo
<deryl> giraffalo!
<RickHull> what do you get when you cross an elephant with a rhino?
<heftig> yxhuvud what's the sentence structure for the latter?
<deryl> an elephino?
<RickHull> s/an// exactly
<RickHull> it works better out loud, in an american accent
<deryl> that sort of like a moose is oen from a pack of moose, though i prefer meese because mosinee just sounds wrong? :)
<deryl> s/oen/one/
<erikh> like people who say virii or penii
jensn_ [jensn_!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby-lang
<deryl> thus would elephino be both the singular and the plural?
<RickHull> hell if i know
<erikh> heh.
<deryl> damn, was hoping to have that one solved too
SuperTaz_work [SuperTaz_work!~supertaz_@38.99.52.59] has joined #ruby-lang
<yxhuvud> ((Adverb, noun), (verb, ((Adverb, noun), (verb, (Adverb, noun))))). oslt.
<heftig> you mean Adjective?
<yxhuvud> erhm. yes.
<heftig> hrm, i don't see how that works
<heftig> just seems wrong to me
<deryl> damn, eye crossing image there removing the words and leaving the parens (()((()(()))))
blowmage [blowmage!~blowmage@humanecode.new.xen.prgmr.com] has joined #ruby-lang
<RickHull> irssi lisp-mode FTW?
<deryl> heh
simon_weber [simon_weber!u4119@gateway/web/irccloud.com/x-pxbcfcfwfahdzula] has joined #ruby-lang
spleeze [spleeze!~Spleeze@173-15-131-114-BusName-Philadelphia.hfc.comcastbusiness.net] has joined #ruby-lang
<yxhuvud> heftig: I might have made a mistake somewhere. But in general, there are more than one way of capitalizing, since both (Adj noun verb ..) and (noun Adv verb ..) is possible.
Jay_Levitt [Jay_Levitt!~Jay_Levit@c-24-63-250-125.hsd1.ma.comcast.net] has joined #ruby-lang
jbsan [jbsan!~jbsan@c80-216-213-130.bredband.comhem.se] has joined #ruby-lang
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby-lang
butchanton [butchanton!~butchanto@vpn-sanfran.exacttarget.com] has joined #ruby-lang
<jaimef> "192.168.15.1".split('.')[-3..-1].each { |x| x.to_s(16) if x} # what am I doing wrong?
<jaimef>
<zenspider> how the hell should we know?
<zenspider> corundum: questions?
<jaimef> ahh .to_i first
<RickHull> "192.168.15.1".split('.')[-3..-1] #=> ["168", "15", "1"]
<RickHull> looks "wrong" to me
<zenspider> .last(3)
<erikh> are you trying to do netmask calculation or get a raw ip?
<jaimef> convert ip -> hex
<erikh> ok so the latter
<manveru> erikh to the rescue!
<erikh> haha
<erikh> sorry, I'll step back, sorry
<jaimef> x.to_i.to_s(16) works
<jaimef> I am sure pack() would be cleaner
<zenspider> for some definition of "works"... the block is still useless
<jaimef> got my dword.
<manveru> >> require 'ipaddr'; IPAddr.new('192.168.15.1').to_i.to_s(16)
<manveru> => "c0a80f01"
<manveru> now someone's gonna bash ipaddr
<erikh> I wrote an alternate implementation but it's not as good
<erikh> (or nearly as fast)
<jaimef> only needed the last 3 octets to form a mac address
<manveru> becaue yours tries to be correct? :)
<erikh> haha something like that
<manveru> well, it works fine for simple stuff like this
<erikh> it has better controls for CIDR
<erikh> that's really about it.
<zenspider> I like the ipaddr one. that's clean
<zenspider> mine was "%02x.%02x.%02x.%02x" % "192.168.15.1".scan(/\d+/).map(&:to_i)
<corsican> I have a stupid question
<corsican> what does the ampersand do there?
<corsican> I've never quite been able to figure that out, and it's hard to google for it
<RickHull> it's a shortcut for calling an operation on the map arg
<corsican> map(&:to_i) <== here
<RickHull> ary.map { |s| s.to_i }
<corsican> ahh okay
<corsican> like, that would have been my guess, but I wasn't sure
<corsican> is that always a shortcut for that notation?
<corsican> or does it only work in certain circumstances
<manveru> it calls to_proc on the right obejct
<manveru> *object
<jaimef> "192.168.15.1".split('.').last(3).map {|x| "%.2x" % x }.join(":") #still ugly but works
<manveru> Symbol#to_proc always expands to that
<corsican> cool... thanks
<manveru> jaimef: you should try that in java sometimes :)
<workmad3> manveru: stop scaring people :P
<RickHull> ip.split('.').map(&:"%") # no way to pass an arg?
<manveru> no
<RickHull> no quotes needed, apparently
<RickHull> entering perlish realms...
<workmad3> CannedCorn: /wi2
<zenspider> corsican: to be pedantic: &:to_i -> :to_i.to_proc -> proc { |x| x.to_i }
Axsuul [Axsuul!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby-lang
<zenspider> then that block gets used for the map
<corsican> zenspider: pedantic is how I learn :) thanks
<corsican> is there a good definitive doc page on that operator?
<zenspider> there's an implied "&" on the front of all of those, so that the proc gets used as a proc in map
<corsican> I couldn't find anything in the pickaxe book on it
<erikh> "192.168.1.15".split('.').inject(0) { |x, y| x << y.to_i }.to_s(16)
<erikh> should work
<RickHull> could you transit a second arg to map, theoretically? e.g. ip.split('.').map(&:%, "%.2x")
<RickHull> arg1 is the method name, arg2 is the first arg passed
<erikh> although if you want it to be in network byte order (the right way), you want to reverse the array I think
<workmad3> RickHull: you could probably curry the method or something
<zenspider> Standard Protocols And Coercions in the pickaxe goes over it, a bit
<corsican> cool thx
Pip_ [Pip_!~Pip@host-189-146-66-217.spbmts.ru] has joined #ruby-lang
Pip_ [Pip_!~Pip@unaffiliated/pip] has joined #ruby-lang
<erikh> derp I fail
<erikh> going back to work now
<RickHull> er, my example is fucked. i got the strs swapped on String#%
<erikh> "192.168.15.1".split('.').inject(0) { |x, y| x += y.to_i; x << 8 }.to_s(16)
<erikh> there!
<erikh> knew I was close
mdel_ [mdel_!~mdel@pool-71-175-17-16.phlapa.fios.verizon.net] has joined #ruby-lang
nofxx [nofxx!~nofxx@unaffiliated/nofxx] has joined #ruby-lang
<zenspider> fuck I hate rails code
<drbrain> erikh: IPAddr.new("192.168.15.1").to_i.to_s(16) ??
<erikh> drbrain: yeah, we were just discussing alternative approaches
<erikh> manveru already belted that out
<erikh> drbrain: do you remember if raw ip is network ordered or little-endian?
<erikh> I can't
<drbrain> I don't
<drbrain> the IPAddr approach also works with IPv6 addresses
aroop [aroop!~aroop@67.139.104.203] has joined #ruby-lang
<erikh> right
<erikh> the ipv6 parser I wrote is *hairy*
<erikh> I don't envy ISC
<manveru> hmm
<manveru> wow, i didn't know pack can return pointers now
<manveru> isn't that fun?
<bougyman> huh?
tomzx [tomzx!~tomzx@dsl-216-221-39-59.aei.ca] has joined #ruby-lang
rob__ [rob__!~rob@dust.cx] has joined #ruby-lang
<rob__> hi
<manveru> headius: i guess jruby doesn't implement p or P
<RickHull> erikh: i can't imagine that a raw ip wouldn't be in network order
<rob__> is there a ruby method that will join '//foo//', '/bar', 'baz' => /foo/bar/baz?
<manveru> File.join
<rob__> File.join doesn't get rid of the extra slashes
<erikh> RickHull: yeah, me neither, but there it is from the IPAddr lib
<headius> pack has always has p, but what a weird feature
<manveru> rob__: the leading ones?
<rob__> yeah
<manveru> guess you gotta squeeze them yourself then
looopy_ [looopy_!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby-lang
<rob__> hmm, why would File.join leave them?
<manveru> >> ['//foo//', '/bar', 'baz'].join('/').gsub(/\/+/, '/')
<manveru> => "/foo/bar/baz"
<erikh> is there some reason they need to be elided?
<manveru> not really
<erikh> foo//bar//baz is legal on a unix fs at least
<rob__> pretty urls
<rob__> in sinatra
<manveru> so not for paths
<lianj> manveru: hehe, FFI::Pointer.new(["Hello, World!"].pack('P').unpack('L')[0]).read_string(100) not sure if it adds a "\x00" of its just by chance
<erikh> I think running this through URI might normalize it
<erikh> but don't hold me to that.
<lianj> s/of/or/
<manveru> erikh: P is null-terminated
<bougyman> #squeeze "/"
<manveru> or not?
<erikh> hell if I know
<manveru> i forgot which one it is already
<canton7> rob__, parts.chomp('/').join('/') maybe?
<erikh> I don't use FFI
RomD`` [RomD``!~Roman@nrbg-4d0774f1.pool.mediaWays.net] has joined #ruby-lang
<manveru> canton7: chomp is at the end
<manveru> erikh: not FFI, pack
<lianj> manveru: so it makes a new string and gives you the pointer to it?
<rob__> bougyman: thanks!
<manveru> erikh: oh, sorry
gasbakid__ [gasbakid__!~gasbakid@41.96.53.8] has joined #ruby-lang
<manveru> i mixed you up with lianj
<manveru> damn, i gotta change the highlight to something readable
<zenspider> FUCK rails is the most developer hostile environment I've come across in a long long time
<bougyman> indeed
<bougyman> unless youbdrank the koolaid.
<zenspider> I look forward to the day we shoot bundler in the head
<bougyman> then ita rainbows and unicorns
<zenspider> and a comple devaluation of your time
<shevy> where is the rails love here :(
<rob__> ive always tried to work out what the point of rails is, is it just like using sinatra but with a built in database?
<shevy> dunno
<shevy> perhaps it is just for marketing tricks
<shevy> "they use raaaaaaaaaaaaails!"
<shevy> sounds kinda cool doesn't it?
<RickHull> sinatra is just like rails but without the legacy
<rob__> RickHull: how do you mean?
<rob__> honestly im rails clueless
<RickHull> rails came first. sinatra (IIRC) tried to keep the best parts
<rob__> i picked up sinatra and liked it so havent used anything else
<shevy> hehe
<RickHull> rails are so mid-19th century. we need tarmac
<RickHull> and hydroplanes
<wmoxam> RickHull: or maybe a Maglev
<RickHull> oh snap! ;)
<RickHull> i'll settle for a gyrocopter
<workmad3> RickHull: the new web framework will be Ruby Flying Cars!
<shevy> hmm
<shevy> gunship-on-rails
<wmoxam> Ruby on Teleporters
<shevy> Ruby in Bikinis
<RickHull> pythons on planes is my favorite
<shevy> hmm
<wmoxam> Ruby's gone wild!
<bougyman> bikinis sounds best
<shevy> lua on LSD
<shevy> does perl have something like that? I mean... ruby on rails... pythons on planes (lol poor pythons)
<manveru> of course
<robgleeson> Perl on broken promises
<robgleeson> cha ching
<lianj> shevy: i think it called lua on zedshaw
<wmoxam> Perl on Peyote
<erikh> Perl has several nice frameworks
* erikh sighs
<robgleeson> erikh: sorry I couldn't resist the Perl6 pun
<bougyman> perlMVC
<shevy> haha
<erikh> it's called Catalyst
AndChat| [AndChat|!~AndChat@222.153.223.45] has joined #ruby-lang
<erikh> and the ORM makes AR look like a toy
<robgleeson> yeah
<robgleeson> from mst
<robgleeson> socialable guy
<erikh> yep
imperator [imperator!~Daniel@63-225-247-192.hlrn.qwest.net] has joined #ruby-lang
<erikh> hehe yes
<erikh> he's nice enough when you really get to know him
<bougyman> erik: so does Sequel
<manveru> actually BBC made Perl on Rails, afaik
* imperator just got here, wonders who erikh is referring to, but has some guesses :)
<erikh> mst
<mrneighborly> bougyman: last time i used sequel, i went back to AR and regretted ever going down that road :( bugs bugs bugs but that might have changed now
<imperator> who?
<erikh> matt trout, DBIC guy
<manveru> mrneighborly: 2006?
<imperator> oh, perl dude
<erikh> yes
<erikh> I'm here to defend perl from the haters
<mrneighborly> manveru: nah more recently than that, though to be fair it has been a couple year probably
<mrneighborly> just got in too deep and it bit me hard to try to back out of it. left me scarred :)
<imperator> erikh, why? ;)
<erikh> eh, bored @ work
<RickHull> someone is wrong on the internet
<erikh> exactly.
<imperator> manveru, i knew a guy who did perl at bbc i think
<shevy> hmm psychos
<imperator> ovid
<erikh> he's at booking.com now
<erikh> along with just about everyone else relevant in the perl community
<erikh> not *everybody*, but quite a few
<shevy> sounds like a perl graveyard
<imperator> ouch
<manveru> mrneighborly: that kinda describes my experience with AR :)
<robgleeson> erikh: mst is?
<mrneighborly> manveru: yeah AR has its warts, i just know how to work around them. :P i'm sure if i spent time with sequel or datamapper i could figure out how to work within them the same way
<erikh> mst is actually a pretty fun guy, just has a very low tolerance for ignorance
<robgleeson> I thought he ran shadowcats
<manveru> mrneighborly: but at that time, Og was still hot
<erikh> oh, no he's not at booking.
<AndChat|> I had a meta programming battle with mst last year
<shevy> meta what
<shevy> in perl?
<mrneighborly> manveru: quite right. what happened to Og/nitro? did it die? somehow camping still rolls on merrily.
<manveru> camping is a lot less maintenance-intensive
<manveru> and yeah, they died
<shevy> hmm
savage-_ [savage-_!~savage-@209.118.197.220] has joined #ruby-lang
<manveru> trans took over og, and gmosx went on to js
gasbakid [gasbakid!~gasbakid@41.96.9.197] has joined #ruby-lang
<shevy> wha
<mrneighborly> this is true. i'm always surprised at new people picking it up. i would think sinatra would be what most people actually use these days for what i would have used camping for. then again, it's fun to play with
<shevy> doesn't trans have like 8795389735 projects already
<manveru> shevy: that's why it's dead :)
<manveru> also... it dependend heavily on facets
<shevy> hehe
yfeldblum [yfeldblum!~Jay@c-98-218-48-253.hsd1.md.comcast.net] has joined #ruby-lang
srbaker [srbaker!~srbaker@184.66.82.213] has joined #ruby-lang
<manveru> lianj: i'm kinda puzzled by the fact that FFI can read the string from the P result
<erikh> it's just a pointer, right?
<manveru> yeah
<erikh> then .... why are you surprised? :)
<manveru> "pointer to a structure (fixed-length string)"
<manveru> because it claims not to be zero-terminated
<erikh> oh, I see.
<lianj> manveru: from my short tests it looks like it always is
<erikh> are you sure you're not running into a null elsewhere? (like in a struct as a member immediately after the string)
<erikh> "implementation defined", but it's almost always like that
<manveru> yeah, might be
<lianj> like if its a new string and not just the pointer to that string passed to pack
<lianj> yea, or that
<manveru> still weird
<manveru> where is the length stored?
<erikh> RSTRING(str)->len
<erikh> IIRC
<erikh> so however RSTRING works under the hood, probably in ruby.h
<erikh> or the split up files that ruby.h now encapsulates
<drbrain> erikh: RSTRING_LEN
<erikh> I thought ... which one is the 1.8 version?
<drbrain> erikh: strings no longer (necessarily) have a filled-in len pointer
<erikh> gotcha
<drbrain> RSTRING(str)->len
<erikh> actually, that might be what you're hitting manveru
<drbrain> in 1.9, short-enough strings are stored in the object header and don't have a separate allocation
<erikh> oh neat
<shevy> sounds clever
<drbrain> same for arrays
<manveru> testing
<shevy> failed
<manveru> got a segfault
<manveru> yay
<manveru> now let's see how it failed :)
<manveru> ok, that was because it's not L but Q
<manveru> on 64bit anyway
jacobwg [jacobwg!~jacobwg@94.sub-75-224-214.myvzw.com] has joined #ruby-lang
<manveru> terminated it at length 400_000, this isn't gonna work
<zenspider> welcome to FFI hell?
Newbs [Newbs!~textual@host-78-144-71-110.as13285.net] has joined #ruby-lang
<manveru> not really...
<manveru> just wanted to see what the difference between p and P is
rob__ [rob__!~rob@dust.cx] has quit [#ruby-lang]
<dreinull> is there a best practice for writing longer || and && statements?
andrewhl [andrewhl!~andrew@24-246-15-43.cable.teksavvy.com] has joined #ruby-lang
<RickHull> dreinull: paste what you are considering
<RickHull> generally, best practice is: don't get too cute
<erikh> I put the || and && at EOL
<erikh> and indent the next line
<erikh> indentation is free
<RickHull> same. though i tend to use and/or
<zenspider> ditto with both suggestions...
<zenspider> and I refactor so they're not so long
<dreinull> here it is: http://fpaste.org/q7Ft/
<dreinull> zenspider: you're the minitest man?
<zenspider> that seems sane
<zenspider> I am
<zenspider> I wouldn't indent a 3rd time tho
<manveru> oh screw that, there is simply no difference between p and P
<zenspider> heh
<manveru> any case i could come up with, they even return the same address
<dreinull> zenspider: just gave it a try with more indents but I'm not really happy with it eiher
<manveru> time for code reading
<lianj> manveru: heh, at least in code there is https://github.com/ruby/ruby/blob/trunk/pack.c#L949
<dreinull> zenspider: is there a way to call a single describe or it block in minispec?