Topic for #ruby is now Ruby programming language || ruby-lang.org || RUBY SUMMER OF CODE! rubysoc.org/ || Paste >3 lines of text in http://pastie.org || Para a nossa audiencia em portugues http://ruby-br.org/
strife25 [strife25!~strife25@cpe-098-026-018-050.nc.res.rr.com] has joined #ruby
<shevy> hmm
jensn [jensn!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby
theRoUS [theRoUS!~KenCoar@apache/committer/coar] has joined #ruby
<shevy> does it work adeponte ?
<shevy> in my ruby code, it seems I use uid = Etc.getpwnam("name_here").uid
<adeponte> shevy: trying it out right now
<shevy> oh
<shevy> just noticed
<shevy> that's what the docu says
<shevy> good that it returns a Struct :)
zakwilson [zakwilson!~quassel@c-69-180-70-100.hsd1.fl.comcast.net] has joined #ruby
<adeponte> shevy: yeah, that works thx
xcyclist [xcyclist!~xeno@rev-66-150-171-4.rhapsody.com] has joined #ruby
<xcyclist> ls
<xcyclist> Say, what is the standard place to ask for rails sanity help these days?
replore_ [replore_!~replore@203.152.213.161.static.zoot.jp] has joined #ruby
nari [nari!~nari@2001:268:306:1:58f5:8bff:fec8:c51d] has joined #ruby
tyman [tyman!~tyman@173-12-219-189-Fresno.hfc.comcastbusiness.net] has joined #ruby
skrewler [skrewler!~skrewler@209.213.206.58] has joined #ruby
skrewler [skrewler!~skrewler@209.213.206.58] has joined #ruby
<shevy> try #one-step-before-hell
<shevy> aka #rubyonrails I suppose
<shevy> I am blissfully and totally unaware of rails :)
<shevy> I wonder though how much one can "componentize" web-related things together into useful "web apps"
<shevy> using just simple things, and not behemoth-like solutions like rails
thomascioppett-1 [thomascioppett-1!~thomascio@cpe-071-071-047-213.triad.res.rr.com] has joined #ruby
toy_battery [toy_battery!~toy_batte@216.101.134.134] has joined #ruby
<Radar> shevy: Sinatra.
<Radar> Yes, Rails is big. Deal with it.
zakwilson [zakwilson!~quassel@c-69-180-70-100.hsd1.fl.comcast.net] has joined #ruby
BrenoPerucchi [BrenoPerucchi!~BrenoPeru@177.16.200.222] has joined #ruby
saltmiser [saltmiser!~chatzilla@70.15.225.198.res-cmts.ovr.ptd.net] has joined #ruby
<shevy> lol
<shevy> Radartrollolol.
<Radar> bingo.
<Okasu> nanoc
<Okasu> sinatra cant generate static
<Okasu> and generate stuff all over ageain
<BrenoPerucchi> Please someone can help me?
<toy_battery> whats up?
<BrenoPerucchi> User.current.id =>4
<BrenoPerucchi> User.current.inspect =>nil
<toy_battery> rails?
<shevy> he isn't very verbose is he
<BrenoPerucchi> Yes -> class Log < ActiveRecord::Base
<toy_battery> maybe ask someone in the rails room, i dunno
<BrenoPerucchi> Current.user.id should not have any value
<BrenoPerucchi> ok
<BrenoPerucchi> toy_battery: ok
thomascioppettin [thomascioppettin!~thomascio@cpe-071-071-047-213.triad.res.rr.com] has joined #ruby
<Radar> BrenoPerucchi: Yes it should, id == 4 is showing you the object's id.
apok_ [apok_!~apok@c-107-3-149-167.hsd1.ca.comcast.net] has joined #ruby
randym [randym!~randym@113x33x226x118.ap113.ftth.ucom.ne.jp] has joined #ruby
<BrenoPerucchi> Radar: but in the inspect the value is nil
<Radar> BrenoPerucchi: nil's id is 4.
<BrenoPerucchi> Radar: hunn
giorni [giorni!~giorni@189.61.134.69] has joined #ruby
milkpost [milkpost!~dec@173-28-195-157.client.mchsi.com] has joined #ruby
<BrenoPerucchi> Radar: something is very wrong when I call User.current.id on console back to me the value 4
<Radar> BrenoPerucchi: Sigh. Please go learn Ruby.
<Radar> BrenoPerucchi: Learn that everything, even nil, is an object. Learn that each object has its own object id, and that nil's is 4.
logic [logic!~logic@unaffiliated/bitch333z] has joined #ruby
zitchdog [zitchdog!~textual@173-25-169-137.client.mchsi.com] has joined #ruby
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby
headius [headius!~headius@71-210-151-185.mpls.qwest.net] has joined #ruby
<BrenoPerucchi> Radar: thks for the help.. I will try to study more. One more thing in console production the value is 4 and development the value is nil
statarb3 [statarb3!~CoreD@546A56AA.cm-12-3b.dynamic.ziggo.nl] has joined #ruby
statarb3 [statarb3!~CoreD@unaffiliated/statarb3] has joined #ruby
dv310p3r [dv310p3r!~dv310p3r@adsl-65-3-161-18.mia.bellsouth.net] has joined #ruby
latentflip [latentflip!~latentfli@cpc5-sgyl34-2-0-cust609.sgyl.cable.virginmedia.com] has joined #ruby
dv310p3r [dv310p3r!~dv310p3r@adsl-65-3-161-18.mia.bellsouth.net] has joined #ruby
epochwolf|2 [epochwolf|2!~epochwolf@unaffiliated/epochwolf] has joined #ruby
devdazed [devdazed!~russ_nyc@cpe-74-66-233-162.nyc.res.rr.com] has joined #ruby
pabloh [pabloh!~pablo@186.22.82.39] has joined #ruby
thomascioppett-1 [thomascioppett-1!~thomascio@cpe-071-071-047-213.triad.res.rr.com] has joined #ruby
<BrenoPerucchi> Radar: I found the caller that gives me the number 4 --> Thread.current[:user].id
<Radar> aaaand guess who's going on ignore
sbanwart_ [sbanwart_!~sbanwart@99-177-126-136.lightspeed.bcvloh.sbcglobal.net] has joined #ruby
saltmiser [saltmiser!~chatzilla@70.15.225.198.res-cmts.ovr.ptd.net] has joined #ruby
<shevy> Radar you
samxor [samxor!samxor@70.32.34.103] has joined #ruby
<davidcelis> aaahhhhhhh this is just gold
<shevy> :)
al3xnull [al3xnull!~al3xnull@cpe-76-188-178-7.neo.res.rr.com] has joined #ruby
banisterfiend [banisterfiend!~baniseter@118.82.185.158] has joined #ruby
ciopte7 [ciopte7!~thomascio@cpe-071-071-047-213.triad.res.rr.com] has joined #ruby
AndChat- [AndChat-!~AndChat@222.153.223.47] has joined #ruby
<ciopte7> BrenoPerucchi: Go through the ruby koans
thomascioppett-1 [thomascioppett-1!~thomascio@cpe-071-071-047-213.triad.res.rr.com] has quit [#ruby]
<BrenoPerucchi> :/
<davidcelis> no, seriously
<davidcelis> you need to learn Ruby :P
<toy_battery> yeah dude
<toy_battery> nil.object_id
<toy_battery> => 4
<toy_battery> lol
ChampS_ [ChampS_!~ChaosBot@p54B4CA30.dip.t-dialin.net] has joined #ruby
jensn_ [jensn_!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby
<toy_battery> it's fairly easy language to learn, even the meta stuffs
edward_ [edward_!~ipsifendu@c-67-169-223-202.hsd1.or.comcast.net] has joined #ruby
<toy_battery> the reset is just gaining experience
<toy_battery> *rest
<BrenoPerucchi> hehe :) ok guys I will.... I have only three years of programming.
ryh [ryh!~ryh@174.45.125.160] has joined #ruby
<AndChat-> BrenoPerucchi: if you believe in yourself you can do anything
<toy_battery> go... for the gold!
latentflip [latentflip!~latentfli@cpc5-sgyl34-2-0-cust609.sgyl.cable.virginmedia.com] has joined #ruby
<toy_battery> three years is more than i have
<toy_battery> but some guys have way more but it's just the first year repeated over and over again
<toy_battery> seems like they don't want to know WHY things do what they do
zitchdog [zitchdog!~textual@173-25-169-137.client.mchsi.com] has joined #ruby
apok [apok!~apok@c-107-3-149-167.hsd1.ca.comcast.net] has joined #ruby
<ciopte7> 3 years is more than I have as well...
<AndChat-> toy_battery: better learn C
freenodiz [freenodiz!~IceChat77@unaffiliated/freenodiz] has joined #ruby
<toy_battery> AndChat-: planning to
<BrenoPerucchi> AndChat-: I do I made many things in this 3 years... I learning a while about ruby,jquery,java,sql... And 2011 I did my first application in the web. Ecommerce with business managment. But I know that need to improve more and more
pen [pen!~pen@140.112.30.131] has joined #ruby
<freenodiz> hello, do you know this framework? http://pakyow.com/ it seems nice and minimalistic...any feedback?
<toy_battery> i know some basic C stuff but not enough
sj26 [sj26!sj26@sj26.com] has joined #ruby
<toy_battery> but i know most of what i'll be doing in school will be in C or CPP
<toy_battery> hopefully all the math i took will pay off...
<davidcelis> totally read that as meth
<toy_battery> hahah
<toy_battery> i spent a little time with Haskell
<jergason> toy_battery: if you want to do cool stuff like AI and ML
<jergason> toy_battery: then math is awesome
<jergason> i regret not learning more math
<AndChat-> Many programmers seem embarrassingly bad at math
<toy_battery> i'm not positive what i want to do exactly with programming but i know i like parsing
v0n [v0n!~v4n@bas1-montreal19-1177820429.dsl.bell.ca] has joined #ruby
<Okasu> haskell, lol
youdonotexist [youdonotexist!~youdonote@c-67-166-121-94.hsd1.ut.comcast.net] has joined #ruby
<Avi`> I have a hash like this, http://pastie.org/private/oospkwbpprosc0f1ibnoa (generated by a group_by) and im trying to smush it down to it says {"Item A"=>[b, b], "Item B" => [b,b]}
<Okasu> lang for trolling onf forums
<Avi`> but when i tried a map it only gave me a single [b]
<Okasu> toy_battery: learn Ada, peach
<toy_battery> ada?
<Avi`> worlds first programmer?
<toy_battery> haha
<toy_battery> i've heard of it
<toy_battery> i meant why?
<toy_battery> there's all this information out there talking about how functional languages are gonna rule the world in the near future
<Okasu> шеэы екщддштп
<Okasu> it's trolling
_|christian|_ [_|christian|_!~christian@190.236.233.157] has joined #ruby
jbw [jbw!~jbw@dsl-044-084.cust.imagine.ie] has joined #ruby
Targen [Targen!~iguana@190.39.181.108] has joined #ruby
<toy_battery> ruby, so far, feels the most natural
Marco [Marco!~marco@Marco-2.Kiewit.dartmouth.edu] has joined #ruby
<BrenoPerucchi> current_user = User.current.id if User.current.class.superclass.name != "Object"
<BrenoPerucchi> ops... sorry guys wrong window
<toy_battery> whoa dude
<davidcelis> .....
<davidcelis> wow that is just
<davidcelis> lol
<LiquidInsect> oh dude no
<toy_battery> ;_;
<davidcelis> sigh
mikeric [mikeric!~mike@96.49.104.175] has joined #ruby
<toy_battery> that deserves an rotflmfao
<LiquidInsect> BrenoPerucchi: please don't do that, you need to program as though the person who maintains your code will be a psychotic murderer who knows where you live
<canton7> if I ever saw that in a bit of code I was maintaining, there would be many, loud, WTFs
<BrenoPerucchi> sorry but solved my problem :)
<toy_battery> you don't need to do that though
Banistergalaxy [Banistergalaxy!~AndChat@222.153.223.45] has joined #ruby
<davidcelis> LOL
<LiquidInsect> BrenoPerucchi: at the worst, current_user = User.current.id unless User.current.nil?
<LiquidInsect> I mean even that's bad
<adeponte> so I have been using Process.uid and Process.euid to change the id of the user a process is running as, though it doesn't load that users environment. Does anyone know an easy way to have the environment load that users environment
Seisatsu [Seisatsu!~seisatsu@2001:5c0:1000:a::5e7] has joined #ruby
<davidcelis> First of all, why alias User.current to current_user?
<davidcelis> use one or the other
<davidcelis> though I have never in my life seen User.current
<davidcelis> Why does your user class need to know about the current user?
<toy_battery> LiquidInsect: at best?
<BrenoPerucchi> davidcelis: I use an plugin called SentientUser to transfer current_user to model
<LiquidInsect> toy_battery: no, that's at worst
<toy_battery> hehe
<LiquidInsect> toy_battery: at best your User model doesn't know who the current user is
<davidcelis> ^
nowthatsamatt [nowthatsamatt!~nowthatsa@adsl-98-85-31-238.mco.bellsouth.net] has joined #ruby
<davidcelis> User model should be able to remain ignorant to the current user
<LiquidInsect> You might want to know current user in a controller or something
<LiquidInsect> but not in the model
<BrenoPerucchi> This is for now, then I'll refactor the code. but now I need to solve
rpowell [rpowell!~rpowell@CPE-124-176-74-65.lns7.cht.bigpond.net.au] has joined #ruby
<davidcelis> :P
<BrenoPerucchi> def self.logger(record, msg)
<BrenoPerucchi> current_user = User.current.id unless User.current.nil?
<BrenoPerucchi> current_user ||= record.user.id rescue nil
<BrenoPerucchi> record.logs.create(:user_id => current_user, :description => msg, :store_id => current_store )
<BrenoPerucchi> end
<BrenoPerucchi> sorry for the paste
<davidcelis> oh dude no
sbanwart__ [sbanwart__!~sbanwart@99-177-126-136.lightspeed.bcvloh.sbcglobal.net] has joined #ruby
<BrenoPerucchi> hehehe.... I only see that "Ohh dude no" Ohh no" "WFT"
<toy_battery> 'WFT'??? dude dude
fungoat [fungoat!~fungoat@230.163.91.184.cfl.res.rr.com] has joined #ruby
<davidcelis> dude WFT
<davidcelis> god
<davidcelis> this is too much for me, i have to go lie down
<toy_battery> my stomach hurts from laughing
<BrenoPerucchi> toy_battery: I am saying that I only see it on me
milkpost [milkpost!~dec@173-28-195-157.client.mchsi.com] has joined #ruby
andrewhl [andrewhl!~andrew@24-246-15-43.cable.teksavvy.com] has joined #ruby
<BrenoPerucchi> toy_battery: Sorry I did not want to be misunderstanding
<toy_battery> dude just spend some time with ruby
<toy_battery> open up irb or pry, bust out a book and soak up the knowledge
<BrenoPerucchi> heheh... ok dude
<BrenoPerucchi> :)
<toy_battery> cool
<toy_battery> in fact the best advice i can give you is to always have a terminal open with pry or irb running
<deryl> pry > irb
<toy_battery> pry for sure
j3r0m3 [j3r0m3!~j3r0m3@50-0-128-97.dsl.dynamic.sonic.net] has joined #ruby
straind` [straind`!~stupidper@n124s123.bbr1.shentel.net] has joined #ruby
colint_ [colint_!~ColinT@69-11-97-130.regn.static.sasknet.sk.ca] has joined #ruby
<BrenoPerucchi> toy_battery: thanks for the advise
Banistergalaxy [Banistergalaxy!~AndChat@222.153.223.46] has joined #ruby
hadees [hadees!~hadees@72-48-91-73.dyn.grandenetworks.net] has joined #ruby
fris [fris!~email@d24-141-68-148.home.cgocable.net] has joined #ruby
colint [colint!~ColinT@69-11-97-130.regn.static.sasknet.sk.ca] has joined #ruby
MUILTR [MUILTR!~MLINTH@adsl-98-80-247-84.mcn.bellsouth.net] has joined #ruby
bennett_ [bennett_!~bennett@75-101-96-184.dsl.static.sonic.net] has joined #ruby
colint_ [colint_!~ColinT@69-11-97-130.regn.static.sasknet.sk.ca] has joined #ruby
bennett_ [bennett_!~bennett@75-101-96-184.dsl.static.sonic.net] has joined #ruby
headius [headius!~headius@71-210-151-185.mpls.qwest.net] has joined #ruby
albemuth [albemuth!~albemuth@201.198.78.18] has joined #ruby
jbhewitt [jbhewitt!~jbhewitt@c122-108-214-224.rochd4.qld.optusnet.com.au] has joined #ruby
anoNxeRo [anoNxeRo!~LessIsMor@unaffiliated/nu253r/x-0655220] has joined #ruby
sbanwart__ [sbanwart__!~sbanwart@99-177-126-136.lightspeed.bcvloh.sbcglobal.net] has joined #ruby
r0bby [r0bby!~wakawaka@guifications/user/r0bby] has joined #ruby
jbpros [jbpros!~jbpros@213-177-112-217.dyn.adsl.belcenter.be] has joined #ruby
ferbass [ferbass!~ferbass@177.35.204.136] has joined #ruby
philcrissman_ [philcrissman_!~philcriss@c-174-53-217-149.hsd1.mn.comcast.net] has joined #ruby
zitchdog [zitchdog!~textual@173-25-169-137.client.mchsi.com] has joined #ruby
linoj [linoj!~linoj@68-114-184-254.static.davl.vt.charter.com] has joined #ruby
marcuspat [marcuspat!~marcuspat@c-76-105-213-37.hsd1.or.comcast.net] has joined #ruby
Banistergalaxy [Banistergalaxy!~AndChat@222.153.223.45] has joined #ruby
Doppp [Doppp!~Doppp@unaffiliated/doppp] has joined #ruby
Carmivore [Carmivore!~carmivmor@ec2-184-73-109-201.compute-1.amazonaws.com] has joined #ruby
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby
<adeponte> ok, I need some ideas because I am a little stumped. I need to have my ruby application run as another user so I have been using Process.uid which works great.
TheIronWolf [TheIronWolf!~theironwo@208.90.215.35] has joined #ruby
<adeponte> However, my ruby application also needs to run commands on the command line as well. I have been using IO.popen for this however I am having some difficulties.
<adeponte> It seems that some things think that I am running commands as the user and other things don't
<adeponte> For example when I run "whoami" via IO.popen it outputs that I am the correct user "rpi"
<adeponte> However if I run "bash -l -c 'whoami'" it says I am the correct user but I get an error saying it can't read /root/.bash_profile
<adeponte> This tells me one of two things, either that bash is looking at some environment variable to figure out the path to the .bash_profile
<adeponte> or that bash thinks I am a different user
<adeponte> I am guessing it is the first case, but I have no idea how to set the environment to the environment of the user I want the application to run as.
<adeponte> Does anyone have any ideas?
wookiehangover [wookiehangover!~wookiehan@c-67-161-138-118.hsd1.co.comcast.net] has joined #ruby
froy [froy!~troy@manuel.dublan.net] has joined #ruby
edsono [edsono!~edsono@186.207.193.191] has joined #ruby
edsono [edsono!~edsono@186.207.193.191] has quit [#ruby]
wookiehangover [wookiehangover!~wookiehan@c-67-161-138-118.hsd1.co.comcast.net] has joined #ruby
anoNxeRo [anoNxeRo!~LessIsMor@unaffiliated/nu253r/x-0655220] has joined #ruby
Banistergalaxy [Banistergalaxy!~AndChat@222.153.223.43] has joined #ruby
vjacob [vjacob!~vjacob@87.61.170.233] has joined #ruby
BIGBOOMBA [BIGBOOMBA!43288ea7@gateway/web/freenode/ip.67.40.142.167] has joined #ruby
austinbv [austinbv!~austinbv@65-134.127-70.tampabay.res.rr.com] has joined #ruby
pen [pen!~pen@140.112.30.131] has joined #ruby
notbrent [notbrent!~notbrent@68-191-45-21.dhcp.nwtn.ct.charter.com] has joined #ruby
jessemc [jessemc!~jessemc@S01060018396a08f6.ed.shawcable.net] has joined #ruby
pencilcheck [pencilcheck!~pen@dhcp1.csie.ntu.edu.tw] has joined #ruby
achiu [achiu!~Adium@ip68-5-18-17.oc.oc.cox.net] has joined #ruby
fungoat [fungoat!~fungoat@230.163.91.184.cfl.res.rr.com] has joined #ruby
amerine [amerine!~mturner@67.204.184.82] has joined #ruby
Pip_ [Pip_!~Pip@unaffiliated/pip] has joined #ruby
gen0cide_ [gen0cide_!~TigerBloo@Wilkins3.static.monkeybrains.net] has joined #ruby
halcyonCorsair [halcyonCorsair!~quassel@2404:130:0:1000:e269:95ff:fe3c:c570] has joined #ruby
sbanwart [sbanwart!~sbanwart@99-177-126-136.lightspeed.bcvloh.sbcglobal.net] has joined #ruby
philcrissman_ [philcrissman_!~philcriss@c-174-53-217-149.hsd1.mn.comcast.net] has joined #ruby
banisterfiend [banisterfiend!~baniseter@118.82.185.158] has joined #ruby
dhodgkin [dhodgkin!~dhodgkin@cpe-76-178-249-57.maine.res.rr.com] has joined #ruby
<sj26> adeponte: sounds like your environment is being preserved when switching UIDs. Also check your effective UID vs actual UID.
Banistergalaxy [Banistergalaxy!~AndChat@222.153.223.43] has joined #ruby
ciopte7_ [ciopte7_!~thomascio@cpe-071-071-047-213.triad.res.rr.com] has joined #ruby
dchelimsky [dchelimsky!~dchelimsk@207-229-185-63.c3-0.arm-ubr1.chi-arm.il.cable.rcn.com] has joined #ruby
austinbv [austinbv!~austinbv@65-134.127-70.tampabay.res.rr.com] has joined #ruby
apok_ [apok_!~apok@c-107-3-149-167.hsd1.ca.comcast.net] has joined #ruby
waxjar [waxjar!~waxjar@ip11-49-212-87.adsl2.static.versatel.nl] has joined #ruby
pen [pen!~pen@2001:288:1001:28:1800:4057:5269:b04b] has joined #ruby
indeterminate [indeterminate!~sei@user-3c2h3m6.cable.mindspring.com] has joined #ruby
luoluoluo [luoluoluo!~culpower@123.120.13.64] has joined #ruby
achiu [achiu!~Adium@ip68-5-18-17.oc.oc.cox.net] has joined #ruby
Emmanuel_Chanel [Emmanuel_Chanel!star2@ZQ115148.ppp.dion.ne.jp] has joined #ruby
<tnk1> can you do something like "j++" to iterate variable j up by 1 in ruby?
<banisterfiend> tnk1: no
headius [headius!~headius@71-210-151-185.mpls.qwest.net] has joined #ruby
<banisterfiend> tnk1: j += 1
<tnk1> you have to do the whole j = j+1
halcyonCorsair [halcyonCorsair!~quassel@2404:130:0:1000:e269:95ff:fe3c:c570] has quit ["http://quassel-irc.org - Chat comfortably. Anywhere."]
<tnk1> j += 1 is the same as j++ in C or something?
<banisterfiend> tnk1: C has J += 1 too
<banisterfiend> j++ is short for j += 1 is short for j = j + 1
<luoluoluo> hi there, I just write a ruby program mirror to its python version to feel the difference between the two fantastic language. here is the ruby code. http://paste.pocoo.org/show/530185/. But I found it twice slower(1.09 seconds to run) than its python counterpart(0.34 seconds to run). I think I made some mistake in writing this ruby code. How can I make the ruby code faster? I'm using MRI 1.9.2, and the file 0103.log is a 60000 lines file.
<tnk1> but Ruby doesn't have j++ kind of syntax?
<banisterfiend> tnk1: no
<tnk1> and Ruby understands j++ ?
<tnk1> Ruby only understands j+=1
<tnk1> or the full equation
<tnk1> am I correct in my understanding?
<tnk1> sweet. I got it
<tnk1> thanks
<tnk1> that fixed it.. i was using j++ and j-- to iterate, but i switched to j+=1 and j-=1 and everything ran fine
ryh [ryh!~ryh@174.45.125.160] has joined #ruby
emmanuelux [emmanuelux!~emmanuel@2a01:e35:2e4d:9010:21d:60ff:fe0e:b818] has joined #ruby
waazzuup [waazzuup!~TheBoss@c-76-102-198-138.hsd1.ca.comcast.net] has joined #ruby
statarb3 [statarb3!~CoreD@unaffiliated/statarb3] has joined #ruby
banisterfiend [banisterfiend!~baniseter@118.82.185.158] has joined #ruby
iDs [iDs!~YourNick@5e0ebb4e.bb.sky.com] has joined #ruby
davidcelis [davidcelis!~david@c-76-115-58-79.hsd1.or.comcast.net] has joined #ruby
brownies [brownies!~brownies@unaffiliated/brownies] has joined #ruby
skaczor [skaczor!~quassel@mail.prognosoft.biz] has joined #ruby
janissary [janissary!~user@adsl-98-85-0-232.mco.bellsouth.net] has joined #ruby
skrewler [skrewler!~skrewler@70-36-139-140.dsl.dynamic.sonic.net] has joined #ruby
radic [radic!~radic@dslb-178-002-212-232.pools.arcor-ip.net] has joined #ruby
p0y [p0y!~p0y@122.52.126.66] has joined #ruby
briandoll [briandoll!~briandoll@c-71-202-88-130.hsd1.ca.comcast.net] has joined #ruby
mikeric [mikeric!~mike@96.49.104.11] has joined #ruby
freenodiz [freenodiz!~IceChat77@unaffiliated/freenodiz] has joined #ruby
friskd [friskd!~friskd@12.236.148.50] has joined #ruby
philcrissman_ [philcrissman_!~philcriss@c-174-53-217-149.hsd1.mn.comcast.net] has joined #ruby
notbrent [notbrent!~notbrent@68-191-45-21.dhcp.nwtn.ct.charter.com] has joined #ruby
mk03 [mk03!~mk03@61.245.119.34.er.eaccess.ne.jp] has joined #ruby
x0F_ [x0F_!~x0F@unaffiliated/x0f] has joined #ruby
ly- [ly-!~ly-@unaffiliated/ly-] has joined #ruby
btanaka [btanaka!~textual@173-228-34-51.dsl.dynamic.sonic.net] has joined #ruby
zitchdog [zitchdog!~textual@173-25-169-137.client.mchsi.com] has joined #ruby
supcdawg [supcdawg!~supcdawg@CPE0026f326b638-CM0026f326b635.cpe.net.cable.rogers.com] has joined #ruby
supcdawg [supcdawg!~yw.hannah@CPE0026f326b638-CM0026f326b635.cpe.net.cable.rogers.com] has joined #ruby
blueadept [blueadept!~blueadept@unaffiliated/blueadept] has joined #ruby
notbrent [notbrent!~notbrent@68-191-45-21.dhcp.nwtn.ct.charter.com] has joined #ruby
apok [apok!~apok@96.24.67.22] has joined #ruby
replore_ [replore_!~replore@203.152.213.161.static.zoot.jp] has joined #ruby
supcdawg [supcdawg!~yw.hannah@CPE0026f326b638-CM0026f326b635.cpe.net.cable.rogers.com] has quit [#ruby]
notbrent [notbrent!~notbrent@68-191-45-21.dhcp.nwtn.ct.charter.com] has joined #ruby
fixl [fixl!~fixl@124-170-21-28.dyn.iinet.net.au] has joined #ruby
ciopte7_ [ciopte7_!~thomascio@cpe-071-071-047-213.triad.res.rr.com] has joined #ruby
Jay_Levitt [Jay_Levitt!~Jay_Levit@home.jay.fm] has joined #ruby
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby
rpowell [rpowell!~rpowell@CPE-124-176-74-65.lns7.cht.bigpond.net.au] has joined #ruby
p1d [p1d!~p1d@dslb-088-064-155-099.pools.arcor-ip.net] has joined #ruby
dyer [dyer!~dyer@108-193-172-174.lightspeed.tukrga.sbcglobal.net] has joined #ruby
dyer [dyer!~dyer@unaffiliated/dyer] has joined #ruby
troutwine [troutwine!~blt@70-100-129-0.dsl1-field.roch.ny.frontiernet.net] has joined #ruby
<troutwine> Would anyone be able to speak to my confusion with em-synchrony, detailed here: http://stackoverflow.com/q/8737652/314318
austinbv [austinbv!~austinbv@65-134.127-70.tampabay.res.rr.com] has joined #ruby
s14 [s14!~nick@ool-18b934ee.dyn.optonline.net] has joined #ruby
ia9371 [ia9371!~ia9371@ip70-160-35-230.hr.hr.cox.net] has joined #ruby
rickmasta [rickmasta!~rickmasta@pool-71-183-247-164.nycmny.fios.verizon.net] has joined #ruby
[-mX-] [[-mX-]!~mx@76-220-97-57.lightspeed.fyvlar.sbcglobal.net] has joined #ruby
blueadept [blueadept!~blueadept@unaffiliated/blueadept] has joined #ruby
vajrapani666 [vajrapani666!~vajrapani@c-69-181-26-39.hsd1.ca.comcast.net] has joined #ruby
igotnolegs [igotnolegs!~igotnoleg@75-162-83-166.slkc.qwest.net] has joined #ruby
sonkei [sonkei!~sonkei@d14-69-26-171.try.wideopenwest.com] has joined #ruby
JayDubs [JayDubs!~jonathan@cpe-98-14-143-168.nyc.res.rr.com] has joined #ruby
ia9371 [ia9371!~ia9371@ip70-160-35-230.hr.hr.cox.net] has joined #ruby
elliottcable [elliottcable!~me@ell.io] has joined #ruby
<ia9371> what is the @ sign mean
<ia9371> in a class method
<JayDubs> its an instance variable
<ia9371> class Whatsver < intherit from whtever
<ia9371> def something
<ia9371> @somethingelse
<JayDubs> a variable that is for the instance of the class - so each object of the class has its own variable. not sure if that makes any sense though
<ia9371> I think i see
<ia9371> Like for all the class named whatever < whatever
<ia9371> not for the orginial class
<ia9371> and each instance of the class will use a different instance
<JayDubs> its a new instance of the variable each time the class is called.
<ia9371> like depending on user input
jameshyde [jameshyde!~jameshyde@c-98-213-109-61.hsd1.il.comcast.net] has joined #ruby
<ia9371> or other reasons
<JayDubs> yup
artOfWar [artOfWar!~artofwar@108-205-201-30.lightspeed.sntcca.sbcglobal.net] has joined #ruby
randym [randym!~randym@EM1-112-255-62.pool.e-mobile.ne.jp] has joined #ruby
CodyMaverick [CodyMaverick!~cody@80.249.82.205] has joined #ruby
fixl [fixl!~fixl@124-170-21-28.dyn.iinet.net.au] has joined #ruby
ciopte7_ [ciopte7_!~thomascio@cpe-071-071-047-213.triad.res.rr.com] has joined #ruby
artOfWar [artOfWar!~artofwar@nat/yahoo/x-iyqekkhsajtykzxn] has joined #ruby
<vajrapani666> What am not understanding exactly? http://pastie.org/3129183
<vajrapani666> Ahh.. I got it to work by using "extend" instead of include , but how can i implement that without using extend? .. module << self .. doesn't appear to be valid
<waxjar> try `def self.do_something`
banisterfiend [banisterfiend!~baniseter@118.82.185.158] has joined #ruby
tyler- [tyler-!~tyman@173-12-219-189-Fresno.hfc.comcastbusiness.net] has joined #ruby
tomzx [tomzx!~tomzx@dsl-216-221-39-59.aei.ca] has joined #ruby
Cervajz [Cervajz!~Cervajz@opensuse/member/Cervajz] has joined #ruby
<Okasu> vajrapani666: do you got it?
<banisterfiend> Okasu: do you have it?*
<vajrapani666> I have it … modules are quirky!
<vajrapani666> really hard to redefine a method by including a module
havenn [havenn!~skipper@pool-72-67-31-69.lsanca.fios.verizon.net] has joined #ruby
andrewhl [andrewhl!~andrew@24-246-15-43.cable.teksavvy.com] has joined #ruby
nekid [nekid!~nekid@c-24-6-170-1.hsd1.ca.comcast.net] has joined #ruby
Guest68249 [Guest68249!Guest68249@200-185-227-52.user.ajato.com.br] has joined #ruby
mksm [mksm!Guest68249@pdpc/supporter/professional/mksm] has joined #ruby
wingie [wingie!~wingie@c-5eeaaa3d-74736162.cust.telenor.se] has joined #ruby
abstrusenick [abstrusenick!~abstrusen@bb116-15-214-58.singnet.com.sg] has joined #ruby
wingie [wingie!~wingie@c-5eeaaa3d-74736162.cust.telenor.se] has quit ["WeeChat 0.3.5"]
ciopte7_ [ciopte7_!~thomascio@cpe-071-071-047-213.triad.res.rr.com] has joined #ruby
tonini [tonini!~tonini@edge.garaio.com] has joined #ruby
tonini [tonini!~tonini@edge.garaio.com] has joined #ruby
TheIronWolf [TheIronWolf!~theironwo@70-36-197-75.dsl.dynamic.sonic.net] has joined #ruby
tonini [tonini!~tonini@edge.garaio.com] has joined #ruby
<ia9371> hello
<vajrapani666> How can you get a list of a methods that are not inherited or included? ( Method#owner still returns the including class .. meaning that it only shows ownership based on direct inheritance)
Evixion` [Evixion`!Evixion@67.235.68.96] has joined #ruby
tonini [tonini!~zastav@edge.garaio.com] has joined #ruby
tonini [tonini!~zastav@edge.garaio.com] has joined #ruby
<Okasu> i can do it in pry with ls -M
<Okasu> or other option ofcourse
<banisterfiend> Okasu: it seems you're becoming infatuated with pry, maybe i can get a photo of you wearing a pry t-shirt and you can become the russian pry mascot
notbrent [notbrent!~notbrent@68-191-45-21.dhcp.nwtn.ct.charter.com] has joined #ruby
<Okasu> banisterfiend: LolNo
<Okasu> i'm just start learn ruby not quite age, month or so
<Okasu> and idk stdlib well, but pry realy easy to remember
<Okasu> s/age/ago/
<banisterfiend> Okasu: you talk english like borat
<banisterfiend> i like that
<banisterfiend> :P
<Okasu> XD
<banisterfiend> is good
youdonotexist [youdonotexist!~youdonote@c-67-166-121-94.hsd1.ut.comcast.net] has joined #ruby
halcyonCorsair [halcyonCorsair!~quassel@2404:130:0:1000:e269:95ff:fe3c:c570] has joined #ruby
<halcyonCorsair> hi, i have an array of hashes, and i want to add hashes to the array if a value is new, or otherwise overwrite an existing hash, what is the best way to go about this?
phantomfake [phantomfake!~whats_in_@pool-71-190-229-236.nycmny.fios.verizon.net] has joined #ruby
Asher [Asher!~asher@98.158.127.150] has joined #ruby
Fraeon [Fraeon!~kzer-za@virgo.dreamhost.com] has joined #ruby
randym [randym!~randym@113x33x226x118.ap113.ftth.ucom.ne.jp] has joined #ruby
aetaric_ [aetaric_!~aetaric@74-130-83-237.dhcp.insightbb.com] has joined #ruby
dantler [dantler!62f6e528@gateway/web/freenode/ip.98.246.229.40] has joined #ruby
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby
savage- [savage-!~savage-@c-67-180-11-89.hsd1.ca.comcast.net] has joined #ruby
savage- [savage-!~savage-@c-67-180-11-89.hsd1.ca.comcast.net] has joined #ruby
<dantler> Any metaprogramming pros around? I'm trying to write a function like this: def foo( obj ); return "obj"; end; # where obj is just an example of whatever object I put in
Fraeon [Fraeon!~kzer-za@virgo.dreamhost.com] has joined #ruby
Carmivore [Carmivore!~carmivmor@ec2-75-101-234-93.compute-1.amazonaws.com] has joined #ruby
<joeyk> dantler: you mean like def foo(String); return "String"; end #?
Cervajz [Cervajz!~Cervajz@opensuse/member/Cervajz] has joined #ruby
<joeyk> dantler: if so: def foo obj; obj.to_s; end
<dantler> joeyk: more like s = String.new; foo(s); # => "String"
<dantler> I guess those are almost the same thing though.
<joeyk> dantler: def foo obj; obj.class.to_s; end
<joeyk> foo(Array).equals "Array"
<joeyk> o.O
<joeyk> haha
<dantler> Okay now for the follow up question! :)
<joeyk> I wrote ".equals" instead of just saying =
brownies [brownies!~brownies@unaffiliated/brownies] has joined #ruby
<joeyk> dantler: ?
<dantler> class MyClass; attr_accessor s; end; x = MyClass.new; x.s = "Hello World"; foo(x.s); # => MyClass.s
trend [trend!~trend@76.91.169.147] has joined #ruby
<dantler> Sorry it's a bit longer. This is semicolon abuse; :<
<dantler> eerm, I meant # => "MyClass.s"
<joeyk> ok
<joeyk> what are you trying to achieve?
<dantler> I think the current implementation would return "String".
<joeyk> correct
headius [headius!~headius@71-210-151-185.mpls.qwest.net] has joined #ruby
<joeyk> I'm not sure about that one
<joeyk> it may or may not be possible
<joeyk> but again
<joeyk> what are you actually trying to achieve
<joeyk> there might be a better way
<dantler> Let me think about how to describe it.
<joeyk> k
<joeyk> I'm expirementing on trying to achieve that MyClass.s thing
<joeyk> the problem is
<joeyk> I'm not sure how foo() is suppose to be aware of x
<joeyk> since technically you're passing "s"
<dantler> Yeah, it's like the only way to do it is to add something to Object.
<joeyk> that, or let foo() take two parameters
sandelius [sandelius!~textual@90-231-202-62-no214.tbcn.telia.com] has joined #ruby
<dantler> Yeah I am trying to keep my clean interface, but I think taking variable parameters might be the solution.
<vajrapani666> Is there a way to change the value of self whilst still maintaining scope .e.g. e=5; class << new_self; e will not be accessible from within the changed scope
<joeyk> why would you want to change the value of self?
Know1edge [Know1edge!~Know1edge@c-69-247-141-247.hsd1.tn.comcast.net] has joined #ruby
<vajrapani666> some sort of ridiculous metaprogramming experiment
<vajrapani666> the classic case is the implementation of class methods
<joeyk> I don't know :(
<dantler> this is now #ruby-metaprogramming-experiments :)
<banisterfiend> vraa: yes
stephans [stephans!~stephans@76-217-209-24.lightspeed.sntcca.sbcglobal.net] has joined #ruby
<banisterfiend> vajrapani666: yes
<banisterfiend> vajrapani666: new_self.singleton_class.class_eval do / end
<vajrapani666> nice ..
<vajrapani666> is e = new_self.singleton_class, same as e = class << new_self; self; end ?
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby
<banisterfiend> vajrapani666: Yes
<dantler> joeyk: I think I'm going to pass everything as a string and try to convert it back to a series of objects. think that'll work?
<joeyk> dantler: yes
<dantler> joeyk: you dont think I'll lose scope?
djdb [djdb!~digitalbo@linux.minsk.tutby.com] has joined #ruby
<joeyk> maybe I mis understood you
<joeyk> I thought you meant you would do something like Object.const_get(x.to_sym).new
<dantler> foo("x.s");
<dantler> # => "MyClass.s"
<dantler> joeyk: I'm getting myself all confused about scope now. I'm just going to settle for variable number of arguments. Thanks for your help and expertise! :)
apeiros_ [apeiros_!~apeiros@77-58-113-31.dclient.hispeed.ch] has joined #ruby
Doppp [Doppp!~Doppp@unaffiliated/doppp] has joined #ruby
<rickmasta> Anyone mind guiding me to installing a gem from github?
<joeyk> dantler: ¯\(°_o)/¯
<joeyk> dantler: sorry I couldn't be of more help
<dantler> Sometimes a language isn't designed for what you want to do. :/
ziggles [ziggles!~ziggles@c-24-6-247-92.hsd1.ca.comcast.net] has joined #ruby
yxhuvud [yxhuvud!mongo@h-17-181.a149.priv.bahnhof.se] has joined #ruby
Know1edge [Know1edge!~Know1edge@c-69-247-141-247.hsd1.tn.comcast.net] has joined #ruby
<joeyk> dantler: as a side note: def foo(obj1, obj2); "#{obj1.class.to_s}.#{obj2} = #{obj1.method(obj2).call}"; end
<joeyk> usage, foo(MyClass, :s)
<joeyk> err
Doppp [Doppp!~Doppp@unaffiliated/doppp] has joined #ruby
<joeyk> foo(x, :s)
<dantler> Oh that's an interesting one, thanks.
<joeyk> by your example
<joeyk> foo(x, :s) -> "MyClass.s = Hello World"
Doppp [Doppp!~Doppp@unaffiliated/doppp] has joined #ruby
<dantler> That 'x' is just so hard to get. :(
Know1edge [Know1edge!~Know1edge@c-69-247-141-247.hsd1.tn.comcast.net] has joined #ruby
Jay_Levitt [Jay_Levitt!~Jay_Levit@home.jay.fm] has joined #ruby
wedtm [wedtm!~wedtm@173-12-163-78-oregon.hfc.comcastbusiness.net] has joined #ruby
<Okasu> https://ideone.com/GdwhG funny that singleton_method_added method triggers itself
Doppp [Doppp!~Doppp@unaffiliated/doppp] has joined #ruby
ReTFEF [ReTFEF!JS@cpe-173-88-110-115.columbus.res.rr.com] has joined #ruby
<joeyk> dantler: If you don't care about processing power you could probably abuse caller
<joeyk> and basically process the source file to look up the variable type
<dantler> i've never heard of caller. what class is that in?
<joeyk> ^_^
Morkel [Morkel!~Morkel@xdsl-87-78-206-32.netcologne.de] has joined #ruby
<joeyk> dantler: it's in Kernel
<dantler> I see, that is quite abusive. :P
<joeyk> to me, it would seem odd for ruby to natively actually allow you to do something like what you were trying to do
<yxhuvud> what is he trying to do?
ph^ [ph^!~ph^@cm-84.212.225.74.getinternet.no] has joined #ruby
<dantler> well it would be nice if there was some way to access args[i] for a function, as an array of strings or something.
<dantler> and by 'function' I mean method, of course. :[
<yxhuvud> apart from using the star operator when defining the method, that is not possible afaik
artOfWar [artOfWar!~artofwar@108-205-201-30.lightspeed.sntcca.sbcglobal.net] has joined #ruby
xpot [xpot!~xpot@166-70-100-198.ip.xmission.com] has joined #ruby
<yxhuvud> I would expect it to be possible in rbx though.
<dantler> what is rbx?
<yxhuvud> rubinus, an alternative interpreter
krz [krz!~foobar@unaffiliated/krz] has joined #ruby
youdonotexist [youdonotexist!~youdonote@c-67-166-121-94.hsd1.ut.comcast.net] has joined #ruby
<dantler> Oooooh, sounds fancy.
<dantler> I wonder if that full CPU concurrency would help with my sinatra app.
senny [senny!~senny@77-56-67-120.dclient.hispeed.ch] has joined #ruby
azbarcea [azbarcea!~quassel@79.114.90.170] has joined #ruby
cableray [cableray!~cableray@75-145-121-174-Colorado.hfc.comcastbusiness.net] has joined #ruby
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby
thone [thone!~thone@g226048128.adsl.alicedsl.de] has joined #ruby
waxjar [waxjar!~waxjar@ip11-49-212-87.adsl2.static.versatel.nl] has joined #ruby
Spockz [Spockz!~Spockz@84.245.46.110] has joined #ruby
friskd [friskd!~friskd@cpe-76-172-2-7.socal.res.rr.com] has joined #ruby
tk_ [tk_!~tk@p252193.doubleroute.jp] has joined #ruby
vajrapani666 [vajrapani666!~vajrapani@c-69-181-26-39.hsd1.ca.comcast.net] has joined #ruby
tilde[afk] [tilde[afk]!~tilde@host226-185-dynamic.23-79-r.retail.telecomitalia.it] has joined #ruby
byronb [byronb!~byron@c-24-18-227-118.hsd1.wa.comcast.net] has joined #ruby
TheNumb [TheNumb!thenumb@gateway/shell/mydevil.net/x-wiwctclpvchliyys] has joined #ruby
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby
Spockz [Spockz!~Spockz@84.245.46.110] has joined #ruby
Sliker [Sliker!~ponies@31.185.131.187] has joined #ruby
saltmiser [saltmiser!~chatzilla@70.15.225.198.res-cmts.ovr.ptd.net] has joined #ruby
ph^ [ph^!~ph^@79.135.7.162] has joined #ruby
p1d [p1d!~p1d@ns1.vonaffenfels.de] has joined #ruby
amerine [amerine!~mturner@bc171197.bendcable.com] has joined #ruby
Guest____ [Guest____!~textual@92.45.22.237] has joined #ruby
toy_battery [toy_battery!~choldbroo@c-67-181-185-107.hsd1.ca.comcast.net] has joined #ruby
zommi [zommi!quassel@nat/ibm/x-jirqcldyehsedgml] has joined #ruby
toy_battery [toy_battery!~choldbroo@c-67-181-185-107.hsd1.ca.comcast.net] has quit [#ruby]
toy_battery [toy_battery!~choldbroo@c-67-181-185-107.hsd1.ca.comcast.net] has joined #ruby
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby
Marco [Marco!~marco@Marco-2.Kiewit.dartmouth.edu] has joined #ruby
Sliker [Sliker!~ponies@31.185.131.187] has joined #ruby
nari_ [nari_!~nari@p62e32d.totrnt01.ap.so-net.ne.jp] has joined #ruby
tilde[af1] [tilde[af1]!~tilde@host226-185-dynamic.23-79-r.retail.telecomitalia.it] has joined #ruby
batlock666 [batlock666!~quassel@bvderbau.ugent.be] has joined #ruby
<toy_battery> fuck... this application i'm building
babinho [babinho!~babinho@babinho.net] has joined #ruby
<toy_battery> anyone out there?
ephemerian [ephemerian!~ian@82-71-51-229.dsl.in-addr.zen.co.uk] has joined #ruby
wallerdev [wallerdev!~wallerdev@72.44.102.30] has joined #ruby
<vajrapani666> I completely understand that this scenario i'm showing in the following question is a bit complex and strange .. but it seems to be the simplest demonstrable version of what i'm encountering .. the following: http://pastie.org/3129721, will raise an exception.. because the binding of the block in the commented out version gets set to the instance … whereas in the version in place on line 6 gets executed.. the executing context
<vajrapani666> the block becomes the class and not the instance?
<vajrapani666> Put in another way, i need a way to modify a lambda , (e.g. add in an argument) without wrapping in another lambda?
<toy_battery> shouldn't that be def self.included ??
shevy [shevy!~shevy@93-82-138-164.adsl.highway.telekom.at] has joined #ruby
<vajrapani666> appears to only work with def included
mksm [mksm!mksm@200-185-227-52.user.ajato.com.br] has joined #ruby
<vajrapani666> everything works fine if i just switch implementation on line 6-8 with the implementation on line 5
mafolz [mafolz!~mafolz@dhcp50-210.start.uni-saarland.de] has joined #ruby
<vajrapani666> it is because when i pass the block as a reference to define method, the block winds up getting executed in the proper context… whereas if i modify the block by wrapping it in another block before i pass it to define_method, then the scope block is executed within changes
<toy_battery> wait y are you extending X
<toy_battery> shouldn't you be including it?
andreime [andreime!~andrei-ci@82.79.96.20] has joined #ruby
<toy_battery> in Y
<vajrapani666> if i include it , then included gets called.. i want included to be called upon inclusion into its class
<vajrapani666> which it does
Helius [Helius!~Adium@93-36-7-225.ip57.fastwebnet.it] has joined #ruby
<toy_battery> what happens if you do def self.extended
cyri_ [cyri_!~cyri_@236.200.72.86.rev.sfr.net] has joined #ruby
<toy_battery> in X
<sj26> toy_battery: nothing, that's not a valid hook
<toy_battery> good point
<toy_battery> ... few beers in
<toy_battery> lol
<sj26> vajrapani666: not sure what you're trying to achieve here, looks overcomplicated. Why not just use modules the way they're intended?
maasha [maasha!535c4c84@gateway/web/freenode/ip.83.92.76.132] has joined #ruby
<toy_battery> wait a sec
<sj26> why do you have an array of blocks which are being attached as methods later?>
<toy_battery> yeah it is
Spockz [Spockz!~Spockz@095-097-113-150.static.chello.nl] has joined #ruby
<sj26> this is essentially what a module does
<toy_battery> self.extended is valid
mksm_ [mksm_!~mksm@200-185-227-52.user.ajato.com.br] has joined #ruby
pi3r [pi3r!~pi3r@LSt-Amand-152-32-39-189.w80-11.abo.wanadoo.fr] has joined #ruby
<maasha> I suspect I have missed out on something important on enumerators.This is awkward, right? http://pastie.org/3129761
<toy_battery> module Foo
<toy_battery> def self.extended(base)
<toy_battery> puts base.class
<toy_battery> end
<toy_battery> end
<toy_battery> module Bar
<toy_battery> extend Foo
<toy_battery> end
<toy_battery> tap returns 'Module'
soulcutter [soulcutter!~soulcutte@varenka.cime.net] has joined #ruby
<toy_battery> *that
<vajrapani666> .. yeah, you should use .. a paste for that
<maasha> toy_battery: /topic - use pastie
<toy_battery> srry
<toy_battery> but yeah self.extended is valid syntax
<toy_battery> did you try that?
Marco [Marco!~marco@Marco-2.Kiewit.dartmouth.edu] has joined #ruby
<toy_battery> *sigh* i'm working on this app right now, it's a fat pain in the ass
<toy_battery> rolling solo sucks sometimes
<toy_battery> i live in a developer free town too lol
<toy_battery> err ruby-free at least
frerich [frerich!~frerich@mail.froglogic.com] has joined #ruby
frerich [frerich!~frerich@kde/raabe] has joined #ruby
<vajrapani666> sj26: Here is a much more easy to follow isolated example of what i'm encountering
pietro__ [pietro__!~pietro@2-227-162-47.ip187.fastwebnet.it] has joined #ruby
<vajrapani666> it doesn't have anything to do with modules …. that is outside the problem.. the problem is with how scope is determine with respect to define_method
<toy_battery> have you tried send?
<toy_battery> send(:define_method)
<Axsuul> Why is... 3999*(25/100).to_f.floor => 0 ?
<sj26> vajrapani666: ah, yes
<sj26> define_method takes a block and rebinds it
<sj26> if you call a proc directly, it will be executed in the original definition context
<vajrapani666> Axsuul: 25/100 ends up as an int, 0.. 0 * 3999 ==0, 0.to_f.floor == 0
<vajrapani666> Axsuul: you would need to ensure that at least one operand of the division is a float, int/int == int , int/float == float, float/int == float
<Axsuul> However if I do (3999*(25/100).to_f).floor => 999 ?
<sj26> a Proc is not a Method
<sj26> the #binding is different
<Axsuul> which is the right answer, I suppose it needed a closure
<toy_battery> because 25/100 is 0
<toy_battery> try 25.0/100
<toy_battery> in the first example
<vajrapani666> sj26: I know, and i can only explicitly set the binding with eval(str, binding)
achiu [achiu!~Adium@ip68-5-18-17.oc.oc.cox.net] has joined #ruby
<vajrapani666> what i need .. is more like currying in lisp … but i can't seem to really achieve that here
ly- [ly-!~ly-@unaffiliated/ly-] has joined #ruby
<toy_battery> mebe cause 3999*(25/100) is evaluated first
<banisterfiend> vajrapani666: what's are you trying to do exactly
<toy_battery> then .to_f
<wallerdev> hi banisterfiend
<banisterfiend> wallerdev: hi
<wallerdev> how are you?
<toy_battery> banisterfiend is the bomb
<banisterfiend> yeah im pretty awesome
<wallerdev> great :)
<vajrapani666> banisterfiend: it is part of a really deep dsl … involves lots of modules that complicate the presentation of the actual problem
<sj26> vajrapani666: that's because code blocks are not first-class in ruby
<banisterfiend> sj26: how aren't they first class
<banisterfiend> vajrapani666: try and code up a minimal test case if u can
<vajrapani666> or if i could only explicitly mess with the binding e.g. someclass.method(:foo).class == UnboundMethod
<sj26> banisterfiend: a code block is not a proc is not a method
<banisterfiend> sj26: ah i see what u mean
<banisterfiend> vajrapani666: mess with the binding of a method object?
<sj26> (which is in every object)
<vajrapani666> when did that come about ? #instance_exec
<vajrapani666> that is quite fantastic
<vajrapani666> basic object is 1.9.. is instance_exec in 1.8.7 ?
<banisterfiend> vajrapani666: 1.9.1 i think was first appearance
<toy_battery> if anyone would like to help me build this http://cl.ly/2z29380Q27343a2i1o0K let me know
<toy_battery> lol
<sj26> vajrapani666vaj: https://gist.github.com/1564308
andreime [andreime!~andrei-ci@82.79.96.20] has joined #ruby
<toy_battery> btw this is a working demo
BiHi [BiHi!~bihi@did75-17-88-165-129-29.fbx.proxad.net] has joined #ruby
<vajrapani666> ugh…. that is so beautiful
<toy_battery> what?
<sj26> toy_battery: if that was at me, a polyfill for #instance_exec so it works on 1.8.7
<sj26> (notice this is from 2006!)
<toy_battery> i don't think instance_exec works on 1.8.7 but i could be wrong
<sj26> no it doesn't
<banisterfiend> yes it does
<sj26> but you can add it using the link provided
<banisterfiend> instance_exec works fine on 1.8.7
<vajrapani666> yay for backports!!!
<toy_battery> didn't know that
<sj26> OH HEY!
<sj26> that's awesome
<sj26> it does mean you can't pass a code block as a parameter to the code block, but we're not in a Nolan movie.
<vajrapani666> No … this is fantastic
<toy_battery> if i'm looking for a rails mercenary where would i look?
<banisterfiend> sj26: another thing people dont know about 1.8.7, this is valid too: proc { |&block| block.call }.call { puts "hi" }
<toy_battery> lol
<sj26> banisterfiend: I knew about that one, quite nicey
<toy_battery> dude that's cool
<sj26> toy_battery: gun.io?
<vajrapani666> I don't know how many times i've read through the 1.9 back ports.. just didn't catch that
<toy_battery> whats gun.io?
<sj26> toy_battery: or right here/in #rubyonrails :P
<banisterfiend> 1.8.7 is pretty cool, though they made a sizeable stupid omission when they neglected to backport Kernel#singleton_class
<toy_battery> it's not so much rails really
<toy_battery> basically i'm building a webapp that lets you create colorschemes for code
<toy_battery> and then ports to every possible code editor
<toy_battery> plus coderay and syntax highlighter
<toy_battery> hopefully no one will steal that idea HA!
<vajrapani666> singleton_class = class << self; self; end
<toy_battery> so it's more a matter of writing generators
<toy_battery> for each editor
<csmrfx> what. you only need vim
Targen_ [Targen_!~iguana@190.39.181.108] has joined #ruby
<toy_battery> i know, i love the shit out of vim
<toy_battery> but i actually used the coloration gem to port a bunch of very nice textmate themes to vim for me
<toy_battery> and i thought, why not have one place where everyone could go to build colorschemes
<toy_battery> sort of a universal adapter for all editors
<Mon_Ouie> http://themes.sweyla.com/, though that's randomly generated, not user-edited
<toy_battery> yeah i've seen that
<toy_battery> it's not up to par
<vajrapani666> sj26, banister fiend: thanks both of you
<toy_battery> did you see that screen shot?
Ammar01 [Ammar01!~hassaa10@gatej.thls.bbc.co.uk] has joined #ruby
<toy_battery> here look http://cl.ly/2z29380Q27343a2i1o0K
<toy_battery> and here http://cl.ly/2L1r0V3L381K0L1x3v3H
<toy_battery> so you can actually interactively build the scheme
bastilian [bastilian!~bastilian@chello213047077012.23.11.vie.surfer.at] has joined #ruby
eldariof [eldariof!~CLD@79.126.108.38] has joined #ruby
Asher [Asher!~asher@98.158.127.150] has joined #ruby
bwright [bwright!~bwright@c122-106-254-100.belrs3.nsw.optusnet.com.au] has joined #ruby
<toy_battery> it'd be cool to get some help on it though
Guest67529 [Guest67529!Guest67529@200-185-227-52.user.ajato.com.br] has joined #ruby
vajrapani666 [vajrapani666!~vajrapani@c-69-181-26-39.hsd1.ca.comcast.net] has quit [#ruby]
kakashi__ [kakashi__!~kakashi_@nltk/kakashi] has joined #ruby
_debo [_debo!~marco.deb@141.0.34.138] has joined #ruby
trivol [trivol!~aurelien@gra94-1-81-57-175-179.fbx.proxad.net] has joined #ruby
<sj26> toy_battery: is this in browser? for what?
<sj26> I would help make that, it looks interesting
jbpros [jbpros!~jbpros@188.189.73.93] has joined #ruby
<toy_battery> yeah it's for the browser
Kichael [Kichael!~Kichael@70-36-49-167.dyn.novuscom.net] has joined #ruby
<toy_battery> seriously? if you'd be down then lets talk
pen [pen!~pen@dhcp1.csie.ntu.edu.tw] has joined #ruby
fixl [fixl!~fixl@124-170-21-28.dyn.iinet.net.au] has joined #ruby
araujo [araujo!~araujo@gentoo/developer/araujo] has joined #ruby
dyer [dyer!~dyer@108-193-172-174.lightspeed.tukrga.sbcglobal.net] has joined #ruby
dyer [dyer!~dyer@unaffiliated/dyer] has joined #ruby
ferbass [ferbass!~ferbass@201-048-211-049.static.ctbctelecom.com.br] has joined #ruby
vandemar [vandemar!nonserviam@2001:470:1f10:56b::4] has joined #ruby
peterhellberg [peterhellberg!~peterhell@213.115.122.2] has joined #ruby
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby
ephemerian [ephemerian!~ian@82-71-51-229.dsl.in-addr.zen.co.uk] has joined #ruby
_debo [_debo!~marco.deb@141.0.34.138] has joined #ruby
jbpros [jbpros!~jbpros@d515285E6.access.telenet.be] has joined #ruby
trivol [trivol!~aurelien@gra94-1-81-57-175-179.fbx.proxad.net] has joined #ruby
trivol [trivol!~aurelien@gra94-1-81-57-175-179.fbx.proxad.net] has joined #ruby
trivol [trivol!~aurelien@gra94-1-81-57-175-179.fbx.proxad.net] has quit [#ruby]
<hemanth> trying to handle Basic Authentication popup with ruby watir webdriver
leoncamel [leoncamel!~user@KD175129170046.ppp-bb.dion.ne.jp] has joined #ruby
hurikhan|Work [hurikhan|Work!~kakra@82-198-195-142.briteline.de] has joined #ruby
chrismcg [chrismcg!~chrismcg@pdpc/supporter/active/chrismcg] has joined #ruby
altivec_ [altivec_!~altivec@95.105.60.182] has joined #ruby
mengu [mengu!~mengu@unaffiliated/mengu] has joined #ruby
bigkm [bigkm!~bigkm@123-243-191-137.static.tpgi.com.au] has joined #ruby
senny [senny!~senny@edge.garaio.com] has joined #ruby
iocor [iocor!~textual@unaffiliated/iocor] has joined #ruby
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby
flippingbits [flippingbits!~anonymous@ip-81-210-178-39.unitymediagroup.de] has joined #ruby
ly- [ly-!~ly-@unaffiliated/ly-] has joined #ruby
mengu [mengu!~mengu@78.188.203.234] has joined #ruby
tvo [tvo!~tvo@katapult/developer/tvo] has joined #ruby
leoncamel [leoncamel!~user@KD175129170046.ppp-bb.dion.ne.jp] has joined #ruby
azbarcea [azbarcea!~quassel@79.114.16.15] has joined #ruby
alem0lars [alem0lars!~alem0lars@host128-246-dynamic.11-87-r.retail.telecomitalia.it] has joined #ruby
ChampS_ [ChampS_!~ChaosBot@141.32.27.50] has joined #ruby
eykosioux [eykosioux!~eykosioux@80.87.25.146] has joined #ruby
eighty4 [eighty4!~eighty4@unaffiliated/eighty4] has joined #ruby
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby
fixl [fixl!~fixl@124-170-21-28.dyn.iinet.net.au] has joined #ruby
kalusn [kalusn!~claus@2.111.18.26] has joined #ruby
sandelius [sandelius!~textual@90-231-202-62-no214.tbcn.telia.com] has quit ["Textual IRC Client: http://www.textualapp.com/"]
dazoakley [dazoakley!~dazoakley@hocuspokus.vm.bytemark.co.uk] has joined #ruby
fedel [fedel!~fedel@adsl-ull-236-198.50-151.net24.it] has joined #ruby
logic [logic!~logic@unaffiliated/bitch333z] has joined #ruby
Seisatsu [Seisatsu!~seisatsu@2001:5c0:1000:a::685] has joined #ruby
tonini [tonini!~zastav@edge.garaio.com] has quit ["Leaving…."]
flippingbits [flippingbits!~anonymous@ip-81-210-178-39.unitymediagroup.de] has joined #ruby
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby
tcurdt [tcurdt!~tcurdt@dslb-188-097-009-235.pools.arcor-ip.net] has joined #ruby
flippingbits [flippingbits!~anonymous@ip-81-210-178-39.unitymediagroup.de] has joined #ruby
fred-fri_ [fred-fri_!~fred-fri@113x39x129x209.ap113.ftth.ucom.ne.jp] has joined #ruby
<fred-fri_> ubuntu 11.04: i installed compass using sudo gem install compass, but it doesnt seem to be on my path because when i do e.g. compass compile i get "The program 'compass' is currently not installed. You can install it by typing:
MekkisFreenode [MekkisFreenode!~MekkisFre@2a00:dd0:0:6:80a6:4fff:fec7:d456] has joined #ruby
<fred-fri_> sudo apt-get install libcompass-ruby1.8"
<fred-fri_> how can i add compass as installed by gem to my path?
emmanuelux [emmanuelux!~emmanuel@2a01:e35:2e4d:9010:21d:60ff:fe0e:b818] has joined #ruby
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby
RomD [RomD!~Roman@nrbg-4dbe2cb5.pool.mediaWays.net] has joined #ruby
Doppp [Doppp!~Doppp@unaffiliated/doppp] has joined #ruby
<maasha> I am looking for an NArray method that can simultaniously replace multiple values in a byte array. all A's to 1 all B's to 10 all C's to 100. Anyone?
canton7 [canton7!~canton7@95.150.107.113] has joined #ruby
Sliker [Sliker!~ponies@31.185.131.187] has joined #ruby
stephans [stephans!~stephans@76-217-209-24.lightspeed.sntcca.sbcglobal.net] has joined #ruby
tommyblue [tommyblue!~tommyblue@galois.linusse.org] has joined #ruby
durre [durre!~kvirc@217-212-242-4.customer.telia.com] has joined #ruby
Hanmac [Hanmac!~hanmac@p50845353.dip0.t-ipconnect.de] has joined #ruby
mohits [mohits!~mohit@unaffiliated/mohits] has joined #ruby
_debo [_debo!~marco.deb@141.0.34.138] has joined #ruby
ly- [ly-!~ly-@unaffiliated/ly-] has joined #ruby
fixl [fixl!~fixl@124-170-21-28.dyn.iinet.net.au] has joined #ruby
Hanmac [Hanmac!~hanmac@p50845353.dip0.t-ipconnect.de] has quit [#ruby]
tommyblue [tommyblue!~tommyblue@galois.linusse.org] has joined #ruby
altivec [altivec!~altivec@81.30.179.24.dynamic.ufanet.ru] has joined #ruby
jensn [jensn!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby
oponder [oponder!~oponder@mail.memocom.nl] has joined #ruby
Johnnus_ [Johnnus_!~Johnnus_@62.109.36.140] has joined #ruby
negative [negative!~Clooth@193-64-22-84-nat.elisa-mobile.fi] has joined #ruby
<Johnnus_> Hi! I'm a .net developer since many years and has just started playing with ruby and sintra/rails. I'm having a little difficult grasping the concept of the "environment". Could someone point me to some resources about what and how the sintra/rails environment works? Could you say that it's a representation of the complete application loaded? Like, when you're running specs or other tests it loads the environment first, is that basically loadi
<Johnnus_> ng the application in memory and serving it though an in memory web server?
pen [pen!~pen@2002:8c70:e6c7:b:e917:1865:bdc6:e5f] has joined #ruby
leoncamel [leoncamel!~user@KD175129170046.ppp-bb.dion.ne.jp] has joined #ruby
<Johnnus_> or to make the question simpler: what happens behind the scene when i run rspec or rails console?
enikar [enikar!~gil@cl-140.mrs-01.fr.sixxs.net] has joined #ruby
leoncamel [leoncamel!~user@KD175129170046.ppp-bb.dion.ne.jp] has joined #ruby
leoncamel [leoncamel!~user@KD175129170046.ppp-bb.dion.ne.jp] has joined #ruby
DarkFoxDK [DarkFoxDK!~darkfox@62.116.219.97] has joined #ruby
CodyMaverick [CodyMaverick!~cody@80.249.82.205] has joined #ruby
otakutomo [otakutomo!~otakutomo@KD027083117212.ppp-bb.dion.ne.jp] has joined #ruby
Locke23rus [Locke23rus!~quassel@128-70-119-37.broadband.corbina.ru] has joined #ruby
durre [durre!~kvirc@217-212-242-4.customer.telia.com] has joined #ruby
skaczor [skaczor!~quassel@mail.prognosoft.biz] has joined #ruby
Nicke\ [Nicke\!~nickelito@h102n2c1o260.bredband.skanova.com] has joined #ruby
<waxjar> so glad i discovered =begin and =end, commenting out blocks of code is so much simpler now :D
<maasha> How can I use tr to replace in a string all 'A' with 1, 'T' with 2, 'C' with 8, and 'G' with 16 (binary numbers)?
<maasha> "ATCG".tr('A', 1.chr) works with one ...
<maasha> like this: "ATCGT".tr('AT', "\x01\x02")
<maasha> autoanswer :o)
oponder_ [oponder_!~oponder@mail.memocom.nl] has joined #ruby
Carmivore [Carmivore!~carmivmor@ec2-204-236-244-228.compute-1.amazonaws.com] has joined #ruby
ixti [ixti!~ixti@232.Red-88-23-28.staticIP.rima-tde.net] has joined #ruby
jbpros [jbpros!~jbpros@d515285E6.access.telenet.be] has joined #ruby
ferbass [ferbass!~ferbass@201-048-211-049.static.ctbctelecom.com.br] has joined #ruby
fedel [fedel!~fedel@adsl-ull-253-215.50-151.net24.it] has joined #ruby
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby
waxjar [waxjar!~waxjar@ip11-49-212-87.adsl2.static.versatel.nl] has joined #ruby
ly- [ly-!~ly-@unaffiliated/ly-] has joined #ruby
MekkisFreenode [MekkisFreenode!~MekkisFre@2a00:dd0:0:6:80a6:4fff:fec7:d456] has joined #ruby
strife25 [strife25!~strife25@cpe-098-026-018-050.nc.res.rr.com] has joined #ruby
anoNxeRo [anoNxeRo!~LessIsMor@unaffiliated/nu253r/x-0655220] has joined #ruby
tilde[afk] [tilde[afk]!~tilde@94.101.55.3] has joined #ruby
rickmasta [rickmasta!~rickmasta@pool-71-183-247-164.nycmny.fios.verizon.net] has joined #ruby
leoncamel [leoncamel!~user@KD175129170046.ppp-bb.dion.ne.jp] has joined #ruby
dazoakley1 [dazoakley1!~dazoakley@hocuspokus.vm.bytemark.co.uk] has joined #ruby
SterNiX [SterNiX!~LessIsMor@unaffiliated/nu253r/x-0655220] has joined #ruby
`brendan [`brendan!~b@66-208-246-34-ubr02b-waldlk01-mi.hfc.comcastbusiness.net] has joined #ruby
nanderoo [nanderoo!~nanders@38.124.137.226] has joined #ruby
apeiros_ [apeiros_!~apeiros@194.209.75.58] has joined #ruby
flippingbits [flippingbits!~anonymous@ip-81-210-178-39.unitymediagroup.de] has joined #ruby
<`brendan> morning folks
esparkman [esparkman!~esparkman@unaffiliated/esparkman] has joined #ruby
zitchdog [zitchdog!~textual@173-25-169-137.client.mchsi.com] has joined #ruby
EddieS [EddieS!~ed@212.59.167.161] has joined #ruby
banister`sleep [banister`sleep!~baniseter@118.82.185.158] has joined #ruby
eldariof [eldariof!~CLD@95.84.35.144] has joined #ruby
pencilcheck [pencilcheck!~pen@g1pc2n249.g1.ntu.edu.tw] has joined #ruby
ByteCrunch [ByteCrunch!bytecrunch@ich.schepper.dich.um.auf.dem.fuse-board.de] has joined #ruby
philcrissman_ [philcrissman_!~philcriss@c-174-53-217-149.hsd1.mn.comcast.net] has joined #ruby
elliot98 [elliot98!~elliot@77.125.140.132] has joined #ruby
elliot98 [elliot98!~elliot@unaffiliated/elliot98] has joined #ruby
rickmasta [rickmasta!~rickmasta@pool-71-183-247-164.nycmny.fios.verizon.net] has joined #ruby
Banistergalaxy [Banistergalaxy!~AndChat@222.153.223.40] has joined #ruby
Jed_84 [Jed_84!~username@190.194.62.47] has joined #ruby
scottw_nj [scottw_nj!~scott@pool-173-63-18-196.nwrknj.fios.verizon.net] has joined #ruby
Sliker [Sliker!~ponies@31.185.131.187] has joined #ruby
tvw [tvw!~tv@212.79.9.150] has joined #ruby
<Raboo> can i ./configure ruby without tk?
Natch| [Natch|!~natch@178.73.217.101] has joined #ruby
indeterminate [indeterminate!~sei@user-3c2h3m6.cable.mindspring.com] has joined #ruby
johnza [johnza!~johnza@176.92.101.246] has joined #ruby
<maasha> I cant get this right. I want to tr a string into non-printable chars ala "ATCGT".tr('AT', "\x01\x02"). But I dont get the \x notation.
<maasha> eg. "A".tr("A", 10.chr) returns \n
<maasha> where "A".tr("A", 1.chr) returns "\x01"
<canton7> it's probably returning \x01 because it thinks the actual character for \x01 is unprintable
<canton7> and so is opting to print its code instead... where as \x10 *is* printable, so it's printing it
<maasha> right, so how can I compile a replacement string for tr using the ascii chars < 16
<canton7> from the looks of it, you are
<canton7> it's when you try and print that string to the console that something or other is making the decision as to what to print
<maasha> sure, but I should be able to convert back and forth. search = "ACGTUMRWSYKVHDBN", replace = "\x01\x02\x04\b\x02\x05\t\x03\f\x06\n\r\a\v\x0E\x0F" - but it doesnt quite work. difficult to debug when you cant print. I better come up with some elegant way.
<maasha> that replace strings looks awful.
<canton7> \n == \x10 == 10.chr: they're all the same thing. Similarly, SOH == \x01 == 1.chr, except that SOH is unprintable. When you print each, the printable version is being used if it exists, otherwise the \xnn version is used
<maasha> It should be these values: [1, 2, 4, 8, 2, 5, 9, 3, 12, 6, 10, 13, 7, 11, 14, 15]
<canton7> wait, do you want it to print a string or an array?
<maasha> canton7: do you know of a simple way to convert the above values into a "replace" string?
<canton7> what do you want the output to be? [1, 2, 4, 8, ... ] or "1248..." ?
<maasha> I simply want to do my_string.tr!(search, replace) --- (for loading to NArray)
tommyvyo_ [tommyvyo_!~tommyvyo@38.123.129.115] has joined #ruby
tommyvyo [tommyvyo!~tommyvyo@38.123.129.115] has joined #ruby
berserkr [berserkr!~david@212.122.111.205.dyn.user.ono.com] has joined #ruby
<Mon_Ouie> why don't you do that then?
<maasha> so my_string should be converted to a string of non-printable chars.
<canton7> ok, then that's what you're doing already
<maasha> Mon_Ouie: hehehe, I am trying to do this elegantly. And reversing my tr I end up with the wrong result - so I build the replace string wrongly.
<canton7> bear in mind that the character with code 1 is *not* a string "1"
oponder [oponder!~oponder@i130041.upc-i.chello.nl] has joined #ruby
<maasha> of cause
* maasha is constructing an array of bit fields
zakwilson_ [zakwilson_!~quassel@c-69-180-70-100.hsd1.fl.comcast.net] has joined #ruby
<canton7> I'm afraid I'm missing the problem. You're wanting to take a string of chars, and replace each character with an equivalent character from the non-printable range? From what you've showed me, you're doing that fine
sepp2k [sepp2k!~sexy@e179239201.adsl.alicedsl.de] has joined #ruby
linoj [linoj!~linoj@sn1-pat-1.m2s.com] has joined #ruby
<maasha> canton7: unfortunately, my test is to convert back to printable chars - and there is something wrong.
<canton7> how are you trying to convert back to printable chars?
<Mon_Ouie> That's because of your replacement string
<maasha> my_string.tr!(search, replace).tr!(replace, search)
<Mon_Ouie> It contains the same character twice, so you can't get the original string
<Mon_Ouie> Since two characters are given the same replacement
<maasha> Mon_Ouie: hm, yes. T and U should be equivalent.
<Mon_Ouie> Something to do with ADN? :p
<Mon_Ouie> DNA*
<shevy> hah
<shevy> more with RNA!
<Mon_Ouie> Yeah
<maasha> anyway, what is a good way to convert these values [1, 2, 4, 8, 2, 5, 9, 3, 12, 6, 10, 13, 7, 11, 14, 15] to a string of hex values? I did it manually before ...
<Mon_Ouie> Array#pack
<Mon_Ouie> [1, 2, 3].pack("C*") => "\x01\x02\x03"
jtrudeau [jtrudeau!~jeff@c-76-127-237-194.hsd1.ma.comcast.net] has joined #ruby
<maasha> Mon_Ouie: of cause. I was looking at pack, but H+ template :P
<shevy> hmm about #pack ... the code explanation to .pack ... where does that come from? is that a standard that is used in C or something?
<maasha> shevy: AFAIK stolen from perl
tilde[afk] [tilde[afk]!~tilde@host226-185-dynamic.23-79-r.retail.telecomitalia.it] has joined #ruby
<shevy> ok
<Mon_Ouie> C doesn't need such a function
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby
<Mon_Ouie> You just need to do some casts to get the same result
<shevy> hmm ok
<maasha> rigth. this rocks. thanks guys.
* maasha did wonder if it was possible to replace multiple values in NArray to avoid tr.
fermion [fermion!~textual@pool-108-7-224-176.bstnma.fios.verizon.net] has joined #ruby
Silker [Silker!~ponies@31.185.131.187] has joined #ruby
tomzx [tomzx!~tomzx@dsl-216-221-39-59.aei.ca] has joined #ruby
dv310p3r [dv310p3r!~dv310p3r@host-208-68-238-122.biznesshosting.net] has joined #ruby
vmatiyko [vmatiyko!~vmatiyko@178.121.196.169] has joined #ruby
vmatiyko [vmatiyko!~vmatiyko@178.121.196.169] has quit [#ruby]
confounds [confounds!~confounds@CPE78cd8e667600-CM78cd8e6675fd.cpe.net.cable.rogers.com] has joined #ruby
enroxorz [enroxorz!~enroxorz@unaffiliated/enroxorz] has joined #ruby
zakwilson [zakwilson!~quassel@c-69-180-70-100.hsd1.fl.comcast.net] has joined #ruby
dchelimsky [dchelimsky!~dchelimsk@207-229-185-63.c3-0.arm-ubr1.chi-arm.il.cable.rcn.com] has joined #ruby
Knodi [Knodi!~Knodi@c-68-43-246-216.hsd1.mi.comcast.net] has joined #ruby
wyhaines [wyhaines!~wyhaines@65.39.118.15] has joined #ruby
Wilhelm_ [Wilhelm_!~textual@awg34.neoplus.adsl.tpnet.pl] has joined #ruby
Knodi [Knodi!~Knodi@c-68-43-246-216.hsd1.mi.comcast.net] has joined #ruby
eykosioux [eykosioux!~eykosioux@80.87.25.146] has quit [#ruby]
crankyco_ [crankyco_!~crankycod@66.207.208.98] has joined #ruby
canton7 [canton7!~canton7@95.150.107.113] has joined #ruby
fermion [fermion!~textual@pool-108-7-224-176.bstnma.fios.verizon.net] has joined #ruby
slide [slide!~slide@unaffiliated/slide] has joined #ruby
cjs226 [cjs226!~cjs226@rrcs-71-40-79-154.sw.biz.rr.com] has joined #ruby
rafacv [rafacv!~rafacv@189.74.161.172] has joined #ruby
asobrasil [asobrasil!~asantioli@palpatine.privatedns.com] has joined #ruby
Jackneill [Jackneill!~Jackneill@unaffiliated/jackneill] has joined #ruby
Sailias [Sailias!~jonathan@bas8-toronto01-1279270254.dsl.bell.ca] has joined #ruby
maploin [maploin!mapleoin@fedora/maploin] has joined #ruby
zitchdog [zitchdog!~textual@159.182.1.4] has joined #ruby
<maploin> hi! Is there any way to explode hashes the same way as arrays? I want to create a new hash with some hardcoded elements and some key-value pairs which come from another hash.
otakutomo [otakutomo!~otakutomo@KD027083117212.ppp-bb.dion.ne.jp] has joined #ruby
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby
<shevy> what is explode
<maploin> *
<maploin> *array
<canton7> maploin, you might be after Hash#merge ?
<shevy> h = Hash[*%w( key1 value1 key2 value2 )]; h # # => {"key2"=>"value2", "key1"=>"value1"}
<shevy> Hash[*array]
<shevy> hmm yeah sounds as if you want to build a more complicated hash
<maploin> canton7: shevy both of your sollutions look decent, thanks!
yfeldblum [yfeldblum!~Jay@pool-71-246-76-76.bltmmd.east.verizon.net] has joined #ruby
<shevy> I think there is also .update but it could be an alias to .merge, not sure ... h = {:a=>42}; h.update(:b => 43) # => {:b=>43, :a=>42}
jonathanwallace [jonathanwallace!~jonathanw@99-11-165-168.lightspeed.tukrga.sbcglobal.net] has joined #ruby
<shevy> h.update(:a => 40) # => {:b=>43, :a=>40}
<canton7> shevy, yeah they're aliases
<shevy> :)
ryh [ryh!~ryh@host-174-45-115-181.bzm-mt.client.bresnan.net] has joined #ruby
<Mon_Ouie> Actually they're not
<Mon_Ouie> update is an alias for merge!, not for merge
nowthatsamatt [nowthatsamatt!~nowthatsa@rrcs-71-43-23-18.se.biz.rr.com] has joined #ruby
<canton7> oops, so it is
virunga [virunga!~virunga@151.64.31.162] has joined #ruby
carlyle [carlyle!~carlyle@rrcs-96-10-255-203.midsouth.biz.rr.com] has joined #ruby
Spockz` [Spockz`!~Spockz@21pc198.sshunet.nl] has joined #ruby
gregorg [gregorg!~Greg@unaffiliated/gregorg] has joined #ruby
moshee [moshee!~moshee@c-50-135-229-127.hsd1.wa.comcast.net] has joined #ruby
moshee [moshee!~moshee@unaffiliated/moshee] has joined #ruby
DFectuoso [DFectuoso!~DFectuoso@fixed-203-141-49.iusacell.net] has joined #ruby
jwmann [jwmann!~Adium@modemcable242.110-201-24.mc.videotron.ca] has joined #ruby
niklasb [niklasb!~codeslay0@p5B310A81.dip0.t-ipconnect.de] has joined #ruby
iocor [iocor!~textual@unaffiliated/iocor] has joined #ruby
jwmann [jwmann!~Adium@modemcable242.110-201-24.mc.videotron.ca] has joined #ruby
jwmann [jwmann!~Adium@modemcable242.110-201-24.mc.videotron.ca] has joined #ruby
16WAAI89D [16WAAI89D!~Adium@modemcable242.110-201-24.mc.videotron.ca] has joined #ruby
Spockz [Spockz!~Spockz@21pc198.sshunet.nl] has joined #ruby
gyre007 [gyre007!~gajdosm@213.86.197.188] has joined #ruby
bbttxu [bbttxu!~adam@pool-71-170-1-72.dllstx.fios.verizon.net] has joined #ruby
rafacv [rafacv!~rafacv@189.74.161.172] has joined #ruby
zakwilson [zakwilson!~quassel@c-69-180-70-100.hsd1.fl.comcast.net] has joined #ruby
Spockz [Spockz!~Spockz@21pc198.sshunet.nl] has joined #ruby
evantravers [evantravers!~textual@fw.luckie.net] has joined #ruby
logic [logic!~logic@unaffiliated/bitch333z] has joined #ruby
zakwilson [zakwilson!~quassel@c-69-180-70-100.hsd1.fl.comcast.net] has joined #ruby
strife25 [strife25!strife25@nat/ibm/x-dnwkagwwnljzlopt] has joined #ruby
Spockz [Spockz!~Spockz@21pc198.sshunet.nl] has joined #ruby
jonathanwallace [jonathanwallace!~jonathanw@146.sub-174-252-174.myvzw.com] has joined #ruby
theRoUS [theRoUS!KenCoar@nat/redhat/x-ionoqvrinlplxvnw] has joined #ruby
theRoUS [theRoUS!KenCoar@apache/committer/coar] has joined #ruby
tesmar [tesmar!~tesmar@adsl-74-162-147-73.rmo.bellsouth.net] has joined #ruby
j-okta [j-okta!~Adium@static-213-115-14-190.sme.bredbandsbolaget.se] has joined #ruby
Johnnus__ [Johnnus__!~Johnnus_@62.109.36.140] has joined #ruby
Aristata [Aristata!~Adium@adsl-75-22-28-181.dsl.chcgil.sbcglobal.net] has joined #ruby
Jrz [Jrz!~jrz@87.239.184.141] has joined #ruby
albemuth [albemuth!~albemuth@201.198.78.18] has joined #ruby
yellow5 [yellow5!~yellow5@levicole.xen.prgmr.com] has joined #ruby
theRoUS [theRoUS!KenCoar@apache/committer/coar] has joined #ruby
myth17 [myth17!~myth17@115.242.91.22] has joined #ruby
<myth17> Which DS to use, if I want to not store duplicate enteries of String? (Hash is storing multiple string keys with same value)
v0n [v0n!~v4n@2607:fad8:4:0:21e:8cff:fe4d:2f7d] has joined #ruby
pietro__ [pietro__!~pietro@109.116.182.118] has joined #ruby
jgarvey [jgarvey!~jgarvey@cpe-174-097-248-211.nc.res.rr.com] has joined #ruby
geekbri [geekbri!~geekbri@64.119.145.106] has joined #ruby
shevy [shevy!~shevy@93-82-138-164.adsl.highway.telekom.at] has joined #ruby
robotmay [robotmay!~robotmay@31.99.37.219] has joined #ruby
polygon-pusher [polygon-pusher!~josh@24-217-76-179.dhcp.stls.mo.charter.com] has joined #ruby
clockwize [clockwize!~clockwize@81.19.48.130] has joined #ruby
<polygon-pusher> need some help with vrm, getting errors on make with install of 1.9.2 seen here http://pastebin.com/87Ufa42p
kennethreitz [kennethreitz!~kennethre@c-24-127-96-129.hsd1.va.comcast.net] has joined #ruby
sobering [sobering!~Adium@iphost-64-56-142-213.wpg.wiband.net] has joined #ruby
bbttxu [bbttxu!~adam@pool-71-96-208-205.dfw.dsl-w.verizon.net] has joined #ruby
asobrasil [asobrasil!~asantioli@palpatine.privatedns.com] has joined #ruby
kevinbond [kevinbond!~kevinbond@250.orl54.voxeo.com] has joined #ruby
<robotmay> No doubt being a bit thick, but what's the best way of finding the difference between two integers?
frist44 [frist44!~Adium@c-69-253-163-29.hsd1.pa.comcast.net] has joined #ruby
pootpoot [pootpoot!~pootpoot@38.108.250.130] has joined #ruby
devdazed [devdazed!~russ_nyc@static-96-239-59-191.nycmny.fios.verizon.net] has joined #ruby
<shevy> hmm how do you guys display ansii colours on console for ruby scripts
<shevy> I can't decide on a reall nice way :(
<shevy> *really
<canton7> shevy, there are a couple of gems out there
sonkei [sonkei!~sonkei@d14-69-26-171.try.wideopenwest.com] has joined #ruby
<canton7> robotmay, abs(a - b) ?
<canton7> robotmay, oops, (a - b).abs
<robotmay> canton7: Awesome, thanks - didn't know about the abs method :)
j-okta [j-okta!~Adium@static-213-115-14-190.sme.bredbandsbolaget.se] has quit [#ruby]
frist44 [frist44!~Adium@c-69-253-163-29.hsd1.pa.comcast.net] has quit [#ruby]
Manhose [Manhose!~Manhose@bl6-38-193.dsl.telepac.pt] has joined #ruby
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby
<shevy> canton7 yeah but
<waxjar> shevy, colored
<waxjar> "lol butts".red
<shevy> one hundred ways to do the same, I just want an elegant way :(
<shevy> hmm waxjar, are you using that?
<waxjar> or 'tickle tickle'.red_on_white (iirc)
<waxjar> yes
<shevy> hmm ok
<shevy> is that a specific gem?
<shevy> the string.red thingy
<shevy> cool thanks
<waxjar> :)
ciopte7 [ciopte7!~thomascio@cpe-071-071-047-213.triad.res.rr.com] has joined #ruby
Ammar01 [Ammar01!~hassaa10@gatej.mh.bbc.co.uk] has joined #ruby
CodyMaverick [CodyMaverick!~cody@80.249.82.205] has joined #ruby
adambeynon [adambeynon!~adambeyno@82-69-1-211.dsl.in-addr.zen.co.uk] has joined #ruby
metadave [metadave!~dparfitt@acsb-dparfitt.facilities.buffalo.edu] has joined #ruby
keyword [keyword!~Adium@190.176.132.98] has joined #ruby
Cervajz [Cervajz!~Cervajz@opensuse/member/Cervajz] has joined #ruby
<keyword> hi guys I have a problem how can I run this cmd with system ruby -pi.bak -e "gsub(/[\"]/, '')" file when I run this system("ruby -pi.bak -e "gsub(/[\"]/, '')" caca") I get sh: -c: line 0: syntax error near unexpected token `)' anyone knows why?
yekta [yekta!~yekta@c-24-1-182-219.hsd1.il.comcast.net] has joined #ruby
philcrissman_ [philcrissman_!~philcriss@206.57.45.116] has joined #ruby
<shevy> hmm a bit odd to want to run ruby from within ruby
gemmes [gemmes!~gemmes@host81-157-148-214.range81-157.btcentralplus.com] has joined #ruby
<maasha> dont ruby have "eval" ?
<shevy> however, I think you forgot a \ there keyword
<shevy> oh wait... even two \"
<keyword> shevy: this cmd works fine from console I want to run this from ruby file
p0y [p0y!~p0y@125.212.56.141] has joined #ruby
<shevy> try ...
<shevy> system("ruby -pi.bak -e \"gsub(/[\"]/, '')\" caca")
<shevy> or
<shevy> assemble your string, before sending it to system()
Mch1 [Mch1!~Mchl@h1881165560.rev.rootvps.pl] has joined #ruby
<keyword> shevy: this not works
<shevy> your_command = 'ruby blablabla'; system(your_command)
<keyword> shevy: I get sh: -c: line 0: syntax error near unexpected token `)'
Aristata1 [Aristata1!~Adium@adsl-75-22-23-163.dsl.chcgil.sbcglobal.net] has joined #ruby
<keyword> nopis
<keyword> the same
theRoUS [theRoUS!KenCoar@nat/redhat/x-wctyglkaaxbalvuy] has joined #ruby
theRoUS [theRoUS!KenCoar@apache/committer/coar] has joined #ruby
<shevy> hmm
<shevy> not entirely sure why this does not work
<shevy> the error says that it did not expect the ')'
<shevy> so there probably is an error after the (, and before the )
<shevy> (/[\"]/, '')
<shevy> keyword did you try it with a simpler regex?
wenbert [wenbert!~wenbert@120.28.206.166] has joined #ruby
<shevy> system "ruby -pi.bak -e \"gsub(/a/, '')\" testing.rb" # => true
<shevy> with a simpler regex it seems to work, so somewhere there must be something with the regex
<shevy> perhaps the \" part is messing things up?
jergason [jergason!~jergason@c-67-182-209-164.hsd1.ut.comcast.net] has joined #ruby
<keyword> shevy: seems to be, what can I add for replace ll doble quotes
Morkel [Morkel!~Morkel@xdsl-87-78-206-32.netcologne.de] has joined #ruby
<shevy> hmm there is ... Regexp.quote ... perhaps you could use this ...
<shevy> not sure keyword, we need a regex expert :)
<keyword> shevy: maybe I can use 34.chr
Marco [Marco!~marco@Marco-2.Kiewit.dartmouth.edu] has joined #ruby
<keyword> this is doble quote
ceej [ceej!~anonymous@cpe-72-190-40-203.tx.res.rr.com] has joined #ruby
<shevy> hehe
havenn [havenn!~skipper@pool-72-67-31-69.lsanca.fios.verizon.net] has joined #ruby
p0y_ [p0y_!~p0y@112.210.94.167] has joined #ruby
<canton7> would system("ruby -pi.bak -e \"gsub(/[\\\"]/, '')\") work?
gheegh [gheegh!~wflanagan@pool-71-191-146-170.washdc.fios.verizon.net] has quit [#ruby]
apok [apok!~apok@96.24.67.22] has joined #ruby
<canton7> shevy ^^
kakashi__ [kakashi__!~kakashi_@nltk/kakashi] has joined #ruby
luxurymode [luxurymode!~luxurymod@rrcs-184-75-21-21.nyc.biz.rr.com] has joined #ruby
DarkFoxDK_ [DarkFoxDK_!~darkfox@62.116.219.97] has joined #ruby
<shevy> hmm
<shevy> oh
<shevy> that seems to work
<shevy> keyword, I think canton7 may have answered your question
<canton7> classic double-escape problem :)
<keyword> jaja
<keyword> this works with 34.chr
<robert_> anyone have much experience with thin?
<shevy> sup robert_
<shevy> :D
<canton7> or system(%Q{ruby -pi.bak -e "gsub(/[\"]/, '')"}) might be clearer
<robert_> shevy: thin -c /srv/http/domains/r-butler.net/applications/psi-llc/app -R config.ru -S ../tmp/socket start yields me, "!! Invalid request" when run on the commandline
<robert_> and endless "Connecting to host..." when run by lighty.
<robert_> 0.o
<shevy> why do you use russian configurations man :(
<shevy> never tried thin
<robert_> I thought .ru was rackup config o.o
<robert_> ah.
<shevy> yeah it is ;)
aetaric [aetaric!~aetaric@74-130-83-237.dhcp.insightbb.com] has joined #ruby
<robert_> :p
<shevy> the error isn't very specific or?
<shevy> I mean
<shevy> what is invalid about it
<robert_> nope, just "!! Invalid request"
<robert_> I dunno what lighty's doing to it, lol
youdonotexist [youdonotexist!~youdonote@192.206.158.10] has joined #ruby
ckrailo [ckrailo!~ckrailo@208.86.167.247] has joined #ruby
azbarcea_ [azbarcea_!~quassel@79.114.16.224] has joined #ruby
<ceej> is there a reason when you pass hashed params to a method you can no longer access them as a hash?
durre [durre!~kvirc@217-212-242-4.customer.telia.com] has joined #ruby
faber [faber!~faber@adsl-ull-163-211.50-151.net24.it] has joined #ruby
<shevy> ceej well, if it is a variable, and the variable gets changed in the method
LiquidInsect [LiquidInsect!~billabney@173-228-63-32.dsl.static.sonic.net] has joined #ruby
<ceej> shevy: I'm doing https://gist.github.com/dd34a91a66df5b171a7b then in my mailer I have def legacy(email = {}) when I do email[:to] it's empty but email['to'] it's not
<shevy> ah so the key changed
<ceej> how do you mean?
<shevy> dunno, I think whoever processes that, re-assigns a key...
<shevy> well, key = key.to_s
p0y [p0y!~p0y@125.212.56.141] has joined #ruby
<ceej> ah so most likely the params is doing that….
<robert_> shevy: "Invalid HTTP Format, parsing fails."
<shevy> robert_ hehe sounds like a slightly better error message
<shevy> "Invalid HTTP Format, I completely failed at parsing this. I am deeply sorry. :("
<shevy> ^^^ now that would be even better
probst [probst!~probst@bumblebee.cl.cam.ac.uk] has joined #ruby
SterNiX [SterNiX!~LessIsMor@unaffiliated/nu253r/x-0655220] has joined #ruby
<robert_> yeah :p
blueadept [blueadept!~blueadept@unaffiliated/blueadept] has joined #ruby
vladyn [vladyn!~vlado@214-125.thezone.bg] has joined #ruby
andrewhl [andrewhl!~andrew@24-246-15-43.cable.teksavvy.com] has joined #ruby
DarkFoxDK [DarkFoxDK!~darkfox@94.191.187.130.mobile.3.dk] has joined #ruby
<ceej> shevy: thank you btw
<shevy> yeah no prob
lkba [lkba!~AndChat@dwj243.neoplus.adsl.tpnet.pl] has joined #ruby
ben_alman [ben_alman!~cowboy@awesome.benalman.com] has joined #ruby
dyer [dyer!~dyer@unaffiliated/dyer] has joined #ruby
j3r0m3 [j3r0m3!~j3r0m3@50-0-128-97.dsl.dynamic.sonic.net] has joined #ruby
kpshek [kpshek!~kpshek@159.140.254.98] has joined #ruby
apok [apok!~apok@96.24.67.22] has joined #ruby
niros [niros!~nir@bzq-218-196-74.red.bezeqint.net] has joined #ruby
ly- [ly-!~ly-@unaffiliated/ly-] has joined #ruby
artOfWar [artOfWar!~artofwar@108-205-201-30.lightspeed.sntcca.sbcglobal.net] has joined #ruby
faber [faber!~faber@adsl-ull-163-211.50-151.net24.it] has joined #ruby
sobering [sobering!~Adium@iphost-64-56-142-213.wpg.wiband.net] has quit [#ruby]
matt_yohe [matt_yohe!~mattyohe@2620:0:e50:3011:9485:19e8:4673:bd0d] has joined #ruby
Mahoek [Mahoek!~Mahoek@ip51ceb6d4.adsl-surfen.hetnet.nl] has joined #ruby
carlyle [carlyle!~carlyle@rrcs-96-10-255-203.midsouth.biz.rr.com] has joined #ruby
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby
DFectuoso [DFectuoso!~DFectuoso@fixed-203-141-49.iusacell.net] has joined #ruby
palcu [palcu!~alex@89.122.187.223] has joined #ruby
soulcutter [soulcutter!~soulcutte@unaffiliated/soulcutter] has joined #ruby
jmeeuwen [jmeeuwen!~kanarip@white.kolabsys.com] has joined #ruby
xec [xec!~xec@2a00:10b0:1:1002:5ab0:35ff:fef8:6a01] has joined #ruby
cylence [cylence!~cylence@64-71-24-18.static.wiline.com] has joined #ruby
rramsden [rramsden!~rramsden@s64-180-62-209.bc.hsia.telus.net] has joined #ruby
zakwilson [zakwilson!~quassel@c-69-180-70-100.hsd1.fl.comcast.net] has joined #ruby
enikar [enikar!~gil@cl-140.mrs-01.fr.sixxs.net] has joined #ruby
artOfWar [artOfWar!~artofwar@nat/yahoo/x-lpolnjqkcifuyqjz] has joined #ruby
mztriz [mztriz!~gailliota@nkugateway.nku.edu] has joined #ruby
robotmay_ [robotmay_!~robotmay@94.30.13.228] has joined #ruby
Guest46377 [Guest46377!~hellspawn@static-96-254-212-18.tampfl.fios.verizon.net] has joined #ruby
devdazed [devdazed!~russ_nyc@static-96-239-59-191.nycmny.fios.verizon.net] has joined #ruby
Jackneill [Jackneill!~Jackneill@unaffiliated/jackneill] has joined #ruby
milkpost [milkpost!~dec@173-28-195-157.client.mchsi.com] has joined #ruby
iocor [iocor!~textual@85.210.55.166] has joined #ruby
iocor [iocor!~textual@unaffiliated/iocor] has joined #ruby
h4mz1d [h4mz1d!~hamfz@99-0-57-199.lightspeed.tsclal.sbcglobal.net] has joined #ruby
Guest46377 [Guest46377!~hellspawn@objectx/robert] has joined #ruby
jmeeuwen [jmeeuwen!~kanarip@white.kolabsys.com] has joined #ruby
akem [akem!~akem@222.144.120.78.rev.sfr.net] has joined #ruby
akem [akem!~akem@unaffiliated/akem] has joined #ruby
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby
Chotaz`W [Chotaz`W!55f08db0@gateway/web/freenode/ip.85.240.141.176] has joined #ruby
<Chotaz`W> I want to start learning Ruby, suggestions?
savage- [savage-!~savage-@209.118.197.220] has joined #ruby
<shevy> Chotaz`W well
<shevy> the only real way to learn ruby is to write ruby scripts, as you learn it
strife25 [strife25!strife25@nat/ibm/x-kvkuyfhdufttzkje] has joined #ruby
<shevy> the best tutorial out there is still http://pine.fm/LearnToProgram/?Chapter=01 IMHO work through it at least once, it is easy and fast
<shevy> as for books, the Pickaxe was ok. I didn't like the other books much though
devdazed [devdazed!~russ_nyc@static-96-239-59-191.nycmny.fios.verizon.net] has joined #ruby
edward__ [edward__!~ipsifendu@173-8-205-65-Oregon.hfc.comcastbusiness.net] has joined #ruby
bier [bier!~bier@p579995C2.dip.t-dialin.net] has joined #ruby
jonathanwallace [jonathanwallace!~jonathanw@99-11-165-168.lightspeed.tukrga.sbcglobal.net] has joined #ruby
azbarcea___ [azbarcea___!~quassel@79.118.6.185] has joined #ruby
bluOxigen [bluOxigen!ssf@unaffiliated/bluOxigen] has joined #ruby
havenn [havenn!~skipper@pool-72-67-31-69.lsanca.fios.verizon.net] has joined #ruby
Manhose [Manhose!~Manhose@bl6-38-193.dsl.telepac.pt] has joined #ruby
ph^ [ph^!~ph^@cm-84.212.225.74.getinternet.no] has joined #ruby
wilmoore [wilmoore!~wilmoore@70-89-165-49-ISTS-co.hfc.comcastbusiness.net] has joined #ruby
yfeldblum [yfeldblum!~Jay@pool-71-246-76-76.bltmmd.east.verizon.net] has joined #ruby
kenichi [kenichi!~kenichi@c-24-20-239-11.hsd1.or.comcast.net] has joined #ruby
jwmann [jwmann!~Adium@modemcable242.110-201-24.mc.videotron.ca] has joined #ruby
eignerchris [eignerchris!~eignerchr@c-24-20-239-11.hsd1.or.comcast.net] has joined #ruby
<Chotaz`W> shevy: thanks a lot, ill keep those references for prior consulting =)
davidcelis [davidcelis!~david@70-89-180-6-smc-or.hfc.comcastbusiness.net] has joined #ruby
austinbv [austinbv!~austinbv@rrcs-24-73-203-202.se.biz.rr.com] has joined #ruby
BrianE [BrianE!~brian@188-220-10-235.zone11.bethere.co.uk] has joined #ruby
<Avi`> i found the koans to be helpful
keyword [keyword!~Adium@190.176.132.98] has quit [#ruby]
<Avi`> but as was pointed out, to learn you have to do more than tutorials and stuff, you have to actually 'do' something with it..
<Avi`> as i was doing koans, i was actively implementing features in rails (without knowing rails or rubys) so i had to learn fast. and i implemented some stuff wrong too, but atleast it helped stuff not slip out of my head, and understand the practical implications and features of ruby
<Avi`> instead of from a theoretical standpoint
sepp2k [sepp2k!~sexy@e179239201.adsl.alicedsl.de] has joined #ruby
<shevy> hmm never tried the koans
<shevy> what can they be used for? or rather, what knowledge can one extract from the koans?
ciopte7 [ciopte7!~thomascio@cpe-071-071-047-213.triad.res.rr.com] has joined #ruby
ghanima [ghanima!~ghanima@alexander.nat.trb.com] has joined #ruby
Araxia [Araxia!~Araxia@173-164-68-213-Oregon.hfc.comcastbusiness.net] has joined #ruby
<LiquidInsect> shevy: it's really to test the limits or edges of your knowledge of the language
<shevy> ah
<shevy> so not so much for newbies only per se?
byronb [byronb!~byron@c-24-18-227-118.hsd1.wa.comcast.net] has joined #ruby
<LiquidInsect> it can be
<LiquidInsect> and as you learn more, you can get further into the suite
<LiquidInsect> until mountains are again merely mountains
Jake232 [Jake232!~textual@5e0e9888.bb.sky.com] has joined #ruby
axl__ [axl__!~axl@173-11-52-113-Minnesota.hfc.comcastbusiness.net] has joined #ruby
apok [apok!~apok@c-107-3-149-167.hsd1.ca.comcast.net] has joined #ruby
btanaka [btanaka!~textual@17.245.91.184] has joined #ruby
waxjar [waxjar!~waxjar@ip11-49-212-87.adsl2.static.versatel.nl] has joined #ruby
mikeric [mikeric!~mike@64.180.47.85] has joined #ruby
ciopte7 [ciopte7!~thomascio@cpe-071-071-047-213.triad.res.rr.com] has joined #ruby
Tuxist [Tuxist!~quassel@dyndsl-085-016-110-020.ewe-ip-backbone.de] has joined #ruby
ianbrandt [ianbrandt!~ianbrandt@99-111-99-153.uvs.sndgca.sbcglobal.net] has joined #ruby
burgestrand [burgestrand!~burgestra@h-45-63.a155.priv.bahnhof.se] has joined #ruby
kenperkins [kenperkins!~textual@174-24-171-37.tukw.qwest.net] has joined #ruby
<shevy> hehe
jrist [jrist!~jrist@184-96-211-124.hlrn.qwest.net] has joined #ruby
Marco [Marco!~marco@Marco-2.Kiewit.dartmouth.edu] has joined #ruby
<Avi`> i started it as a newbie
<Avi`> it was my first introduction into ruby
vmatiyko [vmatiyko!~vmatiyko@178.121.196.169] has joined #ruby
badabim [badabim!~badabim@17.212.166.202] has joined #ruby
<shevy> cool
DrShoggoth [DrShoggoth!~prakwtf@68-188-73-250.static.stls.mo.charter.com] has joined #ruby
troutwine [troutwine!~blt@70-100-129-0.dsl1-field.roch.ny.frontiernet.net] has joined #ruby
amerine [amerine!~mturner@67.204.184.82] has joined #ruby
eywu [eywu!~Adium@205-170-107-4.dia.static.qwest.net] has joined #ruby
apok [apok!~apok@c-107-3-149-167.hsd1.ca.comcast.net] has joined #ruby
mkultras [mkultras!~5C077H@unaffiliated/mkultras] has joined #ruby
crankycoder [crankycoder!~crankycod@66.207.208.98] has joined #ruby
Liothen [Liothen!~liothen@pdpc/supporter/professional/liothen] has joined #ruby
moshee [moshee!~moshee@unaffiliated/moshee] has joined #ruby
Azure [Azure!~azt@unaffiliated/azure] has joined #ruby
<Avi`> but not my first intro to programming
<Avi`> i learn best by trial and error so
<Avi`> koans were helpful for me
metadave [metadave!~dparfitt@acsb-dparfitt.facilities.buffalo.edu] has quit ["Leaving"]
robotmay [robotmay!~robotmay@5ad8f1da.bb.sky.com] has joined #ruby
Cervajz [Cervajz!~Cervajz@opensuse/member/Cervajz] has joined #ruby
senny [senny!~senny@77-56-67-120.dclient.hispeed.ch] has joined #ruby
bastilian [bastilian!~bastilian@chello062178156107.9.14.vie.surfer.at] has joined #ruby
mengu [mengu!~mengu@unaffiliated/mengu] has joined #ruby
robyurkowski [robyurkowski!~robyurkow@64.254.250.82] has joined #ruby
TheIronWolf [TheIronWolf!~theironwo@208.90.215.35] has joined #ruby
ciopte7_ [ciopte7_!~thomascio@cpe-071-071-047-213.triad.res.rr.com] has joined #ruby
Russell^^ [Russell^^!~Russell^^@88.97.51.87] has joined #ruby
adamkittelson [adamkittelson!~adamkitte@50.0.132.2] has joined #ruby
jergason [jergason!~jergason@c-67-182-209-164.hsd1.ut.comcast.net] has joined #ruby
eregon [eregon!~eregon@eregon.me] has joined #ruby
Morkel [Morkel!~Morkel@xdsl-87-78-206-32.netcologne.de] has joined #ruby
eregon [eregon!~eregon@eregon.me] has joined #ruby
tvo [tvo!~tvo@5354CF57.cm-6-5d.dynamic.ziggo.nl] has joined #ruby
tvo [tvo!~tvo@katapult/developer/tvo] has joined #ruby
nekid [nekid!~nekid@c-24-6-170-1.hsd1.ca.comcast.net] has joined #ruby
logic [logic!~logic@41.205.170.123] has joined #ruby
logic [logic!~logic@unaffiliated/bitch333z] has joined #ruby
eldariof [eldariof!~CLD@95.84.56.43] has joined #ruby
havenn [havenn!~skipper@pool-72-67-31-69.lsanca.fios.verizon.net] has joined #ruby
friskd [friskd!~friskd@71-95-209-242.static.mtpk.ca.charter.com] has joined #ruby
Shamgar [Shamgar!~mbainter@adsl-76-233-110-46.dsl.rcsntx.sbcglobal.net] has joined #ruby
eignerchris [eignerchris!~eignerchr@c-24-20-239-11.hsd1.or.comcast.net] has joined #ruby
cjlicata [cjlicata!~carlyle@216.133.69.20] has joined #ruby
eregon [eregon!~eregon@eregon.me] has joined #ruby
Chotaz`W [Chotaz`W!55f08db0@gateway/web/freenode/ip.85.240.141.176] has quit [#ruby]
wallerdev [wallerdev!~wallerdev@72.44.102.30] has joined #ruby
iskren [iskren!~iskren@94.26.24.78] has joined #ruby
achiu [achiu!~Adium@216.174.109.254] has joined #ruby
supergiantrobot [supergiantrobot!~supergian@cpe-174-097-169-208.nc.res.rr.com] has joined #ruby
kpshek [kpshek!~kpshek@159.140.254.98] has joined #ruby
toy_battery [toy_battery!~choldbroo@c-67-181-185-107.hsd1.ca.comcast.net] has joined #ruby
fridim_ [fridim_!~fridim@2a01:e35:2ece:f2d0:223:4eff:fe6c:c754] has joined #ruby
robotmay [robotmay!~robotmay@5ad8f1da.bb.sky.com] has joined #ruby
jrist [jrist!~jrist@184-96-215-73.hlrn.qwest.net] has joined #ruby
durre [durre!~kvirc@217-212-242-4.customer.telia.com] has joined #ruby
robotmay_ [robotmay_!~robotmay@5ad8f1da.bb.sky.com] has joined #ruby
nd_______ [nd_______!~nd@mnhm-590e4149.pool.mediaWays.net] has joined #ruby
kwoodson [kwoodson!kvirc@nat/redhat/x-qhxskojojrgnjlya] has joined #ruby
Marco [Marco!~marco@Marco-2.Kiewit.dartmouth.edu] has joined #ruby
\logic [\logic!~logic@2002:29cd:a8f8::29cd:a8f8] has joined #ruby
\logic [\logic!~logic@unaffiliated/bitch333z] has joined #ruby
zitchdog [zitchdog!~textual@159.182.1.4] has joined #ruby
newellista [newellista!~snewell@gw.voonami.com] has joined #ruby
n8ji [n8ji!~n8ji@c-24-20-239-11.hsd1.or.comcast.net] has joined #ruby
pantsman [pantsman!~pantsman@2.25.205.27] has joined #ruby
pantsman [pantsman!~pantsman@pdpc/supporter/active/pantsman] has joined #ruby
zitchdog [zitchdog!~textual@159.182.1.4] has quit [#ruby]
zodiak [zodiak!~stef@pool-108-13-237-159.lsanca.fios.verizon.net] has joined #ruby
tmiller [tmiller!~tmiller@fw.luckie.net] has joined #ruby
tmiller [tmiller!~tmiller@fw.luckie.net] has joined #ruby
havenn [havenn!~skipper@pool-71-189-126-188.lsanca.fios.verizon.net] has joined #ruby
jmeeuwen [jmeeuwen!~kanarip@white.kolabsys.com] has joined #ruby
gnusosa [gnusosa!~cisosa@unaffiliated/gnusosa] has joined #ruby
s_much [s_much!~butt_hurt@static-173-61-113-6.cmdnnj.fios.verizon.net] has joined #ruby
s_much [s_much!~butt_hurt@static-173-61-113-6.cmdnnj.fios.verizon.net] has quit [#ruby]
youdonotexist [youdonotexist!~youdonote@192.206.158.10] has joined #ruby
jackerran [jackerran!~jackerran@fw.luckie.net] has joined #ruby
kirun [kirun!~kirun@78-86-154-194.zone2.bethere.co.uk] has joined #ruby
<gnusosa> Hi, can anybody tell me how to debug this message "`new': wrong instance allocation (TypeError)", I always encounter it when testing on rspec. It's a ruby/c extension.
virunga [virunga!~virunga@151.64.31.162] has joined #ruby
stkowski [stkowski!~stkowski@99-189-114-57.lightspeed.sntcca.sbcglobal.net] has joined #ruby
confounds [confounds!~confounds@CPE78cd8e667600-CM78cd8e6675fd.cpe.net.cable.rogers.com] has joined #ruby
<Mon_Ouie> Probably something wrong in your C code?
<gnusosa> Yes, I have found something about rb_define_alloc_func, but don't understand how to use it.
<Mon_Ouie> Usually, in a C extension, you'll want to attach some data to Ruby objects (e.g. a C struct)
badabim [badabim!~badabim@17.246.17.121] has joined #ruby
jergason [jergason!~jergason@128.187.154.9] has joined #ruby
<Mon_Ouie> You do that by setting the allocation function to something that will allocate the object with the data attached (using e.g. Data_Wrap_Struct)
omry_ [omry_!~omry@DSL212-235-83-63.bb.netvision.net.il] has joined #ruby
elliot98 [elliot98!~elliot@77.125.140.132] has joined #ruby
wroathe [wroathe!~wroathe@75-146-189-233-Minnesota.hfc.comcastbusiness.net] has joined #ruby
kidoz [kidoz!~kidoz@85.159.44.109] has joined #ruby
omry_ [omry_!~omry@DSL212-235-83-63.bb.netvision.net.il] has joined #ruby
elliot98 [elliot98!~elliot@unaffiliated/elliot98] has joined #ruby
j3r0m3 [j3r0m3!~j3r0m3@50-0-128-97.dsl.dynamic.sonic.net] has quit ["Leaving"]
j3r0m3 [j3r0m3!~j3r0m3@50-0-128-97.dsl.dynamic.sonic.net] has joined #ruby
<gnusosa> Mon_Ouie: I don't want to take more of your time is there more documentation of this, most I've found is like pretty straight-foward, but don't explain anything.
Axsuul [Axsuul!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby
<gnusosa> forward*
cousine [cousine!~cousine@196.221.242.180] has joined #ruby
enroxorz-gypsy [enroxorz-gypsy!~enroxorz@unaffiliated/enroxorz] has quit [#ruby]
yekta [yekta!~yekta@c-24-1-182-219.hsd1.il.comcast.net] has joined #ruby
aantix [aantix!~jjones@70-36-141-115.dsl.dynamic.sonic.net] has joined #ruby
<Mon_Ouie> I haven't seen much more than README.EXT
jergason [jergason!~jergason@128.187.154.9] has joined #ruby
<burgestrand> I second that. README.ext and reading the actual source is pretty much the best place for information on C extensions.
jankly [jankly!~jankly@c-71-57-99-219.hsd1.in.comcast.net] has joined #ruby
<burgestrand> I recall having a link to some mini-tutorial that wasn’t the best in the world but had good information that’s hard to figure out as a C-ext newbie.
Marco [Marco!~marco@pat32.dartmouth-secure.border1-cfw.Dartmouth.EDU] has joined #ruby
Marco [Marco!~marco@129.170.237.186] has joined #ruby
dasfugufish [dasfugufish!~Adium@208-38-192-20.mammothnetworks.com] has joined #ruby
adac [adac!~adac@95.171.49.24] has joined #ruby
<adac> wondering: hwo can I loop through all keys of a hash?
<Mon_Ouie> hash.each_key
conor_ireland [conor_ireland!~conor_ire@89.100.121.49] has joined #ruby
<burgestrand> gnusosa: http://karottenreibe.github.com/2009/10/18/ruby-c-extension/ is what I were thinking of
jonathanwallace [jonathanwallace!~jonathanw@99-11-165-168.lightspeed.tukrga.sbcglobal.net] has joined #ruby
adeponte [adeponte!~adeponte@pool-173-51-131-197.lsanca.fios.verizon.net] has joined #ruby
ChampS_ [ChampS_!~ChaosBot@p54B4AE3D.dip.t-dialin.net] has joined #ruby
jbpros [jbpros!~jbpros@213-177-112-217.dyn.adsl.belcenter.be] has joined #ruby
akem [akem!~akem@222.144.120.78.rev.sfr.net] has joined #ruby
akem [akem!~akem@unaffiliated/akem] has joined #ruby
<gnusosa> burgestrand: Thank you.
<adac> Mon_Ouie, hmm ok. I think i have a ther error then... this is what i do in a loop http://pastie.org/3133045 but in the end the length of @custom_hash remains 1
cjk101010 [cjk101010!~ckruse@painkiller.defunced.de] has joined #ruby
<canton7> adac, you're overwriting @custom_hash on each iteration
looopy [looopy!~looopy@pool-141-156-51-14.washdc.btas.verizon.net] has joined #ruby
<adac> canton7, doesn't this mean i save it on position (key) count? @custom_hash = {count => value_array}
<Mon_Ouie> It means you set @custom_hash to a new hash
<Mon_Ouie> Only the last hash you create will remain accessible later on
<canton7> adac, so on the first iteration, e.g. @custom_hash = {1 => ['yay']}. On the second iteration it might be @custom_hash = {2 => ['bar']}
jasdeepjaitla [jasdeepjaitla!~jasdeepja@c-98-207-73-250.hsd1.ca.comcast.net] has joined #ruby
<adac> canton7, right
<canton7> adac, you probably want @custom_hash[count] = value_array
<adac> Mon_Ouie, i see... hmmm
<canton7> (assuming you've got a line like @custom_hash = Hash.new somewhere above, to initialise @custom_hash to an empty hash)
<adac> ok canton7 i try that
<adac> canton7, yes I have
<canton7> (btw, what's preferred style-wise: var = Hash.new or var = {} ?)
<Mon_Ouie> var = {}
<Mon_Ouie> And [] for arrays, instead of Array.new
cyri_ [cyri_!~cyri_@jem75-1-87-88-118-80.dsl.sta.abo.bbox.fr] has joined #ruby
<canton7> cool, that's my preference, but I've seen a lot of Hash.new lately
<Mon_Ouie> I only use Hash.new when I want to pass arguments to it
jasdeepjaitla [jasdeepjaitla!~jasdeepja@c-98-207-73-250.hsd1.ca.comcast.net] has joined #ruby
puru7 [puru7!~Purusho@173-164-146-14-SFBA.hfc.comcastbusiness.net] has joined #ruby
<Mon_Ouie> (a default value or a default proc)
<burgestrand> Most often you only use Hash.new/Array.new if you use them in the way you can’t with [] and {}
<burgestrand> … what Mon_Ouie said, essentially :p
<canton7> cool, that's what I thought prior to seeing 'Hash.new' dotted about the place :P
<canton7> cheers
<davidcelis> you should change all those Hash.news into {}
<canton7> they're not in code I maintain, just other people's stuff
<davidcelis> you should do it anyway
<canton7> adac, each_with_index exists, btw, which might let you get rid of that 'count' variable
havenn [havenn!~skipper@pool-71-189-126-188.lsanca.fios.verizon.net] has joined #ruby
<canton7> davidcelis, haha! "Hey, new pull request... I didn't like your style"
looopy_ [looopy_!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby
jasdeepjaitla [jasdeepjaitla!~jasdeepja@c-98-207-73-250.hsd1.ca.comcast.net] has joined #ruby
booginga [booginga!~booginga@204-15-4-10-static.webjogger.net] has joined #ruby
savage-_ [savage-_!~savage-@209.118.197.220] has joined #ruby
jonatha__ [jonatha__!~jonathanw@99-11-165-168.lightspeed.tukrga.sbcglobal.net] has joined #ruby
savage-_ [savage-_!~savage-@209.118.197.220] has joined #ruby
zakwilson [zakwilson!~quassel@c-69-180-70-100.hsd1.fl.comcast.net] has joined #ruby
vmatiyko [vmatiyko!~vmatiyko@178.121.196.169] has quit [#ruby]
Morkel [Morkel!~Morkel@xdsl-87-78-206-32.netcologne.de] has joined #ruby
Helius [Helius!~Adium@93-35-230-223.ip57.fastwebnet.it] has joined #ruby
mikeric [mikeric!~mike@96.49.104.11] has joined #ruby
Spockz [Spockz!~Spockz@21pc198.sshunet.nl] has joined #ruby
desireco [desireco!~textual@12.34.4.33] has joined #ruby
trivol [trivol!~aurelien@ip-178.net-89-2-84.rev.numericable.fr] has joined #ruby
Spockz [Spockz!~Spockz@21pc198.sshunet.nl] has joined #ruby
jhunter [jhunter!~jtown@c-67-169-75-5.hsd1.ca.comcast.net] has joined #ruby
savage-_ [savage-_!~savage-@209.118.197.220] has joined #ruby
savage-_ [savage-_!~savage-@209.118.197.220] has joined #ruby
havenn [havenn!~skipper@pool-71-189-126-188.lsanca.fios.verizon.net] has joined #ruby
toy_battery [toy_battery!~toy_batte@216.101.134.150] has joined #ruby
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby
durre [durre!~kvirc@217-212-242-4.customer.telia.com] has joined #ruby
altivec [altivec!~altivec@81.30.179.24.dynamic.ufanet.ru] has joined #ruby
baroquebobcat [baroquebobcat!~nick@70-90-113-174-co.denver.hfc.comcastbusiness.net] has joined #ruby
mikeric [mikeric!~mike@96.53.33.22] has joined #ruby
Manhose [Manhose!~Manhose@bl6-38-193.dsl.telepac.pt] has joined #ruby
grekko [grekko!~grekko@HSI-KBW-078-043-185-121.hsi4.kabel-badenwuerttemberg.de] has joined #ruby
toy_battery_ [toy_battery_!~choldbroo@216.101.134.132] has joined #ruby
GreaseMonkey [GreaseMonkey!~gm@unaffiliated/greasemonkey] has joined #ruby
j3ll3 [j3ll3!~jelle@2001:470:7938:1:3936:ed7a:ac89:7958] has joined #ruby
stayarrr [stayarrr!~olivererx@dslb-178-009-059-241.pools.arcor-ip.net] has joined #ruby
TheIronWolf [TheIronWolf!~theironwo@208.90.215.35] has joined #ruby
snearch [snearch!~snearch@e179158116.adsl.alicedsl.de] has joined #ruby
kirun_ [kirun_!~kirun@78-86-154-194.zone2.bethere.co.uk] has joined #ruby
bigesttitty [bigesttitty!~notjulie@unaffiliated/furryfishy] has joined #ruby
badabim [badabim!~badabim@17.245.88.120] has joined #ruby
headius [headius!~headius@71-210-151-185.mpls.qwest.net] has joined #ruby
mensch [mensch!~mensch@c-174-62-210-182.hsd1.ma.comcast.net] has joined #ruby
crankycoder [crankycoder!~crankycod@66.207.208.98] has quit ["Leaving..."]
j3ll3 [j3ll3!~jelle@2001:470:7938:1:3936:ed7a:ac89:7958] has quit ["Linkinus - http://linkinus.com"]
cooper [cooper!~mitchell@unaffiliated/furryfishy] has joined #ruby
SpitfireWP [SpitfireWP!~spitfire@wikipedia/spitfire] has joined #ruby
indeterminate [indeterminate!~sei@user-3c2h3m6.cable.mindspring.com] has joined #ruby
y3llow_ [y3llow_!~y3llow@114-36-226-184.dynamic.hinet.net] has joined #ruby
s0ber_ [s0ber_!~s0ber@114-36-226-184.dynamic.hinet.net] has joined #ruby
y3llow [y3llow!~y3llow@114-36-226-184.dynamic.hinet.net] has joined #ruby
arthurlockhart [arthurlockhart!~cinch@60-242-128-8.static.tpgi.com.au] has joined #ruby
havenn [havenn!~skipper@pool-71-189-126-188.lsanca.fios.verizon.net] has joined #ruby
y3llow [y3llow!~y3llow@114-36-226-184.dynamic.hinet.net] has joined #ruby
nonotza [nonotza!~nonotza@66.246.94.130] has joined #ruby
jbpros [jbpros!~jbpros@213-177-112-217.dyn.adsl.belcenter.be] has joined #ruby
jonathanwallace [jonathanwallace!~jonathanw@99-11-165-168.lightspeed.tukrga.sbcglobal.net] has joined #ruby
y3llow [y3llow!~y3llow@114-36-226-184.dynamic.hinet.net] has joined #ruby
ia9371 [ia9371!~ia9371@ip70-160-35-230.hr.hr.cox.net] has joined #ruby
RomD [RomD!~Roman@nrbg-4dbe2cb5.pool.mediaWays.net] has joined #ruby
mickn [mickn!~mickn@unaffiliated/mickn] has joined #ruby
stephans [stephans!~stephans@209.66.114.6] has joined #ruby
logic [logic!~logic@unaffiliated/bitch333z] has joined #ruby
puru7 [puru7!~Purusho@173-164-146-14-SFBA.hfc.comcastbusiness.net] has quit [#ruby]
jensn [jensn!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby
dankest [dankest!~dankest@wsip-174-75-64-190.sb.sd.cox.net] has joined #ruby
<dankest> How can I merge two groups of models made using the Model.where() method?
<dankest> .merge() and .concat() don't seem to maintain the fact that the arrays are groups of one model.
newellista_ [newellista_!~snewell@gw.voonami.com] has joined #ruby
havenn [havenn!~skipper@pool-108-0-200-241.lsanca.fios.verizon.net] has joined #ruby
booginga [booginga!~booginga@204-15-4-10-static.webjogger.net] has quit ["Leaving"]
Manhose [Manhose!~Manhose@bl6-38-193.dsl.telepac.pt] has joined #ruby
<robyurkowski> so, dankest, you mean that each array is like... [<User 1>, <User 2>, <User 3>], [<User 4>, <User 5>, <User 6>]
<dankest> yes
<Tasser> dankest, #rubyonrails ?
<dankest> Tried there, was sort of hoping this was a differeny community
<dankest> Sorry for double posting
<dankest> robyurkowski: Yes. Merge only returns one of the arrays, and concat fails."
<robyurkowski> dankest
<robyurkowski> try 'array1 | array2'
strife25 [strife25!strife25@nat/ibm/x-beoewsbxczoojvph] has joined #ruby
Spockz` [Spockz`!~Spockz@21pc198.sshunet.nl] has joined #ruby
<dankest> robyurkowski: Nope. Is there something wrong with this statement? "@feed_items = old_feed_items || @feed_items"
<dankest> OR
<dankest> OH
<robyurkowski> not ||
<dankest> One pipe, sorry
<dankest> lol
<robyurkowski> yep
<dankest> 1 sec
<robyurkowski> union
<dankest> robyurkowski: You are excellent. Thank you.
<robyurkowski> np
<dankest> robyurkowski: Why isn't Rails seeing the array as a group of a single model? I can't run an .order() on it.
<robyurkowski> because they're technically not arrays
<robyurkowski> when you do union, you'll convert them to arrays
<dankest> What are they originally?
<dankest> A hash maybe?
<robyurkowski> i might be mistaken, but they're a lazy-loaded activerecord query object
<robyurkowski> what are you trying to do?
<robyurkowski> gimme a gist of your code :)
<dankest> I can call all to force load them so lazy-loading is off
<robyurkowski> can you explain to me what this code is doing?
rickmasta [rickmasta!~rickmasta@pool-71-183-247-164.nycmny.fios.verizon.net] has joined #ruby
havenn [havenn!~skipper@pool-108-0-200-241.lsanca.fios.verizon.net] has joined #ruby
<dankest> Sure
<dankest> I've TA'd the same class two quarters in a row.
<dankest> I want to merge all my feed_items from the the previous course(s) of the same title into the lazy-loaded relation thing of the current classes items.
<dankest> and I want to sort them by their created_at timestamp
<robyurkowski> feed_items being?
durre [durre!~kvirc@217-212-242-4.customer.telia.com] has joined #ruby
<dankest> comments
<dankest> it's a comment feed in the view
kpshek [kpshek!~kpshek@159.140.254.98] has joined #ruby
<robyurkowski> okay, my suggestion
<robyurkowski> take that union
<robyurkowski> and then just run a sort_by on that array
vraa [vraa!~vraa@c-76-30-135-64.hsd1.tx.comcast.net] has joined #ruby
<robyurkowski> there's probably a better way to do it, but that's definitely functional
<robyurkowski> and the better way is database tomfoolery
<dankest> ah, haha
<dankest> Thanks, I'll try that. I really appreciate it.
confounds [confounds!~confounds@CPE78cd8e667600-CM78cd8e6675fd.cpe.net.cable.rogers.com] has joined #ruby
<robyurkowski> np
<dankest> Is there a reason it doesn't just load the objects in to the array as it would be intuitively? Or do I just not understand the system well enough to get the point?
ferbass [ferbass!~ferbass@186-210-016-017.xd-dynamic.ctbcnetsuper.com.br] has joined #ruby
<canton7> if it did that, it would have to load each of the objects up completely, from the database, before sticking them in the array
<canton7> regardless of whether or not you actually end up reading them
bbttxu [bbttxu!~adam@24-178-212-229.static.ftwo.tx.charter.com] has joined #ruby
<canton7> by being lazy, it can intercept your request to read one of the "array" items, and sneakily load the item you've requested from the database, meaning that only the objects that you actually end up reading are loaded
robbyoconnor [robbyoconnor!~wakawaka@guifications/user/r0bby] has joined #ruby
<ia9371> how would i go about editing a mac user databse
<ia9371> i mean a sqlite database
<canton7> the sqlite3 gem is nice
yekta [yekta!~yekta@c-24-1-182-219.hsd1.il.comcast.net] has joined #ruby
omry_ [omry_!~omry@DSL212-235-83-63.bb.netvision.net.il] has joined #ruby
quest88 [quest88!~quest88@12.181.53.115] has joined #ruby
ciopte7_ [ciopte7_!~thomascio@cpe-071-071-047-213.triad.res.rr.com] has joined #ruby
fridim_ [fridim_!~fridim@2a01:e35:2ece:f2d0:223:4eff:fe6c:c754] has joined #ruby
BrianE [BrianE!~brian@91.125.93.181] has joined #ruby
newellista [newellista!~snewell@gw.voonami.com] has joined #ruby
baniseterfiend` [baniseterfiend`!~baniseter@118.82.185.158] has joined #ruby
wilmoore_ [wilmoore_!~wilmoore@70-89-165-49-ISTS-co.hfc.comcastbusiness.net] has joined #ruby
Marco [Marco!~marco@129.170.237.186] has joined #ruby
jensn [jensn!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby
mooijk [mooijk!~moijk@ti0090a380-dhcp0845.bb.online.no] has joined #ruby
mooijk [mooijk!~moijk@ti0090a380-dhcp0845.bb.online.no] has quit ["Be back later"]
jackerran [jackerran!~jackerran@fw.luckie.net] has joined #ruby
milktrader [milktrader!~milktrade@67.197.35.103] has joined #ruby
mmokrysz [mmokrysz!~mmokrysz@pdpc/supporter/student/mmokrysz] has joined #ruby
cozmoo [cozmoo!~cozmoo@c-76-29-8-53.hsd1.il.comcast.net] has joined #ruby
<cozmoo> dk00@ubuntu:~$ cd AutoSiriProxy
<cozmoo> dk00@ubuntu:~/AutoSiriProxy$ sudo ruby start.rb
<cozmoo> [sudo] password for dk00:
<cozmoo> Invalid gemspec in [/var/lib/gems/1.8/specifications/faraday-0.7.5.gemspec]: invalid date format in specification: "2011-10-04 00:00:00.000000000Z"
<cozmoo> Invalid gemspec in [/var/lib/gems/1.8/specifications/twitter-2.0.2.gemspec]: invalid date format in specification: "2011-12-07 00:00:00.000000000Z"
<cozmoo> can anyone help please
<milktrader> Suppose I start with an empty array and want to append to it every hour, what control flow is best suited?
<baniseterfiend`> cozmoo: rm /var/lib/gems/1.8/specifications/twitter-2.0.2.gemspec]
<baniseterfiend`> cozmoo: rm /var/lib/gems/1.8/specifications/twitter-2.0.2.gemspec
<cozmoo> thats it?
tesmar [tesmar!~tesmar@adsl-74-162-147-73.rmo.bellsouth.net] has joined #ruby
vjacob [vjacob!~vjacob@87.61.170.233] has joined #ruby
<baniseterfiend`> cozmoo: try it
carlyle [carlyle!~carlyle@216.133.69.20] has joined #ruby
wilmoore [wilmoore!~wilmoore@70-89-165-49-ISTS-co.hfc.comcastbusiness.net] has joined #ruby
havenn [havenn!~skipper@pool-72-67-31-69.lsanca.fios.verizon.net] has joined #ruby
Sliker [Sliker!~ponies@31.185.131.187] has joined #ruby
<cozmoo> dk00@ubuntu:~/AutoSiriProxy$ sudo ruby start.rb
<cozmoo> [sudo] password for dk00:
<cozmoo> Invalid gemspec in [/var/lib/gems/1.8/specifications/faraday-0.7.5.gemspec]: invalid date format in specification: "2011-10-04 00:00:00.000000000Z"
<cozmoo> from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:572:in `start_server'
<cozmoo> from ./siriProxy.rb:400:in `initialize'
<cozmoo> from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `call'
<cozmoo> from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
<cozmoo> from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
<cozmoo> from ./siriProxy.rb:399:in `initialize'
<cozmoo> from start.rb:11:in `new'
<cozmoo> from start.rb:11
<cozmoo> dk00@ubuntu:~/AutoSiriProxy$
GSpotAssassin [GSpotAssassin!u4086@gateway/web/irccloud.com/x-pmulrmcpjhtvlsgl] has joined #ruby
nonotza [nonotza!~nonotza@66.246.94.130] has joined #ruby
<davidcelis> cozmoo: Refer to the channel topic, please... Paste >3 lines of text in https://gist.github.com/ or http://pastie.org/
shaatar [shaatar!u648@gateway/web/irccloud.com/x-rchidsluqgynlnue] has joined #ruby
<cozmoo> how do i fix it
robbyoconnor [robbyoconnor!~wakawaka@guifications/user/r0bby] has joined #ruby
<cozmoo> dk00@ubuntu:~/AutoSiriProxy$ sudo ruby start.rb
<cozmoo> [sudo] password for dk00:
<cozmoo> Invalid gemspec in [/var/lib/gems/1.8/specifications/faraday-0.7.5.gemspec]: invalid date format in specification: "2011-10-04 00:00:00.000000000Z"
<cozmoo> var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:572:in `start_tcp_server': no acceptor (RuntimeError)
<cozmoo> from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:572:in `start_server'
<cozmoo> from ./siriProxy.rb:400:in `initialize'
<cozmoo> from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `call'
<cozmoo> from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
<cozmoo> from /var/lib/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
<cozmoo> from ./siriProxy.rb:399:in `initialize'
<cozmoo> from start.rb:11:in `new'
<cozmoo> from start.rb:11
<cozmoo> dk00@ubuntu:~/AutoSiriProxy$
<cozmoo> please help
<canton7> you listen to davidcelis, for a start
adeponte [adeponte!~adeponte@67.110.253.162.ptr.us.xo.net] has joined #ruby
<davidcelis> cozmoo: Stop.
halcyonCorsair [halcyonCorsair!~quassel@2404:130:0:1000:e269:95ff:fe3c:c570] has quit ["http://quassel-irc.org - Chat comfortably. Anywhere."]
<canton7> cozmo, gem update --system
<canton7> cozmoo ^^
ben_alman [ben_alman!~cowboy@awesome.benalman.com] has joined #ruby
relix [relix!u2146@gateway/web/irccloud.com/x-oukkgyeklmbdeskt] has joined #ruby
ferbass [ferbass!~ferbass@177.35.204.136] has joined #ruby
s_much [s_much!~butt_hurt@c-68-36-123-133.hsd1.nj.comcast.net] has joined #ruby
stephans [stephans!~stephans@209.66.114.6] has joined #ruby
savage- [savage-!~savage-@209.118.197.220] has joined #ruby
tommyvyo [tommyvyo!~tommyvyo@38.123.129.115] has joined #ruby
ferbass [ferbass!~ferbass@177.35.204.136] has joined #ruby
rickmasta [rickmasta!~rickmasta@pool-71-183-247-164.nycmny.fios.verizon.net] has joined #ruby
<cozmoo> ok ty
ferbass_ [ferbass_!~ferbass@177.35.204.136] has joined #ruby
thecreators [thecreators!~rskagy@cpe-65-27-201-203.cinci.res.rr.com] has joined #ruby
eeweb [eeweb!~eeweb@c-76-18-4-239.hsd1.fl.comcast.net] has joined #ruby
GSpotAssassin [GSpotAssassin!u4086@gateway/web/irccloud.com/x-yydzpybdoprvmrhm] has joined #ruby
savage-_ [savage-_!~savage-@209.118.197.220] has joined #ruby
dkannan [dkannan!u480@gateway/web/irccloud.com/x-qqiikmymomwcyqzt] has joined #ruby
MekkisFreenode [MekkisFreenode!~MekkisFre@2a00:dd0:0:6:80a6:4fff:fec7:d456] has joined #ruby
tilde[afk] [tilde[afk]!~tilde@host226-185-dynamic.23-79-r.retail.telecomitalia.it] has joined #ruby
Newbs [Newbs!~textual@host-78-147-55-166.as13285.net] has joined #ruby
atmosx [atmosx!~atmosx@191.116.broadband5.iol.cz] has joined #ruby
rjfranco [rjfranco!~rjfranco@173-12-179-225-oregon.hfc.comcastbusiness.net] has joined #ruby
zenergi [zenergi!~zenergi@pdpc/supporter/student/zenergi] has joined #ruby
shaatar [shaatar!u648@gateway/web/irccloud.com/x-ioavxcvehfbmhjgm] has joined #ruby
relix [relix!u2146@gateway/web/irccloud.com/x-wghsimcfsovctngv] has joined #ruby
<shevy> dumdedum
afspear [afspear!~andrews@66.194.234.130] has joined #ruby
cgutshal [cgutshal!~cgutshal@157.182.195.178] has joined #ruby
aspiers [aspiers!~adam@70.83.187.81.in-addr.arpa] has joined #ruby
denysonique_ [denysonique_!u484@gateway/web/irccloud.com/x-ieadhrsvpjowlffp] has joined #ruby
luckman212_ [luckman212_!~irc@pool-108-41-8-176.nycmny.fios.verizon.net] has joined #ruby
<aspiers> hi all, this should be an easy one: what's the cleanest way of splitting a Hash into an array of singleton hashes?
mikeric [mikeric!~mike@96.53.33.22] has joined #ruby
<shevy> singleton hashes?
<aspiers> the context is: def foo(*extra); args =[ :a, :b => 1 ] + singleton_hashes(extra); bar *args; end
<aspiers> i.e. I want to normally call bar with args :a, :b => 1
<banisterfiend> aspiers: that's not even proper hash syntax
<aspiers> but sometimes also append other parameters
<aspiers> banisterfiend: it's not supposed to be
<aspiers> oh ok, I mean: args = [ :a, { :b => 1 } ]
<banisterfiend> aspiers: ah, i see
<shevy> hmm
<aspiers> cut'n'paste from the original which was: bar :a, :b => 1
s_much [s_much!~butt_hurt@c-68-36-123-133.hsd1.nj.comcast.net] has joined #ruby
<aspiers> so foo(:c => 2) would result in bar :a, :b => 1, :c => 2
<aspiers> foo(:c => 2, :d => 3) would result in bar :a, :b => 1, :c => 2, :d => 3 etc.
<aspiers> I could do it with extra.map but that seems clunky
<aspiers> surely there must be an elegant solution
<banisterfiend> aspiers: what if someone goes: foo(:c => 1)
<banisterfiend> aspiers: you get: :a => -1, :b => 0, :c => 1 ?
<aspiers> it would result in calling: bar :a, :b => 1, :c => 1
<banisterfiend> i dont really understand what kind of logic is driving this
<aspiers> I want a wrapper around an existing variable arguments method
<banisterfiend> how do u determine which number gets associated with a hash key?
<aspiers> (it's post in Rails, although that's not really relevant)
<canton7> hmm, so someone correct me if I'm mistaken, but your function definition would have to be something like def foo(*a, h), where *a collects the array args, and h collects the hash args.
<aspiers> banisterfiend: number?
<banisterfiend> aspiers: :c => 2 <--- you associate 2 with c
<canton7> oops, misread the original Q
<banisterfiend> how do you know it's 2 and not 57
<aspiers> banisterfiend: numbers are irrelevant here, I could have written strings
<canton7> either way, the hashes always have to be in the final array element
<banisterfiend> then where did that '1' suddenly arrive from in :b => 1
<aspiers> banisterfiend: that was just an example
<Newbs> can anyone solve my problem? i will happily pa
<Newbs> pay*
<aspiers> banisterfiend: I could have written foo(:c => 'two', :d => 'three') would result in bar :a, :b => 1, :c => 'two', :d => 'three'
<aspiers> banisterfiend: the class of the hash values could be anything
<banisterfiend> aspiers: but there you dont even specify the value for :b, how does it know to give it 1, or where does it get the value from?
<aspiers> banisterfiend: it's inside the wrapper function
<banisterfiend> you say it 'would result in', i assumed there was some rationale behidn the hash keys being associated with those values
<aspiers> ok, start again
<banisterfiend> aspiers: sorry i dont understand a word you're talking about
<banisterfiend> but i gotta go now anyway
<banisterfiend> goodluck!
<aspiers> I am trying wrap an existing function
<aspiers> which takes an arbitrary number of args
<canton7> so args[-1].merge!(extra[-1]); args += extra[0..-2]; or something like that?
<aspiers> canton7: nope, extra defaults to {}
<aspiers> the existing function is bar
<aspiers> and can be called like this: bar :foo
<canton7> personally I'd split the array and the hash out... so def foo(*a, h) is the function prototype
<canton7> maybe h={} if you want a define
<aspiers> or this: bar :foo, :another => 'one', :andanother => 'two'
<aspiers> usually I want bar to be called like this: bar :foo, :another => 'one'
s_much [s_much!~butt_hurt@c-68-36-123-133.hsd1.nj.comcast.net] has quit [#ruby]
<aspiers> but sometimes I want to add :andanother => 'two'
<aspiers> or even two extra (key, value) pairs
<aspiers> make sense?
echo419r [echo419r!~eeweb@c-76-18-4-239.hsd1.fl.comcast.net] has quit [#ruby]
<aspiers> canton7: so foo has to be defined starting as follows: def foo(*extra = {})
<canton7> aspiers, correct me if I'm wrong, but that gives me a syntax error...
chrisja [chrisja!~chris@5ac7d92c.bb.sky.com] has joined #ruby
<aspiers> sorry - def foo(extra = {})
<aspiers> the optional extra parameters form a hash
<aspiers> which needs to be merged to the default arguments for bar
cesario [cesario!u2444@gateway/web/irccloud.com/x-jysiudycgfpnusrh] has joined #ruby
derailed_ [derailed_!~textual@i190010.upc-i.chello.nl] has joined #ruby
<aspiers> ah, I've got it
<derailed_> hi, can someone briefly explain me how gems work. i.e. some gem install executabel files, how does my bash/zsh know that they exist? does it alter the path or something?
<derailed_> for instance, if i install sass or less i can just type sass/less in the shell and it magically works.
GSpotAssassin [GSpotAssassin!u4086@gateway/web/irccloud.com/x-bdungijpaklrbnll] has joined #ruby
<canton7> aspiers, v
<shevy> derailed_ I think if they are put into bin/ they are somehow available
<shevy> perhaps they get copied to /usr/bin too, not sure
<aspiers> derailed_: echo $PATH
<derailed_> brb
dkannan [dkannan!u480@gateway/web/irccloud.com/x-ovsctmqvqhbcbhsn] has joined #ruby
eregon [eregon!~eregon@eregon.me] has joined #ruby
<aspiers> canton7: the signature is actually this: def post(path, parameters = nil, headers = nil)
<aspiers> canton7: so I can just use Hash#merge
<shevy> for instance, rake sits at /usr/bin/rake here
<derailed_> so does gem install then add it to the /bin folder?
<aspiers> shevy: that's probably from your distro
<aspiers> derailed_: use 'which'
<shevy> if the rubygem project puts them into the bin/ I think they get copied to /usr/bin
<aspiers> shevy: nope
<derailed_> ok, cause i am confused, some things haml/sas/ etc are working, but latest version of middleman aint
<derailed_> while if i go to gem directory/bin i can start it there
<aspiers> derailed_: require 'rubygems'
relix [relix!u2146@gateway/web/irccloud.com/x-oeabhqlmumimnhvz] has joined #ruby
<aspiers> derailed_: that's how gems get found
thecreators [thecreators!~rskagy@cpe-65-27-201-203.cinci.res.rr.com] has joined #ruby
<aspiers> derailed_: but if you are talking about executables installed by gems, then it depends on how you installed them
<derailed_> ah! right
<derailed_> i used rvm install
<aspiers> rvm modifies $PATH
<derailed_> rvm install middleman --pre
<aspiers> did you run echo $PATH like I told you to?
asobrasil [asobrasil!~asantioli@palpatine.privatedns.com] has quit [#ruby]
<derailed_> aspiers yes, i seen the bin path of rvm
<aspiers> mine includes /home/adam/.rvm/gems/ruby-1.9.3-p0/bin
<aspiers> all gem executables go there
<derailed_> that makes sense, i just don't understand why middleman does not gets coppied into it.
<derailed_> other gems that offer bins seem to be in there, what does it need to qualify being copied?
<aspiers> maybe it's a bug with middleman
<aspiers> or maybe it's not supposed to install an executable
<aspiers> never used middleman
rafacv [rafacv!~rafacv@201-25-69-81.gnace701.dsl.brasiltelecom.net.br] has joined #ruby
SeanTAllen [SeanTAllen!u4855@gateway/web/irccloud.com/x-heuhxrolevasymsj] has joined #ruby
<derailed_> it is awesome !
<derailed_> ok but thanks for heads up
tomzx [tomzx!~tomzx@dsl-216-221-39-59.aei.ca] has joined #ruby
<derailed_> can i force gem to recopy the bins?
<aspiers> gem help install
hinogi [hinogi!~Stefan@facade/contributor/hinogi] has joined #ruby
<derailed_> thanks!
patricksroberts [patricksroberts!u3278@gateway/web/irccloud.com/x-dcjhpieneacnjhqk] has joined #ruby
davidboy [davidboy!u3228@gateway/web/irccloud.com/x-bgdmezmsrtlzqopq] has joined #ruby
bieirfan [bieirfan!~bieirfan@41.35.215.188] has joined #ruby
nari_ [nari_!~nari@p62e32d.totrnt01.ap.so-net.ne.jp] has joined #ruby
MetaCosm [MetaCosm!u514@gateway/web/irccloud.com/x-mggnydtrwpjxcdvl] has joined #ruby
MetaCosm [MetaCosm!u514@unaffiliated/metacosm] has joined #ruby
MetaCosm [MetaCosm!u514@gateway/web/irccloud.com/x-mggnydtrwpjxcdvl] has joined #ruby
dnyy [dnyy!u2106@gateway/web/irccloud.com/x-fldooxwskamnqyzr] has joined #ruby
tommyvyo[cloud] [tommyvyo[cloud]!u5016@gateway/web/irccloud.com/x-lbitzelpcezjgysw] has joined #ruby
denysonique_ [denysonique_!u484@gateway/web/irccloud.com/x-ckhghfjvdcexfpgw] has joined #ruby
apok_ [apok_!~apok@c-107-3-149-167.hsd1.ca.comcast.net] has joined #ruby
pvh [pvh!u717@gateway/web/irccloud.com/x-fqxxodsrlkrerpyb] has joined #ruby
tilde[afk] [tilde[afk]!~tilde@host226-185-dynamic.23-79-r.retail.telecomitalia.it] has joined #ruby
RomD` [RomD`!~Roman@nrbg-4d070620.pool.mediaWays.net] has joined #ruby
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby
pootpoot [pootpoot!~pootpoot@38.108.250.130] has quit [#ruby]
dcarper1 [dcarper1!~Adium@70-89-106-20-BusName-pa.panjde.hfc.comcastbusiness.net] has joined #ruby
fcoury [fcoury!u2238@gateway/web/irccloud.com/x-lvdwszjtwvnhhdju] has joined #ruby
TheTFEF [TheTFEF!JS@cpe-173-88-110-115.columbus.res.rr.com] has joined #ruby
dyer [dyer!~dyer@unaffiliated/dyer] has joined #ruby
cjk101010 [cjk101010!~ckruse@painkiller.defunced.de] has joined #ruby
Jake232 [Jake232!~textual@5e0eba40.bb.sky.com] has joined #ruby
wilmoore_ [wilmoore_!~wilmoore@70-89-165-49-ISTS-co.hfc.comcastbusiness.net] has joined #ruby
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby
kapowaz [kapowaz!u546@gateway/web/irccloud.com/x-sqlaoxdcmmqwidse] has joined #ruby
al3xnull [al3xnull!~al3xnull@cpe-76-188-178-7.neo.res.rr.com] has joined #ruby
yekta [yekta!~yekta@c-24-1-182-219.hsd1.il.comcast.net] has joined #ruby
MetaCosm [MetaCosm!u514@gateway/web/irccloud.com/x-vvwgkjmcmmwcqvue] has joined #ruby
moeSeth [moeSeth!u1029@gateway/web/irccloud.com/x-pbyvjsclebysauss] has joined #ruby
cantonic [cantonic!~cantonic@46.104.151.184] has joined #ruby
<cantonic> hey guys. i have a problem. i have a variable results = "13.242"
<cantonic> in the next line i do results[","||"."] = "" in order to remove the dot (which sometimes is a comma)
<workmad3> cantonic: doesn't look very problematic...
MekkisFreenode [MekkisFreenode!~MekkisFre@2a00:dd0:0:6:80a6:4fff:fec7:d456] has joined #ruby
<cantonic> this raises "IndexError: string not matched"
cjs226 [cjs226!~cjs226@99-61-65-242.lightspeed.austtx.sbcglobal.net] has joined #ruby
<workmad3> cantonic: yeah... that's because ","||"." is equivalent to ","
<Afal> results.gsub(/[,.]/, '') ???
<cantonic> workmad3: pardon?
<workmad3> cantonic: and not (as I think you were attempting) equivalent to results.gsub(/[,.]/, '.')
<cantonic> Afal: thank you, will try this :)
<workmad3> cantonic: ","||"." will evaluate to ","
<cantonic> oh ok...
Seisatsu [Seisatsu!~seisatsu@2001:5c0:1000:a::685] has joined #ruby
<cantonic> thought it means "," or "."
<workmad3> cantonic: it does... but it's a boolean or
SeanTAllen [SeanTAllen!u4855@gateway/web/irccloud.com/x-ngnghvhvsifivfkr] has joined #ruby
<cantonic> workmad3: yeah. if "," is not there try "."
<cantonic> right?
<workmad3> cantonic: no
denysonique_ [denysonique_!u484@gateway/web/irccloud.com/x-thjnuvxgiixwywzl] has joined #ruby
<cantonic> Oh ok...
<workmad3> cantonic: you need to remember that results[..] = '' is the same as results.[]=(.., '')
<workmad3> cantonic: i.e. it's a method call
<canton7> the "," || "." is evaluated before anything else. "," evaluates to a boolean true, so the expression evaluates to ",". This is then plugged into the next bit
<workmad3> ^^
<workmad3> canton7: better explanation than mine :)
dagnachewa [dagnachewa!~dagnachew@modemcable142.238-179-173.mc.videotron.ca] has joined #ruby
<cantonic> i think i know what you mean...
jergason [jergason!~jergason@208.97.56.66] has joined #ruby
<cantonic> thank you guys :)
<havenn> or: results.delete '.,'
<cantonic> let me try if that works...
adac [adac!~adac@2.156.176.197] has joined #ruby
j3ll3 [j3ll3!~jelle@2001:470:7938:1:3936:ed7a:ac89:7958] has joined #ruby
<workmad3> cantonic: you are aware that you're changing the meaning of the number in the result when you do that though, right?
<cantonic> workmad3: well, i need results as an integer actually
<canton7> One of the things I love about ruby... Whatever you want to do, there's almost always a method or idiom to achieve that very cleanly and obviously
strife25 [strife25!~strife25@cpe-098-026-018-050.nc.res.rr.com] has joined #ruby
veronatii [veronatii!~citrus@ip68-6-95-91.sb.sd.cox.net] has joined #ruby
<havenn> cantonic: (50.64).to_i #=> 50
<workmad3> cantonic: is it originally an integer though? because otherwise, in the example you gave, you just multiplied by 100
<canton7> if you've got the string "12,34", turning that into pence (or cents) isn't trivial
<canton7> well, other than just removing the comma
<havenn> I meant**: "50.64".to_i
<cantonic> workmad3: i am scraping that number from a website
<cantonic> ebay results actually
dnyy [dnyy!u2106@gateway/web/irccloud.com/x-ppzxlakpnycechzv] has joined #ruby
<havenn> cantonic: "1,000.00".delete(',').to_i #=> 1000
<workmad3> cantonic: ah, so it's always given to 2dp? that's fine then
<cantonic> in germany we write 13k this way: "13.000"
<cantonic> in US you write it like "13,000" (with a comma)
<havenn> cantonic: ahhh
<canton7> and in germany, it would be "13.000,00", amiright?
<cantonic> right
<cantonic> just the other way round
dasfugufish [dasfugufish!~Adium@208-38-192-20.mammothnetworks.com] has joined #ruby
<shevy> :)
nari_ [nari_!~nari@p62e32d.totrnt01.ap.so-net.ne.jp] has joined #ruby
<workmad3> cantonic: I was worried not all numbers had decimal places (or different numbers of them) which would make your operation quite dangerous ;)
<cantonic> not only in germany but in Europe I think...
<workmad3> cantonic: not in the UK
<workmad3> cantonic: here, it's 13,000.00
<shevy> well
<shevy> USA & UK same thing
<shevy> ;)
dkannan [dkannan!u480@gateway/web/irccloud.com/x-yupacyeomnheugvo] has joined #ruby
<workmad3> shevy: UK is in europe :P
<cantonic> workmad3: right, but for me UK != EU :P
<shevy> it is floating to the west man!
<workmad3> cantonic: so the fact we're in the EU doesn't count? :P
<cantonic> just kidding ;)
<shevy> ;P
<cantonic> workmad3: you do everything different
<shevy> we still owe tribute to monty python - best guys ever
<cantonic> even your cars are different...
<workmad3> cantonic: that doesn't make us less a part of Europe :P
<workmad3> cantonic: embrace diversity!
<shevy> they drive the wrong way or?
apok [apok!~apok@c-107-3-149-167.hsd1.ca.comcast.net] has joined #ruby
<cantonic> plus you don't want the Euro-Currency and still keep your own currency
<cantonic> shevy: yep :)
<workmad3> cantonic: given recent history... can you blame us?
<cantonic> hehehe… no :D
<shevy> :D
<cantonic> but why don't u do it like switzerland? they are geographically in the middle of europe but no part of the european union
j3ll3 [j3ll3!~jelle@2001:470:7938:1:3936:ed7a:ac89:7958] has quit ["WeeChat 0.3.5"]
<shevy> what
<workmad3> cantonic: because then we wouldn't be able to crap on everything the french say in the EU...
<shevy> shall the UK move geographically to the middle
<shevy> :P
<workmad3> cantonic: err... wait, I mean because we want to be part of the great european community...