apeiros_ changed the topic of #ruby to: programming language || ruby-lang.org || Paste >3 lines of text in http://pastie.org || Rails is in #rubyonrails
jergason has joined #ruby
<Tecan> i need help my brain is messed up trying to figure out ruby
thespock has joined #ruby
<niklasb> Tecan: speak
<fowl_> sorry everybody's out getting smoothies
thespock has joined #ruby
<Tecan> i need help with this https://github.com/joshbuddy/graster it converts images to gcode but its only making doing a pass of light backwards rather than forwards and backwards
<Tecan> i will try to narrow my question down
<Tecan> moments plz
<banisterfiend> Tecan: your question is ungrammatical
michaelb1rton has joined #ruby
<niklasb> note the lack of a question mark
<fowl_> the repos you linked to hadnt been updated in 2 yrs
<fowl_> so try that one
<Tecan> yes same problem
fbernier has joined #ruby
thespock has quit [#ruby]
io_syl has joined #ruby
<Tecan> in the gmask file it spits out there should be some 0 1 1 lines meaning go forward and burn at same time
<fowl_> dunno what any of that magic is, sry
* Sepp-O-mat spits out too, if he inhales pure alcohole in his gasmask+
Jelco has joined #ruby
sarmiena_ has joined #ruby
akem has joined #ruby
thespock has joined #ruby
jameshyde has joined #ruby
michaelbarton has joined #ruby
michaelbarton has joined #ruby
thespock has joined #ruby
thespock has joined #ruby
michaelbarton has joined #ruby
scwh has joined #ruby
michaelbarton has joined #ruby
renato has joined #ruby
TheIronWolf has joined #ruby
<Tecan> forward = @tiled_rows[spans][0][0] < spans[-1][1]
<Tecan> theres a bug in this line
michaelbarton has quit [#ruby]
shevy has joined #ruby
<Tecan> i'll get it bbl
twinturbo has joined #ruby
sbanwart has joined #ruby
vitor-br has joined #ruby
chad_ has joined #ruby
sbanwart_ has joined #ruby
Tecan has quit ["live long and phosphor"]
mborromeo has joined #ruby
Clordio has joined #ruby
fforbeck has joined #ruby
jetblack has joined #ruby
Tearan has joined #ruby
Sgeo_ has joined #ruby
h4mz1d has joined #ruby
KindOne has quit [#ruby]
mborromeo has joined #ruby
ryan_dev70 has joined #ruby
two- has joined #ruby
dkissell has joined #ruby
voodoofish has joined #ruby
flagg0204 has joined #ruby
renato has quit [#ruby]
chad_ has joined #ruby
vikingly has joined #ruby
mikepack has joined #ruby
quest88 has joined #ruby
jmcphers has joined #ruby
voodoofish has joined #ruby
Divinite has joined #ruby
<vikingly> Hi! I am getting time back in Java format, and need to parse it in Ruby. Any suggestions? This is the format: http://joda-time.sourceforge.net/apidocs/org/joda/time/format/ISODateTimeFormat.html#time()
ryanf has joined #ruby
<vikingly> (strictly speaking it's some ISO format)
nu7hatch has quit [#ruby]
TheIronWolf has joined #ruby
tobym has joined #ruby
sent-hil has joined #ruby
redgetan has joined #ruby
jmcphers has joined #ruby
tomzx has joined #ruby
<redgetan> I noticed some people using "Array(an_existing_array)" . What is that for? why not just use the existing array directly
<heftig> redgetan: wraps the object in an array, if it's not already an array
yekta has joined #ruby
<redgetan> ic
<sent-hil> redgetan: could be that "an_existing_array" might be non-array in some cases
nari_ has joined #ruby
fforbeck has joined #ruby
SeySayux has joined #ruby
shtirlic_ has joined #ruby
<fowl_> [*array] is much more good than Array()
TheIronW_ has joined #ruby
statarb3 has joined #ruby
ScottNYC has joined #ruby
sbanwart has joined #ruby
jarred has joined #ruby
jmcphers has joined #ruby
sroy2_ has joined #ruby
seanstickle has joined #ruby
<sent-hil> fowl_: why
iamjarvo has joined #ruby
max_ has joined #ruby
abra has joined #ruby
<redgetan> fowl_ i'd like to know why as well
Synthead has joined #ruby
<davidcelis> seriously?
<davidcelis> because the splat operator is fucking awesome, that's why?
<davidcelis> SPLAT
dbgster has joined #ruby
<fowl_> because Array() looks like python
<fowl_> [*get with it folks]
looopy has joined #ruby
<sent-hil> arr = [1,2]; [*arr] #=> [1,2]; [arr] #=> [[1,2]]
<sent-hil> Array(arr) #=> [1,2]
<sent-hil> as far as I can tell both are the same
<kish> length(@a); # => 1, not as expected
<kish> scalar(@a); # => 3, it's the Perl way to get array size
<kish> damn, what's this crap
<kish> i thought stuff that went after # were comments
<kish> now i see it used everywhere
<davidcelis> They are comments.
<davidcelis> When you see # => ..., that just means "This line or block returns thist" as a comment
<fowl_> or "thusly such a thing was retrieved from such a line", if you think in a weird medieval diction
<davidcelis> verily
jfelchner has joined #ruby
<fowl_> that perl example is pretty stupid tho
banisterfiend has joined #ruby
Ontolog has joined #ruby
mbreedlove has joined #ruby
mborromeo has joined #ruby
Zac_o_O has joined #ruby
iamjarvo has joined #ruby
noyb has joined #ruby
thecreators has joined #ruby
chimkan_ has joined #ruby
joaoh82 has joined #ruby
jimmybaker has joined #ruby
sent-hil has joined #ruby
VxJasonxV has joined #ruby
tatsuya_o has joined #ruby
Chryson has joined #ruby
tatsuya_o has joined #ruby
tatsuya__ has joined #ruby
tatsuya_o has joined #ruby
tatsuya__ has joined #ruby
brianstorti has joined #ruby
d2dchat has joined #ruby
rdegraci_ has joined #ruby
tatsuya_o has joined #ruby
Asebolka has joined #ruby
richardlxc has joined #ruby
richardlxc has joined #ruby
voodoofish has joined #ruby
dfamorato has joined #ruby
cloke has joined #ruby
dfamorato_ has joined #ruby
elalande has joined #ruby
pubis has joined #ruby
tatsuya_o has joined #ruby
x010100x has joined #ruby
mhy_ has joined #ruby
eko has joined #ruby
sent-hil has joined #ruby
eko has joined #ruby
pen has joined #ruby
sent-hil has joined #ruby
brian- has joined #ruby
snip_it has joined #ruby
dql has joined #ruby
iamjarvo has joined #ruby
werdnativ has joined #ruby
srnty has joined #ruby
rking_ has joined #ruby
rking_ has quit [#ruby]
TTilus has joined #ruby
Cache_Money has joined #ruby
mdw has joined #ruby
rippa has joined #ruby
<chovy> i have a csv file w/ two columns: domain, email. I want to remove all duplicate lines based on 'email' column.
mdw has joined #ruby
abstrusenick has joined #ruby
starburst has joined #ruby
phipes has joined #ruby
lkba has joined #ruby
<luckyruby> there's a bunch of ppl in #eventmachine but no one talks it seems.
otters has joined #ruby
<banisterfiend> luckyruby: probably all reading the celluloid docs
<banisterfiend> :P
<luckyruby> lol
<luckyruby> trying to rewrite my em app using celluloid::io but got stuck needing something like BufferedTokenizer, which also happens to be written by tarcieri
<luckyruby> i'm genuinely excited for the future of ruby. celluloid and jruby 1.7
chimkan_ has joined #ruby
tk___ has joined #ruby
CheeToS has joined #ruby
Shaded has joined #ruby
warebec|hat has joined #ruby
yekta has joined #ruby
Bosma has joined #ruby
mikeric has joined #ruby
rking_ has joined #ruby
brianpWins has joined #ruby
pjn_oz has joined #ruby
ZachBeta has joined #ruby
lewis has joined #ruby
<lewis> hi
ScottNYC has joined #ruby
shadoi has joined #ruby
Hsparks has joined #ruby
wmoxam has joined #ruby
akemrir has joined #ruby
n1x has joined #ruby
nilg` has joined #ruby
pen has joined #ruby
alexh_ has joined #ruby
alexh_ has quit [#ruby]
thecreators has joined #ruby
alem0lars has joined #ruby
moshee has joined #ruby
h4mz1d has joined #ruby
tewecske has joined #ruby
becom33 has joined #ruby
paradisaeidae has joined #ruby
<becom33> what I function can use to get the path of the file . for a example I have a "require_relative '../../core/namelist' " help ?
<becom33> I wanna get rid of the ../../
mikeric has joined #ruby
<TTilus> becom33: file has expand path oe realpath or something alike
<TTilus> becom33: in some cases __FILE__ might be usefull
<becom33> TTilus: if you dont mind givve a example ? are you saying like require_relative __FILE__'core/namelist' ?
cha1tanya has joined #ruby
<TTilus> no
<TTilus> more like
x0F_ has joined #ruby
<TTilus> $: << File.expand_path(File.dirname(__FILE__)+'/core')
<TTilus> require 'namelist'
<TTilus> sorry about the lack of speed
<becom33> if I have like 5 or 6 requires and each deffent paths :/ what can I do ?
frogstarr78 has joined #ruby
<TTilus> im on cell, woke up like 5 mins ago and still in bed =D
<TTilus> add their common root to loadpath and require respective to that
<becom33> aww oki
<becom33> aaa oki
<TTilus> $: is loadpath
schovi has joined #ruby
<TTilus> you DO have a common ancestor path for them?
<chovy> anyone know how to dedup a csv file?
<TTilus> dedup?
<chovy> i have a csv file. I want to remove duplicate rows based on a column
<chovy> ie: the same value appears in col2, then remove it.
<chovy> remove the whole row i mean.
Advocation has joined #ruby
quest88 has joined #ruby
<TTilus> require 'csv'
<TTilus> then read the fine manual
<TTilus> then iterate infile and write outfile
<chovy> k
<TTilus> collect values from col2 to hash and check using that if youve seen the value before
Paradox2000 has joined #ruby
<TTilus> ..and i rly hope it wasnt a school assignment
jarred has joined #ruby
thecreators has joined #ruby
sluggy has joined #ruby
jfelchner has joined #ruby
richardlxc has joined #ruby
richardlxc has joined #ruby
deobald has joined #ruby
richardlxc has joined #ruby
richardlxc has joined #ruby
Advocation has joined #ruby
zachrose\ has joined #ruby
nari_ has joined #ruby
<zachrose\> Can anyone help me understand writing bytes to an IO object? (Trying to talk to a reciept printer with ruby-serialport.)
fivetwentysix has joined #ruby
<zachrose\> These are the printer docs: http://www.sparkfun.com/datasheets/Components/General/Driver%20board.pdf. They say writing "1B 76 n" (in hex) will send a status command.
<zachrose\> I'm confused about representing bytes in code... serialport.write("\x1B\x76\xn") ?
yxhuvud has joined #ruby
Advocation_ has joined #ruby
fivetwentysix_ has joined #ruby
sent-hil has joined #ruby
cha1tanya has joined #ruby
wilmoore has joined #ruby
sent-hil_ has joined #ruby
iocor has joined #ruby
sent-hil has joined #ruby
cha1tanya has joined #ruby
pen has joined #ruby
deobald has joined #ruby
savr has joined #ruby
<savr> hi
<savr> I am working on a ruby app
<savr> my local ruby version is 1.9.3p0
<savr> my server is the latest 1.9.3 version
<savr> would this cause any conflicts?
shruggar has joined #ruby
<shadoi> no
qos has joined #ruby
nemesit has joined #ruby
qos_ has joined #ruby
<savr> thanks
frogstarr78 has joined #ruby
Advocation has joined #ruby
Eldariof-ru has joined #ruby
ryanf has joined #ruby
GoogleGuy_ has joined #ruby
LMolr has joined #ruby
tatsuya_o has joined #ruby
Eldariof-ru has joined #ruby
Advocation has joined #ruby
denysonique has joined #ruby
batmanian has joined #ruby
A1241 has joined #ruby
A1241 has quit [#ruby]
<savr> thanks
savr has quit ["Ex-Chat"]
dwon has joined #ruby
sako has joined #ruby
charnel has joined #ruby
beilabs has joined #ruby
parus has joined #ruby
ph^ has joined #ruby
telling has joined #ruby
telling has joined #ruby
francisfish has joined #ruby
pen has joined #ruby
blischalk has joined #ruby
Zolrath has joined #ruby
Zelest has joined #ruby
ephemerian has joined #ruby
davidcelis has joined #ruby
<Zelest> how can i loop through an array and yet know which iteration I'm on? as in, how can I use array.each do |foo| ... end and know when I'm at the final iteration of the loop?
mikeric has joined #ruby
<davidcelis> Zelest: Try .each_with_index
<Zelest> aah, thanks
<Zelest> i know i can do this with a regular for, but that doesn't look ruby-ish enough ;-)
<davidcelis> yeah don't use for loops ;)
moshee has joined #ruby
moshee has joined #ruby
freeayu has joined #ruby
iocor has joined #ruby
cableray has joined #ruby
ukwiz has joined #ruby
n1x has joined #ruby
adac has joined #ruby
joaoh82 has joined #ruby
blacktulip has joined #ruby
moshee has joined #ruby
moshee has joined #ruby
Vert has joined #ruby
alem0lars_ has joined #ruby
pcboy_ has joined #ruby
araujo has joined #ruby
araujo has joined #ruby
dql has joined #ruby
kevinykchan has joined #ruby
<canton7> Cache_Money, you didn't read the spec properly ;)
bier|tp has joined #ruby
bier has joined #ruby
kidoz has joined #ruby
nemesit has joined #ruby
tijmencc has joined #ruby
iaj has joined #ruby
Divinite has joined #ruby
d34th4ck3r has joined #ruby
A124 has joined #ruby
schovi has joined #ruby
rippa has joined #ruby
Morkel has joined #ruby
iocor has joined #ruby
KL-7 has joined #ruby
forcar455 has joined #ruby
forcar455 has quit [#ruby]
Shaded has joined #ruby
Vert has joined #ruby
Russell^^ has joined #ruby
netogallo has joined #ruby
workmad3 has joined #ruby
greenarrow has joined #ruby
manizzle has joined #ruby
mengu has joined #ruby
twinturbo has joined #ruby
lewis1711 has joined #ruby
ken_barber has joined #ruby
agilobable_ has joined #ruby
d34th4ck3r has joined #ruby
banisterfiend has joined #ruby
giftfrosch has joined #ruby
banisterfiend has joined #ruby
giftfrosch has joined #ruby
luke--_ has joined #ruby
giftfrosch has joined #ruby
apeiros_ has joined #ruby
ChampS666 has joined #ruby
tobago has joined #ruby
mdw has joined #ruby
davidcelis has joined #ruby
<shevy> for loops look terribly ugly
Zoxc has joined #ruby
pac1 has joined #ruby
<Zoxc> how to remove a trailing null terminator?
<lewis1711> given a class C, how can I see what methods an instance of that class would respond to? C.methods of course returns what the class Object of responds to.
<xea> i usually use c.methods - Object.methods
<Mon_Ouie> Or c.instance_methods
<lewis1711> ok, then something is wrong as I am getting an empty array
<Mon_Ouie> c.instance_methods(false) to restrict to whatever is defined only by this class
<shevy> Zoxc what the fuck is a trailing null?
<Zoxc> "a\x00"
<fowl_> string#strip
<lewis1711> ahh, I had a module and class of the same name..
<Mon_Ouie> Zoxc: chomp("\0")
<shevy> if you just want to kill the last char, you can use .chop!. x = "foobar0"; x.chop!
<shevy> # => "foobar"
<shevy> yeah .chop works here too
<shevy> "a\x00".chop # => "a"
<apeiros_> shevy.chop!
ephemerian has joined #ruby
<Zoxc> can't get that to work though
<shevy> hmm
<shevy> x[-1,1] = ''
<shevy> should work too
<apeiros_> "can't get that to work" is a useless problem description
<Mon_Ouie> How exactly does it not work? Notice chomp will only remove the last "\0"
<Zoxc> It was a description of the solution
<shevy> of the solution?
<fowl_> lolz
<fowl_> string#strip
<shevy> did you try x[-1,1] = '' yet
<fowl_> and forget about it
twinturbo has joined #ruby
soveran has joined #ruby
<Zoxc> I
<Zoxc> I'm not looking to remove whitespace, just a trailing null =P
<apeiros_> Zoxc: Mon_Ouie already told you how to use chomp.
<apeiros_> so if you "can't get that to work", show what you did and how you figured that it "didn't work"
<fowl_> [1] pry(main)> "omg all this whitespace\x00\x00\x00".strip => "omg all this whitespace"
<shevy> lol
<apeiros_> fowl_: strip a) removes from the beginning too and b) also removes other whitespace, not just \0
<fowl_> you dont want trailing whitespace either, i'm reading your thoughts
<Zoxc> what I did was use ' instead of " :D
<fowl_> apeiros_, im declaring a war on whitespace here, it would be great to have your support
LMolr has joined #ruby
<shevy> yeah apeiros_ where is the support!!!
<apeiros_> fowl_: I'm sorry, but I'm madly in love with whitespace
<shevy> ok we can plenk !
<apeiros_> rofl
<Zoxc> can you have literals with specific encodings?
<apeiros_> shevy: you're a horrible, horrible person :D
<fowl_> ?f.force_encoding
<fowl_> lul
<shevy> apeiros_ I know but I try to die as a good man, so one day I have to work better
<fowl_> thatll get old quick
Mchl has joined #ruby
moshee has joined #ruby
moshee has joined #ruby
giftfrosch has joined #ruby
cha1tanya has joined #ruby
<Zelest> why does .split("\n") ignore multiple returns at the end of a string, but not in the beginning of it? e.g: lines = "\n\nfoo\nbar\n\n\n".split("\n"); p lines .. returns ["", "", "foo", "bar"]
umren has joined #ruby
<apeiros_> Zelest: it's oddly designed
<apeiros_> Zelest: you can remove that by using -1 as last param: .split("\n", -1)
umren has quit ["Linkinus - http://linkinus.com"]
<apeiros_> (fun fact, split is one of the most special cased core methods, it has something like 14 special cases - horrible IMO :-S)
<fowl_> because ruby is written by people from the east with names like "Kimosabi" and "Mr. Miyagi"
<fowl_> lol
iocor has joined #ruby
<canton7> apeiros_, ooh, any chance you could add freenode staff to the mods for this channel? We had some godaweful spammer yesterday and there were no mods around
<apeiros_> canton7: sadly I can't
<apeiros_> I only have ops here, nothing else :(
<canton7> ah so you do, my bad
<Zelest> wow
<Zelest> apeiros_, thanks :D
<apeiros_> canton7: feel free to harass fflush about giving me more privileges, though :-p
DMKE has joined #ruby
alem0lars has joined #ruby
<alem0lars> hi
d34th4ck3r has joined #ruby
<canton7> apeiros_, he's on my notify list... I will if he ever comes online :P
alem0lars has quit [#ruby]
sarmiena_ has joined #ruby
ken_barber has joined #ruby
adac has joined #ruby
<apeiros_> canton7: :D
<apeiros_> maybe I should get a couple of people to do that…
sbanwart has joined #ruby
<apeiros_> fflush is only online about once every 3 or 4 months… it's a shame really
krebipeti has joined #ruby
<krebipeti> hi
<krebipeti> any body home>
<krebipeti> ?
alem0lars has joined #ruby
Divinite has joined #ruby
Divinite has joined #ruby
<canton7> krebipeti, ask your question, and whoever's watching/knows the answer will respond
<krebipeti> btw i try : gem install bundler and it stuck. after i put -V it stuck here : GET http://rubygems.org/quick/Marshal.4.8/bundler-1.1.3.gemspec.rz 302 Moved Temporarily
<krebipeti> i try to put it in my webrowser...and connection timeout accessing http://cachefly.mirrors.rubygems.org/quick/Marshal.4.8/bundler-1.1.3.gemspec.rz
workmad3 has joined #ruby
<krebipeti> is there something wrong in my side or the cachefly.mirrors.rubygems.org is down???
<canton7> seems to be working fine for me. Looks like that mirror is down, and rubygems is still directing you to it
eka has joined #ruby
alem0lars has joined #ruby
<krebipeti> is there a way to work out on it??
<krebipeti> or wait till it is up again
<krebipeti> can it be redirected to the other mirror, i mean is there a comand to do that?
dql has joined #ruby
Shoobdidoo has joined #ruby
Guedes has joined #ruby
pencilcheck has joined #ruby
Eldariof-ru has joined #ruby
Shoobdidoo has joined #ruby
xcvd has joined #ruby
kidoz has joined #ruby
jbw has joined #ruby
niku4i_ has joined #ruby
mcwise has joined #ruby
<shevy> linux is a hack built on top of a hack that was built on another hack
netogallo has joined #ruby
<Mekkis> shevy, most OSes are...
<shevy> Mekkis yeah
<shevy> :(
<Mekkis> some have marketing added!
<shevy> yeah but that is another hack
<shevy> a hack that tries to disguise that there were other hacks before
iocor has joined #ruby
<shevy> I am going to blame the design of unix on C
<affix> shevy: C was designed for unix
<shevy> it spread like a virus
<affix> C is a nice simple language
<shevy> and what is a complicated language?
Poapfel has joined #ruby
<affix> shevy: Assembler for one
Divinite has joined #ruby
tijmencc has joined #ruby
tijmencc has quit [#ruby]
ken_barber1 has joined #ruby
tayy has joined #ruby
<fowl_> shevy, what used to anger you before computers existed?
rdegraci_ has joined #ruby
Nss has joined #ruby
twinturbo has joined #ruby
davorb has joined #ruby
dibri has joined #ruby
pencilcheck has joined #ruby
hirotoshi has joined #ruby
fowl__ has joined #ruby
Ghostman has joined #ruby
niklasb has joined #ruby
jetblack_ has joined #ruby
hirotoshi has joined #ruby
BeLucid_ has joined #ruby
scalebyte has joined #ruby
JodaZ has joined #ruby
epitron__ has joined #ruby
pzol_ has joined #ruby
mfridh_ has joined #ruby
pietr0_ has joined #ruby
andynu_ has joined #ruby
Targen_ has joined #ruby
kaneda__ has joined #ruby
falena has joined #ruby
wataken44_ has joined #ruby
d_roge has joined #ruby
nuba_ has joined #ruby
<shevy> fowl_ hmm not much actually
cjs226_ has joined #ruby
ChloeD has joined #ruby
jshsu_1 has joined #ruby
UdontKnow has joined #ruby
jsaak_ has joined #ruby
<shevy> sometimes larger and stronger kids who beat me
icyfenix_ has joined #ruby
<banisterfiend> fowl_: the last time he got angry the holocaust happened
dmn001_ has joined #ruby
<fowl__> lol..
<shevy> wow I am already that old?
bubuz has joined #ruby
<shevy> I may be immortal and not know it yet
gurugeek_ has joined #ruby
<gurugeek_> hello I am porting an app to 1.9 ..googled this already but don't understand fully what I neeed to change. Now I get this error on 1.9 undefined method `to_report' for #<Array:…..
<niklasb> gurugeek_: that's surely no built-in
<shevy> use 1.8.7
<gurugeek_> lol I am porting this to 1.9
<shevy> :(
<gurugeek_> it is build in
<shevy> when why does it not work ;)
<apeiros_> no, Array#to_report was not a method of 1.8
<apeiros_> something adds that method
<niklasb> gurugeek_: maybe you are talking about some framework here
<gurugeek_> shevy: how about skipping something if you don't own the answer ?
<gurugeek_> nikslab: no is a ruby database not a framework. I have a method to_report to show an array of data as a report
Yugo has joined #ruby
<shevy> gurugeek_ if #to_report does not work your statement that it is built in is wrong
<gurugeek_> shevy: mind getting a clue before answering ? you don't know what you are talking about clearly. Your first suggestion use 1.8 when I said I am porting an app to work on 1.9 shows how knowledgable you are
hasorli has joined #ruby
<shevy> :(
<fowl__> burned
<shevy> I think he hates me now
<fowl__> incineration!
<shevy> curious that he thinks to_report works for him in 1.8 but not in 1.9
<niklasb> gurugeek_: your rudeness will not get you anywhere.
workmad3_ has joined #ruby
<gurugeek_> shevy: read http://boga.wordpress.com/2008/04/15/ruby-19-porting-notes/ then you know why it doesn't work
jeekl_ has joined #ruby
<niklasb> gurugeek_: you seem to know why it doesn't work. tell us
<shevy> gurugeek_ ok where?
<fowl__> yeah gurugeek_ maybe if you spent more time googling and less time crying you'd get some work done, haha!
gmci has joined #ruby
ged has joined #ruby
<gurugeek_> I did google it, proof the link
Gm4n has joined #ruby
<shevy> gurugeek_ I look at that page, I don't see a to_report there. also, do you need a webpage to write ruby code?
<shevy> lol
<gurugeek_> shevy: LOL this is valid for all methods to_report is just what I have on my code
lindenle has joined #ruby
SPYGAME has joined #ruby
<shevy> ok show us your code man
<shevy> don't be shy
<shevy> use pastie.org
<gurugeek_> fowl__: yeah well I do google but usually people on IRC are useful :P
beilabs has joined #ruby
<gurugeek_> shevy: have you ported anything from 1.8 to 1.9 ?
<shevy> gurugeek_ why do you avoid showing your code? scared?
<shevy> chicken?
<niklasb> gurugeek_: man, if you'd have coded it properly from the beginning, you could make it run across versions. you obviously lack some basic knowledge here
<fowl__> i dont see to_report on that page, and i've never heard of it before
<fowl__> so im not sure what you're getting at by linking there
<gurugeek_> nikeslab: right so I should have predicted out 1.9 would require things? do you have any idea?
ryan_dev70 has joined #ruby
<shevy> hehehe
<niklasb> gurugeek_: it exists for some years now.
<gurugeek_> LOL okay I will wait someone that knows some ruby perhaps
<niklasb> gurugeek_: okay
<fowl__> troll ignord
<shevy> gurugeek_ real men don't need to hide their non-working, sloppy code. be a man, show us your non-working crap code please
<gurugeek_> I am no troll… I ask an information and the reply use 1.8 ? WTF is this for real ?
<niklasb> gurugeek_: no
<shevy> gurugeek_ I was wrong.
<fowl__> gurugeek_, its not what you ask its how you ask
FACEFOX has joined #ruby
<niklasb> gurugeek_: for what information did you ask? i must have missed that
<shevy> gurugeek_ Don't use ruby.
mkutub has joined #ruby
elalande has joined #ruby
<gurugeek_> shevy: you don't know the code and you judge it ? please move on you are clearly an idiot
<shevy> gurugeek_ I just want to see your non-working code man :(
<fowl__> tell him to go to #ruby-lang
<shevy> why don't you upload it
<gurugeek_> shevy: because you are a moron
<shevy> ok but this does not explain why you dont show every else here your code :>
<shevy> just upload it and you are done
<gurugeek_> shevy: you don't understand it anyway
<shevy> gurugeek_ could it be that you do not even HAVE any code?
td123 has joined #ruby
<niklasb> shevy: clearly he has some code that involves Array#to_report
<shevy> yeah but he will never show anyone else
<niklasb> or maybe he made that up as well
<shevy> hehe
<gurugeek_> shevy_ hey mr Moron I am porting an open source gem to help the community so please STFU with your idiocy about sloppy code and I got no code
<shevy> I think his nick indicates that... "guru"
<shevy> gurugeek_, how old are you? 12? 13?
<niklasb> gurugeek_: what open source?
<shevy> oh yes, what is the name of this gem?
<gurugeek_> shevy: google gurugeek and you see I am no 13
<niklasb> have to avoid it in the future
<shevy> no, I want the name of the gem please
<shevy> which gem are you porting
gmci has joined #ruby
<gurugeek_> shevy: you get nothing as you are an idiot
<shevy> ok can someone else ask him?
<fowl__> forget about it
<fowl__> why do you entertain fools
<fowl__> they'll just keep coming back
<niklasb> fowl__: agreed
<gurugeek_> exactly move on
<shevy> I like him.
<shevy> he is a young troll in training
<gurugeek_> I see you didn't google gurugeek ;)
<shevy> "I have to port an UNNAMED gem to 1.9.x with code I never WROTE nor does it even EXIST. Please help me."
<niklasb> gurugeek_: so obviously you are one lousy professor?
<gurugeek_> reply: why port use 1.8 gee
<shevy> "What, you do not write this non-existing code for me? You all suck!"
mkutub has quit [#ruby]
<shevy> come on gurugeek_ at least be honest
<niklasb> gurugeek_: can't possibly be that you don't understand what's going wrong here.
<gurugeek_> ignored so move on and attack someone else
<shevy> gurugeek_ why, I wanna help. Why do you not want any help now?
<shevy> Stop pouting man.
<gurugeek_> shevy: not from you thanks
<banisterfiend> gurugeek_: ugh, php ;)
<shevy> Ok but from niklasb right?
<shevy> He can help you if you give him more information.
LMolr has joined #ruby
<niklasb> it's okay if you ask questions, but your question wasn't answerable without more information. you failed to provide that information. instead you started insulting people.
<gurugeek_> I guess there is a reason why sites like stackoverflow get so popular nowadays...
<banisterfiend> gurugeek_: all yoru other qualifications are precisely cancelled by your association with PHP :)
<niklasb> gurugeek_: no, people like you get torn apart on SO as well.
<shevy> gurugeek_ come on, what is the name of the gem you wanna port
<fowl__> PHP is what you slip your girl so you can have some alone time with her
<gurugeek_> niklasb: I asked questions on stack and never got turned down as I show comprehensive information…I don't insult people unless they start giving me a lot of attitude which is unecessary..and clearly show they have zero clue
<niklasb> gurugeek_: okay, so do it the same way here.
abstrusenick has joined #ruby
<niklasb> provide us with a proper question, come on
miso_soup has joined #ruby
maasha has joined #ruby
<gurugeek_> so simply this is the method to report http://pastebin.com/k9p5wwsy which returns an error on 1.9 but works fine on 1.8 (erro on 1.9 undefined method `to_report' for #<Array:)
<maasha> Hi, I have a huge packed byte string that I want to unpack piece by piece. The template is "I2D", so how can I loop?
<canton7> gurugeek_, and are you re-opening the Array class? If you are, it's not in the pastie
<niklasb> gurugeek_: that should be a method of the Array class. if it is, you probably failed to require the containing file before using it
<fowl__> maasha, tons of ways, try something like (hugestring.size/4).times { |x| hugestring.read(4).unpack('I2D') }
<niklasb> and BTW, this shouldn't be tightly coupled with the Array class, because it's obviously not an array operation
<fowl__> depending on how much you wnt to read at a time
<gurugeek_> no I am not reopening it.
<canton7> gurugeek_, what are you calling which causes the error?
<niklasb> gurugeek_: so why would you expect it to be there?
<fowl__> maasha, well, hugestring would be a file handler in my example but i think its better to read it incrementally if you need to process it like that
<fowl__> unless of course im completely misunderstanding u
<gurugeek_> e.g. this to call the method
<gurugeek_> results = cars_tbl.select(:name,:year,:color,:recno).sort(+:color).to_report
akemrir has joined #ruby
<canton7> gurugeek_, and what data type is cars_tbl? An Array?
<niklasb> gurugeek_: this can't possibly work if `to_report` is not a method of the Array class
<gurugeek_> canton7: yes
<fowl__> obviously sort is returning an array
<banisterfiend> gurugeek_: lol is this you: http://vimeo.com/39179342
<fowl__> -_-
<gurugeek_> canton7: works fine if you remove the .to_report shows an array but unformatted
<gurugeek_> what to_report does is mostly formatting
adac has joined #ruby
<niklasb> gurugeek_: pack the method inside a separate module
<niklasb> module Reporter; def format_array(ary) ... ; end; end
akemrir has joined #ruby
<canton7> gurugeek_, OK, so you're starting with an array, calling two methods on it (select and sort) which both return arrays, then calling to_report on the resulting array
akemrir has quit [#ruby]
<gurugeek_> canton7: right
<canton7> gurugeek_, you never re-opened Array to add a to_report method (nor would I recommend doing this)
fivetwentysix has joined #ruby
<gurugeek_> niklasb: I am porting a gem I can't break compatibility etc.
<niklasb> gurugeek_: so make it part of the Array class.
<fowl__> lol
<fowl__> ruby lets you monkey patch but everybody bitches if you do it, wut?
<canton7> gurugeek_, are you 100% sure cars_tbl is an array? cars_tbl.class
<niklasb> and if the method is only called internally, you wouldn't break compatibility by moving it around.
<maasha> fowl__: well, you cant read from a string?
<niklasb> I'd personally be very annoyed if gems would monkey-patch my core classes
<canton7> fowl__, good for applications, not so good for libraries :P I hear there's namespaced monkey-patching in the works, but last I heard was a while back
ChampS666 has joined #ruby
<shevy> niklasb hey have we found out what gem he is trying to port?
<niklasb> canton7: man, that would be so necessary
<fowl__> maahes, not with #read but you could do it with [] ie string[current_pos, 4]
d34th4ck3r has joined #ruby
<niklasb> shevy: no, didn't look for it
<fowl__> canton7, i usually code to please myself or my employer and nobody else so i dont worry about it
gtuckerkellogg has joined #ruby
<canton7> shevy, KirbyBase by the looks of it
<shevy> canton7 namespaced monkey-patching would be really great
<gurugeek_> yes it is KirbyBase
<fowl__> kirbybase is cool
<fowl__> bout time someone ported it
<niklasb> lol
<gurugeek_> :) fowl__ yes all the rest is fixed just miss a couple of things..will get there soon
<niklasb> gurugeek_: so, problem solved?
<maasha> fowl__: ok. gotit.
mengu has joined #ruby
mengu has joined #ruby
<niklasb> "easy to distribute, since the entire DBMS is in one (approx. 100k) code file"
<canton7> gurugeek_, in which case, #to_report is a method of KBResultSet, not Array
<niklasb> canton7: probably that's why it didn't work.
<canton7> which means that cars_tbl is an instance of KBResultSet, not Array
<niklasb> maybe has switched from KBResultSet to array
<canton7> (which means you lied to me grr :))
dibri has joined #ruby
<shevy> lol
<canton7> yeah, looking at how KBResultSet implements select and sort
<niklasb> the error message supports this :)
<gurugeek_> yes well I meant the error was about the array and returns an array but yo uare right
<canton7> gurugeek_, next time make sure you understand the question :) OK, so KBResultSet implements both #select and #sort
<canton7> gurugeek_, so what's the output of 1. cars_tbh.class 2. cars_tbl.select(:name,:year,:color,:recno).class 3. cars_tbl.select(:name,:year,:color,:recno).sort(+:color).class ?
<canton7> s/cars_tbh.class/cars_tbl.class
<gurugeek_> canton7: do you do paid freelance jobs? :)
<canton7> let's find out where it's being converted to an Array
miso_soup has quit [#ruby]
<canton7> gurugeek_, fraid not. Programming's only a hobby
<gurugeek_> same here obviously :)
<canton7> anyway, I've got a report in tomorrow so let's hustle. What's the output of the commands I listed?
Karmaon has joined #ruby
Jake232 has joined #ruby
<canton7> ooh, looks like select (which calls get_matches) returns an Array. Are you entirely sure that your original command worked under Ruby 1.8 ?
<gurugeek_> yes let me show you in a paste
nu7hatch has joined #ruby
<gurugeek_> perhaps this is more helpful apologizes if I didn't give enough information
<canton7> gurugeek_, cool that's more like it :) So what does `p puppen_tbl.selec(:name, :race, :color, :recno)` give in ruby 1.8?
<gurugeek_> without to_report returns the same as 1.9 no ?
<gurugeek_> plus #<struct #<Class:0x10f73b698>
<canton7> well, I'm not sure whether it will. I don't think KirbyBase ever extended Array to have #to_report, so I'm not sure whether KBResultSet#sort in 1.8 returned an array
<canton7> ahem, #select, not #sort
<canton7> also, puppen_tbl.select(:name,:race,:color,:recno).class in ruby1.8 and 1.9 please
<gurugeek_> ok
hirotosh_ has joined #ruby
kidoz has joined #ruby
hirotos__ has joined #ruby
<canton7> ta
<gurugeek_> thank you :)
<canton7> gurugeek_, without the call to #sort, please
<canton7> (not that it should make a difference, but this "shouldn't" be breaking, so I'm going to be careful)
<gurugeek_> without sort I get KBResultSet
<gurugeek_> in 1.8
<gurugeek_> same in 1.9 :)
<canton7> aha awesome
kidoz has joined #ruby
<canton7> so now you delve into #sort and figure out why there's a difference in what it's returning
<gurugeek_> ok will do !
<gurugeek_> thanks for your help will find a way to see waht changed in 1.9 to break that
<canton7> cool, no worries
<gurugeek_> apologizes to everyone for the annoyance !
<niklasb> gurugeek_: do better next time
<gurugeek_> will so thanks niklasb
Asebolka has joined #ruby
ukd1 has joined #ruby
DMKE has joined #ruby
<fowl__> gurugeek_, you gonna have this on github?
waxjar has joined #ruby
<gurugeek_> fowl__ yes now there is an unofficial one but should move the official one too once the porting is done I guess no point to show the old code that is already there
<gurugeek_> fowl__ in client mode it is just 1 file :)
ScottNYC has joined #ruby
soveran has joined #ruby
workmad3__ has joined #ruby
td123 has joined #ruby
dql has joined #ruby
<adac> How to create a hash value out of a string?
bawer has joined #ruby
<canton7> adac, clarify?
schaerli has joined #ruby
dibri has joined #ruby
batmanian has joined #ruby
Natch| has joined #ruby
<adac> canton7, I thought it might somehow be possible if i have an URL string http://example.com to create an unique hash value for this exact string
<canton7> adac what do you mean by "hash value"? Are we talking about ruby's Hash class, or a digest of some sort?
thone_ has joined #ruby
<adac> canton7, hmm actually I think it is digest
<canton7> adac, cool. There's a Digest class for that
savage- has joined #ruby
<adac> http://example.com should be "hashed" which gives me an unique identifierr. when I "rehash" http://example.com I should get the very same "digest"
<adac> canton7, ok let me google for digest :)
<fowl__> require'digest/md5'; Digest::MD5.hexdigest('sup')
<adac> fowl__, thanks!
thecreators has joined #ruby
Eldariof-ru has joined #ruby
Bofu2U has joined #ruby
Morkel has joined #ruby
PragCypher has joined #ruby
schaerli has joined #ruby
emmanuelux has joined #ruby
ereslibre has joined #ruby
ereslibre has joined #ruby
ryan_dev70 has joined #ruby
tobym has joined #ruby
Sailias has joined #ruby
chson has joined #ruby
oscardelben has joined #ruby
<d34th4ck3r> Why there is no rubysoc these days? :(
<shevy> d34th4ck3r google wants to kill ruby
<d34th4ck3r> shevy: WHY?? :-o
<shevy> they have python... Go... dart ... almost their own OS with chromium
<d34th4ck3r> shevy: google cant stop us, we can have our sponsers from ruby/rails community ?
<oscardelben> Hi, I'm trying to install ruby in /foo/bar but it doesn't find the libyaml library. I've installed libyaml by configuring like so: ./configure --prefix=/foo/bar. I do the same for ruby: ./configure --prefix=/foo/bar. Any idea how I can make Ruby recognize the library?
_AlbireoX has joined #ruby
wopi has joined #ruby
<shevy> d34th4ck3r I have no idea about rails.
trivol has joined #ruby
timonv has joined #ruby
fbernier has joined #ruby
<d34th4ck3r> shevy: doesn't matter, The point i am trying to make is that, google cant stop us , we can have our sponsers and our students ?
<shevy> I am not sure why sponsors are needed
<shevy> I use ruby because it solves problems I have, with or without sponsors
seanstickle has joined #ruby
mdw has joined #ruby
<d34th4ck3r> shevy: I am talking about rubysoc, i.e. ruby summer of code...are you aware of that?
<oscardelben> --with-libyaml-dir FTW
<shevy> d34th4ck3r sure
elliot_ has joined #ruby
elliot98 has joined #ruby
<d34th4ck3r> shevy: so , we need to reward student for their work , isint it? that the whole concept of summer of code...
wopi has quit ["ruby"]
<shevy> d34th4ck3r I do not submit to this statement. Ruby needs matz. That's it.
shobhitg has joined #ruby
<seanstickle> Needs Matz? Or benefits from him greatly?
<waxjar> is there an elegant way to turn a MatchData object into a Hash?
<d34th4ck3r> shevy: lol, yea ruby sure needs matz, but people need ruby, and they need to be aware of that.. ;)
<seanstickle> Evidently, people do not *need* Ruby.
<d34th4ck3r> seanstickle: people need ruby in the sense that they need to easy their life. ;)
pubis has joined #ruby
<shevy> well, ruby without matz is not ruby anymore
<fowl__> waxjar, Hash[keys.zip match.to_a]
<seanstickle> shevy: what is it?
<seanstickle> shevy: because the guy is going to die eventually
<shevy> seanstickle yeah but that is very very far away from now!
<SPYGAME> hey guys, i'm using simple form in my app as form builder, i wanna know how do i tell simple form not to use "yes" "no" radio buttons that it does by default but only one radio button for that input field ?
<seanstickle> And C is still C even though Dennis Ritchie died
<fowl__> seanstickle, have you not heard the story of matz' journey through south america in search of the fountain of youth?
<waxjar> thank you fowl__ :)
<seanstickle> A book is independent of its creator when it is published.
<seanstickle> And presumably programming languages are too.
<seanstickle> The Torah is not in heaven.
<d34th4ck3r> shevy, seanstickle : so we need to make people aware of ruby .
<d34th4ck3r> fowl__: LOL
<waxjar> how are books ever independent of a creator?
<fowl__> d34th4ck3r, he ended up not finding it, so he went home and created ruby :)
<seanstickle> waxjar: the interpretations of the work are not limited to the author's
<d34th4ck3r> fowl__: haha..
<seanstickle> waxjar: unless it is a very poor work devoid of value
jordan_ has joined #ruby
<waxjar> i see
<d34th4ck3r> The point I am trying to make here is that we need to make people aware of awesomeness of ruby , rubysoc was started with the purpose, but it died.
jordan_ has quit [#ruby]
yannis has joined #ruby
<seanstickle> d34th4ck3r: is this really a problem?
<seanstickle> It sounds like those campaigns on Facebook to raise awareness of cancers
<seanstickle> Who hasn't heard of those cancers?
__ack has joined #ruby
<d34th4ck3r> seanstickle: do u believe in ruby? how have u came to know about it? some one must have told u or u must have read about it somewhere.. so my point is , more people should know about it .
<d34th4ck3r> seanstickle: awareness is important, let it be cancer or ruby. (both cure people. :P )
<seanstickle> d34th4ck3r: yeah, so your troll powers are not very developed
<shevy> lol
<seanstickle> d34th4ck3r: keep working at it, and you might grow up to be a real troll
<shevy> awareness cures cancer wtf
<seanstickle> shevy: sure, didn't you see the JAMA article about reduced incidence of cancer in Facebook users?
<seanstickle> ;)
kevinykchan has joined #ruby
<shevy> dunno
<shevy> I banned Facebook. Can't visit it.
<seanstickle> See, now you're going to get cancer
<shevy> :(
_AlbireoX has joined #ruby
zakwilson has joined #ruby
<fowl__> seanstickle, so cynical, have we all forgotten about Super Cancer?
<seanstickle> fowl__: Is that what Superman gets?
<d34th4ck3r> oh, whateva. so one here gives a crap about people dying because of unaware of causes of cancer. :P
flagg0204 has joined #ruby
<d34th4ck3r> *being unaware
rippa has joined #ruby
freeayu has joined #ruby
<d34th4ck3r> Think of a situatation when Matz would have just created the language and kept it in his computer, would we be still discussing this topic ? :P
netogallo has joined #ruby
dbgster has joined #ruby
<shevy> d34th4ck3r matz created ruby
<d34th4ck3r> and the grass is green.
Eldariof-ru has joined #ruby
sohocoke has joined #ruby
<elliot98> how does one specify the http accept header in httpsession?
<elliot98> basically, if need to change the response from html to xml
ezl has joined #ruby
luxurymode has joined #ruby
nlc has joined #ruby
tommyvyo has joined #ruby
JohnBat26 has joined #ruby
netogallo has joined #ruby
PragCypher has joined #ruby
ryan_dev_ has joined #ruby
kenperkins has joined #ruby
fforbeck has joined #ruby
<ezl> new to ruby: struggling with requiring a gem -- but the error message makes it look like the interpreter can find the gem in question
<ezl> Could not find nokogiri (~> 1.4.4) amongst [activerecord-2.3.14, ... , nokogiri-1.5.2,
<davorb> have you installed it?
EzeQL has joined #ruby
<davorb> oh
<td123> ~> 1.4.4 only matches against 1.4.x
<davorb> right
<ezl> ok -- how can i choose which version to install?
<davorb> ezl the most convenient thing imho is to install bundler and use that to manage your gems
<ezl> thanks davorb
<seanstickle> ezl: gem install nokogiri --version 1.4.4
deobald has joined #ruby
<ezl> what is the best way to maintain separate environments, for example if different projects require different versions of the same gem?
ZachBeta has joined #ruby
maletor has joined #ruby
<burgestrand> ezl: http://gembundler.com/
Advocation has joined #ruby
<ezl> haha ok -- didn't realize that also separates the environments
<burgestrand> ezl: what environment?
<ezl> i mean, say i have a project that requires nokogiri1.4.4 and one that requires 1.5.2
<burgestrand> ezl: when using bundler it’ll make sure you get the correct version of any given gem when you require it
<burgestrand> ezl: there are several options on how these gems might be found on your system with bundler
<ezl> instead of having all my gems available to all projects, can i make it so that one project uses gems on a certain path, and another project uses gems on another path? (i don't really konw what the appropriate terminology is... just getting started with ruby)
<burgestrand> ezl: often it actually installs them like you would normally with "gem install", but when requiring them it will make sure you require the version specified and not the newest (like what would otherwise happen)
ryanf has joined #ruby
ddv has joined #ruby
<ezl> ok thanks, reading the gembundler docs
ddv has joined #ruby
ddv has joined #ruby
<burgestrand> :)
<burgestrand> ezl: with rubygems, when you require a file from a gem, you’ll get the highest version of that gem that is available on your system
<burgestrand> bundler allows you to be more specific, even if you might have multiple versions of the gem installed
pangur has joined #ruby
iamjarvo has joined #ruby
yoklov has joined #ruby
ph^ has joined #ruby
<ezl> very cool. liking ruby in the first hour. is it appropriate to say "gem" is basically "apt for ruby"?
<banseljaj> ezl: yes.
<seanstickle> ezl: more or less
<banseljaj> ezl: also, take care. ruby is immensely addictive.
<ezl> =)
naquad has joined #ruby
pencilcheck has joined #ruby
<ezl> once i install a gem, whats the easiest way to inspect the source code of the gem to see whats going on/what methods are available in the gem?
<burgestrand> ezl: oftentimes the documentation should hopefully be enough
<burgestrand> ezl: you may unpack a gem with "gem unpack gemname" to see it’s source though
<ezl> very nice, thanks
exploitable has joined #ruby
giftfrosch_ has joined #ruby
exploitable has quit [#ruby]
pac1 has joined #ruby
<pangur> hi.rb:2:in `require': no such file to load -- sinatra (LoadError)from hi.rb:2 I have sinatra installed but I still get that error. Could anyone throw light on this for me please and tell me how to sort it?
<burgestrand> pangur: which version of ruby?
<burgestrand> pangur: ruby -e 'p RUBY_VERSION'
Cache_Money has joined #ruby
<pangur> Using /home/calum/.rvm/gems/ruby-1.9.3-p0
ukd1 has joined #ruby
<pangur> ruby -e 'p RUBY_VERSION' ... "1.9.3"
havenn has joined #ruby
<pangur> burgestrand, 1.9.3
<burgestrand> pangur: a few possible errors: you don’t have sinatra installed (gem list sinatra), you are using bundler and don’t have sinatra in your gemfile (bundle show sinatra) or you might have a broken ruby installation
<burgestrand> possibly some other thing as well…
eph3meral has joined #ruby
<burgestrand> but those are the usual issues
vitor-br has joined #ruby
<pangur> It is the bundle show that reflected an absence of Gemfile :)
<burgestrand> broken ruby installation less common
<pangur> Thanks, burgestrand
<burgestrand> pangur: but then you are not using bundler so it is probably alright
<burgestrand> (unless you require bundler in your code, in which case it’s even more strange :p)
n1x has joined #ruby
<pangur> I upgraded from 1.9.2 to 1.9.3 and somehow my sinatra app would not run any more.
<burgestrand> pangur: also, please make sure to restart your terminal (actually your shell) at least once, just to make sure your terminal is not acting strange
<pangur> It must have been to do with the bundler.
snearch has joined #ruby
<pangur> No, I think it is definitely that I have not done the bundling properly.
<burgestrand> pangur: you are using bundler?
<pangur> Thanks for pointing me in that direction, burgestrand.
trivol has joined #ruby
<pangur> There is a while since I created the hi.rb file but I recall that I did use bundler when I first started with it.
<burgestrand> pangur: are you requiring bundler in hi.rb?
<pangur> No
<burgestrand> Then you are not using bundler :)
<burgestrand> Bundler should complain loud and clear if you are missing the Gemfile, it’s probably something else
<burgestrand> pangur: gem list sinatra shows sinatra in the list?
<burgestrand> pangur: does the output of "gem which sinatra" look good?
<pangur> gem list sinatra ... *** LOCAL GEMS *** ... sinatra (1.3.2) ... sinatra-flash (0.3.0)
<pangur> /home/calum/.rvm/gems/ruby-1.9.3-p0/gems/sinatra-1.3.2/lib/sinatra.rb
<pangur> these are gem list sinatra and gem which sinatra
<burgestrand> Hm, peculiar
<pangur> I am on ubuntu
<pangur> Maybe that is not relevant.
<burgestrand> pangur: and I assume it "irb -rsinatra" raises an error?
<burgestrand> pangur: sometimes, but you are using RVM so usually there is no issue, apt can cause troubles sometimes though
<pangur> irb-rsinatra ... irb-rsinatra: command not found
<fowl__> more like space not found
<fowl__> mirite
<pangur> I was just using kate to do the editing
<fowl__> pangur, `irb(SPACE)-rsinatra`
tommyvyo has joined #ruby
<pangur> 1.9.3-p0 :001 >
<burgestrand> Heh
<burgestrand> pangur: how are you running hi.rb?
<pangur> console
d34th4ck3r has joined #ruby
<pangur> ruby hi.rb
<burgestrand> pangur: if you see then irb prompt with "irb -rsinatra" it means sinatra loaded successfully in the console
robdodson has joined #ruby
iamjarvo has joined #ruby
<robdodson> def projects=(list)
<robdodson> @projects = list.map(&:upcase) # store list of names in uppercase end
<robdodson> oops
<robdodson> well
<burgestrand> which makes it confusing that "ruby hi.rb" does not work
<burgestrand> pangur: how about "irb -r./hi"
<robdodson> if someone has a moment could you help me understand what the &:upcase means up there
<niklasb> robdodson: it's a shortcut for .map { |x| x.upcase }
<burgestrand> robdodson: &something in an argument list converts something to a block (using something.to_proc) and passes the resulting proc as the block to the method
<niklasb> robdodson: in this case, ot iterate through the list and builds up a new list consisting of the results of `upcase` called on the items
<niklasb> s/ot/it
<robdodson> ok, i figured it was doing something with a block and calling upcase
<fowl__> i made Array#to_proc so i can do %w[1 2 3].map &[[:to_i], [:*, 10]]
<fowl__> :P
<pangur> irb -r./hi just gives me 1.9.3-p0 :001 >
<robdodson> hah
<twinturbo> hmm
<niklasb> fowl__: that's just ugly in Ruby :D
<ezl> i'm trying to inspect an object -- i used ruby-debug to drop to a debugger, but when i try to do "puts" on anything the debugger is telling me it doesn't know what "puts" is
sonkei has joined #ruby
<fowl__> niklasb, yea, ugly code <3
<burgestrand> pangur: hm, something strange is happening when you do "ruby hi.rb"
<twinturbo> I have a sorted set index by unix timestamps with instances of events (just counters). What is the easiest way to find the # of events/in a time range? Ie events/perscond/per minute etc
jimeh has joined #ruby
<niklasb> fowl__: reminds me of Haskell's applicative instance of list
<pangur> should I have something like ruby gemfile hi.rb or that sort of thing?
<niklasb> pangur: you probably mean `bundle exec ruby hi.rb`
<burgestrand> pangur: no, not at this stage it’s not necessary, it should work, and it works when you load the file in IRB but not with ruby
h4mz1d has joined #ruby
<burgestrand> pangur: could you pastie the file?
dkissell has joined #ruby
ph^ has joined #ruby
<burgestrand> pangur: I’m out of ideas, could you do a "p RUBY_VERSION" and "p ENV["GEM_HOME"]" in the file, above line #2, and then run it again with "ruby hi.rb"
Eldariof-ru has joined #ruby
<pangur> It has worked for me this time !
<pangur> Thanks, burgestrand!
<burgestrand> D:
fforbeck has joined #ruby
<pangur> Should I have a shebang at the top of the file?
<pangur> Is that the reason that it was not picking up sinatra?
mfridh has joined #ruby
<burgestrand> pangur: no, I have no idea why that was, did you restart your terminal between not working and now working?
<pangur> Nope
<burgestrand> pangur: then I have no idea why it suddenly works :p
<any-key> ruby magic
falena has joined #ruby
<pangur> I had turned off my machine several times before and always the initial error that I reported came up. This time, it was the same but I did not switch off machine or console or restart in any way.
<pangur> I put it down to the burgestrand magic :)
<burgestrand> :p
<any-key> he's just taking credit for ruby magic
Eldariof-ru has joined #ruby
<pangur> Well fowl__ helped with my space typo.
<pangur> Thanks to fowl__ too
hadees has joined #ruby
<shevy> yeah he is helpful after a session of weed
<shevy> but god beware when he just woke up
jgrevich has joined #ruby
jgrevich has joined #ruby
<shevy> then you will understand the true meaning of a fowl mouth
wookiehangover has joined #ruby
<fowl__> haha
jrist has joined #ruby
<ezl> :q
ezl has joined #ruby
<any-key> ezl: this isn't your vim window :P
phipes has quit [#ruby]
<seanstickle> Hmm, vimirc?
<any-key> everything must be vim
phipes has joined #ruby
tomzx has joined #ruby
<fowl__> anybody got experience with ruby on windowz
<fowl__> where do i put these freeglut headers and dlls so the devkit can find it
<eph3meral> <3 vim
tobago has joined #ruby
neto_gallo has joined #ruby
dfamorato has joined #ruby
JohnBat26 has joined #ruby
timonv has joined #ruby
romanesco has joined #ruby
<ddv> Intellij <3
bluenemo has joined #ruby
<ezl> looking through various ruby tutorials online ... any recommendations for a quick primer for a python guy to quickly get functional? (Any attempts to look for "ruby for python programmers" mostly come up with ruby v python flamewars)
bluenemo has joined #ruby
seivan has joined #ruby
<any-key> ezl: hehe you'll probably get a lot of stuff on Zed with a google search like that :P
<ezl> (and also recommended style guide for ruby -- sort of unsure if i should do {} vs do/end, for example... just working through random tutorials still right now)
<any-key> ezl: github's style guide is excellent
<banseljaj> ezl: github has a style guide for ruby
<ezl> great thanks
Rahul has joined #ruby
<any-key> their style guide is essentially the accepted way to write ruby (it was previously unwritten)
Eldariof-ru has joined #ruby
<ezl> yep, i like it so far, already reading through it
virunga has joined #ruby
<ezl> mostly just like that there exist _A_ standard that most people adhere to, rather than "everyone does whatever they want"
<any-key> you'll rarely see people deviate from that style
<yxhuvud> any-key: uh, no. There are several other written style guides, and imo the version github uses have bugs, like using space when declaring default argument.
<any-key> yxhuvud: fair enough
flak has joined #ruby
havenn has joined #ruby
<ezl> preference for do end vs {} for iteration over lists?
<any-key> {} is preferred for single line blocks and blocks that return stuff (sometimes)
<any-key> if you're doing multiple lines you'll pretty much always want do end
<any-key> I'm sure someone will debate that with me though :P
<canton7> personally I used {} 1. the block fits on 1 line and 2. if it doesn't affect any variables outside of its scope
<ezl> this is going to be fun
<ezl> =)
<canton7> hehe
<canton7> it's all personal preference at the end of the day
<fowl__> someone answer my windows question :(
sako has joined #ruby
sbanwart has joined #ruby
blacktulip has joined #ruby
rippa has joined #ruby
sbanwart_ has joined #ruby
SphericalCow has joined #ruby
Sailias has joined #ruby
mborromeo has joined #ruby
dfamorato has joined #ruby
<robert_> is there a ruby implementation of whirlpool?
chson has joined #ruby
<fowl__> #ruby if you dont help me i'll have to use rmagick, and if that happens i'll end up killing myself
Advocation has joined #ruby
<eph3meral> ezl, if it easily fits on one line, use {}, otherwise use do end
<banseljaj> fowl__: Don't kill yourself. we all love you.
<eph3meral> ezl, I write both python and ruby, I would recommend just "jumping in" and using the API docs for reference... things like http://www.ruby-doc.org/core-1.9.3/String.html http://www.ruby-doc.org/core-1.9.3/Array.html http://www.ruby-doc.org/core-1.9.3/Enumerable.html http://www.ruby-doc.org/core-1.9.3/Hash.html
<eph3meral> ezl, just start writing something and learn as you go
<banseljaj> (Disclaimer: The use of the pronoun "we all" is non compulsory and non binding. Use at your own risk)
CheeToS has joined #ruby
tuxaddicted has joined #ruby
Advocation has joined #ruby
P0apfel has joined #ruby
schovi has joined #ruby
hukl has joined #ruby
kirun has joined #ruby
mdw has joined #ruby
Rahul has quit ["Leaving"]
mattyoho has joined #ruby
mattyoho has joined #ruby
futurechimp has joined #ruby
Foxandxss has joined #ruby
h4mz1d has joined #ruby
sako has joined #ruby
<shevy> eph3meral how do you manage to write both in python and ruby? isn't that confusing?
Advocation has joined #ruby
deobald has joined #ruby
<eph3meral> shevy, I could understand how it would be confusing for someone like yourself who failed the 3rd grade, but no, I do just fine... thanks
alienvenom has joined #ruby
<shevy> eph3meral hmm I need to look at your ruby code
<shevy> &get_fitness
<shevy> omg ...
berserkr has joined #ruby
<eph3meral> shevy, yes I know that a perfectly reasonable and DRY piece of code, written in the style that ruby was meant for, i.e. custom domain specific DSL type logic, is confusing to you
<eph3meral> shevy, we've already established this
<shevy> yeah I remember
<shevy> still don't know about your python though
iocor has joined #ruby
<eph3meral> shevy, I still know that you are probably soon to get /ignore
<shevy> :(
Bosma has joined #ruby
<eph3meral> lol @ the fact taht so far you haven't provided even a shred of help, you've only complained that you can't understand perfectly reasonable ruby code
<shevy> eph3meral, perhaps I learn from you :)
<eph3meral> shevy, perhaps :)
guns has joined #ruby
flagg0204 has joined #ruby
<eph3meral> that's the attitude I like... I shall now decrement your ignore_threshdold counter :)
ThatOtherPersonY has joined #ruby
<workmad3> eph3meral, are you still maintaining that the eyesore you posted yesterday is good code? :P
<eph3meral> workmad3, yep
<eph3meral> workmad3, A) it's throw away code - it's the first iteration of an iterative development process, the purpose of which is to get from concept to proof-of-concept as quickly as possible B) I would welcome your suggestions for improvement, but C) I would not welcome them until I have a more fully thought out and comprehensive OOP version of said code
<eph3meral> workmad3, again, I still don't see how that code is a problem at all, unless you would prefer that *every* friggin operation be stored in a variable rather than make use of chaining
<workmad3> eph3meral, ah, your comments there make it clear that you don't consider it good code, but that it is certainly adequate for your current purposes :)
<eph3meral> workmad3, actually, I do consider it good code, good for it's indented purpose
<eph3meral> and for that matter, even if it weren't to be abstracted further, I don't see what's wrong with it
Bosma has joined #ruby
<eph3meral> workmad3, have you never seen .select.inject() before? do you never use chaining in such a manner?
<workmad3> eph3meral, I'd need to look at it again, but I remember it seemed overly verbose and not exactly clear
<workmad3> (I'm on a different machine, not got the link around)
<eph3meral> workmad3, some problem domains are verbose - there's no way around it
<eph3meral> surely hiding some of the various things behind an encapsulated OOP layer will benefit the readability, but that comes later
<eph3meral> other than that, I see nothing wrong with it
<eph3meral> one sec I'll paste the link again
<fowl__> link
<fowl__> o
futurechimp has joined #ruby
<eph3meral> workmad3, i would welcome suggestions on how to reduce the so called "verbosity" of that code
<eph3meral> workmad3, I just honestly don't see what the problem is there, the var names are about the best english language and direct and easily readable descriptions of what's happening
<fowl__> if you know how to use inject why not use it on line 3
<eph3meral> workmad3, the problem domain is non-trivial
<fowl__> 3/4
<eph3meral> workmad3, if you say "shorter var names", I'll basically agree with you, but again, point out that, for the given problem domain, the var names are IMO about as good as they can be
<fowl__> line 18, select{}.first doesnt make sense, use #find
<fowl__> your while loop should be replaced by a mapping
<workmad3> eph3meral, you have at least 2 variables there that you're creating and then never using
<eph3meral> workmad3, if you've never encountered said problem domain before, then of course things will seem verbose - i.e. if you've never studied or tried to implement a GA, you won't know what's going on - but don't confuse your lack of knowlege of a given problem domain with some sort of "problem" inherrent in the so called "verbosity" of the code
<workmad3> eph3meral, which is crufty
<fowl__> all that inject{|sum,val|sum+=val} can be replaced with inject(:+)
<workmad3> ^^
<fowl__> eph3meral, are you listening to me?
<fowl__> your code is whack
<eph3meral> workmad3, hahaha, that's all you have to say?
<eph3meral> workmad3, which ones, incidentally?
<workmad3> eph3meral, sum and total
ThatOtherPersonY has quit [#ruby]
<eph3meral> workmad3, uh, actually total is used, look again
<fowl__> lol
<eph3meral> workmad3, but you're right, sum is no longer used - that was an artifact from the fact that I had to modify my code to get it to work on shitty ass codepad.org which only uses ruby 1.8
timonv has joined #ruby
<workmad3> eph3meral, oh, total is being used badly... and fowl__ had some comments too :)
<eph3meral> i have fowl__ on ignore
<fowl__> hah his loss
<eph3meral> workmad3, whatever, the only other option for that computation I thought was less readable, personally
bawer has joined #ruby
<workmad3> eph3meral, oh, he commented that all your .inject... stuff can be replaced with .inject(:+)
<eph3meral> .each_with_obj was the other option
<eph3meral> workmad3, no it can't, not in ruby 1.8
<eph3meral> workmad3, see, this is why I have him on ignore
<workmad3> eph3meral, it can in 1.8.7
<eph3meral> workmad3, and codepad.org was on 1.8.6
<workmad3> eph3meral, if you're using older... sucks to be you
<eph3meral> sigh
<fowl__> he uses 1.8.6 because this website uses it, lol.
<workmad3> eph3meral, why do you care what codepad uses?
<eph3meral> i was trying to do people in here a favor by giving them something they could play with while helping me answer my actual question
<eph3meral> workmad3, so, aside from everything that you've mentioned so far which is completely irrelevant, anything else?
nilg` has joined #ruby
<workmad3> eph3meral, yeah... we're all capable of running ruby code without using an old online tool to do so :P
<eph3meral> workmad3, true - but whatever, it's one less step for people to have to take
<eph3meral> i was just trying to help folks out, but you're right
<workmad3> eph3meral, and ignoring cleanups that are imposed by said tool and then maintaining you have clean code is an invalid argument
<eph3meral> fuck me
<eph3meral> seriously
<eph3meral> that's retarded
<eph3meral> workmad3, completely spurious and irrelevant argument there
<workmad3> eph3meral, and as I said, for your current use, it's fine... but I wouldn't maintain it as good code, just perfect for your current use
<eph3meral> i'll paste the current code if you like
<eph3meral> and you're wrong
<eph3meral> but ok whatever, we don't see eye to eye and I don't give a fuck cuz it's not fucking relevant to the actual question inherrent in that code
<workmad3> eph3meral, ok, replace 'good' with clean... it's not clean, but it doesn't matter
<workmad3> (good being extremely subjective) and yeah... it doesn't matter :)
<workmad3> eph3meral, but you asked for appropriate cleanups to prove my point... I gave them, you ignore them because you're running on essentially obsolete versions (again fine) but it does make your arguments a bit harder to maintain :)
_|christian|_ has joined #ruby
<fowl__> workmad3, dont bother, he'll just insult you
<eph3meral> workmad3, why are we even still talking about this when you just admitted that it doesn't matter?
<fowl__> this channel is lucky i dont have ops
<workmad3> pragmatism does rule... if you have to compromise because of your environment, that's fair enough... just don't maintain that it's good, it's a compromise
dbgster has joined #ruby
<eph3meral> you're still TOTALLY missing the point
<eph3meral> you haven't even seen the original code
<eph3meral> the code *before* bastardized it mistakenly
<workmad3> eph3meral, if that was relevant, why didn't you paste it? :)
<eph3meral> cuz I'm lazy, and I just grabbed the pb link from my browser history
<eph3meral> and now this is a waste of time
<workmad3> agreed
twinturbo has joined #ruby
<eph3meral> workmad3, so the proposed alternative to using total was this: some_array.each.with_object({sum: 0}).map {|element, keep| keep[:sum] += element }
<eph3meral> which I felt was far less readable and I don't see any inherrent horrible flaw with using total
<niklasb> eph3meral: isn't that equivalent to {sum: some_array.reduce(:+) }?
williamcotton has joined #ruby
<eph3meral> niklasb, I dunno - I asked in here yesterday for proposed solutions and those were the two that I got
<eph3meral> I chose the one I felt was most readable
sbanwart has joined #ruby
<niklasb> eph3meral: I wasn't here yesterday
<eph3meral> niklasb, indeed
<niklasb> so I wouldn't know
<niklasb> have fun
<eph3meral> I need to convert an array of probabilities into a roulette wheel for weighted selection, such that the most probable item is, well, most probable
<eph3meral> niklasb, i.e. [0.1,0.2,0.3,0.4] becomes [0.1,0.3,0.6,1.0]
<niklasb> eph3meral: ah
<fowl__> niklasb, solve his problems or he'll hurt your feelings
<niklasb> fowl__: I see
<eph3meral> nikis, so then when I roll a "die" with e.g. rand(0.0..1.0), the most probable events are, well, most probable
<shevy> :D
<eph3meral> niklasb, I would suggest not listening to fowl__, I have him on ignore for a reason
<niklasb> eph3meral: I see
<shevy> lol
<Mon_Ouie> rand(0.0..1.0) is just rand, btw
<eph3meral> Mon_Ouie, ok good to know, thanks
<Mon_Ouie> Well, that's rand(0.0...1.0) actually
<niklasb> which makes more sense anyways
<fowl__> niklasb, i hit him with a shot of realism :)
<niklasb> fowl__: Oh, so I'm in some kind of cross-fire now
<fowl__> lol
<eph3meral> niklasb, a = [0.1,0.2,0.3,0.4]; a.each.with_object({sum: 0}).map{|element,keep| keep[:sum] += element } does seem to produce essentially the desired result
<eph3meral> niklasb, your reduce() suggestion does not... that I can tell, unless it was supposed to be implied that it was the block argument to the map() in the above
<eph3meral> although, interestingly, the result I get from that .with_object version is [0.1, 0.30000000000000004, 0.6000000000000001, 1.0]
<niklasb> eph3meral: no, I just couldn't remeber the semantics of each_with_object (it's really ugly)
<niklasb> eph3meral: that's not surprising at all.
<eph3meral> niklasb, yeah see, that's why I chose the approach using total, cuz it was a lot less ugly
<eph3meral> workmad3, I still don't see the fault in the approach of using total
<fowl__> boring
<niklasb> eph3meral: I don't know of any total
<niklasb> :D
<eph3meral> if anyone has a suggestion that's both cleaner and "better" then I welcome it
<fowl__> doesnt anybody else have stupid ruby questions
<niklasb> eph3meral: why do you need the array in that form? don't you rather need a function that selects on of the indices according to the probability?
<fowl__> i wish they would bring back def method(@var, @var2)
<eph3meral> niklasb, a = [0.1,0.2,0.3,0.4]; total = 0; a.map{ |v| total += v }
<niklasb> that's about the same thing.
<eph3meral> niklasb, it was just the methodology I came up with - I would also welcome suggestions for other methodologies with which to perform roulette selection
<eph3meral> niklasb, mind providing a pastebin example of what you're talking about?
<eph3meral> also, I'll paste my "cleaned up" version of my original, one sec
sbanwart has joined #ruby
akrasia has joined #ruby
<eph3meral> niklasb, http://pastie.org/private/vnqotzpxta8ksibf6p5tnq is my original code
<eph3meral> workmad3, http://pastie.org/private/vnqotzpxta8ksibf6p5tnq <- so, now that the completely trivial and irrelevant "ugly" bits have been "fixed", what exactly is wrong or bad or ugly about that code?
<eph3meral> niklasb, if welcome suggestions for how to go about creating and "spinning" the roulette wheel
atmosx has joined #ruby
<niklasb> eph3meral: what about `ary.each_with_index.inject([rand, nil]) { |(r,res),(x,i)| r <= x ? [1.0/0,i] : [r-x,res] }.last` ? :)
<eph3meral> niklasb, also, my original question was how to make a better roulette wheel such that the fitness score of the new population is consistently higher than the fitness score of the old population, which as you can see, even with a weighted roulette wheel...
<eph3meral> niklasb, hahaha, I love it :P
n1x has joined #ruby
<eph3meral> niklasb, even with a weighted roulette wheel, my new population consistenly ends up having a lower fitness score
<niklasb> that really sucks
<eph3meral> cuz if you've got percentages like [0.2,0.2,0.2,0.4], I would still prefer to have 0.4 be selected more often than *any* of the 0.2's
<fowl__> so basically he just needs more hand holding
<eph3meral> but given that there are 3 of them, their total percentage ends up being 60% chance to select a lower fitness score and 40% chance to select a higher fitness score
<niklasb> eph3meral: oh, so 0.4 should have a higher probabilty than.. 0.4?
<eph3meral> nikis, hehe, well... yeah I guess so :)
<niklasb> eph3meral: that sounds like you want to get your requirements straight before asking for help
<eph3meral> niklasb, but I'm also interested in if you have any other methodologies for building the roulette wheel
<eph3meral> sigh, I think my requirements are pretty straight forward... anyway
<eph3meral> my old question about the probabilities seems moot, if the population size is large enough
<eph3meral> for populations of about 1000 or so, the new fitness score is like, almost *always* much larger than the old fitness score
manizzle has joined #ruby
<niklasb> eph3meral: oh, so what should be the probability distribution in the case with the 0.2's and 0.4s
<eph3meral> and by a factor of 2 or 3
<eph3meral> but, it's still an interesting problem IMO, how to redistribute those kinds of probabilities
ginsun has joined #ruby
<eph3meral> i was thinking of maybe creating a single group of all the 0.2. probabilities, and then there would be 2 die rolls, one to select a probability group, such as 0.2, and another to at random (with no weighting) select one of the members of said group
<eph3meral> niklasb, anyway, as I said, it's a moot point when the population size is large enough, which I figured out last night by... well.. increasing the population size
<niklasb> eph3meral: so why not use a hash like { 0.2 => [1,2,3], 0.4 => [4] }
<eph3meral> nikis, yep, that's a pretty good idea
<eph3meral> yuno! nick completeion!
<eph3meral> niklasb, I may consider doing that, but I would have to still figure out where to assign the left over 0.4 probability out of 1.0
<eph3meral> cuz 0.2+0.4 != 1.0
<eph3meral> i guess I could just roll a die in the range of 0..probability-max
<eph3meral> niklasb, so anyway, ignore all of that probability redistribution thing - it's not an issue when the population is large enough - i'm more interested in your suggestions for alternative methods of building the roulette wheel
<eph3meral> niklasb, i would welcome a pastebin with an alternative method of building and spinning said roulette wheel
bawer has joined #ruby
<eph3meral> niklasb, something that doesn't need to use ary.each_with_index.inject([rand, nil]) { |(r,res),(x,i)| r <= x ? [1.0/0,i] : [r-x,res] }.last :)
<niklasb> eph3meral: ary.size.times.map { |i| ary[0..i].reduce(:+) } comes to mind
<niklasb> eph3meral: that's not to build up the wheel but to select one of the options randomly
seanstickle has joined #ruby
<eph3meral> niklasb, er... wait, that looks like it builds the wheel... to me, I just tried it in irb
<niklasb> i mean what you just echoed
<eph3meral> niklasb, a = [0.1,0.2,0.3,0.4]; a.size.times.map { |i| a[0..i].reduce(:+) }
<eph3meral> niklasb, ohhh, gotcha
<eph3meral> wow... yeah I still think my method is more readable :)
<niklasb> yeah, that's for the wheel. but the wheel is not really necessary
<niklasb> of course it's readable
<eph3meral> niklasb, ahh, yes I see... I don't understand your selection algorithm... but that's cool, I will try it and try to understand it
<niklasb> please don't
<eph3meral> niklasb, lol, why?
<niklasb> because it's utterly confusing
<eph3meral> ahhh, heheh
<eph3meral> ok, well then for now I'm going to stick with what I've got
<eph3meral> in terms of what I'm doing for selection
havenn has joined #ruby
astre has joined #ruby
astre has quit [#ruby]
otters has joined #ruby
Mekkis has joined #ruby
Quirrell has joined #ruby
jfelchner has joined #ruby
<eph3meral> workmad3, so, are there any egregious style errors in this http://pastie.org/private/vnqotzpxta8ksibf6p5tnq still? things that could improve "readability" per se?
zemanel has joined #ruby
n3m has joined #ruby
<canton7> eph3meral, line 20, select{ }.first can be replaced with find{ }
<seanstickle> select{}.first is nicer with detect{}
<seanstickle> Ah, someone else beat me to it with a slight variation
<eph3meral> canton7, seanstickle, k... anything else?
<fowl__> canton7, i said that hours ago :p
maletor has joined #ruby
<canton7> eph3meral, actually, lines 20 and 21 can be replaced with #find_index
<niklasb> seanstickle: no.
<niklasb> oh
<niklasb> sry
<canton7> fowl__, sorry, I wasn't around then :P
<niklasb> read it the other way around :)
<canton7> actually, #index, not #find_index
<niklasb> eph3meral: the whole while-loop can be replaced by a population.size.times.map
<canton7> what's wrong with using population.map?
<canton7> and tbh I wouldn't bother with the lambda on line 27
<canton7> for me it's clearer to have that inline
mikepack has joined #ruby
<niklasb> canton7: that would imply that the population objects would be used inside the loop. but of course it would work too
<niklasb> s/loop/block
<canton7> niklasb, hrm, otoh, using .size.times implies that the index is needed :P swings and roundabouts...
<niklasb> right.. it's ugly either way
<eph3meral> canton7, k, I debated that lambda myself, I figured it was more DRY
<niklasb> but nicer than a while
<canton7> yeah -- seeing the while, I assumed (at first) that the new and old population lengths could be different
delinquentme has joined #ruby
<delinquentme> how would I split a string at \n
<niklasb> delinquentme: split('\\n')??
<niklasb> lol no
<eph3meral> yeah, theoretically they will be the same
<canton7> delinquentme, string.each_line, string.split("\n")
<niklasb> \n of course
<delinquentme> split("\\n") yeah doesnt seem to work
<canton7> you need double quotes and one backslash
sako has joined #ruby
<delinquentme> .split("\n")
<eph3meral> but, I may actually pre-populate the new_population by default with the two fittest members of the old population
<delinquentme> yeah dobl quotes
<niklasb> delinquentme: but str.lines is much cleaner and splits on \r\n too
hukl has joined #ruby
<niklasb> which is usually desirable
<eph3meral> but i would still want to be able to select those two fittest members from the old population for recombination
<canton7> niklasb, thing is, that leaves the newlines on
<eph3meral> my main point really, was just - do you guys find that code "unreadable"? in its present state?
<niklasb> canton7: .map(&:chomp) if those aren't needed
<eph3meral> all of your suggestions are perfectly valid, in terms of code/style optimization
<canton7> niklasb, aye, but then you've got two iterations over the string instead of one
* canton7 stops being picky
<niklasb> canton7: it's still O(n) :) who cares about performance if one codes in Ruby :P
<niklasb> canton7: btw, that's not even true
<niklasb> lines is lazy
<canton7> does anyone know if ruby does implicit EOL conversion? iirc I've never encountered \r\n in a string read in by ruby
<canton7> niklasb, oops, true true
<Mon_Ouie> canton7: It does in non-binary mode
<niklasb> canton7: IO.open handles it
<niklasb> + what Mon_Ouie said
<canton7> aha awesome cheers. I suspected as much, but hadn't confirmed it
sarmiena_ has joined #ruby
williamcotton has joined #ruby
savage- has joined #ruby
startling has joined #ruby
gurugeek_1 has joined #ruby
startling has quit [#ruby]
yxhuvud has joined #ruby
pastjean has joined #ruby
Nss has joined #ruby
ryan_dev70 has joined #ruby
<ryanf> I think that's only true on windows
<ryanf> >> File.open('test', 'w') { |f| f.write("hello\r\nworld\r\n") }
<ryanf> >> File.open('test', 'r').read
<ryanf> => "hello\r\nworld\r\n"
igotnolegs has joined #ruby
davidcelis has joined #ruby
<heftig> ryanf: indeed.
emmanuelux has joined #ruby
<heftig> use "wb" or "rb" to enable binary mode, which sets external encoding to ASCII-8BIT. on windows, it also disables EOL conversion
mrtheshadow has joined #ruby
macmartine has joined #ruby
rramsden has joined #ruby
iamjarvo1 has joined #ruby
sarmiena_ has joined #ruby
iamjarvo1 has joined #ruby
kenperkins has joined #ruby
Bosma has joined #ruby
pastjean_ has joined #ruby
francisfish has joined #ruby
iamjarvo has joined #ruby
sectionme has joined #ruby
adamkittelson has joined #ruby
FreeDoug has joined #ruby
cableray has joined #ruby
iamjarvo1 has joined #ruby
Jrz has joined #ruby
gen0cide_ has joined #ruby
notVert has joined #ruby
gift has joined #ruby
<Jrz> hi!
<fowl__> Jrz, ruby <3s you
archivebot has joined #ruby
<davidcelis> fowl__: your name changed from yellow to green
<davidcelis> this is simply unacceptable. change it back.
jesly has joined #ruby
<jesly> what does uninitialized constant Gem::Deprecate means while rake install??
looopy has joined #ruby
<fowl__> davidcelis, your name is green to me, so we're even :P
rking has joined #ruby
adeponte has joined #ruby
juarlex has joined #ruby
<fowl__> jesly, your gems is out of date or the library is old (probably pre 1.3)
<jesly> i done a gem update
ZachBeta has joined #ruby
<jesly> i guess the particular gem is outdated
<fowl__> it probably wouldnt take much to update it
kenperkins has joined #ruby
Axsuul has joined #ruby
Axsuul has joined #ruby
Axsuul has joined #ruby
bawer has joined #ruby
Axsuul has joined #ruby
Axsuul has joined #ruby
justinmcp has joined #ruby
<davidcelis> jesly: `gem -v`
<jesly> 1.8.10
<davidcelis> yeah that's almost the current version. probably an issue with that gem
<jesly> i ran the extconf.rb
<jesly> and make and make install, no idea wot it got to do with ruby
nif has joined #ruby
mborromeo has joined #ruby
m_3 has joined #ruby
<eph3meral> hmm, when I use random_percentage = rand; new_chromosome_index = roulette_wheel.index { |c| c >= random_percentage }, I get a new population with, as expected, a higher (on average) fitness score, but when I use new_chromosome_index = roulette_wheel.index { |c| c >= rand(0) }, I always get the exact same results for the new population's fitness score
<eph3meral> what's up with that? is rand(0) always returning the same result if used within a block like that? does it always get the same seed or something?
<canton7> eph3meral, for each element in the array, rand() is being evaluated
<eph3meral> doesn't matter (as I would expect) if I use rand, rand(0) or rand(0.0..1.0) or rand(0.0...1.0)
<canton7> (in the second example)
<canton7> while in the first one, only one random number is chosen
<eph3meral> ohhh... duh, ok
<eph3meral> yeah, the first is what I need/want
Paradox2000 has joined #ruby
Paradox2000 has joined #ruby
lkba has joined #ruby
joaoh82 has joined #ruby
<fowl__> yesterday that line was rand(0.000000000..1.0000000000)
<fowl__> im not joking either
banisterfiend has joined #ruby
kenperkins has joined #ruby
mcwise has joined #ruby
<shevy> hehehe fowl__
twinturbo has joined #ruby
iamjarvo has joined #ruby
Morkel has joined #ruby
s0ber_ has joined #ruby
y3llow_ has joined #ruby
ph^ has joined #ruby
scwh has joined #ruby
y3llow has joined #ruby
y3llow has joined #ruby
michaelbarton has joined #ruby
y3llow has joined #ruby
mengu has joined #ruby
chson has joined #ruby
kenperkins has joined #ruby
sarmiena_ has joined #ruby
cableray has joined #ruby
mikepack has joined #ruby
<epitron> is there a builtin method to select elements on a hash, and return a hash?
<davidcelis> ?
<epitron> i suppose i could do Hash#delete_if { not (expression) }
<davidcelis> hashes respond to select.
<epitron> and return an array
<Mon_Ouie> epitron: There isn't. You can do Hash[hash.select { … }]
<epitron> hmm
<davidcelis> { :first => 1, :second => 2, :third => 3 }.select { |k,v| v > 1 } #=> {:second=>2, :third=>3}
<epitron> i wonder which is faster -- hash.dup.delete_if, or Hash[hash.select]
tomsthumb has joined #ruby
codezombie has joined #ruby
kah_ has joined #ruby
<epitron> davidcelis: oh, you're right
<epitron> hmm
<davidcelis> Enumerable.
<Mon_Ouie> Oh, I thought they made them both (select and reject) return Array in 1.9
<davidcelis> Hashes are enumerable.
<epitron> yeah, me too
<davidcelis> Why would they return arrays?
<epitron> maybe 1.9.3 changed that
<Mon_Ouie> Because that's what Enumerable#select does
<epitron> well, because they used to return arrays :)
<Mon_Ouie> Hash redefines select to return a Hash
<Mon_Ouie> Which means that's a special case you may need to deal with in some cases
<davidcelis> Ah. So it does.
savage- has joined #ruby
<Mon_Ouie> For the record, in 1.8, select behaves as Enumerable#select and reject returns a Hash
<shevy> awww only 2 months before 1.8 dies ...
<epitron> wat? reject returns a hash? :)
<epitron> oh, i guess because of delete_if
snip_it has joined #ruby
shadoi has joined #ruby
Shaded has joined #ruby
blast_hardcheese has joined #ruby
statarb3 has joined #ruby
statarb3 has joined #ruby
btaitelb has joined #ruby
dysoco|laptop has joined #ruby
<dysoco|laptop> Anyone is running Ruby 1.9 in Ubuntu ?
<kah_> yeah
__ack has joined #ruby
<dysoco|laptop> how ?
_lennart_ has joined #ruby
<dysoco|laptop> I'm trying to install RVM but I get tons of errors with DPKG
<eph3meral> does ruby have such a concept as an "interface" or an "abstract" class... does it need to?
timonv has joined #ruby
<eph3meral> dysoco|laptop, don't use apt/dpkg, just install rvm like it's meant to be installed
<eph3meral> dysoco|laptop, http://rvm.beginrescueend.com/
<shadoi> eph3meral: you can make one, but it doesn't have a builtin concept of an abstract class.
<shadoi> Just make a base class that raises exceptions if interfaces aren't implemented.
<dysoco|laptop> kah_, eph3meral : Thanks
<dysoco|laptop> It was lot easier in Arch though...
<shadoi> Use Arch then :)
<Mon_Ouie> You don't really need abstract classes if you can just rely on duck typing
Nss has joined #ruby
<Mon_Ouie> The object will raise an exception itself if you call a method it doesn't have
cbuxton has joined #ruby
<dysoco|laptop> shadoi, yeah, I run it in my Desktop but gives me some problems with my laptop
<eph3meral> shadoi, ok
<eph3meral> dysoco|laptop, I use ubuntu and installing and using rvm has been nothing but easy for me
<shadoi> eph3meral: like Mon_Ouie said you don't really need it, only if you want to be really strict about things implementing an API.
<eph3meral> dysoco|laptop, using a packaged version of rvm on any platform = fail
<eph3meral> shadoi, Mon_Ouie, ok yeah that's what I thought, thanks
<eph3meral> i'm just used to the C/PHP world in this respect
<niklasb> eph3meral: ah, so C has added interfaces and classes lately?
<eph3meral> bleh, C++, whatever
heftig has joined #ruby
<dysoco|laptop> eph3meral, in Arch you've AUR, wich compiles from source, that's what I used
<dysoco|laptop> well, though, I think RVM was in Repos
luke--_ has joined #ruby
<niklasb> dysoco|laptop: RVM is neither in the repos nor in the AUR
<niklasb> but that's no problem because it's not meant to be install system-wide
<dysoco|laptop> nikis, then I did it another way, I've not used it in a while
Bauer has joined #ruby
cespare has joined #ruby
<eph3meral> niklasb, actually RVM is perfectly viable for installation system wide, there are a number of docs on this
<eph3meral> helps keep the disk space footprint low so that each user doesn't have their own version of e.g. 1.9.3-p125
<niklasb> eph3meral: good to know.
wedgeV has joined #ruby
<eph3meral> niklasb, with that said, wayne does encourage you to NOT install system wide :)
<niklasb> eph3meral: so my statement that it's not *meant* to be installed system-wide was correct :)
iocor has joined #ruby
dysoco|laptop has quit ["Saliendo"]
<eph3meral> niklasb, fair'nuff
cola_zero has joined #ruby
nif has joined #ruby
banisterfiend has joined #ruby
cascalheira has joined #ruby
KL-7 has quit ["Leaving"]
KL-7 has joined #ruby
KL-7 has joined #ruby
h4mz1d has joined #ruby
Bauer1 has joined #ruby
mikos has joined #ruby
lewis1711 has joined #ruby
ephemerian has joined #ruby
<rking> Is there anything else like "# encoding: " comments?
<rking> Like some other magic-string-in-comment mechanism?
PragCypher has joined #ruby
armdale has joined #ruby
<banisterfiend> anyone thnk of a nice icon/representation of a 'method' ?
<banisterfiend> class is easy -- package/blueprint
<banisterfiend> method im having trouble with
havenn has joined #ruby
<rking> Hrm, wow. What context?
adeponte has joined #ruby
<rking> All of the analogies I am thinking of are abstract as well.
looopy has joined #ruby
<rking> Maybe a button you can push?
<sohocoke> what's the best way to retrieve the source of a proc defined at runtime? sourcify doesn't seem good enough, Ruby2Ruby seems outdated.
seanstickle has joined #ruby
blueadept has joined #ruby
<banisterfiend> rking: for a documentation viewer
<heftig> class = blueprint, object = gearbox, method = gear?
<rking> A gear is as good as anything I'm thinking of.
niku4i_ has joined #ruby
nif has joined #ruby
berserkr has joined #ruby
<niklasb> sohocoke: hm, not sure if this is actually possible. could well be that the Proc is compiled to bytecode and the source is thrown away.
<niklasb> why do you need that?
<sohocoke> niklasb: oh, many reasons. in general, i always prefer my programming to be as interactive and repl-friendly as possible. but specifically now, i need to understand what / with what a method is getting monkey-patched when i invoke a feature in my app
<niklasb> sohocoke: so for debugging reasons?
<sohocoke> it would be nice to flag an option at some point to have the proc have the text dangling or so after jit
<niklasb> sohocoke: hm, that's a tough one.
BrokenCog has joined #ruby
<banisterfiend> sohocoke: what's wrong with sourcify exactly
<sohocoke> yeah, for now. but in general i never understood why the source is so divorced from the objects and classes, despite the lisp influence
<sohocoke> sourcify needs the source file.. and it won't work with my ruby
<banisterfiend> sohocoke: what version of ruby?
<sohocoke> macruby head
<sohocoke> :P
<banisterfiend> yeah, stupid macruby doesnt even have source_location
<Tasser> it's compiled n shit
ElitestFX has joined #ruby
ElitestFX has joined #ruby
<banisterfiend> i got pry working on macruby once, but it was so crippled it could barely do anything
<sohocoke> know the method name that compiles the proc? would like to hack quickly if someone can help me find the right place
<niklasb> sohocoke: "hack quickly" is probably not quite fitting here
<sohocoke> banisterfiend: you should push that stuff to github and let people like me scavenge on it
gen0cide_ has joined #ruby
<sohocoke> niklasb: it is quite fitting here. i won't submit a patch to ruby core
<epochwolf> Octopress/jekyll question (no one responded in #octopress): Is there a way to filter out blog posts with a certian category from the atom feed and from the blog index?
<niklasb> sohocoke: I meant a "quick hack" is probably not sufficient to solve your problem
<niklasb> not that it's off-topic :)
<sohocoke> if i have the parser input or output as a whole i can just attach that to the proc before returning
<niklasb> sohocoke: good luck
FACEFOX has joined #ruby
nari_ has joined #ruby
prometheus has joined #ruby
prometheus has joined #ruby
fayimora has joined #ruby
davidpk has joined #ruby
dkissell has joined #ruby
sako has joined #ruby
brianpWins has joined #ruby
FACEFOX has joined #ruby
sebastorama has joined #ruby
davidcelis has joined #ruby
Emmanuel_Chanel has joined #ruby
adac has joined #ruby
dfamorato has joined #ruby
lewis1711 has quit [#ruby]
emmanuelux has joined #ruby
cespare has joined #ruby
cbuxton has joined #ruby
moshee has joined #ruby
moshee has joined #ruby
frishi has joined #ruby
snip_it has joined #ruby
nif has joined #ruby
sarmiena_ has joined #ruby
skrewler has joined #ruby
kenperkins has joined #ruby
TheIronWolf has joined #ruby
machine2 has joined #ruby
wroathe has joined #ruby
<wroathe> From ruby's point of view is there any difference between this constant USERNAME and this constant Username?
<davidpk> Yes
<wroathe> Difference being?
<davidpk> [49] pry(main)> USERNAME = 'hello'
<davidpk> => "hello"
<davidpk> [50] pry(main)> Username
<davidpk> NameError: uninitialized constant Username
<banisterfiend> davidpk: USERNAME
<banisterfiend> oh
<banisterfiend> sorry
<banisterfiend> didnt read :)
<wroathe> Oh, I didn't mean in terms of them being the same name for something. I was wondering if USERNAME indicates something different than it's camelcased alternative.
<wroathe> Technically you could do something like class USERNAME I believe
<davidpk> Yeah, though in most cases it's good style to use mixed case for class names
<davidpk> and all-caps for actual constant data
<wroathe> Yeah, I felt like that was a convention but I just wanted to confirm.
<wroathe> I've seen people do stuff like this in code PriorityThreshold = 750