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/
nowthatsamatt_ [nowthatsamatt_!~nowthatsa@adsl-98-85-39-233.mco.bellsouth.net] has joined #ruby
kemet [kemet!~wizfunk@cpe-173-095-149-009.nc.res.rr.com] has joined #ruby
kemet [kemet!~wizfunk@cpe-173-095-149-009.nc.res.rr.com] has quit [#ruby]
tommyvyo [tommyvyo!~tommyvyo@38.123.129.115] has joined #ruby
<CannedCorn> got it
hooper [hooper!~hooper@204.28.122.20] has joined #ruby
yfeldblum [yfeldblum!~Jay@c-98-218-48-253.hsd1.md.comcast.net] has joined #ruby
d3b4g [d3b4g!~d3b4g@123.176.25.98] has joined #ruby
phantomfake [phantomfake!~whats_in_@pool-71-190-229-236.nycmny.fios.verizon.net] has joined #ruby
<hooper> Hi folks, I have a question about optparse. I'd like to use multi-chars in my shortopts, ie, -ld, -lw, -lm, as well as longopts for the same flags, --local-daily, --local-weekly, --local-monthy.. is this possible?
<hooper> -> opts.on("-ry", "--remote-year INT",
<hooper> 'Remote year retention') do |ry|
<hooper> options[:ry] = ry
<hooper> end
<hooper> er. sorry for the spam
Starwiz [Starwiz!~jesse@S010600259c797e1b.ed.shawcable.net] has joined #ruby
<bookpage> best site for learning ruby?
<Starwiz> Does anyone know how I could simplify a URI from something like 'http://www.example.com/my/example/../back' from that to 'http://www.example.com/my/back'
<bookpage> Starwiz: modify your .htaccess?
<Starwiz> In ruby.
<Starwiz> For something like a web crawler.
<Starwiz> I should have been more descriptive =P
<bookpage> no idea sorry - I'm trying to convert my first program to ruby atm
kenichi [kenichi!~kenichi@c-24-20-239-11.hsd1.or.comcast.net] has joined #ruby
<Gate> bookpage: are you an experienced developer or are you looking for a beginners guide to ruby?
<waxjar> just replace (.)/.. with / using regexpes?
<Gate> waxjar: is the first string supposed to be a regexp or a literal string?
kemet [kemet!~wizfunk@cpe-173-095-149-009.nc.res.rr.com] has joined #ruby
<waxjar> a little bit of both, forgot the + in (.+)
<bookpage> Gate: i'm an experienced developer, so i want to jump straight into OO stuff
<Gate> bookpage: http://www.ruby-lang.org/ has a few guides "from other languages" that may be beneficial
<bookpage> Gate: cool, ill read up this thanks
<Gate> waxjar: so do you mean this? gsub(/(.)\/../, '/')
<Gate> which will remove the character before and the two characters after a slash
<waxjar> it's not a correct regexp, bit that's the idea, yea
<waxjar> *but
<Gate> so if you want to match literal periods, just put a \ in front of them
<waxjar> yea
techhelp [techhelp!~Dan@ip70-162-10-229.ph.ph.cox.net] has joined #ruby
<waxjar> actually Gate, use File.expand_path http://ruby-doc.org/core-1.9.3/File.html#method-c-expand_path
comron [comron!~comron@c-174-62-110-55.hsd1.ca.comcast.net] has joined #ruby
tomzx [tomzx!~tomzx@dsl-156-157.aei.ca] has joined #ruby
tommyvyo [tommyvyo!~tommyvyo@c-68-83-3-164.hsd1.nj.comcast.net] has joined #ruby
anoNxeRo [anoNxeRo!~LessIsMor@unaffiliated/nu253r/x-0655220] has joined #ruby
CreativeEmbassy [CreativeEmbassy!~CreativeE@pool-209-158-5-18.altnpa.east.verizon.net] has joined #ruby
<hooper> no optparse pros to help with an easy question about short opts?
notjohn [notjohn!~john@cpe-174-103-133-37.cinci.res.rr.com] has joined #ruby
Hellojere [Hellojere!~Hellojere@89.7.90.160] has joined #ruby
<Gate> Ah
<Gate> I didn't realize that was what you were gunning for
x77686d_ [x77686d_!~whm@uawifi-nat-210-74.arizona.edu] has joined #ruby
clockwize [clockwize!~clockwize@5ac85c0d.bb.sky.com] has joined #ruby
n00b_gloves [n00b_gloves!~n00b_glov@CPE0023bee17c0e-CM0023bee17c0b.cpe.net.cable.rogers.com] has joined #ruby
<RubyPanther> hooper: it looks like you already know what you want to do, and wrote it, it either worked or it didn't, right?
<CannedCorn> thanks for the help before RubyPanther
<RubyPanther> yw
n00b_gloves [n00b_gloves!~n00b_glov@CPE0023bee17c0e-CM0023bee17c0b.cpe.net.cable.rogers.com] has joined #ruby
<shevy> yawn????
<shevy> bookpage I would recommend that you should try to arrange the code logic into (standalone) classes whenever possible
asobrasil [asobrasil!~asantioli@palpatine.privatedns.com] has quit [#ruby]
<gigamonkey> Hmmm. I'm plaing around with the ruby koans thingy. In an attempt to understand something I tried testing what the specific character in a string is with something like assert_equal 'abc'[0], 'a' which fails yet assert_equal 'abc'[0], 'a'[0] passes.
<gigamonkey>
<shevy> bookpage, you should still work through http://pine.fm/LearnToProgram/?Chapter=01 at least once, if you are experienced it will be super easy and thus super fast
<gigamonkey> Yet in irb 'abc'[0] == 'a' is true.
<shevy> gigamonkey perhaps because of the ruby version
<shevy> not for me
<shevy> 'abc'[0,1] == 'a' should be correct in both 1.8.x and 1.9.x
counterbeing [counterbeing!~textual@208.80.66.34] has joined #ruby
<gigamonkey> Ah. Indeed.
dankest [dankest!~dankest@pool-71-102-139-138.snloca.dsl-w.verizon.net] has joined #ruby
<Gate> gigamonkey: 'abc'[0] is an integer, assert equal probably does a type comparison
hadees [hadees!~hadees@72-48-91-73.dyn.grandenetworks.net] has joined #ruby
<Gate> or not
<Gate> :/ I misunderstood, ignore that
<shevy> Bill Gates shall not be ignored!
<gigamonkey> Looks like in 1.9.3 'abc'[0] is a String.
<shevy> yeah it changed
<shevy> but I am too accustomed to [0, other_position_here]
magic_pond_tree [magic_pond_tree!~magic_pon@CPE0023bee17c0e-CM0023bee17c0b.cpe.net.cable.rogers.com] has joined #ruby
nobitanobi [nobitanobi!~novito@103.Red-213-96-26.staticIP.rima-tde.net] has joined #ruby
kpshek [kpshek!~kpshek@98.156.71.29] has joined #ruby
nobitanobi [nobitanobi!~novito@103.Red-213-96-26.staticIP.rima-tde.net] has quit [#ruby]
<hooper> RubyPanther: it truncates the last char.. so if i have opts, rd,rw,rm,ry, it will only show me 'r' on the top option
<RubyPanther> hooper: must not work for that, then
<hooper> bummer pants.. thanks
<RubyPanther> hooper: for the record, what your asking for is basically "broken" option parsing, those should all be long options like --rd --rw
<RubyPanther> because short arguments can be merged where they aren't taking arguments, like -vvvrwd
<hooper> RubyPanther: ya, I figured as much but I think I've seen some other optparsers that will let you use more than one char.. I'm using two chars because I'll also have an ld,lw,lm,ly local vs remote options, same characteristics
mengu_ [mengu_!~mengu@95.13.8.79] has joined #ruby
mengu_ [mengu_!~mengu@unaffiliated/mengu] has joined #ruby
<RubyPanther> hooper: only the most common options need short versions, the normal thing you should be assuming is that --long-descriptive-options will get used, and it is normal for most/many options to only have a long form
<shevy> hooper: hmm you could try https://github.com/injekt/slop
vraa [vraa!~vraa@99-20-202-44.lightspeed.hstntx.sbcglobal.net] has joined #ruby
<jlogsdon> shevy: slop works the same way as optparse wrt -abc style switches
<shevy> aha
<jlogsdon> And I wouldn't be surprised if any option parser you find does, it's the "unix" way of handling options
<hooper> shevy: cool, I'll check that out
<hooper> thanks shevy & RubyPanther
<hooper> In other news, I have another question
<hooper> Has anyone seen an issue while using both yaml & date? I get tons of "warning: already initialized constant" errors
<jlogsdon> perhaps yaml requires date?
<jlogsdon> so you don't need to require it yourself?
<shevy> hmm yaml alone does not
raincole_ [raincole_!~raincole@2001:288:5239:1:224:2bff:fe75:2f60] has joined #ruby
fayimora [fayimora!~fayimora@109.175.187.141] has joined #ruby
magic_pond_tree [magic_pond_tree!~magic_pon@CPE0023bee17c0e-CM0023bee17c0b.cpe.net.cable.rogers.com] has joined #ruby
wroathe [wroathe!~wroathe@173-17-249-11.client.mchsi.com] has joined #ruby
<shevy> oh man, I can tell you guys ... never bundle all your components together into one file
<hooper> jlogsdon: I'll try that out
<shevy> I have a file that includes all my modules ..
apok_ [apok_!~apok@c-107-3-149-167.hsd1.ca.comcast.net] has joined #ruby
<jlogsdon> yeah, i definitely prefer to require in the files that explicitly need the modules. if they are proliferate enough, I'll include them globally though
<hooper> jlogsdon: that was it. I pulled the "require 'Date'" and kept yaml and was still able to use Date
<hooper> Thanks!
roblak [roblak!~roblak@204.28.126.146] has joined #ruby
apok_ [apok_!~apok@c-107-3-149-167.hsd1.ca.comcast.net] has joined #ruby
bbrandon [bbrandon!~brandon@cpe-174-097-242-015.nc.res.rr.com] has joined #ruby
tatsuya_o [tatsuya_o!~tatsuya_o@46-64-51-175.zone15.bethere.co.uk] has joined #ruby
iamjarvo [iamjarvo!~Adium@c-71-230-13-201.hsd1.nj.comcast.net] has joined #ruby
mars2686 [mars2686!~mars2686@71-22-192-221.gar.clearwire-wmx.net] has joined #ruby
davidcelis [davidcelis!~david@c-76-115-58-79.hsd1.or.comcast.net] has joined #ruby
winux [winux!~tom@unaffiliated/winux] has quit [#ruby]
sdwrage [sdwrage!~sdwrage@cpe-184-57-83-165.columbus.res.rr.com] has joined #ruby
cook1es [cook1es!~chatzilla@c83-248-93-185.bredband.comhem.se] has joined #ruby
jergason [jergason!~jergason@c-67-182-209-164.hsd1.ut.comcast.net] has joined #ruby
robyurkowski [robyurkowski!~robyurkow@205.233.80.139] has joined #ruby
looopy [looopy!~looopy@pool-141-156-60-19.washdc.btas.verizon.net] has joined #ruby
raincole_ [raincole_!~raincole@2001:288:5239:1:224:2bff:fe75:2f60] has joined #ruby
<newbold> When doing Ruby via CGI, is there a way to make errors display in the browser?
bwlang [bwlang!~anonymous@static-71-245-233-146.bstnma.fios.verizon.net] has joined #ruby
tatsuya_o [tatsuya_o!~tatsuya_o@46-64-51-175.zone15.bethere.co.uk] has joined #ruby
Azure [Azure!~azt@unaffiliated/azure] has joined #ruby
sdwrage [sdwrage!~sdwrage@cpe-184-57-83-165.columbus.res.rr.com] has joined #ruby
ap3mantus [ap3mantus!~ap3mantus@c-98-217-179-108.hsd1.ma.comcast.net] has joined #ruby
colossal7 [colossal7!~colossal7@67.136.116.202] has joined #ruby
<RubyPanther> newbold: probably you would just rescue exceptions and get the backtrace from the exception
<RubyPanther> it seems like that, but my memory of it is foggy
<newbold> RubyPanther: yeah, just learning that bit now
<newbold> and that's exactly how it's done :)
Targen [Targen!~iguana@190.39.181.108] has joined #ruby
dankest [dankest!~dankest@wsip-174-75-64-190.sb.sd.cox.net] has joined #ruby
colossal7 [colossal7!~colossal7@67.136.116.202] has joined #ruby
huhu_ [huhu_!~huhu@unaffiliated/huhu-/x-6122598] has joined #ruby
senthil [senthil!~senthil@99-51-1-6.lightspeed.snjsca.sbcglobal.net] has joined #ruby
<senthil> Does 1.8.7 have something like 1.9.3's Uri#encode_www_form
mars2686 [mars2686!~mars2686@71-22-192-221.gar.clearwire-wmx.net] has joined #ruby
igotnolegs [igotnolegs!~igotnoleg@75-162-83-166.slkc.qwest.net] has joined #ruby
bwlang [bwlang!~anonymous@static-71-245-233-146.bstnma.fios.verizon.net] has joined #ruby
tommyvyo [tommyvyo!~tommyvyo@38.123.129.115] has joined #ruby
Sailias [Sailias!~jonathan@CPE0018f85e576d-CM001bd7aaaf96.cpe.net.cable.rogers.com] has joined #ruby
cespare [cespare!~cespare@eng.nat.mtv.ooyala.com] has joined #ruby
strife25 [strife25!~strife25@cpe-098-026-018-050.nc.res.rr.com] has joined #ruby
huhu_ [huhu_!~huhu@unaffiliated/huhu-/x-6122598] has joined #ruby
inteq [inteq!~justin.si@adsl-98-88-29-211.asm.bellsouth.net] has joined #ruby
colossal7 [colossal7!~colossal7@67.136.116.202] has joined #ruby
Bonkers [Bonkers!~matt@pool-108-27-21-239.nycmny.fios.verizon.net] has joined #ruby
daniel- [daniel-!~daniel@118-92-42-39.dsl.dyn.ihug.co.nz] has joined #ruby
cook1es [cook1es!~chatzilla@c83-248-93-185.bredband.comhem.se] has joined #ruby
robyurkowski [robyurkowski!~robyurkow@205.233.80.139] has joined #ruby
Banistergalaxy [Banistergalaxy!~AndChat@222.153.223.46] has joined #ruby
t0mmyvyo [t0mmyvyo!~tommyvyo@c-68-83-3-164.hsd1.nj.comcast.net] has joined #ruby
daniel- [daniel-!~daniel@118-92-42-39.dsl.dyn.ihug.co.nz] has joined #ruby
blueadept [blueadept!~blueadept@unaffiliated/blueadept] has quit ["Leaving"]
ottohenrique [ottohenrique!~ottohenri@189-46-254-248.dsl.telesp.net.br] has joined #ruby
notjohn [notjohn!~john@cpe-174-103-133-37.cinci.res.rr.com] has joined #ruby
looopy_ [looopy_!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby
yakko [yakko!~quassel@189.27.57.132.dynamic.adsl.gvt.net.br] has joined #ruby
colossal7 [colossal7!~colossal7@67.136.116.202] has joined #ruby
Hanmac1 [Hanmac1!~hanmac@p50844AC3.dip0.t-ipconnect.de] has joined #ruby
bwlang [bwlang!~anonymous@static-71-245-233-146.bstnma.fios.verizon.net] has joined #ruby
crankycoder [crankycoder!~crankycod@nat/mozilla/x-jhcprbrbdebgbwab] has joined #ruby
igotnolegs [igotnolegs!~igotnoleg@75-162-83-166.slkc.qwest.net] has joined #ruby
cobragoat [cobragoat!~cobragoat@99-47-212-16.lightspeed.frokca.sbcglobal.net] has joined #ruby
waxjar [waxjar!~waxjar@ip11-49-212-87.adsl2.static.versatel.nl] has joined #ruby
ilyam [ilyam!~ilyam@eng.nat.mtv.ooyala.com] has joined #ruby
kenperkins [kenperkins!~textual@50-47-18-37.evrt.wa.frontiernet.net] has joined #ruby
colossal7 [colossal7!~colossal7@67.136.116.202] has joined #ruby
techhelp [techhelp!~Dan@ip70-162-10-229.ph.ph.cox.net] has joined #ruby
wallerdev [wallerdev!~wallerdev@72.44.102.30] has joined #ruby
S2kx [S2kx!~S1kx@ip-95-223-80-198.unitymediagroup.de] has joined #ruby
djbkd [djbkd!~djbkd@71.39.169.14] has joined #ruby
bwlang [bwlang!~anonymous@static-71-245-233-146.bstnma.fios.verizon.net] has joined #ruby
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby
colossal7 [colossal7!~colossal7@67.136.116.202] has joined #ruby
geofridh [geofridh!~geofridh@c-76-115-235-38.hsd1.wa.comcast.net] has joined #ruby
shmuppy [shmuppy!~Jared@75-129-110-5.dhcp.aldl.mi.charter.com] has joined #ruby
dankest [dankest!~dankest@wsip-174-75-64-190.sb.sd.cox.net] has joined #ruby
headius [headius!~headius@71-210-154-45.mpls.qwest.net] has joined #ruby
colossal7 [colossal7!~colossal7@67.136.116.202] has joined #ruby
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby
vajrapani666 [vajrapani666!~vajrapani@c-69-181-26-39.hsd1.ca.comcast.net] has joined #ruby
wenbert [wenbert!~wenbert@120.28.217.169] has joined #ruby
MissionCritical [MissionCritical!~MissionCr@unaffiliated/missioncritical] has joined #ruby
radic_ [radic_!~radic@dslb-094-216-246-068.pools.arcor-ip.net] has joined #ruby
kpshek [kpshek!~kpshek@98.156.71.29] has joined #ruby
Indian_ [Indian_!~Indian@unaffiliated/londonmet050] has joined #ruby
<Banistergalaxy> Indian_ are you the worlds fastest?
ferbass [ferbass!~ferbass@177.80.253.128] has joined #ruby
colossal7 [colossal7!~colossal7@67.136.116.202] has joined #ruby
Animawish [Animawish!~Adium@71-32-194-141.slkc.qwest.net] has joined #ruby
<Animawish> what's the method that takes a string and makes it into an array of single word strings
n8ji [n8ji!~n8ji@c-24-20-239-11.hsd1.or.comcast.net] has joined #ruby
<Animawish> like "this is a string" -> ["this", "is", "a", "string"]
aces1up [aces1up!~aces1up@ip70-173-232-11.lv.lv.cox.net] has joined #ruby
<aces1up> if i have a cache that is a hash with Timestamps as the values.. how would i delete the hash entry with the lowest timestamp?
<aces1up> @dns_cache['dude3.com'] = Time.now.to_i
<aces1up> @dns_cache.min{|dns_entry, ts| ts }
<aces1up> that just returns an array
kenperkins [kenperkins!~textual@50-47-18-37.evrt.wa.frontiernet.net] has joined #ruby
tnk1 [tnk1!~tnk@ip72-195-134-180.ri.ri.cox.net] has joined #ruby
Mon_Ouie [Mon_Ouie!~Mon_Ouie@subtle/user/MonOuie] has joined #ruby
pen [pen!~pen@2002:731e:7d10:c:c4ff:dce8:43f:e443] has joined #ruby
raincole_ [raincole_!~raincole@2001:288:5239:1:224:2bff:fe75:2f60] has joined #ruby
Mon_Ouie [Mon_Ouie!~Mon_Ouie@subtle/user/MonOuie] has joined #ruby
pencilcheck [pencilcheck!~pen@2002:731e:7d10:c:88d5:35a8:69c3:edbf] has joined #ruby
Thav [Thav!~ninja@75-170-254-120.desm.qwest.net] has joined #ruby
sdwrage [sdwrage!~sdwrage@cpe-184-57-83-165.columbus.res.rr.com] has joined #ruby
dnyy [dnyy!~dnyy@c-98-237-138-38.hsd1.wa.comcast.net] has joined #ruby
gigamonk` [gigamonk`!~user@adsl-99-179-45-189.dsl.pltn13.sbcglobal.net] has joined #ruby
kasansweat [kasansweat!~kasan@fl-67-235-224-58.dhcp.embarqhsd.net] has joined #ruby
<kasansweat> noob question -- when using "Array.each { |element| ..etc -- is it possible to modify that particular element within that loop?
advorak [advorak!~advorak@216-15-16-163.c3-0.161-ubr1.lnh-161.md.cable.rcn.com] has joined #ruby
janissary [janissary!~user@adsl-98-85-0-232.mco.bellsouth.net] has joined #ruby
thomasdebenning [thomasdebenning!~thomasdeb@c-69-181-139-137.hsd1.ca.comcast.net] has joined #ruby
CreativeEmbassy [CreativeEmbassy!~CreativeE@pool-209-158-5-18.altnpa.east.verizon.net] has joined #ruby
iulius [iulius!~iulius@38.96.37.90] has joined #ruby
geofridh [geofridh!~geofridh@gateway/tor-sasl/geofridh] has joined #ruby
sdwrage [sdwrage!~sdwrage@cpe-184-57-83-165.columbus.res.rr.com] has joined #ruby
Animawish [Animawish!~Adium@71-32-194-141.slkc.qwest.net] has quit [#ruby]
andrewsmit [andrewsmit!~fullsailo@97.102.236.118] has joined #ruby
dankest [dankest!~dankest@wsip-174-75-64-190.sb.sd.cox.net] has joined #ruby
Animawish [Animawish!~Adium@71-32-194-141.slkc.qwest.net] has joined #ruby
Sailias [Sailias!~jonathan@CPE0018f85e576d-CM001bd7aaaf96.cpe.net.cable.rogers.com] has joined #ruby
idarkside [idarkside!~YourNick@5e0e912d.bb.sky.com] has joined #ruby
noname [noname!~textual@c-67-171-131-23.hsd1.wa.comcast.net] has joined #ruby
adeponte [adeponte!~adeponte@pool-173-51-131-197.lsanca.fios.verizon.net] has joined #ruby
cobragoat [cobragoat!~cobragoat@c-76-105-54-37.hsd1.ca.comcast.net] has joined #ruby
ckrailo [ckrailo!~ckrailo@pool-71-97-77-8.dfw.dsl-w.verizon.net] has joined #ruby
epochwolf [epochwolf!~epochwolf@unaffiliated/epochwolf] has joined #ruby
geofridh [geofridh!~geofridh@gateway/tor-sasl/geofridh] has joined #ruby
savage- [savage-!~savage-@c-67-180-11-89.hsd1.ca.comcast.net] has joined #ruby
pen [pen!~pen@115.30.125.182] has joined #ruby
chrxn [chrxn!~chrxn@69.4.233.32] has joined #ruby
banisterfiend [banisterfiend!~baniseter@115.189.50.18] has joined #ruby
MoMo [MoMo!u1590@gateway/web/irccloud.com/x-pdqsgrupwzulblim] has joined #ruby
adamjleonard [adamjleonard!~adamjleon@pool-108-9-169-222.tampfl.fios.verizon.net] has joined #ruby
headius [headius!~headius@71-210-154-45.mpls.qwest.net] has joined #ruby
banisterfiend [banisterfiend!~baniseter@122.63.184.145] has joined #ruby
ryanf [ryanf!~rfitz@adsl-71-141-90-67.dsl.snfc21.sbcglobal.net] has joined #ruby
<idarkside> hi
<newbold> hello
<huhu_> Hello.
<idarkside> im building a ruby script
<idarkside> i can do the ruby side of it
headius [headius!~headius@71-210-154-45.mpls.qwest.net] has joined #ruby
<idarkside> but im wondering if there is a string to use that would call www.mywebsite.com/license.php
<idarkside> and if active = continue
<idarkside> if inactive = die
wmoxam [wmoxam!~wmoxam@pdpc/supporter/active/wmoxam] has joined #ruby
<epochwolf> uh...
<epochwolf> what?
zenergi [zenergi!~zenergi@pdpc/supporter/student/zenergi] has joined #ruby
<idarkside> is there somthing i can put in my code to read www.mywebsitre.com/license.php
<idarkside> and if active = coninute loading
<idarkside> if inactive = die
<idarkside> -
<epochwolf> sure, ruby comes with the net/http library. It's not real nice to use but it works. Alternatively, I'm sure there is a gem or two out there that can make that a nicer experience.
Skaag [Skaag!~Skaag@207-38-134-148.c3-0.avec-ubr2.nyr-avec.ny.cable.rcn.com] has joined #ruby
andrewsmit [andrewsmit!~fullsailo@118.236.102.97.cfl.res.rr.com] has joined #ruby
Synthead [Synthead!~max@c-71-204-121-215.hsd1.ga.comcast.net] has joined #ruby
dankest [dankest!~dankest@wsip-174-75-64-190.sb.sd.cox.net] has joined #ruby
<RubyPanther> idarkside: openuri
jergason_ [jergason_!~jergason@c-67-182-209-164.hsd1.ut.comcast.net] has joined #ruby
frerich2 [frerich2!~frerich@mail.froglogic.com] has joined #ruby
ShiFTKey [ShiFTKey!~Shift@206.223.184.2] has joined #ruby
indeterminate [indeterminate!sei@user-3c2h3m6.cable.mindspring.com] has joined #ruby
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby
<bookpage> are strings or files read or stored in a way which doesn't include international characters?
<RubyPanther> bookpage: depends what "international characters" are, and what encoding you ask for...
<bookpage> RubyPanther: an example is the char: ä - when i read it and then output it, without specifying any encoding, it comes out as ?
<bookpage> and also, is there a good way to replace strings within a string? I've made my own method for it but it seems to trudge through the 350,000 lines slowly... compared to the String.replace("x", "y") java method at least
<newbold> bookpage: gsub()
<bookpage> newbold, right ill try it out, my one takes nearly 3 mins for 100mb of text
<newbold> I've never tried any analysis on speed, so not sure how it'll do, but that's the only way of replacing text that I know :)
Seisatsu [Seisatsu!~seisatsu@adsl-99-35-225-92.dsl.pltn13.sbcglobal.net] has joined #ruby
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby
crodas [crodas!~crodas@git.crodas.org] has joined #ruby
sterNiX [sterNiX!~LessIsMor@unaffiliated/nu253r/x-0655220] has joined #ruby
dankest [dankest!~dankest@ip184-187-165-135.sb.sd.cox.net] has joined #ruby
kenperkins [kenperkins!~textual@50-47-18-37.evrt.wa.frontiernet.net] has joined #ruby
<wallerdev> hi
huhu_ [huhu_!~huhu@94.79.112.41] has joined #ruby
Guest44828 [Guest44828!~huhu@unaffiliated/huhu-/x-6122598] has joined #ruby
fullsailor [fullsailor!~fullsailo@97.102.236.118] has joined #ruby
geofridh [geofridh!~geofridh@gateway/tor-sasl/geofridh] has joined #ruby
minijupe [minijupe!~benlieb@adsl-74-243-170-217.ard.bellsouth.net] has joined #ruby
trend [trend!~trend@76.91.169.147] has joined #ruby
dnjaramba [dnjaramba!~dnjaramba@41.72.193.86] has joined #ruby
Brandonn [Brandonn!~brandon@cpe-174-097-242-015.nc.res.rr.com] has joined #ruby
<Okasu> is there way to detect when hash key replaced with new value?
<Okasu> method maybe, saving value to var and comare with it looks not pretty
ryanf [ryanf!~rfitz@adsl-69-111-192-194.dsl.snfc21.sbcglobal.net] has joined #ruby
<Okasu> for example when in hash {key1:value, key2:value} detect when key:value replace with key1:new-value
advorak [advorak!~advorak@216-15-16-163.c3-0.161-ubr1.lnh-161.md.cable.rcn.com] has joined #ruby
<Okasu> meh, manual comprasion seems only variant
AnarchoTroll [AnarchoTroll!~c@c-71-197-218-142.hsd1.wa.comcast.net] has joined #ruby
[[thufir]] [[[thufir]]!~thufir@184.65.42.92] has joined #ruby
<[[thufir]]> from nokogiri, how can I convert html to xml? http://pastebin.mozilla.org/1457235 or is that the wrong approach?
wedtm [wedtm!~wedtm@173-12-163-78-oregon.hfc.comcastbusiness.net] has joined #ruby
sdwrage [sdwrage!~sdwrage@cpe-184-57-83-165.columbus.res.rr.com] has joined #ruby
voodoofish430 [voodoofish430!~mtorres@adsl-99-93-149-204.dsl.lsan03.sbcglobal.net] has joined #ruby
_|christian|_ [_|christian|_!~christian@190.234.253.130] has joined #ruby
amerine [amerine!~mturner@bc171197.bendcable.com] has joined #ruby
LaMMer66 [LaMMer66!~LaMMer66@189.138.238.245] has joined #ruby
brownies [brownies!~brownies@unaffiliated/brownies] has joined #ruby
enherit [enherit!~enherit@66-214-13-183.dhcp.lnbh.ca.charter.com] has joined #ruby
banisterfiend [banisterfiend!~baniseter@118.82.185.158] has joined #ruby
thone_ [thone_!~thone@g226049084.adsl.alicedsl.de] has joined #ruby
stringoO [stringoO!~JLstring@bas1-toronto42-1279599415.dsl.bell.ca] has joined #ruby
stayarrr [stayarrr!~olivererx@dslb-178-009-059-241.pools.arcor-ip.net] has joined #ruby
Animawish [Animawish!~Adium@71-32-194-141.slkc.qwest.net] has quit [#ruby]
brmouzone [brmouzone!~brmouzone@108-90-18-133.lightspeed.cicril.sbcglobal.net] has joined #ruby
tarrant [tarrant!~tarrant@mail.voidbyte.net] has joined #ruby
<aces1up> can someone help me maping a hash to another hash? i have this: http://pastebin.com/XFt3g2MU
<banisterfiend> aces1up: use Hash#select
<wallerdev> interesting
<banisterfiend> wallerdev: sup walla
<wallerdev> not much
<banisterfiend> wallerdev: http://i.imgur.com/YZHYb.gif
<wallerdev> was thinking hash select returned an array but then thought about how that mustve changed
<wallerdev> lol
<banisterfiend> wallerdev: 1.8 -> array, 1.9 -> hash
<wallerdev> yeah i think i remember the change going in
<wallerdev> I'm doing some ruby again
<wallerdev> so thats fun
<wallerdev> and playing with mongodb
<wallerdev> which is kinda confusing
<wallerdev> whats up with you banisterfiend ?
<aces1up> banisterfiend seems the example in the docs returns a hash. but i'm getting [["http://dude.com", false], ["http://dude3.com", false]]
<wallerdev> sounds like you're using ruby 1.8
<wallerdev> aces1up: you can try using Hash#delete
<wallerdev> or using ruby 1.9
<banisterfiend> aces1up: then just wrap it in Hash[]
<banisterfiend> aces1up: and get your ass into ruby 1.9 already! ;)
<aces1up> wallerdev thanks.
<aces1up> banisterfiend sorry running jruby and its stuck in 1.8 for now.
tarrant [tarrant!~tarrant@mail.voidbyte.net] has quit ["WeeChat 0.3.0"]
<banisterfiend> aces1up: jruby can run in 1.9 mode, iirc
<banisterfiend> you just have to pass a command line flag
<aces1up> yes, but i have no idea, but my app breaks gloriously if i run it in 1.9.. and i don't feel like tracking down all the issues at this juncture.
<banisterfiend> oh ok
<banisterfiend> can someone recommend a good movie?
rippa [rippa!~rippa@109-161-78-165.pppoe.yaroslavl.ru] has joined #ruby
<aces1up> thomas crown affair
thecreators [thecreators!~rskagy@cpe-65-27-201-150.cinci.res.rr.com] has joined #ruby
ThatDudeGuy_ [ThatDudeGuy_!~ThatDudeG@99-66-8-185.lightspeed.mssnks.sbcglobal.net] has joined #ruby
<Asher> full metal jacket
<banisterfiend> Asher: know of any good scifi
<Asher> what kind of sci fi
<Asher> event horizon is pretty awesome
<Asher> kinda horror sci fi
nicholasmabry [nicholasmabry!~nicholasm@99-66-8-185.lightspeed.mssnks.sbcglobal.net] has joined #ruby
nicholasmabry [nicholasmabry!~nicholasm@99-66-8-185.lightspeed.mssnks.sbcglobal.net] has quit [#ruby]
<[[thufir]]> in general, how do I scrape through using nokogiri? http://pastebin.mozilla.org/1457318 I'm only looking for the text of a few elements
ph^ [ph^!~ph^@cm-84.212.225.74.getinternet.no] has joined #ruby
<aces1up> so i have a hash now of x keys, how can a trim it to only say 10 of the first keys if it has a total of 20 keys?
<Asher> you want keys only?
<aces1up> no, i want to delete the value and key
<aces1up> so in total after it has 10 key/value pairs
akem [akem!~akem@unaffiliated/akem] has joined #ruby
<Asher> hm you could do hash.keys.slice( 10 ).each {|key, data| hash.delete( key )}
<Asher> err
<Asher> hash.keys.slice( 10 ).each {|key| hash.delete( key )}
<aces1up> i think that would delete all keys wouldn't it?
<aces1up> nevermind i see.
<Asher> seems to me like now that hash is ordered it should have #slice and #slice!
ghanima [ghanima!~ghanima@108-90-245-101.lightspeed.cicril.sbcglobal.net] has joined #ruby
dnjaramba_ [dnjaramba_!~dnjaramba@41.72.193.86] has joined #ruby
centipedefarmer_ [centipedefarmer_!~centipede@75-162-52-240.desm.qwest.net] has joined #ruby
Morkel [Morkel!~Morkel@xdsl-87-78-206-32.netcologne.de] has joined #ruby
iocor [iocor!~textual@87.194.167.19] has joined #ruby
iocor [iocor!~textual@unaffiliated/iocor] has joined #ruby
akem [akem!~akem@unaffiliated/akem] has joined #ruby
stephenjudkins [stephenjudkins!~stephen@c-76-115-1-70.hsd1.or.comcast.net] has joined #ruby
<[[thufir]]> puts "links: #(links.length)" isn't outputting the length of links. on the next line, puts links.length works fine tho. why?
faber [faber!~faber@ppp-104-4.26-151.libero.it] has joined #ruby
shadoi [shadoi!~Adium@99-59-176-174.lightspeed.sntcca.sbcglobal.net] has joined #ruby
pen [pen!~pen@223-143-216-125.dynamic.hinet.net] has joined #ruby
akem [akem!~akem@unaffiliated/akem] has joined #ruby
LMolr [LMolr!~quassel@87.19.33.245] has joined #ruby
<wallerdev> [[thufir]]: you need to use curly braces instead of parenthesis
<wallerdev> #{links.length}
<[[thufir]]> wallerdev: ah, that sounds about right. thanks.
<[[thufir]]> also, how do I print just part of the link? just the url perhaps
CircleDot [CircleDot!~CircleDot@206-169-94-86.static.twtelecom.net] has joined #ruby
CK_afk [CK_afk!~ckruse@painkiller.defunced.de] has joined #ruby
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby
eldariof [eldariof!~CLD@81.200.20.66] has joined #ruby
jlogsdon [jlogsdon!~jlogsdon@c-67-169-79-114.hsd1.ca.comcast.net] has joined #ruby
yxhuvud [yxhuvud!mongo@h-49-31.a212.priv.bahnhof.se] has joined #ruby
akem [akem!~akem@unaffiliated/akem] has joined #ruby
daniel-_ [daniel-_!~daniel@118-92-42-39.dsl.dyn.ihug.co.nz] has joined #ruby
bluOxigen [bluOxigen!ssf@unaffiliated/bluOxigen] has joined #ruby
colossal7 [colossal7!~colossal7@67.136.116.202] has joined #ruby
ePirat [ePirat!~ePirat@unaffiliated/epirat] has joined #ruby
Locke23rus [Locke23rus!~quassel@128-70-95-104.broadband.corbina.ru] has joined #ruby
thomasdebenning [thomasdebenning!~thomasdeb@c-69-181-139-137.hsd1.ca.comcast.net] has joined #ruby
stephenjudkins [stephenjudkins!~stephen@c-76-115-1-70.hsd1.or.comcast.net] has joined #ruby
burgestrand [burgestrand!~burgestra@h-45-63.a155.priv.bahnhof.se] has joined #ruby
<MarcWeber> def a b end def b a end then run a causes infinite recursion. How to debug such ?
<[[thufir]]> why does this work to extract the hrefs? hrefs = links.map{ |link| link['href'] } is that some magic built into nokogiri?
<[[thufir]]> I get it that this is a map of the links array, but how does ruby know which is href? it looks for the string href?
<[[thufir]]> maybe that's an aspect of blocks which I don't understand
klaustsen [klaustsen!~klaustsen@c80-217-133-221.bredband.comhem.se] has joined #ruby
colossal7 [colossal7!~colossal7@67.136.116.202] has joined #ruby
robyurkowski [robyurkowski!~robyurkow@205.233.80.139] has joined #ruby
<[[thufir]]> 5.times {puts "foo"} sends the block into the process of 5.times, is that correct?
nyuszika7h [nyuszika7h!nyuszika7h@unaffiliated/nyuszika7h] has joined #ruby
maasha [maasha!535c4c84@gateway/web/freenode/ip.83.92.76.132] has joined #ruby
<maasha> hello
<maasha> I have a peculiar problem of popen3 hanging - what can cause this?
<[[thufir]]> maasha: I'm a newbie, but what's popen3?
<maasha> a way to open pipes to a command line tool yeilding three steams -> stdin, stdout, and stderr
colossal7 [colossal7!~colossal7@67.136.116.202] has joined #ruby
<[[thufir]]> interesting
apeiros_ [apeiros_!~apeiros@77-58-113-31.dclient.hispeed.ch] has joined #ruby
stephenjudkins [stephenjudkins!~stephen@c-76-115-1-70.hsd1.or.comcast.net] has joined #ruby
Azure [Azure!~azt@unaffiliated/azure] has joined #ruby
tvw [tvw!~tv@89.204.130.50] has joined #ruby
QKO [QKO!~reaVer@banzai.speedxs.nl] has joined #ruby
shevy [shevy!~shevy@178-190-69-12.adsl.highway.telekom.at] has joined #ruby
user__ [user__!~akem@253.195.84.79.rev.sfr.net] has joined #ruby
sterNiX [sterNiX!~LessIsMor@unaffiliated/nu253r/x-0655220] has joined #ruby
adambeynon [adambeynon!~adambeyno@82-69-1-211.dsl.in-addr.zen.co.uk] has joined #ruby
QKO [QKO!~reaVer@banzai.speedxs.nl] has joined #ruby
rippa [rippa!~rippa@93-181-232-78.adsl.yaroslavl.ru] has joined #ruby
stephenjudkins [stephenjudkins!~stephen@c-76-115-1-70.hsd1.or.comcast.net] has joined #ruby
krainboltgreene [krainboltgreene!u5202@gateway/web/irccloud.com/x-vrjqzsebmvyedlss] has joined #ruby
<krainboltgreene> Does anyone know why Ruby Hashes are randomly REALLY slow?
<krainboltgreene> I create a huge hash (500 key/values), dup it twice, and one of those dupes randomly takes a large chunk of time.
<apeiros_> I wouldn't consider 500 key/values huge…
<krainboltgreene> Ok, that's not better :P
leanother [leanother!~leanother@190.80.179.159] has joined #ruby
<apeiros_> and what is "a large chunk of time"? 100ms?
latenightfred [latenightfred!~jeff@99-181-49-49.lightspeed.rcsntx.sbcglobal.net] has joined #ruby
<[[thufir]]> sounds like a system thing to me. the OS is doing something?
<apeiros_> ruby-1.9.3-p0:001:0>> a = Hash[(1..500).map { |k| [k,k] }];
<apeiros_> ruby-1.9.3-p0:003:0>> pbench 100,10 do a.dup end
<apeiros_> ø 0.274847ms (61.0%)
<apeiros_> high stddev - might be a GC thing…
<krainboltgreene> .5ms vs 10ms
<krainboltgreene> But it's every 4th run or so.
<apeiros_> I really need to rewrite pbench to use CPU- instead of real-time
<krainboltgreene> Old Open Struct: 12.656ms // New Open Struct: 0.855ms or 1380.23% faster/slower
bluOxigen [bluOxigen!ssf@unaffiliated/bluOxigen] has joined #ruby
<krainboltgreene> When it's normally 1.5ms vs 0.5~
iocor [iocor!~textual@unaffiliated/iocor] has joined #ruby
iocor [iocor!~textual@unaffiliated/iocor] has joined #ruby
spinagon [spinagon!~rippa@93-181-232-78.adsl.yaroslavl.ru] has joined #ruby
MekkisFreenode [MekkisFreenode!~MekkisFre@2a00:dd0:0:6:80a6:4fff:fec7:d456] has joined #ruby
stephenjudkins [stephenjudkins!~stephen@c-76-115-1-70.hsd1.or.comcast.net] has joined #ruby
pvgrif [pvgrif!547a338f@gateway/web/freenode/ip.84.122.51.143] has joined #ruby
<pvgrif> hi
<pvgrif> could any one please tell me if on ActiveRecord when I save two records in a transaction, will the second one that i save have the id of the first one + 1? e.g. A: 123, B: 124
<apeiros_> pvgrif: I don't think that's a safe assumption
<apeiros_> but AR questions should go to #rubyonrails
azbarcea [azbarcea!~quassel@79.114.14.88] has joined #ruby
rippa [rippa!~rippa@93-181-232-78.adsl.yaroslavl.ru] has joined #ruby
latenightfred [latenightfred!~jeff@99-181-49-49.lightspeed.rcsntx.sbcglobal.net] has quit [#ruby]
<pvgrif> fuck i ve been all this time on #rails, no wonder no one ever answered
<pvgrif> thanks
<apeiros_> pvgrif: the answer might even change from db to db, since the only guarantee that transactions give is that either all is saved or nothing. sequences or autoincrement fields are not part of the promise.
<Asher> i think that is never a safe assumption
<Asher> unless the database is only ever single-threaded
<pvgrif> alright thank you very much
<apeiros_> Asher: that's not the only requirement, though
<Asher> if only one thread has db control it seems reasonable to assume the next sequence id requested will be the next sequentially
<Asher> no?
<pvgrif> i have a one-to-one self referential association, it has the property that both objects involved are created at the same time, the problem is that i can only give the id of its partner to the second one and the first one will have nil
<krainboltgreene> 1 pull request to MRI, 2 pull requests to JRuby.
<pvgrif> so i thought maybe i could wrap it in a transaction and have my own function that returns the id of the partner if its nil, by just adding one to its own
<apeiros_> Asher: a single thread doesn't guarantee a single "stream" of queries
<krainboltgreene> Now one to Rubinius and I'll be golden for this weekened.
<apeiros_> Asher: I can write a single threaded server easily, and it can still serve concurrent requests
<Asher> i suppose it's possible there are internal actions goign on that could cause further sequence increments in between
<Asher> is that what you mean?
c0rn [c0rn!~c0rn@cpe-66-91-253-48.san.res.rr.com] has joined #ruby
<Asher> right i meant by single-threaded that there is only one thread of control for requests
<Asher> obviously you can do all sorts of concurrency stuff w/o using threads - wasn't intending to speak to that
<apeiros_> client A starts transaction, gets id 1 for first insert, client B does insert, gets id 2, client A does second insert in transaction and gets id 3, client A commits transaction
<Asher> i meant 1 client control thread
<apeiros_> all that is unrelated to threads, and a db that can only serve a single client at any time is rather useless
<apeiros_> Asher: even then
<pvgrif> but could there be inserts in between, even if the transaction hasnt finished, which would make it possible that the second transaction has id 4 while the first one has id 1?
<Asher> generally a transaction that makes an insert will reserve a block of IDs from the sequence
<apeiros_> pvgrif: sure. if two clients do inserts, they must not get the same ids
<Asher> and if the transaction is rolled back it just dumps those IDs
<apeiros_> so the id must be incremented even if the transaction has not been committed
<pvgrif> ok i understand, do you know i could exploit that property (that they are both created at the same time), to link both bidirectionally in an efficient way?
<Asher> you should probably just be asking the db for the id it created
<apeiros_> pvgrif: why on earth do you think you need that anyway?
<pvgrif> Asher: i meant if the second one would get the id immediately after, or could be something else
<apeiros_> seems like a stupid thing to rely on (no offense intended)
<pvgrif> none taken
<Asher> you don't want to be doing the db's work
<Asher> just ask the db for the id it created
<Asher> presumably AR has a way to do that? i don't know
<apeiros_> well, in db's like oracle you can manually increment the sequence. but as asher said, you don't want to do the dbs work. also it seems like bad design. coupling on the wrong level.
<pvgrif> if i dont do that, everytime i encounter an object with its partner to nil, i ve to search the database again to find one that has the first one as its partner
<pvgrif> table*
<Asher> AR doesn't have a way to request insert ID?
<Asher> that would surprise me
blueOxigen [blueOxigen!~noreply@58-27-242-50.wateen.net] has joined #ruby
<pvgrif> yes it does, i could do an INSERT A, INSERT B, UPDATE A
<Asher> i don't understand
<pvgrif> would that be good design?
<Asher> i thought you wanted the id the db creates when you do INSERT A
<Asher> you want the id from B to be in the record for A?
<pvgrif> yes, the second update is to set teh partner of A to the ID i got form the insertion of B
<pvgrif> yes
<pvgrif> and the id of A to be in the record A
<pvgrif> sorry
<Asher> then yes i think INSERT A, INSERT B, UPDATE A is the way to do it
<pvgrif> the id of A to be in record B
<Asher> maybe with a cursor
<pvgrif> perfect
<pvgrif> thanks
<apeiros_> you could do insert b, insert a
<Asher> same problem b/c he wants b to have a in it
<apeiros_> or does b also reference a? if so, then yes, insert a, b, a
tayy [tayy!~tayy@dhcp-129-234-218-187.un.esol.dur.ac.uk] has joined #ruby
<apeiros_> or rather, insert a, b, updatea
<apeiros_> gah
<pvgrif> alright thanks, i felt dirty using the the id+1 coupling, im glad you removed any doubts
<apeiros_> insert a, b, update a
<apeiros_> you very rightly felt dirty for it.
iocor [iocor!~textual@unaffiliated/iocor] has joined #ruby
<pvgrif> lol
<Buck> is there an easy way to output a multidimensional array in a overviewable way?
geaif [geaif!~geaif@xdsl-188-155-129-176.adslplus.ch] has joined #ruby
<apeiros_> Buck: require 'pp'; pp ary
<apeiros_> or: require 'yaml'; y ary
<Buck> thank you :)
QaDeS [QaDeS!~mklaus@frbg-4d028e0d.pool.mediaWays.net] has joined #ruby
symb0l [symb0l!~symb0l@c-50-131-187-183.hsd1.ca.comcast.net] has joined #ruby
enikar [enikar!~gil@cl-140.mrs-01.fr.sixxs.net] has joined #ruby
csherin [csherin!~csherin@61.11.47.238] has joined #ruby
geaif [geaif!~geaif@xdsl-188-155-129-176.adslplus.ch] has joined #ruby
tatsuya_o [tatsuya_o!~tatsuya_o@46-64-51-175.zone15.bethere.co.uk] has joined #ruby
x0F_ [x0F_!~x0F@unaffiliated/x0f] has joined #ruby
jbpros [jbpros!~jbpros@82-186-112-217.dyn.adsl.belcenter.be] has joined #ruby
stephenjudkins [stephenjudkins!~stephen@c-76-115-1-70.hsd1.or.comcast.net] has joined #ruby
blueadept [blueadept!~blueadept@unaffiliated/blueadept] has joined #ruby
tayy [tayy!~tayy@dhcp-129-234-218-187.un.esol.dur.ac.uk] has joined #ruby
<shevy> hmm .sort_by! does not exist for Array? hmm
dhs227 [dhs227!~dhs227@180.154.10.40] has joined #ruby
<dhs227> Chinese new year are coming! Happy new year to all fellows here!
stephenjudkins [stephenjudkins!~stephen@c-76-115-1-70.hsd1.or.comcast.net] has joined #ruby
yfeldblum [yfeldblum!~Jay@c-98-218-48-253.hsd1.md.comcast.net] has joined #ruby
vraa [vraa!~vraa@99-20-202-44.lightspeed.hstntx.sbcglobal.net] has joined #ruby
johnnus_ [johnnus_!~johnnus_@c80-217-133-221.bredband.comhem.se] has joined #ruby
<johnnus_> i'm having some problems with bundler installing therubyracer in my app directory when running ubuntu, any way to solve this? i'm guessing it's coffeescript that requires it somehow.. can i get it to install it globally somewhere?
<pvgrif> are you using rvm?
<johnnus_> yeah
<pvgrif> i think that when you do bundle install, it will just install in the current gemset, same as 'gem install therubyracer', its just more convenient for projects with many gems
<pvgrif> what error is it giving you?
<johnnus_> i've tried installing it in the global gemset, but it stills installs it locally when running bundle install
<johnnus_> it doesnt give any error, but it installs theruvyracer in a directory called therubyracer in my approot
<johnnus_> which is rather annyoing :)
<pvgrif> thats weird, and the other gems dont?
<johnnus_> nope, just that one
<johnnus_> and if i remove the folder and start the webserver it tells me that it cant find the il8n gem
<johnnus_> everthing works when running the server and still having therubyracer directory
<shevy> how would I profile a really huge but slowish ruby class
<pvgrif> i ll check where i ve mine
<johnnus_> hmm, actually it seems to install all gems in the "therubyracer" directory
<Buck> is converting an array to a set an acceptable way to remove dupes or is there a better way?
<johnnus_> when running bundle install i get a structure like: therubyracer/ruby/1.9.1/bin cache doc gems specifications
snap_ [snap_!~snap_@cslinux1.utdallas.edu] has joined #ruby
<banisterfiend> Buck: juse use the uniq method
<johnnus_> and in the gems dir are all the gems
<Buck> oh
<Buck> >_>
pantsman [pantsman!~pantsman@2.25.204.228] has joined #ruby
pantsman [pantsman!~pantsman@pdpc/supporter/active/pantsman] has joined #ruby
<pvgrif> did you check that you are using the gemset you want to be using?
<johnnus_> yeah, it tells me i'm running the correct gemset and ruby 1.9.2 (so why is it creating a ruby 1.9.1 dir in rubyracer?)
<pvgrif> i ve no idea, in the Gemfile have you specified a therubyracer version?
<johnnus_> nope, gem 'therubyracer', :require => 'v8'
<Buck> if I have a multidimensional array like so: a1 = Array.new [[1, 1, 1, 1], [1, 1, 2], [1, 2, 1], [1, 3], [2, 1, 1], [2, 2], [3, 1], [4]], how can I sort it so that I get [[1, 1, 1, 1], [1, 1, 2], [1, 1, 2], [1, 3], [1, 1, 2], [2, 2], [3, 1], [4]]? I tried a1.each { |t| t.sort } but that didn't do it
<pvgrif> maybe its downloading an old version that was for 1.9.1, but im not sure it would even do that
niklasb [niklasb!~codeslay0@p5B3115F4.dip0.t-ipconnect.de] has joined #ruby
<apeiros_> Buck: uuum, I think you misunderstand Array.new
bastilian [bastilian!~bastilian@chello062178156107.9.14.vie.surfer.at] has joined #ruby
<apeiros_> you probably want to leave it away.
<pvgrif> try with requiring v8, if it works, you have something else to work with, you can remove it later
<Buck> apeiros_?
<pvgrif> without* requiring v8
<apeiros_> Buck: a1 = [[1, 1, 1, 1], …]
<apeiros_> Buck: read up what Array.new does. it doesn't do what you think.
<Buck> okay
<apeiros_> also, t.sort will return a new sorted array
<apeiros_> it will *not* sort the array in place. use sort! for that.
<Buck> right, I kinda figured that
<Buck> ah
<Buck> I have a lot to learn in ruby world still
indiche [indiche!~indiche@93-136-182-120.adsl.net.t-com.hr] has joined #ruby
<apeiros_> so either: sorted = a1.map { |t| t.sort }
<apeiros_> or: a1.map! { |t| t.sort }
<Buck> what's the difference between each and map?
<apeiros_> or: a1.each { |t| t.sort! }
<apeiros_> map returns an array consisting of the return values of the block
<apeiros_> each just returns the receiver
<Buck> oh okay
<Buck> thanks
<apeiros_> [1,2,3].each { |a| a * 5 } # => [1,2,3]
<johnnus_> actually, something else seems very wrong.. if i comment out everything in my gemfile and run bundle install it tells me: "The Gemfile specified no dependencies. Your bundle is complete! It was installed into ./therubyracer"
hardyboy [hardyboy!736e0874@gateway/web/freenode/ip.115.110.8.116] has joined #ruby
<apeiros_> [1,2,3].map { |a| a * 5 } # => [5,10,15]
<hardyboy> hai all
<hardyboy> :)
<apeiros_> hai hardiboi
<Buck> so |a| is called the receiver? I thought it was the parameter
<johnnus_> and a directory called therubyracer is created with a ruby/1.9.1 folder that is empty
<apeiros_> Buck: no, the thing before the . is called receiver. the thing that receives the method invocation, the call
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby
<pvgrif> johnnus: yeah thats very weird, i dont know what to say, what does ruby -v return?
stringoO [stringoO!~JLstring@bas1-toronto42-1279598654.dsl.bell.ca] has joined #ruby
<apeiros_> so in a1.each { … }, a1 is the receiver of each, it will be self within that method
<johnnus_> 1.9.2p290
<Buck> alright, I get that
<hardyboy> hai friends... https://gist.github.com/1652318 i am trying to store in @distinct_users all the unique user ids from the LoginRecords class.. and but its giving me this error undefined method `map' for nil:NilClass
<hardyboy> Please help me out to solve this isssue!!! thanks
<apeiros_> hardyboy: @login_records and login_records are not the same
<hardyboy> <apeiros_ yes got it sorry.. my mistake.. i was trying for a while as to why it was throwing an error
<apeiros_> hardyboy: raising. throw has a different meaning in ruby.
<pvgrif> try installing a gem without bundler, just gem install and see where it goes
<hardyboy> <apeiros_> ok... I understand thanks for the help :) now its working fine..
<hardyboy> <apeiros_> have you worked on rails ? i had a small doubt on that as well..
<apeiros_> hardyboy: are you copy & pasting nicknames in irc? o0
<apeiros_> if so - just use tab-completion. should be easier…
<hardyboy> apeiros_:
<apeiros_> hardyboy: I'm using rails at work. the proper rails channel is #rubyonrails, though.
<hardyboy> apeiros_: got it
<hardyboy> apeiros_:
<apeiros_> premature-enter-key-pressing? :D
<hardyboy> apeiros_: am not able to login into rails channel due to some reason.. :)
oddmunds [oddmunds!~oddmunds@s21-04214.dsl.no.powertech.net] has joined #ruby
indiche [indiche!~indiche@93-136-182-120.adsl.net.t-com.hr] has joined #ruby
<apeiros_> it seems you're banned
<hardyboy> apeiros_: yes how can i get into the channel ?
<hardyboy> apeiros_: by the way, my doubt is this https://gist.github.com/1652329 here am using the model directly with a namedscope in the view.. is it wrong from rails convention ?
<apeiros_> you're banned. you can't.
<apeiros_> you mean line 16 in view.html? yes, that's generally considered bad.
<hardyboy> apeiros_: login_record model keeps track of how many times each user logged in so i use a namedscope to iterate the records using the date selected by the users?
<apeiros_> oh, actually User.find's in 12-15 too
<hardyboy> apeiros_: so how can i do that in the controller itself since i thgt it wud make things a lil complicated !!
<apeiros_> you'd see to it that you can ask it from the items in @distinct_users
<apeiros_> @distinct_users.each do |user| user.id … user.logged_count …
Russell^^ [Russell^^!~Russell^^@88.97.51.87] has joined #ruby
<hardyboy> apeiros_: if i just store line 16 in the array and pass it to the view.. will that be in order to the user list since that is another array all together?
<apeiros_> user.last_activity(@end)
<shevy> I want to ban the rubyonrails channel
<apeiros_> hardyboy: it'd be a possibility. but I'd clearly favor the way I just showed
<hardyboy> apeiros_: no its just last_activity() a helper method which is independent of User
<hardyboy> apeiros_: i have used all models in the view....could you help me with this in the method above.. how can i remodify it in the ryt way ? it wud be of gr8 help for a learner like me :)
<apeiros_> hardyboy: it hardly is independent if you pass it…
<apeiros_> last_activity(@end, value) <-- you pass value, hardly independent of it then.
<apeiros_> and I'm off now.
<hardyboy> apeiros_: thats the issue.. since last activity is a user helper method which tries to fecth from another model community activities as to what the last activity of the user was with the parameter user_id and date
<hardyboy> apeiros_: its all kinda mixed up since iam working over a new feature on an already existing app... so kinda i have limited flexibility :0
senny [senny!~senny@84-72-61-96.dclient.hispeed.ch] has joined #ruby
<[[thufir]]> for getting the id for a craigslist ad from the URL, is this a reasonable approach? http://pastebin.mozilla.org/1457385
<hardyboy> apeiros_: is there a way to remove white spaces from files without disturbing the intendations
p1d [p1d!~p1d@dslb-088-067-031-081.pools.arcor-ip.net] has joined #ruby
<hardyboy> is there a way to remove white spaces from files without disturbing the intendations
<Asher> what would that even mean
iamjarvo [iamjarvo!~Adium@c-71-230-13-201.hsd1.nj.comcast.net] has joined #ruby
<hardyboy> when we submit our code to gerrit the code review system it detects some whitespaces that are generaaly not displayed using git -diff file.. so i want a method to remove trailing white spaces
S1kx [S1kx!~S1kx@pdpc/supporter/monthlybyte/s1kx] has joined #ruby
ikaros [ikaros!~ikaros@dslb-188-107-220-229.pools.arcor-ip.net] has joined #ruby
<fred> Any recommendations for a customizable lint tool? eg to pick up all the trivial stuff like \s+$ ?
<hardyboy> folow me https://twitter.com/#!/mithun_sasi for interesting updates on Ruby Rails and more !!
denysonique_ [denysonique_!u484@gateway/web/irccloud.com/x-qubwqlvwpldcxkwa] has joined #ruby
<hardyboy> i have an array of ids in login_records array and i want to store all users with that id from the User model into another @variable!! what is the easiest way to do that?
palcu [palcu!~alex@89.122.187.223] has joined #ruby
<hardyboy> Asher: i have an array of ids in login_records array and i want to store all users with that id from the User model into another @variable!! what is the easiest way to do that?
<hardyboy> Buckaway: i have an array of ids in login_records array and i want to store all users with that id from the User model into another @variable!! what is the easiest way to do that?
<hardyboy> csherin: i have an array of ids in login_records array and i want to store all users with that id from the User model into another @variable!! what is the easiest way to do that?
<apeiros_> hardyboy: stop that
<hardyboy> apeiros_: please help me with my doubt :(
<apeiros_> I'm sorry, but I don't have time.
<hardyboy> apeiros_: PLease I beg you !! I am new to Ruby pls help me Sir/Madam
<apeiros_> what about "I don't have time" don't you understand?
<hardyboy> apeiros_: ok :( :(
nd___ [nd___!~nd@mnhm-590e56c0.pool.mediaWays.net] has joined #ruby
Targen [Targen!~iguana@190.39.181.108] has joined #ruby
thecreators [thecreators!~rskagy@cpe-65-27-201-150.cinci.res.rr.com] has joined #ruby
adamjleonard [adamjleonard!~adamjleon@pool-108-9-169-222.tampfl.fios.verizon.net] has joined #ruby
QKO [QKO!~reaVer@banzai.speedxs.nl] has joined #ruby
savage-_ [savage-_!~savage-@c-67-180-11-89.hsd1.ca.comcast.net] has joined #ruby
<shevy> hmmm
visof [visof!~visof@unaffiliated/visof] has joined #ruby
<visof> hello
<shevy> visof what are you writing on
<visof> shevy: what so you mean?
iamjarvo [iamjarvo!~Adium@c-71-230-13-201.hsd1.nj.comcast.net] has joined #ruby
kerframil [kerframil!~kerframil@cpc2-enfi16-2-0-cust659.hari.cable.virginmedia.com] has joined #ruby
jmampost [jmampost!~jmampost@cm238.sigma71.maxonline.com.sg] has joined #ruby
<visof> i'm processing arguments using options = Hash[*ARGV], i want to must certain there are three options present, should i use that? , if(not(options.has_key?('-a')) and not(options.has_key?('b')) and not(options.has_key?('-c'))); usage(); exit(); end; ?
<visof> is that right way?
<apeiros_> missing_keys = ['-a', '-b', '-c'] - options.keys
<apeiros_> abort("Missing required flags #{missing_keys.join(', ')}") unless missing_keys.empty?
<visof> apeiros_: wonderful
robotmay [robotmay!~robotmay@5ad8f1da.bb.sky.com] has joined #ruby
palcu [palcu!~alex@89.122.187.223] has joined #ruby
bastilian [bastilian!~bastilian@chello213047077012.23.11.vie.surfer.at] has joined #ruby
ephemerian [ephemerian!~ian@82-71-51-229.dsl.in-addr.zen.co.uk] has joined #ruby
spinagon [spinagon!~rippa@87-253-25-66.pppoe.yaroslavl.ru] has joined #ruby
stringoO [stringoO!~JLstring@bas1-toronto42-1279598654.dsl.bell.ca] has joined #ruby
deSade_ [deSade_!~Sylvie@50-32-55-20.drr01.hrbg.pa.frontiernet.net] has joined #ruby
davidpk [davidpk!~r00t@5e0a02e9.bb.sky.com] has joined #ruby
Morkel [Morkel!~Morkel@xdsl-87-78-206-32.netcologne.de] has joined #ruby
<hardyboy> hai all... I have used a namedscope to select just the id from a model. and it returns values like [#<LoginRecord user_id: 1>, #<LoginRecord user_id: 74>, #<LoginRecord user_id: 75>, #<LoginRecord user_id: 76>, #<LoginRecord user_id: 77>]
<hardyboy> how can i make it an array like [1,74,75,76,77]
<hardyboy> please help
palcu [palcu!~alex@89.122.187.223] has joined #ruby
<Asher> array = [1,74,75,76,77]
<Asher> return_array.select { |member| member.user_id}
<hardyboy> Asher: yes how can i get ids in the array form from the named scope. ? since namedscope gives me [#<LoginRecord user_id: 1>, #<LoginRecord user_id: 74>, #<LoginRecord user_id: 75>, #<LoginRecord user_id: 76>, #<LoginRecord user_id: 77>]
<Asher> err
<Asher> return_array.collect { |member| member.user_id}
palcu [palcu!~alex@89.122.187.223] has joined #ruby
tk_ [tk_!~tk@p083005.doubleroute.jp] has joined #ruby
<hardyboy> Asher: https://gist.github.com/1652497 here it is... please can u suggest me how i can retirve it as an array ?
<Asher> i just did
strife25 [strife25!~strife25@cpe-098-026-018-050.nc.res.rr.com] has joined #ruby
LMolr [LMolr!~quassel@87.19.33.245] has joined #ruby
zastaph [zastaph!~uid@unaffiliated/zastaph] has joined #ruby
<hardyboy> Asher: so where have i got to do this? i mean after calling the named scope?
<Asher> you have your array from namedscope
<Asher> call #collect { |member| member.user_id } on it
<hardyboy> Asher: in that array i am just selecting the id alone..
<Hanmac> if you have a newer ruby you could short it to map(&:user_id)
<hardyboy> Hanmac: so il give login_records = LoginRecord.unique_users(start_date,end_date).map(&:user_id)
rushed [rushed!~rushed@cpe-70-116-11-35.austin.res.rr.com] has joined #ruby
mengu [mengu!~mengu@unaffiliated/mengu] has joined #ruby
<hardyboy> Hanmac: yes working... thanks mate :)
<hardyboy> Asher: thanks asher for the help
<banisterfiend> Hanmac: (und)
pantsman- [pantsman-!~pantsman@2.25.204.228] has joined #ruby
<hardyboy> login_records = [1,2,3] login_records.each do |id| @logged_users = User.find(id) end
<hardyboy> this isnt returning me array of user objects but simply the array 123 again ??:-/
<hardyboy> why is that so?
akem [akem!~akem@unaffiliated/akem] has joined #ruby
<hardyboy> should i give @logged_users << User.find(id) instead of @logged_users = User.find(id) ???
<tommylommykins> users = login_records.collect {|login_record| User.find login_record}
<tommylommykins> ?
<hardyboy> tommylommykins: yes good one
<hardyboy> tommylommykins: thanks
<tommylommykins> :)
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby
<hardyboy> tommylommykins: it just worked like a charm :) thats a tonnes
<hardyboy> tommylommykins: have u worked on rails i had a small doubt !!
<tommylommykins> login_records.collect {|id|}Never worked with rails
* tommylommykins uses Ruby for scripting all his work away at work :)
<tommylommykins> oops
<tommylommykins> *Never worked with rails
michael_mbp [michael_mbp!~Marin@149.147.167.108] has joined #ruby
<hardyboy> tommylommykins: what is the easy way of learning ruby especially these interesting array modifications with collect,map.... all that ? :) i wanna become a master in ruby
<Hanmac> read the documentations in http://ruby-doc.org
<hardyboy> Hanmac: reading is so boring....some interactive site in which i can do the coding and learn... in which it will point out my mistakes n all ?:)
berserkr [berserkr!~david@212.122.111.205.dyn.user.ono.com] has joined #ruby
* tommylommykins wonders if tryruby is still around
strife25 [strife25!~strife25@cpe-098-026-018-050.nc.res.rr.com] has joined #ruby
fserb [fserb!~fserb@178-83-225-18.dynamic.hispeed.ch] has joined #ruby
<Hanmac> it is http://tryruby.org/
<hardyboy> try ruby is good but we got to type our commands in that on our own.. where are the tutorials in it ?
<hardyboy> is it ok to use models inside helpers in rails ??? :-/
kirun [kirun!~kirun@78-86-154-194.zone2.bethere.co.uk] has joined #ruby
bluOxigen [bluOxigen!ssf@unaffiliated/bluOxigen] has joined #ruby
cmasseraf [cmasseraf!~ColdFusio@187.106.195.233] has joined #ruby
thecreators [thecreators!~rskagy@cpe-65-27-201-150.cinci.res.rr.com] has joined #ruby
hzlocky [hzlocky!~me@dynamic-vpdn-46-53-165-24.telecom.by] has joined #ruby
luoluoluo [luoluoluo!~sheng@222.244.157.205] has joined #ruby
luoluoluo [luoluoluo!~sheng@222.244.157.205] has quit ["离开"]
canton7 [canton7!~canton7@87-194-161-58.bethere.co.uk] has joined #ruby
rflorianobr [rflorianobr!~rfloriano@189.58.112.71.dynamic.adsl.gvt.net.br] has joined #ruby
banister_ [banister_!~baniseter@115.189.60.152] has joined #ruby
spinagon [spinagon!~rippa@93-181-237-218.adsl.yaroslavl.ru] has joined #ruby
Spockz` [Spockz`!~Spockz@21pc198.sshunet.nl] has joined #ruby
rippa [rippa!~rippa@93-181-237-218.adsl.yaroslavl.ru] has joined #ruby
stephenjudkins [stephenjudkins!~stephen@c-76-115-1-70.hsd1.or.comcast.net] has joined #ruby
Spockz` [Spockz`!~Spockz@21pc198.sshunet.nl] has joined #ruby
<shevy> hardyboy rails makes people stop thinking
<hardyboy> shevy: exaclty... i completely agree with you.. its like working under some rules and u rnt suppose to think out of those lines.. :-/
<hardyboy> shevy: J2EE is cool.. and at the end of the day.. rails cant even give you scalability that java can give you.. no wonder twitter switched to scala and java
gianlucadv [gianlucadv!~user@host78-84-dynamic.44-79-r.retail.telecomitalia.it] has joined #ruby
robyurkowski [robyurkowski!~robyurkow@205.233.80.139] has joined #ruby
sontek [sontek!~sontek@opensuse/member/Sontek] has joined #ruby
<sontek> in python we have virtualenv to manage repos of our code so that we don't have to kill the system python
<sontek> does that exist in ruby?
<banistergalaxy> sontek: rvmmm
<banistergalaxy> sontek: rvm* or rbenv
<sontek> I'll check both out
<Asher> sontek can you explain whaty ou mean
<hardyboy> sontek: I think you'll like sandbox.
<Asher> repos of your code
<Asher> how do you mean
<hardyboy> sontek: RVM works closer to how virtualenv works since it lets you sandbox different ruby versions and their gems, etc.
<sontek> Asher: instead of gem installing as root and having everything go into global ruby environment
abstrusenick [abstrusenick!~abstrusen@180.241.175.11] has joined #ruby
<sontek> Asher: I'd like it all local in its own environment
<Asher> yeah you want rvm or rbenv
<sontek> hardyboy: Asher banistergalaxy: thanks!
<shevy> hardyboy well they still decided to prototype in ruby. once they reached a critical mass, had more money, they switched
<sontek> Now if i'm hacking on rails stuff can I ask questions in here? or is there a better channel?
<hardyboy> shevy: thats right
<Asher> #rubyonrails
<sontek> We are doing a startup weekend project and the other guy didn't know python so I decided to go his route
<shevy> hehe
spinagon [spinagon!~rippa@93.181.237.218] has joined #ruby
<hardyboy> sontek: thats nice
<hardyboy> shevy: you know rails ?
<hardyboy> anyone out here knows a thing or two abt rails ?
<Asher> generally people here want nothing to do with rails
banister_ [banister_!~baniseter@118.82.185.158] has joined #ruby
<hardyboy> Asher : :)
fayimora [fayimora!~fayimora@95.175.159.58] has joined #ruby
iamjarvo [iamjarvo!~Adium@c-71-230-13-201.hsd1.nj.comcast.net] has joined #ruby
beilabs [beilabs!~jonathan@ppp59-167-171-134.static.internode.on.net] has joined #ruby
Hellojere [Hellojere!~Hellojere@89.7.90.160] has joined #ruby
jbpros [jbpros!~jbpros@82-186-112-217.dyn.adsl.belcenter.be] has joined #ruby
spinagon [spinagon!~rippa@95-86-249-112.pppoe.yaroslavl.ru] has joined #ruby
J` [J`!~dhs227@180.154.10.40] has quit [#ruby]
mengu [mengu!~mengu@unaffiliated/mengu] has joined #ruby
berserkr [berserkr!~david@212.122.111.205.dyn.user.ono.com] has joined #ruby
cyri_ [cyri_!~cyri_@jem75-1-87-88-118-80.dsl.sta.abo.bbox.fr] has joined #ruby
waxjar [waxjar!~waxjar@ip11-49-212-87.adsl2.static.versatel.nl] has joined #ruby
burgestrand [burgestrand!~burgestra@h-45-63.a155.priv.bahnhof.se] has joined #ruby
<shevy> hah
<shevy> finally he gave up :>
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby
dwon [dwon!~dwon@75-119-251-37.dsl.teksavvy.com] has joined #ruby
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby
bwlang [bwlang!~anonymous@static-71-245-233-146.bstnma.fios.verizon.net] has joined #ruby
fayimora [fayimora!~fayimora@95.175.159.58] has joined #ruby
niklasb_ [niklasb_!~codeslay0@p5B3115F4.dip0.t-ipconnect.de] 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
nyuszika7h [nyuszika7h!nyuszika7h@unaffiliated/nyuszika7h] has joined #ruby
vandemar [vandemar!bella@2001:470:1f10:56b::4] has joined #ruby
musee [musee!~musee@unaffiliated/musee] has joined #ruby
MekkisFreenode [MekkisFreenode!~MekkisFre@2a00:dd0:0:6:80a6:4fff:fec7:d456] has joined #ruby
dv310p3r [dv310p3r!~dv310p3r@c-98-203-41-91.hsd1.fl.comcast.net] has joined #ruby
thecreators [thecreators!~rskagy@cpe-65-27-201-150.cinci.res.rr.com] has joined #ruby
ePirat [ePirat!~ePirat@p57A9728A.dip.t-dialin.net] has joined #ruby
ePirat [ePirat!~ePirat@unaffiliated/epirat] has joined #ruby
abstrusenick [abstrusenick!~abstrusen@180.241.175.11] has joined #ruby
stdcall [stdcall!~scriper@181.208.73.94.ip.orionnet.ru] has joined #ruby
Cypher [Cypher!~kapone@208.157.149.45] has joined #ruby
Karmaon [Karmaon!~john@gateway/tor-sasl/karmaon] has joined #ruby
cek [cek!~cek@crius.pantheon.fused.net] has joined #ruby
<cek> optimize: container.kind_of?(Hash) ? (container[key] ? container[key] : container) : container
tatsuya_o [tatsuya_o!~tatsuya_o@46-64-51-175.zone15.bethere.co.uk] has joined #ruby
<cek> container.kind_of?(Hash) && (container[key] || container) || container
minijupe [minijupe!~benlieb@adsl-74-243-170-217.ard.bellsouth.net] has joined #ruby
voodoofish4301 [voodoofish4301!~mtorres@il-la.la.idealab.com] has joined #ruby
pilf [pilf!~pilf@client-86-25-199-193.cht-bng-011.adsl.virginmedia.net] has joined #ruby
[[thufir]] [[[thufir]]!~thufir@184.65.42.92] has joined #ruby
<cek> container.kind_of?(Hash) && container.has_key?(key) and container[key] or container
p0y [p0y!~p0y@112.210.125.195] has joined #ruby
<cek> container.kind_of?(Hash) && container.has_key?(key) ? container[key] : container
<cek> thanks
geaif [geaif!~geaif@xdsl-188-155-129-176.adslplus.ch] has joined #ruby
z2fyza [z2fyza!~gard@cm-84.215.22.0.getinternet.no] has joined #ruby
Sailias [Sailias!~jonathan@CPE0018f85e576d-CM001bd7aaaf96.cpe.net.cable.rogers.com] has joined #ruby
Cypher [Cypher!~kapone@208.157.149.45] has joined #ruby
sdwrage [sdwrage!~sdwrage@cpe-184-57-83-165.columbus.res.rr.com] has joined #ruby
IrishGringo [IrishGringo!~chatzilla@c-71-229-99-200.hsd1.fl.comcast.net] has joined #ruby
jensn [jensn!~Jens@ip231-178.wireless.lu.se] has joined #ruby
sandstrom [sandstrom!~sandstrom@unaffiliated/sandstrom] has joined #ruby
flippingbits [flippingbits!~anonymous@ip-81-210-178-39.unitymediagroup.de] has joined #ruby
tatsuya_o [tatsuya_o!~tatsuya_o@46-64-51-175.zone15.bethere.co.uk] has joined #ruby
mk03 [mk03!~mk03@61.245.119.34.er.eaccess.ne.jp] has joined #ruby
iocor [iocor!~textual@unaffiliated/iocor] has joined #ruby
advorak [advorak!~advorak@216-15-16-163.c3-0.161-ubr1.lnh-161.md.cable.rcn.com] has joined #ruby
beakerman [beakerman!~beakerman@c-76-118-172-173.hsd1.nh.comcast.net] has joined #ruby
wmoxam [wmoxam!~wmoxam@pdpc/supporter/active/wmoxam] has joined #ruby
CreativeEmbassy [CreativeEmbassy!~CreativeE@pool-209-158-5-18.altnpa.east.verizon.net] has joined #ruby
Jake232 [Jake232!~textual@5e021a35.bb.sky.com] has joined #ruby
abstrusenick_ [abstrusenick_!~abstrusen@180.241.175.11] has joined #ruby
kenperkins [kenperkins!~textual@50-47-18-37.evrt.wa.frontiernet.net] has joined #ruby
huhu_ [huhu_!~huhu@unaffiliated/huhu-/x-6122598] has joined #ruby
<shevy> lol
shevy [shevy!~shevy@178-190-69-12.adsl.highway.telekom.at] has quit ["I'll be back ... maybe"]
icrazyhack [icrazyhack!horieyui@222.47.125.36] has joined #ruby
umren [umren!~umren@176.14.162.174] has joined #ruby
centipedefarmer_ [centipedefarmer_!~centipede@75-162-52-240.desm.qwest.net] has joined #ruby
tatsuya_o [tatsuya_o!~tatsuya_o@46-64-51-175.zone15.bethere.co.uk] has joined #ruby
closedbook [closedbook!~closedboo@cpe-098-027-062-105.nc.res.rr.com] has joined #ruby
<closedbook> anyone know good documentation for ruby syntax, like keyword and symbol (~=, : ?, ===, etc.)?
<newbold> closedbook: I could use that too
<newbold> seems that there are a lot of fun things that I totally don't understand or recognize
dagnachewa [dagnachewa!~dagnachew@modemcable142.238-179-173.mc.videotron.ca] has joined #ruby
<closedbook> Yeah, when I read code, I'd like to know more about how I could use a particular symbol or keyword.
adambeynon [adambeynon!~adambeyno@82-69-1-211.dsl.in-addr.zen.co.uk] has joined #ruby
visof [visof!~visof@41.130.30.225] has joined #ruby
<newbold> thanks canton7
<canton7> (but not on stuff like ===)
<newbold> man, "unless" looks really handy
jbpros [jbpros!~jbpros@82-186-112-217.dyn.adsl.belcenter.be] has joined #ruby
<canton7> yeah, it's amazing as a statement modifier. Most style guides agree on not allowing unless...else, though
alx- [alx-!~Alex@108.162.180.72] has joined #ruby
kenperkins [kenperkins!~textual@50-47-18-37.evrt.wa.frontiernet.net] has joined #ruby
<closedbook> so, using unless by itself is stylistically better?
techhelp [techhelp!~Dan@ip70-162-10-229.ph.ph.cox.net] has joined #ruby
<newbold> seems that using it in a loop as a way to decide if the loop should be allowed to continue is a good use
<newbold> (that was the example on that page anyway)
<newbold> I'm also generally curious about how to take full advantage of Ruby's awesome syntax for writing code more efficiently... like, for instance, could this be written more cleanly? http://pastie.org/3225418
<closedbook> I found this for operators, though I don't know if it's exhaustive http://www.tutorialspoint.com/ruby/ruby_operators.htm
<canton7> from what I've read, http://pastie.org/3225433 is the best style for 'unless'
<newbold> closedbook: looks like it could exhaust me :) thanks for sharing that one
BrianE [BrianE!~brian@87.112.149.96] has joined #ruby
<closedbook> no probs :-)
<closedbook> yeah, it makes more sense to not have an else statement after unless
<canton7> newbold, that would be my preferred style for that statement. You might be able to replace "if cgi['content'].to_str.length > 0" with "unless cgi['content'].to_s.empty?"
<newbold> canton7: well, last night when I was playing with that (and I admit it was late, and I could have made mistakes) it seemed that cgi['whatever'] was never empty or nil even when it wasn't set to anything via GET or POST
<newbold> so either I was screwing something up or there's something going on here that I don't understand
<canton7> newbold, notice I left the conversion to string in there
<newbold> I'm examining it more closely, just read about "puts YAML::dump(object)" so maybe that'll help me better understand the cgi object
<newbold> ah
ePirat [ePirat!~ePirat@unaffiliated/epirat] has joined #ruby
<canton7> newbold, "string.length == 0" is the same as "string.empty?"
wmoxam [wmoxam!~wmoxam@pdpc/supporter/active/wmoxam] has joined #ruby
<canton7> I've no idea what your CGI object is... So didn't want to assume there was a better way of accessing it
<newbold> canton7: well, cgi['lol'] would be the value of http://example.com/index.rb?lol=hello
<newbold> cgi['lol'] = 'hello'
<newbold> oh, interesting
<newbold> that YAML::dump thing is very useful: http://pastie.org/3225473
<newbold> when I did ?page=test, that's what I see
<canton7> newbold, p (and pp) are very handy also
<newbold> and when I do the YAML dump on cgi['page'] and when I don't pass a page parameter to the script at all, I see: --- !str str: "" "@params": []
<newbold> which I guess would explain why my nil check failed
* newbold notes p and pp
<canton7> for pp, you have to require 'pp', but it's prettier than p
enikar [enikar!~gil@cl-140.mrs-01.fr.sixxs.net] has joined #ruby
RegEchse [RegEchse!~regechse@h1985974.stratoserver.net] has joined #ruby
<newbold> canton7: so what's the ? mean in 'empty?'
<canton7> newbold, it's convention for methoids which return a boolean to end in a question mark
<newbold> is there an 'empty' method without the question mark as well? or just 'empty?'
<canton7> similarly, methods which are potentially "dangerous" or produce unexpected results often end with an exclamation mark. So you'll get "Array.map", which returns a new array, and "Array.map!", which modifies the original array
<newbold> oh, that's awesome
<canton7> newbold, the method is defined as ending in a question mark, so the method "empty" doesn't exist
<newbold> when I learn stuff like this, it makes more sense when I remember that a lot of this was largely created by a Japanese genius :D
<newbold> there's something kind of cute about methods including punctuation that provide additional meaning/information
<newbold> now I just wish there was a more efficient way to do page = cgi['page'].gsub(' ', '').gsub('.', '')
<canton7> yeah, it's handy :) Exclamation marks and questions marks are the only punctuation allowed in method names, though, and only at the end
<newbold> tacking on a bunch of .gsubs doesn't seem right somehow but it was the only thing I could find that worked
pantsman [pantsman!~pantsman@2.27.111.107] has joined #ruby
pantsman [pantsman!~pantsman@pdpc/supporter/active/pantsman] has joined #ruby
<canton7> newbold, you could use gsub with regex, or tr. cgi['page'].tr('. ', '') would be my personal preference
<canton7> but you could also so cgi['page'].gsub(/\. /, '')
<newbold> oh, what's tr?
<canton7> *do
<newbold> oh wow!
<newbold> that's incredibly awesome
<newbold> exactly what I needed!
<canton7> that's the no. 1 thing I've found I like about ruby -- whatever you want to do, there's almost always a method designed to do exactly that, so you end up with clean, clear code, rather than a mess of other functions
<newbold> I love it
<newbold> of course at this stage, < 24 hours into learning the language, that's what also makes it the most intimidating... :)
<Hanmac> and if not, all classes are open so you can define your own methods
<canton7> I'm waiting for a decent way to limit the scope of monkey-patches, thoug
<canton7> *though
dekroning [dekroning!~dekroning@541B931D.cm-5-4c.dynamic.ziggo.nl] has joined #ruby
<Hanmac> you can not ... the monkey have more power then you :P
<newbold> is there a ternary?
<canton7> newbold, there is: condition ? truecase : falsecase
<newbold> or a faster way to express "do this if this otherwise do that"
enikar [enikar!~gil@cl-140.mrs-01.fr.sixxs.net] has quit ["WeeChat 0.3.6"]
<canton7> Hanmac, I saw a proposal and a basic implementation a little while ago, but it was as slow as anything
senny [senny!~senny@84-72-61-96.dclient.hispeed.ch] has joined #ruby
<newbold> canton7: hmmm do you see anything wrong with this? page == 'MainPage' ? puts '<span style="color: #ccc;">Home</span>' : puts '<a href=?>Home</a>'
<canton7> newbold, stylistically, or functionally
<newbold> functionally first and foremost :)
<newbold> since it's causing my thing not to work
<newbold> but because I'm doing this all through CGI I can't easily see errors :(
<canton7> looks fine from here
<newbold> I just know when I've goofed something up
<newbold> (because the screen loads white, heh)
<canton7> ah, no. There's a precidence problem I think
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby
<newbold> oh
stoffus [stoffus!~stoffus@exch-ad.bahnhof.net] has joined #ruby
* newbold tries to act like he knows what that means
<canton7> page == 'MainPage' ? puts('<span style="color: #ccc;">Home</span>') : puts('<a href=?>Home</a>') will work, but you're better off with puts page == 'MainPage' ? '<span style="color: #ccc;">Home</span>' : <a href=?>Home</a>
<Hanmac> newbold, i would prefer to put the puts outside of the condition ... or funny error could be the result
<canton7> oops, with quotes around the last bit, of course
<newbold> oooohhhh
<newbold> I can't believe you can do that!
<newbold> this is SO awesome
<Hanmac> canton7: i think he has enough ... he is ruby-high :p
pxjorge [pxjorge!~pxjorge@a79-169-113-23.cpe.netcabo.pt] has joined #ruby
<canton7> haha! I remember that moment :)
* canton7 resists blowing newbold's mind
<newbold> heh
<newbold> I'll share what I have so far in a sec
<canton7> cool. Then we can attack it and make it more awesome :)
* newbold would love that
burgestrand [burgestrand!~burgestra@h-45-63.a155.priv.bahnhof.se] has joined #ruby
<newbold> canton7: ok, here: http://newbold.name/rubywiki/
<newbold> it's lame, I know, but it's my first thing :)
<newbold> source: http://pastie.org/3225634
<canton7> I like :)
<newbold> I thought a wiki would be a great way to learn a bit of everything
<newbold> working with files, vars, arrays, string substitution (gsub, but now tr is my favorite for simple stuff), working with form data, etc
<newbold> there's only one bug that I know of
<canton7> newbold, I'm going to point you at sinatra, just because I think it's awesome. I know you're doing this to learn ruby :P
moshee [moshee!~moshee@c-50-135-229-127.hsd1.wa.comcast.net] has joined #ruby
moshee [moshee!~moshee@unaffiliated/moshee] has joined #ruby
<newbold> display.gsub!(/\[\[(.+?)\]\]/u, '<a href=?page=\1>\1</a>') <--- this doesn't allow for page names with spaces, like [[This Page]]
<newbold> I'm filtering out spaces anyway, but still, it won't generate the link. I know the reason why --- my HTML doesn't have quotes around the href= bit
<newbold> but I can't seem to add them without weird stuff happening. :/
<newbold> oh wait
kenperkins [kenperkins!~textual@50-47-18-37.evrt.wa.frontiernet.net] has joined #ruby
dekroning [dekroning!~dekroning@541B931D.cm-5-4c.dynamic.ziggo.nl] has joined #ruby
<newbold> got it :)
<newbold> I was just putting the quotes in the wrong place like a dork
<newbold> canton7: and yeah, I saw sinatra and it does look _awesome_
<newbold> I'm not sure I can use it in my current environment through, which is all CGI-based and kind of dorky
<newbold> I did work out how to install a gem last night though, with some help (the 'redcloth' gem
<newbold> which does awesome Textile formatting like *bold* _italics_ etc
adamjleonard [adamjleonard!~adamjleon@pool-108-9-169-222.tampfl.fios.verizon.net] has joined #ruby
senny [senny!~senny@84-72-61-96.dclient.hispeed.ch] has joined #ruby
pvgrif [pvgrif!547a338f@gateway/web/freenode/ip.84.122.51.143] has joined #ruby
smitjel [smitjel!~smitjel@174-125-206-101.dyn.centurytel.net] has joined #ruby
<pvgrif> hi whats the best way to check for a nil object or no defined
<pvgrif> i ve seen on the net !!current_user but it says that its not convention and it shouldnt be done like that
<pvgrif> and it doesnt say how it should really be done
<pvgrif> whats the rubyish way?
<Hanmac> .nil? is the fastest and best way
tomzx [tomzx!~tomzx@dsl-156-157.aei.ca] has joined #ruby
<pvgrif> Hanmac: thank you
<burgestrand> pvgrif: !! object is more for explicitly converting an object to a true/false value, no matter what it is
<burgestrand> pvgrif: it’ll return false for nil/false, and true for everything else
<pvgrif> burgerstrand: if ive assigned it like this @current_user ||= User.find(session[:user_id]) if session[:user_id]
__zak__ [__zak__!~z@78.251.223.161] has joined #ruby
<pvgrif> should i do !!current_user or current_user.nil?
<pvgrif> sry i didnt say, the first line is the output of the function current_user
<canton7> newbold, http://pastie.org/3225692 is my personal preferences applied to the source
<newbold> canton7: oh, awesome
x77686d [x77686d!~whm@c-68-63-181-242.hsd1.az.comcast.net] has joined #ruby
<newbold> canton7: you managed to get an unless in there :) Is there an advantage to using the heredoc? just cleaner?
senny [senny!~senny@84-72-61-96.dclient.hispeed.ch] has joined #ruby
<canton7> newbold, just cleaner IMO for multi-line strings. That one's entirely personal preference
kevinbond [kevinbond!~kevinbond@112.50.204.68.cfl.res.rr.com] has joined #ruby
<newbold> canton7: ok so I just looked at sinatra again and realized I absolutely need it.
adambeynon [adambeynon!~adambeyno@82-69-1-211.dsl.in-addr.zen.co.uk] has joined #ruby
<newbold> canton7: but I assume it's not just as simple as require 'sinatra' and going to town... it has to be running in the background to some extent, no?
sbanwart [sbanwart!~sbanwart@66.6.175.18] has joined #ruby
<canton7> newbold, not quite. There's a funky thing called 'Rack', which is described as 'middleware'. Web servers talk to Rack, Rack talks to whatever framework you're running (sinatra, rails, etc)
<newbold> ah. But for my simple no-frills host that supports PHP only (and kinda-sorta other stuff running as a CGI script), I assume Rack isn't available
<newbold> I've had a Heroku account for a while but haven't ever tried it... think it's time to bust into that
<canton7> newbold, ruby has a simple webserver called 'Webrick' built in, which sinatra will use if you just run 'ruby myapp.rb'. If you install more complex servers, (e.g. thin), then sinatra will use those by default. If you're using something like Passenger with Apache, then that's also capable of hosting a sinatra site, through the magic of Rack
<canton7> newbold, yeah that's the thing -- support on cheap shared hosting for ruby stuff isn't good at all
regedarek [regedarek!rege@gateway/shell/bshellz.net/x-vntlkoxycmpqnfhm] has joined #ruby
<canton7> Heroku is the only one I know of, and you might as well get a VPS for the price
<regedarek> hey
<newbold> canton7: well, Heroku has a free tier that I plan to make full use of while I learn :)
<regedarek> im using .run method
<canton7> newbold, ooh wasn't aware of that! Might have to look into it
<regedarek> how to close this task
z2fyza [z2fyza!~gard@cm-84.215.22.0.getinternet.no] has joined #ruby
<newbold> canton7: well, that's what someone told me... haven't actually used it yet so I haven't experienced it first-hand
Seisatsu [Seisatsu!~seisatsu@adsl-99-35-225-92.dsl.pltn13.sbcglobal.net] has joined #ruby
<newbold> canton7: do you know anything about this 'bundle' command?
<canton7> newbold, http://gembundler.com/
<newbold> I'm supposed to run "bundle install" on my ruby app to prepare it for deployment to heroku
<newbold> ah
huhu_ [huhu_!~huhu@unaffiliated/huhu-/x-6122598] has joined #ruby
<newbold> I guess they assume that you already have that... installing now
p0y [p0y!~p0y@121.97.55.207] has joined #ruby
visof [visof!~visof@41.130.163.82] has joined #ruby
<burgestrand> newbold: heroku runs that command for you when you deploy your application to them
<newbold> burgestrand: I'm following http://devcenter.heroku.com/articles/ruby and it's kind of suggesting that I have to do this locally first
<newbold> which is cool --- learning a ton
<burgestrand> newbold: like it says there, bundler is only for dependencies of your application, it’s nice to have them installed locally too
<newbold> ahhh
dagnachewa [dagnachewa!~dagnachew@modemcable142.238-179-173.mc.videotron.ca] has joined #ruby
<newbold> I'm not used to do anything local ever, heh
<burgestrand> newbold: but it won’t affect your heroku deployment :)
<newbold> which I guess is bad practice :(
closedbook [closedbook!~closedboo@cpe-098-027-062-105.nc.res.rr.com] has joined #ruby
<newbold> holy crap, this local thing actually worked
<newbold> with sinatra
<newbold> nothing ever works for me on the first try :P
<newbold> 12:14:06 web.1 | == Sinatra has ended his set (crowd applauds)
<newbold> lol.
havenn [havenn!~skipper@pool-71-189-127-105.lsanca.fios.verizon.net] has joined #ruby
<burgestrand> :)
<newbold> burgestrand: hehe what's up with the names they assign to apps? they're awesome
<newbold> but intensely random :)
<burgestrand> newbold: japanesy, like the rest of their stack, bunch of samurais and carps
<newbold> burgestrand: any clue why when I do git push heroku master I get "Permission denied (publickey)." and "fatal: The remote end hung up unexpectedly"
<burgestrand> newbold: yes, if you go to your account heroku asks you to add an SSH key to it
<newbold> ah
<burgestrand> newbold: it comes in two parts, a private and a public one; heroku needs the public one to make sure that you are you
<burgestrand> newbold: they should have a guide somewhere on how to generate it; if not github also has one :)
<newbold> burgestrand: is this in the heroku web thing?
<newbold> I see a place for an API key but nothing about SSH keys :/
<newbold> ah thanks
<burgestrand> newbold: sorry, you might need to add it with the command-line client
luckyruby [luckyruby!~luckyruby@125-187.96-97.tampabay.res.rr.com] has joined #ruby
kiero_ [kiero_!kiero@platinum.edu.pl] has quit [#ruby]
dasfugufish [dasfugufish!~Adium@64-184-237-212.mammothnetworks.com] has joined #ruby
<newbold> burgestrand: annnnd http://gentle-dawn-6006.herokuapp.com/
<newbold> yay :D
<burgestrand> newbold: \o/
x77686d [x77686d!~whm@c-68-63-181-242.hsd1.az.comcast.net] has joined #ruby
<newbold> burgestrand: so, the idea here is to develop on this machine, test, and if all looks good then stick it into git and deploy?
<canton7> woop!
<burgestrand> newbold: yeah, once it looks good enough you just put it up on heroku :)
<newbold> canton7: yeah, I can confirm that it's free, too, since I haven't given them any billing details yet :)
<canton7> newbold, git is an scm: you're supposed to use it throughout development
<newbold> canton7: now to integrate my wiki code so it works nicely with sinatra :)
<newbold> canton7: I'm used to just saving over my changes and uploading via FTP :P
* newbold has been living in the dark ages
<burgestrand> newbold: like canton7 says though, commit often, commits are cheap :)
<canton7> newbold, http://progit.org/ . Hop into #git if you have any questions
<newbold> would I git commit -m "init" every time? or do I need to change the -m or "init" parts?
<canton7> newbold, unfortunately git isn't something you can get into by guesswork. My advice is to read progit all the way through. You won't pick git up in a day, but after a week you'll love it to bits
<newbold> canton7: gotcha, totally understood
<newbold> sinatra is freaking me out though
<newbold> you don't have to puts? you can just stick stuff in quotes and it's displayed?
<canton7> newbold, in ruby, the last statement in a block/function is returned by the function
<burgestrand> newbold: yeah, actually puts won’t work at all
<burgestrand> newbold: which languages have you used before?
<canton7> in this case, the last thing in that 'get' block is a string, so the string is returned by the block
<newbold> burgestrand: BASIC, pascal, and PHP. :/
<newbold> canton7: that sounds like magic, heh
<newbold> I love it.
<burgestrand> newbold: just curious, the model in ruby web applications is a bit different from PHP :)
<Hanmac> but dont say SVN is better than git ... 1. it is a lie, and 2. people will hate you
<dagnachewa> the best way to have identical gem install is with exporting gems ? my pc-gems and laptop-gems are not identical , on my pc global gems count is 174 and on my laptop gems count is 150
dotnull [dotnull!~dot_null@173-31-158-182.client.mchsi.com] has joined #ruby
fserb [fserb!~fserb@178-83-225-18.dynamic.hispeed.ch] has joined #ruby
<newbold> there sound be some way to sync gems across machines
<newbold> s/sound/should/
iocor [iocor!~textual@unaffiliated/iocor] has joined #ruby
<newbold> canton7: what's the best way to troubleshoot a gem problem? I installed the redcloth gem locally, but now when I use the foreman thing it's all eb.rb:8:in `require': no such file to load -- redcloth (LoadError)
<burgestrand> newbold: put it in your Gemfile if you have one
<burgestrand> newbold: the Gemfile is the authorative source to which gems you have access to from your application
<newbold> ohhhh, gotcha.
bier [bier!~bier@p579990C6.dip.t-dialin.net] has joined #ruby
<newbold> burgestrand: do I have to specify the gem version in that file?
<newbold> or is that optional?
<burgestrand> newbold: it’s optional, bundler will use the latest one thats compatible with the rest of the gems
hadees [hadees!~hadees@72-48-91-73.dyn.grandenetworks.net] has joined #ruby
BrianE [BrianE!~brian@87.112.149.96] has joined #ruby
<newbold> silly gem and their case-sensitive names
<burgestrand> yeah, and camel-casing gem names is also annoying :p
<newbold> that's what I just ran into
mmokrysz [mmokrysz!~mmokrysz@pdpc/supporter/student/mmokrysz] has joined #ruby
crodas [crodas!~crodas@git.crodas.org] has joined #ruby
thomasdebenning [thomasdebenning!~thomasdeb@c-69-181-139-137.hsd1.ca.comcast.net] has joined #ruby
<newbold> canton7: sinatra is making me feel pretty bad about how I've spent the last 10 years of webdev
<canton7> newbold, yeah I had a similar moment :P
<newbold> canton7: refactoring my wiki code now :)
emmanuelux [emmanuelux!~emmanuel@2a01:e35:2e4d:9010:21d:60ff:fe0e:b818] has joined #ruby
<newbold> every time I start foreman and don't get an error, I feel like I actually know what I'm doing
Sailias [Sailias!~jonathan@CPE0018f85e576d-CM001bd7aaaf96.cpe.net.cable.rogers.com] has joined #ruby
headius [headius!~headius@71-210-154-45.mpls.qwest.net] has joined #ruby
v0n [v0n!~v4n@modemcable144.68-81-70.mc.videotron.ca] has joined #ruby
bbttxu [bbttxu!~adam@pool-71-96-208-205.dfw.dsl-w.verizon.net] has quit [#ruby]
<newbold> canton7: got a sec?
<canton7> newbold, sure
<newbold> I've got def render(output) '<br>' + output + '<br>' end
<newbold> (spread across three lines of course)
<newbold> then in a sinatra "do" block or whatever it's called, I have some stuff that creates the string "display" and then I do this at the end of the block: render display
<newbold> in theory that should spit out the string passed to the render function wrapped in <br>s, right?
<newbold> or am I totally thinking about this incorrectly?
<canton7> that should be fine
<newbold> canton7: sinatra is saying "wrong number of arguments (1 for 2)"
<canton7> can you pastebin it?
<newbold> canton7: just don't laugh :P http://pastie.org/3226016
<newbold> it's all sloppy, I know
<canton7> that's a lot neater than most "sloppy" code I see :P
<newbold> line 35 is where I call the function, and that's where sinatra is saying it's expecting two parameters
<newbold> ah sorry my function really is on three lines, not smooshed into one
<newbold> I just had it that way so I could paste it into the channel as one line before :)
cobragoat [cobragoat!~cobragoat@adsl-71-142-54-0.dsl.scrm01.pacbell.net] has joined #ruby
<canton7> newbold, render is a function defined by sinatra. You're stepping on its toes :)
<newbold> (this also doesn't use your helpful suggestions from earlier, which I've totally saved)
<newbold> ahhh
* newbold changes the function name
<newbold> canton7: heh, works perfectly now!
<newbold> thanks! :)
<canton7> newbold, if you use the "modular app" style, you'll stop stepping on its toes ;)
<canton7> http://www.sinatrarb.com/intro#Sinatra::Base%20-%20Middleware,%20Libraries,%20and%20Modular%20Apps
<newbold> ahhh, I se
<newbold> see*
x77686d [x77686d!~whm@c-68-63-181-242.hsd1.az.comcast.net] has joined #ruby
kevinbond [kevinbond!~kevinbond@68.204.50.112] has joined #ruby
gianlucadv [gianlucadv!~user@host78-84-dynamic.44-79-r.retail.telecomitalia.it] has joined #ruby
maletor [maletor!~maletor@c-69-181-24-86.hsd1.ca.comcast.net] has joined #ruby
<newbold> is there something equivalent to PHP's $foo = 'A', $foo .= 'B' // echo $foo => AB
<newbold> specifically the .= thing
<burgestrand> newbold: +=
<burgestrand> newbold: ruby have a bunch of different operators for handling strings
<newbold> I'm guessing the very fact that I'm asking that means I'm doing something wrong or failing to take advantage of some Ruby-specific way of doing stuff though, hhe
<newbold> burgestrand: thanks!
<burgestrand> newbold: full reference of them here: http://ruby-doc.org/core-1.9.3/String.html :)
<canton7> newbold, << for strings -- avoids duplication iirc
<canton7> well, creating useless new strings
proview2 [proview2!~proview@sapphiredirect-156-86.sapphirenet.gi] has joined #ruby
<burgestrand> actually it’s probably the old string that is useless canton7 :p
<proview2> Anyone knows how to count the number of AR objects similar to what rack-bug does? (which doesnt seem to work for rails 3.1)
<canton7> yeah, I didn't phrase that well at all :P
voodoofish430 [voodoofish430!~mtorres@adsl-99-93-149-204.dsl.lsan03.sbcglobal.net] has joined #ruby
<burgestrand> proview2: ObjectSpace.count_objects(ActiveRecord::Base) perhaps
<burgestrand> Oh, hm, it takes some other argument.
<proview2> tks, thats a big help
dasfugufish [dasfugufish!~Adium@64-184-237-212.mammothnetworks.com] has joined #ruby
<burgestrand> ObjectSpaceh.each_object(ActiveRecord::Base) should give you an iterator that you could iterate through and get the count, though.
<proview2> trying it now
<Asher> it's always great to switch tabs and see a solution involving iterating object space :P
<proview2> have been hours now trying to this, feeling right now a huge moron :)
tobyo [tobyo!~tobyo@cpe-24-165-22-166.san.res.rr.com] has joined #ruby
<burgestrand> Asher: :p
<Asher> hehe
macmartine [macmartine!~macmartin@c-24-21-112-60.hsd1.or.comcast.net] has joined #ruby
radmacd [radmacd!~radmacd@modemcable055.68-82-70.mc.videotron.ca] has joined #ruby
<proview2> ok nice
<proview2> so using ObjectSpace.each_object(ActiveRecord::Base) seems to work
<proview2> although it seems the garbage collector is affecting it
<Asher> you are traversing every object
<newbold> in sinatra how could I do something like get '/:page/:action' do but have the /:action part be optional?
<newbold> I'm thinking just looking at :page and splitting the string on / but is there a better approach?
<canton7> newbold, see the section startnig "Route patterns may have optional parameters:" in http://www.sinatrarb.com/intro#Routes
davidpk [davidpk!~r00t@5e0a02e9.bb.sky.com] has joined #ruby
<newbold> canton7: ah it was right under my nose :)
<proview2> whats wrong with this approach? http://pastie.org/3226132
award85 [award85!~itsame@c-69-181-38-133.hsd1.ca.comcast.net] has joined #ruby
award85 [award85!~itsame@unaffiliated/award85] has joined #ruby
demian`_ [demian`_!~demian_@80.149.203.160] has joined #ruby
roitst [roitst!599c4fa3@gateway/web/freenode/ip.89.156.79.163] has joined #ruby
am88b [am88b!~siim@q.xf.ee] has quit [#ruby]
<roitst> BOnsoir
jergason [jergason!~jergason@c-67-182-209-164.hsd1.ut.comcast.net] has joined #ruby
<roitst> Je suis dev depuis 2 / 3 ans. Et j'ai toujours eu un défaut c'est de ne pas savoir quoi coder... Je n'ai pas d'idée, à croire que j'ai tous les outils qu'il me faut ...
<roitst> Ca parle à quelqu'un ?
* Hanmac failed to understand the request. language is not supported by this user
<burgestrand> roitst: sacre bleu
<roitst> :)
gioele [gioele!~gioele@unaffiliated/gioele] has joined #ruby
<gioele> hello
jay_zawrotny [jay_zawrotny!~Jay@c-71-205-218-131.hsd1.mi.comcast.net] has joined #ruby
<burgestrand> roitst: on a more serious note, make an app that solves that problem, many developers have it
dwon_ [dwon_!~dwon@75-119-251-37.dsl.teksavvy.com] has joined #ruby
<gioele> after I use `File.utime(atime, mtime, path)`, how can I make sure that `File.stat(path).mtime` returns the updated value? There is a delay in syncing (indeed, if I `sleep(5)` everything goes fine) but `File.open(path).fsync` does not seem to sync at all
<proview2> se eu falar portugues aqui, alguem me poder dizer o que esta errado com isto ? http://pastie.org/3226132 :)
<roitst> burgestrand: What problem ?
<burgestrand> roitst: the problem of figuring out what to make
emocakes [emocakes!~om@201-14-40-67.mganm703.dsl.brasiltelecom.net.br] has joined #ruby
<roitst> burgestrand: And you say many developers have it. Do u have a example ? I don't understand what u mean
Seisatsu [Seisatsu!~seisatsu@adsl-99-54-9-134.dsl.pltn13.sbcglobal.net] has joined #ruby
lkba [lkba!~AndChat@aaqp239.neoplus.adsl.tpnet.pl] has joined #ruby
scribbles [scribbles!~scribbles@babel.sn0wcrash.info] has joined #ruby
lkba [lkba!~AndChat@aaqp239.neoplus.adsl.tpnet.pl] has joined #ruby
scribbles [scribbles!~scribbles@unaffiliated/scribbles] has joined #ruby
<newbold> anyone know the default webroot location for sinatra/thin?
<Mon_Ouie> "more serious"
<newbold> I don't even know if I'm asking that question correctly... but my app is writing files and I have no idea where it's putting them :P
<burgestrand> newbold: sinatra has it in public/
<burgestrand> newbold: if you mean where to put files to have them accessible from the app
<newbold> burgestrand: hmmm, any clue where public/ is on a Mac?
<burgestrand> newbold: I think I misunderstood you
<newbold> I just want to know where in my filesystem it's putting these files :P
<newbold> I'm not specifying any paths in my code
<newbold> so it's sticking them somewhere... heh.
<burgestrand> newbold: putting what files_
<newbold> burgestrand: File.open(page, "w") do |f| ... f.write params[:content] ... end
<Mon_Ouie> e.g. where's located the foo file in open("foo", "w") { |io| io.write "weee" } ?
<newbold> exactly!
<burgestrand> newbold: it’s dependent on how you start your application, it’ll be in the current working directory (Dir.pwd)
<Mon_Ouie> In whatever directory is the current one (the one Ruby was launched at by default)
<newbold> ohhh, yeah
<newbold> you're right --- it's right there alongside the app in the same directory
<newbold> Cool, thanks! :)
<newbold> I just assumed it was putting them in some crazy place, heh
<Harzilein> gioele: did you try stating a filehandle instead of a path?
<Harzilein> gioele: i'm pretty sure you should be guaranteed to read the stat you set in that case.
adeponte [adeponte!~adeponte@pool-173-51-131-197.lsanca.fios.verizon.net] has joined #ruby
smitjel [smitjel!~smitjel@174-125-206-101.dyn.centurytel.net] has quit [#ruby]
<gioele> Harzilein: but the code that calls `File.utime` is in a library and the code that checks for the correct `mtime` is in a rspec, so they cannot share the same file handle
Indian [Indian!~Indian@unaffiliated/londonmet050] has joined #ruby
d2dchat [d2dchat!~d2dchat@c-98-209-18-197.hsd1.mi.comcast.net] has joined #ruby
<newbold> can you break out of an if statement?
<Hanmac> you mean line break?
PaciFisT [PaciFisT!~PeaCE@CPE602ad06de6b3-CM602ad06de6b0.cpe.net.cable.rogers.com] has joined #ruby
<newbold> Hanmac: I've got an if statement (with an else as well) and early on within the if part I want to see if some other condition has been met... and if it has, I don't want it to execute any more code in the if/else statement
<burgestrand> newbold: lots of ways, but it depends what you mean
<newbold> if something ... (now, if something else, stop right here and break out) ... else .... end
<burgestrand> newbold: add another if-statement? :p
<newbold> oh.
<newbold> lol.
* newbold smacks himself
<newbold> I think the insanely awesome syntax of ruby has me 2nd-guessing even the most obvious and normal approaches to stuff
pantsman [pantsman!~pantsman@2.25.187.234] has joined #ruby
pantsman [pantsman!~pantsman@pdpc/supporter/active/pantsman] has joined #ruby
PaciFisT1 [PaciFisT1!~PeaCE@CPE602ad06de6b3-CM602ad06de6b0.cpe.net.cable.rogers.com] has joined #ruby
cek [cek!~cek@crius.pantheon.fused.net] has joined #ruby
<cek> why the heck shoulda runs teardown block before running shoulda test block?
<cek> oh what a crappy gem. no docs whatsoever. 79 issues open
pantsman [pantsman!~pantsman@pdpc/supporter/active/pantsman] has quit [#ruby]
waxjar [waxjar!~waxjar@ip11-49-212-87.adsl2.static.versatel.nl] has joined #ruby
enherit [enherit!~enherit@66-214-13-183.dhcp.lnbh.ca.charter.com] has joined #ruby
daniel_hinojosa [daniel_hinojosa!~danno@67-0-117-93.albq.qwest.net] has joined #ruby
phantomfake [phantomfake!~whats_in_@pool-71-190-229-236.nycmny.fios.verizon.net] has joined #ruby
PaciFisT [PaciFisT!~PeaCE@CPE0023be436752-CM0023be436750.cpe.net.cable.rogers.com] has joined #ruby
c0rn [c0rn!~c0rn@cpe-66-91-253-48.san.res.rr.com] has joined #ruby
zenergi [zenergi!~zenergi@pdpc/supporter/student/zenergi] has joined #ruby
<AnarchoTroll> if I need a function to capture a variable through a closure, should I create it as a lambda?
<Mon_Ouie> cek: It does have documentation.
<Mon_Ouie> AnarchoTroll: You can use define_method to define a method with a block
raincole_ [raincole_!~raincole@2001:288:5239:1:224:2bff:fe75:2f60] has joined #ruby
<cek> yea, autogenerated
jbw [jbw!~jbw@dsl-044-084.cust.imagine.ie] has joined #ruby
Karmaon [Karmaon!~john@gateway/tor-sasl/karmaon] has joined #ruby
geaif [geaif!~geaif@xdsl-188-155-129-176.adslplus.ch] has joined #ruby
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby
Axsuul [Axsuul!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby
Axsuul [Axsuul!~Axsuul@75-140-75-52.dhcp.mtpk.ca.charter.com] has joined #ruby
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby
<AnarchoTroll> Mon_Ouie, Thanks!
techhelp [techhelp!~Dan@ip70-162-10-229.ph.ph.cox.net] has joined #ruby
<idarkside> hi
<idarkside> is there somthing i can put in my code to read www.mywebsitre.com/license.php
<idarkside> and if active = coninute loading
<idarkside> if inactive = die
Cypher [Cypher!~kapone@208.157.149.45] has joined #ruby
csherin [csherin!~csherin@61.11.47.238] has joined #ruby
csherin [csherin!~csherin@61.11.47.238] has joined #ruby
maletor [maletor!~maletor@c-69-181-24-86.hsd1.ca.comcast.net] has joined #ruby
sandstrom [sandstrom!~sandstrom@m83-186-133-211.cust.tele2.se] has joined #ruby
sandstrom [sandstrom!~sandstrom@unaffiliated/sandstrom] has joined #ruby
vajrapani666 [vajrapani666!~vajrapani@c-69-181-26-39.hsd1.ca.comcast.net] has joined #ruby
strife25 [strife25!~strife25@cpe-098-026-018-050.nc.res.rr.com] has joined #ruby
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby
deanh [deanh!~deanh@ool-4578a276.dyn.optonline.net] has joined #ruby
cobragoat [cobragoat!~cobragoat@173-160-19-241-Sacramento.hfc.comcastbusiness.net] has joined #ruby
fiques [fiques!599c4fa3@gateway/web/freenode/ip.89.156.79.163] has joined #ruby
<fiques> If there is any sublime text 2 users
minijupe [minijupe!~benlieb@adsl-74-243-170-217.ard.bellsouth.net] has joined #ruby
<fiques> Why when I open folder I got this : http://img593.imageshack.us/img593/320/capturedcran20120121203.png on OS X Lion
tbrock [tbrock!~tbrock@207.239.107.3] has joined #ruby
<tbrock> guys i'm trying to call object_id on a method in ruby and it just prints the output of the method
<tbrock> 1.9.3
<tbrock> is that a bug?
<idarkside> yeah there is
<idarkside> Array
<idarkside> (
<idarkside> [status] => Active
<tbrock> idarkside was that for me?
<idarkside> no buddy
frode15243 [frode15243!~frode1524@pdpc/supporter/active/frode15243] has joined #ruby
<idarkside> for fiques
<tbrock> ok thanks :-)
<fiques> idarkside: What ?
rjfranco [rjfranco!~rjfranco@c-24-21-64-5.hsd1.wa.comcast.net] has joined #ruby
<idarkside> u answered my question im just looking for a sample code to kill the process if it says inactive
timepilot [timepilot!~timepilot@66.71.231.174] has joined #ruby
adambeynon [adambeynon!~adambeyno@82-69-1-211.dsl.in-addr.zen.co.uk] has joined #ruby
<fiques> good for u !
<idarkside> thanks
<idarkside> i'm never astounded by the ungratefulness that comes with knowledge
<fiques> But I can't use subimetext2
<samuelkadolph> tbrock: What do you mean prints the output of the method?
beakerman [beakerman!~beakerman@66.211.145.57] has joined #ruby
Zorg [Zorg!~Adium@MSP5135.rh.psu.edu] has joined #ruby
dnyy [dnyy!~dnyy@c-98-237-138-38.hsd1.wa.comcast.net] has joined #ruby
<Zorg> hi, I want to split a ruby string into an array with the delimiter being null terminators/zeros (not the string '0'). Does anyone know how to do this?
<cek> why the heck shoulda runs teardown block before running shoulda test block?
<Hanmac> Zorg: try "\0"
iocor [iocor!~textual@unaffiliated/iocor] has joined #ruby
<Zorg> Hanmac: works, thanks. wonder why I didn't think of that ;p.
bwlang [bwlang!~anonymous@static-71-245-233-146.bstnma.fios.verizon.net] has joined #ruby
<newbold> canton7: you still aroind?
<newbold> around*
Liothen [Liothen!~liothen@24-119-65-28.cpe.cableone.net] has joined #ruby
Liothen [Liothen!~liothen@pdpc/supporter/professional/liothen] has joined #ruby
<cek> ill tell you why
blueadept [blueadept!~blueadept@72.21.137.199] has joined #ruby
blueadept [blueadept!~blueadept@unaffiliated/blueadept] has joined #ruby
<cek> becaue when you create a thread and then that thread excepts, it prematurely exits the test somhow
<cek> then it runs teardown block and bt doesn't get a chance to be printed
mityaz [mityaz!~Earth@ip183-42.telenet.dn.ua] has joined #ruby
symb0l [symb0l!~symb0l@c-50-131-187-183.hsd1.ca.comcast.net] has joined #ruby
d2dchat [d2dchat!~d2dchat@c-98-209-18-197.hsd1.mi.comcast.net] has joined #ruby
sam101 [sam101!~hi@host86-167-110-45.range86-167.btcentralplus.com] has joined #ruby
<sam101> hello
<sam101> would any1 tell me where can i get rpm files ruby for Centos please
<Mon_Ouie> By default, threads silently die when an exception is raised and not caught
<Mon_Ouie> or rather rescued
iocor [iocor!~textual@unaffiliated/iocor] has joined #ruby
ggrocco [ggrocco!~ggrocco@177.32.49.198] has joined #ruby
jmorton [jmorton!~jmorton@pool-108-15-39-246.bltmmd.fios.verizon.net] has joined #ruby
vajrapani666 [vajrapani666!~vajrapani@c-69-181-26-39.hsd1.ca.comcast.net] has joined #ruby
sbanwart [sbanwart!~sbanwart@66.6.175.18] has joined #ruby
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby
thomasdebenning [thomasdebenning!~thomasdeb@c-69-181-139-137.hsd1.ca.comcast.net] has joined #ruby
S2kx [S2kx!~S1kx@ip-95-223-80-198.unitymediagroup.de] has joined #ruby
blueadept [blueadept!~blueadept@unaffiliated/blueadept] has joined #ruby
vraa [vraa!~vraa@99-20-202-44.lightspeed.hstntx.sbcglobal.net] has joined #ruby
brmouzone [brmouzone!~brmouzone@108-90-18-133.lightspeed.cicril.sbcglobal.net] has joined #ruby
cyb3r3li0 [cyb3r3li0!~3li0@c-69-254-128-192.hsd1.nm.comcast.net] has joined #ruby
cyb3r3li0g [cyb3r3li0g!~3li0@c-69-254-128-192.hsd1.nm.comcast.net] has joined #ruby
beakerman [beakerman!~beakerman@66.211.145.57] has joined #ruby
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby
cook1es [cook1es!~chatzilla@c83-248-93-185.bredband.comhem.se] has joined #ruby
* newbold grumbles about gemlocks and bundles
kakaskin [kakaskin!~CLDG@178.120.109.192] has joined #ruby
csherin [csherin!~csherin@61.11.47.238] has joined #ruby
rickmasta [rickmasta!~rickmasta@pool-71-183-247-164.nycmny.fios.verizon.net] has joined #ruby
thecreators [thecreators!~rskagy@cpe-65-27-201-150.cinci.res.rr.com] has joined #ruby
gigamonkey [gigamonkey!~user@adsl-76-254-17-226.dsl.pltn13.sbcglobal.net] has joined #ruby
rexbutler [rexbutler!~rex@c-24-10-196-81.hsd1.ut.comcast.net] has joined #ruby
cyb3r3li0 [cyb3r3li0!~eguzman@c-69-254-128-192.hsd1.nm.comcast.net] has joined #ruby
Faris [Faris!~amnay@41.250.233.124] has joined #ruby
Evixion [Evixion!Evixion@tn-67-236-5-224.dhcp.embarqhsd.net] has joined #ruby
badabim [badabim!~badabim@c-98-207-235-20.hsd1.ca.comcast.net] has joined #ruby
kerframil [kerframil!~kerframil@cpc2-enfi16-2-0-cust659.hari.cable.virginmedia.com] has joined #ruby
kerframil [kerframil!~kerframil@gentoo/user/kerframil] has joined #ruby
ggrocco [ggrocco!~ggrocco@177.32.49.198] has quit [#ruby]
ChampS666 [ChampS666!~ChampS@p54B4AEBD.dip.t-dialin.net] has joined #ruby
Th|rdman [Th|rdman!~hi@host86-167-110-45.range86-167.btcentralplus.com] has joined #ruby
QKO [QKO!~reaVer@banzai.speedxs.nl] has joined #ruby
Alt-255 [Alt-255!~blah@CPE0023bee17c0e-CM0023bee17c0b.cpe.net.cable.rogers.com] has joined #ruby
jensn [jensn!~Jens@c-83-233-145-148.cust.bredband2.com] has joined #ruby
dotnull [dotnull!~dot_null@173-31-158-182.client.mchsi.com] has joined #ruby
<newbold> oh no
mztriz [mztriz!~mztriz@74-136-75-114.dhcp.insightbb.com] has joined #ruby
<newbold> the favicon file I included isn't being served because a request for /favicon.ico is picked up by sinatra
Kelvin [Kelvin!~Kelvin@pool-108-35-91-79.nwrknj.fios.verizon.net] has joined #ruby
<Kelvin> hello
<canton7> newbold, put favicon.ico in public/
<newbold> canton7: ah, do I need to create a folder in my repo called public?
<canton7> newbold, yup. Or you can configure sinatra to use another folder
<canton7> anything in that folder is available "automatically", as it were... so public/favicon.ico is available as yoursite.com/favicon.ico
S1kx [S1kx!~S1kx@pdpc/supporter/monthlybyte/s1kx] has joined #ruby
<newbold> canton7: perfect!
<newbold> I have learned so much today, it's crazy
notjohn [notjohn!~john@cpe-174-103-133-37.cinci.res.rr.com] has joined #ruby
<canton7> heh
<canton7> how's the wiki coming along?
<Kelvin> So, hopefully someone is around :). I'm working my way through a ruby tutorial. The, ever popular, Microposting site. I used scaffolding to create a Users model, and a Microposts model. When I try to make an association with has_many and belongs_to. it doesn't seems to work
<newbold> canton7: I lost the data I had on the server because I just pushed a new version, heh
<newbold> canton7: here's the source: http://pastie.org/private/pp0zch0g2rfrimrqlsx5la
<canton7> newbold, ah, nice. Methinks you need a database backend
nowthatsamatt [nowthatsamatt!~nowthatsa@rrcs-71-43-23-18.se.biz.rr.com] has joined #ruby
<canton7> I like tiny sinatra apps - they're so neat :)
<newbold> canton7: heck yeah they're neat!
<Kelvin> anyone who can help me understand why I can't do something (after its set) like first_user.microposts?
<newbold> as for databases, they kind of intimidate me
<canton7> newbold, btw, line 6 would be better off as "title = '' unless title"
<newbold> canton7: ah right
<canton7> (or maybe if title.nil?. Things that evaulate to boolean false as nil and false, nothing else)
<canton7> *are
<canton7> newbold, http://datamapper.org/
dv310p3r [dv310p3r!~dv310p3r@nmd.sbx11041.miamifl.wayport.net] has joined #ruby
<canton7> same goes for line 41
<newbold> wow, what's the datamapper thing?
kakaskin [kakaskin!~CLDG@178.120.109.192] has joined #ruby
<canton7> an orm -- databases wrapped in classes, basically
<canton7> *tables wrapped in classes
<newbold> haha, awesome!
<newbold> where does the data actually live?
<canton7> in a database of your choice. Heroku seem to use postgres
<newbold> it took me a long, long time to get comfortable with MySQL after years of PHP use
<newbold> I've always kinda had a weird thing about databases
<newbold> guess I need to get over that :P
<canton7> yeah, you'll learn to love them
voodoofish430 [voodoofish430!~mtorres@il-la.la.idealab.com] has joined #ruby
Telmo [Telmo!~telmo@c-68-44-135-81.hsd1.pa.comcast.net] has joined #ruby
<newbold> canton7: I've also been doing OK with git so far
<newbold> only thing I haven't worked out yet is how to pull stuff from the server down and replace my local repo with that
<canton7> which server?
<newbold> from heroku to my laptop
<canton7> don't know that you can
<newbold> I guess most people would never do that
<newbold> hehe
<canton7> just push to a git repo somewhere
<canton7> like github
<canton7> or bitbucket, if you need a private repo
magic_pond_tree [magic_pond_tree!~magic_pon@CPE0023bee17c0e-CM0023bee17c0b.cpe.net.cable.rogers.com] has joined #ruby
chessguy [chessguy!~chessguy@pool-74-96-83-16.washdc.fios.verizon.net] has joined #ruby
<RubyPanther> I just keep an extra VPS around that I can use for git, vpn, experiments, etc
<Boohbah> must be nice to have that kind of cash
<canton7> my linode sets me back
zulax [zulax!~radarwork@99-120-232-161.lightspeed.iplsin.sbcglobal.net] has joined #ruby
nowthatsamatt [nowthatsamatt!~nowthatsa@rrcs-71-43-23-18.se.biz.rr.com] has quit [#ruby]
<newbold> yeah linode is nice, and very inexpensive
thecreators [thecreators!~rskagy@cpe-65-27-201-150.cinci.res.rr.com] has joined #ruby
notbrent [notbrent!u5121@gateway/web/irccloud.com/x-ynatvvvhnudgevye] has joined #ruby
jergason [jergason!~jergason@c-67-182-209-164.hsd1.ut.comcast.net] has joined #ruby
jbpros [jbpros!~jbpros@82-186-112-217.dyn.adsl.belcenter.be] has joined #ruby
wmoxam [wmoxam!~wmoxam@184.175.15.252] has joined #ruby
wmoxam [wmoxam!~wmoxam@pdpc/supporter/active/wmoxam] has joined #ruby
zalesz [zalesz!~zalesz@user-46-113-163-238.play-internet.pl] has joined #ruby
beakerman [beakerman!~beakerman@c-76-118-172-173.hsd1.nh.comcast.net] has joined #ruby
bier [bier!~bier@p579990C6.dip.t-dialin.net] has joined #ruby
iocor [iocor!~textual@unaffiliated/iocor] has joined #ruby
zastaph [zastaph!zastaph@unaffiliated/zastaph] has joined #ruby
freelanceful [freelanceful!~jamesfend@c-71-228-225-167.hsd1.tn.comcast.net] has joined #ruby
techhelp [techhelp!~Dan@ip70-162-10-229.ph.ph.cox.net] has joined #ruby
tatsuya_o [tatsuya_o!~tatsuya_o@46-64-51-175.zone15.bethere.co.uk] has joined #ruby
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby
rex_ [rex_!~rex@c-24-10-196-81.hsd1.ut.comcast.net] has joined #ruby
rexbutler_ [rexbutler_!~rex@c-24-10-196-81.hsd1.ut.comcast.net] has joined #ruby
rexbutler_ [rexbutler_!~rex@c-24-10-196-81.hsd1.ut.comcast.net] has joined #ruby
rexbutler [rexbutler!~rex@c-24-10-196-81.hsd1.ut.comcast.net] has joined #ruby
spectre^ [spectre^!~spectre@sticky.clownjuice.com] has joined #ruby
<rexbutler> So, suppose I wanted to do a map, but on a 2 dimensional array. Is there a faster way than a nested double map?
<rexbutler> IE, if I wanted to add 2 to every element of a two (or three, etc...) dimensional array of numbers
shadoi [shadoi!~Adium@c-71-202-122-8.hsd1.ca.comcast.net] has joined #ruby
<Hanmac> rexbotler: like: map {|(a,b)| ... } ?
<banister`sleep> rexbutler: what does your array look like exactly and how do u want to increase the values in the array
automagic [automagic!~karol@213-238-68-166.adsl.inetia.pl] has joined #ruby
<rexbutler> I meant something like map! { |x| x.map! { |y| a[x][y] += 1 } }
<rexbutler> roughly :)
TomJ [TomJ!~TomJ@unaffiliated/tomj] has joined #ruby
<rexbutler> Well, let's just assume I want to increment every element in a two dimensional array
<rexbutler> I'm applying a different function, but that's irreleveant
<rexbutler> It's an 8by8 array (chess related)
<rexbutler> I'm translating an 8by8 array of piece codes into and 8by8 array of file paths
<rexbutler> But like I said, I just am wondering about the pattern/"right way" to do it, so let's just assume I'm incrementing every element of a 2 or 3 dimensional array...
<banister`sleep> no
pabloh [pabloh!~pablo@186.22.82.39] has joined #ruby
<banister`sleep> rexbutler: the second one is incremented :) i gisted teh wrong thing
<rexbutler> Yeah, that's the way I'm doing it now
<rexbutler> a double map
Synthead [Synthead!~max@c-71-204-121-215.hsd1.ga.comcast.net] has joined #ruby
<banister`sleep> rexbutler: well your code was a bit different
<banister`sleep> oh your using the value as an index
<banister`sleep> you're*
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby
<rexbutler> Okay, so here's a (tough?) question everyone
<banister`sleep> rexbutler: well there's no way to avoid a double map
<banister`sleep> afaik
<rexbutler> suppose you have a (non-jagged) array of of arbitrary but reasonable dimension, say dim < 10, and you want to increment every number in it
<rexbutler> what would be the best approach? With arbitrary dimension, you can't use multiple maps, you have to be clever. Maybe make an array all the indexes?
<canton7> recursion! Possibly... or a stack
<rexbutler> right now I'm looking at 'product' in the array class
<rexbutler> recursion would work
thecreators [thecreators!~rskagy@cpe-65-27-201-150.cinci.res.rr.com] has joined #ruby
leanother [leanother!~leanother@190.80.179.159] has joined #ruby
<rexbutler> Okay, another question:
<rexbutler> Can I do my_array.include?(nil)
<rexbutler> It's confusing because my_array[out_of_bounds] = nil
dwon [dwon!~dwon@75-119-251-37.dsl.teksavvy.com] has joined #ruby
<rexbutler> I just want to get if an element in the array's bounds is nil, but I'm worried about nil behavior re arrays
<gioele> rexbutler: yes, you can .include?(nil)
<gioele> (and you could have tested easily with irb)
<rexbutler> Yeah, I need to try things out with irb more often, thanks for the reminder :)
x77686d [x77686d!~whm@h-67-101-188-178.phndaz91.static.covad.net] has joined #ruby
S2kx [S2kx!~S1kx@ip-95-223-80-198.unitymediagroup.de] has joined #ruby
adeponte [adeponte!~adeponte@pool-173-51-131-197.lsanca.fios.verizon.net] has joined #ruby
savage- [savage-!~savage@c-67-180-11-89.hsd1.ca.comcast.net] has joined #ruby
gen0cide_ [gen0cide_!~Security@Wilkins3.static.monkeybrains.net] has joined #ruby
sterNiX [sterNiX!~LessIsMor@unaffiliated/nu253r/x-0655220] has joined #ruby
diago1 [diago1!~heath@wsip-98-174-211-206.hr.hr.cox.net] has joined #ruby
stringoO [stringoO!~JLstring@bas1-toronto42-1279598654.dsl.bell.ca] has joined #ruby
looopy [looopy!~looopy@c-68-34-92-100.hsd1.md.comcast.net] has joined #ruby
senthil [senthil!~senthil@99-51-1-6.lightspeed.snjsca.sbcglobal.net] has joined #ruby
bier [bier!~bier@p579990C6.dip.t-dialin.net] has joined #ruby
t0mmyvyo [t0mmyvyo!~tommyvyo@c-68-83-3-164.hsd1.nj.comcast.net] has joined #ruby
Proshot [Proshot!~CoreD@546A56AA.cm-12-3b.dynamic.ziggo.nl] has joined #ruby
bier [bier!~bier@p579990C6.dip.t-dialin.net] has joined #ruby
BrianE [BrianE!~brian@87.112.149.96] has joined #ruby
leanother [leanother!~leanother@190.80.179.159] has quit [#ruby]
bier [bier!~bier@p579990C6.dip.t-dialin.net] has joined #ruby
burgestrand [burgestrand!~burgestra@h-45-63.a155.priv.bahnhof.se] has joined #ruby
iocor [iocor!~textual@unaffiliated/iocor] has joined #ruby
mengu [mengu!~mengu@unaffiliated/mengu] has joined #ruby
<senthil> Does fb send access_token in json format? I tried setting header: 'Accept' => 'application/json', but I just get a body 'access_token=blaaaa'.
<senthil> I tried asking in #facebook and got no response, so trying here.
jergason [jergason!~jergason@c-67-182-209-164.hsd1.ut.comcast.net] has joined #ruby
ePirat [ePirat!~ePirat@unaffiliated/epirat] has joined #ruby
workmad3 [workmad3!~workmad3@cpc1-bagu10-2-0-cust81.1-3.cable.virginmedia.com] has joined #ruby
<rexbutler> senthil: You might have to camp around here for a while to get an answer
<rexbutler> senthil: Have you trying asking in javascript channels?
Chaazd [Chaazd!~tdervan@cpc19-nmal17-2-0-cust305.croy.cable.virginmedia.com] has joined #ruby
<senthil> rexbutler: It wasn't js related, so I didn't bother.
Chaazd [Chaazd!~tdervan@cpc19-nmal17-2-0-cust305.croy.cable.virginmedia.com] has quit [#ruby]
<rexbutler> senthil: I meant because JSON is javascript related, so ...
idarkside [idarkside!~YourNick@5e0e912d.bb.sky.com] has joined #ruby
<rexbutler> IE javascript object notation... if someone does javascript facebook programming they may know over there
fayimora [fayimora!~fayimora@109.175.187.141] has joined #ruby
robotmay [robotmay!~robotmay@5ad8f1da.bb.sky.com] has joined #ruby
sterNiX [sterNiX!~LessIsMor@unaffiliated/nu253r/x-0655220] has joined #ruby
nd_______ [nd_______!~nd@mnhm-4d01ac4c.pool.mediaWays.net] has joined #ruby
ryanf [ryanf!~rfitz@adsl-69-111-192-194.dsl.snfc21.sbcglobal.net] has joined #ruby
frerich [frerich!~frerich@mail.froglogic.com] has joined #ruby
frerich [frerich!~frerich@kde/raabe] has joined #ruby
justfielding [justfielding!~justfield@ip70-178-131-208.ks.ks.cox.net] has joined #ruby
<senthil> rexbutler: Doing that now. Much more livelier than here.
dorzey [dorzey!~dorzey@host-78-148-140-110.as13285.net] has joined #ruby
stephenjudkins [stephenjudkins!~stephen@c-76-115-1-70.hsd1.or.comcast.net] has joined #ruby
idarkside [idarkside!~YourNick@5e0e912d.bb.sky.com] has joined #ruby
fayimora_ [fayimora_!~fayimora@95.175.159.58] has joined #ruby
emmanuelux [emmanuelux!~emmanuel@2a01:e35:2e4d:9010:21d:60ff:fe0e:b818] has joined #ruby