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 :)
<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
<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
<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]
<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
<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: 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
<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
<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 ...
<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
<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
<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?
<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
<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
<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.
<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.
<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" ?
<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?
<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
<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
<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
<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 █ 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