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/
<andreassaebjoern> I'am then changing convention
hadees_ joined #ruby
RubyPanther joined #ruby
<andreassaebjoern> I'am now going to require the class names to be capitalized properly. Case-insensitivity in the DSL is just posing too much trouble
workmad3 joined #ruby
emmanuelux joined #ruby
WhiteHorse joined #ruby
Fraeon joined #ruby
headius joined #ruby
steph021 joined #ruby
steph021 joined #ruby
youlysses joined #ruby
youlysses left #ruby
thoolihan joined #ruby
sorin joined #ruby
csavola joined #ruby
Banistergalaxy joined #ruby
linduxed joined #ruby
otherj joined #ruby
nerdy_ joined #ruby
tomzx joined #ruby
strife25 joined #ruby
luckman212 joined #ruby
josemota joined #ruby
<linduxed> so if i've got a class that called Proxy, and has only got the lines "def initialize(target_object)", "@object = target_object", "end"
<linduxed> how come that this is a working proxy?
<linduxed> or well, at least the start of it?
<linduxed> this is something that i totally don't understand
<linduxed> is there some magic to the @object variable?
<linduxed> does every object have a @object variable, and that's why magic happens?
sythe_ joined #ruby
<linduxed> oh and btw, by proxy i meant that i would be able to do a tv = Proxy.new(Television.new) and then send commands like tv.power or tv.channel = 10 when Proxy hasn't got a thing in it, it's the Television class that's got all of the info
Manhose_ joined #ruby
<josemota> hey guys, I have a model with two associations of a common ActiveRecord class. Is this situation (http://pastie.org/2988679) normal or is it a bug?
bbrandon joined #ruby
Manhose__ joined #ruby
<bbrandon> What does a ruby hash/array look like. a = [{'yes','no'},{'true','false'}]?
<shevy> bbrandon almost
<shevy> the [] part for array is correct
<shevy> oh
<shevy> interesting
<shevy> seems the other part is correct (???) as well
<shevy> IRB turns it into this though [{"yes"=>"no"}, {"true"=>"false"}]
wyhaines joined #ruby
r0bby joined #ruby
Brandonn joined #ruby
<Brandonn> !!!! shevy: i timed out, sorry
<Brandonn> did you explain the solution?
<Brandonn> ^^
<shevy> Brandonn the [] part for array is correct, the other part should be [{"yes"=>"no"}, {"true"=>"false"}], but oddly enough it seems your version works too
<Brandonn> my version doesn't seem to work with 1.9.2
<shevy> good!
<shevy> I find it confusing
ixti joined #ruby
<shevy> {"yes"=>"no"} should work in 1.8.x and 1.9.x
bwlang joined #ruby
<linduxed> could someone shed light on my issue?
<Brandonn> which version does my way work in?>
<linduxed> or well, not issue... lack of knowledge
<shevy> Brandonn, I am on ruby 1.8.7 and both ways work here apparently
<shevy> Brandonn, where did you see {'yes','no'} ?
jbw joined #ruby
<Brandonn> shevy: 1.9.2
<shevy> No I mean
<Brandonn> shevy: oh, i guessed
<shevy> did you find this yourself or did you read it somewhere?
<shevy> aaah weird
<Brandonn> shevy: one more thing, how would I access 'false'?
<Brandonn> shevy: a[1] something?
<shevy> a is your array right?
<shevy> so if you do:
<shevy> a[1] you access the second element of the array. right?
<Brandonn> yes
<shevy> ok then look at the second element of the array you have
<shevy> [{"yes"=>"no"}, {"true"=>"false"}]
<shevy> the , separates the elements
<shevy> so a[0] is {"yes"=>"no"}
<Brandonn> a[1][1]
<shevy> and a[1] is {"true"=>"false"}
<shevy> that is better but still not working
<shevy> a[1][1] would work if you have an array in an array
<shevy> but you have a hash in an array
<Brandonn> a[1]{1}!
<shevy> Brandonn, to access a hash value, you must pass the key
<shevy> a[1]['true']
<Brandonn> doh!
<shevy> but this is a fucked up data structure really :P
<shevy> you really need the array?
<shevy> a hash alone seems easier
<shevy> a['yes']
<Brandonn> looking at doing [{},{}].sample
<Brandonn> need an array in an array
<Brandonn> you're right, this isn't correct
<Boohbah> anyone here done chess ai in ruby?
<Boohbah> or is this a silly thing to do because it's not C/C++?
sbanwart joined #ruby
<Brozilla> linduxed, i think you just want to do foo = Television.new there ?
<Brandonn> shevy: thanks, i've got it all figured out. i was scared of [[],[]]
<linduxed> Brozilla: well the idea in my assignment is to demonstrate the possibility to create a Proxy class through which i can send commands
<shevy> Boohbah it should work in any language
<shevy> AI sounds difficult thoug
<Brozilla> extend it? like Proxy < Television.
<Brozilla> *class Proxy < Television; [code/nothing]; end
<Boohbah> shevy: i was also thinking about distributed processing... just throw a bunch of nodes at the problem :)
<shevy> hehe
<shevy> funny that you mention chess
<shevy> I am playing on http://en.lichess.org/
<Boohbah> shevy: there is this very helpful site http://chessprogramming.wikispaces.com/
<shevy> I've won against AI 1 and AI 2
<shevy> played against AI 3 about 50 times so far and always lost :(
<TandemAdam> haha, did everyone see trollscript https://github.com/tombell/trollscript
sbanwart joined #ruby
lduros joined #ruby
lduros left #ruby
<linduxed> TandemAdam: because brainfuck wans't bad as it was....
<TandemAdam> linduxed: :P
<shevy> trooloolooloo
<linduxed> well at least it's turing complete, so i guess it's good for something
<shevy> ^^^ that is the beginning of Fibonacci
<shevy> turing is overrated
<shevy> matz > turing
<Boohbah> Brainfuck in One Line of Python
<Boohbah> lol!
sbanwart_ joined #ruby
<Banistergalaxy> Lol at one line
<Banistergalaxy> That isn't one line;)
<TandemAdam> hehe, hey how would I run the trollscript hello-world in irb? me=noob
<TandemAdam> i know I need to install the gem, but then what?
<TandemAdam> do I do a require or something?
PaciFisT joined #ruby
BrenoPerucchi joined #ruby
<Boohbah> Banistergalaxy: word wrap
bbrandon joined #ruby
akem joined #ruby
akem joined #ruby
pen_isident joined #ruby
Zanacross joined #ruby
Norrin joined #ruby
nerdy_ joined #ruby
<zykes-> what's the diff on a rails app and a passenger app ?
kingfishr_ joined #ruby
conor_ireland joined #ruby
kingfishr_ joined #ruby
<Boohbah> TandemAdam, i just found the answer and you left! :(
<Boohbah> wget -q -O- https://gist.github.com/1205800 | grep trool | sed -e :a -e 's/<[^<]*>/ /g;/</{N;s/\n/ /;ba;}' | sed 's/^ *//;s/ *$//' | trollscript
yfeldblum joined #ruby
axilla joined #ruby
xkws49er joined #ruby
<blueadept> quick question here, if i have a variable i want to insert into a string, but it's nil, what would be the best way of converting it to empty string to get around the "convert to nil" error in ruby?
<xkws49er> best book for beginners?
Cervajz joined #ruby
jetblack joined #ruby
xkws49er left #ruby
sbanwart joined #ruby
rpowell joined #ruby
btanaka joined #ruby
<blueadept> nevermind, figured out its .to_s
<blueadept> thats fairly easy
<blueadept> seems like the solution to everything in ruby is to_x
<ReinH> blueadept: "#{ thing }"
<ReinH> assuming that isn't the only thing in the string
<ReinH> use #{} for interpolation
<blueadept> ah
<blueadept> i see
<ReinH> (don't use it just for to_s conversion)
<davidcelis> zykes-: try #rubyonrails
<davidcelis> blueadept: to_x isn't just a ruby thing
<davidcelis> it's common in most OO languages
<blueadept> true
<blueadept> i'm coming to ruby from coffeescript
<blueadept> for most people its the other way around
<davidcelis> lol..
<davidcelis> that is a strange progression
<blueadept> i know right
<blueadept> i just picked up coffeescript/javascript as my first language sorta
<blueadept> but now i'm beginning to work on bigger projects that have a mix of all sorts of server side langauges, so i need to get into the mix
<blueadept> i did stuff in school, but that doesn't really count
esparkman joined #ruby
esparkman joined #ruby
luckyruby joined #ruby
savage- joined #ruby
luminare joined #ruby
emmanuelux joined #ruby
keithpitt joined #ruby
nari joined #ruby
emmanuelux joined #ruby
dbgster joined #ruby
adambeynon joined #ruby
pen_isident joined #ruby
<mksm> there should be a way to forbid ruby to look into gems dir
rickmasta joined #ruby
kenperkins joined #ruby
jay_zawrotny joined #ruby
<iamjarvo> whats a solid book or tut to get a grasp of oop/oop with ruby
n3m joined #ruby
d2dchat joined #ruby
ggtoo joined #ruby
emmanuelux joined #ruby
Banistergalaxy joined #ruby
sorin joined #ruby
epochwolf joined #ruby
emmanuelux joined #ruby
davidcelis joined #ruby
banisterfiend joined #ruby
mxweas_ joined #ruby
igotnolegs joined #ruby
bwlang joined #ruby
emmanuelux joined #ruby
h4mz1d joined #ruby
mikeycgto_ joined #ruby
JakeyChan joined #ruby
SolarisBoy joined #ruby
teej_m joined #ruby
mickn joined #ruby
andreim joined #ruby
jetblack joined #ruby
<andreim> hello, when I'm reading a file with .readlines or .each, I get 2 new lines instead of each new line :/ any ideas?
Evixion joined #ruby
huismon joined #ruby
replore joined #ruby
roaminghorse joined #ruby
<envygeeks> iamjarvo: One line -- Ruby is OOP, everything is an Object. That is all.
<iamjarvo> envygeeks: true
roadze joined #ruby
<davidcelis> iamjarvo: being OOP doesn't mean everything is an Object
<davidcelis> (but yes, that's true for Ruby)
<davidcelis> er, that was at envygeeks
<iamjarvo> davidcelis: but me just using ruby would give me a grasp at patterns and what not for oop?
<envygeeks> if you mean what PHP programmers consider "OOP" clases and Modules then that isn't a hard thing to really grasp other then unlike PHP (I don't remember if this is possible with PHP) you can strap it to self so you don't need to instance (like a struct), you don't need self, @ is instance, @@ is class
<davidcelis> iamjarvo: you can learn OO design patters from any OOP language
mickn joined #ruby
<davidcelis> but of course we're going to advocate Ruby... this is #ruby
<davidcelis> what do you think we're gonna tell you to use... python? java? HAHAHAH
<iamjarvo> yep i understand
<iamjarvo> lol no
<envygeeks> I would tell you to use Python if it's fit for the job
<envygeeks> I'm not a single language elitist
<andreim> hello, when I'm reading a file with .readlines or .each, I get 2 new lines instead of each new line :/ any ideas?
<davidcelis> envygeeks: "learning object oriented design patterns" isn't really a "job" though, hence why any language works for it
<davidcelis> andreim: gist what you're doing
vitoravelino joined #ruby
<envygeeks> davidcelis: that's more of an opinion more than fact
<andreim> @file['content'] = open(textfile) in the controller
<davidcelis> envygeeks: it's an opinion that any OOP language would suffice to learn OO design patterns? wut...
<envygeeks> yes, because IMO you are confusing modular programming with OOP tbh
<davidcelis> man i dont even know what the main topic we're discussing is
<davidcelis> i came in during the middle
<davidcelis> the first message i got in this channel was "One line -- Ruby is OOP, everything is an Object. That is all." lol
<envygeeks> well first before we can even answer truthfully we have to know what he considers OOP
<envygeeks> >.<
<envygeeks> so what do you consider OOP iamjarvo
<andreim> davidcelis: so actually I get an array with each line PLUS \r\n
<andreim> so this is where it's from
<andreim> but how should I do this then?
<teej_m> Hey #ruby ! I've got a weird problem. My eventmachine instance keeps mysteriously killing itself without throwing an error, I'm not sure whats going on
<davidcelis> andreim: not really sure, to be honest, it would help to see what's in that file, and what the output of that code is
<andreim> can I pm?
<mksm> teej_m: is it suicidal?
ggtoo joined #ruby
<teej_m> mksm: seems so, heh
<envygeeks> sometimes even machine gets suicidal no lie, my heroku evenmachine sometimes just suicides, no reason what at all in the logs it's just 'screw you, I'm done for now'
vtr joined #ruby
<teej_m> hmm. Is there anything I can do (perhaps if I detect a mass-disconnect happening) to try to figure out what's happening as it goes down?
h4mz1d joined #ruby
<mksm> i have almost no experience with em :D
<iamjarvo> well guys
<teej_m> mksm: that's okay.
Behi joined #ruby
<iamjarvo> i dont have much experience with oop, but i would say classes and patterns and thought processes to solve problems (davidcelis envygeeks)
<iamjarvo> if that makes any sense
<envygeeks> yeah that's more modular programming IMO
<iamjarvo> i guess i mainly want to learn abstraction
kassien joined #ruby
<davidcelis> abstraction is not really restricted to one type of programming
<mksm> teej_m, i'm guessing an exception is raised and bring everything down. Something like a raise inside a thread would kill the Thread but you'll only see if you have Thread.abort_on_exception=true
bbrandon joined #ruby
kassien joined #ruby
<iamjarvo> i see
<iamjarvo> davidcelis: we have sure been chatting back and forth in the last couple days haha
<davidcelis> i spend too much time on the computer
<iamjarvo> lol
<mksm> don't we all?
<iamjarvo> envygeeks: ruby is mentioned in the modular programming article on wiki
kassien joined #ruby
<envygeeks> yes, things like abstract classes (which I don't know if I would ever do in Ruby anyways), classes, modules and what some PHP programmers call "OOP" is really modular programming
<teej_m> mksm: interesting. I'll go ahead and double check to see if that's being set in my app/libraries anywhere.
andreim left #ruby
<teej_m> mksm: My first thought was that I was perhaps running out of file descriptors and that was crashing the app, but I couldnt find anywhere online that documented that happening
kassien joined #ruby
<envygeeks> you'd see that in your kern.log if you're on Linux
<teej_m> hrm, it's empty. Must not be that.
keithpitt joined #ruby
kassien joined #ruby
<mksm> teej_m, i think em uses a few threads so Thread.abort_on_exception might help as the entire script will halt with a raise inside a thread
ryanf joined #ruby
kassien joined #ruby
wyhaines joined #ruby
RubyPanther joined #ruby
kawa_xxx joined #ruby
Samoi joined #ruby
Samoi joined #ruby
flip_digits joined #ruby
<teej_m> mksm: Thanks for the guidance
kawa_xxx joined #ruby
flip_digits joined #ruby
jwmann joined #ruby
JakeyChan_ joined #ruby
bwlang joined #ruby
emmanuelux joined #ruby
jman217 joined #ruby
sodani joined #ruby
<sodani> wondering if someone can help me with this. I have a hash of arrays like this {a => [], b => []}. how I can get the cumulative size of all the arrays?
mdel joined #ruby
<ryanf> hsh.map { |k, v| v.length }.reduce(:+)
ggtoo joined #ruby
<mksm> would there be a clean way to use mutex with an object for exclusive access beside initializing a mutex and then adding #synchronize everywhere?
banisterfiend joined #ruby
vtr joined #ruby
zodiak joined #ruby
emmanuelux joined #ruby
bwlang joined #ruby
brownies joined #ruby
linoj joined #ruby
<ryanf> you could probably find some clever way of wrapping all of the object's methods with synchronization logic
<ryanf> e.g., using Class#instance_methods and alias
<ryanf> might not be worth it though
<banisterfiend> sounds nerdy
<ryanf> inorite
roaminghorse joined #ruby
freuderico joined #ruby
jman217 left #ruby
Draco_ joined #ruby
Samoi joined #ruby
Samoi joined #ruby
rpowell joined #ruby
SirFunk joined #ruby
dasfugufish joined #ruby
alagu joined #ruby
yangchenyun joined #ruby
andrewhl joined #ruby
roaminghorse joined #ruby
x0F_ joined #ruby
vtr joined #ruby
emmanuelux joined #ruby
dagnachewa joined #ruby
tomzx joined #ruby
radic joined #ruby
headius joined #ruby
emmanuelux joined #ruby
vtr joined #ruby
banisterfiend joined #ruby
LiquidInsect joined #ruby
<skillachie> Hi guys
<skillachie> just wondering if someone could tell me if i am doing something wrong
<skillachie> using poppler and ruby. Currently gets all the major chapters
adeponte joined #ruby
<skillachie> however when i try to get the sub chapters/child, it does not print any output
emmanuelux joined #ruby
<skillachie> and based on the child method it should just create another IndexIter
dickbutt joined #ruby
WhiteHorse joined #ruby
skinnymuch joined #ruby
jimmy1980 joined #ruby
emmanuelux joined #ruby
<dickbutt> http://pastie.org/2989408 halp halp i dont understand
CannedCorn joined #ruby
amacgregor joined #ruby
emmanuelux joined #ruby
emmanuelux joined #ruby
p0y joined #ruby
PaciFisT joined #ruby
emmanuelux joined #ruby
Nisstyre joined #ruby
banisterfiend joined #ruby
manizzle joined #ruby
hadees joined #ruby
looopy joined #ruby
rippa joined #ruby
apok joined #ruby
randym joined #ruby
LittleBill902 joined #ruby
wyhaines joined #ruby
pen joined #ruby
hadees_ joined #ruby
<GSpotAssassin> dickbutt: that's a good one
dnjaramba joined #ruby
LittleBill902 joined #ruby
badabim joined #ruby
<mksm> puts returns nil
sodani left #ruby
tomzx joined #ruby
kawa_xxx joined #ruby
vtr joined #ruby
bbrandon joined #ruby
LittleBill902 joined #ruby
alagu left #ruby
<dickbutt> GSpotAssassin: it was not joke
Clooth joined #ruby
looopy joined #ruby
<dickbutt> if i say "10.times {puts 10}"
<Clooth> nice nick
<dickbutt> i get 10 ten times, but if i say arg1.times {call arg2} within a function, it only calls arg2 once
<dickbutt> arg2 being a separate function and arg1 being a number above 1
Draco_ joined #ruby
LittleBill902 joined #ruby
Seisatsu joined #ruby
LittleBill902 joined #ruby
<rippa> what's "call" ?
raythecat joined #ruby
bigkm joined #ruby
LittleBill902 joined #ruby
<dickbutt> i meant {arg2} which calls whatever function was passed
ryanf joined #ruby
vtr joined #ruby
robyurkowski joined #ruby
SolarisBoy left #ruby
Beoran_ joined #ruby
luckyruby joined #ruby
tonini joined #ruby
flak joined #ruby
youlysses joined #ruby
youlysses left #ruby
Cervajz joined #ruby
nadirvardar joined #ruby
Banistertab joined #ruby
<Banistertab> Sup sup
LittleBill902 joined #ruby
PaciFisT joined #ruby
<Banistertab> Yo yo yo
TomJ joined #ruby
LittleBill902 joined #ruby
<ryanf> hi hi hi
bosphorus joined #ruby
p0y joined #ruby
LittleBill902 joined #ruby
r0bby joined #ruby
stayarrr joined #ruby
LittleBill902 joined #ruby
dbernar1 joined #ruby
LittleBill902 joined #ruby
hadees joined #ruby
shaatar joined #ruby
hamstu joined #ruby
skinnymuch left #ruby
vtr joined #ruby
vtr joined #ruby
Targen joined #ruby
LittleBill902 joined #ruby
io_syl joined #ruby
io_syl joined #ruby
abstrakt joined #ruby
<abstrakt> is before_somemethod :someothermethod a part of ruby or rails? as in http://stackoverflow.com/questions/3197635/how-do-i-run-code-before-and-after-a-method-in-a-sub-class
jimmy1980 joined #ruby
rickmasta joined #ruby
yxhuvud joined #ruby
roadze joined #ruby
nadirvardar joined #ruby
quest88 joined #ruby
<davidcelis> That stackoverflow question has nothing to do with Rails. What does that tell you?
maletor joined #ruby
ghosTM55 joined #ruby
vitoravelino__ joined #ruby
rpowell joined #ruby
otakutomo joined #ruby
TandemAdam joined #ruby
TandemAdam left #ruby
p0y joined #ruby
tk_ joined #ruby
lucasgonze joined #ruby
JohnBat26 joined #ruby
warlock_handler joined #ruby
dida joined #ruby
asQuirreL joined #ruby
<dida> how to get user input (prompt) from command line?
<dida> pry(main)> grade = gets.chomp
<dida> Errno::EISDIR: Is a directory - .
<dida> from (pry):10:in `gets'
<dida> should I require something?
<dida> search results pointed me to gets
<burgestrand> dida: it’s gets; what version of pry are you using?
zhl joined #ruby
<dida> irb also give the same error
<burgestrand> ^.-
xpot joined #ruby
<dida> burgestrand: Pry version 0.9.3 on Ruby 1.9.2
ggtoo joined #ruby
ryanf joined #ruby
p0y joined #ruby
<burgestrand> Yeah if if it does not work in IRB something else is awry
<dida> any idea what should I check?
<burgestrand> dida: in pry, what does method(:gets) show you?
<dida> => #<Method: Object(Kernel)#gets>
<burgestrand> Weird. Since it wasn’t working, I was thinking perhaps you had something overriding it.
<burgestrand> dida: try Kernel.gets instead of just gets; see if that gets you working
<dida> Kernel.gets
<dida> Errno::ENOENT: No such file or directory - -I
<dida> from (pry):1:in `gets'
<burgestrand> :d
jimmy1980 joined #ruby
<burgestrand> dida: how’d you install ruby?
<dida> rvm
djdb joined #ruby
<burgestrand> dida: googled a bit, appears to be some rare issue that happens people at times, first time I’ve seen it in here though
<burgestrand> dida: do you have any irb enhancements with ~/.irbrc?
dotsolo joined #ruby
andrewhl joined #ruby
<burgestrand> Ah. I’m stupid.
<dida> ya i have some settings
hbien joined #ruby
<dida> in ~/.ribrc
<burgestrand> dida: you have something touching ARGV?
<burgestrand> dida: anyhow, $stdin.gets should work, Kernel.gets is a bit special
GoBin joined #ruby
<dida> burgestrand: yeah. ARGV.concat [ "--readline", "--prompt-mode", "simple" ]
<burgestrand> dida: Kernel.gets has this special behaviour that if you give any parameters when starting ruby (or, adjust the parameters at runtime like you do with ARGV there), gets will interpret them as paths to files and try to read lines from them
<burgestrand> dida: that’s why you’re getting the error
<dida> ah, i see
<burgestrand> dida: so, $stdin.gets will instead invoke IO#gets on $stdin, and bypass that behaviour from Kernel.gets
dickbutt left #ruby
bluOxigen joined #ruby
<dida> burgestrand: Thanks!
andreim joined #ruby
<andreim> hello there, I have an optimization question, I am doing a lot of if bla == "bla" then foo = "value", elsif bla == "lala" then foo = "othervalue", etc for 15 values. is there any way to make it more beautiful?
ryanf joined #ruby
bluOxigen joined #ruby
<burgestrand> andreim: put the "bla" and "values" into a hash
<andreim> burgestrand: how so? how would I make a condition out of that?
<burgestrand> andreim: given by the example you gave there’s no need to, just assign foo = hash[bla]
jay_lee joined #ruby
<andreim> burgestrand: to be sure, this is my code: http://linx.li/code/1c5a9c7aa9d40f32.rb.html
<burgestrand> Yeah, would definitely make a hash out of data.
<burgestrand> … that.
<andreim> :( I don't understand, how would the if one is this, then the other is that work?
<shevy> andreim for a first change, turn this if/elsif into a case/when
<andreim> oh
<shevy> this way, you get rid of all "ext ==" instances"
Morkel joined #ruby
<andreim> so how do I make it? case ext when hash[:part1 then hash[:part2]?
<andreim> :/
<burgestrand> andreim: http://codepad.org/MiSv3O07
<shevy> dunno if you really need a hash
<andreim> that's syncronization
<andreim> shevy: my goal is to get rid of all those lines
<andreim> I think burgestrand nailed it
<andreim> it looks very nice
<shevy> well, you don't have to use @lang = either
<andreim> thank you
otakutomo joined #ruby
jr00n joined #ruby
Wroathe_ joined #ruby
batlock666 joined #ruby
bluOxigen joined #ruby
adeponte_ joined #ruby
replore joined #ruby
<skillachie> hi guys
<skillachie> I am having some problems using poppler and ruby. I can get poppler to print all the major table of contents of a pdf book
<skillachie> but cant get it to print the sub headings
<skillachie> from my understanding the child instance method should just create a new Poppler::IndexIter
<skillachie> and from there I would assume that, the same action.title methods would be used to print the name of the sub headings withing that chapter
ph^ joined #ruby
mafolz joined #ruby
workmad3 joined #ruby
Wroathe joined #ruby
_debo joined #ruby
trivol joined #ruby
abstrakt joined #ruby
enikar joined #ruby
kreantos joined #ruby
<skillachie> :(
p1d joined #ruby
jimmy1980 joined #ruby
pi3r joined #ruby
nari joined #ruby
headius joined #ruby
Wroathe joined #ruby
mxweas_ joined #ruby
Brandonn joined #ruby
bosphorus joined #ruby
sandstrom joined #ruby
sandstrom joined #ruby
demian`_ joined #ruby
poppiez joined #ruby
nopper joined #ruby
cyri_ joined #ruby
jbpros joined #ruby
sepp2k joined #ruby
Jrz joined #ruby
<warlock_handler> hi guys.. is there a ruby wrapper / lib for http://cmusphinx.sourceforge.net/wiki/
ognevsky joined #ruby
timonv joined #ruby
ggtoo joined #ruby
<warlock_handler> or else is there any speech to text lib in ruby
Cervajz_ joined #ruby
ph^ joined #ruby
negaduck_ joined #ruby
BiHi joined #ruby
<Wroathe> I'm finding that I really really like ruby :)
mxweas_ joined #ruby
banisterfiend joined #ruby
nicoulaj joined #ruby
james_cotterill joined #ruby
hurikhan|Work joined #ruby
havenn joined #ruby
ph^ joined #ruby
jr00n joined #ruby
Ammar_Frameworks joined #ruby
Ammar01 joined #ruby
Ammar01 joined #ruby
ggtoo joined #ruby
Mon_Ouie joined #ruby
bastilian joined #ruby
james_cotterill joined #ruby
adambeynon joined #ruby
ognevsky_ joined #ruby
nari joined #ruby
ognevsky joined #ruby
ognevsky joined #ruby
cafesofie joined #ruby
pen joined #ruby
<shevy> Wroathe why
<shevy> warlock_handler dont think so but who knows
<shevy> we need more high quality libraries in ruby
bbrandon joined #ruby
pigoz joined #ruby
BrianE joined #ruby
<warlock_handler> shevy: hmmm ya... someone has to make it :P :D
<Wroathe> shevy: In the scheme of things I'm still in very formative years as a programmer. I've hit that sweet spot where I can perform most tasks with a variety of languages. Ruby is fun because it combines a lot of the utility of Python with a special brand of syntactical sugar.
<warlock_handler> Wroathe: haha in that case.. please write us a wrapper in ruby for http://cmusphinx.sourceforge.net/wiki/
<Wroathe> warlock_handler: :P Feeling lazy
<warlock_handler> Wroathe: can u think of a better excuse for me that will convince you to write it :P
<shevy> people will write code for things they need
<shevy> hmm
<Wroathe> warlock_handler: How about something like, "I'll provide you with salary and benefits."
apok joined #ruby
<shevy> and for bindings it requires knowledge of the language in question, like C I suppose
<shevy> Wroathe how long have you been using python?
<warlock_handler> Wroathe: I am a student.. how about I would share my lunch box with you?
<Wroathe> shevy: About 4 years.
<Wroathe> warlock_handler: I like lunch.
poppiez joined #ruby
<warlock_handler> Wroathe: so.. do we have a deal...
<shevy> Wroathe that's quite a long time
<shevy> I think I have been using Ruby since about ... 5 or almost 6 years
vitoravelino__ joined #ruby
<shevy> I wanted to dive deeper into python and start writing several scripts, and add to them incrementally, but the transition to python 3.x annoys me. I'll wait until the dust has settled.
dazoakley joined #ruby
<warlock_handler> i initially thought of python.. only because all (or at least major) of Ubuntu development is python
<Wroathe> I started getting interested in Ruby after taking on a small Rails project a while back.
<warlock_handler> programs etc
<Wroathe> And then I read through Why's Poignant Guide...
<Wroathe> Guy's hilarious.
roaminghorse joined #ruby
<warlock_handler> Wroathe: dude you should try Meta programming in Ruby.. thats agood book as well
<Wroathe> I'll look into it.
<Wroathe> Right now I'm reading through a book on Algorithm design...
<poppiez> I have a string where I want to search for a certain pattern and build an array of all the matches. can anyone point me in the right direction?
Clooth joined #ruby
<Wroathe> myarray = mystring.scan(/^$/)
<warlock_handler> poppiez: i think you can do a string.split(/ /)
<shevy> yeah .scan
workmad3 joined #ruby
bluOxigen joined #ruby
xec joined #ruby
<poppiez> ah, nice, thx :)
jay_zawrotny joined #ruby
BiHi_ joined #ruby
pixie79 joined #ruby
ggtoo joined #ruby
nuba joined #ruby
<pixie79> hi, what is the best way to remove a '\' if it appears at the end of a line all the way through a file, prefrible as a one liner
<pixie79> I am trying to convert one wiki markup to another, from mac to markdown
<banisterfiend> pixie79: "prefrible" srsly?
<Wroathe> Haha
<Wroathe> banisterfiend: Spelling and correct punctuation are not necessary to program effectively!
<pixie79> thanks, spelling is not my best option
<benj_> pixie79, .gsub(/\\$/, '')
Johnny_mobme joined #ruby
<pixie79> benj_: thanks
speggey_ joined #ruby
<poppiez> how do you duplicates from an array?
NARKOZ joined #ruby
<pigoz> poppiez: [1,2,3,4,2,2,2].uniq
<NARKOZ> how to power a float value in ruby? getting this error: NoMethodError: undefined method `^' for 0.0166666666666667:Float
<benj_> NARKOZ, the operator is **
<benj_> ^ is a completely different operator
<banisterfiend> benj_: which operator do u prefer
<poppiez> pigoz: thx! :)
bbrandon joined #ruby
jimmy1980 joined #ruby
ramusara joined #ruby
Behi joined #ruby
Hellojere joined #ruby
bbrandon joined #ruby
jimmy1980 joined #ruby
ph^ joined #ruby
bluOxigen joined #ruby
bluOxigen joined #ruby
WhiteHorse joined #ruby
bluOxigen joined #ruby
<benj_> banisterfiend, whichever is smoother
looopy joined #ruby
iocor joined #ruby
vitoravelino joined #ruby
rpowell joined #ruby
timonv joined #ruby
jr00n joined #ruby
Jrz joined #ruby
yfeldblum joined #ruby
<banisterfiend> benj_: ** is like silk
kawa_xxx joined #ruby
dnjaramba joined #ruby
rpowell joined #ruby
Manhose joined #ruby
jr00n joined #ruby
jr00n joined #ruby
Wroathe left #ruby
mmokrysz joined #ruby
peterwald joined #ruby
mmokrysz left #ruby
Manhose_ joined #ruby
berkes joined #ruby
dark3rdre4ms joined #ruby
dark3rdre4ms joined #ruby
ognevsky_ joined #ruby
Silker joined #ruby
gayasentinel joined #ruby
xissburg joined #ruby
<NARKOZ> 25/100 returns 0
<Clooth> 25.0/100.0
<shevy> NARKOZ 25/100.0 # => 0.25
Manhose joined #ruby
kennethreitz joined #ruby
jamesl__ joined #ruby
<jamesl__> hi
<warlock_handler> would you consider ruby as a scripting language???
<rippa> it is a scripting language
kennethreitz joined #ruby
<jamesl__> I'm using a @array.select{..} inside a loop and I'm getting the following error: private method `select' called for nil:NilClass (NoMethodError), however it works outside the loop. I'm not loopin through those elements. Why is this?
<banisterfiend> jamesl__: @array is nil
<jamesl__> oh, why is it nil inside the loop.. ?
peterwald joined #ruby
<banisterfiend> jamesl__: i cant tell u until you show some code
randym joined #ruby
fermo joined #ruby
Samoi joined #ruby
<shevy> warlock_handler yeah, though the whole world can be "scripted"
<warlock_handler> shevy: hahahah
<jamesl__> banisterfiend: basically @array is not nil before the loop and contains an array of objects. Then I loop using hpricot: doc.at('someelement') do puts @array.select{|a| a.attr=somevalue}.first.inspect end
<warlock_handler> I somehow feel offended when someone says ruby is just a scripting language
<jamesl__> I can execute the same @array.select code before the loop and it works...
sandstrom joined #ruby
<banisterfiend> jamesl__: im guessig it's due to instance_eval
<shevy> warlock_handler I dunno, I think it is more a family term, an umbrella term... like, for me, Perl PHP Ruby Python... they are all brothers and sisters in the scripting language family
<shevy> closer to one another than C C++ Java and so on
<jamesl__> banisterfiend: what should I do if that is the case ?
<jamesl__> I dont really understand why it is failing!
<banisterfiend> jamesl__: try array = @array outside the loop
<jamesl__> ok
<banisterfiend> jamesl__: then insidet he loop put: array.select {} etc
aibo joined #ruby
<warlock_handler> shevy: hmm may be...
<jamesl__> thanks banisterfiend, seems that it doesnt complain now.. However, after the loop if I change that variable, would it still remain changed ?
<jamesl__> I mean if I changed the variable inside the loop
<warlock_handler> shevy: i think its more cause ruby is build over c
<benj_> I wouldn't get offended about a term that doesn't mean much anyway
jgrimes joined #ruby
chrismcg joined #ruby
<shevy> warlock_handler well, I am waiting for the language that gives you the same amount of power as C gives you, but comes with a neat, cute, elegant syntax :)
<warlock_handler> shevy: i think everyones wait for that!!! :P
<shevy> hmm
<shevy> it's not really happening though
<shevy> all the new languages, like C# or D or Go ... they are so similar to C
<csmrfx> shevy: u can start with scheme, lisp or ocaml any day
<csmrfx> no need to wait
<shevy> but(when(will(I(have(an(elegant(syntax(in(scheme
<csmrfx> life is
nej joined #ruby
<shevy> csmrfx, I lost faith in scheme... http://myweb.cableone.net/gmcnutt/LOG
<csmrfx> and dont leave your ))))))))) laying around
<banisterfiend> jamesl__: ask csmrfx
<shevy> "Good enough. But then this:"
<shevy> "cd worlds/haxima-1.002
<shevy> nazghul start-new-game.scm"
<shevy> "Exploded in script errors. After an hour of fiddling I decided screw it. I'm rewriting haxima in python. Starting today."
<shevy> it was kinda interesting though, he wrote lots of little .scm files and they were kinda readable too
mikepack joined #ruby
<csmrfx> shevy nice logs
Helius joined #ruby
<csmrfx> jamesl__: dont ask, if you can IRB
<shevy> kern-log-enable #f
<shevy> was interesting to read through it :)
<jamesl__> csmrfx: right :)
<shevy> I should really try to write a game in ruby
Paladin joined #ruby
<csmrfx> shevy I dont get that style
<jamesl__> csmrfx: just found out, it actually changes the value. Thanks!
<csmrfx> imo the inn's should be able to make a list of their doors when necessary
<csmrfx> but meh, whatever
<shevy> yeah no idea
shaman42 joined #ruby
<shevy> I think making a complex game work right is hard work
<shevy> he also has new problems now with python
<shevy> :\
ikaros joined #ruby
<csmrfx> yes it is
<csmrfx> complexity is like a powerful stallion
<csmrfx> that you are riding, in a fog, in a forest
eldariof joined #ruby
ChampS_ joined #ruby
<csmrfx> give it one inch of leeway and you will find yourself face down in mud in the middle of fog with a huge bump on your head and your stallion (project) who knows where
Sliker joined #ruby
<shevy> hehe
<shevy> I get too angry. I want to kill the stallion with a knife.
<csmrfx> with games especially it (complexity) needs to be reined, well, aim for simple simple simple
<csmrfx> Ultimately it is you biting your own ass
<csmrfx> 8D
<shevy> my first game was a remake of kaisers, but I kept on adding features on features on top of it until things were chaotic. I tried to rewrite it but I lost all fun ... so it decayed to something unusuable :(
rallie joined #ruby
<csmrfx> I always end up with huge world simulations that cannot be run on current hardware no matter how you thread or split processing
Zimsky joined #ruby
<csmrfx> its the same on all levels of game making - object design, feature design, game design
<csmrfx> makes making movies look like something simpleminded apes can do
<shevy> yeah most movies these days are like that
<shevy> I usually like what Christopher Nolan does though
ali123456 joined #ruby
<csmrfx> well its a lot about production companies having one recipe that works, and just using that
<shevy> Other movies, like "Puss in Boots"... I don't understand the fuzz. Nothing new there, nothing particularly fascinating... at least Toy Story 3 was good and finished the whole saga
<shevy> yeah
ali123456 left #ruby
<shevy> same what happened to the gaming scene
<csmrfx> otoh game-making is the same, if you want to make a living, you have to identify what works and use that
<shevy> skyrim!
<csmrfx> everybody is talking abotu skyrim
<shevy> well, I am sure it works for them to generate revenues... but I miss the 1990s somewhat... :(
<banisterfiend> shevy: what was your fave game from the 90s
<banisterfiend> mine was little big adventure
<banisterfiend> or twisen's odyssey
ronniemlr joined #ruby
<shevy> banisterfiend I am not sure... too many to name, I think. I liked many of the old computer roleplaying games ... I liked Might and Magic 2-6 ... Ultima 3-7 ... Prince of Persia... battle isle 1-3 ...
<shevy> alone in the dark!
<shevy> populous...
cdepue joined #ruby
<shevy> oh
<banisterfiend> the 90s was also the decade of RS
<banisterfiend> RTS*
<banisterfiend> which seems to have died recently as a genre
<shevy> it was the first computer game where I felt that this was more a novel, than a game
<shevy> yeah, most everything died. except for ego-shooter style
<shevy> though I was impressed by assassin's creed
<shevy> but it's like ... 85% the same variant like The Witcher. they are all the same....
<csmrfx> thief
<csmrfx> ut
<csmrfx> mmm
traph1 joined #ruby
<banisterfiend> shevy: shadow of the colossus was a pretty original game, if you ever played it
<csmrfx> <3 soc
iocor joined #ruby
<banisterfiend> csmrfx: did you ever feel so lonely wanderng those enormous desolate landscapes
<banisterfiend> they wanted that i think, the contrast of the desolation/loneliness to the richness of the boss battles
dekroning joined #ruby
<shevy> never heard of shadow of the colossus
<shevy> somehow, when I read colossus ... it reminds me of that game... where you had to kill titans / giants
<shevy> oh
<shevy> Fallout 1 and Fallout 2 were also nice games back then
<banisterfiend> shevy: that is that game
<csmrfx> nature the atmosphere was definately delicate in soc
Morkel joined #ruby
<shevy> ah
fridim_ joined #ruby
<shevy> I remember that was something newish to me, running around to kill giants, rather than flapping dragons living in ... small caves ... :P
<shevy> but I never played it :(
<csmrfx> and I suppose the gameplay was just brilliant... I mean, when you are climbing on a huge titan without you feeling like you need to fiddle with the controller
<banisterfiend> csmrfx: how far did u get
<shevy> oh
<shevy> MechWarriors and Mech Commander were quite ok too
<csmrfx> banisterfiend: finished it many times
<banisterfiend> csmrfx: i coul dnever get past that colossus that was like a turtle
<csmrfx> I wish I was as good finishing my own games as other peoples
Morkel_ joined #ruby
<shevy> you mean, writing games?
<shevy> I even had a time where I tried to make a few simple games in ruby-gtk
<csmrfx> writing and coding
<banisterfiend> shevy: use gosu or ray
<shevy> I think I tried ray but something did not work
tvw joined #ruby
looopy_ joined #ruby
<csmrfx> ah well, back to the youtube mixer now
BiHi joined #ruby
<shevy> I try to work on projects only when I can sustain the fun in it
andrewhl joined #ruby
<shevy> otherwise, it just gets abandoned, decaying to a boring mess
Zimsky joined #ruby
Telling joined #ruby
JakeyChan joined #ruby
jimmy1980 joined #ruby
<JakeyChan> hi ? about the installing question
<JakeyChan> I install rails with sudo install rails
<JakeyChan> it tells me installed
<JakeyChan> but the command rails is not found
<csmrfx> I think youre supposed to gem install rails
<csmrfx> maybe #rails or #ror or #rubyonrails
Paladin joined #ruby
<shevy> yeah looks like he forgot "gem"
Brozilla joined #ruby
Cervajz_ joined #ruby
<JakeyChan> sudo gem install rails
<csmrfx> JakeyChan: I think you want to google up OS specific guide to installing rails
<shevy> hehe
nari joined #ruby
<JakeyChan> csmrfx: :(
<shevy> !
<shevy> does gem work JakeyChan
Behi_ joined #ruby
<JakeyChan> yeah, works property
<shevy> *properly*
<JakeyChan> I reinstall now
<JakeyChan> properly
<shevy> problems should be solved with little steps!
<JakeyChan> little steps ?
<banisterfiend> JakeyChan: does your milkshake bring all the boys to the yard?
<JakeyChan> :O
lorandi joined #ruby
<csmrfx> ot: soc looks real nice on ps3, banisterfiend http://www.youtube.com/watch?v=a_P1yqoQbk0#t=233s
<banisterfiend> csmrfx: you got the recently released HD version?
emmanuelux joined #ruby
Zimsky joined #ruby
nicoulaj joined #ruby
Zimsky joined #ruby
iocor joined #ruby
Zimsky joined #ruby
Paladin joined #ruby
<csmrfx> banisterfiend: No, I just remembered it might be cool to get that. otoh, I spent too much playing games :)
IrishGringo joined #ruby
Zimsky joined #ruby
Zimsky joined #ruby
wyhaines joined #ruby
senny joined #ruby
Zimsky joined #ruby
Zimsky joined #ruby
Zimsky joined #ruby
<shevy> hehe
beaknit joined #ruby
crooksey_ joined #ruby
Zimsky joined #ruby
crooksey_ left #ruby
sandstrom joined #ruby
sandstrom joined #ruby
bwlang joined #ruby
emmanuelux joined #ruby
Zimsky joined #ruby
mmokrysz joined #ruby
Zimsky joined #ruby
emmanuelux joined #ruby
Zimsky joined #ruby
<JakeyChan> hey, guys, what's the RDT of eclipse do you use for ruby ? Aptana radrails 2, is it?
nanderoo joined #ruby
emmanuelux joined #ruby
Zimsky joined #ruby
<csmrfx> I only use vim
Zimsky joined #ruby
<csmrfx> I even have my own test sys for tdd
MAD joined #ruby
ethndbst joined #ruby
amacgregor joined #ruby
Zimsky joined #ruby
yashaka joined #ruby
eeadc joined #ruby
manizzle joined #ruby
<JakeyChan> csmrfx: you are awesome man :D
<linduxed> could i take a simple rails question here?
<linduxed> or should i take it to #rails?
<JakeyChan> how about textmate for ruby development ?
<Brozilla> text mate is awesome for anything
<csmrfx> JakeyChan: got it working? :) dud I remember spending days on getting rails to work in 2008 and before
Gonzih joined #ruby
<JakeyChan> csmrfx: yeah, it working now, i remove the rails command file and reinstall then rails works :D
Guest1906 joined #ruby
<JakeyChan> csmrfx: let me think what I did when 2008, oh, in high school :D
emmanuelux joined #ruby
<csmrfx> gg... yeah, I'm a simple mang so I need simple stuff and eclipse and rails and all of those are too complicated for me :D
<JakeyChan> :D
Zimsky joined #ruby
roadze joined #ruby
emmanuelux joined #ruby
ph^ joined #ruby
tommyvyo joined #ruby
jtrudeau joined #ruby
gearaholic joined #ruby
tdubellz_ joined #ruby
Zimsky joined #ruby
p0y joined #ruby
Cervajz joined #ruby
pen joined #ruby
JonnieCache joined #ruby
tdubellz_ joined #ruby
linoj joined #ruby
bbttxu joined #ruby
<JakeyChan> ruby works on my computer :D
rippa joined #ruby
<JakeyChan> YEAH YEAH YEAH !!!
<JakeyChan> I can start it
<csmrfx> Imagine if you had a yaml templating language for making ruby gui's, with tk, gtk, what else?
<csmrfx> can you show me how?
<csmrfx> Or maybe just a simple object notation dsl. mygui.window = { button: { text: "open", onclick: open_dialogue() }, button: { text: "close", onclick: close_buffer } }
<csmrfx> Something anyone could plug in their ruby apps
muraii joined #ruby
tdubellz_ joined #ruby
_debo joined #ruby
Synthead joined #ruby
dazoakley joined #ruby
akem joined #ruby
akem joined #ruby
RomD` joined #ruby
asQuirreL joined #ruby
Paladin joined #ruby
dv310p3r joined #ruby
<shevy> csmrfx I had a similar idea
<shevy> to describe all GUI elements in an agnostic format
<shevy> rather than do:
<shevy> button = Gtk::Button.new('Bla bla click me')
<csmrfx> of course the library would need to do that
<shevy> but to also use this on the WWW
<csmrfx> I was thinking of empowering people with GUI
<shevy> :)
<csmrfx> thats what ruby needs
<csmrfx> or perhaps, those could also be parsed into your web app gui
<csmrfx> rails or sinatra or whatewa
Guest5749 joined #ruby
<shevy> yeah
<shevy> web apps are traditional quite text-heavy
<shevy> and the scrolling overflows to the bottom
<shevy> in a classical GUI you rarely see the need for a scrollbar
iamjarvo joined #ruby
<csmrfx> well, relative layouts are all the rage with html5
j-okta joined #ruby
WhiteHorse joined #ruby
ChampS_ joined #ruby
<shevy> although you can also do that easily with web stuff... you have those radiobuttons... input fields... and so on
mkscrg joined #ruby
<csmrfx> Or as "designers" call it: Responsive design
<shevy> I haven't spend much time with HTML5 yet
<shevy> But I feel as if there is more innovation coming from the web than from all the GUIs together
yfeldblum joined #ruby
<csmrfx> It's just GUIs
<csmrfx> over web or local, what eva
ggtoo joined #ruby
dyer joined #ruby
Pip joined #ruby
Pip joined #ruby
<banisterfiend> shevy: there's a tonne of innovation in touch based guis
Sailias joined #ruby
<banisterfiend> ipad2 apps
robyurkowski joined #ruby
tomzx joined #ruby
yekta joined #ruby
tdubellz_ joined #ruby
enroxorz-dead joined #ruby
enroxorz joined #ruby
heeton joined #ruby
<heeton> Are there any good gems for creating 'choose your own' adventure games?
j-okta joined #ruby
<gener1c> File.open("/etc/shadow").readlines {|line| add_user(username) if line.scan(/username/) }
<gener1c> is that possible?
<gener1c> File.open("/etc/shadow").readlines {|line| add_user(username) if line.match(/username/) }
<gener1c> or is there a better way?
strife25 joined #ruby
tdubellz_ joined #ruby
crescendo joined #ruby
<JonnieCache> gener1c: looks fine to me. there would be plenty of other ways to do that but its really a matter of taste
Manhose joined #ruby
crescendo joined #ruby
tomku joined #ruby
<shevy> gener1c why not File.readlines('/etc/shadow') ?
<shevy> hmm
tdubellz_ joined #ruby
<shevy> would be kinda interesting if regexes could work on file objects directly
dotnull joined #ruby
<heeton> Are there any good gems for creating 'choose your own' adventure games?
<heeton> (Sorry if that already posted once, having trouble with my user account)
crankycoder joined #ruby
daglees joined #ruby
daglees joined #ruby
crankycoder joined #ruby
crankycoder joined #ruby
tdubellz_ joined #ruby
Helius joined #ruby
<JonnieCache> heeton: do you mean a text adventure?
<heeton> yea
<heeton> And ideally, something using sinatra or similar to provide a web interface
<JonnieCache> hmm well I was going to suggest Highline for doing console interaction but if youre doing it on the web then thats different
<JonnieCache> id suggest making the game first, and keeping user presentation and interaction very separate so you can add the web interface later
<JonnieCache> because the web side will be relatively complex, you'll need an evented server and then some javascript library for doing the realtime interaction
<JonnieCache> so id focus on making a good game first
evantravers joined #ruby
tdubellz1 joined #ruby
bbttxu joined #ruby
shevy joined #ruby
albemuth joined #ruby
Manhose_ joined #ruby
ceej joined #ruby
tdubellz_ joined #ruby
nari joined #ruby
jr00n joined #ruby
dekroning joined #ruby
mike___ joined #ruby
<mike___> hi
Paladin joined #ruby
<mike___> i can't find the error in this code: http://codepad.org/2HFZmTlN
<mike___> my problem lies in lines 69 and 70
<mike___> IMHO this should either print "not nexted" or the output of check thats printed if check returns 1
Guest57705 joined #ruby
<mike___> but this is not the case somehow
<shevy> mike___ always try to narrow the error down
<shevy> also, in those pasties
axl_ joined #ruby
<shevy> please provide the error message in # commented form
<shevy> last but not least, you should use http://pastie.org/ it has nicer colours
tvw joined #ruby
<shevy> mike___
<shevy> testing.rb:62: undefined method `repeated_permutation' for ["a", "b", "c"]:Array (NoMethodError)
<mike___> it's ruby 1.9
<shevy> hmm
<mike___> 1.9.3
statbot2 joined #ruby
<mike___> there's this method
<shevy> yeah I am looking at it
<shevy> so where is the bug
<shevy> at:
<shevy> next if (check(ima+imb) || check(ima+ima) || check(imb+imb) || check(imb+ima) )
<shevy> ?
kreantos joined #ruby
Manhose joined #ruby
pen_isident joined #ruby
<mike___> somehow, yeah
Paladin joined #ruby
mike____ joined #ruby
tdubellz_ joined #ruby
<mike___> for example if ima="accba" and imb="acbba" then this condition is 0
<mike___> so this "not nested" should be printed
<mike___> but it isn't -.-
niklasb_ joined #ruby
Adman65 joined #ruby
charlenopires joined #ruby
<shevy> well
<shevy> reshuffle it a bit
<shevy> dumb it down
kreantos joined #ruby
dasfugufish joined #ruby
<mike___> ok, so i added some more debugoutputs
<mike___> and it gets weirder every time
theRoUS joined #ruby
theRoUS joined #ruby
<mike___> if the expression is 0, why isn't there some "not nested" in the output?!?!
<mike___> nexted*
tdubellz_ joined #ruby
<mike___> oh
<mike___> 0 is true in ruby?
<burgestrand> mike___: yes
<mike___> jesus
<burgestrand> mike___: :)
Morkel joined #ruby
<shevy> hehe
<burgestrand> mike___: only false and nil are not truthy
<mike___> nifty details
<shevy> mike___, from what language are you coming?
* JonnieCache puts $100 on php
<JonnieCache> isnt 0 false in php?
<mike___> different ones, don't program that much. doing some stuff in awk and c++ mainly
<burgestrand> it is in many languages
<JonnieCache> oh yeah and "0" is false in php thats what im thinking of
<shevy> yeah I thought about PHP
<shevy> but not because of 0
<shevy> more because of the structure
<mike___> that code is ugly, i know
<shevy> (check(ima+imb) || check(ima+ima) || check(imb+imb) || check(imb+ima) )
<heeton> JonnieCache: So, a 'no' then :)
<shevy> well, that too, but it's more the thinking pattern mike___
<dotsolo> helps me keep it all straight
<mike___> but i'm not really interested in nice code, it's the output that matters :)
<heeton> I think I will build my own though, so thanks very much for the tips
plukevdh joined #ruby
<shevy> if you look at the code as a whole, it seems as if the one who wrote it did not "think" within ruby yet
<shevy> but yeah, you'll get better anyway :)
<JonnieCache> heeton: i think there is one in python
<heeton> *hisss*
<shevy> IS THAT THE SOUND A SNAKE MAKES
<shevy> A PYTHON?!
<shevy> zZszszs sszs Szszszs?!
<JonnieCache> my brother was going on about some pythonic text adventure framework last time i saw him
<heeton> No… the joke isn't as good when it's for python
<shevy> what happened to your brother then
<mike___> yeah, definitely not a rubyist here
<shevy> did he vanish or what
<heeton> Imagine C# - *hisss* but with python replaced
<mike___> just like the easy string manipulation stuff it provides :)
<shevy> and why is your brother using python and not ruby :(
<mike___> but what's the ruby way to do sty like A or B or C or D?
<mike___> sth*
<JonnieCache> yeah he writes text adventures in the los angeles underground like some kind of zork-based soldier of fortune
<shevy> I don't know mike___ but it all kinda *feels* strange ... if !check(phi(tm, ima, imb))
Paladin joined #ruby
<shevy> in ruby you'd often enough have something like:
<shevy> object.does_something(bla, ble, blu)
<shevy> mike___ if that way to code works for you just continue
<shevy> it is more important to find a practical style
nonotza joined #ruby
tdubellz_ joined #ruby
wedgeV joined #ruby
akem joined #ruby
akem joined #ruby
pen_isident joined #ruby
addamgc joined #ruby
dotsolo joined #ruby
Barakas joined #ruby
dyer joined #ruby
enikar joined #ruby
Azure joined #ruby
hungerandthirst joined #ruby
tdubellz_ joined #ruby
<Barakas> hi all, does somebody know if there is a "OwnCloud-like" project written in Ruby ? (http://owncloud.org/)
Manhose_ joined #ruby
v0n joined #ruby
mike____ joined #ruby
ggtoo joined #ruby
axl_ joined #ruby
theRoUS joined #ruby
jr00n joined #ruby
ph^ joined #ruby
tdubellz_ joined #ruby
renanoronfle joined #ruby
statbot2 joined #ruby
statbot2 joined #ruby
bwlang joined #ruby
jamesl__ left #ruby
tdubellz_ joined #ruby
bwlang joined #ruby
stringoO joined #ruby
codespectator joined #ruby
statbot2 joined #ruby
DuoSRX joined #ruby
alex__c2022 joined #ruby
iocor joined #ruby
statbot2 joined #ruby
Guest69570 joined #ruby
bbrandon joined #ruby
pangur joined #ruby
statbot2 joined #ruby
looopy joined #ruby
theRoUS joined #ruby
Paladin joined #ruby
tdubellz_ joined #ruby
Cervajz joined #ruby
RomD`` joined #ruby
statbot2 joined #ruby
Axsuul joined #ruby
io_syl joined #ruby
youdonotexist joined #ruby
tdubellz_ joined #ruby
Na_Klar joined #ruby
jimmy1980 joined #ruby
looopy joined #ruby
<Na_Klar> I set up a script which runs in background and writes perodically to a file. But when I start the script with "ruby script.rb &" the output file remains 0 bytes untill the script is completed. How can I make the script write instantly?
<gener1c> file.close
<Na_Klar> of course it does from the logic of the program. it is a while() construct with file.write() in it
<gener1c> till you close the handler the data wont be written afaik
<Na_Klar> uh
<gener1c> ohhhhhhhhh
<Na_Klar> really? so I have to re-open the file every time ?
<gener1c> let me check
statbot2 joined #ruby
<Na_Klar> yeah. I hardly could believe that. PHP e.g. behaves different here
<shevy> Na_Klar and if you don't append & what happens then?
<shevy> also, can you upload it on pastie.org
<Na_Klar> shevy, i'll try .. just a sec
<Na_Klar> well ^^
ank joined #ruby
<JonnieCache> file.flush
<JonnieCache> look into flushing generally
<Na_Klar> shevy, same without "&"
<Na_Klar> jonniecache, I'll check ..
<shevy> Na_Klar if it does not write anything anyway then the culprit is the code itself
<burgestrand> lots of the time output is buffered up until the next newline
<shevy> when I write a ruby script with File.open it writes immediately
<shevy> btw Na_Klar funny nickname :D
tdubellz_ joined #ruby
<burgestrand> you’ll want to explicitly flush the output buffer if you want the file to have any contents
<Na_Klar> shevy, it writes but only when the script is completed
<Na_Klar> shevy, why is that funny? :P
<JonnieCache> shevy: its highly dependent on the environment
<burgestrand> like JonnieCache said :)
<shevy> na klar oida, slang german would fit here!
ckrailo joined #ruby
<Na_Klar> burgestrand, I write a line in every loop
<Na_Klar> but .flush did it
<Na_Klar> thanks jonnycache
sandstrom joined #ruby
<Na_Klar> jonniecache ^
sandstrom joined #ruby
<pangur> I am to place an object in roles[] unless the object is in roles already.
<Na_Klar> shevy, rather na klar alda ;-)
<pangur> How do I use set to do that, please?
<Narcissus> Hi - I am having trouble using the rest-client gem. I have added it to my gemfile and using gem install 'rest-client'. However when I try to use `require 'rest-client'` I get `no such file to load -- rest-client` - suggestions?
kennethreitz joined #ruby
Indian joined #ruby
LiquidInsect joined #ruby
<JonnieCache> pangur: roles << obj unless roles.inclues?(obj)
<burgestrand> Narcissus: if you use bundler, do use ”bundle install” and not ”gem install”
<pangur> thanks JonnieCache - I shall give that a try
<burgestrand> (actually, you can use both as long as you do bundle install after)
<JonnieCache> pangur: or you could make roles a Set in which case it would be automatic
<Narcissus> burgestrand: I tried that too, still doesn't work
<workmad3> Na_Klar: when the script finishs, the file handle will be closed which will flush the buffer
<pangur> How would I make roles a Set, JonnieCache?
<burgestrand> Narcissus: how are you running whatever script you are running that can’t require it?
rexo joined #ruby
<Na_Klar> workmad3, yea I got that now. I wasn't used to flush file writes from other languages. Did not expect that ruby buffers writes to (local) files :P
<shevy> Na_Klar yeah, but alda is a bit more german-german, in Vienna it's "oidaaaaaa". also see http://www.youtube.com/watch?v=ti-uTf829Qo if curious at all, though that is western austria :P
<Narcissus> burgestrand: running it with rails
<workmad3> Na_Klar: it's pretty common tbh :)
<pangur> Do I just declare roles = set.roles or something?
<shevy> Na_Klar but yeah it's the same meaning of those dialects
<JonnieCache> pangur: you could use Set.new when creating it
Paladin joined #ruby
saschaheylik joined #ruby
<pangur> I am taking the values from a csv file, so roles is empty on first creation.
<burgestrand> Narcissus: pastie your gemfile please; are you using RVM?
<Na_Klar> workmad3, at least not in php ^^ and that is where I come from
<shevy> hehe
<shevy> I moved from php to ruby years ago
<Narcissus> burgestrand: http://fpaste.org/Iy0t/
<Na_Klar> i am not >moving< i am spreading
<workmad3> Na_Klar: yeah... I wouldn't take any PHP style stuff as good standards ;)
<Na_Klar> that is true indeed
<workmad3> Na_Klar: PHP is very much a mish-mash of 'this seems like a good idea' IMO
bier joined #ruby
<Na_Klar> php is ugly and it is meant to be ugly
<burgestrand> Narcissus: oh, yeah, I remember this gem now
lkba joined #ruby
excelsior joined #ruby
DrShoggoth joined #ruby
statbot2 joined #ruby
<burgestrand> Narcissus: you can require 'rest_client' or 'restclient' but not 'rest-client', the name of the gem, because who’d try to do that?!
<Narcissus> That would be silly. Trying to use the name of the gem.
<Narcissus> face->palm
ascarter joined #ruby
<burgestrand> Hey, appears you can actually require 'rest-client' nowadays, never mind my sarcastic comment.
<Narcissus> :/
<burgestrand> Who knows, maybe you’re on an old version.
<shevy> hmm how do you call the contents of an Array ... members? or elements
<shevy> I need conventions!
<shevy> Someone give me conventions!
<burgestrand> Narcissus: do try it with one of the alternative names
<JonnieCache> elements is the proper term. members implies a cantor-style set which an array is not
<burgestrand> shevy: I use members, elements, items
<Narcissus> burgestrand: just did: no such file to load -- restclient
* saschaheylik gives shevy a convention
<burgestrand> depending on the context
<shevy> hmm
<shevy> I am going to believe JonnieCache here
<burgestrand> Narcissus: are you trying to load it in the console or from some sort of initializer?
<shevy> at least, its simpler if I stick to one thing :)
<Narcissus> burgestrand: neither, I'm trying to load it in a model (as part of RoR)
<shevy> although I have never before heard "cantor-style" ...
ElitestFX joined #ruby
tdubellz_ joined #ruby
statbot2 joined #ruby
<JonnieCache> shevy: elements is proper but people use any word. this is symptomatic of modern programmers's over reliance on arrays and hashmaps
<JonnieCache> shevy: i made up "cantor-style" :) greg cantor was the inventor of Set Theory
<burgestrand> Narcissus: could you fire up the rails console and try to require it from there? I assume you’re on a fairly recent version of rails?
<shevy> ah ok
<JonnieCache> have you all heard about the jquery plugins website?
dnjaramba joined #ruby
<JonnieCache> the dev accidentally deleted the only copy of the database haha
<Narcissus> burgestrand: http://fpaste.org/g4Om/ is my result
Paladin joined #ruby
<burgestrand> well, he did have a backup
<burgestrand> :p
<burgestrand> 1 year old
<JonnieCache> dont think that counts tbh
<shevy> JonnieCache well
quest88 joined #ruby
<burgestrand> Narcissus: I take it all you did there was ”rails console” and then those requires? odd… my only guess right now is that rails loads the models somehow *before* it requires bundler… which would be kind of silly and goes against my own personal experience
<shevy> sometimes a fresh start doesn't hurt that much
statbot2 joined #ruby
<JonnieCache> good riddance. theyre building an npm/homebrew style package manager on top of github, which will be much better. shame we have to have ANOTHER dependency/package manager though
<shevy> some 8 years ago or something, I also was in a similar situation, but only with personal data
<Narcissus> burgestrand: mmhm
<shevy> you kinda learn from mistakes
pen_isident_ joined #ruby
<shevy> JonnieCache, where?
<shevy> machomebrew?
<burgestrand> Narcissus: I’d put the require after the bundler setup in config/application.rb (or is it config/environment.rb?) anyway
mksm_ joined #ruby
<burgestrand> Then again, I believe rails requires all gems in the Gemfile by default
<shevy> ah
<shevy> everyone loves to have its own package manager :)
<shevy> gems ...
<Narcissus> burgestrand: apparently, I have to restart rails server when I install a gem to the Gemfile
<burgestrand> Narcissus: indeed
<JonnieCache> Narcissus: yeah. if it reloaded all your gems as well as your app code with each request it'd be even slower
<Narcissus> urgh
<JonnieCache> burgestrand: rails bundler code is in ./config/boot.rb and it is indeed the first thing that gets loaded
<Narcissus> totally going back to Python after this assignment
<Narcissus> thanks for all your help JonnieCache & burgestrand :)
<burgestrand> JonnieCache: I just didn’t bother to look it up, can’t remember it by heart but thanks :p
liekzomg joined #ruby
* pangur is away: Gone away for now
kreantos joined #ruby
ascarter joined #ruby
tdubellz_ joined #ruby
kenichi joined #ruby
<liekzomg> when i install a gem and a depency rdoc fails it kills the rest of the generation. how can i make rdoc just skip failing gems and continue?
minijupe joined #ruby
<workmad3> liekzomg: just do 'gem install --no-rdoc --no-ri'
<liekzomg> workmad3: but i want the docs
<workmad3> liekzomg: rdoc and ri generation are non-essential, and can be done on-demand when you need the docs
wilmoore joined #ruby
mafolz joined #ruby
<workmad3> liekzomg: or you could check the docs online, which tends to be more reliable :)
p0y joined #ruby
h4mz1d joined #ruby
Na_Klar left #ruby
dasfugufish joined #ruby
tdubellz_ joined #ruby
<shevy> %w( a b c d e f ).reduce(&:+) # => "abcdef"
<shevy> hmm
<shevy> what is the long version for that ^^^ ?
<shevy> without the &
Bennit joined #ruby
<Bennit> Hi
<Bennit> I need to map sales records onto weeks, sales have a time of occurence, any good libs for getting monday and sunday of every week?
<dotsolo> shevy:
<dotsolo> %w(a b c d e f).reduce { |a,o| a + o }
<shevy> aaaah
<shevy> two arguments, I get it now
<shevy> thanks dotsolo :)
<dotsolo> |accumulator,current_object|
<shevy> yeah
Paladin joined #ruby
<shevy> I was trying with |foo| alone and wondered hehehe
andrew_ joined #ruby
ascarter joined #ruby
<pangur> http://fpaste.org/RzWw/ shows my attempt use Set.new
<pangur> However, it does not pay any attention to the previous entries.
tdubellz_ joined #ruby
<pangur> roles << r unless roles.include?(r) has the same effect.
<pangur> Basically, it lists every one of 416 roles from 416 records. There should be fewer than 20 roles altogether as most people have similar roles to one another.
kenperkins joined #ruby
<pangur> Basically, I want if role not already in storage, add it. Otherwise skip.
Clooth joined #ruby
* pangur is back.
<pangur> How do I do that?
<dotsolo> add?(o) possible
<pangur> ok, will try
<dotsolo> possibly*
looopy_ joined #ruby
<pangur> I tried roles.add?(k) - but that did not work.
<pangur> undefined local variable or method `k' for
<shevy> and what is k
<dotsolo> pangur: don't you want roles.add?(r)
ascarter joined #ruby
<pangur> of course - sorry
Brozilla joined #ruby
<pangur> It added all the roles same as roles << r :(
<pangur> Must be that I am comparing apples with oranges.
<shevy> I like both
jtrudeau joined #ruby
<JonnieCache> pangur: the objects are obviously not coming out as "the same" in the eyes of Set
maletor joined #ruby
<dotsolo> pangur: perhaps create a set of names, then convert them to Role objects to test
<JonnieCache> set checks uniqueness by object_id
<JonnieCache> so if they are different objects it will still add them
thone joined #ruby
<JonnieCache> i think its object_id anyway, look into it
<dotsolo> JonnieCache: can't be
<dotsolo> works with strings
Nisstyre joined #ruby
savage- joined #ruby
lucasgonze joined #ruby
<JonnieCache> yeah its probably just == or ===
<dotsolo> pangur: add an equality method to your Role class
<dotsolo> def ==(other_role) ... end
crankycoder joined #ruby
<pangur> dotsolo: I was just about to ask you what that should be. Thanks.
Paladin joined #ruby
pabloh joined #ruby
<pangur> Do I just add def == (other_role) like i might add def to_s ?
<dotsolo> yep
<pangur> Did that.
<pangur> When I ran it, all roles rendered as before
<dotsolo> what does your method look like?
<dotsolo> @name == other_role.name
<pangur> no, my next line was end :)
<davidcelis> why doesn't your equality method do anything? like check equality?
<pangur> Ok, have run it with that @name line included. same output
<davidcelis> lol
<dotsolo> well that will always return nil, which means false, which means unequal
<pangur> Should I have @name <> other_role.name?
* pangur looks flummoxed
fridim_ joined #ruby
<pangur> name != other_name did not make any difference
looopy joined #ruby
<dotsolo> lol, a set is just a hash
dparry joined #ruby
<dotsolo> pangur:
<dotsolo> first of all
<dparry> good afternoon, this might be one more for #puppet, but anyone know how to set the ruby on rails active record wait_timeout up from the default of 5 across the board please?
<dotsolo> it has to be roles.add?(r)
<dotsolo> don't change that back
bosphorus joined #ruby
<pangur> OK, that's what I have/
james_co_ joined #ruby
cbuxton joined #ruby
<pangur> It is what I have had since you corrected me.
Manhose joined #ruby
acreek joined #ruby
hamstu joined #ruby
strife25 joined #ruby
SegFaultAX|work joined #ruby
madhatter joined #ruby
<pangur> Seeing as set is not working for me, do I not need require 'set'?
<pangur> Makes no difference to the output whether it is there or not atm.
LiquidInsect joined #ruby
acreek joined #ruby
axl_ joined #ruby
philcrissman joined #ruby
<dotsolo> pangur
sepp2k joined #ruby
<dotsolo> looked into it
<dotsolo> set is really just a Hash
<dotsolo> and hash uses the .hash method to compare objects
<dotsolo> so add
<dotsolo> def hash
<dotsolo> @name.hash
<dotsolo> end
bluOxigen joined #ruby
<dotsolo> should fix your problem
<pangur> Tried without success.
ianbrandt joined #ruby
<pangur> It is still giving me 416 roles rather than 18 or so.
bwright joined #ruby
craigglennie joined #ruby
<pangur> How does hash method connect with my processing code?
dparry left #ruby
<pangur> The get_roles part?
apok joined #ruby
<pangur> It is as if the method is defined without any relation to the get_roles function.
<pangur> click
<dotsolo> implement all three methods in Role
raythecat joined #ruby
<pangur> It WORKED!!!!!!!!!!!!
<pangur> Thanks, dotsolo!
* pangur cannot believe it.
<dotsolo> welcome, bit strange really
* pangur has struggled with this for days.
ChampS_ joined #ruby
bratsche joined #ruby
zodiak joined #ruby
* pangur is delighted to have a solution that he can apply to similar issues.
jimmy1980 joined #ruby
<bratsche> Hey everyone!
<bratsche> Was wondering if there's anyone here who's used parslet very much.
desmovalvo joined #ruby
<pangur> I am surprised that not more people do not ask for help with that thing that you just helped me with dotsolo.
ph^ joined #ruby
Araxia_ joined #ruby
<shevy> pangur, I dont even know what roles are
tholl583xx joined #ruby
apok joined #ruby
<pangur> a role is the type of function that a person has, shevy.
<tholl583xx> i have a bunch of gems installed using yum/rpm in fedora, but they dont show up in the "gem list" is that to be expected?
<shevy> pangur a person has a function?
Guest76755 joined #ruby
<pangur> It has no technical use within ruby
<shevy> tholl583xx, not sure, sounds very odd
<pangur> you could call it a title, I suppose
<tholl583xx> how is the gem list built?
<shevy> tholl583xx, can you find out where the gems reside on your file system?
adeponte joined #ruby
<tholl583xx> the rpm ones would just be in the standard places...
<shevy> dunno... but when a gem is installed, it is somewhere registered and "gem list" reports that
<pangur> I am using it for church purposes - people can have different roles - minister, elder, deacon, chaplain, etc.
<dotsolo> did you install rubygems through yum/rpm
<shevy> if they are in standard places, why cant they be found :P
<bratsche> I found an irc channel for parslet, so I'm asking there. Seems like nobody is around, but I'll be patient. :)
<shevy> yeah tholl583xx
<shevy> and "gem list" does not show them?
<shevy> oh
<shevy> just do "gem list"
luckyruby joined #ruby
<tholl583xx> heres a pastebin, it shows a rpm of warden installed, but not in the gem list
<shevy> does not return anything?
<tholl583xx> its in the pastebin, yeah it not show anything
<shevy> I mean
<tholl583xx> > sudo gem list | grep -i warden
<tholl583xx> [~]
<tholl583xx> nada
<shevy> nono dont grep
<shevy> "gem list" does not even output a newline?
<bratsche> tholl583xx: It's probably not a good idea to have gems installed with rpm/deb/etc.
<shevy> that's the strangest thing
<shevy> my gems are in that directory too, and "gem list" displays them
<shevy> gem list
<dotsolo> which gem
<shevy> *** LOCAL GEMS ***
<shevy> yip (0.8.2)
<shevy> wirble (0.1.3)
<tholl583xx> well, just inspecting the gem list warden is not in there
<shevy> and so on
<bratsche> echo $GEM_HOME
<dotsolo> sudo which gem
<shevy> but gem list shows any gem? also do "gem env" too and the commands given here by dotsolo and bratsche
nowthatsamatt joined #ruby
<nowthatsamatt> join #1911techtalk
adamkittelson joined #ruby
<shevy> never!
badabim joined #ruby
<pangur> Is advertising allowed in this channel?
nadirvardar joined #ruby
<bratsche> Will 'not allowing' advertising in this channel actually stop it? :)
<shevy> :D
<nowthatsamatt> pangur: was it advertising or sheer stupidity
<nowthatsamatt> you be the judge
<shevy> pangur, the official ruby channel is on #ruby-lang
<pangur> I am not sure that I want to go back to the technology of 1911.
<shevy> yeah
<shevy> you could not use ruby
<bratsche> tholl583xx: Is there any particular reason you're using gems that are installed by rpm/yum?
<pangur> I had not realised that this was not the official ruby channel, shevy.
<blueadept> what does <% } %> mean?
<pangur> That someone has not finished their code very well.
<shevy> blueadept what is the context? looks like erb
<shevy> embedded ruby code
<blueadept> right it is
<JonnieCache> its closing a { futher up
<tholl583xx> which gem => /usr/bin/gem
<blueadept> ah
<blueadept> ok
<bratsche> } closes a block of code, and <% %> looks like it's escaping some html.erb
<blueadept> yeah that makes sense
<shevy> but blueadept it really makes ruby ugly!
<davidcelis> lol <% } %>
<blueadept> i know
<davidcelis> that shit
<davidcelis> should never happen
<blueadept> i wish i was using HAML
<shevy> :)
<blueadept> i'm refactoring code here
<JonnieCache> most people use do/end in erb cos its less ugly
<bratsche> It's more common to use <% end %>
<shevy> really?
josh__ joined #ruby
<JonnieCache> <% end %> is just about acceptable compared to <% } %> which just looks like bad perl
<blueadept> bratsche, yeah thats what i'm doing right now
<shevy> well that may be a bit better but... it is soooo ugly
<davidcelis> JonnieCache: most people use do/end because using curly braces for multi-line blocks is terrible
<blueadept> just going to put the ends in
<blueadept> shevy: haml is ugyly?!
statbot2 joined #ruby
<bratsche> haml is slow.
<JonnieCache> HAML IS AWESOME.
<shevy> blueadept no idea, I dont use it :)
<davidcelis> haml? ugly?
<blueadept> i really like Jade on the node.js side
<davidcelis> lol.
DrShoggoth joined #ruby
<blueadept> jade is like haml
<blueadept> i dont care if its slow
<pangur> Has anyone here every tried either rubypython or seamless?
<blueadept> i just want to fricking read it
eignerchris joined #ruby
Synthead joined #ruby
<JonnieCache> it isnt slow its like 1% slower than erb, and in production templates only get compiled once so its irrelevant
<davidcelis> HAML is only ugly if you write shitty HAML, but the same can be said of a lot of languages
<bratsche> I guess I've just been using html/erb longer, but I don't find haml to be more readable. It's just different.
statbot2 joined #ruby
<blueadept> i like the indent based structure
tdubellz_ joined #ruby
<blueadept> if you right <div></div> it can be everywhere
<JonnieCache> haml only really reaches its full awesomeness when you use it along with the original sass syntax
<blueadept> write8
statbot2 joined #ruby
statbot2 joined #ruby
<bratsche> I like the indent structure in sass and coffeescript. It's fine in haml, but I'm just not willing to put up with the speed hit for what's essentially just a different syntax with no real features.
<davidcelis> HAML is definitely more readable. it's much more easy to follow, as it forces correct indentataion, and is by far less redundant
<JonnieCache> kids: just say no to closing tags!
<pangur> I wanted to give seamless a whirl because I like the endless python syntax but seamless would not work for me.
statbot2 joined #ruby
<davidcelis> P.S. HAML is barely slower than ERB these days. It's negligible.
<bratsche> Has anyone here used parslet much by any chance? I'm having trouble with the transforms. :/
<davidcelis> Wow, I thought this was #rubyonrails, what the fuck?
<blueadept> devidcelis: thats what im sayin!
<bratsche> davidcelis: Oh, cool. I haven't kept up with it I guess. Last time I tried it and measured, it was about 30% slower.
voodoofish430 joined #ruby
guns joined #ruby
ilyam joined #ruby
statbot2 joined #ruby
Natch| joined #ruby
Russell^^ joined #ruby
rushed joined #ruby
statbot2 joined #ruby
iocor joined #ruby
ghanima joined #ruby
josemota joined #ruby
TomJ joined #ruby
moshee joined #ruby
Shamgar joined #ruby
statbot2 joined #ruby
quest88 joined #ruby
statbot2 joined #ruby
<pangur> Has there been a netsplit?
<shevy> dunno
<pangur> A whole lot of people left and rejoined
statbot2 joined #ruby
<shevy> sounds like a netsplit
<shevy> :P
<shevy> I dont see joining or leaving, I feel it is too much spam
<shevy> and my internet connection is unstable/dynamic, before a reset occurs, I don't get the last ~2 minutes of talk
Cervajz joined #ruby
Guest25605 joined #ruby
<pangur> I am still intrigued by the solution that dotsolo came up with. Whilst I can see that it worked and recognise some of the ingredients, it still looks strange to me.
<shevy> it looks strange to me too simply because I dont understand roles
<Boohbah> know your role
mikepack joined #ruby
statbot2 joined #ruby
<josemota> hey guys, I have this pastie http://pastie.org/2992346. The record has multiple events, but has two pointers, one to each specific event. Calling either associated event gives me the first of the events. What do I need to do?
<kstephens> Anybody know how to distinguish between class or instance methods inside a set_trace_proc? (CRuby)
<josemota> the sql log for each of the associated event objects is: `Event Load (0.2ms) SELECT "events".* FROM "events" WHERE "events"."record_id" = 1 LIMIT 1`
statbot2 joined #ruby
<pangur> Shevy, for roles substitute job_type - does that make more sense?
statbot2 joined #ruby
<shevy> pangur not sure
<shevy> it's just a @ivar?
<shevy> class User
<shevy> def set_job_type(i)
<shevy> @job_type = i
<shevy> ?
tdubellz_ joined #ruby
<pangur> More or less
Manhose_ joined #ruby
eignerchris_ joined #ruby
<pangur> I get given a file with various bits of data in it - and I try to isolate the data into different classes.
statbot21 joined #ruby
Morkel joined #ruby
statbot2 joined #ruby
<pangur> Different roles are eligible/required to serve on different committees etc. So, it is helpful to be able to associate roles with people and with committees - thus I make them more than a mere attribute of Person.
Paladin joined #ruby
statbot2 joined #ruby
<pangur> Fortunately, this is just a hobby - nobody is waiting for the outcome of my efforts.
statbot2 joined #ruby
<shevy> I'll never understand roles
statbot2 joined #ruby
statbot2 joined #ruby
eywu joined #ruby
pangur left #ruby
statbot2 joined #ruby
axl_ joined #ruby
flip_digits joined #ruby
quest88 joined #ruby
statbot2 joined #ruby
statbot2 joined #ruby
kirun joined #ruby
Fretta joined #ruby
statbot2 joined #ruby
sepp2k joined #ruby
statbot2 joined #ruby
jbpros joined #ruby
excelsior joined #ruby
rbanffy joined #ruby
guns joined #ruby
andreim left #ruby
apok_ joined #ruby
davidcelis joined #ruby
kennethreitz joined #ruby
btanaka joined #ruby
looopy_ joined #ruby
baroquebobcat joined #ruby
kakaskin joined #ruby
zodiak joined #ruby
jonathanrwallace joined #ruby
Targen joined #ruby
Jippi joined #ruby
jergason joined #ruby
igotnolegs joined #ruby
timonv joined #ruby
stephans joined #ruby
d2dchat joined #ruby
kuber joined #ruby
demian`_ joined #ruby
eignerchris joined #ruby
looopy joined #ruby
<xissburg> I have this code https://gist.github.com/1452872 and I get that error in the comment at the bottom..
<xissburg> what is that?
jgarvey joined #ruby
Brandonn joined #ruby
<davidcelis> xissburg: Try #rubyonrails
kidoz joined #ruby
<xissburg> uuh
ascarter_ joined #ruby
Seisatsu joined #ruby
kennethreitz joined #ruby
gf3_ joined #ruby
JohnBat26 joined #ruby
g0bl1n joined #ruby
<jergason> xissburg: does it work if it is all on one line?
philcrissman joined #ruby
<davidcelis> jergason: It was because the . from the method call was after a linebreak
<xissburg> jergason: yea, that was the problem. davidcelis told me that on #rubyonrails
shnats|dropdead joined #ruby
agent00tai joined #ruby
shnats|dropdead left #ruby
agent00tai left #ruby
Cervajz joined #ruby
p1d joined #ruby
tholl583xx left #ruby
jay_zawrotny joined #ruby
<danheberden> i have a var that i want to make sure it's an array if it isn't defined yet, which right now is something like `whatever[ iWantThisKeyToBeAnArray] = [] unless whatever[ iWantThisKeyToBeAnArray ].kind_of(Array)`
<danheberden> but i'm sure there's a better way to do that
<rippa> danheberden: a ||= []
<danheberden> omg - it's like a short-circuit but... better
<rippa> it will initialize it if it's undefined, nil or false
<danheberden> i am so diggin' ruby
<danheberden> thanks rippa :)
[JL]stringo0 joined #ruby
Hellojere joined #ruby
stringoO joined #ruby
IrishGringo joined #ruby
jr00n joined #ruby
mrsolo joined #ruby
apucacao joined #ruby
Sailias joined #ruby
RORgasm joined #ruby
ascarter joined #ruby
PaciFisT joined #ruby
jamiejackson joined #ruby
csavola joined #ruby
Clooth joined #ruby
p1d joined #ruby
ascarter joined #ruby
berserkr joined #ruby
<jamiejackson> can someone hold my hand while i install ruby/rails and a couple of gems on ubuntu? i have questions along the way.
dv310p3r joined #ruby
ronniemlr joined #ruby
headius joined #ruby
Nisstyre joined #ruby
* asQuirreL holds jamiejackson's hand
<jamiejackson> thanks asQuirreL .
Araxia_ joined #ruby
<asQuirreL> jamiejackson: have you started yet?
<jamiejackson> question number one: i heard that it's bets just to install ruby via apt-get, and use gem install for *everything* else
<asQuirreL> jamiejackson: well... I personally don't like apt-get
jarin joined #ruby
<asQuirreL> because installing "ruby" from it gives you 1.8.7
<asQuirreL> you need to install "ruby1.9" to get ruby 1.9
<asQuirreL> which means all the shebangs need to be changed
<asQuirreL> (no fun)
<crankycoder> hi all - i'm trying to install jruby_hdfs and i can't seem to figure out how to get ruby to install this library. https://github.com/falti/jruby_hdfs
<asQuirreL> jamiejackson: I'd go for installing "rvm" first
<crankycoder> should "rake gem" just build me an installable gem file?
<jamiejackson> okay asQuirreL, go ahead and tell me what to do according to your prefs
<asQuirreL> and then using rvm to install the latest ruby
<asQuirreL> and then gems for everything else
<jamiejackson> so "sudo apt-get install ruby1.9" ?
<asQuirreL> jamiejackson: http://beginrescueend.com/rvm/install/
<asQuirreL> no, install rvm first
statbot2 joined #ruby
<asQuirreL> as per the link
<jamiejackson> ahh, okay will do and will be right back
<asQuirreL> jamiejackson: good stuff
<crankycoder> is there something equivalent to "setup.py install" in ruby?
<asQuirreL> crankycoder: like "make install"?
<asQuirreL> crankycoder: (for C family languages)
statbot2 joined #ruby
<jamiejackson> asQuirreL, this is just for my desktop, but i tend to like to do things in a server-y sort of way so i can administer a server if need be. should i go ahead with multi-user?
<crankycoder> asQuirreL: yeah, i can't see any way to install this piece of code..
kennethr_ joined #ruby
<asQuirreL> jamiejackson: hmmm...
<crankycoder> asQuirreL: i can run rake to run the tests fine, but i can't figure out how to build and install a gem from the source
<asQuirreL> jamiejackson: if you're alright with it installing as root, then yeah, go ahead
<jamiejackson> your call, though, asQuirreL. what would you do on your dev desktop?
bigdata joined #ruby
<jamiejackson> what's gonna be the least headache, etc., asQuirreL?
<crankycoder> jamiejackson: use rvm. it'll save you a lot of grief
dbgster joined #ruby
<asQuirreL> jamiejackson: my dev environment is OS X, and I don't ssh in or anything, so I just went for single user
<jamiejackson> crankycoder, thx, doing that now.
statbot2 joined #ruby
<asQuirreL> crankycoder: can you give me the name of the library you're trying to install?
<crankycoder> asQuirreL: https://github.com/falti/jruby_hdfs
atmosx joined #ruby
statbot2 joined #ruby
<jamiejackson> okay, single-user it is asQuirreL. bbiam
<asQuirreL> crankycoder: that README wasn't so great... :P
<crankycoder> asQuirreL: :) yeah. i'm thinking of just forking the code an inlining it into my code base.
* crankycoder opensource: fixing it is your problem
iocor joined #ruby
<asQuirreL> crankycoder: yeah, that's what it looks like
<asQuirreL> crankycoder: you could just put it somewhere in your load path and save yourself some trouble should you need it again
<crankycoder> asQuirreL: i'm normally a python guy - i have no idea what you mean when you say load path (w.r.t ruby) :P
<asQuirreL> like.... "~/lib/includes/rb/"
<asQuirreL> crankycoder: I mean your $PATH shell variable
<crankycoder> asQuirreL: oh.. is that all?
* crankycoder trying that out...
<asQuirreL> crankycoder: yep
marienz_ joined #ruby
rickmasta joined #ruby
<jamiejackson> asQuirreL, do you know if ubuntu does its bash profile stuff differently? i ran the following but still get "no command 'rvm' found': echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bash_profile
abstrakt joined #ruby
DaZ joined #ruby
mengu_ joined #ruby
<jamiejackson> asQuirreL, i'm finding some docs on ubuntu specific sourcing, brb
<asQuirreL> jamiejackson: kk
<asQuirreL> jamiejackson: other places it could be
<asQuirreL> .profile, .bash
<asQuirreL> jamiejackson: actually, hold up
<asQuirreL> I have an ubuntu machine, here, I'l' check :P
<jamiejackson> cool
<asQuirreL> *I'll
<asQuirreL> ah that's right
<asQuirreL> .bashrc
<jamiejackson> k
<jamiejackson> so can i just replace .bash_profile in that command with .bashrc?
<asQuirreL> jamiejackson: that should do it
<jamiejackson> k
timonv joined #ruby
Vendethiel joined #ruby
<jamiejackson> i think this project wants an old-ish version of ruby. maybe i should go for ruby 1.9x
<jamiejackson> so, "rvm install 1.9.2" ?
<jamiejackson> * asQuirreL
MAD_ joined #ruby
<asQuirreL> jamiejackson: that's right
<asQuirreL> jamiejackson: you can install as many different versions of ruby as you want with rvm
<asQuirreL> they all have separate environments, and separate gem installs
<asQuirreL> so it's all kept collision free
p1d joined #ruby
<asQuirreL> *sigh* class name collision in rails >.>
<yxhuvud> Don't name your classes Base.
<asQuirreL> yxhuvud: lol, :P
<asQuirreL> yxhuvud: I didn't do that, but it was arguably just as bad
<asQuirreL> I should have seen it coming
<asQuirreL> I named the entire project the same as one of the model classes
<asQuirreL> except the model isn't an activerecord
<asQuirreL> because the app isn't data driven
manizzle joined #ruby
<asQuirreL> jamiejackson: how's it going?
<jamiejackson> took forever to compile and stuff, but it's done. thanks for checking in. so now, it's just a matter of setting my ruby version with "rvm use 1.9.2" and installing gems?
<jamiejackson> ^ asQuirreL
jergason joined #ruby
Amirh joined #ruby
<asQuirreL> jamiejackson: yeo
<asQuirreL> *yep
<jamiejackson> asQuirreL, i.e., i need to install rails, roo, warbler.
<jamiejackson> k
<asQuirreL> if you want it to stick, then just use "rvm use 1.9.2 --default"
<jamiejackson> right, saw that. probably will set the default
_debo joined #ruby
wyhaines joined #ruby
n8ji joined #ruby
<v0n> hi
<asQuirreL> v0n: marnin
<v0n> :)
sean_m joined #ruby
<v0n> vocabulary question: is there a name for the special __END__ keyword?
Knodi joined #ruby
statbot2 joined #ruby
<jamiejackson> asQuirreL, rvm is purty. have you ever used warbler to war something for jruby?
tvw joined #ruby
<asQuirreL> jamiejackson: 'fraid not, I'm an MRI guy myself :P
* asQuirreL wouldn't touch java with a 10 foot pool
<asQuirreL> *pole
statbot2 joined #ruby
<jamiejackson> asQuirreL, i assume that's not magnetic resonance imaging?
ilyam joined #ruby
<asQuirreL> Matz' Ruby Interpreter
statbot2 joined #ruby
<jamiejackson> oh
<asQuirreL> jamiejackson: you just installed MRI now :P
statarb3 joined #ruby
<asQuirreL> jamiejackson: if you wanted jruby, you'd need to specify when you did the installing
<jamiejackson> asQuirreL, that was sneaky of you. now matz is all up in my business.
<jamiejackson> i don't really want jruby, i don't think. i just want to be able to war it up
statbot2 joined #ruby
<jamiejackson> to deploy to jruby
<shevy> asQuirreL are you a squirrel?
<headius> I'm not sure warbler runs in MRI
<headius> it might though
<jamiejackson> we run our ruby stuff on glassfish, for some reason
<headius> it fetches JRuby for you either way
<asQuirreL> shevy: I am indeed...
<shevy> cool
* shevy hides some nuts in the channel.
<asQuirreL> one with opposable thumbs, so I can type
statbot2 joined #ruby
<shevy> yeah. sophisticated coding squirrels are the best
<asQuirreL> damn straight
<asQuirreL> now did someone say something about nuts...?
<shevy> hmm oh no
<shevy> we are coding something
<shevy> something important
<asQuirreL> ...to do with nuts? 0.o
<jamiejackson> okay, so i'm trying to run warble, headius, and i'm getting "no such file to load -- initializer"
adambeynon joined #ruby
<headius> hmm
<asQuirreL> jamiejackson: you probably need jruby...
<headius> running it in MRI I assume
<asQuirreL> jamiejackson: no worries
<asQuirreL> you can install it with rvm
<asQuirreL> same as before
<jamiejackson> k
<asQuirreL> but instead of "1.9.2
<asQuirreL> you should say "jruby1.9.2"
<shevy> hmm you know what
pantsman joined #ruby
pantsman joined #ruby
<shevy> gem install github/path/to/project
<shevy> that would be cool
kennethreitz joined #ruby
<asQuirreL> shevy: I think you've given yourself a nice project there
<jamiejackson> wait, so i'm in a "rvm use 1.9.2" shell right now. where do i go from here to get to jruby warbling thingy?
Shamgar joined #ruby
<headius> rvm install jruby ; rvm use jruby
skyraid joined #ruby
<jamiejackson> ohhhhhh
<asQuirreL> jamiejackson: you also need to install warbler in the jruby environment too
<shevy> asQuirreL hmm I am not really using gem though
<asQuirreL> emacs is so awesome... only in emacs would "C-c ; f y calculate.css.scss" be considered a shortcut
<v0n> no answer to my question so? :P
<asQuirreL> v0n: what was your question?
<shevy> <v0n> vocabulary question: is there a name for the special __END__ keyword
<asQuirreL> ah yes
<shevy> I think its name is
<shevy> hmm
<shevy> __END__
<asQuirreL> v0n: "the __END__ keyword"
<shevy> :)
kennethreitz joined #ruby
<asQuirreL> v0n: you can shout it really loud for emphasis if it makes you feel better :P
<asQuirreL> that way it's different from "end"
<jamiejackson> okay to just install the default jruby? "rvm install jruby"? that gives me 1.6.5. good stuff?
<asQuirreL> jamiejackson: I've never used jruby
<headius> 1.6.5 is what you want, yes
<shevy> ok wait
<asQuirreL> but I was under the impression that you choose which ruby spec you want after installing it
<jamiejackson> because you wouldn't touch java with a ten-foot-pole
<shevy> how do I use __END__ ...
<shevy> x = DATA.read does not seem to work
<asQuirreL> jamiejackson: okay, that was a lie...
<asQuirreL> but I really, *really* don't like java
<headius> shevy: only works in a "main" script
<shevy> a main script?
<headius> not in require'd scripts, IRC, eval's, or -e
cschauer joined #ruby
<headius> er IRB, not IRC
gearaholic joined #ruby
<shevy> ah
<asQuirreL> v0n: oh, I just thought a name for it...
<asQuirreL> it's not the official name
<asQuirreL> obviously
<asQuirreL> squirrels don't get a say in those
<asQuirreL> but what about the "parser end"?
<asQuirreL> or "eval end"
<gearaholic> How can i count the number of times a string is in an array
<gearaholic> for each unique name
<asQuirreL> gearaholic: for each uniq name in that array?
mmokrysz joined #ruby
<asQuirreL> *unique
<gearaholic> yeah like mike is in there 3 times, bob 4 etc...
<asQuirreL> gearaholic: you want a hash?
<asQuirreL> or just a list in order of appearance
<gearaholic> sure
<asQuirreL> because there's
<gearaholic> just need to get some numbers for someone, dont need to do anything with the data
<asQuirreL> arr.uniq.map { |name| arr.select { |elem| elem == name }.length }
<asQuirreL> that produces the list
<asQuirreL> (not the hash)
<asQuirreL> if you want the hash then I'd do this
LittleBill902 joined #ruby
negative joined #ruby
<asQuirreL> Hash[arr.zip(arr.uniq.map { |name| arr.select { |elem| elem == name }.length })]
<asQuirreL> oops, mistake there
<asQuirreL> it should be
<asQuirreL> Hash[arr.uniq.zip(arr.uniq.map { |name| arr.select { |elem| elem == name }.length })]
<jamiejackson> okay, so warbler wants me to issue "gem install -v=>=2.3.8 rails", but that is apparently a syntactically invalid command. something about a stray "="? how to fix?
<asQuirreL> gearaholic: I'm sure you can shorten that some more :P
<gearaholic> thats perfect thanks
<asQuirreL> gearaholic: no problem :P
wmoxam joined #ruby
<asQuirreL> jamiejackson: try this: "gem install -v >= 2.3.8 rails"
<jamiejackson> yup, asQuirreL , that was even human readable, and stuff
<atmosx> is there any way to force ruby to read a file with a specific encoding? not open it...
<atmosx> I'm interested in the content's encoding not the file's encoding, apparently these are different (even though I don't understand in what respect)
<atmosx> in Ruby 1.9
Clooth joined #ruby
<asQuirreL> jamiejackson: so I take it that it worked then :P
<asQuirreL> atmosx: how does ruby read a file without opening it...?
<atmosx> with File.read(file) reads the file as a 'string'
<atmosx> and File.read cannot take any options while File.open can...
<atmosx> I'm not an expert, I'm a newbe but that's what I'm getting out from reading online tutorials and actually testing a script
Shamgar joined #ruby
bigdata joined #ruby
|RicharD| joined #ruby
<asQuirreL> atmosx: oh I see, well File.read is still opening the file
<|RicharD|> hi to all
<shevy> |RicharD| DIE!!!
<asQuirreL> atmosx: it's just that it knows that you want the "r" option
<atmosx> asQuirreL: hmm and converts it to string automatically...
<shevy> oops sorry. I meant Hi!
<asQuirreL> atmosx: yeah
<shevy> wrong idiom I was in :D
<|RicharD|> lol
techhelp joined #ruby
<asQuirreL> shevy: those keys're like... right next to each other
<atmosx> asQuirreL: okay, thatnks I get it now, so I just File.open(file, "r:ENCODING").to_s and I'm done
<|RicharD|> what do super()
<shevy> asQuirreL I have fat fingers and a small keyboard
<|RicharD|> in initialize method ?
jimmy1980 joined #ruby
<shevy> with super() you call the parent method
<asQuirreL> |RicharD|: it calls the initialize method in the super/parent class
<shevy> you call to the initialize() method in your parent class that way
<asQuirreL> so that it has a chance to initialize as well
<|RicharD|> for what do ?
<|RicharD|> and when use it ?
<shevy> |RicharD| when you subclass a class, you use it in your sub-classed class
<Clooth> puts puts
<shevy> class Foo;end; class Bar < Far;def initialize;super();end;end
<shevy> oops
<shevy> class Bar < Foo
<asQuirreL> |RicharD|: also, because of the way ruby works, you can also use it on Modules
<asQuirreL> for example, if you include a module in to your class
<|RicharD|> umh
<asQuirreL> then calling "super" inside your class will make it look for a method called "initialize" in the module you included first
<asQuirreL> for example
<|RicharD|> so for call the initialize of class Foo ?
<|RicharD|> from class bar ?
<asQuirreL> module A; def initialize *args; puts "In the module!"; end; end
<asQuirreL> and then
<asQuirreL> class B; include A; def initialize; super; end; end
<asQuirreL> will give you
<asQuirreL> "In the module!"
WanderingGlitch joined #ruby
<|RicharD|> oki
<|RicharD|> as thinked
<|RicharD|> :)
<|RicharD|> thx
moshee joined #ruby
moshee joined #ruby
<asQuirreL> you know what would be *awesome*
quest88 joined #ruby
<asQuirreL> a program that can read in a css file
<asQuirreL> and make it as efficient as possible
<asQuirreL> so, minimise reptition and the like
<asQuirreL> and make it nice and organised
kennethreitz joined #ruby
ChampS_ joined #ruby
Mohan joined #ruby
<asQuirreL> actually... what would be awesome is a program that could just write the html and css for me
<asQuirreL> and leave me to do the javascript and ruby
<asQuirreL> shevy: I have a project for you...
<shevy> but I have so many already
<asQuirreL> don't we all :P
andrewpthorp joined #ruby
<shevy> asQuirreL hmm
<shevy> yeah but
<shevy> I like these projects!
<asQuirreL> I personally have one web app (RoR), an IRC Bot (ruby), and two two apps
<shevy> hmm
<asQuirreL> but I'm already behind on the schedule for this web app
<shevy> I had an IRC Bot but abandoned it. It was no more fun
<asQuirreL> shevy: this is a second iteration :P
<|RicharD|> where i can find
<|RicharD|> your bot in ruby ?
<|RicharD|> i want learn...reading the code
<asQuirreL> |RicharD|: link ^
<asQuirreL> this one uses a (homemode) eventmachine
<|RicharD|> oki thx
<|RicharD|> anyway now i'm reading a book on ruby
<|RicharD|> with a var @@items_num = 10
<|RicharD|> i have this var in all class right ?
Indian joined #ruby
<Clooth> my face when I discovered rails after working with php for 7 years: http://myfacewhen.com/40/
<|RicharD|> but anlso in children class ?
<asQuirreL> |RicharD|: I don't believe the value is retained across sub-classes
<asQuirreL> so the sub-class will have the variable
<|RicharD|> so
<asQuirreL> but if you modify it in the parent class, the sub-class's value won't change
<asQuirreL> and vice versa
<|RicharD|> so
<|RicharD|> subclass has it
<|RicharD|> when i initialize it
<asQuirreL> |RicharD|: yep, it does
<|RicharD|> but then...every var has different
<|RicharD|> life
<|RicharD|> in the program
<asQuirreL> but if you change it in the parent class
<asQuirreL> it won't change in the sub-class
<|RicharD|> yes ok
<asQuirreL> no, that particular variable is a singleton variable
rpowell joined #ruby
<asQuirreL> so if you make an instance of the parent class
<asQuirreL> and change it in that instance
<asQuirreL> the value changes for all instances of the parent class
<asQuirreL> but not for all instances of the sub-class
<|RicharD|> i hope of learn
<|RicharD|> ruby and then rails fast
<|RicharD|> :D
<asQuirreL> |RicharD|: ahuh, you have that the right way round atleast
<asQuirreL> way back when I tried to learn them
<asQuirreL> I tried to learn rails first
<asQuirreL> and it doesn't really make all that much sense without knowing ruby, because you don't see how rails is achieving the stuff it's doing
var1 joined #ruby
<|RicharD|> i tried but
<|RicharD|> without know ruby
excelsior joined #ruby
<|RicharD|> is stupid
<asQuirreL> |RicharD|: rails doesn't seem logical without knowing ruby
<|RicharD|> and i "know" rails things...i worked with cakephp
<|RicharD|> so i know mvc,helper ecc...
<asQuirreL> |RicharD|: mhmm
<|RicharD|> but i want know ruby for really work on rails
<asQuirreL> well that was the same for me, I'd learnt MVC and delegation from ObjC
<|RicharD|> because is as...use cakephp without know php
timonv joined #ruby
statbot2 joined #ruby
<|RicharD|> objC
<|RicharD|> seems very difficult
<|RicharD|> :(
<asQuirreL> |RicharD|: personally I like it :P
<asQuirreL> I would learn C first though
<|RicharD|> i don't know
<|RicharD|> the syntax :(
<|RicharD|> for me is hard
<asQuirreL> the syntax for ObjC is borrowed from a language called smalltalk
Brozilla joined #ruby
<asQuirreL> syntaxs is normally one of the easier things to overcome when learning a new language
<skyraid> objC has the most hideous syntax of any language ive ever learned
<asQuirreL> the thing I always stumble on is learning the libraries
<skyraid> except maybe for erlang
<asQuirreL> skyraid: have you learnt lisp?
<skyraid> asQuirreL: yeah i really like lisp
<asQuirreL> oh my.
<skyraid> i mean, ruby's whole advantage, more than anything else
<skyraid> is that syntactically and lexically
<shevy> what annoyed me in Obj-C was the interface write up
<asQuirreL> skyraid: what abooout Haskell?
<skyraid> haskell is pretty bad too
<skyraid> insofar as functional languages
<skyraid> i like ocaml, d
<shevy> haskell is only for mathematicians
<skyraid> those are beautiful languages
<asQuirreL> I use haskell :P
<asQuirreL> I love the way haskell works
<skyraid> oh i agree i mean
<skyraid> functional programming is super powerful and haskell is an awesome language
<skyraid> erlang i think has the native actors thing going for it too
<skyraid> its just looking at the code is uneasy on the eyes
<skyraid> they look terrible
<asQuirreL> skyraid: what about...
<asQuirreL> regex? xD
<skyraid> i mean im an old perl dude so like
<asQuirreL> I have some regex that makes your eyes bleed if you look at it for too long
<skyraid> regex is fine for me
<asQuirreL> fine, I'm gonna take out the big guns
<asQuirreL> K
<asQuirreL> I don't see how you can like K
<asQuirreL> there's no way.
<skyraid> lol
<skyraid> tru
<asQuirreL> *phew*
strife25 joined #ruby
statbot2 joined #ruby
jay_lee left #ruby
<asQuirreL> skyraid: /\[([^\[\]]+)\]/ <- mmmm tasty regex
statbot2 joined #ruby
s0ber_ joined #ruby
y3llow_ joined #ruby
statbot2 joined #ruby
<asQuirreL> skyraid: my only problem with regex is that once I've written it, if I forget what it was for, it's such a chore trying to decipher it
<asQuirreL> I mean, can you honestly say you know what this does: /\[([^\[\]]+)\]/ ?
alex__c2022 joined #ruby
jgarvey joined #ruby
<RubyPanther> asQuirreL: it looks fairly straightforwards
<RubyPanther> it's not like you're adding the nastiness to pair them :)
<asQuirreL> RubyPanther: yeah, I rely on regex as little as possible :P
<asQuirreL> I can guarantee the input will always be paired anyway
peterwal_ joined #ruby
apok joined #ruby
statbot2 joined #ruby
<RubyPanther> /\/([^\\\/]+)\\/
peterwal_ joined #ruby
wedgeV joined #ruby
<RubyPanther> good ol' "Trees in a Storm" I think I want a framed print of that for my living room
hinogi joined #ruby
hinogi joined #ruby
bigdata joined #ruby
boodle joined #ruby
Telling- joined #ruby
btanaka joined #ruby
statbot2 joined #ruby
LiquidInsect joined #ruby
incluye joined #ruby
wyhaines joined #ruby
cek joined #ruby
<cek> You may have encountered a bug in the Ruby interpreter or extension libraries.
<cek> /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/libruby.so.1.9 [0x2afb2654d38c] ohyeah!
s_much joined #ruby
malkomalko joined #ruby
<alex__c2022> anyone here uses curb gem with digest auth? An example up somewhere?
jonathanrwallace joined #ruby
fahadsadah joined #ruby
<cek> [2011-12-09 08:49:21] ERROR SignalException: SIGTERM /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:90:in `select'
<cek> oh really? thankyou, i didn't know i want to terminate the server
beaknit left #ruby
bbttxu joined #ruby
nonotza joined #ruby
nonotza left #ruby
akem joined #ruby
akem joined #ruby
yfeldblum joined #ruby
jimmy1980 joined #ruby
strife25 joined #ruby
bigdata joined #ruby
nanoyak joined #ruby
stephenjudkins joined #ruby
nanderoo left #ruby
apucacao joined #ruby
hinogi1 joined #ruby
moshee joined #ruby
moshee joined #ruby
<shevy> BUGS BUGS BUGS
<shevy> AND DRAGONS
brownies joined #ruby
dagnachewa joined #ruby
QKO joined #ruby
vitoravelino joined #ruby
bier joined #ruby
alex__c2022 joined #ruby
syntaxritual joined #ruby
stephenjudkins joined #ruby
tomhsx joined #ruby
syntaxritual joined #ruby
svetzal joined #ruby
<shevy> AND MORE BUGS
dankest joined #ruby
minijupe joined #ruby
bafilius joined #ruby
hinogi joined #ruby
hinogi joined #ruby
mxweas_ joined #ruby
statbot2 joined #ruby
Shamgar joined #ruby
jimmy1980 joined #ruby
bigdata joined #ruby
<kenperkins> is rubyforge down?
eignerchris_ joined #ruby
looopy joined #ruby
cek joined #ruby
Shamgar joined #ruby
<iamjarvo> are there any advantages of me pulling the if out of the loop in this http://pastie.org/2993539
jwmann joined #ruby
jwmann joined #ruby
jwmann joined #ruby
jwmann joined #ruby
fixl joined #ruby
jwmann joined #ruby
jwmann joined #ruby
jwmann joined #ruby
jwmann joined #ruby
jwmann joined #ruby
jwmann joined #ruby
jwmann joined #ruby
jwmann joined #ruby
Cervajz joined #ruby
jwmann joined #ruby
peterwald joined #ruby
kennethreitz joined #ruby
<shevy> iamjarvo, something seems odd
<shevy> what happens when the user types 'BYE'
<iamjarvo> just breaks out the loop
<iamjarvo> i should say bye
eignerchris joined #ruby
<shevy> ok so it breaks out
<shevy> but how does it get to the next condition?
<shevy> the "if sentence_to_grandma == sentence_to_grandma.upcase" part
<iamjarvo> just an else
eignerchris_ joined #ruby
<iamjarvo> if its not uppercase it says hello
<iamjarvo> i mean it says huh
<iamjarvo> shevy: thing is doing a tutorial
fantazo joined #ruby
<iamjarvo> and he has two examples, they way he would do it and they way a person not at his level would
eignerchris joined #ruby
<iamjarvo> and in the noob level they have the if outside and then in his he has everything in the while but refactored a bit
<shevy> I have no idea what you are describing :)
Manhose joined #ruby
<shevy> if it is a loop anyway though, use loop {} and then break out of it via break, if some condition is met
<shevy> and use case/when on your variable input to determine what you want to see happen
<shevy> if foo == "bla"
<shevy> is the same as
<shevy> case foo
<shevy> when "bla"
moshee joined #ruby
LittleBill902 joined #ruby
looopy_ joined #ruby
<iamjarvo> alright so the moral is loop is better in this situation?
ekello joined #ruby
codespectator joined #ruby
RichGuk joined #ruby
<ekello> does anyone know how Ruby compare to C/C++?
<moshee> that's quite an open-ended question
<ekello> I'm just wondering what their differences are in their use
dasfugufish joined #ruby
<ekello> i'll just look around on the internet more i guess
ekello left #ruby
dagnachewa joined #ruby
<iamjarvo> moshee: rubys corde is built on c right?
<iamjarvo> someone had explained it to me
<moshee> the ruby interpreter and a lot of gems are written in C
Pip joined #ruby
<iamjarvo> yea the interpreter
<moshee> C is statically typed and compiled, so it's fast
<moshee> ruby is dynamic and interpreted, so it's quite a bit slower
g0bl1n joined #ruby
baroquebobcat joined #ruby
LittleBill902 joined #ruby
<iamjarvo> o ok
<iamjarvo> thank you
Shamgar joined #ruby
burgestrand joined #ruby
Sailias joined #ruby
Manhose_ joined #ruby
<shevy> iamjarvo who knows what is "better". Perhaps it is not for you. I find "loop {}" beautiful and thus better than "while bla"
cbuxton1 joined #ruby
Helius joined #ruby
<Taos> What makes ruby cool. Im a long time python fan and a short time java user (unfortunatly) why should I be liking ruby :)
<banisterfiend> Taos: blocks
<Taos> Sounds cool
<banisterfiend> Taos: For example, in ruby:
<banisterfiend> loop {
<banisterfiend> puts "print infinitely"
<banisterfiend> }
<banisterfiend> is just a ruby method called 'loop' taking a block, it's not a baked in control structure
<banisterfiend> Taos: in Ruby you can define your own methods that look and behave like control structures, you could even build your own alternative to if/else if you wanted, just using pure ruby
statbot2 joined #ruby
fridim_ joined #ruby
statbot2 joined #ruby
jimmy1980 joined #ruby
sorin joined #ruby
bwright joined #ruby
sorin joined #ruby
<Taos> sounds complicated and pointless
<banisterfiend> Taos: that's a very short sighted thing to say
<banisterfiend> Taos: have you heard of the notion of a DSL ?
<banisterfiend> Taos: where you effectively define your own mini language inside Ruby that more closely corresponds to teh domain you're modeling in your application
<Taos> Well
workmad3 joined #ruby
<Taos> Hmmmm
<moshee> in the case of loop
<moshee> it isn't really very complicated
<davidcelis> MacRuby.... "No rule to make target `install' " ಠ_ಠ
<Taos> On the other hand. Ill learn ruby anyway, for completeness
<moshee> def loop &block; while true; block.call; end; end
<banisterfiend> Taos: so, in Ruby we have sinatra: a DSL for web development, where you can do things like: get '/hi' do; "hello world"; end
<Taos> Sounds kinky
<banisterfiend> Taos: or Rake, which is a DSL for project maintenance, similar to Make utility, it looks like this: task :build => :dependency do; ...; end
<banisterfiend> Taos: and then there is RSpec which is a DSL for testing, and lets you do things like this: describe MyClass do; it 'puts the lotion on its skin' do; girl.puts_lotion_on?.should == true; end; end
sorin joined #ruby
LiquidInsect joined #ruby
<banisterfiend> Taos: So it's not just a 'complicated and pointless', bitch. It's very useful, makes your code a lot more expressive, and gets rid of the boilerplate of kruft that you'd have with other languages as you try to bend that language to model your domain
<Taos> Whoh, call me bitch? Please. But it does sound kinda fun
statbot2 joined #ruby
Lord-Harlot joined #ruby
mikepack joined #ruby
lkba joined #ruby